Skip to content

Commit 0d7d85d

Browse files
authored
Merge pull request #19 from stryngs/main
Release 2.0.6
2 parents c0ea1ee + 70c23e4 commit 0d7d85d

16 files changed

+165
-138
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ airpwn-ng is based on the concepts laid out in [Airpwn](http://airpwn.sourceforg
1212
* [Scapy](https://github.com/secdev/scapy)
1313

1414
## Installation
15-
Wwith scapy at version 2.4.5 and Aircrack-NG at 1.7 or greater run the following:
15+
With scapy at version 2.4.5 and Aircrack-NG at 1.7 or greater run the following:
1616
```
1717
python3 -m pip install RESOURCEs/airpwn-ng-*.tar.gz
1818
```

RESOURCEs/airpwn-ng-2.0.4.tar.gz

-6.4 KB
Binary file not shown.

RESOURCEs/airpwn-ng-2.0.6.tar.gz

7.63 KB
Binary file not shown.

SRC/airpwn_ng/README SRC/README

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ airpwn-ng is based on the concepts laid out in [Airpwn](http://airpwn.sourceforg
1212
* [Scapy](https://github.com/secdev/scapy)
1313

1414
## Installation
15-
Wwith scapy at version 2.4.5 and Aircrack-NG at 1.7 or greater run the following:
15+
With scapy at version 2.4.5 and Aircrack-NG at 1.7 or greater run the following:
1616
```
1717
python3 -m pip install RESOURCEs/airpwn-ng-*.tar.gz
1818
```

SRC/airpwn_ng/lib/core.py

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import argparse
2+
import os
3+
import signal
4+
import subprocess
5+
import sys
6+
from airpwn_ng.lib.styles import File
7+
from airpwn_ng.lib.visuals import Bcolors
8+
9+
class Core(object):
10+
11+
def __init__(self, args):
12+
self.args = args
13+
14+
15+
def crtlC(self, args):
16+
"""Handle CTRL+C."""
17+
def tmp(signal, frame):
18+
print (Bcolors.FAIL + '\n[!] Stopping injection and exiting airpwn-ng ...' + Bcolors.ENDC)
19+
sys.exit(0)
20+
return tmp
21+
22+
23+
def channelSet(self, nic, chan):
24+
"""Set the channel for a given NIC"""
25+
subprocess.call('iwconfig {0} channel {1}'.format(nic, chan), shell = True)
26+
27+
28+
def injection_check(self, args):
29+
"""Injection file check"""
30+
try:
31+
f = open(self.args.injection, 'r')
32+
f.close()
33+
except:
34+
print (Bcolors.FAIL + '[!] Selected injection file', self.args.injection, 'does not exist.' + Bcolors.ENDC)
35+
exit(1)
36+
print (Bcolors.OKGREEN + '\n[+] Loaded injection file {0}'.format(str(self.args.injection)) + Bcolors.ENDC)
37+
injection = 1
38+
return injection
39+
40+
41+
def main(self):
42+
"""Launching logic"""
43+
44+
## Backpressure defaults
45+
if self.args.w is not None:
46+
self.args.bWarn = int(self.args.w)
47+
else:
48+
self.args.bWarn = 40
49+
50+
## NIC types
51+
if self.args.inj is None:
52+
self.args.inj = 'mon'
53+
54+
## Set channel if so desired
55+
if self.args.channel is not None:
56+
if self.args.tun is False:
57+
print (Bcolors.OKGREEN + '[+] Setting NIC Channel(s) to %s' % self.args.channel + Bcolors.ENDC)
58+
59+
## Set monitor nic
60+
self.channelSet(self.args.m, self.args.channel)
61+
62+
## Set injector nic
63+
if self.args.inj == 'mon':
64+
self.channelSet(self.args.i, self.args.channel)
65+
66+
## Injection Logic
67+
injection = self.injection_check(self.args)
68+
69+
## BSSID announce
70+
if self.args.bssid is not None:
71+
print (Bcolors.OKGREEN + '[+] Adding BSSID ' + Bcolors.OKBLUE + self.args.bssid + Bcolors.ENDC)
72+
73+
## Broadcast mode
74+
if self.args.t is None:
75+
print (Bcolors.WARNING + '[!] You are in broadcast mode.')
76+
print ('[!] This means you will inject packets into all targetss you are able to detect.')
77+
print ('[!] Use with caution.' + Bcolors.ENDC)
78+
79+
## Targeted mode
80+
else:
81+
if len(self.args.t) == 0:
82+
print (Bcolors.WARNING + '[!] You must specify at least one target MAC address with -t for targeted mode')
83+
exit(1)
84+
else:
85+
for target in self.args.t:
86+
print (Bcolors.OKGREEN + '[+] Adding target ' + Bcolors.OKBLUE + target + Bcolors.ENDC)
87+
88+
## Launch the handler
89+
style = File()
90+
style.handler(self.args)
File renamed without changes.

SRC/airpwn_ng/airpwn_ng/lib/injector.py SRC/airpwn_ng/lib/injector.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
class Injector(object):
1313
"""Uses scapy to inject packets on the networks"""
1414

15-
def __init__(self, interface, args):
16-
self.interface = interface
15+
def __init__(self, args):
16+
self.interface = args.i
1717
self.args = args
1818
self.hdr = Headers()
19-
self.injSocket = conf.L2socket(iface = interface)
19+
self.injSocket = conf.L2socket(iface = self.interface)
2020
if (args.m != args.i) or args.tun is True:
21-
self.injMac = scapy.arch.get_if_hwaddr(interface)
21+
self.injMac = scapy.arch.get_if_hwaddr(self.interface)
2222

2323
def inject(self,
2424
tgtmac,

SRC/airpwn_ng/lib/menu.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import argparse
2+
3+
class Menu(object):
4+
5+
def __init__(self):
6+
self.parser = argparse.ArgumentParser(description = 'airpwn-ng - the new and improved 802.11 packet injector')
7+
self.parser.add_argument('-i',
8+
help = 'Your injection interface',
9+
metavar = '<interface>')
10+
self.parser.add_argument('-m',
11+
help = 'Your monitor interface',
12+
metavar = '<interface>')
13+
self.parser.add_argument('-t',
14+
help = 'Target MAC addresses',
15+
metavar = '<MAC address>',
16+
nargs = '*')
17+
self.parser.add_argument('-w',
18+
help = 'Backpressure warning value',
19+
metavar = 'Backpressure warning value')
20+
self.parser.add_argument('--bssid',
21+
help = 'Filter for a given BSSID',
22+
metavar = 'Filter for a given BSSID')
23+
self.parser.add_argument('--channel',
24+
help = 'Set the channel for the NICs',
25+
metavar = '<channel>')
26+
self.parser.add_argument('--inj',
27+
choices = ['mon', 'man'],
28+
help = 'Injector NIC type - mon or man',
29+
metavar = '<inj NIC type>')
30+
self.parser.add_argument('--injection',
31+
metavar = '<filename>',
32+
help = 'File with your injection code',
33+
required = True)
34+
self.parser.add_argument('--trigger',
35+
metavar = '<trigger>',
36+
help = 'Trigger string for injection')
37+
self.parser.add_argument('--tun',
38+
action = 'store_true',
39+
help = 'airtun-ng integration')

SRC/airpwn_ng/airpwn_ng/lib/packet_handler.py SRC/airpwn_ng/lib/packet_handler.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77
class PacketHandler(object):
88
"""This class does all the heavy-lifting."""
99

10-
def __init__(self, *positional_parameters, **keyword_parameters):
11-
self.handler = keyword_parameters.get('handler')
12-
self.i = keyword_parameters.get('i')
13-
self.target_parameters = keyword_parameters.get('target_parameters')
10+
def __init__(self, args, tp):
11+
self.i = args.i
12+
self.target_parameters = tp
13+
14+
# print(keyword_parameters)
1415

1516
if self.i is None:
1617
print ('[ERROR] No injection interface selected')
1718
exit(1)
1819

1920
## Argument handling
20-
args = keyword_parameters.get('Args')
21+
# args = keyword_parameters.get('Args')
2122

2223
## Trigger setup
2324
if args.trigger is None:
@@ -26,7 +27,7 @@ def __init__(self, *positional_parameters, **keyword_parameters):
2627
self.trigger = args.trigger
2728

2829
## Injector creation
29-
self.injector = Injector(self.i, args)
30+
self.injector = Injector(args)
3031

3132

3233
def proc_handler(self, packet, args):
File renamed without changes.

SRC/airpwn_ng/airpwn_ng/lib/sniffer.py SRC/airpwn_ng/lib/sniffer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class Sniffer(object):
1313
for packets received from scapy's sniff() function.
1414
"""
1515

16-
def __init__(self, packethandler, args, *positional_parameters, **keyword_parameters):
17-
self.m = keyword_parameters.get('m')
16+
def __init__(self, packethandler, args):
17+
self.m = args.m
1818

1919
## Create the handler
2020
self.packethandler = packethandler

SRC/airpwn_ng/airpwn_ng/lib/styles.py SRC/airpwn_ng/lib/styles.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
from .sniffer import Sniffer
44
from .target import Target
55

6+
"""
7+
This module allows for multiple vectors in reference to injection.
8+
9+
The default model is to inject based off of a templated file.
10+
"""
11+
612
class File(object):
713
"""Inject based upon a single file"""
814

@@ -13,8 +19,9 @@ def handler(self, args):
1319
tp = TargetParameters(inject_file = args.injection)
1420

1521
## Packet handling
16-
ph = PacketHandler(Args = args, i = args.i, target_parameters = tp)
22+
# ph = PacketHandler(Args = args, i = args.i, target_parameters = tp)
23+
ph = PacketHandler(args, tp)
1724

1825
## Begin sniffing
19-
snif = Sniffer(ph, args, m = args.m)
26+
snif = Sniffer(ph, args)
2027
snif.threaded_sniff(args)
File renamed without changes.
File renamed without changes.

SRC/airpwn_ng/setup.py SRC/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
setup(
66
name = 'airpwn-ng',
7-
version = '2.0.4',
7+
version = '2.0.6',
88
author = 'stryngs and Jack64',
99
packages = ['airpwn_ng', 'airpwn_ng.lib'],
1010
include_package_data = True,

airpwn-ng

+11-121
Original file line numberDiff line numberDiff line change
@@ -5,131 +5,21 @@ import os
55
import signal
66
import subprocess
77
import sys
8-
from airpwn_ng.lib.styles import File
9-
from airpwn_ng.lib.visuals import Bcolors
10-
11-
def channelSet(nic, chan):
12-
"""Set the channel for a given NIC"""
13-
subprocess.call('iwconfig {0} channel {1}'.format(nic, chan), shell = True)
14-
15-
16-
def crtlC(args):
17-
"""Handle CTRL+C."""
18-
def tmp(signal, frame):
19-
print (Bcolors.FAIL + '\n[!] Stopping injection and exiting airpwn-ng ...' + Bcolors.ENDC)
20-
sys.exit(0)
21-
return tmp
22-
23-
24-
def injection_check(args):
25-
"""Injection file check"""
26-
try:
27-
f = open(args.injection, 'r')
28-
f.close()
29-
except:
30-
print (Bcolors.FAIL + '[!] Selected injection file', args.injection, 'does not exist.' + Bcolors.ENDC)
31-
exit(1)
32-
print (Bcolors.OKGREEN + '[+] Loaded injection file {0}'.format(str(args.injection)) + Bcolors.ENDC)
33-
injection = 1
34-
return injection
35-
36-
37-
def main(args):
38-
"""Launching logic"""
39-
40-
## Backpressure defaults
41-
if args.w is not None:
42-
args.bWarn = int(args.w)
43-
else:
44-
args.bWarn = 40
45-
46-
## NIC types
47-
if args.inj is None:
48-
args.inj = 'mon'
49-
50-
## User printouts
51-
print (Bcolors.HEADER + '\n[+] airpwn-ng v2.0' + Bcolors.ENDC)
52-
53-
## Set channel if so desired
54-
if args.channel is not None:
55-
if args.tun is False:
56-
print (Bcolors.OKGREEN + '[+] Setting NIC Channel(s) to %s' % args.channel + Bcolors.ENDC)
57-
58-
## Set monitor nic
59-
channelSet(args.m, args.channel)
60-
61-
## Set injector nic
62-
if args.inj == 'mon':
63-
channelSet(args.i, args.channel)
64-
65-
## Injection Logic
66-
injection = injection_check(args)
67-
68-
## BSSID announce
69-
if args.bssid is not None:
70-
print (Bcolors.OKGREEN + '[+] Adding BSSID ' + Bcolors.OKBLUE + args.bssid + Bcolors.ENDC)
71-
72-
## Broadcast mode
73-
if args.t is None:
74-
print (Bcolors.WARNING + '[!] You are starting your attack in broadcast mode.')
75-
print ('[!] This means you will inject packets into all clients you are able to detect.')
76-
print ('[!] Use with caution.' + Bcolors.ENDC)
77-
78-
## Targeted mode
79-
else:
80-
if len(args.t) == 0:
81-
print (Bcolors.WARNING + '[!] You must specify at least one target MAC address with -t for targeted mode')
82-
exit(1)
83-
else:
84-
for target in args.t:
85-
print (Bcolors.OKGREEN + '[+] Adding target ' + Bcolors.OKBLUE + target + Bcolors.ENDC)
86-
87-
## Launch the handler
88-
style = File()
89-
style.handler(args)
8+
from airpwn_ng.lib.core import Core
9+
from airpwn_ng.lib.menu import Menu
9010

9111
if __name__ == '__main__':
9212

93-
## ARGUMENT PARSING
94-
parser = argparse.ArgumentParser(description = 'airpwn-ng - the new and improved 802.11 packet injector')
95-
parser.add_argument('-i',
96-
help = 'Your injection interface',
97-
metavar = '<interface>')
98-
parser.add_argument('-m',
99-
help = 'Your monitor interface',
100-
metavar = '<interface>')
101-
parser.add_argument('-t',
102-
help = 'Target MAC addresses',
103-
metavar = '<MAC address>',
104-
nargs = '*')
105-
parser.add_argument('-w',
106-
help = 'Backpressure warning value',
107-
metavar = 'Backpressure warning value')
108-
parser.add_argument('--bssid',
109-
help = 'Filter for a given BSSID',
110-
metavar = 'Filter for a given BSSID')
111-
parser.add_argument('--channel',
112-
help = 'Set the channel for the NICs',
113-
metavar = '<channel>')
114-
parser.add_argument('--inj',
115-
choices = ['mon', 'man'],
116-
help = 'Injector NIC type - mon or man',
117-
metavar = '<inj NIC type>')
118-
parser.add_argument('--injection',
119-
metavar = '<filename>',
120-
help = 'File with your injection code',
121-
required = True)
122-
parser.add_argument('--trigger',
123-
metavar = '<trigger>',
124-
help = 'Trigger string for injection')
125-
parser.add_argument('--tun',
126-
action = 'store_true',
127-
help = 'airtun-ng integration')
128-
args = parser.parse_args()
13+
## Menu creation
14+
menu = Menu()
15+
args = menu.parser.parse_args()
16+
17+
## Import airpwn-ng
18+
airPwn = Core(args)
12919

130-
## ADD SIGNAL HANDLER
131-
signal_handler = crtlC(args)
20+
## Signal handler
21+
signal_handler = airPwn.crtlC(args)
13222
signal.signal(signal.SIGINT, signal_handler)
13323

13424
## Launch
135-
main(args)
25+
airPwn.main()

0 commit comments

Comments
 (0)