コード例 #1
0
ファイル: hopper.py プロジェクト: su-yiting/wifi-scripts
    def __init__(self, interface, wait=4):
        """
        set the channel hopping sequence
        """
        Thread.__init__(self)
        Thread.daemon = True

        self.wait = wait
        if LINUX:
            self.iface = PyLorcon2.Context(interface)
            self.iface.open_injmon()
        elif DARWIN:
            self.iface = interface
        else:
            raise NotImplemented
        self.HOPpause = False
        # dwell for 3 time slices on 1 6 11
        # default is 3/10 of a second
        # got the lists from kismet config file
        # thanks dragorn!
        self.channellist = [
            1, 6, 11, 14, 2, 7, 3, 8, 4, 9, 5, 10, 36, 38, 40, 42, 44, 46, 52,
            56, 58, 60, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140,
            149, 153, 157, 161, 165
        ]
        self.hopList = []
        self.current = 0
        self.check_channels()
コード例 #2
0
    def __init__(self):
        try:
            self.lorcon = PyLorcon2.Context(IFACE)
        except PyLorcon2.Lorcon2Exception as err:
            print "Error creating lorcon object: "
            print str(err)
            exit()

        self.setmonitor(IFACE, monitor=True)
        try:
            self.lorcon.open_injmon()
        except PyLorcon2.Lorcon2Exception as err:
            print "Error while setting injection mode, are you root?"
            print str(err)
            exit()

        self.lorcon.set_channel(CHANNEL)

        # Quick definitions for pcapy
        MAX_LEN = 1514  # max size of packet to capture
        PROMISCUOUS = 1  # promiscuous mode?
        READ_TIMEOUT = 0  # in milliseconds, I found that 0 does not tend to block
        #  in the way I had assumed and you get a NULL pcap error from:
        #  https://github.com/CoreSecurity/pcapy/blob/master/pcapobj.cc#L215
        MAX_PKTS = 1  # number of packets to capture; 0 => no limit

        try:
            self.pcapy = open_live(IFACE, MAX_LEN, PROMISCUOUS, READ_TIMEOUT)
        except PcapError as err:
            print "Error creating pcapy descriptor, try turning on the target interface or setting it to monitor mode"
            print str(err)
コード例 #3
0
ファイル: Tool80211.py プロジェクト: Nitron/piwat
 def openMon(self, interface):
     """
     open a monitor mode interface and create a vap
     interface = string 
     currently assumes all cards are to be opened in monitor mode
     """
     # open the card up and gain a a context to them
     # create a dict with interface name and context
     try:
         self.moniface = {"ctx": PyLorcon2.Context(interface)}
     except PyLorcon2.Lorcon2Exception, e:
         print "%s is the %s interface there?" % (e, interface)
         sys.exit(-1)
コード例 #4
0
 def openMon(self, interface):
     """
     open a monitor mode interface and create a vap
     interface = string 
     currently assumes all cards are to be opened in monitor mode
     """
     # open the card up and gain a a context to them
     # create a dict with interface name and context
     try:
         self.moniface = {"ctx": PyLorcon2.Context(interface)}
     except PyLorcon2.Lorcon2Exception as e:
         print("%s is the %s interface there?" % (e, interface))
         sys.exit(-1)
     # place cards in injection/monitor mode
     self.moniface["ctx"].open_injmon()
     self.moniface["name"] = self.moniface["ctx"].get_vap()
コード例 #5
0
ファイル: fap.py プロジェクト: xZeraSx/wifi-pwn
 def __init__(self, iface):
     self.iface = iface
     self.ctx = PyLorcon2.Context(self.iface)
     self.ctx.open_injmon()
コード例 #6
0
ファイル: test.py プロジェクト: 0x0d/lorcon
 def testAutoDriver(self):
     # Is it wise to test this? May fail depending on where it is tested
     # without a bug/error in Lorcon2 itself...
     driver, description = PyLorcon2.auto_driver(self.iface)
     self.assertEqual(self.driver, driver)
     self.assertEqual(type(description), str)
