Q. Who afflicted Job? Was it Satan or God?
A. As I have explained in an earlier Q&A about whether God is the author of sin, God is the ultimate and first cause of everything, but He is not the immediate cause of all things. That is, He uses secondary means.
With this in mind, let's read Job 1:11. Satan says to God, "But put forth thine hand now, and touch all that he hath, and he will curse thee to thy face." Whose hand is to be put forth? God's. And how does God respond? "And the LORD said unto Satan, Behold, all that he hath is in thy power; only upon himself put not forth thine hand. So Satan went forth from the presence of the LORD" (verse 12). Satan is God's hand to touch Job. He is God's secondary means.
Job 2:3 says, "And the LORD said unto Satan, Hast thou considered my servant Job, that there is none like him in the earth, a perfect and an upright man, one that feareth God, and escheweth evil? and still he holdeth fast his integrity, although thou movedst me against him, to destroy him without cause." Carefully notice the phrase, "thou movedst me against him, to destroy him." "Thou" refers to Satan. "Me" refers to God. "Him" refers to Job. Who acted against Job? God, although the earlier verses explain that He used Satan to do it.
Now look at Job 2:5-7: "But put forth thine hand now, and touch his bone and his flesh, and he will curse thee to thy face. And the LORD said unto Satan, Behold, he is in thine hand; but save his life. So went Satan forth from the presence of the LORD, and smote Job with sore boils from the sole of his foot unto his crown." Notice the parallel brought out between God's hand and Satan's hand. Satan was God's tool.
Certainly, the Bible always shows evil coming from Satan or from people because, as it comes directly from God, the act is not evil. God's having Satan afflict Job resulted in blessings for Job (Job 42:12-17). The Bible has many such examples. One involves Judas. From eternity, God determined that Judas would betray Jesus. This determination was not evil; it was good because of the good results. But when Judas did it, it was evil for Judas.
From eternity, God determined that Joseph's brothers would sell him into slavery. For them, it was evil, but it was not evil for God. Read Joseph's words in Genesis 50:20: "But as for you, ye thought evil against me; but God meant it unto good, to bring to pass, as it is this day, to save much people alive." The words "thought" and "meant" in this verse are translated from the same Hebrew word. It means "weave," "fabricate," "plot," "compute," "invent," or "devise." Joseph's brothers devised what they did to Joseph for evil. But God had devised it for good.
By the way, nothing is said about God "allowing" it. He devised it. The popular notion that God does not determine evil but that He "allows" it is a myth that is not found in the Bible. It was invented by people who thought that if God determined evil He would be committing sin. But it is based on ignorance and would not get God off the hook anyway. If I had the power to save someone from a murderer, but I allowed the murder to take place anyway, wouldn't I be guilty of sin? Of course. The same charge could be laid against an all-powerful God who allowed evil. That is, it could if God were like humans. But He is not. Neither God's "allowing" (which is not the way it really happens) nor His determining evil is evil for God who is the standard of right and wrong, who works everything (even what we see as evil) for good, who is above all laws that define evil, and who can do with His creation as He sees fit.
So, who afflicted Job? Directly, it was Satan, but ultimately, it was God acting in love for His servant Job's ultimate good.