Skip to content

Commit 6e34803

Browse files
author
root
committed
Added Support for Multiple Scapy Version
1 parent 3cc7585 commit 6e34803

4 files changed

Lines changed: 39 additions & 16 deletions

File tree

wifibroot.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def __init__(self, iface, bssid=None, essid=None):
157157
self.bssid = bssid
158158
self.essid = essid
159159
self.shift = Shifter(self.iface1.iface, self.bssid, self.essid, V__)
160-
self.sig = signal(SIGINT, self.break_shifter)
160+
signal(SIGINT, self.break_shifter)
161161
self.aps()
162162

163163
def aps(self):
@@ -179,7 +179,6 @@ def break_shifter(self, sig, frame):
179179
del self.screen
180180

181181
__HEADERS = [color.BOLD+'NO', 'ESSID', 'PWR', 'ENC', 'CIPHER', 'AUTH', 'CH', 'BSSID'+color.END]
182-
self.sig = signal(SIGINT, lambda sig, frame: sys.exit())
183182
tabulator__ = []
184183
###
185184
__sig_LIST = []
@@ -199,6 +198,7 @@ def break_shifter(self, sig, frame):
199198
tabulator__.append([ap['count'], ap['essid'], ap['pwr'], ap['auth'], ap['cipher'], \
200199
ap['psk'], ap['channel'], ap['bssid'].upper()])
201200
print "\n"+tabulate(tabulator__, headers=__HEADERS)+"\n"
201+
os.kill(os.getpid(), SIGINT)
202202

203203
class Phazer:
204204

@@ -279,15 +279,15 @@ def h_crack(self, ap, p_to_h):
279279
pols = gen.get_pols()
280280
self.call_PSK(pols, ap['essid'], ap['auth'])
281281

282-
def d_h_crack(self, ap):
282+
def d_h_crack(self, ap, timeout):
283283
global WRITE__
284284

285285
y_h = False
286286

287287
while not y_h:
288288

289-
pull.up('Locating Clients from AP to generate handshake. Sleeping for 20 Seconds. ')
290-
self.sniper = Sniper(self.iface, ap['bssid'], ap['essid'], ap['channel'])
289+
pull.up('Locating Clients from AP to generate handshake. Sleeping for %d Seconds. ' % timeout)
290+
self.sniper = Sniper(self.iface, ap['bssid'], ap['essid'], ap['channel'], timeout)
291291
self.sniper.cl_generator()
292292
cls__ = self.sniper.clients()
293293
pull.info('Clients Detected. Number of Connected Users: %d' % len(cls__))
@@ -353,6 +353,7 @@ def main():
353353
parser.add_option('-d', '--dictionary', dest='dictionary', help="Dictionary containing Passwords")
354354
parser.add_option('', '--newhandshake', dest='newhandshake', default=False, action="store_true", help="Discard previous handshake and capture new one. ")
355355
parser.add_option('-n', '--nowrite', dest="write", default=True, action="store_false", help="Do not Save the Captured Handshakes")
356+
parser.add_option('-t', '--timeout', dest="timeout", default=20, help="Specify timeout for locating target clients. ")
356357
parser.add_option('-v', '--verbose', dest="verbose", default=False, action="store_true", help="Print hashes and verbose messages. ")
357358

358359
(options, args) = parser.parse_args()
@@ -410,6 +411,7 @@ def main():
410411

411412
phaser = Phazer(sniffer)
412413
target = phaser.get_input()
414+
signal(SIGINT, lambda sig, frame: sys.exit())
413415
pull.info("You've choosed \"%s\" with encryption %s" % (target['essid'], target['auth']))
414416
if not phaser.verify_h_crack(target['bssid'])[0] or NEW_HAND == True:
415417
if NEW_HAND:
@@ -418,7 +420,7 @@ def main():
418420
pull.delete('Discarded Previous Handshake for "%s"' % (color.BOLD+target['essid']+color.END))
419421
else:
420422
pull.info('Attempting to Capture new handshake for "%s"' % (color.BOLD+target['essid']+color.END))
421-
phaser.d_h_crack(target)
423+
phaser.d_h_crack(target, int(options.timeout))
422424
else:
423425
pull.use("We've already got the handshake for this network. Attempting to Crack it.")
424426
phaser.h_crack(target, phaser.verify_h_crack(target['bssid'])[1])

