INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Return the attribute value in xml files which matches the tag name and the specific attribute | def get_attribute_value(
self, tag_name, attribute, format_value=False, **attribute_filter
):
"""
Return the attribute value in xml files which matches the tag name and the specific attribute
:param str tag_name: specify the tag name
:param str attribute: specify the attribu... |
Return the value of the android prefixed attribute in a specific tag. | def get_value_from_tag(self, tag, attribute):
"""
Return the value of the android prefixed attribute in a specific tag.
This function will always try to get the attribute with a android: prefix first,
and will try to return the attribute without the prefix, if the attribute could not be... |
Return a list of all the matched tags in all available xml | def find_tags(self, tag_name, **attribute_filter):
"""
Return a list of all the matched tags in all available xml
:param str tag: specify the tag name
"""
all_tags = [
self.find_tags_from_xml(
i, tag_name, **attribute_filter
)
... |
Return a list of all the matched tags in a specific xml w: param str xml_name: specify from which xml to pick the tag from: param str tag_name: specify the tag name | def find_tags_from_xml(
self, xml_name, tag_name, **attribute_filter
):
"""
Return a list of all the matched tags in a specific xml
w
:param str xml_name: specify from which xml to pick the tag from
:param str tag_name: specify the tag name
"""
xml = s... |
r Return true if the attributes matches in attribute filter. | def is_tag_matched(self, tag, **attribute_filter):
r"""
Return true if the attributes matches in attribute filter.
An attribute filter is a dictionary containing: {attribute_name: value}.
This function will return True if and only if all attributes have the same value.
This func... |
Return names of the main activities | def get_main_activities(self):
"""
Return names of the main activities
These values are read from the AndroidManifest.xml
:rtype: a set of str
"""
x = set()
y = set()
for i in self.xml:
if self.xml[i] is None:
continue
... |
Return the name of the main activity | def get_main_activity(self):
"""
Return the name of the main activity
This value is read from the AndroidManifest.xml
:rtype: str
"""
activities = self.get_main_activities()
if len(activities) > 0:
return self._format_value(activities.pop())
... |
Find intent filters for a given item and name. | def get_intent_filters(self, itemtype, name):
"""
Find intent filters for a given item and name.
Intent filter are attached to activities, services or receivers.
You can search for the intent filters of such items and get a dictionary of all
attached actions and intent categorie... |
Return all permissions implied by the target SDK or other permissions. | def get_uses_implied_permission_list(self):
"""
Return all permissions implied by the target SDK or other permissions.
:rtype: list of string
"""
target_sdk_version = self.get_effective_target_sdk_version()
READ_CALL_LOG = 'android.permission.READ_CALL_LOG'
... |
Return permissions with details. | def get_details_permissions(self):
"""
Return permissions with details.
THis can only return details about the permission, if the permission is
defined in the AOSP.
:rtype: dict of {permission: [protectionLevel, label, description]}
"""
l = {}
for i in ... |
Returns requested permissions declared within AOSP project. | def get_requested_aosp_permissions(self):
"""
Returns requested permissions declared within AOSP project.
This includes several other permissions as well, which are in the platform apps.
:rtype: list of str
"""
aosp_permissions = []
all_permissions = self.get_pe... |
Returns requested aosp permissions with details. | def get_requested_aosp_permissions_details(self):
"""
Returns requested aosp permissions with details.
:rtype: dictionary
"""
l = {}
for i in self.permissions:
try:
l[i] = self.permission_module[i]
except KeyError:
... |
Returns list of requested permissions not declared within AOSP project. | def get_requested_third_party_permissions(self):
"""
Returns list of requested permissions not declared within AOSP project.
:rtype: list of strings
"""
third_party_permissions = []
all_permissions = self.get_permissions()
for perm in all_permissions:
... |
Return the effective targetSdkVersion always returns int > 0. | def get_effective_target_sdk_version(self):
"""
Return the effective targetSdkVersion, always returns int > 0.
If the targetSdkVersion is not set, it defaults to 1. This is
set based on defaults as defined in:
https://developer.android.com/guide/topics/manifest/... |
Return the DER coded X. 509 certificate from the signature file. | def get_certificate_der(self, filename):
"""
Return the DER coded X.509 certificate from the signature file.
:param filename: Signature filename in APK
:returns: DER coded X.509 certificate as binary
"""
pkcs7message = self.get_file(filename)
pkcs7obj = cms.Cont... |
Return a X. 509 certificate object by giving the name in the apk file | def get_certificate(self, filename):
"""
Return a X.509 certificate object by giving the name in the apk file
:param filename: filename of the signature file in the APK
:returns: a :class:`Certificate` certificate
"""
cert = self.get_certificate_der(filename)
cer... |
Create a new zip file | def new_zip(self, filename, deleted_files=None, new_files={}):
"""
Create a new zip file
:param filename: the output filename of the zip
:param deleted_files: a regex pattern to remove specific file
:param new_files: a dictionnary of new files
:type ... |
Parse digests | def parse_signatures_or_digests(self, digest_bytes):
""" Parse digests """
if not len(digest_bytes):
return []
digests = []
block = io.BytesIO(digest_bytes)
data_len = self.read_uint32_le(block)
while block.tell() < data_len:
algorithm_... |
Parse the V2 signing block and extract all features | def parse_v3_signing_block(self):
"""
Parse the V2 signing block and extract all features
"""
self._v3_signing_data = []
# calling is_signed_v3 should also load the signature, if any
if not self.is_signed_v3():
return
block_bytes = self._v2_blocks[s... |
Parse the V2 signing block and extract all features | def parse_v2_signing_block(self):
"""
Parse the V2 signing block and extract all features
"""
self._v2_signing_data = []
# calling is_signed_v2 should also load the signature
if not self.is_signed_v2():
return
block_bytes = self._v2_blocks[self._APK... |
Return a list of DER coded X. 509 public keys from the v3 signature block | def get_public_keys_der_v3(self):
"""
Return a list of DER coded X.509 public keys from the v3 signature block
"""
if self._v3_signing_data == None:
self.parse_v3_signing_block()
public_keys = []
for signer in self._v3_signing_data:
public_keys.... |
Return a list of DER coded X. 509 public keys from the v3 signature block | def get_public_keys_der_v2(self):
"""
Return a list of DER coded X.509 public keys from the v3 signature block
"""
if self._v2_signing_data == None:
self.parse_v2_signing_block()
public_keys = []
for signer in self._v2_signing_data:
public_keys.... |
Return a list of DER coded X. 509 certificates from the v3 signature block | def get_certificates_der_v3(self):
"""
Return a list of DER coded X.509 certificates from the v3 signature block
"""
if self._v3_signing_data == None:
self.parse_v3_signing_block()
certs = []
for signed_data in [signer.signed_data for signer in self._v3_sign... |
Return a list of DER coded X. 509 certificates from the v3 signature block | def get_certificates_der_v2(self):
"""
Return a list of DER coded X.509 certificates from the v3 signature block
"""
if self._v2_signing_data == None:
self.parse_v2_signing_block()
certs = []
for signed_data in [signer.signed_data for signer in self._v2_sign... |
Return a list of: class: asn1crypto. x509. Certificate which are found in the META - INF folder ( v1 signing ). Note that we simply extract all certificates regardless of the signer. Therefore this is just a list of all certificates found in all signers. | def get_certificates_v1(self):
"""
Return a list of :class:`asn1crypto.x509.Certificate` which are found
in the META-INF folder (v1 signing).
Note that we simply extract all certificates regardless of the signer.
Therefore this is just a list of all certificates found in all sign... |
Return a list of unique: class: asn1crypto. x509. Certificate which are found in v1 v2 and v3 signing Note that we simply extract all certificates regardless of the signer. Therefore this is just a list of all certificates found in all signers. | def get_certificates(self):
"""
Return a list of unique :class:`asn1crypto.x509.Certificate` which are found
in v1, v2 and v3 signing
Note that we simply extract all certificates regardless of the signer.
Therefore this is just a list of all certificates found in all signers.
... |
Return a list of the signature file names ( v1 Signature/ JAR Signature ) | def get_signature_names(self):
"""
Return a list of the signature file names (v1 Signature / JAR
Signature)
:rtype: List of filenames matching a Signature
"""
signature_expr = re.compile(r"^(META-INF/)(.*)(\.RSA|\.EC|\.DSA)$")
signatures = []
for i in se... |
Return a list of the data of the signature files. Only v1/ JAR Signing. | def get_signatures(self):
"""
Return a list of the data of the signature files.
Only v1 / JAR Signing.
:rtype: list of bytes
"""
signature_expr = re.compile(r"^(META-INF/)(.*)(\.RSA|\.EC|\.DSA)$")
signature_datas = []
for i in self.get_files():
... |
Export analysis method to dot format | def method2dot(mx, colors=None):
"""
Export analysis method to dot format
:param mx: :class:`~androguard.core.analysis.analysis.MethodAnalysis`
:param colors: dict of colors to use, if colors is None the default colors are used
:returns: a string which contains the dot graph
"""
if not co... |
Export method to a specific file format | def method2format(output, _format="png", mx=None, raw=None):
"""
Export method to a specific file format
@param output : output filename
@param _format : format type (png, jpg ...) (default : png)
@param mx : specify the MethodAnalysis object
@param raw : use directly a dot raw buffer if None
... |
Export method to a png file format | def method2png(output, mx, raw=False):
"""
Export method to a png file format
:param output: output filename
:type output: string
:param mx: specify the MethodAnalysis object
:type mx: :class:`MethodAnalysis` object
:param raw: use directly a dot raw buffer
:type raw: string
"""
... |
Export method to a jpg file format | def method2jpg(output, mx, raw=False):
"""
Export method to a jpg file format
:param output: output filename
:type output: string
:param mx: specify the MethodAnalysis object
:type mx: :class:`MethodAnalysis` object
:param raw: use directly a dot raw buffer (optional)
:type raw: string
... |
Get a JSON representation of a DEX file | def vm2json(vm):
"""
Get a JSON representation of a DEX file
:param vm: :class:`~androguard.core.bytecodes.dvm.DalvikVMFormat`
:return:
"""
d = {"name": "root", "children": []}
for _class in vm.get_classes():
c_class = {"name": _class.get_name(), "children": []}
for method... |
Convert a object to a bytearray or call get_raw () of the object if no useful type was found. | def object_to_bytes(obj):
"""
Convert a object to a bytearray or call get_raw() of the object
if no useful type was found.
"""
if isinstance(obj, str):
return bytearray(obj, "UTF-8")
elif isinstance(obj, bool):
return bytearray()
elif isinstance(obj, int):
return pack... |
Transform a typed class name into a form which can be used as a python attribute | def FormatClassToPython(i):
"""
Transform a typed class name into a form which can be used as a python
attribute
example::
>>> FormatClassToPython('Lfoo/bar/foo/Barfoo$InnerClass;')
'Lfoo_bar_foo_Barfoo_InnerClass'
:param i: classname to transform
:rtype: str
"""
i = i... |
Return package and class name in a java variant from a typed variant name. | def get_package_class_name(name):
"""
Return package and class name in a java variant from a typed variant name.
If no package could be found, the package is an empty string.
example::
>>> get_package_class_name('Ljava/lang/Object;')
('java.lang', 'Object')
:param name: the name
... |
Transform a ( method ) name into a form which can be used as a python attribute | def FormatNameToPython(i):
"""
Transform a (method) name into a form which can be used as a python
attribute
example::
>>> FormatNameToPython('<clinit>')
'clinit'
:param i: name to transform
:rtype: str
"""
i = i.replace("<", "")
i = i.replace(">", "")
i = i.r... |
Format a descriptor into a form which can be used as a python attribute | def FormatDescriptorToPython(i):
"""
Format a descriptor into a form which can be used as a python attribute
example::
>>> FormatDescriptorToPython('(Ljava/lang/Long; Ljava/lang/Long; Z Z)V')
'Ljava_lang_LongLjava_lang_LongZZV
:param i: name to transform
:rtype: str
"""
i... |
Read bytes with length size without incrementing the current offset | def read_b(self, size):
"""
Read bytes with length `size` without incrementing the current offset
:param int size: length to read in bytes
:rtype: bytearray
"""
return self.__buff[self.__idx:self.__idx + size] |
Read all bytes from the start of off until the end of the buffer | def readat(self, off):
"""
Read all bytes from the start of `off` until the end of the buffer
This method can be used to determine a checksum of a buffer from a given
point on.
:param int off: starting offset
:rtype: bytearray
"""
if isinstance(off, SV):... |
Read from the current offset a total number of size bytes and increment the offset by size | def read(self, size):
"""
Read from the current offset a total number of `size` bytes
and increment the offset by `size`
:param int size: length of bytes to read
:rtype: bytearray
"""
if isinstance(size, SV):
size = size.value
buff = self.__b... |
Save the current buffer to filename | def save(self, filename):
"""
Save the current buffer to `filename`
Exisiting files with the same name will be overwritten.
:param str filename: the name of the file to save to
"""
with open(filename, "wb") as fd:
fd.write(self.__buff) |
Read a null terminated string from a file - like object. | def read_null_terminated_string(f):
"""
Read a null terminated string from a file-like object.
:param f: file-like object
:rtype: bytearray
"""
x = bytearray()
while True:
z = f.read(1)
if ord(z) == 0:
return x
else:
x.append(ord(z)) |
Transform an access flag field to the corresponding string | def get_access_flags_string(value):
"""
Transform an access flag field to the corresponding string
:param value: the value of the access flags
:type value: int
:rtype: string
"""
flags = []
for k, v in ACCESS_FLAGS.items():
if (k & value) == k:
flags.append(v)
... |
Read a signed LEB128 at the current position of the buffer. | def readsleb128(buff):
"""
Read a signed LEB128 at the current position of the buffer.
:param buff: a file like object
:return: decoded sLEB128
"""
result = 0
shift = 0
for x in range(0, 5):
cur = get_byte(buff)
result |= (cur & 0x7f) << shift
shift += 7
... |
Determine the next offsets inside the bytecode of an: class: EncodedMethod. The offsets are calculated in number of bytes from the start of the method. Note that offsets inside the bytecode are denoted in 16bit units but this method returns actual bytes! | def determineNext(i, cur_idx, m):
"""
Determine the next offsets inside the bytecode of an :class:`EncodedMethod`.
The offsets are calculated in number of bytes from the start of the method.
Note, that offsets inside the bytecode are denoted in 16bit units but this method returns actual bytes!
Offs... |
Returns try - catch handler inside the method. | def determineException(vm, m):
"""
Returns try-catch handler inside the method.
:param vm: a :class:`~DalvikVMFormat`
:param m: a :class:`~EncodedMethod`
:return:
"""
# no exceptions !
if m.get_code().get_tries_size() <= 0:
return []
h_off = {}
handler_catch_list = m.g... |
Return the value of the kind argument | def get_kind(cm, kind, value):
"""
Return the value of the 'kind' argument
:param cm: a ClassManager object
:type cm: :class:`ClassManager`
:param kind: the type of the 'kind' argument
:type kind: int
:param value: the value of the 'kind' argument
:type value: int
:rtype: string
... |
Returns an Unicode String This is the actual string. Beware that some strings might be not decodeable with usual UTF - 16 decoder as they use surrogates that are not supported by python. | def get_unicode(self):
"""
Returns an Unicode String
This is the actual string. Beware that some strings might be not
decodeable with usual UTF-16 decoder, as they use surrogates that are
not supported by python.
"""
s = mutf8.decode(self.data)
if len(s) !... |
Returns a printable string. In this case all lonely surrogates are escaped thus are represented in the string as 6 characters: \\ ud853 Valid surrogates are encoded as 32bit values ie. \ U00024f5c. | def get(self):
"""
Returns a printable string.
In this case, all lonely surrogates are escaped, thus are represented in the
string as 6 characters: \\ud853
Valid surrogates are encoded as 32bit values, ie. \U00024f5c.
"""
s = mutf8.decode(self.data)
if len... |
Return the class name of the field | def get_class_name(self):
"""
Return the class name of the field
:rtype: string
"""
if self.class_idx_value is None:
self.class_idx_value = self.CM.get_type(self.class_idx)
return self.class_idx_value |
Return the prototype of the method | def get_proto(self):
"""
Return the prototype of the method
:rtype: string
"""
if self.proto_idx_value is None:
self.proto_idx_value = self.CM.get_proto(self.proto_idx)
return self.proto_idx_value |
Display the information ( with a pretty print ) about the field | def show(self):
"""
Display the information (with a pretty print) about the field
"""
bytecode._PrintSubBanner("Field Information")
bytecode._PrintDefault("{}->{} {} [access_flags={}]\n".format(
self.get_class_name(), self.get_name(), self.get_descriptor(),
... |
From the Dalvik Bytecode documentation: | def each_params_by_register(self, nb, proto):
"""
From the Dalvik Bytecode documentation:
> The N arguments to a method land in the last N registers
> of the method's invocation frame, in order.
> Wide arguments consume two registers.
> Instance methods are passed a this... |
Return a shorter formatted String which encodes this method. The returned name has the form: <classname > <methodname > ( [ arguments... ] ) <returntype > | def get_short_string(self):
"""
Return a shorter formatted String which encodes this method.
The returned name has the form:
<classname> <methodname> ([arguments ...])<returntype>
* All Class names are condensed to the actual name (no package).
* Access flags are not ret... |
Display the information ( with a pretty print ) about the method | def show(self):
"""
Display the information (with a pretty print) about the method
"""
self.show_info()
self.show_notes()
if self.code:
self.each_params_by_register(self.code.get_registers_size(), self.get_descriptor())
self.code.show() |
Display the notes about the method | def show_notes(self):
"""
Display the notes about the method
"""
if self.notes:
bytecode._PrintSubBanner("Notes")
for i in self.notes:
bytecode._PrintNote(i)
bytecode._PrintSubBanner() |
Get a particular instruction by using ( default ) the index of the address if specified | def get_instruction(self, idx, off=None):
"""
Get a particular instruction by using (default) the index of the address if specified
:param idx: index of the instruction (the position in the list of the instruction)
:type idx: int
:param off: address of the instruction
:t... |
Return direct and virtual methods | def get_methods(self):
"""
Return direct and virtual methods
:rtype: a list of :class:`EncodedMethod` objects
"""
return [x
for x in self.direct_methods] + [x
for x in self.virtual_methods] |
Return static and instance fields | def get_fields(self):
"""
Return static and instance fields
:rtype: a list of :class:`EncodedField` objects
"""
return [x for x in self.static_fields] + [x
for x in self.instance_fields] |
: rtype: bytearray | def get_raw(self):
"""
:rtype: bytearray
"""
buff = bytearray()
buff += writesleb128(self.size)
for i in self.handlers:
buff += i.get_raw()
if self.size <= 0:
buff += writeuleb128(self.catch_all_addr)
return buff |
: rtype: bytearray | def get_raw(self):
"""
:rtype: bytearray
"""
buff = bytearray()
buff += self.get_obj()
for i in self.list:
buff += i.get_raw()
return buff |
Return the kind argument of the instruction | def get_kind(self):
"""
Return the 'kind' argument of the instruction
:rtype: int
"""
if self.OP > 0xff:
if self.OP >= 0xf2ff:
return DALVIK_OPCODES_OPTIMIZED[self.OP][1][1]
return DALVIK_OPCODES_EXTENDED_WIDTH[self.OP][1][1]
retur... |
Return the name of the instruction | def get_name(self):
"""
Return the name of the instruction
:rtype: string
"""
if self.OP > 0xff:
if self.OP >= 0xf2ff:
return DALVIK_OPCODES_OPTIMIZED[self.OP][1][0]
return DALVIK_OPCODES_EXTENDED_WIDTH[self.OP][1][0]
return DALVIK... |
Print the instruction | def show(self, idx):
"""
Print the instruction
"""
print(self.get_name() + " " + self.get_output(idx), end=' ') |
Return the display of the instruction | def show_buff(self, pos):
"""
Return the display of the instruction
:rtype: string
"""
buff = self.get_name() + " "
for i in range(0, len(self.data)):
buff += "\\x%02x" % self.data[i]
return buff |
Returns a HEX String separated by spaces every byte | def get_hex(self):
"""
Returns a HEX String, separated by spaces every byte
"""
s = binascii.hexlify(self.get_raw()).decode("ascii")
return " ".join(s[i:i + 2] for i in range(0, len(s), 2)) |
Return the keys of the instruction | def get_keys(self):
"""
Return the keys of the instruction
:rtype: a list of long
"""
return [(self.first_key + i) for i in range(0, len(self.targets))] |
Return an additional output of the instruction | def get_output(self, idx=-1):
"""
Return an additional output of the instruction
:rtype: string
"""
return " ".join("%x" % (self.first_key + i)
for i in range(0, len(self.targets))) |
Return the display of the instruction | def show_buff(self, pos):
"""
Return the display of the instruction
:rtype: string
"""
buff = self.get_name() + " "
buff += "%x:" % self.first_key
for i in self.targets:
buff += " %x" % i
return buff |
Set a new raw buffer to disassemble | def set_insn(self, insn):
"""
Set a new raw buffer to disassemble
:param insn: the buffer
:type insn: string
"""
self.insn = insn
self.size = len(self.insn) |
Get the instructions | def get_instructions(self):
"""
Get the instructions
:rtype: a generator of each :class:`Instruction` (or a cached list of instructions if you have setup instructions)
"""
# it is possible to a cache for instructions (avoid a new disasm)
if self.cached_instructions is No... |
Add a message to a specific instruction by using ( default ) the index of the address if specified | def add_inote(self, msg, idx, off=None):
"""
Add a message to a specific instruction by using (default) the index of the address if specified
:param msg: the message
:type msg: string
:param idx: index of the instruction (the position in the list of the instruction)
:typ... |
Get a particular instruction by using ( default ) the index of the address if specified | def get_instruction(self, idx, off=None):
"""
Get a particular instruction by using (default) the index of the address if specified
:param idx: index of the instruction (the position in the list of the instruction)
:type idx: int
:param off: address of the instruction
:t... |
Get the position of an instruction by using the address | def off_to_pos(self, off):
"""
Get the position of an instruction by using the address
:param off: address of the instruction
:type off: int
:rtype: int
"""
idx = 0
nb = 0
for i in self.get_instructions():
if idx == off:
... |
Get a particular instruction by using the address | def get_ins_off(self, off):
"""
Get a particular instruction by using the address
:param off: address of the instruction
:type off: int
:rtype: an :class:`Instruction` object
"""
idx = 0
for i in self.get_instructions():
if idx == off:
... |
Display ( with a pretty print ) this object | def show(self):
"""
Display (with a pretty print) this object
"""
off = 0
for n, i in enumerate(self.get_instructions()):
print("{:8d} (0x{:08x}) {:04x} {:30} {}".format(n, off, i.get_op_value(), i.get_name(), i.get_output(self.idx)))
off += i.get_length() |
Return the raw buffer of this object | def get_raw(self):
"""
Return the raw buffer of this object
:rtype: bytearray
"""
buff = bytearray()
for i in self.get_instructions():
buff += i.get_raw()
return buff |
Get the reconstructed code as bytearray | def get_raw(self):
"""
Get the reconstructed code as bytearray
:rtype: bytearray
"""
code_raw = self.code.get_raw()
self.insns_size = (len(code_raw) // 2) + (len(code_raw) % 2)
buff = bytearray()
buff += pack("<H", self.registers_size) + \
... |
Return a string from the string table at index idx | def get_string(self, idx):
"""
Return a string from the string table at index `idx`
:param int idx: index in the string section
"""
if idx in self.hook_strings:
return self.hook_strings[idx]
try:
off = self.__manage_item[TypeMapItem.STRING_ID_ITE... |
Return the ( unprocessed ) string from the string table at index idx. | def get_raw_string(self, idx):
"""
Return the (unprocessed) string from the string table at index `idx`.
:param int idx: the index in the string section
"""
try:
off = self.__manage_item[TypeMapItem.STRING_ID_ITEM][idx].get_string_data_off()
except IndexError... |
Return the resolved type name based on the index | def get_type(self, idx):
"""
Return the resolved type name based on the index
This returns the string associated with the type.
:param int idx:
:return: the type name
:rtype: str
"""
_type = self.get_type_ref(idx)
if _type == -1:
retu... |
Print with a pretty display the MapList object | def show(self):
"""
Print with a pretty display the MapList object
"""
bytecode._Print("MAP_LIST SIZE", self.size)
for i in self.map_item:
if i.item != self:
# FIXME this does not work for CodeItems!
# as we do not have the method analy... |
Flush all caches Might be used after classes methods or fields are added. | def _flush(self):
"""
Flush all caches
Might be used after classes, methods or fields are added.
"""
self.classes_names = None
self.__cache_methods = None
self.__cached_methods_idx = None
self.__cache_fields = None
# cache methods and fields as we... |
Return the names of classes | def get_classes_names(self, update=False):
"""
Return the names of classes
:param update: True indicates to recompute the list.
Maybe needed after using a MyClass.set_name().
:rtype: a list of string
"""
if self.classes_names is None or update:
... |
Return a specific class | def get_class(self, name):
"""
Return a specific class
:param name: the name of the class
:rtype: a :class:`ClassDefItem` object
"""
for i in self.get_classes():
if i.get_name() == name:
return i
return None |
Return a list all methods which corresponds to the regexp | def get_method(self, name):
"""
Return a list all methods which corresponds to the regexp
:param name: the name of the method (a python regexp)
:rtype: a list with all :class:`EncodedMethod` objects
"""
# TODO could use a generator here
prog = re.compile(name)
... |
Return a list all fields which corresponds to the regexp | def get_field(self, name):
"""
Return a list all fields which corresponds to the regexp
:param name: the name of the field (a python regexp)
:rtype: a list with all :class:`EncodedField` objects
"""
# TODO could use a generator here
prog = re.compile(name)
... |
Return all field objects | def get_fields(self):
"""
Return all field objects
:rtype: a list of :class:`EncodedField` objects
"""
if self.__cache_all_fields is None:
self.__cache_all_fields = []
for i in self.get_classes():
for j in i.get_fields():
... |
Return all method objects | def get_methods(self):
"""
Return all method objects
:rtype: a list of :class:`EncodedMethod` objects
"""
if self.__cache_all_methods is None:
self.__cache_all_methods = []
for i in self.get_classes():
for j in i.get_methods():
... |
Return a specific method by using an index: param idx: the index of the method: type idx: int | def get_method_by_idx(self, idx):
"""
Return a specific method by using an index
:param idx: the index of the method
:type idx: int
:rtype: None or an :class:`EncodedMethod` object
"""
if self.__cached_methods_idx is None:
self.__cached_methods_idx = ... |
Return the specific method | def get_method_descriptor(self, class_name, method_name, descriptor):
"""
Return the specific method
:param class_name: the class name of the method
:type class_name: string
:param method_name: the name of the method
:type method_name: string
:param descriptor: t... |
Return the specific methods of the class | def get_methods_descriptor(self, class_name, method_name):
"""
Return the specific methods of the class
:param class_name: the class name of the method
:type class_name: string
:param method_name: the name of the method
:type method_name: string
:rtype: None or ... |
Return all methods of a specific class | def get_methods_class(self, class_name):
"""
Return all methods of a specific class
:param class_name: the class name
:type class_name: string
:rtype: a list with :class:`EncodedMethod` objects
"""
l = []
for i in self.get_classes():
for j in... |
Return all fields of a specific class | def get_fields_class(self, class_name):
"""
Return all fields of a specific class
:param class_name: the class name
:type class_name: string
:rtype: a list with :class:`EncodedField` objects
"""
l = []
for i in self.get_classes():
for j in i.... |
Return the specific field | def get_field_descriptor(self, class_name, field_name, descriptor):
"""
Return the specific field
:param class_name: the class name of the field
:type class_name: string
:param field_name: the name of the field
:type field_name: string
:param descriptor: the desc... |
Return all target strings matched the regex | def get_regex_strings(self, regular_expressions):
"""
Return all target strings matched the regex
:param regular_expressions: the python regex
:type regular_expressions: string
:rtype: a list of strings matching the regex expression
"""
str_list = []
if ... |
Export classes/ methods/ fields names in the python namespace | def create_python_export(self):
"""
Export classes/methods/fields' names in the python namespace
"""
setattr(self, "C", ExportObject())
for _class in self.get_classes():
self._create_python_export_class(_class) |
Disassembles a given offset in the DEX file | def disassemble(self, offset, size):
"""
Disassembles a given offset in the DEX file
:param offset: offset to disassemble in the file (from the beginning of the file)
:type offset: int
:param size:
:type size:
"""
for i in DCode(
self.CM, ... |
Convert a path such as android. support. v4. app. ActivityCompat into a string Landroid/ support/ v4/ app/ ActivityCompat so we can change name of a class by d. CLASS_Landroid_support_v4_app_ActivityCompat. set_name ( new_name ) | def classdot2class(path):
""" Convert a path such as 'android.support.v4.app.ActivityCompat'
into a string 'Landroid/support/v4/app/ActivityCompat'
so we can change name of a class by d.CLASS_Landroid_support_v4_app_ActivityCompat.set_name(new_name)
"""
if path[0] == 'L' and path[-1] == ';':... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.