volca / ESPloitV2

Migrate to platformio. WiFi Keystroke Injection Tool designed for an Atmega 32u4/ESP8266 Paired via Serial (Cactus WHID Firmware). Also features Serial, HTTP, and PASV FTP exfiltration methods and an integrated Credential Harvester Phishing tool called ESPortal.
MIT License
17 stars 1 forks source link

Exploit WiFi Not created anymore #2

Closed ixiliae closed 3 years ago

ixiliae commented 3 years ago

Hello,

I have several WHID Injectors that I am trying to flash to a QWERTZ keyboard.

I have followed the steps for flashing from a Windows machine, and had an output saying "Success" at the end.

However, I have no exploit Wi-Fi network that is created anymore. As such, I cannot see if the keyboard has been flashed properly or even use the drive at all.

I am using around 40 WHID a year and will need flashing in several languages over the coming year, and as such would appreciate help regarding this matter.

With regards

volca commented 3 years ago

Please paste the full terminal log when you flash the WHID.

ixiliae commented 3 years ago

Will do tonight when on the right computer and edit this message.

Thank you.

ixiliae commented 3 years ago

Processing whid (platform: https://github.com/volca/platform-espressif8266.git#whid; board: esp12e; framework: arduino)

Platform Manager: Installing git+https://github.com/volca/platform-espressif8266.git#whid git version 2.28.0.windows.1 Cloning into 'C:\Users\Max.platformio.cache\tmp\pkg-installing-5vip313k'... remote: Enumerating objects: 104, done. remote: Counting objects: 100% (104/104), done. remote: Compressing objects: 100% (80/80), done. Receiving objects: 59% (62/104)eused 42 (delta 12), pack-reused 0 Receiving objects: 100% (104/104), 28.97 KiB | 7.24 MiB/s, done. Resolving deltas: 100% (53/53), done. Platform Manager: espressif8266 @ 1.8.1-alpha.1+sha.b13eb26 has been installed! The platform 'https://github.com/volca/platform-espressif8266.git#whid' has been successfully installed! The rest of the packages will be installed later depending on your build environment. Tool Manager: Installing framework-arduinoespressif8266 @ ~2.20402.0 Tool Manager: Warning! More than one package has been found by framework-arduinoespressif8266 @ ~2.20402.0 requirements:

C:\Users\Max\Documents\xxxxx\SERT - USB\WHID\ESPloitV2-master\ESPloitV2-master\source>pio run -t upload -d 32u4 Processing LilyPadUSB (platform: atmelavr; framework: arduino; board: LilyPadUSB)

Verbose mode can be enabled via -v, --verbose option CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/LilyPadUSB.html PLATFORM: Atmel AVR (2.2.0) > Arduino LilyPad USB HARDWARE: ATMEGA32U4 8MHz, 2.50KB RAM, 28KB Flash DEBUG: Current (simavr) On-board (simavr) PACKAGES:

Connecting to programmer: . Found programmer: Id = "CATERIN"; type = S Software Version = 1.0; No Hardware Version given. Programmer supports auto addr increment. Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices: Device code: 0x44

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% -0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4) avrdude: reading input file ".pio\build\LilyPadUSB\firmware.hex" avrdude: writing flash (10444 bytes):

Writing | ################################################## | 100% 0.82s

avrdude: 10444 bytes of flash written avrdude: verifying flash memory against .pio\build\LilyPadUSB\firmware.hex: avrdude: load data flash data from input file .pio\build\LilyPadUSB\firmware.hex: avrdude: input file .pio\build\LilyPadUSB\firmware.hex contains 10444 bytes avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.13s

avrdude: verifying ... avrdude: 10444 bytes of flash verified

avrdude: safemode: Fuses OK (E:CE, H:D8, L:FF)

avrdude done. Thank you.

============================================= [SUCCESS] Took 7.96 seconds =============================================

volca commented 3 years ago

platformio updated to v5.0.x and it's not compatible with v4.x. Some packages for flash WHID can't work.

We'll update the packages soon. I will note on you

ixiliae commented 3 years ago

Thank you.

Do you have an ETA for this update ? I have managed to create scripts using character substitution for one of my uses but some of the layouts are just not going to work.

