Coder Social home page Coder Social logo

ivision-research / usbq Goto Github PK

View Code? Open in Web Editor NEW
75.0 6.0 6.0 145 KB

USBQ is a Python-based programming framework for monitoring and modifying USB communications.

Home Page: https://usbq.org

License: Other

Makefile 2.65% Python 97.35%
usb mitm

usbq's Introduction

USBQ

USBQ is a Python-based programming framework for monitoring and modifying USB communications.

This work is MIT licensed.

Installation

Userland Installation

pip install git+https://github.com/rbdixon/usbq.git#egg=usbq

I'm working on the Pypi package.

Kernel Module

Right now USBQ requires the kernel module from USBiquitous. I've not modified the module at all and would like to replace this module with mainline kernel capabilities and support for other hardware.

  1. Clone usbq_core
  2. Modify driver.c line 47 with the IP address of the device that will be executing USBQ.
  3. Build the kernel loadable module. The easiest way is to install development tools on your board and then modify the Makefile to be able to find your kernel headers.
  4. Install the kernel loadable module.
  5. Check your dmesg output and see if it is working.

If you have a Beaglebone Black running the 4.4.9-ti-r25 kernel and you want to use a pre-built kernel module configured for IP address 10.0.10.1 you can use the pre-built binary that I've got: ubq_core.ko. If that pre-built binary breaks you get to keep both pieces.

Usage

  1. Install the loadable kernel module.
  2. Plug your MITM board into your host computer.
  3. Start USBQ on your MITM host: usbq mitm.
  4. Plug your USB device into your MITM board.
  5. Give it a moment and you should see the USB device pop up on your host computer.
  6. Unplug the USB device.
  7. Control-C to terminate USBQ.

Origin

The tool was created for the edope.bike project and is an extensive rewrite of the userspace component of the USBiquitous USB Intrusion Toolkit.

usbq's People

Contributors

rbdixon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

usbq's Issues

Error while running "usbq mitm"

Team,

Im facing below issue while running "usbq mitm"

root@armhf:~# usbq mitm
INFO [ usbq.pm]: Loading plugins: reload, proxy, pcap, decode, encode, lookfor, usbq_hooks
INFO [ usbq.plugins.proxy]: Device listen to 0.0.0.0:64240
INFO [ usbq.plugins.proxy]: Host send to 127.0.0.1:64241
INFO [ usbq.plugins.pcap]: Logging packets to PCAP file usb.pcap
Traceback (most recent call last):
File "/usr/local/bin/usbq", line 11, in
load_entry_point('usbq==0.1.0', 'console_scripts', 'usbq')()
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/usbq-0.1.0-py3.7.egg/usbq/cli.py", line 128, in mitm
enabled=ctx.obj['enable_plugin'],
File "/usr/local/lib/python3.7/dist-packages/usbq-0.1.0-py3.7.egg/usbq/pm.py", line 62, in enable_plugins
mod = importlib.import_module(pd.mod)
File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "/usr/local/lib/python3.7/dist-packages/usbq-0.1.0-py3.7.egg/usbq/plugins/lookfor.py", line 4, in
import usb
ModuleNotFoundError: No module named 'usb'

Regards
khaleel

Error in running usbq

Hi,
After cloning and installing I am getting the below error.
$ usbq mitm
INFO [ usbq.pm]: Loading plugins: reload, proxy, pcap, decode, encode, lookfor, usbq_hooks
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/usbq", line 11, in
load_entry_point('usbq==0.1.0', 'console_scripts', 'usbq')()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/usbq/cli.py", line 128, in mitm
enabled=ctx.obj['enable_plugin'],
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/usbq/pm.py", line 62, in enable_plugins
mod = importlib.import_module(pd.mod)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 953, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'usbq.plugins'

USBQ:- An existing connection was forcibly closed by the remote host

Hi there,

I am using usbq and facing an issue. I am following the def con 17 tutorial to set up usbq mitm via a beagle bone board. I followed each step religiously but now I am getting this error whenever I try to bind and unbind with ubq_driver (as in the demo video). Also, the ANT+ dongle connected through my beaglebone black never showed up on my windows 10 laptop either.

