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

Update wifijammer #133

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
13 changes: 7 additions & 6 deletions wifijammer
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import fcntl
Expand All @@ -13,6 +13,7 @@ import sys
import os
from scapy.all import *
import logging

logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up Scapy
conf.verb = 0 # Scapy I thought I told you to shut up

Expand Down Expand Up @@ -157,7 +158,7 @@ def get_iface(interfaces):
for iface in interfaces:
count = 0
proc = Popen(['iwlist', iface, 'scan'], stdout=PIPE, stderr=DN)
for line in proc.communicate()[0].split('\n'):
for line in proc.communicate()[0].decode().split('\n'):
if ' - Address:' in line: # first line in iwlist scan for a new AP
count += 1
scanned_aps.append((count, iface))
Expand Down Expand Up @@ -237,7 +238,7 @@ def channel_hop(mon_iface, args):
print('['+R+'-'+W+'] Could not execute "iw"')
os.kill(os.getpid(), SIGINT)
sys.exit(1)
for line in proc.communicate()[1].split('\n'):
for line in proc.communicate()[1].decode().split('\n'):
if len(line) > 2: # iw dev shouldnt display output unless there's an error
err = '['+R+'-'+W+'] Channel hopping failed: '+R+line+W

Expand Down Expand Up @@ -368,7 +369,7 @@ def cb(pkt):
# Filter out all other APs and clients if asked
if args.accesspoint:
# track bssid for essid
if (pkt.haslayer(Dot11Beacon) or pkt.haslayer(Dot11ProbeResp)) and pkt[Dot11Elt].info in args.accesspoint:
if (pkt.haslayer(Dot11Beacon) or pkt.haslayer(Dot11ProbeResp)) and pkt[Dot11Elt].info.decode() in args.accesspoint:
args.accesspoint.add(pkt[Dot11].addr3.lower())
# bail if bssid is not in target list
if not args.accesspoint.intersection([pkt.addr1.lower(), pkt.addr2.lower()]):
Expand All @@ -394,11 +395,11 @@ def cb(pkt):


def APs_add(clients_APs, APs, pkt, chan_arg, world_arg):
ssid = pkt[Dot11Elt].info
ssid = pkt[Dot11Elt].info.decode()
bssid = pkt[Dot11].addr3.lower()
try:
# Thanks to airoscapy for below
ap_channel = str(ord(pkt[Dot11Elt:3].info))
ap_channel = str(pkt[Dot11Elt:3].info[0])
chans = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'] if not args.world else [
'1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13']
if ap_channel not in chans:
Expand Down