JohnDMcMaster / usbrply

Replay USB messages from Wireshark (.cap) files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python script without data

QkiZMR opened this issue · comments

commented

I made some captures on Windows with Wireshark and usbpcap and then saved it to file.
profil2.zip
Then I tried convert it python script. usbrply generated script but without any data in it. I made few others captures and tried to convert them but all always converted to same script without any data.
profil2.py.zip

Interrupt support is pretty poor and had been explicitly filtered out. I just made a quick stab to support your data. Please let me know if this helps.

Sample output:

    # Generated from packet 107/108
    controlWrite(0x21, 0x09, 0x0204, 0x0001, b"")
    # Generated from packet 102/109
    buff = interruptRead(0x82, 0x0040)
    validate_read(b"\x04\x02\x00\x02\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
            b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
            b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
            b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", buff, "packet 102/109")
commented

I updated local repo and made sudo python setup install again. When I'm trying to run usbrply I'm getting following error:

 $ usbrply --device-hi -p profil1.pcapng > profil1.py
Traceback (most recent call last):
  File "/usr/local/bin/usbrply", line 4, in <module>
    __import__('pkg_resources').run_script('usbrply==2.0.1', 'usbrply')
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 666, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1469, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/usbrply-2.0.1-py2.7.egg/EGG-INFO/scripts/usbrply", line 4, in <module>
    __import__('pkg_resources').run_script('usbrply==2.0.1', 'usbrply')
  File "build/bdist.linux-x86_64/egg/usbrply/parsers.py", line 6, in <module>
  File "/usr/local/lib/python2.7/dist-packages/usbrply-2.0.1-py2.7.egg/usbrply/win_pcap.py", line 494
    self.verbose and print("WARNING: unknown transfer type %u" % self.urb.transfer_type)
                         ^
SyntaxError: invalid syntax

EDIT:
nvm, I was using python 2.7 except 3.8.
Now scripts contain some data but it doesn't interact with hardware. I converted this scripts to switch profiles on my gaming keyboard. But keyboard didn't react to scripts.

ah yeah py2 has been on the way out but forgot to update the default. Fixed to default to py3

Hmm unfortunately not sure what I can do to help further. I'd suggest taking a look at wireshark GUI vs the generated python code to see if it looks reasonable?

Also: did you include --wrapper? Otherwise it won't give you a main() to actually execute the code

Please let me know if there is anything I can do, otherwise I will assume this is solved and close ticket for inactivity. Thank you.

Closed for inactivity.