Could you also update the part about changing keyboard in more details for platformio, for other users who might need it ?

With regards

volca commented 3 years ago

about hours

ixiliae commented 3 years ago

Great. I sadly won't be able to perform the tests until at least next week or the next as I only had the last couple of days to work on it. I will keep you posted when I am finally able to test this new solution.

Thank you for investigating this matter this quick.

volca commented 3 years ago

we uploaded new packages and wait for platformio team review them. It should take some times.

volca commented 3 years ago

Please try our updated packages with the steps:

Let me know if this works

ixiliae commented 3 years ago

Hello,

I confirm that the WHID injector that was out of order is working again after removing the package and reflashing it.

Would you have more in-depth steps regarding flashing the drive with a new keyboard using platformio ? I used to modify the keyboard file on Arduino ide files but am unsure as to which file should be modified here.

With regards

volca commented 3 years ago

Thanks for update.

I'm not the original author of the software ESPloitV2. Please contact Corey instead

volca commented 3 years ago

close issue. Reopen it if you need

lorenzoPrimi commented 1 year ago

Hi @volca I have the same issue. Fresh install of this repo and flash of the device and the WiFi doesn't spawn. Tried this repo on OSX and Linux Here's my log

Processing LilyPadUSB (platform: atmelavr; framework: arduino; board: LilyPadUSB)
--------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/LilyPadUSB.html
PLATFORM: Atmel AVR (4.0.0) > Arduino LilyPad USB
HARDWARE: ATMEGA32U4 8MHz, 2.50KB RAM, 28KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.1.0 
 - tool-avrdude @ 1.60300.200527 (6.3.0) 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
Converting programmer.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/LilyPadUSB/src/programmer.ino.cpp.o
Linking .pio/build/LilyPadUSB/firmware.elf
Checking size .pio/build/LilyPadUSB/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  21.4% (used 548 bytes from 2560 bytes)
Flash: [==        ]  18.3% (used 5242 bytes from 28672 bytes)
Configuring upload protocol...
AVAILABLE: avr109
CURRENT: upload_protocol = avr109
Looking for upload port...
Auto-detected: /dev/cu.usbmodemHIDFG1
Forcing reset using 1200bps open/close on port /dev/cu.usbmodemHIDFG1
Waiting for the new upload port...
Uploading .pio/build/LilyPadUSB/firmware.hex

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file ".pio/build/LilyPadUSB/firmware.hex"
avrdude: writing flash (5242 bytes):

Writing | ################################################## | 100% 0.43s

avrdude: 5242 bytes of flash written
avrdude: verifying flash memory against .pio/build/LilyPadUSB/firmware.hex:
avrdude: load data flash data from input file .pio/build/LilyPadUSB/firmware.hex:
avrdude: input file .pio/build/LilyPadUSB/firmware.hex contains 5242 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.07s

avrdude: verifying ...
avrdude: 5242 bytes of flash verified

avrdude: safemode: Fuses OK (E:CB, H:D8, L:FF)

avrdude done.  Thank you.

