ehabhussein / AutoGadgetFS

USB testing made easy
https://agfs.io
MIT License
110 stars 22 forks source link

An error about Test the installation #5

Closed fusss9 closed 2 years ago

fusss9 commented 2 years ago

Traceback (most recent call last): File "USBtest.py", line 1, in import libagfs File "/home/pi/AutoGadgetFS/libagfs.py", line 119 if path.exists(f"devEnumCT/{self.SelectedDevice}.db"): ^ SyntaxError: invalid syntax

ehabhussein commented 2 years ago

please provide steps to replicate this issue.

fusss9 commented 2 years ago

I follow Linux Machine: Install to Test the installation to import libagfs and report an error

fusss9 commented 2 years ago

error

ehabhussein commented 2 years ago

Please use python3

please follow the steps in https://docs.agfs.io/#selecting-your-device and let me know

┌──(kali㉿kali)-[~]
└─$ git clone https://github.com/ehabhussein/AutoGadgetFS
Cloning into 'AutoGadgetFS'...
remote: Enumerating objects: 1619, done.
remote: Counting objects: 100% (179/179), done.
remote: Compressing objects: 100% (146/146), done.
remote: Total 1619 (delta 106), reused 65 (delta 31), pack-reused 1440
Receiving objects: 100% (1619/1619), 4.27 MiB | 2.42 MiB/s, done.
Resolving deltas: 100% (952/952), done.

┌──(kali㉿kali)-[~]
└─$ cd AutoGadgetFS 

┌──(kali㉿kali)-[~/AutoGadgetFS]
└─$ sudo bash
┌──(root💀kali)-[/home/kali/AutoGadgetFS]
└─# pip3 install -r requirements.txt 
Collecting paramiko==2.6.0
 ................ SNIP

──(root💀kali)-[/home/kali/AutoGadgetFS]
└─# ipython3                                                                 
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.22.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import libagfs

In [2]: X = libagfs.agfs()
***************************************
AutoGadgetFS: USB testing made easy
***************************************
Give your project a name?!: xscgv
0 : Linux 5.10.0-kali9-amd64 ehci_hcd:2:7531
1 : VMware:8:3599
2 : VMware, Inc.:2:3599
3 : VMware:3:3599
4 : Linux 5.10.0-kali9-amd64 uhci_hcd:1:7531
---> Select a device: 0
DEVICE ID 1d6b:0002 on Bus 001 Address 001 =================
 bLength                :   0x12 (18 bytes)
 bDescriptorType        :    0x1 Device
 bcdUSB                 :  0x200 USB 2.0

......... SNIP

directory structure created:

┌──(root💀kali)-[/home/kali/AutoGadgetFS]
└─# ls                                                                       
agfsconsole.py     ctrltrnsfdb     libagfs.py     rabbitMQbrokerconfig
agfsSettings.json  databases       LICENSE        README.md
binariesdb         devEnumCT       payloads       requirements.txt
clones             devfuzzresults  Pizero         screenshots
CNAME              EDAP.py         __pycache__    thanks.md
_config.yml        gadgetscripts   pyusb_patches

using python3

┌──(root💀kali)-[/home/kali/AutoGadgetFS]
└─# cat foo.py 
import libagfs

x = libagfs.agfs()

┌──(root💀kali)-[/home/kali/AutoGadgetFS]
└─# python3 foo.py 
***************************************
AutoGadgetFS: USB testing made easy
***************************************
Give your project a name?!: 
fusss9 commented 2 years ago

yes,I use python3 and follow the steps https://docs.agfs.io/#selecting-your-device

pi@raspberrypi:~ $ cd AutoGadgetFS/
pi@raspberrypi:~/AutoGadgetFS $ ls
agfsconsole.py     _config.yml  LICENSE        rabbitMQbrokerconfig  screenshots
agfsSettings.json  EDAP.py      Pizero         README.md             thanks.md
CNAME              libagfs.py   pyusb_patches  requirements.txt      USBtest.py
pi@raspberrypi:~/AutoGadgetFS $ ipython3
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import libagfs
  File "/home/pi/AutoGadgetFS/libagfs.py", line 119
    if path.exists(f"devEnumCT/{self.SelectedDevice}.db"):
                                                       ^
SyntaxError: invalid syntax

In [2]: 
fusss9 commented 2 years ago
pi@raspberrypi:~/AutoGadgetFS $ cat foo.py 
import libagfs

x = libagfs.agfs()pi@raspberrypi:~/AutoGadgetFS $ python3 foo.py 
Traceback (most recent call last):
  File "foo.py", line 1, in <module>
    import libagfs
  File "/home/pi/AutoGadgetFS/libagfs.py", line 119
    if path.exists(f"devEnumCT/{self.SelectedDevice}.db"):
                                                       ^
SyntaxError: invalid syntax
pi@raspberrypi:~/AutoGadgetFS $ 
ehabhussein commented 2 years ago

Also upgrade python to 3.9 if possible

  1. remove the directory
  2. git clone the repo
  3. sudo bash
  4. cd into the directory
  5. install the python requirements
  6. use ipython3 as root

should work. if not try it out on another machine using kali.