Ejemplo n.º 1
0
from pypacker import utils

import logging
logger = logging.getLogger("pypacker")


#
# sanity checks
#
if len(sys.argv) < 2:
	print("pleace specify an interface as 1st parameter")
	sys.exit(1)

iface	= sys.argv[1]

utils.set_wlan_monmode(iface, monitor_active=True)
psock = psocket.SocketHndl(iface_name=iface, timeout=0.5)
channels = utils.get_available_wlan_channels(iface)

if len(channels) == 0:
	# set default channels
	channels = [ch for ch in range(1, 12)]
print("got som' channels: %r" % str(channels))


Base = declarative_base()


#
# data schemes
#
Ejemplo n.º 2
0
"""
Check for unparsable files retrieved via network and save them to "parsefail.pcap"
"""
import sys
import time
import socket

from pypacker import psocket, ppcap, utils
from pypacker.layer12 import ethernet, linuxcc, radiotap
from pypacker.layer3 import ip

iface = sys.argv[1]

print("opening (wlan?) interface: %s" % iface)
utils.set_wlan_monmode(iface)

sockhndl = psocket.SocketHndl(iface_name=iface)
pcapwriter = ppcap.Writer(filename="parsefail.pcap",
                          linktype=ppcap.DLT_IEEE802_11_RADIO)
# pcapwriter	= ppcap.Writer(filename="parsefail.pcap")
raw_bytes = b""
cnt = 0
time_start = time.time()

while True:
    if cnt % 1000 == 0:
        print("%d pps" % (cnt / (time.time() - time_start)))
        cnt = 0
        time_start = time.time()

    cnt += 1
Ejemplo n.º 3
0
"""
Check for unparsable files retrieved via network and save them to "parsefail.pcap"
"""
import sys
import time
import socket

from pypacker import psocket, ppcap, utils
from pypacker.layer12 import ethernet, linuxcc, radiotap
from pypacker.layer3 import ip

iface		= sys.argv[1]

print("opening (wlan?) interface: %s" % iface)
utils.set_wlan_monmode(iface)

sockhndl	= psocket.SocketHndl(iface_name=iface)
pcapwriter	= ppcap.Writer(filename="parsefail.pcap", linktype=ppcap.DLT_IEEE802_11_RADIO)
# pcapwriter	= ppcap.Writer(filename="parsefail.pcap")
raw_bytes	= b""
cnt		= 0
time_start	= time.time()

while True:
	if cnt % 1000 == 0:
		print("%d pps" % (cnt / (time.time() - time_start)))
		cnt		= 0
		time_start	= time.time()

	cnt += 1
	try:
Ejemplo n.º 4
0
import sys
import threading
import socket
import copy

from pypacker import pypacker, utils
from pypacker.layer12 import radiotap, ieee80211
from pypacker import psocket

# name of monitor interface to use
wlan_monitor_if	= sys.argv[1]
# MAC address of access point
ap_mac		= sys.argv[2]

print("interface/ap: %s %s" % (wlan_monitor_if, ap_mac))
utils.set_wlan_monmode(wlan_monitor_if, monitor_active=False, reactivate=False)
utils.set_ethernet_address(wlan_monitor_if, "24:77:03:01:5C:8D")
utils.set_wlan_monmode(wlan_monitor_if, monitor_active=True)

psocket		= psocket.SocketHndl(wlan_monitor_if)

auth_req_orig	= radiotap.Radiotap() +\
		ieee80211.IEEE80211(type=ieee80211.MGMT_TYPE, subtype=ieee80211.M_AUTH, to_ds=0, from_ds=0) +\
		ieee80211.IEEE80211.Auth(dst_s=ap_mac, bssid_s=ap_mac)
beacon_orig	= radiotap.Radiotap() +\
		ieee80211.IEEE80211(type=ieee80211.MGMT_TYPE, subtype=ieee80211.M_BEACON, to_ds=0, from_ds=0) +\
		ieee80211.IEEE80211.Beacon(
			params=[ieee80211.IEEE80211.IE(id=0, len=10, body_bytes=b"\x00" * 10),
				ieee80211.IEEE80211.IE(id=1, len=8, body_bytes=b"\x82\x84\x8b\x96\x0c\x12\x18\x24"),
				ieee80211.IEEE80211.IE(id=3, len=1, body_bytes=b"\x04"),
				ieee80211.IEEE80211.IE(id=5, len=4, body_bytes=b"\x00\x01\x00\x00"),
Ejemplo n.º 5
0
from pypacker.layer12 import ieee80211, radiotap
from pypacker import utils

import logging
logger = logging.getLogger("pypacker")

#
# sanity checks
#
if len(sys.argv) < 2:
    print("pleace specify an interface as 1st parameter")
    sys.exit(1)

iface = sys.argv[1]

utils.set_wlan_monmode(iface, monitor_active=True)
psock = psocket.SocketHndl(iface_name=iface, timeout=0.5)
channels = utils.get_available_wlan_channels(iface)

if len(channels) == 0:
    # set default channels
    channels = [ch for ch in range(1, 12)]
print("got som' channels: %r" % str(channels))

Base = declarative_base()


#
# data schemes
#
class Station(Base):