plasma-disassembler / plasma

Plasma is an interactive disassembler for x86/ARM/MIPS. It can generates indented pseudo-code with colored syntax.
GNU General Public License v3.0
3.05k stars 275 forks source link

AttributeError: '_io.BufferedReader' object has no attribute 'stream' #95

Closed em92 closed 5 years ago

em92 commented 5 years ago

Steps to reproduce:

$ cat 1.c
#include <stdio.h>

int main() {
  printf("hello\n");
}
$ gcc 1.c -o 1.out
$ ./1.out 
hello
$ plasma -i 1.out
Traceback (most recent call last):
  File "/usr/local/bin/plasma", line 11, in <module>
    load_entry_point('plasma==1.0', 'console_scripts', 'plasma')()
  File "/usr/local/lib/python3.5/dist-packages/plasma-1.0-py3.5-linux-x86_64.egg/plasma/main.py", line 35, in console_entry
    if not gctx.load_file():
  File "/usr/local/lib/python3.5/dist-packages/plasma-1.0-py3.5-linux-x86_64.egg/plasma/lib/__init__.py", line 197, in load_file
    self.db)
  File "/usr/local/lib/python3.5/dist-packages/plasma-1.0-py3.5-linux-x86_64.egg/plasma/lib/disassembler.py", line 102, in __init__
    self.load_symbols()
  File "/usr/local/lib/python3.5/dist-packages/plasma-1.0-py3.5-linux-x86_64.egg/plasma/lib/disassembler.py", line 160, in load_symbols
    self.binary.load_dyn_sym()
  File "/usr/local/lib/python3.5/dist-packages/plasma-1.0-py3.5-linux-x86_64.egg/plasma/lib/fileformat/elf.py", line 220, in load_dyn_sym
    fakestrtabheader, "strtab_plasma", self.elf.stream)
  File "/usr/local/lib/python3.5/dist-packages/elftools/elf/sections.py", line 30, in __init__
    self.stream = self.elffile.stream
AttributeError: '_io.BufferedReader' object has no attribute 'stream'

What is installed:

$ pip3 freeze
appdirs==1.4.0
APScheduler==2.1.2
beautifulsoup4==4.6.3
blinker==1.3
bs4==0.0.1
capstone==4.0.0rc1
chardet==2.3.0
click==6.7
cloud-init==18.3
command-not-found==0.3
configobj==5.0.6
cryptography==1.2.3
feedgen==0.7.0
feedparser==5.2.1
Flask==1.0.2
future==0.16.0
hibagent==1.0.1
hiredis==0.2.0
idna==2.0
itsdangerous==0.24
Jinja2==2.10
jsonpatch==1.10
jsonpointer==1.9
language-selector==0.1
lxml==4.2.5
MarkupSafe==0.23
msgpack-python==0.5.6
Nuitka==0.6.0.1
oauthlib==1.0.3
pefile==2018.8.8
plasma==1.0
prettytable==0.7.2
pyasn1==0.1.9
pycurl==7.43.0
pyelftools==0.25
pygobject==3.20.0
PyJWT==1.3.0
pymongo==2.8
pyserial==3.0.1
python-apt==1.1.0b1+ubuntu0.16.4.2
python-dateutil==2.7.3
python-debian==0.1.27
python-systemd==231
PyYAML==3.11
pyzmq==17.1.0
redis==2.10.6
requests==2.9.1
six==1.10.0
ssh-import-id==5.5
ufw==0.35
unattended-upgrades==0.1
urllib3==1.13.1
virtualenv==15.0.1
vk-api==7.3
Werkzeug==0.14.1
stawrocek commented 5 years ago

I have got same error on master branch

stawrocek commented 5 years ago

Also

make
.EEEEEEEEEEEEEEEEEEEEEEEEEEE.EEEE...EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
5/90 tests passed successfully in 0.953664s
failed: andor6.bin
failed: break1.bin
failed: if7.bin
failed: gotoinloop18.bin
failed: gotoinloop14.bin
failed: dowhile1.bin
failed: x86.bin
failed: canary_plt.bin
failed: andor2.bin
failed: if9.bin
failed: andor5.bin
failed: goto8.bin
failed: nestedloop3.bin
failed: goto3.bin
failed: gotoinloop5.bin
failed: gotoinloop9.bin
failed: nestedloop7.bin
failed: goto2.bin
failed: dowhile3.bin
failed: nestedloop6.bin
failed: gotoinloop1.bin
failed: andor3.bin
failed: and1.bin
failed: if4.bin
failed: loopends2.bin
failed: gotoinloop8.bin
failed: continue3.bin
failed: gotoinloop2.bin
failed: break2.bin
failed: goto7.bin
failed: gotoinloop19.bin
failed: or2.bin
failed: if5.bin
failed: gotoinloop10.bin
failed: goto6.bin
failed: loopinf3.bin
failed: gotoinloop20_nestedloop7.bin
failed: nestedloop4.bin
failed: gotoinloop17.bin
failed: andor1.bin
failed: goto1.bin
failed: if1.bin
failed: or4.bin
failed: gotoinloop6.bin
failed: jump_is_loop.bin
failed: loopinf2.bin
failed: andor4.bin
failed: goto9.bin
failed: return1.bin
failed: and4.bin
failed: loopinf4.bin
failed: dowhile4.bin
failed: gotoinloop12.bin
failed: continue2.bin
failed: dowhile2.bin
failed: or3.bin
failed: gotoinloop16.bin
failed: gotoinloop20_2_nestedloop7.bin
failed: chars1.bin
failed: gotoinloop11.bin
failed: loopends1.bin
failed: or1.bin
failed: if6.bin
failed: and3.bin
failed: and2.bin
failed: loopinf1.bin
failed: goto4.bin
failed: nestedloop5.bin
failed: if3.bin
failed: goto5.bin
failed: gotoinloop3.bin
failed: return2.bin
failed: if8.bin
failed: nestedloop2.bin
failed: strlen.bin
failed: continue1.bin
failed: gotoinloop4.bin
failed: nestedloop1.bin
failed: break3.bin
failed: server.bin
failed: server.bin
failed: gotoinloop13.bin
failed: gotoinloop7.bin
failed: if2.bin
failed: gotoinloop15.bin
analyzer tests...
arrays [FAIL]
ifexit [FAIL]
invert_cond [FAIL]
mips_prefetch [FAIL]
overlap [FAIL]
pusha [FAIL]
regsim [FAIL]
stack [FAIL]
switch [FAIL]
stawrocek commented 5 years ago

@plasma-disassembler Any updates on this one?

D0048 commented 5 years ago

Having the same issue.

stawrocek commented 5 years ago

@D0048 There is already a pull request for this: https://github.com/plasma-disassembler/plasma/pull/96

plasma-disassembler commented 5 years ago

Sorry to be late, I think it's now resolved with the commit 3adb1f29e7f3c6666032a82b3dd33aab629ae5f9 Thanks to @GH0st3rs