Ask Your Question
2

Using Androguard, what is the method for extracting strings from strings.xml?

asked 2023-05-05 21:46:54 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-05 21:50:01 +0000

lalupa gravatar image

The method for extracting strings from strings.xml using Androguard is as follows:

  1. Import the necessary modules:
from androguard import misc
from androguard.axml.axmlparser import AXMLParser
  1. Load the APK file:
a, d, dx = misc.AnalyzeAPK('path_to_apk')
  1. Get the strings.xml file:
xml_string = a.get_android_resources()['xml']['strings.xml'].decode('utf-8')
  1. Create an AXMLParser object and parse the XML string:
parser = AXMLParser(xml_string)
parser.parse()
  1. Get the list of string resources:
strings = parser.get_string_resources()
  1. Print the list of string resources:
for string in strings:
    print(string)

This will output a list of all the strings extracted from the strings.xml file.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-05 21:46:54 +0000

Seen: 9 times

Last updated: May 05 '23