Daf 126a (דַּף קכ״ו ע״א)
And the form of his service was that he would take a serpent from among those serpents, and bind it before him (וְשֵׁירוּתָא דְּעוֹבָדוֹי הֲוֵי נָטִיל נָחָשׁ מֵאִינוּן חִוְיָין וְקָטִיר לֵיהּ קַמֵּיהּ), and he would shake its head and bring out its tongue (וּבָזַע רֵישֵׁיהּ וְאַפִּיק לִישָׁנֵיהּ), and he would take known herbs and burn them all (וְנָטִיל עִשְׂבִּין יְדִיעָן וְאוֹקִיד כֹּלָּא), and make from it one incense offering (וְעֲבִיד מִנֵּיהּ קְטַרְתָּא חָדָא); afterward he would take the head of that serpent and shake it to the four directions (לְבָתַר נָטִיל רֵישָׁא דְהַהוּא חִוְיָא וּבְזַע לֵיהּ לְאַרְבַּע סִטְרִין), and make from it another incense offering (וְעֲבִיד מִנֵּיהּ קְטַרְתָּא אָחֳרָא). And he would make a circle, and say words and perform other deeds (וְעֲבִיד עִגּוּלָא חַד, וְהֲוָה אָמַר מִלִּין וְעֲבִיד עוֹבָדִין אָחֳרָנִין), until he would draw upon himself impure spirits (עַד דְּאַמְשִׁיךְ עֲלֵיהּ רוּחִין מְסָאֲבִין), and they would inform him what was needed (וְאוֹדִיעִין לֵיהּ מַה דְּאִצְטְרִיךְ), and he would perform his deeds through them, according to what they knew from the side of that serpent of the firmament (וְעֲבִיד בְּהוּ עוֹבָדוֹי כְּפוּם מַה דְּאִינוּן יָדְעֵי מִסִּטְרָא דְהַהוּא חִוְיָא דִּרְקִיעָא). From there he was drawn into his deeds and sorceries, until he would draw upon himself a spirit from that primordial serpent (מִתַּמָּן אִתְמַשַּׁךְ בְּעוֹבָדוֹי וְחָרָשׁוֹי עַד דְּאַמְשִׁיךְ עֲלֵיהּ רוּחַ מֵהַהוּא נָחָשׁ קַדְמוֹנִי). And from there he knew knowledge and sorceries and divinations (וּמֵהָכָא הֲוָה יָדַע יְדִיעָן וָחֳרָשִׁין וְקוֹסְמִין). And therefore it is written: “But he did not go as at other times to seek enchantments” - indeed enchantments, for his essence and root were in impurity, as it is said (וּבְגִין כָּךְ כְּתִיב וְלא הָלַךְ כְּפַעַם בְּפַעַם לִקְרַאת נְחָשִׁים, נְחָשִׁים וַדַּאי, וְעִקְּרָא וְשָׁרְשָׁא בִּמְסָאֲבוּתָא אִיהוּ כְּמָה דְאִתְּמָר), and afterward, the entirety of his service was only through the serpent (וּלְבָתַר שֵׁירוּתָא דְּכֹלָּא לָאו אִיהוּ אֶלָּא בְּנָחָשׁ).
Rabbi Yosei said: Why is it that all kinds of sorceries and divinations are not found except among women? (אָמַר רַבִּי יוֹסֵי אַמַּאי כָּל זַיְינֵי חֳרָשִׁין וְקוֹסְמִין לָא אִשְׁתַּכָּחוּ אֶלָּא בִּנְשַׁיָּיא). He said to him: Thus I have learned - that when the serpent came upon Chavah, he cast into her pollution (אָמַר לֵיהּ הָכִי אוֹלִיפְנָא מִדַּאֲתָא נָחָשׁ עַל חַוָּה הִטִּיל בָּהּ זוּהֲמָא), in her he cast it and not in her husband (בָּהּ אַטִּיל וְלָא בְּבַעֲלָהּ). He said: So it truly is (אָמַר הָכִי הוּא וַדַּאי). Rabbi Yosei came and kissed Rabbi Yitzchak (אֲתָא רַבִּי יוֹסֵי וּנְשָׁקֵיהּ לְרַבִּי יִצְחָק), and said: How many times have I asked this matter and did not merit it until now (אָמַר כַּמָּה זִמְנִין שָׁאִילְנָא הַאי מִלָּה וְלָא זָכִינָא בָּהּ אֶלָּא הַשְׁתָּא).
He said to him: All these deeds and all that Bil‘am knew - from what place did he learn it? (אָמַר לֵיהּ כָּל הַנֵּי עוֹבָדִין וְכָל מַה דְּיָדַע בִּלְעָם מֵאָן אֲתַר אוֹלִיף לֵיהּ). He said to him: From his father (אָמַר לֵיהּ מֵאֲבוֹי). But in those mountains of the east - which is the land of Kedem - he learned all sorceries and all kinds of divinations (אֲבָל בְּאִינוּן הַרְרֵי קֶדֶם דְּאִיהוּ אֶרֶץ קֶדֶם אוֹלִיף כָּל חֳרָשִׁין וְכָל זִינֵי קוֹסְמִין). For in those mountains are the angels ‘Aza and ‘Aza’el, whom Kudsha Berikh Hu cast down from Heaven, and they are bound in chains of iron, and they reveal sorceries to mankind (בְּגִין דִּבְאִינוּן טוִּרִי אִינוּן מַלְאֲכֵי עֲזָ״א וַעֲזָאֵ״ל, דְּאַפִּיל לוֹן קוּדְשָׁא בְּרִיךְ הוּא מִן שְׁמַיָא וְאִינוּן קְטִירִין בְּשַׁלְשְׁלָאֵי דְפַרְזְלָא וְאוֹדִיעִין חֳרָשִׁין לִבְנֵי נָשָׁא), and from there Bil‘am knew, as it is said: “From Aram Balak brought me, the king of Moav, from the mountains of the east” (Numbers 23) (וּמִתַּמָּן הֲוָה יָדַע בִּלְעָם כְּמָה דְאַתְּ אָמֵר: מִן אֲרָם יַנְחֵנִי בָלָק מֶלֶךְ מוֹאָב מֵהַרְרֵי קֶדֶם).