Traceback (most recent call last):
File "C:\Python310\Scripts\usbq-script.py", line 33, in
sys.exit(load_entry_point('usbq==0.1.0', 'console_scripts', 'usbq')())
File "C:\Python310\lib\site-packages\click-8.0.3-py3.10.egg\click\core.py", line 1128, in call
return self.main(*args, **kwargs)
File "C:\Python310\lib\site-packages\click-8.0.3-py3.10.egg\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "C:\Python310\lib\site-packages\click-8.0.3-py3.10.egg\click\core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Python310\lib\site-packages\click-8.0.3-py3.10.egg\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Python310\lib\site-packages\click-8.0.3-py3.10.egg\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "C:\Python310\lib\site-packages\click-8.0.3-py3.10.egg\click\decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "C:\Python310\lib\site-packages\usbq-0.1.0-py3.10.egg\usbq\cli.py", line 130, in mitm
USBQEngine().run()
File "C:\Python310\lib\site-packages\usbq-0.1.0-py3.10.egg\usbq\engine.py", line 90, in run
self.event()
File "C:\Python310\lib\site-packages\usbq-0.1.0-py3.10.egg\usbq\engine.py", line 79, in event
self._do_host_packet()
File "C:\Python310\lib\site-packages\usbq-0.1.0-py3.10.egg\usbq\engine.py", line 41, in _do_host_packet
data = pm.hook.usbq_get_host_packet()
File "C:\Python310\lib\site-packages\pluggy-1.0.0-py3.10.egg\pluggy_hooks.py", line 265, in call
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "C:\Python310\lib\site-packages\pluggy-1.0.0-py3.10.egg\pluggy_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "C:\Python310\lib\site-packages\pluggy-1.0.0-py3.10.egg\pluggy_callers.py", line 60, in _multicall
return outcome.get_result()
File "C:\Python310\lib\site-packages\pluggy-1.0.0-py3.10.egg\pluggy_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "C:\Python310\lib\site-packages\pluggy-1.0.0-py3.10.egg\pluggy_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "C:\Python310\lib\site-packages\usbq-0.1.0-py3.10.egg\usbq\plugins\proxy.py", line 123, in usbq_get_host_packet
data, self._host_dst = self._host_sock.recvfrom(4096)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

Note:-

  1. Beaglebone is tethered to the PC with a USB
  2. Kernel has complied with the IP of 192.168.7.1 host computer

Please tell me how to get around this issue, thanks in advance

udc-core: couldn't find an available UDC - added [ubq_gadget] to list of pending drivers

Follow the given steps and started USBQ but Getting an error on beagle bone while mounting the ubqcore driver on USB drive. Need your help to resolve this issue
Running on Linux beaglebone 4.14.108-ti-r113 #1 SMP PREEMPT armv7l GNU/Linux

root@beaglebone:/usbq_core# echo '1-1:1.0' > /sys/bus/usb/drivers/ubq_driver/bind
root@beaglebone:/usbq_core# dmesg | tail
[ 2082.592616] *** NEW descriptor 05
[ 2082.592628] [ 15] GADGET parse_init_pkt(0706):
[ 2082.592633] New EP:number:1 type:BULK dir:IN bEndpointAddress:0x81 interval:0 wMaxPacketSize:512
[ 2082.592640] [ 15] GADGET check_descriptor_header(0550):
[ 2082.592644] HEADER: 05
[ 2082.592651] [ 15] GADGET parse_init_pkt(0691):
[ 2082.592655] *** NEW descriptor 05
[ 2082.592665] [ 15] GADGET parse_init_pkt(0706):
[ 2082.592670] New EP:number:2 type:BULK dir:OUT bEndpointAddress:0x02 interval:0 wMaxPacketSize:512
[ 2082.592680] udc-core: couldn't find an available UDC - added [ubq_gadget] to list of pending drivers
root@beaglebone:/usbq_core#

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.