Luke 3:1-22 1 Then, in the fifteenth year of the reign of Tiberius Caesar, Pontius Pilate being procurator of Judea, and Herod tetrarch of Galilee, and his brother Philip tetrarch of Ituraea and of the region of Trachonitis, and Lysanias tetrarch of Abilene, 2 under the high priests Annas and Caiaphas: the word of the Lord came to John, the son of Zechariah, in the wilderness. 3 And he went into the entire region of the Jordan, preaching a baptism of repentance for the remission of sins, 4 just as it has been written in the book of the sermons of the prophet Isaiah: "The voice of one crying out in the wilderness: Prepare the way of the Lord. Make straight his paths. 5 Every valley shall be filled, and every mountain and hill shall be brought low. And what is crooked shall be made straight. And the rough paths shall be made into level ways. 6 And all flesh shall see the salvation of God." 7 Therefore, he said to the crowd that went out in order to be baptised by him: "You brood of vipers! Who told you to flee from the approaching wrath? 8 So then, produce fruits worthy of repentance. And do not begin to say, "We have Abraham as our father." For I tell you that God has the power to raise up sons to Abraham from these stones. 9 For even now the axe has been placed at the root of the trees. Therefore, every tree that does not produce good fruit shall be cut down and cast into the fire." 10 And the crowed was questioning him, saying, "What then should we do?" 11 But in response, he said to them: "Whoever has two coats, let him give to those who do not have. And whoever has food, let him act similarly." 12 Now the tax collectors also came to be baptised, and they said to him, "Teacher, what should we do?" 13 But he said to them, "You should do nothing more than what has been appointed to you." 14 Then the soldiers also questioned him, saying, "And what should we do?" And he said to them: "You should strike no one, and you should not make false accusations. And be content with your pay." 15 Now all were thinking about John in their hearts, and the people were supposing that perhaps he might be the Christ. 16 John responded by saying to everyone: "Indeed, I baptise you with water. But there will arrive one stronger than me, the laces of whose shoes I am not worthy to loosen. He will baptise you in the Holy Spirit, and with fire. 17 His winnowing fan is in his hand. And he will purify his threshing floor. And he will gather the wheat into the barn. But the chaff he will burn with unquenchable fire." 18 Indeed, he also proclaimed many other things, exhorting the people. 19 But Herod the tetrarch, when he was corrected by him concerning Herodias, his brother"s wife, and concerning all the evils that Herod had done, 20 added this also, above all else: that he confined John to prison. 21 Now it happened that, when all the people were being baptised, Jesus was baptised; and as he was praying, heaven was opened. 22 And the Holy Spirit, in a corporal appearance like a dove, descended upon him. And a voice came from heaven: "You are my beloved Son. In you, I am well pleased."
"You brood of vipers! Who told you to flee from the approaching wrath? So then, produce fruits worthy of repentance. And do not begin to say, "We have Abraham as our father." For I tell you that God has the power to raise up sons to Abraham from these stones. For even now the axe has been placed at the root of the trees. Therefore, every tree that does not produce good fruit shall be cut down and cast into the fire."
Maybe he wanted to shake them from their confidence in their ancestry. As descendants of Abraham they may have presumed that they were assured of salvation because of the promises God made to Abraham about his descendants. So if John wanted to disabuse them of confidence in their ancestry what better way to go about it than with shock treatment. I think he was aiming to get them to repent of their sins.