IOsipov / androguard

Automatically exported from code.google.com/p/androguard
Apache License 2.0
0 stars 0 forks source link

still have a problem with get_raw in dvm #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.run dalvikvm_format_2.py with sample facebook apk file
2.get_raw() raised an exception 

What is the expected output? What do you see instead?
Traceback (most recent call last):
  File "./demos/dalvikvm_format_2.py", line 46, in <module>
    fd.write( j.save() )
  File ".//core/bytecodes/dvm.py", line 3513, in save
    return self._get_raw()
  File ".//core/bytecodes/dvm.py", line 3541, in _get_raw
    l = self.map_list.get_raw()
  File ".//core/bytecodes/dvm.py", line 3449, in get_raw
    [ x.get_raw() for x in self.map_item ]
  File ".//core/bytecodes/dvm.py", line 3193, in get_raw
    return [ bytecode.Buff( self.__offset.off, self.format.get_value_buff() ) ] + [ i.get_raw() for i in self.item ]
  File ".//core/bytecodes/dvm.py", line 1369, in get_raw
    return [ bytecode.Buff(self.__offset.off, self.visibility.get_value_buff()) ] + self.annotation.get_raw()
  File ".//core/bytecodes/dvm.py", line 1338, in get_raw
    [ i.get_raw() for i in self.elements ]
  File ".//core/bytecodes/dvm.py", line 1310, in get_raw
    return [ bytecode.Buff(self.__offset.off, writeuleb128(self.name_idx) + self.value.get_raw()) ]
  File ".//core/bytecodes/dvm.py", line 1290, in get_raw
    return self.val.get_value_buff() + object_to_str( self.value )
TypeError: cannot concatenate 'str' and 'list' objects

What version of the product are you using? On what operating system?
Ubuntu 11.04

Please provide any additional information below.
I looked into the error, it seemed in EncodedValue, when type is 
EncodedAnnotation, get_raw() returned a list instead of string,therefore 
'return self.val.get_value_buff() + object_to_str( self.value )' threw 
TypeError exception. 

Original issue reported on code.google.com by haoh...@gmail.com on 20 Feb 2012 at 8:26

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by anthony....@gmail.com on 22 Feb 2012 at 5:05

GoogleCodeExporter commented 9 years ago
Do you use the mercurial version ?

Original comment by anthony....@gmail.com on 22 Feb 2012 at 5:08

GoogleCodeExporter commented 9 years ago
I checked out the code on Feb 3rd, is that mercurial version? I did not see any 
changes for get_raw() in dvm.py after Feb 3rd.

Original comment by haoh...@gmail.com on 22 Feb 2012 at 5:42

GoogleCodeExporter commented 9 years ago
ah ok sorry.

You would like to save an apk file ? 

If yes, this feature is not fully supported, you can only "read" a apk/dex 
file. If you would like to write, you can use smali/baksmali.

Original comment by anthony....@gmail.com on 23 Feb 2012 at 8:33

GoogleCodeExporter commented 9 years ago
Thanks for your response. I indeed want to save an apk file. I am wondering 
when will you have this feature fully supported or could you please give me 
some hint to fix this problem I mentioned? Thanks again. Really appreciate it!

Original comment by haoh...@gmail.com on 23 Feb 2012 at 4:49

GoogleCodeExporter commented 9 years ago

Original comment by anthony....@gmail.com on 5 Aug 2012 at 10:54