8000 Add completed chapter1 · andreffs18/violent-python@1370a25 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1370a25

Browse files
committed
Add completed chapter1
1 parent 7fa7597 commit 1370a25

File tree

9 files changed

+1000593
-0
lines changed

9 files changed

+1000593
-0
lines changed

chapter1/Networking.ipynb

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Networking "
8+
]
9+
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": 21,
13+
"metadata": {},
14+
"outputs": [],
15+
"source": [
16+
"import socket\n",
17+
"\n",
18+
"def get_banner(ip, port):\n",
19+
" \"\"\"Open socket connection to given ip:port and \n",
20+
" read first 1024 bytes from open socket connection\"\"\"\n",
21+
" socket.setdefaulttimeout(2)\n",
22+
" s = socket.socket()\n",
23+
" try:\n",
24+
" s.connect((ip, port))\n",
25+
" ans = s.recv(1024)\n",
26+
" return ans\n",
27+
" except Exception, e:\n",
28+
" print(\"[-] Error {}:{} = {}\".format(ip, port, e))\n",
29+
" return None\n",
30+
" \n",
31+
"def check_vulnerabilities(banner, filename=\"banners.txt\"):\n",
32+
" \"\"\"From given banner, check if from \"filename\" theres is any match\"\"\"\n",
33+
" with open(filename, 'r') as f:\n",
34+
" for line in f.readlines():\n",
35+
" if line.strip('\\n') in banner:\n",
36+
" print \"[+] Server is vulnerable: {}\".format(banner.strip('\\n'))"
37+
]
38+
},
39+
{
40+
"cell_type": "code",
41+
"execution_count": 22,
42+
"metadata": {
43+
"collapsed": true
44+
},
45+
"outputs": [
46+
{
47+
"name": "stdout",
48+
"output_type": "stream",
49+
"text": [
50+
"[-] Error 192.168.1.1:21 = timed out\n",
51+
"[-] Error 192.168.1.1:22 = timed out\n",
52+
"[-] Error 192.168.1.1:25 = timed out\n",
53+
"[-] Error 192.168.1.1:80 = [Errno 64] Host is down\n",
54+
"[-] Error 192.168.1.1:110 = [Errno 64] Host is down\n",
55+
"[-] Error 192.168.1.1:443 = [Errno 64] Host is down\n",
56+
"[-] Error 192.168.1.2:21 = timed out\n",
57+
"[-] Error 192.168.1.2:22 = timed out\n",
58+
"[-] Error 192.168.1.2:25 = timed out\n",
59+
"[-] Error 192.168.1.2:80 = [Errno 64] Host is down\n",
60+
"[-] Error 192.168.1.2:110 = [Errno 64] Host is down\n",
61+
"[-] Error 192.168.1.2:443 = [Errno 64] Host is down\n",
62+
"[-] Error 192.168.1.3:21 = timed out\n",
63+
"[-] Error 192.168.1.3:22 = timed out\n",
64+
"[-] Error 192.168.1.3:25 = [Errno 65] No route to host\n",
65+
"[-] Error 192.168.1.3:80 = [Errno 64] Host is down\n",
66+
"[-] Error 192.168.1.3:110 = [Errno 64] Host is down\n",
67+
"[-] Error 192.168.1.3:443 = [Errno 64] Host is down\n",
68+
"[-] Error 192.168.1.4:21 = timed out\n",
69+
"[-] Error 192.168.1.4:22 = timed out\n",
70+
"[-] Error 192.168.1.4:25 = timed out\n",
71+
"[-] Error 192.168.1.4:80 = [Errno 64] Host is down\n",
72+
"[-] Error 192.168.1.4:110 = [Errno 64] Host is down\n",
73+
"[-] Error 192.168.1.4:443 = [Errno 64] Host is down\n",
74+
"[-] Error 192.168.1.5:21 = timed out\n",
75+
"[-] Error 192.168.1.5:22 = timed out\n",
76+
"[-] Error 192.168.1.5:25 = timed out\n",
77+
"[-] Error 192.168.1.5:80 = [Errno 64] Host is down\n",
78+
"[-] Error 192.168.1.5:110 = [Errno 64] Host is down\n",
79+
"[-] Error 192.168.1.5:443 = [Errno 64] Host is down\n",
80+
"[-] Error 192.168.1.6:21 = timed out\n",
81+
"[-] Error 192.168.1.6:22 = timed out\n",
82+
"[-] Error 192.168.1.6:25 = timed out\n",
83+
"[-] Error 192.168.1.6:80 = [Errno 64] Host is down\n",
84+
"[-] Error 192.168.1.6:110 = [Errno 64] Host is down\n",
85+
"[-] Error 192.168.1.6:443 = [Errno 64] Host is down\n",
86+
"[-] Error 192.168.1.7:21 = timed out\n",
87+
"[-] Error 192.168.1.7:22 = timed out\n",
88+
"[-] Error 192.168.1.7:25 = timed out\n",
89+
"[-] Error 192.168.1.7:80 = [Errno 64] Host is down\n",
90+
"[-] Error 192.168.1.7:110 = [Errno 64] Host is down\n",
91+
"[-] Error 192.168.1.7:443 = [Errno 64] Host is down\n",
92+
"[-] Error 192.168.1.8:21 = timed out\n",
93+
"[-] Error 192.168.1.8:22 = timed out\n",
94+
"[-] Error 192.168.1.8:25 = timed out\n",
95+
"[-] Error 192.168.1.8:80 = [Errno 64] Host is down\n",
96+
"[-] Error 192.168.1.8:110 = [Errno 64] Host is down\n",
97+
"[-] Error 192.168.1.8:443 = [Errno 64] Host is down\n",
98+
"[-] Error 192.168.1.9:21 = timed out\n",
99+
"[-] Error 192.168.1.9:22 = timed out\n",
100+
"[-] Error 192.168.1.9:25 = timed out\n",
101+
"[-] Error 192.168.1.9:80 = [Errno 65] No route to host\n",
102+
"[-] Error 192.168.1.9:110 = [Errno 64] Host is down\n",
103+
"[-] Error 192.168.1.9:443 = [Errno 64] Host is down\n",
104+
"[-] Error 192.168.1.10:21 = timed out\n",
105+
"[-] Error 192.168.1.10:22 = timed out\n",
106+
"[-] Error 192.168.1.10:25 = timed out\n",
107+
"[-] Error 192.168.1.10:80 = [Errno 65] No route to host\n",
108+
"[-] Error 192.168.1.10:110 = [Errno 64] Host is down\n",
109+
"[-] Error 192.168.1.10:443 = [Errno 64] Host is down\n",
110+
"[-] Error 192.168.1.11:21 = timed out\n",
111+
"[-] Error 192.168.1.11:22 = timed out\n",
112+
"[-] Error 192.168.1.11:25 = timed out\n",
113+
"[-] Error 192.168.1.11:80 = [Errno 64] Host is down\n",
114+
"[-] Error 192.168.1.11:110 = [Errno 64] Host is down\n",
115+
"[-] Error 192.168.1.11:443 = [Errno 64] Host is down\n",
116+
"[-] Error 192.168.1.12:21 = timed out\n",
117+
"[-] Error 192.168.1.12:22 = timed out\n",
118+
"[-] Error 192.168.1.12:25 = timed out\n",
119+
"[-] Error 192.168.1.12:80 = timed out\n",
120+
"[-] Error 192.168.1.12:110 = [Errno 64] Host is down\n",
121+
"[-] Error 192.168.1.12:443 = [Errno 64] Host is down\n",
122+
"[-] Error 192.168.1.13:21 = timed out\n",
123+
"[-] Error 192.168.1.13:22 = timed out\n",
124+
"[-] Error 192.168.1.13:25 = timed out\n",
125+
"[-] Error 192.168.1.13:80 = timed out\n",
126+
"[-] Error 192.168.1.13:110 = timed out\n",
127+
"[-] Error 192.168.1.13:443 = [Errno 64] Host is down\n",
128+
"[-] Error 192.168.1.14:21 = timed out\n",
129+
"[-] Error 192.168.1.14:22 = timed out\n",
130+
"[-] Error 192.168.1.14:25 = timed out\n",
131+
"[-] Error 192.168.1.14:80 = timed out\n",
132+
"[-] Error 192.168.1.14:110 = [Errno 64] Host is down\n",
133+
"[-] Error 192.168.1.14:443 = [Errno 64] Host is down\n",
134+
"[-] Error 192.168.1.15:21 = timed out\n",
135+
"[-] Error 192.168.1.15:22 = timed out\n",
136+
"[-] Error 192.168.1.15:25 = timed out\n"
137+
]
138+
},
139+
{
140+
"ename": "KeyboardInterrupt",
141+
"evalue": "",
142+
"output_type": "error",
143+
"traceback": [
144+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
145+
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
146+
"\u001b[0;32m<ipython-input-22-524c9e0ec3ba>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mip\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mip_list\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mport\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mport_list\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 9\u001b[0;31m \u001b[0mbanner\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_banner\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mip\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mport\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 10\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbanner\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"[+] Checking \"\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mip\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;34m\":\"\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mport\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
147+
"\u001b[0;32m<ipython-input-21-5508846065de>\u001b[0m in \u001b[0;36mget_banner\u001b[0;34m(ip, port)\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0ms\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msocket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msocket\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 9\u001b[0;31m \u001b[0ms\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mip\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mport\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 10\u001b[0m \u001b[0mans\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0ms\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1024\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mans\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
148+
"\u001b[0;32m/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.pyc\u001b[0m in \u001b[0;36mmeth\u001b[0;34m(name, self, *args)\u001b[0m\n\u001b[1;32m 226\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 228\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_sock\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 229\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 230\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0m_m\u001b[0m \u001b[0;32min\u001b[0m \u001b[0m_socketmethods\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
149+
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
150+
]
151+
}
152+
],
153+
"source": [
154+
"# main()\n",
155+
"# generate list of all possible ip's on subnet 192.168.1.0/24\n",
156+
"ip_list = map(lambda ip: \"192.168.1.{}\".format(ip), range(1, 255))\n",
157+
"# test ports telnet, ssh, smtp, http, imap and https\n",
158+
"port_list = [21, 22, 25, 80, 110, 443]\n",
159+
"\n",
160+
"for ip in ip_list:\n",
161+
" for port in port_list:\n",
162+
" banner = get_banner(ip, port)\n",
163+
" if banner:\n",
164+
" print(\"[+] Checking \" + ip + \":\" + port)\n",
165+
" check_vulnerabilities(banner)"
166+
]
167+
},
168+
{
169+
"cell_type": "code",
170+
"execution_count": null,
171+
"metadata": {},
172+
"outputs": [],
173+
"source": []
174+
}
175+
],
176+
"metadata": {
177+
"kernelspec": {
178+
"display_name": "Python 2",
179+
"language": "python",
180+
"name": "python2"
181+
},
182+
"language_info": {
183+
"codemirror_mode": {
184+
"name": "ipython",
185+
"version": 2
186+
},
187+
"file_extension": ".py",
188+
"mimetype": "text/x-python",
189+
"name": "python",
190+
"nbconvert_exporter": "python",
191+
"pygments_lexer": "ipython2",
192+
"version": "2.7.10"
193+
}
194+
},
195+
"nbformat": 4,
196+
"nbformat_minor": 2
197+
}

