pbtk icon indicating copy to clipboard operation
pbtk copied to clipboard

Error extracting from jar or apk

Open jackz314 opened this issue 4 years ago • 1 comments

I'm trying to extract proto files from an APK, but it fails when extracting content from the jar:

In vfo:
Traceback (most recent call last):
  File "./gui.py", line 462, in run
    for name, contents in self.extractor['func'](input_):
  File "/home/jack/Desktop/phone/pbtk/extractors/jar_extract.py", line 236, in handle_jar
    extract_lite(jar, cls, enums, gen_classes_nodollar, codedinputstream, codedoutputstream, map_entry_cls, out_additional_cls,
  File "/home/jack/Desktop/phone/pbtk/extractors/jar_extract.py", line 326, in extract_lite
    ftype = {0: 'int32', 1: 'fixed64', 2: 'bytes', 3: 'group', 5: 'fixed32'}[lazy_tag & 7]
KeyError: 4

I checked the code and the lazy_tag I'm getting when this error occurs is 68, so it's trying to find key 4 in the ftype dict, but it doesn't exist. Is this intentional?

jackz314 avatar Dec 14 '20 23:12 jackz314

I get a similar error, but in a different place:

In apau:
Traceback (most recent call last):
  File "jar_extract.py", line 962, in <module>
    extractor_main('jar_extract')
  File "/home/andriy/pbtk/extractors/../utils/common.py", line 261, in extractor_main
    nb_written, wrote_endpoints = extractor_save(args.output_dir, '', extractor['func'](args.input_))
  File "/home/andriy/pbtk/extractors/../utils/common.py", line 217, in extractor_save
    for name, contents in outputs:
  File "jar_extract.py", line 236, in handle_jar
    extract_lite(jar, cls, enums, gen_classes_nodollar, codedinputstream, codedoutputstream, map_entry_cls, out_additional_cls,
  File "jar_extract.py", line 326, in extract_lite
    ftype = {0: 'int32', 1: 'fixed64', 2: 'bytes', 3: 'group', 5: 'fixed32'}[lazy_tag & 7]
KeyError: 4

savandriy avatar May 17 '21 11:05 savandriy