Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library synchronizations #12

Merged
merged 4 commits into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ python3 ./airpwn-ng -i wlan0 --inj man -m wlan1mon --injection payloads/demo --c
```

### WPA
Can be implemented with one NIC in monitor mode.
Can be implemented with one NIC in monitor mode; use WEP workaround if needed.
```
python2 -m pip install _python2/RESOURCEs/*.tar.gz
cd _python2
Expand Down
Binary file removed RESOURCEs/packetEssentials-1.8.2.tar.gz
Binary file not shown.
Binary file added RESOURCEs/packetEssentials-1.8.4.tar.gz
Binary file not shown.
94 changes: 45 additions & 49 deletions lib/sniffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,44 +122,28 @@ def threaded_sniff(self, args):
sniffer = Thread(target = self.sniff, args = (q,))
sniffer.daemon = True
sniffer.start()
warningTimer = 0

## Sniffing in Monitor Mode for Open wifi
if args.mon == 'mon' and not args.wep and not args.wpa:

"""
It is worth bringing up an error which should not occur, but does

File "./airpwn-ng", line 210, in <module>
main(args)
File "./airpwn-ng", line 137, in main
style.handler(args)
File "/stuffz/bin/hub/myHub/_wifi/airpwn-ng/lib/styles.py", line 33, in handler
snif.threaded_sniff(args) ## Here
File "/stuffz/bin/hub/myHub/_wifi/airpwn-ng/lib/sniffer.py", line 178, in threaded_sniff
if pkt[Dot11].FCfield == 1 and len(pkt) >= int(args.s):
File "/usr/local/lib/python3.8/dist-packages/scapy/packet.py", line 1185, in __getitem__
raise IndexError("Layer [%s] not found" % lname)
IndexError: Layer [Dot11] not found

Not sure why [Dot11] doesn't exist...
"""

## BSSID filtering and Speedpatch
if args.bssid and not args.b:
print('Speedpatch && BSSID filtering\n** Mode broken ~ wait for patch')
exit(0)
while True:
try:
x = q.qsize()
if x > self.bp:
print(' {0} backpressure warning'.format(q.qsize()))
pkt = q.get(timeout = 1)
if pkt[Dot11].addr1 == args.bssid and pkt[Dot11].FCfield == 1 and len(pkt) >= int(args.s):
self.handler(q, self.m, pkt, args)
else:
pass
except Empty:
pass
# warningTimer = 0
# while True:
# try:
# x = q.qsize()
# if x > self.bp:
# print(' {0} backpressure warning'.format(q.qsize()))
# pkt = q.get(timeout = 1)
# if pkt[Dot11].addr1 == args.bssid and pkt[Dot11].FCfield == 1 and len(pkt) >= int(args.s):
# self.handler(q, self.m, pkt, args)
# else:
# pass
# except Empty:
# pass

## NO Speedpatch and NO BSSID filtering
elif args.b and not args.bssid:
Expand All @@ -168,7 +152,9 @@ def threaded_sniff(self, args):
try:
x = q.qsize()
if x > self.bp:
print(' {0} backpressure warning'.format(q.qsize()))
if time.time() - warningTimer > 5:
print(' {0} backpressure warning'.format(q.qsize()))
warningTimer = time.time()
pkt = q.get(timeout = 1)
if (pkt[Dot11].FCfield == 1 or pkt[Dot11].FCfield == 2) and len(pkt) >= int(args.s):
self.handler(q, self.m, pkt, args)
Expand All @@ -181,19 +167,19 @@ def threaded_sniff(self, args):
elif args.bssid and args.b:
print('No Speedpatch && BSSID filtering\n** Mode broken ~ wait for patch')
exit(0)
while True:
try:
x = q.qsize()
if x > self.bp:
print(' {0} backpressure warning'.format(q.qsize()))
pkt = q.get(timeout = 1)
if (pkt[Dot11].addr1 == args.bssid and pkt[Dot11].FCfield == 1 and len(pkt) >= int(args.s)) or\
(pkt[Dot11].addr2 == args.bssid and pkt[Dot11].FCfield == 2 and len(pkt) >= int(args.s)):
self.handler(q, self.m, pkt, args)
else:
pass
except Empty:
pass
# while True:
# try:
# x = q.qsize()
# if x > self.bp:
# print(' {0} backpressure warning'.format(q.qsize()))
# pkt = q.get(timeout = 1)
# if (pkt[Dot11].addr1 == args.bssid and pkt[Dot11].FCfield == 1 and len(pkt) >= int(args.s)) or\
# (pkt[Dot11].addr2 == args.bssid and pkt[Dot11].FCfield == 2 and len(pkt) >= int(args.s)):
# self.handler(q, self.m, pkt, args)
# else:
# pass
# except Empty:
# pass

## Speedpatch and NO BSSID filtering
else:
Expand All @@ -202,7 +188,9 @@ def threaded_sniff(self, args):
try:
x = q.qsize()
if x > self.bp:
print(' {0} backpressure warning'.format(q.qsize()))
if time.time() - warningTimer > 5:
print(' {0} backpressure warning'.format(q.qsize()))
warningTimer = time.time()
pkt = q.get(timeout = 1)
if pkt[Dot11].FCfield == 1 and len(pkt) >= int(args.s):
self.handler(q, self.m, pkt, args)
Expand All @@ -219,7 +207,9 @@ def threaded_sniff(self, args):
try:
x = q.qsize()
if x > self.bp:
print(' {0} backpressure warning'.format(q.qsize()))
if time.time() - warningTimer > 5:
print(' {0} backpressure warning'.format(q.qsize()))
warningTimer = time.time()
pkt = q.get(timeout = 1)
if pkt[Dot11].addr1 == args.bssid and pkt[Dot11].FCfield == 65 and len(pkt) >= int(args.s):
self.handler(q, self.m, pkt, args)
Expand All @@ -235,7 +225,9 @@ def threaded_sniff(self, args):
try:
x = q.qsize()
if x > self.bp:
print(' {0} backpressure warning'.format(q.qsize()))
if time.time() - warningTimer > 5:
print(' {0} backpressure warning'.format(q.qsize()))
warningTimer = time.time()
pkt = q.get(timeout = 1)
if (pkt[Dot11].addr1 == args.bssid and pkt[Dot11].FCfield == 65 and len(pkt) >= int(args.s)) or (pkt[Dot11].addr2 == args.bssid and pkt[Dot11].FCfield == 66 and len(pkt) >= int(args.s)):
self.handler(q, self.m, pkt, args)
Expand All @@ -254,7 +246,9 @@ def threaded_sniff(self, args):
try:
x = q.qsize()
if x > self.bp:
print(' {0} backpressure warning'.format(q.qsize()))
if time.time() - warningTimer > 5:
print(' {0} backpressure warning'.format(q.qsize()))
warningTimer = time.time()
pkt = q.get(timeout = 1)

if pkt.haslayer(EAPOL):
Expand Down Expand Up @@ -287,7 +281,9 @@ def threaded_sniff(self, args):
try:
x = q.qsize()
if x > self.bp:
print(' {0} backpressure warning'.format(q.qsize()))
if time.time() - warningTimer > 5:
print(' {0} backpressure warning'.format(q.qsize()))
warningTimer = time.time()
pkt = q.get(timeout = 1)
if pkt.haslayer(EAPOL):
self.shake.eapolGrab(pkt)
Expand Down