Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pexpect.exceptions.EOF: End Of File (EOF). Exception style platform. #62

Open
terorr opened this issue Mar 12, 2021 · 12 comments
Open

pexpect.exceptions.EOF: End Of File (EOF). Exception style platform. #62

terorr opened this issue Mar 12, 2021 · 12 comments

Comments

@terorr
Copy link

terorr commented Mar 12, 2021

./fat.py wnap320_V3.7.11.4_firmware.tar

                           __           _
                          / _|         | |
                         | |_    __ _  | |_
                         |  _|  / _` | | __|
                         | |   | (_| | | |_
                         |_|    \__,_|  \__|

            Welcome to the Firmware Analysis Toolkit - v0.3
Offensive IoT Exploitation Training http://bit.do/offensiveiotexploitation
              By Attify - https://attify.com  | @attifyme

[+] Firmware: wnap320_V3.7.11.4_firmware.tar
[+] Extracting the firmware...
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 166, in read_nonblocking
s = os.read(self.child_fd, size)
OSError: [Errno 5] Input/output error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 111, in expect_loop
incoming = spawn.read_nonblocking(spawn.maxread, timeout)
File "/usr/lib/python3/dist-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking
return super(spawn, self).read_nonblocking(size)
File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 171, in read_nonblocking
raise EOF('End Of File (EOF). Exception style platform.')
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./fat.py", line 170, in
main()
File "./fat.py", line 158, in main
image_id = run_extractor(args.firm_path)
File "./fat.py", line 52, in run_extractor
child.expect_exact("Tag: ")
File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 418, in expect_exact
return exp.expect_loop(timeout)
File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 117, in expect_loop
return self.eof(e)
File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 63, in eof
raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x7f994ab87040>
command: /home/hjk/soft/firmware-analysis-toolkit-master/firmadyne/sources/extractor/extractor.py
args: ['/home/hjk/soft/firmware-analysis-toolkit-master/firmadyne/sources/extractor/extractor.py', '-np', '-nk', 'wnap320_V3.7.11.4_firmware.tar', '/home/hjk/soft/firmware-analysis-toolkit-master/firmadyne/images']
buffer (last 100 chars): b''
before (last 100 chars): b'firmware-analysis-toolkit-master/firmadyne/wnap320_V3.7.11.4_firmware.tar\r\n>> Skipping: completed!\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 23010
child_fd: 5
closed: False
timeout: None
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_string:
0: b'Tag: '

@BlackTrackDragon
Copy link

Same problem.
Firmware image: https://static.tp-link.com/TL-WR945N(EU)_V1_161028.zip

@cloud0606

This comment has been minimized.

@cloud0606
Copy link

cloud0606 commented Mar 23, 2021

It work for me killing fat-related processes, but I don’t know what caused the error, I guess it might be the memory space too small.

cuc@cuc-VirtualBox:~/tools/firmware-analysis-toolkit$ ps aux | grep fat 
cuc       2304 82.4  0.6  53924  6348 ?        R    17:24 147:52 python3 /home/cuc/tools/firmware-analysis-toolkit/fat.py /home/cuc/tools/firmware-analysis-toolkit/share/dlink/DCS-930L_Ax_v1.15.04.bin
root      2623  0.3  6.4 1191064 64876 pts/18  Sl+  17:26   0:42 qemu-system-mipsel -m 256 -M malta -kernel /home/cuc/tools/firmware-analysis-toolkit/firmadyne/binaries//vmlinux.mipsel -drive if=ide,format=raw,file=/home/cuc/tools/firmware-analysis-toolkit/firmadyne/scratch//7//image.raw -append root=/dev/sda1 console=ttyS0 nandsim.parts=64,64,64,64,64,64,64,64,64,64 rdinit=/firmadyne/preInit.sh rw debug ignore_loglevel print-fatal-signals=1 user_debug=31 firmadyne.syscall=0 -nographic -netdev socket,id=net1,listen=:2001 -device e1000,netdev=net1 -netdev socket,id=net2,listen=:2002 -device e1000,netdev=net2 -netdev socket,id=net3,listen=:2003 -device e1000,netdev=net3
cuc      12754  0.0  0.1  15756  1088 pts/23   S+   20:24   0:00 grep --color=auto fat
cuc@cuc-VirtualBox:~/tools/firmware-analysis-toolkit$ sudo kill -9 2304
cuc@cuc-VirtualBox:~/tools/firmware-analysis-toolkit$ sudo kill -9 2623
./fat.py wnap320_V3.7.11.4_firmware.tar

           __           _
                       / _|         | |
                      | |_    __ _  | |_
                      |  _|  / _` | | __|
                      | |   | (_| | | |_
                      |_|    \__,_|  \__|

         Welcome to the Firmware Analysis Toolkit - v0.3
Offensive IoT Exploitation Training http://bit.do/offensiveiotexploitation
           By Attify - https://attify.com  | @attifyme

[+] Firmware: wnap320_V3.7.11.4_firmware.tar
[+] Extracting the firmware...
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 166, in read_nonblocking
s = os.read(self.child_fd, size)
OSError: [Errno 5] Input/output error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 111, in expect_loop
incoming = spawn.read_nonblocking(spawn.maxread, timeout)
File "/usr/lib/python3/dist-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking
return super(spawn, self).read_nonblocking(size)
File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 171, in read_nonblocking
raise EOF('End Of File (EOF). Exception style platform.')
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./fat.py", line 170, in
main()
File "./fat.py", line 158, in main
image_id = run_extractor(args.firm_path)
File "./fat.py", line 52, in run_extractor
child.expect_exact("Tag: ")
File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 418, in expect_exact
return exp.expect_loop(timeout)
File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 117, in expect_loop
return self.eof(e)
File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 63, in eof
raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x7f994ab87040>
command: /home/hjk/soft/firmware-analysis-toolkit-master/firmadyne/sources/extractor/extractor.py
args: ['/home/hjk/soft/firmware-analysis-toolkit-master/firmadyne/sources/extractor/extractor.py', '-np', '-nk', 'wnap320_V3.7.11.4_firmware.tar', '/home/hjk/soft/firmware-analysis-toolkit-master/firmadyne/images']
buffer (last 100 chars): b''
before (last 100 chars): b'firmware-analysis-toolkit-master/firmadyne/wnap320_V3.7.11.4_firmware.tar\r\n>> Skipping: completed!\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 23010
child_fd: 5
closed: False
timeout: None
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_string:
0: b'Tag: 

@So4ms
Copy link

So4ms commented May 14, 2021

I encountered the same problem, have you solved it?

@Applebois
Copy link

Any solutions on this ??

@Applebois
Copy link

I think I found the solution.

Go to firmadyne/sources/extractor/exrtractor.py
change first line to
#!/usr/bin/env python3

@MatthewTingum
Copy link

Go to firmadyne/sources/extractor/exrtractor.py
change first line to
#!/usr/bin/env python3

Interesting...

00000000 (Not Committed Yet 2021-10-16 14:32:53 -0500   1) #!/usr/bin/env python333
^5520c64 (Dominic Chen      2016-02-14 17:37:18 -0500   2) 
^5520c64 (Dominic Chen      2016-02-14 17:37:18 -0500   3) """

@flamecopper
Copy link

For me I just reinstall the entire thing, it works for me, I swear

@AblePart
Copy link

first run ./reset.py or sudo ./reset.py
then sudo ./fat.py fimwarefile.bin

some times previous workspace lives and causes problem!

@Grolar1337
Copy link

i have the same problem is there any way to fix it

@KoelhoSec
Copy link

first run ./reset.py or sudo ./reset.py then sudo ./fat.py fimwarefile.bin

some times previous workspace lives and causes problem!

Worked for me!

@sdahiasdba
Copy link

(ayman㉿kali)-[~/Downloads/firmware-analysis-toolkit/firmadyne]
└─$ sudo ./fat.py Gaw5.6T02-4-DL-R1B020-ME.EN_upgrade(0322113411).en_upgrade

                           __           _
                          / _|         | |
                         | |_    __ _  | |_
                         |  _|  / _` | | __|
                         | |   | (_| | | |_
                         |_|    \__,_|  \__|

            Welcome to the Firmware Analysis Toolkit - v0.3
Offensive IoT Exploitation Training http://bit.do/offensiveiotexploitation
              By Attify - https://attify.com  | @attifyme

[+] Firmware: Gaw5.6T02-4-DL-R1B020-ME.EN_upgrade(0322113411).en_upgrade
[+] Extracting the firmware...
Traceback (most recent call last):
File "/home/ayman/Downloads/firmware-analysis-toolkit/firmadyne/./fat.py", line 172, in
main()
File "/home/ayman/Downloads/firmware-analysis-toolkit/firmadyne/./fat.py", line 160, in main
image_id = run_extractor(args.firm_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ayman/Downloads/firmware-analysis-toolkit/firmadyne/./fat.py", line 54, in run_extractor
child.expect_exact("Tag: ")
File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 432, in expect_exact
return exp.expect_loop(timeout)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 179, in expect_loop
return self.eof(e)
^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 122, in eof
raise exc
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x7f0484008050>
command: /usr/bin/sudo
args: ['/usr/bin/sudo', '--', '/home/ayman/Downloads/firmware-analysis-toolkit/sources/extractor/extractor.py', '-np', '-nk', 'Gaw5.6T02-4-DL-R1B020-ME.EN_upgrade(0322113411).en_upgrade', '/home/ayman/Downloads/firmware-analysis-toolkit/images']
buffer (last 100 chars): b''
before (last 100 chars): b'ayman/Downloads/firmware-analysis-toolkit/sources/extractor/extractor.py: command not found\r\nayman\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: 1
flag_eof: True
pid: 17610
child_fd: 5
closed: False
timeout: None
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_string:
0: b'Tag: '

I have same this problem anyone solve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests