Example #1
0
async def test(max_timeout):
    async with pyrcrack.AirodumpNg() as pdump:
        with suppress(asyncio.TimeoutError):
            async with timeout(max_timeout):
                await pdump.run(sys.argv[1])
                while True:
                    await asyncio.sleep(1)
                    print(pdump.meta)
        return await pdump.proc.terminate()
Example #2
0
async def scan_for_targets():
    """Scan for targets, return json."""
    console = Console()
    console.clear()
    console.show_cursor(False)
    airmon = pyrcrack.AirmonNg()
    interfaces = await airmon.interfaces
    console.print(interfaces.table)
    interface = Prompt.ask('Select an interface',
                           choices=[a.interface for a in interfaces])

    async with airmon(interface) as mon:
        async with pyrcrack.AirodumpNg() as pdump:
            # TODO: Maybe copy this object upon __call__ so we can do, paralell
            # async for result in pdump(foo) (the only relevant part would be
            # execn properties) within the same temporary path?
            async for aps in pdump(mon.monitor_interface):
                console.clear()
                console.print(aps.table)
                client = Prompt.ask(
                    'Select an AP',
                    choices=['continue', *[str(a) for a in range(len(aps))]])

                if client != 'continue':
                    break

        async with pyrcrack.AirodumpNg() as pdump:
            console.print(
                ":vampire:",
                f"Selected client: [red] {aps[int(client)].bssid} [/red]")

            async for result in pdump(mon.monitor_interface,
                                      **aps[int(client)].airodump):
                console.clear()
                console.print(result.table)
                await asyncio.sleep(3)
Example #3
0
async def do_scan(session, args, kwargs):
    """Execute scan and update results dict each 1.1 seconds.

    Airodump-ng will update the file each second.
    """
    async with pyrcrack.AirodumpNg() as pdump:
        kwargs.update({'write_interval': 1})
        await pdump.run(*args, **kwargs)
        while True:
            await asyncio.sleep(1.1)
            with suppress(KeyError):
                session.scan.result_files = glob(pdump.tempdir.name + '/*')
                session.scan.results.update(
                    {a.bssid: asdict(a)
                     for a in pdump.sorted_aps()})
Example #4
0
async def deauth():
    """Scan for targets, return json."""
    async with pyrcrack.AirmonNg() as airmon:
        interface = (await airmon.list_wifis())[0]['interface']
        interface = (await airmon.set_monitor(interface))[0]

        async with pyrcrack.AirodumpNg() as pdump:
            await pdump.run(interface['interface'], write_interval=1)
            # Extract first results
            while True:
                with suppress(KeyError):
                    await asyncio.sleep(2)
                    ap = pdump.sorted_aps()[0]
                    break
            # Deauth.
            await attack(interface, ap)
Example #5
0
async def getApsHelper():
    """Scan for targets, return json."""
    apsList= []
    async with pyrcrack.AirmonNg() as airmon:
        interface = (await airmon.list_wifis())[0]['interface']
        interface = (await airmon.set_monitor(interface))[0]
        async with pyrcrack.AirodumpNg() as pdump:
            await pdump.run(interface['interface'], write_interval=1)
            await asyncio.sleep(15)
            aps = pdump.sorted_aps()
            for ap in aps:
                currentDict = {"bssid": ap.bssid, "essid": ap.essid,"channel": ap.channel, "clients": [c.station_mac for c in ap.clients]}
                apsList.append(currentDict)
           # await attack1(interface)
            print(json.dumps(apsList))
    return json.dumps(apsList)
Example #6
0
async def scanForTargets():
    air = pyrcrack.AirodumpNg()
    air.run('wlan1')
    await asyncio.sleep(2)
    print(air.get_results())