コード例 #7
0
ファイル: test.py プロジェクト: 0x0d/lorcon
 def testFindDriver(self):
     driver, description = PyLorcon2.find_driver(self.driver)
     self.assertEqual(self.driver, driver)
     self.assertEqual(type(description), str)
コード例 #8
0
ファイル: test.py プロジェクト: 0x0d/lorcon
 def testListDrivers(self):
     drivers = PyLorcon2.list_drivers()
     self.assertEqual(type(drivers), list)
     self.assertTrue(len(drivers) > 0)
コード例 #9
0
ファイル: test.py プロジェクト: 0x0d/lorcon
 def testGetVersion(self):
     version = PyLorcon2.get_version()
     self.assertEqual(type(version), int)
コード例 #10
0
ファイル: test.py プロジェクト: PNPtutorials/lorcon-1
 def testGetVersion(self):
     version = PyLorcon2.get_version()
     self.assertEqual(type(version), int)
コード例 #11
0
ファイル: test.py プロジェクト: PNPtutorials/lorcon-1
 def testFindDriver(self):
     driver, description = PyLorcon2.find_driver(self.driver)
     self.assertEqual(self.driver, driver)
     self.assertEqual(type(description), str)
コード例 #12
0
import PyLorcon2, sys

if len(sys.argv) < 3:
    print "Expected pcapfile1, pcapfile2"
    sys.exit(1)

pcap1 = PyLorcon2.Context(sys.argv[1], "file")
pcap2 = PyLorcon2.Context(sys.argv[2], "file")

pcap1.open_monitor()
pcap2.open_monitor()

multi = PyLorcon2.Multi()
multi.add_interface(pcap1)
multi.add_interface(pcap2)

print multi.get_interfaces()


def MultiHandler(packet):
    print "Got packet from %s len %d" % (packet.get_interface().get_capiface(),
                                         packet.get_length())


multi.loop(0, MultiHandler)
コード例 #13
0
ファイル: test.py プロジェクト: PNPtutorials/lorcon-1
 def setUp(self):
     self.ctx = PyLorcon2.Context(self.iface)
コード例 #14
0
    if o == "-h":
        usage()

if ((interface is None) or (channel is None)):
    print "ERROR: Interface or channel not set (see -h for more info)"
    sys.exit(-1)

print "[+] Using interface", interface
'''
	The following is all of the standard interface, driver, and context setup
'''

# Automatically determine the driver of the interface

try:
    driver, description = PyLorcon2.auto_driver(interface)
    if driver is not None:
        print "[+]\t Driver:", driver
except:
    print "[!] Could not determine the driver for", interface
    sys.exit(-1)

# Create LORCON context
try:
    ctx = PyLorcon2.Context(interface)
except:
    print "[!]\t Failed to create context"
    sys.exit(-1)

# Create Monitor Mode Interface
コード例 #15
0
ファイル: probemon.py プロジェクト: szehl/wifi-arsenal
 def setup(self):
     self.ctx = pylorcon.Context(self.iface)
     self.ctx.open_injmon()
     print "Set up context and set to monitor/injection mode."
コード例 #16
0
#!/usr/bin/env python

import sys
import PyLorcon2
import pprint
from scapy.all import *

lorcon = PyLorcon2.Context("./test.pcap")

lorcon.open_injmon()

lorcon.set_filter("host 192.168.11.24")

npackets = 0
try:
    while 1:
        p = lorcon.get_next()
        #print "Got packet, len %d dot11 len %d data len %d" % (p.get_length(), p.get_dot11_length(), p.get_data_length())

        #b = p.get_dot11()
        #scapypacket = Dot11(b)

        #pprint.pprint(scapypacket)

        npackets += 1
except:
    print "Could not read packet"