======================================================= [SUCCESS] Took 4.11 seconds =======================================================
Processing clean (platform: espressif8266@2.0.4; board: esp12e; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp12e.html
PLATFORM: Espressif 8266 (2.0.4) > Espressif ESP8266 ESP-12E
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 @ 2.20500.190223 (2.5.0) 
 - tool-esptool @ 1.413.0 (4.13) 
 - toolchain-xtensa @ 1.40802.0 (4.8.2)
Converting ESP_Code.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 26 compatible libraries
Scanning dependencies...
Dependency Graph
|-- DNSServer @ 1.1.1
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266HTTPClient @ 1.2
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266HTTPUpdateServer @ 1.0
|   |-- ESP8266WebServer @ 1.0
|   |   |-- ESP8266WiFi @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266WebServer @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266WiFi @ 1.0
|-- ESP8266httpUpdate @ 1.3
|   |-- ESP8266HTTPClient @ 1.2
|   |   |-- ESP8266WiFi @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|   |-- ESP8266WiFi @ 1.0
Building in release mode
Looking for serial port...
Auto-detected: /dev/cu.usbmodem14301
Ready for erasing
warning: espcomm_sync failed
error: espcomm_open failed
*** [erase] Error 2
======================================================= [FAILED] Took 11.99 seconds =======================================================

Environment    Status    Duration
-------------  --------  ------------
clean          FAILED    00:00:11.986
================================================== 1 failed, 0 succeeded in 00:00:11.986 ==================================================
Processing whid (platform: https://github.com/volca/platform-espressif8266.git#whid; board: esp12e; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing volcas/tool-esptool @ 1.413.1
Error: Could not find the package with 'volcas/tool-esptool @ 1.413.1' requirements for your system 'darwin_x86_64'
Processing LilyPadUSB (platform: atmelavr; framework: arduino; board: LilyPadUSB)
--------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/LilyPadUSB.html
PLATFORM: Atmel AVR (4.0.0) > Arduino LilyPad USB
HARDWARE: ATMEGA32U4 8MHz, 2.50KB RAM, 28KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.1.0 
 - tool-avrdude @ 1.60300.200527 (6.3.0) 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
Converting main.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 7 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Mouse @ 1.0.1
|   |-- HID @ 1.0
|-- Keyboard @ 1.0.4
|   |-- HID @ 1.0
Building in release mode
Compiling .pio/build/LilyPadUSB/src/main.ino.cpp.o
Linking .pio/build/LilyPadUSB/firmware.elf
Checking size .pio/build/LilyPadUSB/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  24.6% (used 630 bytes from 2560 bytes)
Flash: [====      ]  36.6% (used 10480 bytes from 28672 bytes)
Configuring upload protocol...
AVAILABLE: avr109
CURRENT: upload_protocol = avr109
Looking for upload port...
Auto-detected: /dev/cu.usbmodem14301
Forcing reset using 1200bps open/close on port /dev/cu.usbmodem14301
Waiting for the new upload port...
Uploading .pio/build/LilyPadUSB/firmware.hex

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file ".pio/build/LilyPadUSB/firmware.hex"
avrdude: writing flash (10480 bytes):

Writing | ################################################## | 100% 0.84s

avrdude: 10480 bytes of flash written
avrdude: verifying flash memory against .pio/build/LilyPadUSB/firmware.hex:
avrdude: load data flash data from input file .pio/build/LilyPadUSB/firmware.hex:
avrdude: input file .pio/build/LilyPadUSB/firmware.hex contains 10480 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.13s

avrdude: verifying ...
avrdude: 10480 bytes of flash verified

avrdude: safemode: Fuses OK (E:CB, H:D8, L:FF)

avrdude done.  Thank you.

======================================================= [SUCCESS] Took 4.60 seconds =======================================================
volca commented 1 year ago

It seems platformio removed my tool package. See the logs

Processing whid (platform: https://github.com/volca/platform-espressif8266.git#whid; board: esp12e; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing volcas/tool-esptool @ 1.413.1
Error: Could not find the package with 'volcas/tool-esptool @ 1.413.1' requirements for your system 'darwin_x86_64'

Here's a workaround

  1. Download compiled esptool. Unzip the file and you will get two files esptool and package.json
  2. Modify the section [env:whid] in ESPloitV2/source/esp/platformio.ini. replace the package tool-esptool
    [env:whid]
    platform = https://github.com/volca/platform-espressif8266.git#whid
    board = esp12e
    platform_packages =
    platformio/tool-esptool@^1.413.0
    framework = arduino
    upload_speed = 115200
    upload_resetmethod = dtrset
    build_flags =
    -Wl,-Tesp8266.flash.4m.ld
    -DNDEBUG
    -DVTABLES_IN_FLASH
    -fno-exceptions
    ;ArduinoJson_ID64
    ;ESP8266FtpServer_ID992
    lib_deps =
    ArduinoJson@5.11.0
    https://github.com/exploitagency/esp8266FTPServer/archive/feature/bbx10_speedup.zip
  3. Install the package tool-esptool by the command. You
    pio run -e whid -d esp
  4. Find the installed package tool-esptool at ~/.platformio/packages/tool-esptool. Copy the two files in step 1 and overwrite the package
  5. Try the normal steps to flash your WHID ./flash.sh

Let me know if this works

lorenzoPrimi commented 1 year ago

With this scenario both clean and whid fails

Processing LilyPadUSB (platform: atmelavr; framework: arduino; board: LilyPadUSB)
--------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/LilyPadUSB.html
PLATFORM: Atmel AVR (4.0.0) > Arduino LilyPad USB
HARDWARE: ATMEGA32U4 8MHz, 2.50KB RAM, 28KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.1.0 
 - tool-avrdude @ 1.60300.200527 (6.3.0) 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
Converting programmer.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/LilyPadUSB/src/programmer.ino.cpp.o
Linking .pio/build/LilyPadUSB/firmware.elf
Checking size .pio/build/LilyPadUSB/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  21.4% (used 548 bytes from 2560 bytes)
Flash: [==        ]  18.3% (used 5242 bytes from 28672 bytes)
Configuring upload protocol...
AVAILABLE: avr109
CURRENT: upload_protocol = avr109
Looking for upload port...
Auto-detected: /dev/cu.usbmodemHIDFG1
Forcing reset using 1200bps open/close on port /dev/cu.usbmodemHIDFG1
Waiting for the new upload port...
Uploading .pio/build/LilyPadUSB/firmware.hex

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file ".pio/build/LilyPadUSB/firmware.hex"
avrdude: writing flash (5242 bytes):

Writing | ################################################## | 100% 0.42s

avrdude: 5242 bytes of flash written
avrdude: verifying flash memory against .pio/build/LilyPadUSB/firmware.hex:
avrdude: load data flash data from input file .pio/build/LilyPadUSB/firmware.hex:
avrdude: input file .pio/build/LilyPadUSB/firmware.hex contains 5242 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.07s

avrdude: verifying ...
avrdude: 5242 bytes of flash verified

avrdude: safemode: Fuses OK (E:CB, H:D8, L:FF)

avrdude done.  Thank you.

======================================================= [SUCCESS] Took 4.02 seconds =======================================================
Processing clean (platform: espressif8266@2.0.4; board: esp12e; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp12e.html
PLATFORM: Espressif 8266 (2.0.4) > Espressif ESP8266 ESP-12E
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 @ 2.20500.190223 (2.5.0) 
 - tool-esptool @ 1.413.0 (4.13) 
 - toolchain-xtensa @ 1.40802.0 (4.8.2)
Converting ESP_Code.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 26 compatible libraries
Scanning dependencies...
Dependency Graph
|-- DNSServer @ 1.1.1
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266HTTPClient @ 1.2
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266HTTPUpdateServer @ 1.0
|   |-- ESP8266WebServer @ 1.0
|   |   |-- ESP8266WiFi @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266WebServer @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266WiFi @ 1.0
|-- ESP8266httpUpdate @ 1.3
|   |-- ESP8266HTTPClient @ 1.2
|   |   |-- ESP8266WiFi @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|   |-- ESP8266WiFi @ 1.0
Building in release mode
Looking for serial port...
Auto-detected: /dev/cu.usbmodem14301
Ready for erasing
warning: espcomm_sync failed
error: espcomm_open failed
*** [erase] Error 2
======================================================= [FAILED] Took 12.19 seconds =======================================================

Environment    Status    Duration
-------------  --------  ------------
clean          FAILED    00:00:12.187
================================================== 1 failed, 0 succeeded in 00:00:12.187 ==================================================
Processing whid (platform: https://github.com/volca/platform-espressif8266.git#whid; board: esp12e; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing tool-espotapy @ ~1.1.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: tool-espotapy@1.1.3 has been installed!
Tool Manager: Installing tool-mkspiffs @ ~1.200.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: tool-mkspiffs@1.200.0 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp12e.html
PLATFORM: Espressif 8266 (1.8.1-alpha.1+sha.bccae0b) > Espressif ESP8266 ESP-12E
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 @ 2.20402.4 (2.4.2) 
 - tool-espotapy @ 1.1.3 
 - tool-esptool @ 1.413.0 (4.13) 
 - tool-mkspiffs @ 1.200.0 (2.0) 
 - toolchain-xtensa @ 1.40802.0 (4.8.2)
Converting ESP_Code.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 28 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ArduinoJson @ 5.11.0
|-- ESP8266FtpServer @ 1.0.1
|   |-- ESP8266WiFi @ 1.0
|-- DNSServer @ 1.1.0
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266HTTPClient @ 1.1
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266HTTPUpdateServer @ 1.0
|   |-- ESP8266WebServer @ 1.0
|   |   |-- ESP8266WiFi @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266WebServer @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266WiFi @ 1.0
|-- ESP8266httpUpdate @ 1.2
|   |-- ESP8266HTTPClient @ 1.1
|   |   |-- ESP8266WiFi @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS
|   |-- ESP8266WiFi @ 1.0
Building in release mode
Compiling .pio/build/whid/src/ESP_Code.ino.cpp.o
/Users/lorenzo/Downloads/ESPloitV2-master/source/esp/src/ESP_Code.ino:64:0: warning: "LED_BUILTIN" redefined [enabled by default]
 #define LED_BUILTIN 2
 ^
In file included from /Users/lorenzo/.platformio/packages/framework-arduinoespressif8266@2.20402.4/cores/esp8266/Arduino.h:300:0,
                 from /var/folders/m1/kxy0fn2n1b5_gbdnq4ytcn340000gn/T/tmp3mlv9e2r:1:
/Users/lorenzo/.platformio/packages/framework-arduinoespressif8266@2.20402.4/variants/nodemcu/pins_arduino.h:35:0: note: this is the location of the previous definition
 #define LED_BUILTIN 16
 ^
/Users/lorenzo/Downloads/ESPloitV2-master/source/esp/src/ESP_Code.ino: In function 'bool loadDefaults()':
/Users/lorenzo/Downloads/ESPloitV2-master/source/esp/src/ESP_Code.ino:411:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
/Users/lorenzo/Downloads/ESPloitV2-master/source/esp/src/ESP_Code.ino: In function 'bool RawFile(String)':
/Users/lorenzo/Downloads/ESPloitV2-master/source/esp/src/ESP_Code.ino:624:12: warning: unused variable 'sent' [-Wunused-variable]
     size_t sent = server.streamFile(file, "application/octet-stream");
            ^
/Users/lorenzo/Downloads/ESPloitV2-master/source/esp/src/ESP_Code.ino: In lambda function:
/Users/lorenzo/Downloads/ESPloitV2-master/source/esp/src/ESP_Code.ino:951:3: warning: control reaches end of non-void function [-Wreturn-type]
   });
   ^
Retrieving maximum program size .pio/build/whid/firmware.elf
Checking size .pio/build/whid/firmware.elf
Building .pio/build/whid/firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=====     ]  48.2% (used 39488 bytes from 81920 bytes)
Flash: [=====     ]  52.4% (used 547048 bytes from 1044464 bytes)
Configuring upload protocol...
Looking for upload port...
Auto-detected: /dev/cu.usbmodem14301
Uploading .pio/build/whid/firmware.bin
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
*** [upload] Error 2
======================================================= [FAILED] Took 18.72 seconds =======================================================

Environment    Status    Duration
-------------  --------  ------------
whid           FAILED    00:00:18.720
================================================== 1 failed, 0 succeeded in 00:00:18.720 ==================================================
Processing LilyPadUSB (platform: atmelavr; framework: arduino; board: LilyPadUSB)
--------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/LilyPadUSB.html
PLATFORM: Atmel AVR (4.0.0) > Arduino LilyPad USB
HARDWARE: ATMEGA32U4 8MHz, 2.50KB RAM, 28KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.1.0 
 - tool-avrdude @ 1.60300.200527 (6.3.0) 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
Converting main.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 7 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Mouse @ 1.0.1
|   |-- HID @ 1.0
|-- Keyboard @ 1.0.4
|   |-- HID @ 1.0
Building in release mode
Compiling .pio/build/LilyPadUSB/src/main.ino.cpp.o
Linking .pio/build/LilyPadUSB/firmware.elf
Checking size .pio/build/LilyPadUSB/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  24.6% (used 630 bytes from 2560 bytes)
Flash: [====      ]  36.6% (used 10480 bytes from 28672 bytes)
Configuring upload protocol...
AVAILABLE: avr109
CURRENT: upload_protocol = avr109
Looking for upload port...
Auto-detected: /dev/cu.usbmodem14301
Forcing reset using 1200bps open/close on port /dev/cu.usbmodem14301
Waiting for the new upload port...
Uploading .pio/build/LilyPadUSB/firmware.hex

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file ".pio/build/LilyPadUSB/firmware.hex"
avrdude: writing flash (10480 bytes):

Writing | ################################################## | 100% 0.86s

avrdude: 10480 bytes of flash written
avrdude: verifying flash memory against .pio/build/LilyPadUSB/firmware.hex:
avrdude: load data flash data from input file .pio/build/LilyPadUSB/firmware.hex:
avrdude: input file .pio/build/LilyPadUSB/firmware.hex contains 10480 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.13s

avrdude: verifying ...
avrdude: 10480 bytes of flash verified

avrdude: safemode: Fuses OK (E:CB, H:D8, L:FF)

avrdude done.  Thank you.

======================================================= [SUCCESS] Took 4.51 seconds =======================================================
lorenzoPrimi commented 1 year ago

I manually executed the 4 commands of the script flash.sh and now it worked! I don't know if it was the sleep to cause the problem but thank you!

Edit: worked once but can't reproduce the success scenario. Still fails clean and whid. At this point, it could be a problem with my device.

volca commented 1 year ago

Thanks for update. I think increase the sleep time in flash.sh should be helpful.

lorenzoPrimi commented 1 year ago

Seems like I can't reproduce the success scenario, the clean always fails, doesn't matter if I wait 1 sec or 1 hour. Do you think it could be my hardware malfunctioning?

volca commented 1 year ago

Add a command clean_esp.sh and execute the command ./clean_esp.sh

pio run -t upload -d esp-programmer
sleep 3
pio run -e clean -t erase -d esp --verbose

You should see something like

esptool -cp /dev/cu.usbmodem14301 -cd dtrset -ce

You can run the command manually to erase ESP8266

lorenzoPrimi commented 1 year ago

If I run manually that command I get

error: cannot access /dev/cu.usbmodem14301

error: espcomm_open failed

Could it be the reason that the pio run -t upload -d esp-programmer runs a reset

Looking for upload port...
Auto-detected: /dev/cu.usbmodem14601
Forcing reset using 1200bps open/close on port /dev/cu.usbmodem14601
Waiting for the new upload port...

and the clean doesn't?

volca commented 1 year ago

Could it be the reason that the pio run -t upload -d esp-programmer runs a reset

No. The step make ATMega32U4 to a serial programmer for ESP8266.

pio run -t upload -d esp-programmer

Do you use MacOS? Try another Linux laptop instead

lorenzoPrimi commented 1 year ago

Same exact error on Linux

Building in release mode
Looking for serial port...
Auto-detected: /dev/ttyACM0
Ready for erasing
warning: espcomm_sync failed
error: espcomm_open failed
*** [erase] Error 2
volca commented 1 year ago

Please check the version of esptool like this

~/.platformio/packages/tool-esptool/esptool -h

Is the version v0.4.14?

esptool v0.4.14 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
ESP8266/ESP32 build and upload helper tool
Maintained by Ivan Grokhotkov: https://github.com/igrr/esptool-ck

Or you need overwrite the esptool for Linux also

lorenzoPrimi commented 1 year ago

Yes it is that version, I downloaded the correct Linux version before trying on Linux. Even running it with~/.platformio/packages/tool-esptool/esptool -cp /dev/cu.usbmodem14301 -cd dtrset -ce or (/dev/ttyACM0 on Linux) doesn't work

volca commented 1 year ago

Did you see the red LED light when you run the command? It means the sketch esp-programmer start working

~/.platformio/packages/tool-esptool/esptool -cp /dev/cu.usbmodem14301 -cd dtrset -ce

lorenzoPrimi commented 1 year ago

Yes, the led turns right and after around 10 secs it shows the fail message. The only time it worked took 3s

volca commented 1 year ago

I think the ESP8266 module is bricked. It can't work any more

lorenzoPrimi commented 1 year ago

I kinda suspected that, will buy a new one. Thanks for all the help!