chapter1/Unix Password Cracker.ipynb

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Unix password cracker"
8+
]
9+
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": 9,
13+
"metadata": {},
14+
"outputs": [],
15+
"source": [
16+
"import crypt\n",
17+
"from tqdm import tqdm\n",
18+
"\n",
19+
"def test_password(crypt_pass):\n",
20+
" \"\"\"From given cryptografic password we can find a match on our\n",
21+
" dictionary.txt \"database\" \"\"\"\n",
22+
" salt = crypt_pass[:2]\n",
23+
" with open('dictionary.txt', 'r') as dictionary:\n",
24+
" for word in tqdm(dictionary.readlines()):\n",
25+
" word = word.strip()\n",
26+
" crypt_test = crypt.crypt(word, salt)\n",
27+
" if crypt_pass == crypt_test:\n",
28+
" print(\"[+] Found password: \\\"{}\\\"\".format(word))\n",
29+
" return word\n",
30+
" print(\"[-] Password not found.\")\n",
31+
" return"
32+
]
33+
},
34+
{
35+
"cell_type": "code",
36+
"execution_count": 10,
37+
"metadata": {},
38+
"outputs": [
39+
{
40+
"name": "stderr",
41+
"output_type": "stream",
42+
"text": [
43+
" 1%|▏ | 13946/999999 [00:00<00:07, 139408.28it/s]"
44+
]
45+
},
46+
{
47+
"name": "stdout",
48+
"output_type": "stream",
49+
"text": [
50+
"[*] Cracking Password For: nobody\n"
51+
]
52+
},
53+
{
54+
"name": "stderr",
55+
"output_type": "stream",
56+
"text": [
57+
"100%|██████████| 999999/999999 [00:06<00:00, 158194.85it/s]\n",
58+
" 1%|▏ | 13700/999999 [00:00<00:07, 136820.72it/s]"
59+
]
60+
},
61+
{
62+
"name": "stdout",
63+
"output_type": "stream",
64+
"text": [
65+
"[-] Password not found.\n",
66+
"[*] Cracking Password For: victim\n"
67+
]
68+
},
69+
{
70+
"name": "stderr",
71+
"output_type": "stream",
72+
"text": [
73+
"100%|██████████| 999999/999999 [00:06<00:00, 149624.83it/s]\n",
74+
" 1%|▏ | 12507/999999 [00:00<00:07, 124889.97it/s]"
75+
]
76+
},
77+
{
78+
"name": "stdout",
79+
"output_type": "stream",
80+
"text": [
81+
"[-] Password not found.\n",
82+
"[*] Cracking Password For: root\n"
83+
]
84+
},
85+
{
86+
"name": "stderr",
87+
"output_type": "stream",
88+
"text": [
89+
" 18%|█▊ | 183811/999999 [00:01<00:05, 139715.73it/s]\n",
90+
" 1%|▏ | 14027/999999 [00:00<00:07, 140225.00it/s]"
91+
]
92+
},
93+
{
94+
"name": "stdout",
95+
"output_type": "stream",
96+
"text": [
97+
"[+] Found password: \"youwin\"\n",
98+
"[*] Cracking Password For: root\n"
99+
]
100+
},
101+
{
102+
"name": "stderr",
103+
"output_type": "stream",
104+
"text": [
105+
"100%|██████████| 999999/999999 [00:07<00:00, 137771.37it/s]\n",
106+
" 0%| | 0/999999 [00:00<?, ?it/s]"
107+
]
108+
},
109+
{
110+
"name": "stdout",
111+
"output_type": "stream",
112+
"text": [
113+
"[-] Password not found.\n",
114+
"[*] Cracking Password For: daemon\n"
115+
]
116+
},
117+
{
118+
"name": "stderr",
119+
"output_type": "stream",
120+
"text": [
121+
" 6%|▌ | 62287/999999 [00:00<00:07, 124557.07it/s]\n"
122+
]
123+
},
124+
{
125+
"ename": "KeyboardInterrupt",
126+
"evalue": "",
127+
"output_type": "error",
128+
"traceback": [
129+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
130+
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
131+
"\u001b[0;32m<ipython-input-10-8de7c99f0b79>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mcrypt_pass\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mline\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m':'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstrip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m' '\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"[*] Cracking Password For: {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0muser\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mtest_password\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcrypt_pass\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
132+
"\u001b[0;32m<ipython-input-9-2f1ba6ae414e>\u001b[0m in \u001b[0;36mtest_password\u001b[0;34m(crypt_pass)\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mword\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mtqdm\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdictionary\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreadlines\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0mword\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mword\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstrip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 11\u001b[0;31m \u001b[0mcrypt_test\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcrypt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcrypt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mword\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msalt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 12\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mcrypt_pass\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mcrypt_test\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"[+] Found password: \\\"{}\\\"\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mword\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
133+
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
134+
]
135+
}
136+
],
137+
"source": [
138+
"with open('passwords.txt') as unknown_passwords:\n",
139+
" for line in unknown_passwords.readlines():\n",
140+
" if \":\" in line:\n",
141+
" user = line.split(':')[0]\n",
142+
" crypt_pass = line.split(':')[1].strip(' ')\n",
143+
" print(\"[*] Cracking Password For: {}\".format(user))\n",
144+
" test_password(crypt_pass)\n"
145+
]
146+
},
147+
{
148+
"cell_type": "code",
149+
"execution_count": null,
150+
"metadata": {},
151+
"outputs": [],
152+
"source": []
153+
}
154+
],
155+
"metadata": {
156+
"kernelspec": {
157+
"display_name": "Python 2",
158+
"language": "python",
159+
"name": "python2"
160+
},
161+
"language_info": {
162+
"codemirror_mode": {
163+
"name": "ipython",
164+
"version": 2
165+
},
166+
"file_extension": ".py",
167+
"mimetype": "text/x-python",
168+
"name": "python",
169+
"nbconvert_exporter": "python",
170+
"pygments_lexer": "ipython2",
171+
"version": "2.7.10"
172+
}
173+
},
174+
"nbformat": 4,
175+
"nbformat_minor": 2
176+
}

0 commit comments

Comments
 (0)
0