print npackets
コード例 #17
0
ファイル: test.py プロジェクト: PNPtutorials/lorcon-1
 def testAutoDriver(self):
     # Is it wise to test this? May fail depending on where it is tested
     # without a bug/error in Lorcon2 itself...
     driver, description = PyLorcon2.auto_driver(self.iface)
     self.assertEqual(self.driver, driver)
     self.assertEqual(type(description), str)
コード例 #18
0
ファイル: airdrop-old.py プロジェクト: Nitron/piwat
 if options.pysco == True:
     #if false we wont use psyco
     #usefull when using pdb
     try:
         import psyco
         psyco.full()
     except ImportError:
         message.printMessage(
             " Psyco Not found you may wish to install it to increase speed"
         )
 try:
     try:
         import pylorcon
         try:
             #tx = pylorcon.Lorcon(options.card,options.driver)
             tx = PyLorcon2.Context(options.card)
         except pylorcon.LorconError, e:
             message.printMessage(
                 ["\n", e, "Interface " + options.card + " does not exist"])
             sys.exit(-1)
     except ImportError:
         message.printMessage("\nPylorcon error, do you have it installed?")
         sys.exit(-1)
     try:
         #populate the oui lookup datatbases
         try:
             try:
                 ouiLookup = libOuiParse.macOUI_lookup("./support/oui.txt")
             except IOError:
                 ouiLookup = libOuiParse.macOUI_lookup(
                     "/usr/lib/airdrop-ng/oui.txt")
コード例 #19
0
ファイル: 4whsg.py プロジェクト: MAVProxyUser/3DRSoloHacks
channel = 11
#interface = sys.argv[1]    
eapol_packets = []
handshake_found = 0
WPA_key = [] # This is wrong... possible change from Lorcon1 to Lorcon2

#injector = pylorcon.Lorcon("ath0", "madwifing")
#injector.setfunctionalmode("INJECT")
#injector.setmode("MONITOR")
#injector.setchannel(11)

# Borrowed Lorcon2 Code from - https://github.com/OpenSecurityResearch/lorcon_examples/blob/master/beacon_flood_raw.py
# Automatically determine the driver of the interface

try:
	driver, description = PyLorcon2.auto_driver(interface)
	if driver is not None:
		print "[+]\t Driver:",driver
except:
	print "[!] Could not determine the driver for",interface
	sys.exit(-1)

# Create LORCON context
try:
	ctx = PyLorcon2.Context(interface)
except:
	print "[!]\t Failed to create context"
	sys.exit(-1)

# Create Monitor Mode Interface
コード例 #20
0
        frame += '\x03\x01\x06' 
        # RSN IE 
        frame += '\x30' # ID: 48 
        frame += '\x14' # Size: 20 
        frame += '\x01\x00' # Version: 1 
        frame += '\x00\x0f\xac\x04' # Group cipher suite: TKIP 
        frame += '\x01\x00' # Pairwise cipher suite count: 1 
        frame += '\x00\x0f\xac\x00' # Pairwise cipher suite 1: TKIP 
        frame += '\xff\xff' # Authentication suites count: 65535 
        frame += '\x00\x0f\xac\x02' # Pairwise authentication suite 2: PSK 
        frame += '\x00\x00' 

        sequence += 1 
        yield frame 

if __name__ == "__main__": 
    if len(sys.argv) != 2: 
        print "Usage:" 
        print "\t%s <wireless interface>" % sys.argv[0] 
        sys.exit(-1) 

    iface = sys.argv[1] 
    context = PyLorcon2.Context(iface) 
    context.open_injmon() 

    generator = beaconFrameGenerator() 

    for i in range(10000): 
        frame = generator.next() 
        time.sleep(0.100) 
        context.send_bytes(frame) 
コード例 #21
0
ファイル: test.py プロジェクト: PNPtutorials/lorcon-1
 def testListDrivers(self):
     drivers = PyLorcon2.list_drivers()
     self.assertEqual(type(drivers), list)
     self.assertTrue(len(drivers) > 0)