code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def get_android_manifest_axml(self) -> Union[AXMLPrinter, None]: """ Return the [AXMLPrinter][androguard.core.axml.AXMLPrinter] object which corresponds to the `AndroidManifest.xml` file :returns: the `AXMLPrinter` object """ try: return self.axml["AndroidManifest.xm...
Return the [AXMLPrinter][androguard.core.axml.AXMLPrinter] object which corresponds to the `AndroidManifest.xml` file :returns: the `AXMLPrinter` object
get_android_manifest_axml
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_android_manifest_xml(self) -> Union[lxml.etree.Element, None]: """ Return the parsed xml object which corresponds to the `AndroidManifest.xml` file :returns: the parsed xml object """ try: return self.xml["AndroidManifest.xml"] except KeyError: ...
Return the parsed xml object which corresponds to the `AndroidManifest.xml` file :returns: the parsed xml object
get_android_manifest_xml
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_android_resources(self) -> Union[ARSCParser, None]: """ Return the [ARSCParser][androguard.core.axml.ARSCParser] object which corresponds to the `resources.arsc` file :returns: the `ARSCParser` object """ try: return self.arsc["resources.arsc"] except...
Return the [ARSCParser][androguard.core.axml.ARSCParser] object which corresponds to the `resources.arsc` file :returns: the `ARSCParser` object
get_android_resources
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def is_signed(self) -> bool: """ Returns true if any of v1, v2, or v3 signatures were found. :returns: True if any of v1, v2, or v3 signatures were found, else False """ return ( self.is_signed_v1() or self.is_signed_v2() or self.is_signed_v3() )
Returns true if any of v1, v2, or v3 signatures were found. :returns: True if any of v1, v2, or v3 signatures were found, else False
is_signed
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def is_signed_v2(self) -> bool: """ Returns `True` of a v2 / APK signature was found. Returning `True` does not mean that the file is properly signed! It just says that there is a signature file which needs to be validated. :returns: `True` of a v2 / APK signature was found, el...
Returns `True` of a v2 / APK signature was found. Returning `True` does not mean that the file is properly signed! It just says that there is a signature file which needs to be validated. :returns: `True` of a v2 / APK signature was found, else `False`
is_signed_v2
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def is_signed_v3(self) -> bool: """ Returns `True` of a v3 / APK signature was found. Returning `True` does not mean that the file is properly signed! It just says that there is a signature file which needs to be validated. :returns: `True` of a v3 / APK signature was found, el...
Returns `True` of a v3 / APK signature was found. Returning `True` does not mean that the file is properly signed! It just says that there is a signature file which needs to be validated. :returns: `True` of a v3 / APK signature was found, else `False`
is_signed_v3
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def parse_signatures_or_digests( self, digest_bytes: bytes ) -> list[tuple[int, bytes]]: """Parse digests :param digest_bytes: the digests bytes :returns: a list of tuple where the first element is the `algorithm_id` and the second is the digest bytes """ ...
Parse digests :param digest_bytes: the digests bytes :returns: a list of tuple where the first element is the `algorithm_id` and the second is the digest bytes
parse_signatures_or_digests
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def parse_v3_signing_block(self) -> None: """ 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_...
Parse the V2 signing block and extract all features
parse_v3_signing_block
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_public_keys_der_v3(self) -> list[bytes]: """ Return a list of DER coded X.509 public keys from the v3 signature block :returns: the list of public key bytes """ if self._v3_signing_data == None: self.parse_v3_signing_block() public_keys = [] ...
Return a list of DER coded X.509 public keys from the v3 signature block :returns: the list of public key bytes
get_public_keys_der_v3
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_certificates_der_v3(self) -> list[bytes]: """ Return a list of DER coded X.509 certificates from the v3 signature block :returns: the list of public key bytes """ if self._v3_signing_data == None: self.parse_v3_signing_block() certs = [] for...
Return a list of DER coded X.509 certificates from the v3 signature block :returns: the list of public key bytes
get_certificates_der_v3
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_public_keys_v3(self) -> list[asn1crypto.keys.PublicKeyInfo]: """ Return a list of `asn1crypto.keys.PublicKeyInfo` which are found in the v3 signing block. :returns: a list of the found `asn1crypto.keys.PublicKeyInfo` """ return [ keys.PublicKeyInfo.lo...
Return a list of `asn1crypto.keys.PublicKeyInfo` which are found in the v3 signing block. :returns: a list of the found `asn1crypto.keys.PublicKeyInfo`
get_public_keys_v3
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_public_keys_v2(self) -> list[asn1crypto.keys.PublicKeyInfo]: """ Return a list of `asn1crypto.keys.PublicKeyInfo` which are found in the v2 signing block. :returns: a list of the found `asn1crypto.keys.PublicKeyInfo` """ return [ keys.PublicKeyInfo.lo...
Return a list of `asn1crypto.keys.PublicKeyInfo` which are found in the v2 signing block. :returns: a list of the found `asn1crypto.keys.PublicKeyInfo`
get_public_keys_v2
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_certificates_v3(self) -> list[asn1crypto.x509.Certificate]: """ Return a list of `asn1crypto.x509.Certificate` which are found in the v3 signing block. Note that we simply extract all certificates regardless of the signer. Therefore this is just a list of all certificates...
Return a list of `asn1crypto.x509.Certificate` which are found in the v3 signing block. Note that we simply extract all certificates regardless of the signer. Therefore this is just a list of all certificates found in all signers. :returns: a list of the found `asn1crypto.x509....
get_certificates_v3
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_certificates_v2(self) -> list[asn1crypto.x509.Certificate]: """ Return a list of `asn1crypto.x509.Certificate` which are found in the v2 signing block. Note that we simply extract all certificates regardless of the signer. Therefore this is just a list of all certificates...
Return a list of `asn1crypto.x509.Certificate` which are found in the v2 signing block. Note that we simply extract all certificates regardless of the signer. Therefore this is just a list of all certificates found in all signers. :returns: a list of the found `asn1crypto.x509....
get_certificates_v2
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_certificates_v1(self) -> list[Union[x509.Certificate, None]]: """ Return a list of verified `asn1crypto.x509.Certificate` which are found in the META-INF folder (v1 signing). """ certs = [] for x in self.get_signature_names(): cc = self.get_certificate...
Return a list of verified `asn1crypto.x509.Certificate` which are found in the META-INF folder (v1 signing).
get_certificates_v1
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_certificates(self) -> list[asn1crypto.x509.Certificate]: """ Return a list of unique `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 certific...
Return a list of unique `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. Exception is v1, for which the certificat...
get_certificates
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_signature_name(self) -> Union[str, None]: """ Return the name of the first signature file found. :returns: the name of the first signature file, or `None` if not signed """ if self.get_signature_names(): return self.get_signature_names()[0] else: ...
Return the name of the first signature file found. :returns: the name of the first signature file, or `None` if not signed
get_signature_name
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_signature_names(self) -> list[str]: """ Return a list of the signature file names (v1 Signature / JAR Signature) :returns: List of filenames matching a Signature """ signature_expr = re.compile(r'\AMETA-INF/(?s:.)*\.(DSA|EC|RSA)\Z') signatures = [] ...
Return a list of the signature file names (v1 Signature / JAR Signature) :returns: List of filenames matching a Signature
get_signature_names
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_signature(self) -> Union[str, None]: """ Return the data of the first signature file found (v1 Signature / JAR Signature) :returns: First signature name or None if not signed """ if self.get_signatures(): return self.get_signatures()[0] else: ...
Return the data of the first signature file found (v1 Signature / JAR Signature) :returns: First signature name or None if not signed
get_signature
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_signatures(self) -> list[bytes]: """ Return a list of the data of the signature files. Only v1 / JAR Signing. :returns: list of bytes """ signature_expr = re.compile(r'\AMETA-INF/(?s:.)*\.(DSA|EC|RSA)\Z') signature_datas = [] for i in self.get_fi...
Return a list of the data of the signature files. Only v1 / JAR Signing. :returns: list of bytes
get_signatures
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def show_Certificate(cert:asn1crypto.x509.Certificate, short:bool=False) -> None: """ Print Fingerprints, Issuer and Subject of an X509 Certificate. :param cert: `asn1crypto.x509.Certificate` to print :param short: Print in shortform for DN (Default: False) """ print("SHA1 Fingerprint: {}".form...
Print Fingerprints, Issuer and Subject of an X509 Certificate. :param cert: `asn1crypto.x509.Certificate` to print :param short: Print in shortform for DN (Default: False)
show_Certificate
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def ensure_final_value(packageName: str, arsc: ARSCParser, value: str) -> str: """Ensure incoming value is always the value, not the resid androguard will sometimes return the Android "resId" aka Resource ID instead of the actual value. This checks whether the value is actually a resId, then performs ...
Ensure incoming value is always the value, not the resid androguard will sometimes return the Android "resId" aka Resource ID instead of the actual value. This checks whether the value is actually a resId, then performs the Android Resource lookup as needed. :returns: the final Android Resource v...
ensure_final_value
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def get_apkid(apkfile: str) -> tuple[str, str, str]: """Read (appid, versionCode, versionName) from an APK This first tries to do quick binary XML parsing to just get the values that are needed. It will fallback to full androguard parsing, which is slow, if it can't find the versionName value or v...
Read (appid, versionCode, versionName) from an APK This first tries to do quick binary XML parsing to just get the values that are needed. It will fallback to full androguard parsing, which is slow, if it can't find the versionName value or versionName is set to a Android String Resource (e.g. an inte...
get_apkid
python
androguard/androguard
androguard/core/apk/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/apk/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, header: ARSCHeader) -> None: """ :param buff: buffer which holds the string block :param header: a instance of [ARSCHeader][androguard.core.axml.ARSCHeader] """ self._cache = {} self.header = header # We already read the header (...
:param buff: buffer which holds the string block :param header: a instance of [ARSCHeader][androguard.core.axml.ARSCHeader]
__init__
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def getString(self, idx: int) -> str: """ Return the string at the index in the string table :param idx: index in the string table :return: the string """ if idx in self._cache: return self._cache[idx] if idx < 0 or not self.m_stringOffsets or idx >=...
Return the string at the index in the string table :param idx: index in the string table :return: the string
getString
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def _decode8(self, offset: int) -> str: """ Decode an UTF-8 String at the given offset :param offset: offset of the string inside the data :raises ResParserError: if string is not null terminated :return: the decoded string """ # UTF-8 Strings contain two lengths...
Decode an UTF-8 String at the given offset :param offset: offset of the string inside the data :raises ResParserError: if string is not null terminated :return: the decoded string
_decode8
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def _decode16(self, offset: int) -> str: """ Decode an UTF-16 String at the given offset :param offset: offset of the string inside the data :raises ResParserError: if string is not null terminated :return: the decoded string """ str_len, skip = self._decode_len...
Decode an UTF-16 String at the given offset :param offset: offset of the string inside the data :raises ResParserError: if string is not null terminated :return: the decoded string
_decode16
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def _decode_bytes(data: bytes, encoding: str, str_len: int) -> str: """ Generic decoding with length check. The string is decoded from bytes with the given encoding, then the length of the string is checked. The string is decoded using the "replace" method. :param data: ...
Generic decoding with length check. The string is decoded from bytes with the given encoding, then the length of the string is checked. The string is decoded using the "replace" method. :param data: bytes :param encoding: encoding name ("utf-8" or "utf-16") :par...
_decode_bytes
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def _decode_length(self, offset: int, sizeof_char: int) -> tuple[int, int]: """ Generic Length Decoding at offset of string The method works for both 8 and 16 bit Strings. Length checks are enforced: * 8 bit strings: maximum of 0x7FFF bytes (See http://androidxref.com/9....
Generic Length Decoding at offset of string The method works for both 8 and 16 bit Strings. Length checks are enforced: * 8 bit strings: maximum of 0x7FFF bytes (See http://androidxref.com/9.0.0_r3/xref/frameworks/base/libs/androidfw/ResourceTypes.cpp#692) * 16 bit stri...
_decode_length
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def show(self) -> None: """ Print some information on stdout about the string table """ print( "StringBlock(stringsCount=0x%x, " "stringsOffset=0x%x, " "stylesCount=0x%x, " "stylesOffset=0x%x, " "flags=0x%x" ")" ...
Print some information on stdout about the string table
show
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def name(self) -> str: """ Return the String associated with the tag name :returns: the string """ if self.m_name == -1 or ( self.m_event != START_TAG and self.m_event != END_TAG ): return '' return self.sb[self.m_name]
Return the String associated with the tag name :returns: the string
name
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def comment(self) -> Union[str, None]: """ Return the comment at the current position or None if no comment is given This works only for Tags, as the comments of Namespaces are silently dropped. Currently, there is no way of retrieving comments of namespaces. :returns: the comm...
Return the comment at the current position or None if no comment is given This works only for Tags, as the comments of Namespaces are silently dropped. Currently, there is no way of retrieving comments of namespaces. :returns: the comment string, or None if no comment exists
comment
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def namespace(self) -> str: """ Return the Namespace URI (if any) as a String for the current tag :returns: the namespace uri, or empty if namespace does not exist """ if self.m_name == -1 or ( self.m_event != START_TAG and self.m_event != END_TAG ): ...
Return the Namespace URI (if any) as a String for the current tag :returns: the namespace uri, or empty if namespace does not exist
namespace
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def nsmap(self) -> dict[str, str]: """ Returns the current namespace mapping as a dictionary there are several problems with the map and we try to guess a few things here: 1) a URI can be mapped by many prefixes, so it is to decide which one to take 2) a prefix might ma...
Returns the current namespace mapping as a dictionary there are several problems with the map and we try to guess a few things here: 1) a URI can be mapped by many prefixes, so it is to decide which one to take 2) a prefix might map to an empty string (some packers) 3)...
nsmap
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def text(self) -> str: """ Return the String assosicated with the current text :returns: the string associated with the current text """ if self.m_name == -1 or self.m_event != TEXT: return '' return self.sb[self.m_name]
Return the String assosicated with the current text :returns: the string associated with the current text
text
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def _get_attribute_offset(self, index: int): """ Return the start inside the m_attributes array for a given attribute """ if self.m_event != START_TAG: logger.warning("Current event is not START_TAG.") offset = index * ATTRIBUTE_LENGTH if offset >= len(self.m...
Return the start inside the m_attributes array for a given attribute
_get_attribute_offset
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def getAttributeCount(self) -> int: """ Return the number of Attributes for a Tag or -1 if not in a tag :returns: the number of attributes """ if self.m_event != START_TAG: return -1 return self.m_attribute_count
Return the number of Attributes for a Tag or -1 if not in a tag :returns: the number of attributes
getAttributeCount
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def getAttributeUri(self, index:int) -> int: """ Returns the numeric ID for the namespace URI of an attribute :returns: the namespace URI numeric id """ logger.debug(index) offset = self._get_attribute_offset(index) uri = self.m_attributes[offset + ATTRIBUTE_IX_...
Returns the numeric ID for the namespace URI of an attribute :returns: the namespace URI numeric id
getAttributeUri
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def getAttributeNamespace(self, index:int) -> str: """ Return the Namespace URI (if any) for the attribute :returns: the attribute uri, or empty string if no namespace """ logger.debug(index) uri = self.getAttributeUri(index) # No Namespace if uri == 0x...
Return the Namespace URI (if any) for the attribute :returns: the attribute uri, or empty string if no namespace
getAttributeNamespace
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def getAttributeName(self, index:int) -> str: """ Returns the String which represents the attribute name :returns: the attribute name """ logger.debug(index) offset = self._get_attribute_offset(index) name = self.m_attributes[offset + ATTRIBUTE_IX_NAME] ...
Returns the String which represents the attribute name :returns: the attribute name
getAttributeName
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def getAttributeValueType(self, index: int): """ Return the type of the attribute at the given index :param index: index of the attribute """ logger.debug(index) offset = self._get_attribute_offset(index) return self.m_attributes[offset + ATTRIBUTE_IX_VALUE_TYPE...
Return the type of the attribute at the given index :param index: index of the attribute
getAttributeValueType
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def getAttributeValueData(self, index: int): """ Return the data of the attribute at the given index :param index: index of the attribute """ logger.debug(index) offset = self._get_attribute_offset(index) return self.m_attributes[offset + ATTRIBUTE_IX_VALUE_DATA...
Return the data of the attribute at the given index :param index: index of the attribute
getAttributeValueData
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def getAttributeValue(self, index: int) -> str: """ This function is only used to look up strings All other work is done by [format_value][androguard.core.axml.format_value] # FIXME should unite those functions :param index: index of the attribute :returns: the st...
This function is only used to look up strings All other work is done by [format_value][androguard.core.axml.format_value] # FIXME should unite those functions :param index: index of the attribute :returns: the string
getAttributeValue
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def format_value( _type: int, _data: int, lookup_string=lambda ix: "<string>" ) -> str: """ Format a value based on type and data. By default, no strings are looked up and `"<string>"` is returned. You need to define `lookup_string` in order to actually lookup strings from the string table. ...
Format a value based on type and data. By default, no strings are looked up and `"<string>"` is returned. You need to define `lookup_string` in order to actually lookup strings from the string table. :param _type: The numeric type of the value :param _data: The numeric data of the value :p...
format_value
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def _get_attribute_value(self, index: int): """ Wrapper function for format_value to resolve the actual value of an attribute in a tag :param index: index of the current attribute :return: formatted value """ _type = self.axml.getAttributeValueType(index) _data = ...
Wrapper function for format_value to resolve the actual value of an attribute in a tag :param index: index of the current attribute :return: formatted value
_get_attribute_value
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def _fix_name(self, prefix, name) -> tuple[str, str]: """ Apply some fixes to element named and attribute names. Try to get conform to: > Like element names, attribute names are case-sensitive and must start with a letter or underscore. > The rest of the name can contain letters,...
Apply some fixes to element named and attribute names. Try to get conform to: > Like element names, attribute names are case-sensitive and must start with a letter or underscore. > The rest of the name can contain letters, digits, hyphens, underscores, and periods. See: <https:/...
_fix_name
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def _fix_value(self, value): """ Return a cleaned version of a value according to the specification: > Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] See <https://www.w3.org/TR/xml/#charsets> :param value: a value to clean ...
Return a cleaned version of a value according to the specification: > Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] See <https://www.w3.org/TR/xml/#charsets> :param value: a value to clean :return: the cleaned value
_fix_value
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def __init__(self, raw_buff: bytes) -> None: """ :param bytes raw_buff: the raw bytes of the file """ self.buff = io.BufferedReader(io.BytesIO(raw_buff)) self.buff_size = self.buff.raw.getbuffer().nbytes if self.buff_size < 8 or self.buff_size > 0xFFFFFFFF: r...
:param bytes raw_buff: the raw bytes of the file
__init__
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_types( self, package_name: str, locale: str = '\x00\x00' ) -> list[str]: """ Retrieve a list of all types which are available in the given package and locale. :param package_name: the package name to get types of :param locale: the locale to get types of (def...
Retrieve a list of all types which are available in the given package and locale. :param package_name: the package name to get types of :param locale: the locale to get types of (default: '') :returns: a list of type strings
get_types
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_public_resources( self, package_name: str, locale: str = '\x00\x00' ) -> bytes: """ Get the XML (as string) of all resources of type 'public'. The public resources table contains the IDs for each item. :param package_name: the package name to get the resources for ...
Get the XML (as string) of all resources of type 'public'. The public resources table contains the IDs for each item. :param package_name: the package name to get the resources for :param locale: the locale to get the resources for (default: '') :returns: the public xml byte...
get_public_resources
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_string_resources( self, package_name: str, locale: str = '\x00\x00' ) -> bytes: """ Get the XML (as string) of all resources of type 'string'. Read more about string resources: <https://developer.android.com/guide/topics/resources/string-resource.html> :para...
Get the XML (as string) of all resources of type 'string'. Read more about string resources: <https://developer.android.com/guide/topics/resources/string-resource.html> :param package_name: the package name to get the resources for :param locale: the locale to get the resource...
get_string_resources
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_strings_resources(self) -> bytes: """ Get the XML (as string) of all resources of type 'string'. This is a combined variant, which has all locales and all package names stored. :returns: the string, locales, and package name xml bytes """ self._analyse() ...
Get the XML (as string) of all resources of type 'string'. This is a combined variant, which has all locales and all package names stored. :returns: the string, locales, and package name xml bytes
get_strings_resources
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_id_resources( self, package_name: str, locale: str = '\x00\x00' ) -> bytes: """ Get the XML (as string) of all resources of type 'id'. Read more about ID resources: <https://developer.android.com/guide/topics/resources/more-resources.html#Id> :param package_...
Get the XML (as string) of all resources of type 'id'. Read more about ID resources: <https://developer.android.com/guide/topics/resources/more-resources.html#Id> :param package_name: the package name to get the resources for :param locale: the locale to get the resources for ...
get_id_resources
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_bool_resources( self, package_name: str, locale: str = '\x00\x00' ) -> bytes: """ Get the XML (as string) of all resources of type 'bool'. Read more about bool resources: <https://developer.android.com/guide/topics/resources/more-resources.html#Bool> :param ...
Get the XML (as string) of all resources of type 'bool'. Read more about bool resources: <https://developer.android.com/guide/topics/resources/more-resources.html#Bool> :param package_name: the package name to get the resources for :param locale: the locale to get the resource...
get_bool_resources
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_integer_resources( self, package_name: str, locale: str = '\x00\x00' ) -> bytes: """ Get the XML (as string) of all resources of type 'integer'. Read more about integer resources: <https://developer.android.com/guide/topics/resources/more-resources.html#Integer> ...
Get the XML (as string) of all resources of type 'integer'. Read more about integer resources: <https://developer.android.com/guide/topics/resources/more-resources.html#Integer> :param package_name: the package name to get the resources for :param locale: the locale to get the...
get_integer_resources
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_color_resources( self, package_name: str, locale: str = '\x00\x00' ) -> bytes: """ Get the XML (as string) of all resources of type 'color'. Read more about color resources: <https://developer.android.com/guide/topics/resources/more-resources.html#Color> :pa...
Get the XML (as string) of all resources of type 'color'. Read more about color resources: <https://developer.android.com/guide/topics/resources/more-resources.html#Color> :param package_name: the package name to get the resources for :param locale: the locale to get the resou...
get_color_resources
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_dimen_resources( self, package_name: str, locale: str = '\x00\x00' ) -> bytes: """ Get the XML (as string) of all resources of type 'dimen'. Read more about Dimension resources: <https://developer.android.com/guide/topics/resources/more-resources.html#Dimension> ...
Get the XML (as string) of all resources of type 'dimen'. Read more about Dimension resources: <https://developer.android.com/guide/topics/resources/more-resources.html#Dimension> :param package_name: the package name to get the resources for :param locale: the locale to get t...
get_dimen_resources
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_id( self, package_name: str, rid: int, locale: str = '\x00\x00' ) -> tuple: """ Returns the tuple `(resource_type, resource_name, resource_id)` for the given resource_id. :param package_name: package name to query :param rid: the resource_id :param lo...
Returns the tuple `(resource_type, resource_name, resource_id)` for the given resource_id. :param package_name: package name to query :param rid: the resource_id :param locale: specific locale :returns: tuple of (resource_type, resource_name, resource_id)
get_id
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def __init__( self, android_resources: ARSCParser, config: Union[ARSCResTableConfig, None] = None, ) -> None: """ :param ARSCParser android_resources: A resource parser :param ARSCResTableConfig config: The desired configuration or None to ...
:param ARSCParser android_resources: A resource parser :param ARSCResTableConfig config: The desired configuration or None to resolve all.
__init__
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def resolve(self, res_id: int) -> list[tuple[ARSCResTableConfig, str]]: """ the given ID into the Resource and returns a list of matching resources. :param int res_id: numerical ID of the resource :returns: a list of tuples of (ARSCResTableConfig, str) """ ...
the given ID into the Resource and returns a list of matching resources. :param int res_id: numerical ID of the resource :returns: a list of tuples of (ARSCResTableConfig, str)
resolve
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def put_ate_value( self, result: list, ate: ARSCResTableEntry, config: ARSCResTableConfig, ) -> None: """ Put a [ARSCResTableEntry][androguard.core.axml.ARSCResTableEntry] into the list of results :param result: results array ...
Put a [ARSCResTableEntry][androguard.core.axml.ARSCResTableEntry] into the list of results :param result: results array :param ate: :param config:
put_ate_value
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def put_item_value( self, result: list, item: Union[ARSCResStringPoolRef, int], config: ARSCResTableConfig, parent: ARSCResTableEntry, complex_: bool, compact_: bool = False, ) -> None: """ Put the tuple ...
Put the tuple ([ARSCResTableConfig][androguard.core.axml.ARSCResTableConfig], resolved string) into the result set :param result: the result set :param item: :param config: :param parent: the originating entry :param complex_: True if the origina...
put_item_value
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_resolved_res_configs( self, rid: int, config: Union[ARSCResTableConfig, None] = None ) -> list[tuple[ARSCResTableConfig, str]]: """ Return a list of resolved resource IDs with their corresponding configuration. It has a similar return type as [get_res_configs][androguard.core...
Return a list of resolved resource IDs with their corresponding configuration. It has a similar return type as [get_res_configs][androguard.core.axml.ARSCParser.get_res_configs] but also handles complex entries and references. Also instead of returning [ARSCResTableConfig][androguard.co...
get_resolved_res_configs
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_res_configs( self, rid: int, config: Union[ARSCResTableConfig, None] = None, fallback: bool = True, ) -> list[ARSCResTableConfig]: """ Return the resources found with the ID `rid` and select the right one based on the configuration, or return all if no...
Return the resources found with the ID `rid` and select the right one based on the configuration, or return all if no configuration was set. But we try to be generous here and at least try to resolve something: This method uses a fallback to return at least one resource (the first one ...
get_res_configs
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def parse_id(name: str) -> tuple[str, str]: """ Resolves an id from a binary XML file in the form `@[package:]DEADBEEF` and returns a tuple of package name and resource id. If no package name was given, i.e. the ID has the form `@DEADBEEF`, the package name is set to None. ...
Resolves an id from a binary XML file in the form `@[package:]DEADBEEF` and returns a tuple of package name and resource id. If no package name was given, i.e. the ID has the form `@DEADBEEF`, the package name is set to None. :raises ValueError: if the id is malformed. ...
parse_id
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_resource_xml_name( self, r_id: int, package: Union[str, None] = None ) -> str: """ Returns the XML name for a resource, including the package name if package is `None`. A full name might look like `@com.example:string/foobar` Otherwise the name is only looked up in th...
Returns the XML name for a resource, including the package name if package is `None`. A full name might look like `@com.example:string/foobar` Otherwise the name is only looked up in the specified package and is returned without the package name. The same example from about with...
get_resource_xml_name
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def __init__( self, current_package: ARSCResTablePackage, stringpool_main: StringBlock, mTableStrings: StringBlock, mKeyStrings: StringBlock, ) -> None: """ :param current_package: :param stringpool_main: :param mTableStrings: :param mK...
:param current_package: :param stringpool_main: :param mTableStrings: :param mKeyStrings:
__init__
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def __init__( self, buff: BinaryIO, expected_type: Union[int, None] = None, possible_types: Union[set[int], None] = None, ) -> None: """ :raises ResParserError: if header malformed :param buff: the buffer set to the position where the header starts. :p...
:raises ResParserError: if header malformed :param buff: the buffer set to the position where the header starts. :param int expected_type: the type of the header which is expected.
__init__
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_language_and_region(self) -> str: """ Returns the combined language+region string or \x00\x00 for the default locale :returns: the combined language and region string """ if self.locale != 0: _language = self._unpack_language_or_region( [ ...
Returns the combined language+region string or for the default locale :returns: the combined language and region string
get_language_and_region
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_qualifier(self) -> str: """ Return resource name qualifier for the current configuration. for example * `ldpi-v4` * `hdpi-v4` All possible qualifiers are listed in table 2 of <https://developer.android.com/guide/topics/resources/providing-resources> You...
Return resource name qualifier for the current configuration. for example * `ldpi-v4` * `hdpi-v4` All possible qualifiers are listed in table 2 of <https://developer.android.com/guide/topics/resources/providing-resources> You can find how android process this at [Reso...
get_qualifier
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def format_value(self) -> str: """ Return the formatted (interpreted) data according to `data_type`. """ return format_value( self.data_type, self.data, self.parent.stringpool_main.getString )
Return the formatted (interpreted) data according to `data_type`.
format_value
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def get_arsc_info(arscobj: ARSCParser) -> str: """ Return a string containing all resources packages ordered by packagename, locale and type. :param arscobj: [ARSCParser][androguard.core.axml.ARSCParser] :return: a string """ buff = "" for package in arscobj.get_packages_names(): bu...
Return a string containing all resources packages ordered by packagename, locale and type. :param arscobj: [ARSCParser][androguard.core.axml.ARSCParser] :return: a string
get_arsc_info
python
androguard/androguard
androguard/core/axml/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/axml/__init__.py
Apache-2.0
def read_null_terminated_string(f: IO) -> bytearray: """ Read a null terminated string from a file-like object. :param f: file-like object :returns: the bytes of the string read """ x = [] while True: z = f.read(128) if 0 in z: s = z.split(b'\x00', 1) ...
Read a null terminated string from a file-like object. :param f: file-like object :returns: the bytes of the string read
read_null_terminated_string
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def get_access_flags_string(value: int) -> str: """ Transform an access flag field to the corresponding string :param value: the value of the access flags :returns: the transformed string """ flags = [] for k, v in ACCESS_FLAGS.items(): if (k & value) == k: flags.append...
Transform an access flag field to the corresponding string :param value: the value of the access flags :returns: the transformed string
get_access_flags_string
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def get_type(atype: str, size: Union[int, None] = None) -> str: """ Retrieve the type of a descriptor (e.g : I) :returns: the descriptor string """ if atype.startswith('java.lang'): atype = atype.replace('java.lang.', '') res = TYPE_DESCRIPTOR.get(atype.lstrip('java.lang')) if res is...
Retrieve the type of a descriptor (e.g : I) :returns: the descriptor string
get_type
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def readuleb128(cm: ClassManager, buff: BinaryIO) -> int: """ Read an unsigned LEB128 at the current position of the buffer :param buff: a file like object :returns: decoded unsigned LEB128 """ result = get_byte(cm, buff) if result > 0x7F: cur = get_byte(cm, buff) result = (...
Read an unsigned LEB128 at the current position of the buffer :param buff: a file like object :returns: decoded unsigned LEB128
readuleb128
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def readsleb128(cm: ClassManager, buff: BinaryIO) -> int: """ 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(cm, buff) result |= (cur & 0x...
Read a signed LEB128 at the current position of the buffer. :param buff: a file like object :return: decoded sLEB128
readsleb128
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def writeuleb128(cm: ClassManager, value: int) -> bytearray: """ Convert an integer value to the corresponding unsigned LEB128. Raises a value error, if the given value is negative. :raises ValueError: if given value is negative :param value: non-negative integer :returns: bytes """ if...
Convert an integer value to the corresponding unsigned LEB128. Raises a value error, if the given value is negative. :raises ValueError: if given value is negative :param value: non-negative integer :returns: bytes
writeuleb128
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def writesleb128(cm: ClassManager, value: int) -> bytearray: """ Convert an integer value to the corresponding signed LEB128 :param value: integer value :return: bytes """ remaining = value >> 7 hasMore = True buff = bytearray() if (value & (-sys.maxsize - 1)) == 0: end = 0...
Convert an integer value to the corresponding signed LEB128 :param value: integer value :return: bytes
writesleb128
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def determineNext(i: Instruction, cur_idx: int, m: EncodedMethod) -> list: """ Determine the next offsets inside the bytecode of an [EncodedMethod][androguard.core.dex.EncodedMethod]. The offsets are calculated in number of bytes from the start of the method. Note, that offsets inside the bytecode are d...
Determine the next offsets inside the bytecode of an [EncodedMethod][androguard.core.dex.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! Offsets inside th...
determineNext
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def determineException(vm: DEX, m: EncodedMethod) -> list[list]: """ Returns try-catch handler inside the method. :param vm: a `DEX` object :param m: `EncodedMethod` object :return: a list """ # no exceptions ! if m.get_code().get_tries_size() <= 0: return [] h_off = {} ...
Returns try-catch handler inside the method. :param vm: a `DEX` object :param m: `EncodedMethod` object :return: a list
determineException
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, cm:ClassManager) -> None: """ :param buff: a string which represents a Buff object of the `annotation_set_ref_item` :param cm: a `ClassManager` object """ self.CM = cm (self.annotations_off,) = cm.packer["I"].unpack(buff.read(4))
:param buff: a string which represents a Buff object of the `annotation_set_ref_item` :param cm: a `ClassManager` object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, cm:ClassManager) -> None: """ :param buff: a string which represents a Buff object of the `annotation_set_ref_list_item` :param cm: a ClassManager object """ self.offset = buff.tell() self.CM = cm (self.size,) = cm.packer["I"].u...
:param buff: a string which represents a Buff object of the `annotation_set_ref_list_item` :param cm: a ClassManager object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, cm:ClassManager) -> None: """ :param buff: a string which represents a Buff object of the `annotations_directory_item` :param cm: a `ClassManager` object """ self.CM = cm self.offset = buff.tell() ( self.class_annot...
:param buff: a string which represents a Buff object of the `annotations_directory_item` :param cm: a `ClassManager` object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, cm:ClassManager) -> None: """ :param buff: a string which represents a buff object of the `encoded_array` :param cm: a ClassManager object """ self.CM = cm self.offset = buff.tell() self.size = readuleb128(cm, buff) sel...
:param buff: a string which represents a buff object of the `encoded_array` :param cm: a ClassManager object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, cm:ClassManager) -> None: """ :param buff: a string which represents a Buff object of the `encoded_value` :param cm: a `ClassManager` object """ self.CM = cm self.val = get_byte(cm, buff) self.value_arg = self.val >> 5 s...
:param buff: a string which represents a Buff object of the `encoded_value` :param cm: a `ClassManager` object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, cm:ClassManager) -> None: """ :param buff: a string which represents a Buff object of the `encoded_annotation` :param cm: a `ClassManager` object """ self.CM = cm self.offset = buff.tell() self.type_idx = readuleb128(cm, buff) ...
:param buff: a string which represents a Buff object of the `encoded_annotation` :param cm: a `ClassManager` object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, cm:ClassManager) -> None: """ :param buff: a string which represents a Buff object of the `annotation_item` :param cm: a `ClassManager` object """ self.CM = cm self.offset = buff.tell() self.visibility = get_byte(cm, buff) ...
:param buff: a string which represents a Buff object of the `annotation_item` :param cm: a `ClassManager` object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, cm: ClassManager) -> None: """ :param buff: a string which represents a Buff object of the `encoded_array_item` :param cm: a `ClassManager` object """ self.CM = cm self.offset = buff.tell() self.value = EncodedArray(buff, cm)
:param buff: a string which represents a Buff object of the `encoded_array_item` :param cm: a `ClassManager` object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, cm: ClassManager) -> None: """ :param buff: a string which represents a Buff object of the `string_data_item` :param cm: a `ClassManager` object """ self.CM = cm self.offset = buff.tell() # Content of string_data_item s...
:param buff: a string which represents a Buff object of the `string_data_item` :param cm: a `ClassManager` object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, cm: ClassManager): """ :param buff: a string which represents a Buff object of the str`ing_id_item :param cm: a `ClassManager` object """ self.CM = cm self.offset = buff.tell() (self.string_data_off,) = cm.packer["I"].unpack(buf...
:param buff: a string which represents a Buff object of the str`ing_id_item :param cm: a `ClassManager` object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, cm: ClassManager): """ :param buff: a string which represents a Buff object of the `type_id_item` :param cm: a `ClassManager` object """ self.CM = cm self.offset = buff.tell() (self.descriptor_idx,) = cm.packer["I"].unpack(buff....
:param buff: a string which represents a Buff object of the `type_id_item` :param cm: a `ClassManager` object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, size: int, buff: BinaryIO, cm: ClassManager) -> None: """ :param buff: a string which represents a Buff object of the list of `type_id_item` :param cm: a `ClassManager` object """ self.CM = cm self.offset = buff.tell() self.type = [TypeIdItem(...
:param buff: a string which represents a Buff object of the list of `type_id_item` :param cm: a `ClassManager` object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, cm: ClassManager): """ :param buff: a string which represents a Buff object of the `proto_id_item` :param cm: a `ClassManager` object """ self.CM = cm self.offset = buff.tell() self.shorty_idx, self.return_type_idx, self.paramet...
:param buff: a string which represents a Buff object of the `proto_id_item` :param cm: a `ClassManager` object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def get_shorty_idx_value(self) -> str: """ Return the string associated to the `shorty_idx` :returns: string """ if self.shorty_idx_value is None: self.shorty_idx_value = self.CM.get_string(self.shorty_idx) return self.shorty_idx_value
Return the string associated to the `shorty_idx` :returns: string
get_shorty_idx_value
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def get_return_type_idx_value(self) -> str: """ Return the string associated to the `return_type_idx` :returns: string """ if self.return_type_idx_value is None: self.return_type_idx_value = self.CM.get_type(self.return_type_idx) return self.return_type_idx_v...
Return the string associated to the `return_type_idx` :returns: string
get_return_type_idx_value
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def get_parameters_off_value(self) -> str: """ Return the string associated to the `parameters_off` :returns: string """ if self.parameters_off_value is None: params = self.CM.get_type_list(self.parameters_off) self.parameters_off_value = '(' + ' '.join(p...
Return the string associated to the `parameters_off` :returns: string
get_parameters_off_value
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, size:int, buff: BinaryIO, cm:ClassManager) -> None: """ :param buff: a string which represents a Buff object of the list of `proto_id_item` :param cm: a `ClassManager` object """ self.CM = cm self.offset = buff.tell() self.proto = [ProtoIdItem...
:param buff: a string which represents a Buff object of the list of `proto_id_item` :param cm: a `ClassManager` object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def __init__(self, buff: BinaryIO, cm: ClassManager) -> None: """" :param buff: a string which represents a Buff object of the `field_id_item` :param cm: a `ClassManager` object """ self.CM = cm self.offset = buff.tell() self.class_idx, self.type_idx, self.name_i...
" :param buff: a string which represents a Buff object of the `field_id_item` :param cm: a `ClassManager` object
__init__
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0
def get_class_name(self) -> str: """ Return the class name of the field :returns: the class name """ 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 class name of the field :returns: the class name
get_class_name
python
androguard/androguard
androguard/core/dex/__init__.py
https://github.com/androguard/androguard/blob/master/androguard/core/dex/__init__.py
Apache-2.0