I think Revelation 12:1-5 seems to be referring to Lucifer’s rebellion in Heaven(along with a third of the angels); and his attempt to destroy the Son of God as soon as He is manifest in human form:
Revelation 12:1-5 Now a great sign appeared in heaven: a woman clothed with the sun, with the moon under her feet, and on her head a garland of twelve stars. 2 Then being with child, she cried out in labor and in pain to give birth. 3 And another sign appeared in heaven: behold, a great, fiery red dragon having seven heads and ten horns, and seven diadems on his heads. 4 His tail drew a third of the stars of heaven and threw them to the earth. And the dragon stood before the woman who was ready to give birth, to devour her Child as soon as it was born. 5 She bore a male Child who was to rule all nations with a rod of iron. And her Child was caught up to God and His throne.
It seems that John is not writing in chronological order because in verse 7 he is writing about when Lucifer was first thrown to the earth, along with those angels that rebelled with him:
Revelation 12:7-8 And war broke out in heaven: Michael and his angels fought with the dragon; and the dragon and his angels fought, 8 but they did not prevail, nor was a place found for them in heaven any longer.
We know that Satan was defeated in Heaven, we know that he was defeated when Jesus was born, lived a sinless life, was crucified, and rose on the third day. Satan was and remains defeated; however, he has waged war against all the saints (followers of Jesus Christ). Satan is allowed to accuse the brethren before God day and night. WOW! Satan is allowed to accuse the brethren before God day and night!?!
Revelation 12:9-10 So the great dragon was cast out, that serpent of old, called the Devil and Satan, who deceives the whole world; he was cast to the earth, and his angels were cast out with him. 10 Then I heard a loud voice saying in heaven, "Now salvation, and strength, and the kingdom of our God, and the power of His Christ have come, for the accuser of our brethren, who accused them before our God day and night, has been cast down.
But the accusations amount to nothing because those that put their trust in Jesus Christ and His Blood Sacrifice love Him more than they love their own life and are willing to demonstrate that faith and love unto death if necessary:
Revelation 12:11 And they overcame him by the blood of the Lamb and by the word of their testimony, and they did not love their lives to the death.
Does this mean Satan has given up and is curled up in his bottomless pit? Not a chance!
Revelation 12:12 Therefore rejoice, O heavens, and you who dwell in them! Woe to the inhabitants of the earth and the sea! For the devil has come down to you, having great wrath, because he knows that he has a short time."
Revelation 12:17 And the dragon was enraged with the woman, and he went to make war with the rest of her offspring, who keep the commandments of God and have the testimony of Jesus Christ.
1Peter 5:6-9 Therefore humble yourselves under the mighty hand of God, that He may exalt you in due time, 7 casting all your care upon Him, for He cares for you. 8 Be sober, be vigilant; because your adversary the devil walks about like a roaring lion, seeking whom he may devour. 9 Resist him, steadfast in the faith, knowing that the same sufferings are experienced by your brotherhood in the world.