Great tool, hoping I can get the fix to finish my RE project.
If my cursory analysis is correct, the code needs to replace StringO with BytesIO to handle bytes stream correctly, but I am not 100% sure. I am working on REing my esp8266, if I get this fixed for python3 I will update the issue. However, I'd be grateful if you have a quick fix ( I am not seasoned at python programming)
#####################################################################
1) StringIO deprecated in Python3
#####################################################################
┌──(kali㉿kali)-[~/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf]
└─$ python3 esp8266-bin-to-elf.py
Traceback (most recent call last):
File "/home/kali/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf/esp8266-bin-to-elf.py", line 1, in
import esp_bin2elf
File "/home/kali/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf/esp_bin2elf.py", line 8, in
from esp_rom import EspRom
File "/home/kali/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf/esp_rom.py", line 7, in
from StringIO import StringIO
ModuleNotFoundError: No module named 'StringIO'
#####################################################################
2) After updating the code to import StringIO from io
#####################################################################
(kali㉿kali)-[~/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf]
└─$ python3 esp8266-bin-to-elf.py
Traceback (most recent call last):
File "/home/kali/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf/esp8266-bin-to-elf.py", line 5, in
rom = esp_bin2elf.parse_rom('tywe3s-2mb.bin', '../bin/tywe3s-2mb.bin', flash_layout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf/esp_bin2elf.py", line 14, in parse_rom
rom = EspRom(rom_name, f, flash_layout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf/esp_rom.py", line 15, in init
self.contents = rom_bytes_stream.read()
^^^^^^^^^^^^^^^^^^^^^^^
File "", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 0: invalid continuation byte
Hi Sandin,
Great tool, hoping I can get the fix to finish my RE project.
If my cursory analysis is correct, the code needs to replace StringO with BytesIO to handle bytes stream correctly, but I am not 100% sure. I am working on REing my esp8266, if I get this fixed for python3 I will update the issue. However, I'd be grateful if you have a quick fix ( I am not seasoned at python programming)
##################################################################### 1) StringIO deprecated in Python3 ##################################################################### ┌──(kali㉿kali)-[~/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf] └─$ python3 esp8266-bin-to-elf.py
import esp_bin2elf
File "/home/kali/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf/esp_bin2elf.py", line 8, in
from esp_rom import EspRom
File "/home/kali/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf/esp_rom.py", line 7, in
from StringIO import StringIO
ModuleNotFoundError: No module named 'StringIO'
Traceback (most recent call last): File "/home/kali/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf/esp8266-bin-to-elf.py", line 1, in
##################################################################### 2) After updating the code to import StringIO from io ##################################################################### (kali㉿kali)-[~/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf] └─$ python3 esp8266-bin-to-elf.py
rom = esp_bin2elf.parse_rom('tywe3s-2mb.bin', '../bin/tywe3s-2mb.bin', flash_layout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf/esp_bin2elf.py", line 14, in parse_rom
rom = EspRom(rom_name, f, flash_layout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf/esp_rom.py", line 15, in init
self.contents = rom_bytes_stream.read()
^^^^^^^^^^^^^^^^^^^^^^^
File "", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 0: invalid continuation byte
Traceback (most recent call last): File "/home/kali/Desktop/CSC-844/TuyaTYWE3S/esp-bin2elf/esp8266-bin-to-elf.py", line 5, in