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

Unable to load: radare_core.py: ValueError: invalid literal for int() with base 10 #25

Open
blshkv opened this issue Mar 21, 2016 · 9 comments

Comments

@blshkv
Copy link

blshkv commented Mar 21, 2016

Hi, I'm unable to decompile an intel 64 binary. The error is below:

bokken-1.8
radare2-0.10.1 (with capstone-3.0.4)

bokken.py 
        Python version...       OK
        Radare availability...  OK
        GTK UI dependencies...  OK
        GtkSourceView2...       OK
        Graphviz binaries...    OK
Starting bokken 1.8, running on:
  Python version:
    2.7.10 (default, Nov 18 2015, 08:41:51) 
    [GCC 4.9.3]
  GTK version: 2.24.29
  PyGTK version: 2.24.0

After    0 cycles:      ;-- section_end..plt;-- , section..text:
0x00001f30      55                    push rbp     ; [11] va=0x00001f30 pa=0x00001f30 sz=22682 vsz=22682 rwx=--r-x .text
Traceback (most recent call last):
  File "./bokken.py", line 76, in <module>
    bokken()
  File "./bokken.py", line 71, in bokken
    'radare' if args.radare else '',
  File "/usr/share/bokken/ui/main.py", line 395, in main
    BokkenGTKClient(target, backend)
  File "/usr/share/bokken/ui/main.py", line 163, in __init__
    self.tviews = textviews.TextViews(self.uicore, self)
  File "/usr/share/bokken/ui/textviews.py", line 148, in __init__
    self.right_notebook = rightnotebook.RightNotebook(self)
  File "/usr/share/bokken/ui/rightnotebook.py", line 46, in __init__
    self.create_tabs()
  File "/usr/share/bokken/ui/rightnotebook.py", line 98, in create_tabs
    self.add_info_elements_tab()
  File "/usr/share/bokken/ui/rightnotebook.py", line 152, in add_info_elements_tab
    self.uicore.get_full_file_info()
  File "/usr/share/bokken/ui/radare_core.py", line 469, in get_full_file_info
    self.full_fileinfo['eps'].append(['Entry0', hex(int(line))])
ValueError: invalid literal for int() with base 10: '{"vaddr":10032,"paddr":10032,"baddr":0,"laddr":0}'
@blshkv blshkv changed the title radare_core.py: ValueError: invalid literal for int() with base 10 Unable to load: radare_core.py: ValueError: invalid literal for int() with base 10 Mar 21, 2016
@hteso
Copy link
Contributor

hteso commented Mar 21, 2016

Hi,

Most probably the issue is a compatibility problem as Bokken 1.8 ONLY works with radare2 0.9.9 and you are using radare2 0.10.1 :/ Next Bokken release will work with the latest radare2 version.

To be sure that is not a bokken problem I would need the binary you are using; can you share it or is it private?

@blshkv
Copy link
Author

blshkv commented Mar 21, 2016

It is definitely a new output of radare2-0.10.1 (the suspected commit is radareorg/radare2#3249) since it was working fine with the previous version.

The issue is reproducible with any binary. I loaded a random /bin/more and got the same error message. Let me know if you need it (42832 bytes)

@hteso
Copy link
Contributor

hteso commented Mar 21, 2016

Great, thanks for the info!

It will be fixed in the next release. In the meantime... I'm afraid Bokken 1.8 will only work with r2 0.9.9 :/

@blshkv
Copy link
Author

blshkv commented Mar 21, 2016

Please share a link to a patch once it's ready so I could backport it to 1.8. It might take months for you to release a new version but the patch should be trivial. Thanks a lot

@hteso
Copy link
Contributor

hteso commented Mar 21, 2016

lol

Hopefully it will not be months, but I'll share the patch :)

@rahulpathakgit
Copy link

I am getting the same issue,

File "/home/platform/Temporary/tmp_packages/radare/bokken-1.8/ui/radare_core.py", line 469, in get_full_file_info
self.full_fileinfo['eps'].append(['Entry0', hex(int(line))])
ValueError: invalid literal for int() with base 10: '{"vaddr":756,"paddr":757,"baddr":0,"laddr":0,"type":"program"}'

is this issue fixed and merged already? Will it be possible to get the patch

@Stenudd
Copy link

Stenudd commented Apr 12, 2016

Same here, also radare2-0.10.1, no patch?

    Python version...   OK
    Radare availability...  OK
    GTK UI dependencies...  OK
    GtkSourceView2...   OK
    Graphviz binaries...    OK
Starting bokken 1.8, running on:
  Python version:
    2.7.10 (default, Feb 28 2016, 15:59:27) 
    [GCC 4.8.4]
  GTK version: 2.24.27
  PyGTK version: 2.24.0

After    0 cycles:  ;-- _GLOBAL__sub_I_g_FileSystemFactory;-- , section..text:
0x00049490      31 c0                 xor eax, eax ; [9] va=0x00049490 pa=0x00049490 sz=540092 vsz=540092 rwx=--r-x .text
Traceback (most recent call last):
  File "/usr/share/bokken/bokken.py", line 76, in <module>
    bokken()
  File "/usr/share/bokken/bokken.py", line 71, in bokken
    'radare' if args.radare else '',
  File "/usr/share/bokken/ui/main.py", line 395, in main
    BokkenGTKClient(target, backend)
  File "/usr/share/bokken/ui/main.py", line 163, in __init__
    self.tviews = textviews.TextViews(self.uicore, self)
  File "/usr/share/bokken/ui/textviews.py", line 148, in __init__
    self.right_notebook = rightnotebook.RightNotebook(self)
  File "/usr/share/bokken/ui/rightnotebook.py", line 46, in __init__
    self.create_tabs()
  File "/usr/share/bokken/ui/rightnotebook.py", line 98, in create_tabs
    self.add_info_elements_tab()
  File "/usr/share/bokken/ui/rightnotebook.py", line 152, in add_info_elements_tab
    self.uicore.get_full_file_info()
  File "/usr/share/bokken/ui/radare_core.py", line 469, in get_full_file_info
    self.full_fileinfo['eps'].append(['Entry0', hex(int(line))])
ValueError: invalid literal for int() with base 10: '{"vaddr":300176,"paddr":300176,"baddr":0,"laddr":0}'

@jeffball55
Copy link

I fixed this issue with the following hack to ui/radare_core.py (for those who want to use it until a real fix is included). Basically the issue stems from the radare command iej output format being changed to the string representation of a python dictionary inside a list, i.e. [{"vaddr":4195392,"paddr":1088,"baddr":4194304,"laddr":0,"type":"program"}].

This snippet hacks the parser to use the new format.

ui/radare_core.py
@@ -456,8 +465,11 @@
             if entryp:
                 self.full_fileinfo['eps'] = []
                 for line in entryp.split('\n'):
-                    line = line.strip('[').strip(']')
-                    self.full_fileinfo['eps'].append(['Entry0', hex(int(line))])
+                    line = line.strip()
+                    if line != "":
+                      entries = eval(line.strip()) # fuck it, just use an eval
+                      for entry in entries:
+                        self.full_fileinfo['eps'].append(['Entry0', hex(entry['vaddr'])])
             # Get symbols
             symbols = self.send_cmd_str('is')
             if symbols:

blshkv pushed a commit to pentoo/pentoo-overlay that referenced this issue Apr 30, 2016
@blshkv
Copy link
Author

blshkv commented Aug 27, 2016

I hate to be right but it's been 4 months and counting. Please fix 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

5 participants