Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Metasploit Hwbridge Relay #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tools/lib/nrf24.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ def __init__(self, index=0):
except:
raise Exception('Cannot find USB dongle.')

# Lists all compatiable USB devices
def supported_indexes(self):
dongles = list()
try:
dongles = list(usb.core.find(idVendor=0x1915, idProduct=0x0102, find_all=True))
except usb.core.USBError, ex:
raise ex
except:
raise Exception('Cannot find USB dongle.')
return range(0, len(dongles))

# Put the radio in pseudo-promiscuous mode
def enter_promiscuous_mode(self, prefix=[]):
self.send_usb_command(ENTER_PROMISCUOUS_MODE, [len(prefix)]+map(ord, prefix))
Expand Down
23 changes: 23 additions & 0 deletions tools/lib/nrf24_reset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Workaround to fix problem where device time outs

import usb.core
import usb.util
try:
from fcntl import ioctl
except ImportError:
# Make sure this code does not break platforms without ioctl - if any...
ioctl = lambda *args: None
import os

# Thanks to https://github.com/Paufurtado/usbreset.py
USBDEVFS_RESET = ord('U') << (4*2) | 20

def reset_radio(index, idVendor=0x1915, idProduct=0x0102):
device = list(usb.core.find(idVendor=idVendor, idProduct=idProduct, find_all=True))[index]
bus = str(device.bus).zfill(3)
addr = str(device.address).zfill(3)
filename = "/dev/bus/usb/%s/%s" % (bus, addr)
try:
ioctl(open(filename,"w"), USBDEVFS_RESET, 0)
except IOError:
print "Unable to reset device %s" % filename
Loading