wireless/cracker.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

22
from scapy.layers.dot11 import Dot11
33
from scapy.layers.dot11 import Dot11Beacon
4-
from scapy.layers.dot11 import Raw
5-
from scapy.layers.dot11 import EAPOL
4+
from scapy.layers.dot11 import Raw
65
from pull import Pully
76
from pbkdf2 import PBKDF2
87
from screen import Display
@@ -14,7 +13,10 @@
1413
import sys
1514
import time
1615
import string
17-
16+
try:
17+
from scapy.layers.dot11 import EAPOL
18+
except ImportError: # Support for new versions
19+
from scapy.layers.eap import EAPOL
1820

1921
pull = Pully()
2022

wireless/shifter.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# Shifter.py
22

3-
import re
4-
from scapy.layers.dot11 import EAPOL, Dot11Beacon, Dot11, Dot11Elt
3+
from scapy.layers.dot11 import Dot11Beacon
4+
from scapy.layers.dot11 import Dot11
5+
from scapy.layers.dot11 import Dot11Elt
56
from scapy.layers.dot11 import RadioTap
6-
from scapy.all import sniff, conf
7-
from scapy.utils import PcapWriter, rdpcap
7+
from scapy.sendrecv import sniff
8+
from scapy.config import conf
9+
from scapy.utils import PcapWriter
10+
from scapy.utils import rdpcap
11+
import re
12+
try:
13+
from scapy.layers.dot11 import EAPOL
14+
except ImportError:
15+
from scapy.layers.eap import EAPOL
816

917
class Shifter:
1018

wireless/sniper.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11

2-
from scapy.all import *
2+
from scapy.sendrecv import sniff
3+
from scapy.sendrecv import sendp
4+
from scapy.config import conf
5+
from scapy.layers.dot11 import Dot11
6+
from scapy.layers.dot11 import RadioTap
7+
from scapy.layers.dot11 import Raw
8+
from scapy.layers.dot11 import Dot11Deauth
39
import signal
410
import sys
511
import time
612
import threading
713
import exceptions
814
import binascii
915
import os
16+
try:
17+
from scapy.layers.dot11 import EAPOL
18+
except ImportError:
19+
from scapy.layers.eap import EAPOL
1020

1121
class Sniper:
1222

@@ -17,12 +27,13 @@ class Sniper:
1727
__c_TGT = ''
1828
out__ = ['33:33:00:00:00:16', '33:33:ff:9d:df:fd', 'ff:ff:ff:ff:ff:ff', ]
1929

20-
def __init__(self, iface_instance, bssid, essid, channel):
30+
def __init__(self, iface_instance, bssid, essid, channel, timeout):
2131
self.iface_instance = iface_instance
2232
self.iface = self.iface_instance.iface
2333
self.bssid = bssid
2434
self.essid = essid
2535
self.ch = channel
36+
self.timeout = timeout
2637
self.channel_shifter = self.channel_shifter(self.ch)
2738

2839
def __str__(self):
@@ -40,7 +51,7 @@ def sniff_breaker(self, sig, frame):
4051
def cl_generator(self):
4152
signal.signal(signal.SIGINT, self.sniff_breaker)
4253
try:
43-
sniff(iface=self.iface, prn=self.cl_generator_replay, timeout=20)
54+
sniff(iface=self.iface, prn=self.cl_generator_replay, timeout=self.timeout)
4455
except ValueError:
4556
pass
4657
finally:

0 commit comments

Comments
 (0)