Job spent nine to eighteen months in torment when the Devil attacked him. Why did God not protect him from Satan's attack? Or did He? Let us take a look at the book of Job and see just what happened.
After this, Job got up and tore his robe and shaved his head. Then he fell to the ground in worship and said: "Naked I came from my mother's womb, and naked I will depart. The LORD gave and the LORD has taken away; may the name of the LORD be praised." In all this, Job did not sin by charging God with wrongdoing. -- Job 1:20-22 (NIV)
Job had just lost his servants, his flocks, his oxen and donkeys, his camels, His whole wealth and even his children, all his family except his wife (who told Job to "Curse God and die.")
Satan returned to God and said; "Skin for skin! …A man will give all he has for his own life. But stretch out your hand and strike his flesh and bones, and he will surely curse you to your face." The LORD said to Satan, "Very well, then, he is in your hands; but you must spare his life." -- Job 2:4-6 (NIV)
Job's neighbors, three friends came by and sat with him. These "friends," such as they were, came to comfort him in his loss. Yet Job never did blame God for his trouble. Job did lament his losses and suffering, even a skin disease. The next 37 chapters of the book of Job, his friends try to get Job to curse God and repent of his sin and maybe even die. The God speaks to Job (chapter 38:1-40:2). God and Job converse, with Job repenting his lack of knowledge of God and His ways. Job's only sin (see chapter 1) was that he was in fear of loss. Satan used this small crack to attack. The result, however, was that Job prayed for his tormenting friends, then God restored double all the property that he lost and also restored his three daughters and his sons (see Job 42:7-17).