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

Release 2.0.6 #19

Merged
merged 2 commits into from
Jun 11, 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 @@ -12,7 +12,7 @@ airpwn-ng is based on the concepts laid out in [Airpwn](http://airpwn.sourceforg
* [Scapy](https://github.com/secdev/scapy)

## Installation
Wwith scapy at version 2.4.5 and Aircrack-NG at 1.7 or greater run the following:
With scapy at version 2.4.5 and Aircrack-NG at 1.7 or greater run the following:
```
python3 -m pip install RESOURCEs/airpwn-ng-*.tar.gz
```
Expand Down
Binary file removed RESOURCEs/airpwn-ng-2.0.4.tar.gz
Binary file not shown.
Binary file added RESOURCEs/airpwn-ng-2.0.6.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion SRC/airpwn_ng/README → SRC/README
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ airpwn-ng is based on the concepts laid out in [Airpwn](http://airpwn.sourceforg
* [Scapy](https://github.com/secdev/scapy)

## Installation
Wwith scapy at version 2.4.5 and Aircrack-NG at 1.7 or greater run the following:
With scapy at version 2.4.5 and Aircrack-NG at 1.7 or greater run the following:
```
python3 -m pip install RESOURCEs/airpwn-ng-*.tar.gz
```
Expand Down
90 changes: 90 additions & 0 deletions SRC/airpwn_ng/lib/core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import argparse
import os
import signal
import subprocess
import sys
from airpwn_ng.lib.styles import File
from airpwn_ng.lib.visuals import Bcolors

class Core(object):

def __init__(self, args):
self.args = args


def crtlC(self, args):
"""Handle CTRL+C."""
def tmp(signal, frame):
print (Bcolors.FAIL + '\n[!] Stopping injection and exiting airpwn-ng ...' + Bcolors.ENDC)
sys.exit(0)
return tmp


def channelSet(self, nic, chan):
"""Set the channel for a given NIC"""
subprocess.call('iwconfig {0} channel {1}'.format(nic, chan), shell = True)


def injection_check(self, args):
"""Injection file check"""
try:
f = open(self.args.injection, 'r')
f.close()
except:
print (Bcolors.FAIL + '[!] Selected injection file', self.args.injection, 'does not exist.' + Bcolors.ENDC)
exit(1)
print (Bcolors.OKGREEN + '\n[+] Loaded injection file {0}'.format(str(self.args.injection)) + Bcolors.ENDC)
injection = 1
return injection


def main(self):
"""Launching logic"""

## Backpressure defaults
if self.args.w is not None:
self.args.bWarn = int(self.args.w)
else:
self.args.bWarn = 40

## NIC types
if self.args.inj is None:
self.args.inj = 'mon'

## Set channel if so desired
if self.args.channel is not None:
if self.args.tun is False:
print (Bcolors.OKGREEN + '[+] Setting NIC Channel(s) to %s' % self.args.channel + Bcolors.ENDC)

## Set monitor nic
self.channelSet(self.args.m, self.args.channel)

## Set injector nic
if self.args.inj == 'mon':
self.channelSet(self.args.i, self.args.channel)

## Injection Logic
injection = self.injection_check(self.args)

## BSSID announce
if self.args.bssid is not None:
print (Bcolors.OKGREEN + '[+] Adding BSSID ' + Bcolors.OKBLUE + self.args.bssid + Bcolors.ENDC)

## Broadcast mode
if self.args.t is None:
print (Bcolors.WARNING + '[!] You are in broadcast mode.')
print ('[!] This means you will inject packets into all targetss you are able to detect.')
print ('[!] Use with caution.' + Bcolors.ENDC)

## Targeted mode
else:
if len(self.args.t) == 0:
print (Bcolors.WARNING + '[!] You must specify at least one target MAC address with -t for targeted mode')
exit(1)
else:
for target in self.args.t:
print (Bcolors.OKGREEN + '[+] Adding target ' + Bcolors.OKBLUE + target + Bcolors.ENDC)

## Launch the handler
style = File()
style.handler(self.args)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
class Injector(object):
"""Uses scapy to inject packets on the networks"""

def __init__(self, interface, args):
self.interface = interface
def __init__(self, args):
self.interface = args.i
self.args = args
self.hdr = Headers()
self.injSocket = conf.L2socket(iface = interface)
self.injSocket = conf.L2socket(iface = self.interface)
if (args.m != args.i) or args.tun is True:
self.injMac = scapy.arch.get_if_hwaddr(interface)
self.injMac = scapy.arch.get_if_hwaddr(self.interface)

def inject(self,
tgtmac,
Expand Down
39 changes: 39 additions & 0 deletions SRC/airpwn_ng/lib/menu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import argparse

class Menu(object):

def __init__(self):
self.parser = argparse.ArgumentParser(description = 'airpwn-ng - the new and improved 802.11 packet injector')
self.parser.add_argument('-i',
help = 'Your injection interface',
metavar = '<interface>')
self.parser.add_argument('-m',
help = 'Your monitor interface',
metavar = '<interface>')
self.parser.add_argument('-t',
help = 'Target MAC addresses',
metavar = '<MAC address>',
nargs = '*')
self.parser.add_argument('-w',
help = 'Backpressure warning value',
metavar = 'Backpressure warning value')
self.parser.add_argument('--bssid',
help = 'Filter for a given BSSID',
metavar = 'Filter for a given BSSID')
self.parser.add_argument('--channel',
help = 'Set the channel for the NICs',
metavar = '<channel>')
self.parser.add_argument('--inj',
choices = ['mon', 'man'],
help = 'Injector NIC type - mon or man',
metavar = '<inj NIC type>')
self.parser.add_argument('--injection',
metavar = '<filename>',
help = 'File with your injection code',
required = True)
self.parser.add_argument('--trigger',
metavar = '<trigger>',
help = 'Trigger string for injection')
self.parser.add_argument('--tun',
action = 'store_true',
help = 'airtun-ng integration')
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
class PacketHandler(object):
"""This class does all the heavy-lifting."""

def __init__(self, *positional_parameters, **keyword_parameters):
self.handler = keyword_parameters.get('handler')
self.i = keyword_parameters.get('i')
self.target_parameters = keyword_parameters.get('target_parameters')
def __init__(self, args, tp):
self.i = args.i
self.target_parameters = tp

# print(keyword_parameters)

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

## Argument handling
args = keyword_parameters.get('Args')
# args = keyword_parameters.get('Args')

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

## Injector creation
self.injector = Injector(self.i, args)
self.injector = Injector(args)


def proc_handler(self, packet, args):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class Sniffer(object):
for packets received from scapy's sniff() function.
"""

def __init__(self, packethandler, args, *positional_parameters, **keyword_parameters):
self.m = keyword_parameters.get('m')
def __init__(self, packethandler, args):
self.m = args.m

## Create the handler
self.packethandler = packethandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
from .sniffer import Sniffer
from .target import Target

"""
This module allows for multiple vectors in reference to injection.

The default model is to inject based off of a templated file.
"""

class File(object):
"""Inject based upon a single file"""

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

## Packet handling
ph = PacketHandler(Args = args, i = args.i, target_parameters = tp)
# ph = PacketHandler(Args = args, i = args.i, target_parameters = tp)
ph = PacketHandler(args, tp)

## Begin sniffing
snif = Sniffer(ph, args, m = args.m)
snif = Sniffer(ph, args)
snif.threaded_sniff(args)
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion SRC/airpwn_ng/setup.py → SRC/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name = 'airpwn-ng',
version = '2.0.4',
version = '2.0.6',
author = 'stryngs and Jack64',
packages = ['airpwn_ng', 'airpwn_ng.lib'],
include_package_data = True,
Expand Down
132 changes: 11 additions & 121 deletions airpwn-ng
Original file line number Diff line number Diff line change
Expand Up @@ -5,131 +5,21 @@ import os
import signal
import subprocess
import sys
from airpwn_ng.lib.styles import File
from airpwn_ng.lib.visuals import Bcolors

def channelSet(nic, chan):
"""Set the channel for a given NIC"""
subprocess.call('iwconfig {0} channel {1}'.format(nic, chan), shell = True)


def crtlC(args):
"""Handle CTRL+C."""
def tmp(signal, frame):
print (Bcolors.FAIL + '\n[!] Stopping injection and exiting airpwn-ng ...' + Bcolors.ENDC)
sys.exit(0)
return tmp


def injection_check(args):
"""Injection file check"""
try:
f = open(args.injection, 'r')
f.close()
except:
print (Bcolors.FAIL + '[!] Selected injection file', args.injection, 'does not exist.' + Bcolors.ENDC)
exit(1)
print (Bcolors.OKGREEN + '[+] Loaded injection file {0}'.format(str(args.injection)) + Bcolors.ENDC)
injection = 1
return injection


def main(args):
"""Launching logic"""

## Backpressure defaults
if args.w is not None:
args.bWarn = int(args.w)
else:
args.bWarn = 40

## NIC types
if args.inj is None:
args.inj = 'mon'

## User printouts
print (Bcolors.HEADER + '\n[+] airpwn-ng v2.0' + Bcolors.ENDC)

## Set channel if so desired
if args.channel is not None:
if args.tun is False:
print (Bcolors.OKGREEN + '[+] Setting NIC Channel(s) to %s' % args.channel + Bcolors.ENDC)

## Set monitor nic
channelSet(args.m, args.channel)

## Set injector nic
if args.inj == 'mon':
channelSet(args.i, args.channel)

## Injection Logic
injection = injection_check(args)

## BSSID announce
if args.bssid is not None:
print (Bcolors.OKGREEN + '[+] Adding BSSID ' + Bcolors.OKBLUE + args.bssid + Bcolors.ENDC)

## Broadcast mode
if args.t is None:
print (Bcolors.WARNING + '[!] You are starting your attack in broadcast mode.')
print ('[!] This means you will inject packets into all clients you are able to detect.')
print ('[!] Use with caution.' + Bcolors.ENDC)

## Targeted mode
else:
if len(args.t) == 0:
print (Bcolors.WARNING + '[!] You must specify at least one target MAC address with -t for targeted mode')
exit(1)
else:
for target in args.t:
print (Bcolors.OKGREEN + '[+] Adding target ' + Bcolors.OKBLUE + target + Bcolors.ENDC)

## Launch the handler
style = File()
style.handler(args)
from airpwn_ng.lib.core import Core
from airpwn_ng.lib.menu import Menu

if __name__ == '__main__':

## ARGUMENT PARSING
parser = argparse.ArgumentParser(description = 'airpwn-ng - the new and improved 802.11 packet injector')
parser.add_argument('-i',
help = 'Your injection interface',
metavar = '<interface>')
parser.add_argument('-m',
help = 'Your monitor interface',
metavar = '<interface>')
parser.add_argument('-t',
help = 'Target MAC addresses',
metavar = '<MAC address>',
nargs = '*')
parser.add_argument('-w',
help = 'Backpressure warning value',
metavar = 'Backpressure warning value')
parser.add_argument('--bssid',
help = 'Filter for a given BSSID',
metavar = 'Filter for a given BSSID')
parser.add_argument('--channel',
help = 'Set the channel for the NICs',
metavar = '<channel>')
parser.add_argument('--inj',
choices = ['mon', 'man'],
help = 'Injector NIC type - mon or man',
metavar = '<inj NIC type>')
parser.add_argument('--injection',
metavar = '<filename>',
help = 'File with your injection code',
required = True)
parser.add_argument('--trigger',
metavar = '<trigger>',
help = 'Trigger string for injection')
parser.add_argument('--tun',
action = 'store_true',
help = 'airtun-ng integration')
args = parser.parse_args()
## Menu creation
menu = Menu()
args = menu.parser.parse_args()

## Import airpwn-ng
airPwn = Core(args)

## ADD SIGNAL HANDLER
signal_handler = crtlC(args)
## Signal handler
signal_handler = airPwn.crtlC(args)
signal.signal(signal.SIGINT, signal_handler)

## Launch
main(args)
airPwn.main()