partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
construct
Constructs a CFG :param androguard.core.analysis.analysis.DVMBasicBlock start_block: The startpoint :param vmap: variable mapping :param exceptions: list of androguard.core.analysis.analysis.ExceptionAnalysis :rtype: Graph
androguard/decompiler/dad/graph.py
def construct(start_block, vmap, exceptions): """ Constructs a CFG :param androguard.core.analysis.analysis.DVMBasicBlock start_block: The startpoint :param vmap: variable mapping :param exceptions: list of androguard.core.analysis.analysis.ExceptionAnalysis :rtype: Graph """ bfs_block...
def construct(start_block, vmap, exceptions): """ Constructs a CFG :param androguard.core.analysis.analysis.DVMBasicBlock start_block: The startpoint :param vmap: variable mapping :param exceptions: list of androguard.core.analysis.analysis.ExceptionAnalysis :rtype: Graph """ bfs_block...
[ "Constructs", "a", "CFG" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/graph.py#L479-L534
[ "def", "construct", "(", "start_block", ",", "vmap", ",", "exceptions", ")", ":", "bfs_blocks", "=", "bfs", "(", "start_block", ")", "graph", "=", "Graph", "(", ")", "gen_ret", "=", "GenInvokeRetName", "(", ")", "# Construction of a mapping of basic blocks into No...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Graph.remove_node
Remove the node from the graph, removes also all connections. :param androguard.decompiler.dad.node.Node node: the node to remove
androguard/decompiler/dad/graph.py
def remove_node(self, node): """ Remove the node from the graph, removes also all connections. :param androguard.decompiler.dad.node.Node node: the node to remove """ preds = self.reverse_edges.get(node, []) for pred in preds: self.edges[pred].remove(node) ...
def remove_node(self, node): """ Remove the node from the graph, removes also all connections. :param androguard.decompiler.dad.node.Node node: the node to remove """ preds = self.reverse_edges.get(node, []) for pred in preds: self.edges[pred].remove(node) ...
[ "Remove", "the", "node", "from", "the", "graph", "removes", "also", "all", "connections", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/graph.py#L85-L110
[ "def", "remove_node", "(", "self", ",", "node", ")", ":", "preds", "=", "self", ".", "reverse_edges", ".", "get", "(", "node", ",", "[", "]", ")", "for", "pred", "in", "preds", ":", "self", ".", "edges", "[", "pred", "]", ".", "remove", "(", "nod...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Graph.compute_rpo
Number the nodes in reverse post order. An RPO traversal visit as many predecessors of a node as possible before visiting the node itself.
androguard/decompiler/dad/graph.py
def compute_rpo(self): """ Number the nodes in reverse post order. An RPO traversal visit as many predecessors of a node as possible before visiting the node itself. """ nb = len(self.nodes) + 1 for node in self.post_order(): node.num = nb - node.po ...
def compute_rpo(self): """ Number the nodes in reverse post order. An RPO traversal visit as many predecessors of a node as possible before visiting the node itself. """ nb = len(self.nodes) + 1 for node in self.post_order(): node.num = nb - node.po ...
[ "Number", "the", "nodes", "in", "reverse", "post", "order", ".", "An", "RPO", "traversal", "visit", "as", "many", "predecessors", "of", "a", "node", "as", "possible", "before", "visiting", "the", "node", "itself", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/graph.py#L136-L145
[ "def", "compute_rpo", "(", "self", ")", ":", "nb", "=", "len", "(", "self", ".", "nodes", ")", "+", "1", "for", "node", "in", "self", ".", "post_order", "(", ")", ":", "node", ".", "num", "=", "nb", "-", "node", ".", "po", "self", ".", "rpo", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Graph.post_order
Yields the :class`~androguard.decompiler.dad.node.Node`s of the graph in post-order i.e we visit all the children of a node before visiting the node itself.
androguard/decompiler/dad/graph.py
def post_order(self): """ Yields the :class`~androguard.decompiler.dad.node.Node`s of the graph in post-order i.e we visit all the children of a node before visiting the node itself. """ def _visit(n, cnt): visited.add(n) for suc in self.all_sucs(n): ...
def post_order(self): """ Yields the :class`~androguard.decompiler.dad.node.Node`s of the graph in post-order i.e we visit all the children of a node before visiting the node itself. """ def _visit(n, cnt): visited.add(n) for suc in self.all_sucs(n): ...
[ "Yields", "the", ":", "class", "~androguard", ".", "decompiler", ".", "dad", ".", "node", ".", "Node", "s", "of", "the", "graph", "in", "post", "-", "order", "i", ".", "e", "we", "visit", "all", "the", "children", "of", "a", "node", "before", "visiti...
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/graph.py#L147-L163
[ "def", "post_order", "(", "self", ")", ":", "def", "_visit", "(", "n", ",", "cnt", ")", ":", "visited", ".", "add", "(", "n", ")", "for", "suc", "in", "self", ".", "all_sucs", "(", "n", ")", ":", "if", "suc", "not", "in", "visited", ":", "for",...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Graph.draw
Writes the current graph as a PNG file :param str name: filename (without .png) :param str dname: directory of the output png :param draw_branches: :return:
androguard/decompiler/dad/graph.py
def draw(self, name, dname, draw_branches=True): """ Writes the current graph as a PNG file :param str name: filename (without .png) :param str dname: directory of the output png :param draw_branches: :return: """ from pydot import Dot, Edge impor...
def draw(self, name, dname, draw_branches=True): """ Writes the current graph as a PNG file :param str name: filename (without .png) :param str dname: directory of the output png :param draw_branches: :return: """ from pydot import Dot, Edge impor...
[ "Writes", "the", "current", "graph", "as", "a", "PNG", "file" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/graph.py#L165-L196
[ "def", "draw", "(", "self", ",", "name", ",", "dname", ",", "draw_branches", "=", "True", ")", ":", "from", "pydot", "import", "Dot", ",", "Edge", "import", "os", "g", "=", "Dot", "(", ")", "g", ".", "set_node_defaults", "(", "color", "=", "'lightgra...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
axml
Parse the AndroidManifest.xml. Parsing is either direct or from a given APK and prints in XML format or saves to file. This tool can also be used to process any AXML encoded file, for example from the layout directory. Example: \b $ androguard axml AndroidManifest.xml
androguard/cli/entry_points.py
def axml(input_, output, file_, resource): """ Parse the AndroidManifest.xml. Parsing is either direct or from a given APK and prints in XML format or saves to file. This tool can also be used to process any AXML encoded file, for example from the layout directory. Example: \b ...
def axml(input_, output, file_, resource): """ Parse the AndroidManifest.xml. Parsing is either direct or from a given APK and prints in XML format or saves to file. This tool can also be used to process any AXML encoded file, for example from the layout directory. Example: \b ...
[ "Parse", "the", "AndroidManifest", ".", "xml", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/cli/entry_points.py#L64-L91
[ "def", "axml", "(", "input_", ",", "output", ",", "file_", ",", "resource", ")", ":", "if", "file_", "is", "not", "None", "and", "input_", "is", "not", "None", ":", "print", "(", "\"Can not give --input and positional argument! \"", "\"Please use only one of them!...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
arsc
Decode resources.arsc either directly from a given file or from an APK. Example: \b $ androguard arsc app.apk
androguard/cli/entry_points.py
def arsc(input_, file_, output, package, locale, type_, id_, list_packages, list_locales, list_types): """ Decode resources.arsc either directly from a given file or from an APK. Example: \b $ androguard arsc app....
def arsc(input_, file_, output, package, locale, type_, id_, list_packages, list_locales, list_types): """ Decode resources.arsc either directly from a given file or from an APK. Example: \b $ androguard arsc app....
[ "Decode", "resources", ".", "arsc", "either", "directly", "from", "a", "given", "file", "or", "from", "an", "APK", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/cli/entry_points.py#L142-L247
[ "def", "arsc", "(", "input_", ",", "file_", ",", "output", ",", "package", ",", "locale", ",", "type_", ",", "id_", ",", "list_packages", ",", "list_locales", ",", "list_types", ")", ":", "from", "androguard", ".", "core", "import", "androconf", "from", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
cg
Create a call graph and export it into a graph format. classnames are found in the type "Lfoo/bar/bla;". Example: \b $ androguard cg APK
androguard/cli/entry_points.py
def cg(output, show, verbose, classname, methodname, descriptor, accessflag, no_isolated, apk): """ Create a call graph and export it into a graph format. classnames are found in the type "Lfoo/bar/bla;". Example: \b $ androguard cg ...
def cg(output, show, verbose, classname, methodname, descriptor, accessflag, no_isolated, apk): """ Create a call graph and export it into a graph format. classnames are found in the type "Lfoo/bar/bla;". Example: \b $ androguard cg ...
[ "Create", "a", "call", "graph", "and", "export", "it", "into", "a", "graph", "format", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/cli/entry_points.py#L300-L327
[ "def", "cg", "(", "output", ",", "show", ",", "verbose", ",", "classname", ",", "methodname", ",", "descriptor", ",", "accessflag", ",", "no_isolated", ",", "apk", ")", ":", "androcg_main", "(", "verbose", "=", "verbose", ",", "APK", "=", "apk", ",", "...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
decompile
Decompile an APK and create Control Flow Graphs. Example: \b $ androguard resources.arsc
androguard/cli/entry_points.py
def decompile(input_, file_, output, format_, jar, limit, decompiler): """ Decompile an APK and create Control Flow Graphs. Example: \b $ androguard resources.arsc """ from androguard import session if file_ and input_: print("Can not give --input and positional argument! "...
def decompile(input_, file_, output, format_, jar, limit, decompiler): """ Decompile an APK and create Control Flow Graphs. Example: \b $ androguard resources.arsc """ from androguard import session if file_ and input_: print("Can not give --input and positional argument! "...
[ "Decompile", "an", "APK", "and", "create", "Control", "Flow", "Graphs", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/cli/entry_points.py#L367-L395
[ "def", "decompile", "(", "input_", ",", "file_", ",", "output", ",", "format_", ",", "jar", ",", "limit", ",", "decompiler", ")", ":", "from", "androguard", "import", "session", "if", "file_", "and", "input_", ":", "print", "(", "\"Can not give --input and p...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
sign
Return the fingerprint(s) of all certificates inside an APK.
androguard/cli/entry_points.py
def sign(hash_, print_all_hashes, show, apk): """Return the fingerprint(s) of all certificates inside an APK.""" androsign_main(apk, hash_, print_all_hashes, show)
def sign(hash_, print_all_hashes, show, apk): """Return the fingerprint(s) of all certificates inside an APK.""" androsign_main(apk, hash_, print_all_hashes, show)
[ "Return", "the", "fingerprint", "(", "s", ")", "of", "all", "certificates", "inside", "an", "APK", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/cli/entry_points.py#L425-L427
[ "def", "sign", "(", "hash_", ",", "print_all_hashes", ",", "show", ",", "apk", ")", ":", "androsign_main", "(", "apk", ",", "hash_", ",", "print_all_hashes", ",", "show", ")" ]
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
apkid
Return the packageName/versionCode/versionName per APK as JSON.
androguard/cli/entry_points.py
def apkid(apks): """Return the packageName/versionCode/versionName per APK as JSON.""" import json import logging logging.getLogger("androguard.axml").setLevel(logging.ERROR) results = dict() for apk in apks: results[apk] = androguard.core.bytecodes.apk.get_apkid(apk) print(json.dump...
def apkid(apks): """Return the packageName/versionCode/versionName per APK as JSON.""" import json import logging logging.getLogger("androguard.axml").setLevel(logging.ERROR) results = dict() for apk in apks: results[apk] = androguard.core.bytecodes.apk.get_apkid(apk) print(json.dump...
[ "Return", "the", "packageName", "/", "versionCode", "/", "versionName", "per", "APK", "as", "JSON", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/cli/entry_points.py#L437-L445
[ "def", "apkid", "(", "apks", ")", ":", "import", "json", "import", "logging", "logging", ".", "getLogger", "(", "\"androguard.axml\"", ")", ".", "setLevel", "(", "logging", ".", "ERROR", ")", "results", "=", "dict", "(", ")", "for", "apk", "in", "apks", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
load_module
Load a module by name and search path Returns None if Module could not be loaded.
androguard/gui/mainwindow.py
def load_module(module_name, file_path): """ Load a module by name and search path Returns None if Module could not be loaded. """ if sys.version_info >= (3,5,): import importlib.util spec = importlib.util.spec_from_file_location(module_name, file_path) if not spec: ...
def load_module(module_name, file_path): """ Load a module by name and search path Returns None if Module could not be loaded. """ if sys.version_info >= (3,5,): import importlib.util spec = importlib.util.spec_from_file_location(module_name, file_path) if not spec: ...
[ "Load", "a", "module", "by", "name", "and", "search", "path" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/gui/mainwindow.py#L22-L42
[ "def", "load_module", "(", "module_name", ",", "file_path", ")", ":", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "5", ",", ")", ":", "import", "importlib", ".", "util", "spec", "=", "importlib", ".", "util", ".", "spec_from_file_location", "(...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
MainWindow.showStatus
Helper function called by any window to display a message in status bar.
androguard/gui/mainwindow.py
def showStatus(self, msg): """Helper function called by any window to display a message in status bar. """ log.debug(msg) self.statusBar().showMessage(msg)
def showStatus(self, msg): """Helper function called by any window to display a message in status bar. """ log.debug(msg) self.statusBar().showMessage(msg)
[ "Helper", "function", "called", "by", "any", "window", "to", "display", "a", "message", "in", "status", "bar", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/gui/mainwindow.py#L157-L162
[ "def", "showStatus", "(", "self", ",", "msg", ")", ":", "log", ".", "debug", "(", "msg", ")", "self", ".", "statusBar", "(", ")", ".", "showMessage", "(", "msg", ")" ]
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
MainWindow.saveFile
User clicked Save menu. Display a Dialog to ask whwre to save.
androguard/gui/mainwindow.py
def saveFile(self): """User clicked Save menu. Display a Dialog to ask whwre to save.""" filepath, _ = QtWidgets.QFileDialog.getSaveFileName( self, "Save File", '', "Androguard Session (*.ag)") if filepath: # Ensure .ag as file ending if not filepath.endswith...
def saveFile(self): """User clicked Save menu. Display a Dialog to ask whwre to save.""" filepath, _ = QtWidgets.QFileDialog.getSaveFileName( self, "Save File", '', "Androguard Session (*.ag)") if filepath: # Ensure .ag as file ending if not filepath.endswith...
[ "User", "clicked", "Save", "menu", ".", "Display", "a", "Dialog", "to", "ask", "whwre", "to", "save", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/gui/mainwindow.py#L223-L235
[ "def", "saveFile", "(", "self", ")", ":", "filepath", ",", "_", "=", "QtWidgets", ".", "QFileDialog", ".", "getSaveFileName", "(", "self", ",", "\"Save File\"", ",", "''", ",", "\"Androguard Session (*.ag)\"", ")", "if", "filepath", ":", "# Ensure .ag as file en...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
MainWindow.saveSession
Save androguard session.
androguard/gui/mainwindow.py
def saveSession(self, filepath): """Save androguard session.""" try: session_module.Save(self.session, filepath) except RuntimeError as e: log.exception(e) os.remove(filepath) log.warning("Session not saved")
def saveSession(self, filepath): """Save androguard session.""" try: session_module.Save(self.session, filepath) except RuntimeError as e: log.exception(e) os.remove(filepath) log.warning("Session not saved")
[ "Save", "androguard", "session", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/gui/mainwindow.py#L237-L244
[ "def", "saveSession", "(", "self", ",", "filepath", ")", ":", "try", ":", "session_module", ".", "Save", "(", "self", ".", "session", ",", "filepath", ")", "except", "RuntimeError", "as", "e", ":", "log", ".", "exception", "(", "e", ")", "os", ".", "...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
MainWindow.setupEmptyTree
Setup empty Tree at startup.
androguard/gui/mainwindow.py
def setupEmptyTree(self): """Setup empty Tree at startup. """ if hasattr(self, "tree"): del self.tree self.tree = QtWidgets.QTreeWidget(self) self.tree.header().close()
def setupEmptyTree(self): """Setup empty Tree at startup. """ if hasattr(self, "tree"): del self.tree self.tree = QtWidgets.QTreeWidget(self) self.tree.header().close()
[ "Setup", "empty", "Tree", "at", "startup", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/gui/mainwindow.py#L272-L277
[ "def", "setupEmptyTree", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "\"tree\"", ")", ":", "del", "self", ".", "tree", "self", ".", "tree", "=", "QtWidgets", ".", "QTreeWidget", "(", "self", ")", "self", ".", "tree", ".", "header", "(",...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
MainWindow.setupDock
Setup empty Dock at startup.
androguard/gui/mainwindow.py
def setupDock(self): """Setup empty Dock at startup. """ self.dock = QtWidgets.QDockWidget("Classes", self) self.dock.setWidget(self.tree) self.dock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures) self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, self.dock)
def setupDock(self): """Setup empty Dock at startup. """ self.dock = QtWidgets.QDockWidget("Classes", self) self.dock.setWidget(self.tree) self.dock.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures) self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, self.dock)
[ "Setup", "empty", "Dock", "at", "startup", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/gui/mainwindow.py#L279-L284
[ "def", "setupDock", "(", "self", ")", ":", "self", ".", "dock", "=", "QtWidgets", ".", "QDockWidget", "(", "\"Classes\"", ",", "self", ")", "self", ".", "dock", ".", "setWidget", "(", "self", ".", "tree", ")", "self", ".", "dock", ".", "setFeatures", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
MainWindow.setupCentral
Setup empty window supporting tabs at startup.
androguard/gui/mainwindow.py
def setupCentral(self): """Setup empty window supporting tabs at startup. """ self.central = TabsWindow(self.bin_windows, self) self.setCentralWidget(self.central)
def setupCentral(self): """Setup empty window supporting tabs at startup. """ self.central = TabsWindow(self.bin_windows, self) self.setCentralWidget(self.central)
[ "Setup", "empty", "window", "supporting", "tabs", "at", "startup", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/gui/mainwindow.py#L292-L295
[ "def", "setupCentral", "(", "self", ")", ":", "self", ".", "central", "=", "TabsWindow", "(", "self", ".", "bin_windows", ",", "self", ")", "self", ".", "setCentralWidget", "(", "self", ".", "central", ")" ]
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
MainWindow.openSourceWindow
Main function to open a decompile source window It checks if it already opened and open that tab, otherwise, initialize a new window.
androguard/gui/mainwindow.py
def openSourceWindow(self, current_class, method=None): """Main function to open a decompile source window It checks if it already opened and open that tab, otherwise, initialize a new window. """ log.debug("openSourceWindow for %s" % current_class) sourcewin = sel...
def openSourceWindow(self, current_class, method=None): """Main function to open a decompile source window It checks if it already opened and open that tab, otherwise, initialize a new window. """ log.debug("openSourceWindow for %s" % current_class) sourcewin = sel...
[ "Main", "function", "to", "open", "a", "decompile", "source", "window", "It", "checks", "if", "it", "already", "opened", "and", "open", "that", "tab", "otherwise", "initialize", "a", "new", "window", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/gui/mainwindow.py#L402-L428
[ "def", "openSourceWindow", "(", "self", ",", "current_class", ",", "method", "=", "None", ")", ":", "log", ".", "debug", "(", "\"openSourceWindow for %s\"", "%", "current_class", ")", "sourcewin", "=", "self", ".", "getMeOpenedWindowIfExists", "(", "current_class"...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
name_to_androguard
Convert a object or primitive name into androguard syntax For example: byte --> B foo.bar.bla --> Lfoo/bar/bla; [int --> [I There is also a special case, where some arrays are specified differently: B[] --> [B foo.bar.bla[] --> [Lfoo/bar/bla; :param n: :return:
generators/axplorer_to_androguard.py
def name_to_androguard(n): """ Convert a object or primitive name into androguard syntax For example: byte --> B foo.bar.bla --> Lfoo/bar/bla; [int --> [I There is also a special case, where some arrays are specified differently: B[] --> [B foo.bar.bla[] --> [Lf...
def name_to_androguard(n): """ Convert a object or primitive name into androguard syntax For example: byte --> B foo.bar.bla --> Lfoo/bar/bla; [int --> [I There is also a special case, where some arrays are specified differently: B[] --> [B foo.bar.bla[] --> [Lf...
[ "Convert", "a", "object", "or", "primitive", "name", "into", "androguard", "syntax" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/generators/axplorer_to_androguard.py#L18-L53
[ "def", "name_to_androguard", "(", "n", ")", ":", "if", "n", "==", "\"\"", ":", "return", "\"\"", "is_array", "=", "\"\"", "# FIXME what about n-dimensional arrays?", "if", "n", ".", "startswith", "(", "\"[\"", ")", ":", "is_array", "=", "\"[\"", "n", "=", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
convert_name
Converts a line of axplorer format into androguard method signature + permission :param s: :return:
generators/axplorer_to_androguard.py
def convert_name(s): """ Converts a line of axplorer format into androguard method signature + permission :param s: :return: """ m = re.compile(r"^(.*)\.(.*)\((.*)\)(.*) :: (.*)$") res = m.search(s) if res: clname, methodname, all_args, ret, perm = res.groups() args = "...
def convert_name(s): """ Converts a line of axplorer format into androguard method signature + permission :param s: :return: """ m = re.compile(r"^(.*)\.(.*)\((.*)\)(.*) :: (.*)$") res = m.search(s) if res: clname, methodname, all_args, ret, perm = res.groups() args = "...
[ "Converts", "a", "line", "of", "axplorer", "format", "into", "androguard", "method", "signature", "+", "permission", ":", "param", "s", ":", ":", "return", ":" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/generators/axplorer_to_androguard.py#L56-L74
[ "def", "convert_name", "(", "s", ")", ":", "m", "=", "re", ".", "compile", "(", "r\"^(.*)\\.(.*)\\((.*)\\)(.*) :: (.*)$\"", ")", "res", "=", "m", ".", "search", "(", "s", ")", "if", "res", ":", "clname", ",", "methodname", ",", "all_args", ",", "ret", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
generate_mappings
Generate the permission mappings from a axplorer root dir into a given folder. For each API Level, separate json file will be created. :param axplorerdir: path to the axplorer dir :param outfolder: path to the folder where the resulting json files are put
generators/axplorer_to_androguard.py
def generate_mappings(axplorerdir="libraries/axplorer", outfolder="androguard/core/api_specific_resources"): """ Generate the permission mappings from a axplorer root dir into a given folder. For each API Level, separate json file will be created. :param axplorerdir: path to the axplorer dir :param...
def generate_mappings(axplorerdir="libraries/axplorer", outfolder="androguard/core/api_specific_resources"): """ Generate the permission mappings from a axplorer root dir into a given folder. For each API Level, separate json file will be created. :param axplorerdir: path to the axplorer dir :param...
[ "Generate", "the", "permission", "mappings", "from", "a", "axplorer", "root", "dir", "into", "a", "given", "folder", ".", "For", "each", "API", "Level", "separate", "json", "file", "will", "be", "created", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/generators/axplorer_to_androguard.py#L77-L150
[ "def", "generate_mappings", "(", "axplorerdir", "=", "\"libraries/axplorer\"", ",", "outfolder", "=", "\"androguard/core/api_specific_resources\"", ")", ":", "res", "=", "dict", "(", ")", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
DvMachine.get_class
Return the :class:`DvClass` with the given name The name is partially matched against the known class names and the first result is returned. For example, the input `foobar` will match on Lfoobar/bla/foo; :param str class_name: :return: the class matching on the name :rtype: Dv...
androguard/decompiler/dad/decompile.py
def get_class(self, class_name): """ Return the :class:`DvClass` with the given name The name is partially matched against the known class names and the first result is returned. For example, the input `foobar` will match on Lfoobar/bla/foo; :param str class_name: :retu...
def get_class(self, class_name): """ Return the :class:`DvClass` with the given name The name is partially matched against the known class names and the first result is returned. For example, the input `foobar` will match on Lfoobar/bla/foo; :param str class_name: :retu...
[ "Return", "the", ":", "class", ":", "DvClass", "with", "the", "given", "name" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/decompile.py#L460-L477
[ "def", "get_class", "(", "self", ",", "class_name", ")", ":", "for", "name", ",", "klass", "in", "self", ".", "classes", ".", "items", "(", ")", ":", "# TODO why use the name partially?", "if", "class_name", "in", "name", ":", "if", "isinstance", "(", "kla...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
DvMachine.process
Process all classes inside the machine. This calls :meth:`~androgaurd.decompiler.dad.decompile.DvClass.process` on each :class:`DvClass`.
androguard/decompiler/dad/decompile.py
def process(self): """ Process all classes inside the machine. This calls :meth:`~androgaurd.decompiler.dad.decompile.DvClass.process` on each :class:`DvClass`. """ for name, klass in self.classes.items(): logger.debug('Processing class: %s', name) if isi...
def process(self): """ Process all classes inside the machine. This calls :meth:`~androgaurd.decompiler.dad.decompile.DvClass.process` on each :class:`DvClass`. """ for name, klass in self.classes.items(): logger.debug('Processing class: %s', name) if isi...
[ "Process", "all", "classes", "inside", "the", "machine", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/decompile.py#L479-L491
[ "def", "process", "(", "self", ")", ":", "for", "name", ",", "klass", "in", "self", ".", "classes", ".", "items", "(", ")", ":", "logger", ".", "debug", "(", "'Processing class: %s'", ",", "name", ")", "if", "isinstance", "(", "klass", ",", "DvClass", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
DvMachine.process_and_show
Run :meth:`process` and :meth:`show_source` after each other.
androguard/decompiler/dad/decompile.py
def process_and_show(self): """ Run :meth:`process` and :meth:`show_source` after each other. """ for name, klass in sorted(self.classes.items()): logger.debug('Processing class: %s', name) if not isinstance(klass, DvClass): klass = DvClass(klass, ...
def process_and_show(self): """ Run :meth:`process` and :meth:`show_source` after each other. """ for name, klass in sorted(self.classes.items()): logger.debug('Processing class: %s', name) if not isinstance(klass, DvClass): klass = DvClass(klass, ...
[ "Run", ":", "meth", ":", "process", "and", ":", "meth", ":", "show_source", "after", "each", "other", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/decompile.py#L503-L512
[ "def", "process_and_show", "(", "self", ")", ":", "for", "name", ",", "klass", "in", "sorted", "(", "self", ".", "classes", ".", "items", "(", ")", ")", ":", "logger", ".", "debug", "(", "'Processing class: %s'", ",", "name", ")", "if", "not", "isinsta...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
DvMachine.get_ast
Processes each class with AST enabled and returns a dictionary with all single ASTs Classnames as keys. :return: an dictionary for all classes :rtype: dict
androguard/decompiler/dad/decompile.py
def get_ast(self): """ Processes each class with AST enabled and returns a dictionary with all single ASTs Classnames as keys. :return: an dictionary for all classes :rtype: dict """ ret = dict() for name, cls in sorted(self.classes.items()): ...
def get_ast(self): """ Processes each class with AST enabled and returns a dictionary with all single ASTs Classnames as keys. :return: an dictionary for all classes :rtype: dict """ ret = dict() for name, cls in sorted(self.classes.items()): ...
[ "Processes", "each", "class", "with", "AST", "enabled", "and", "returns", "a", "dictionary", "with", "all", "single", "ASTs", "Classnames", "as", "keys", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/decompile.py#L514-L529
[ "def", "get_ast", "(", "self", ")", ":", "ret", "=", "dict", "(", ")", "for", "name", ",", "cls", "in", "sorted", "(", "self", ".", "classes", ".", "items", "(", ")", ")", ":", "logger", ".", "debug", "(", "'Processing class: %s'", ",", "name", ")"...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
disable_colors
Disable colors from the output (color = normal)
androguard/core/androconf.py
def disable_colors(): """ Disable colors from the output (color = normal)""" for i in CONF["COLORS"]: if isinstance(CONF["COLORS"][i], dict): for j in CONF["COLORS"][i]: CONF["COLORS"][i][j] = Color.normal else: CONF["COLORS"][i] = Color.normal
def disable_colors(): """ Disable colors from the output (color = normal)""" for i in CONF["COLORS"]: if isinstance(CONF["COLORS"][i], dict): for j in CONF["COLORS"][i]: CONF["COLORS"][i][j] = Color.normal else: CONF["COLORS"][i] = Color.normal
[ "Disable", "colors", "from", "the", "output", "(", "color", "=", "normal", ")" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/androconf.py#L163-L170
[ "def", "disable_colors", "(", ")", ":", "for", "i", "in", "CONF", "[", "\"COLORS\"", "]", ":", "if", "isinstance", "(", "CONF", "[", "\"COLORS\"", "]", "[", "i", "]", ",", "dict", ")", ":", "for", "j", "in", "CONF", "[", "\"COLORS\"", "]", "[", "...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
remove_colors
Remove colors from the output (no escape sequences)
androguard/core/androconf.py
def remove_colors(): """ Remove colors from the output (no escape sequences)""" for i in CONF["COLORS"]: if isinstance(CONF["COLORS"][i], dict): for j in CONF["COLORS"][i]: CONF["COLORS"][i][j] = "" else: CONF["COLORS"][i] = ""
def remove_colors(): """ Remove colors from the output (no escape sequences)""" for i in CONF["COLORS"]: if isinstance(CONF["COLORS"][i], dict): for j in CONF["COLORS"][i]: CONF["COLORS"][i][j] = "" else: CONF["COLORS"][i] = ""
[ "Remove", "colors", "from", "the", "output", "(", "no", "escape", "sequences", ")" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/androconf.py#L173-L180
[ "def", "remove_colors", "(", ")", ":", "for", "i", "in", "CONF", "[", "\"COLORS\"", "]", ":", "if", "isinstance", "(", "CONF", "[", "\"COLORS\"", "]", "[", "i", "]", ",", "dict", ")", ":", "for", "j", "in", "CONF", "[", "\"COLORS\"", "]", "[", "i...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
is_android_raw
Returns a string that describes the type of file, for common Android specific formats
androguard/core/androconf.py
def is_android_raw(raw): """ Returns a string that describes the type of file, for common Android specific formats """ val = None # We do not check for META-INF/MANIFEST.MF, # as you also want to analyze unsigned APKs... # AndroidManifest.xml should be in every APK. # classes.dex an...
def is_android_raw(raw): """ Returns a string that describes the type of file, for common Android specific formats """ val = None # We do not check for META-INF/MANIFEST.MF, # as you also want to analyze unsigned APKs... # AndroidManifest.xml should be in every APK. # classes.dex an...
[ "Returns", "a", "string", "that", "describes", "the", "type", "of", "file", "for", "common", "Android", "specific", "formats" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/androconf.py#L215-L240
[ "def", "is_android_raw", "(", "raw", ")", ":", "val", "=", "None", "# We do not check for META-INF/MANIFEST.MF,", "# as you also want to analyze unsigned APKs...", "# AndroidManifest.xml should be in every APK.", "# classes.dex and resources.arsc are not required!", "# if raw[0:2] == b\"PK...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
show_logging
enable log messages on stdout We will catch all messages here! From all loggers...
androguard/core/androconf.py
def show_logging(level=logging.INFO): """ enable log messages on stdout We will catch all messages here! From all loggers... """ logger = logging.getLogger() h = logging.StreamHandler(stream=sys.stderr) h.setFormatter(logging.Formatter(fmt="[%(levelname)-8s] %(name)s: %(message)s")) l...
def show_logging(level=logging.INFO): """ enable log messages on stdout We will catch all messages here! From all loggers... """ logger = logging.getLogger() h = logging.StreamHandler(stream=sys.stderr) h.setFormatter(logging.Formatter(fmt="[%(levelname)-8s] %(name)s: %(message)s")) l...
[ "enable", "log", "messages", "on", "stdout" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/androconf.py#L243-L255
[ "def", "show_logging", "(", "level", "=", "logging", ".", "INFO", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", ")", "h", "=", "logging", ".", "StreamHandler", "(", "stream", "=", "sys", ".", "stderr", ")", "h", ".", "setFormatter", "(", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
rrmdir
Recursivly delete a directory :param directory: directory to remove
androguard/core/androconf.py
def rrmdir(directory): """ Recursivly delete a directory :param directory: directory to remove """ for root, dirs, files in os.walk(directory, topdown=False): for name in files: os.remove(os.path.join(root, name)) for name in dirs: os.rmdir(os.path.join(root,...
def rrmdir(directory): """ Recursivly delete a directory :param directory: directory to remove """ for root, dirs, files in os.walk(directory, topdown=False): for name in files: os.remove(os.path.join(root, name)) for name in dirs: os.rmdir(os.path.join(root,...
[ "Recursivly", "delete", "a", "directory" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/androconf.py#L266-L277
[ "def", "rrmdir", "(", "directory", ")", ":", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "directory", ",", "topdown", "=", "False", ")", ":", "for", "name", "in", "files", ":", "os", ".", "remove", "(", "os", ".", "pat...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
make_color_tuple
turn something like "#000000" into 0,0,0 or "#FFFFFF into "255,255,255"
androguard/core/androconf.py
def make_color_tuple(color): """ turn something like "#000000" into 0,0,0 or "#FFFFFF into "255,255,255" """ R = color[1:3] G = color[3:5] B = color[5:7] R = int(R, 16) G = int(G, 16) B = int(B, 16) return R, G, B
def make_color_tuple(color): """ turn something like "#000000" into 0,0,0 or "#FFFFFF into "255,255,255" """ R = color[1:3] G = color[3:5] B = color[5:7] R = int(R, 16) G = int(G, 16) B = int(B, 16) return R, G, B
[ "turn", "something", "like", "#000000", "into", "0", "0", "0", "or", "#FFFFFF", "into", "255", "255", "255" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/androconf.py#L280-L293
[ "def", "make_color_tuple", "(", "color", ")", ":", "R", "=", "color", "[", "1", ":", "3", "]", "G", "=", "color", "[", "3", ":", "5", "]", "B", "=", "color", "[", "5", ":", "7", "]", "R", "=", "int", "(", "R", ",", "16", ")", "G", "=", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
color_range
wrapper for interpolate_tuple that accepts colors as html ("#CCCCC" and such)
androguard/core/androconf.py
def color_range(startcolor, goalcolor, steps): """ wrapper for interpolate_tuple that accepts colors as html ("#CCCCC" and such) """ start_tuple = make_color_tuple(startcolor) goal_tuple = make_color_tuple(goalcolor) return interpolate_tuple(start_tuple, goal_tuple, steps)
def color_range(startcolor, goalcolor, steps): """ wrapper for interpolate_tuple that accepts colors as html ("#CCCCC" and such) """ start_tuple = make_color_tuple(startcolor) goal_tuple = make_color_tuple(goalcolor) return interpolate_tuple(start_tuple, goal_tuple, steps)
[ "wrapper", "for", "interpolate_tuple", "that", "accepts", "colors", "as", "html", "(", "#CCCCC", "and", "such", ")" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/androconf.py#L339-L346
[ "def", "color_range", "(", "startcolor", ",", "goalcolor", ",", "steps", ")", ":", "start_tuple", "=", "make_color_tuple", "(", "startcolor", ")", "goal_tuple", "=", "make_color_tuple", "(", "goalcolor", ")", "return", "interpolate_tuple", "(", "start_tuple", ",",...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
load_api_specific_resource_module
Load the module from the JSON files and return a dict, which might be empty if the resource could not be loaded. If no api version is given, the default one from the CONF dict is used. :param resource_name: Name of the resource to load :param api: API version :return: dict
androguard/core/androconf.py
def load_api_specific_resource_module(resource_name, api=None): """ Load the module from the JSON files and return a dict, which might be empty if the resource could not be loaded. If no api version is given, the default one from the CONF dict is used. :param resource_name: Name of the resource to...
def load_api_specific_resource_module(resource_name, api=None): """ Load the module from the JSON files and return a dict, which might be empty if the resource could not be loaded. If no api version is given, the default one from the CONF dict is used. :param resource_name: Name of the resource to...
[ "Load", "the", "module", "from", "the", "JSON", "files", "and", "return", "a", "dict", "which", "might", "be", "empty", "if", "the", "resource", "could", "not", "be", "loaded", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/androconf.py#L349-L377
[ "def", "load_api_specific_resource_module", "(", "resource_name", ",", "api", "=", "None", ")", ":", "loader", "=", "dict", "(", "aosp_permissions", "=", "load_permissions", ",", "api_permission_mappings", "=", "load_permission_mappings", ")", "if", "resource_name", "...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
BottomBanner.draw
qp.drawLine(self.fontWidth*(len(pos) + 1) + 15, 0, self.fontWidth*(len(pos) + 1) + 15, 50) qp.drawLine(self.fontWidth*(len(pos + sd) + 1) + 3*15, 0, self.fontWidth*(len(pos + sd) + 1) + 3*15, 50) qp.drawLine(self.fontWidth*(len(pos + sd + sq) + 1) + 5*15, 0, self.fontWidth*(len(pos + sd + sq) + 1) + 5*1...
androguard/gui/Banners.py
def draw(self): qp = QtGui.QPainter() qp.begin(self.qpix) qp.fillRect(0, 0, self.width, self.height, self.backgroundBrush) qp.setPen(self.textPen) qp.setFont(self.font) cemu = ConsoleEmulator(qp, self.height // self.fontHeight, self.width // self.fontWidth) dwo...
def draw(self): qp = QtGui.QPainter() qp.begin(self.qpix) qp.fillRect(0, 0, self.width, self.height, self.backgroundBrush) qp.setPen(self.textPen) qp.setFont(self.font) cemu = ConsoleEmulator(qp, self.height // self.fontHeight, self.width // self.fontWidth) dwo...
[ "qp", ".", "drawLine", "(", "self", ".", "fontWidth", "*", "(", "len", "(", "pos", ")", "+", "1", ")", "+", "15", "0", "self", ".", "fontWidth", "*", "(", "len", "(", "pos", ")", "+", "1", ")", "+", "15", "50", ")", "qp", ".", "drawLine", "...
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/gui/Banners.py#L210-L296
[ "def", "draw", "(", "self", ")", ":", "qp", "=", "QtGui", ".", "QPainter", "(", ")", "qp", ".", "begin", "(", "self", ".", "qpix", ")", "qp", ".", "fillRect", "(", "0", ",", "0", ",", "self", ".", "width", ",", "self", ".", "height", ",", "se...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
update_chain
Updates the DU chain of the instruction located at loc such that there is no more reference to it so that we can remove it. When an instruction is found to be dead (i.e it has no side effect, and the register defined is not used) we have to update the DU chain of all the variables that may me used by th...
androguard/decompiler/dad/dataflow.py
def update_chain(graph, loc, du, ud): """ Updates the DU chain of the instruction located at loc such that there is no more reference to it so that we can remove it. When an instruction is found to be dead (i.e it has no side effect, and the register defined is not used) we have to update the DU cha...
def update_chain(graph, loc, du, ud): """ Updates the DU chain of the instruction located at loc such that there is no more reference to it so that we can remove it. When an instruction is found to be dead (i.e it has no side effect, and the register defined is not used) we have to update the DU cha...
[ "Updates", "the", "DU", "chain", "of", "the", "instruction", "located", "at", "loc", "such", "that", "there", "is", "no", "more", "reference", "to", "it", "so", "that", "we", "can", "remove", "it", ".", "When", "an", "instruction", "is", "found", "to", ...
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/dataflow.py#L80-L113
[ "def", "update_chain", "(", "graph", ",", "loc", ",", "du", ",", "ud", ")", ":", "ins", "=", "graph", ".", "get_ins_from_loc", "(", "loc", ")", "for", "var", "in", "ins", ".", "get_used_vars", "(", ")", ":", "# We get the definition points of the current var...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
dead_code_elimination
Run a dead code elimination pass. Instructions are checked to be dead. If it is the case, we remove them and we update the DU & UD chains of its variables to check for further dead instructions.
androguard/decompiler/dad/dataflow.py
def dead_code_elimination(graph, du, ud): """ Run a dead code elimination pass. Instructions are checked to be dead. If it is the case, we remove them and we update the DU & UD chains of its variables to check for further dead instructions. """ for node in graph.rpo: for i, ins in no...
def dead_code_elimination(graph, du, ud): """ Run a dead code elimination pass. Instructions are checked to be dead. If it is the case, we remove them and we update the DU & UD chains of its variables to check for further dead instructions. """ for node in graph.rpo: for i, ins in no...
[ "Run", "a", "dead", "code", "elimination", "pass", ".", "Instructions", "are", "checked", "to", "be", "dead", ".", "If", "it", "is", "the", "case", "we", "remove", "them", "and", "we", "update", "the", "DU", "&", "UD", "chains", "of", "its", "variables...
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/dataflow.py#L116-L145
[ "def", "dead_code_elimination", "(", "graph", ",", "du", ",", "ud", ")", ":", "for", "node", "in", "graph", ".", "rpo", ":", "for", "i", ",", "ins", "in", "node", ".", "get_loc_with_ins", "(", ")", ":", "reg", "=", "ins", ".", "get_lhs", "(", ")", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
clear_path
Check that the path from loc1 to loc2 is clear. We have to check that there is no side effect between the two location points. We also have to check that the variable `reg` is not redefined along one of the possible pathes from loc1 to loc2.
androguard/decompiler/dad/dataflow.py
def clear_path(graph, reg, loc1, loc2): """ Check that the path from loc1 to loc2 is clear. We have to check that there is no side effect between the two location points. We also have to check that the variable `reg` is not redefined along one of the possible pathes from loc1 to loc2. """ lo...
def clear_path(graph, reg, loc1, loc2): """ Check that the path from loc1 to loc2 is clear. We have to check that there is no side effect between the two location points. We also have to check that the variable `reg` is not redefined along one of the possible pathes from loc1 to loc2. """ lo...
[ "Check", "that", "the", "path", "from", "loc1", "to", "loc2", "is", "clear", ".", "We", "have", "to", "check", "that", "there", "is", "no", "side", "effect", "between", "the", "two", "location", "points", ".", "We", "also", "have", "to", "check", "that...
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/dataflow.py#L161-L186
[ "def", "clear_path", "(", "graph", ",", "reg", ",", "loc1", ",", "loc2", ")", ":", "logger", ".", "debug", "(", "'clear_path: reg(%s), loc1(%s), loc2(%s)'", ",", "reg", ",", "loc1", ",", "loc2", ")", "node1", "=", "graph", ".", "get_node_from_loc", "(", "l...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
register_propagation
Propagate the temporary registers between instructions and remove them if necessary. We process the nodes of the graph in reverse post order. For each instruction in the node, we look at the variables that it uses. For each of these variables we look where it is defined and if we can replace it with ...
androguard/decompiler/dad/dataflow.py
def register_propagation(graph, du, ud): """ Propagate the temporary registers between instructions and remove them if necessary. We process the nodes of the graph in reverse post order. For each instruction in the node, we look at the variables that it uses. For each of these variables we look ...
def register_propagation(graph, du, ud): """ Propagate the temporary registers between instructions and remove them if necessary. We process the nodes of the graph in reverse post order. For each instruction in the node, we look at the variables that it uses. For each of these variables we look ...
[ "Propagate", "the", "temporary", "registers", "between", "instructions", "and", "remove", "them", "if", "necessary", ".", "We", "process", "the", "nodes", "of", "the", "graph", "in", "reverse", "post", "order", ".", "For", "each", "instruction", "in", "the", ...
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/dataflow.py#L189-L309
[ "def", "register_propagation", "(", "graph", ",", "du", ",", "ud", ")", ":", "change", "=", "True", "while", "change", ":", "change", "=", "False", "for", "node", "in", "graph", ".", "rpo", ":", "for", "i", ",", "ins", "in", "node", ".", "get_loc_wit...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
build_def_use
Builds the Def-Use and Use-Def (DU/UD) chains of the variables of the method.
androguard/decompiler/dad/dataflow.py
def build_def_use(graph, lparams): """ Builds the Def-Use and Use-Def (DU/UD) chains of the variables of the method. """ analysis = reach_def_analysis(graph, lparams) UD = defaultdict(list) for node in graph.rpo: for i, ins in node.get_loc_with_ins(): for var in ins.get_...
def build_def_use(graph, lparams): """ Builds the Def-Use and Use-Def (DU/UD) chains of the variables of the method. """ analysis = reach_def_analysis(graph, lparams) UD = defaultdict(list) for node in graph.rpo: for i, ins in node.get_loc_with_ins(): for var in ins.get_...
[ "Builds", "the", "Def", "-", "Use", "and", "Use", "-", "Def", "(", "DU", "/", "UD", ")", "chains", "of", "the", "variables", "of", "the", "method", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/dataflow.py#L421-L456
[ "def", "build_def_use", "(", "graph", ",", "lparams", ")", ":", "analysis", "=", "reach_def_analysis", "(", "graph", ",", "lparams", ")", "UD", "=", "defaultdict", "(", "list", ")", "for", "node", "in", "graph", ".", "rpo", ":", "for", "i", ",", "ins",...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
intervals
Compute the intervals of the graph Returns interval_graph: a graph of the intervals of G interv_heads: a dict of (header node, interval)
androguard/decompiler/dad/control_flow.py
def intervals(graph): """ Compute the intervals of the graph Returns interval_graph: a graph of the intervals of G interv_heads: a dict of (header node, interval) """ interval_graph = Graph() # graph of intervals heads = [graph.entry] # list of header nodes interv_heads = {} # int...
def intervals(graph): """ Compute the intervals of the graph Returns interval_graph: a graph of the intervals of G interv_heads: a dict of (header node, interval) """ interval_graph = Graph() # graph of intervals heads = [graph.entry] # list of header nodes interv_heads = {} # int...
[ "Compute", "the", "intervals", "of", "the", "graph", "Returns", "interval_graph", ":", "a", "graph", "of", "the", "intervals", "of", "G", "interv_heads", ":", "a", "dict", "of", "(", "header", "node", "interval", ")" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/control_flow.py#L29-L83
[ "def", "intervals", "(", "graph", ")", ":", "interval_graph", "=", "Graph", "(", ")", "# graph of intervals", "heads", "=", "[", "graph", ".", "entry", "]", "# list of header nodes", "interv_heads", "=", "{", "}", "# interv_heads[i] = interval of header i", "process...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
derived_sequence
Compute the derived sequence of the graph G The intervals of G are collapsed into nodes, intervals of these nodes are built, and the process is repeated iteratively until we obtain a single node (if the graph is not irreducible)
androguard/decompiler/dad/control_flow.py
def derived_sequence(graph): """ Compute the derived sequence of the graph G The intervals of G are collapsed into nodes, intervals of these nodes are built, and the process is repeated iteratively until we obtain a single node (if the graph is not irreducible) """ deriv_seq = [graph] de...
def derived_sequence(graph): """ Compute the derived sequence of the graph G The intervals of G are collapsed into nodes, intervals of these nodes are built, and the process is repeated iteratively until we obtain a single node (if the graph is not irreducible) """ deriv_seq = [graph] de...
[ "Compute", "the", "derived", "sequence", "of", "the", "graph", "G", "The", "intervals", "of", "G", "are", "collapsed", "into", "nodes", "intervals", "of", "these", "nodes", "are", "built", "and", "the", "process", "is", "repeated", "iteratively", "until", "w...
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/control_flow.py#L86-L109
[ "def", "derived_sequence", "(", "graph", ")", ":", "deriv_seq", "=", "[", "graph", "]", "deriv_interv", "=", "[", "]", "single_node", "=", "False", "while", "not", "single_node", ":", "interv_graph", ",", "interv_heads", "=", "intervals", "(", "graph", ")", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
DecompilerJADX.get_source_class
Return the Java source code of a whole class :param _class: `ClassDefItem` object, to get the source from :return:
androguard/decompiler/decompiler.py
def get_source_class(self, _class): """ Return the Java source code of a whole class :param _class: `ClassDefItem` object, to get the source from :return: """ if not _class.get_name() in self.classes: return "" return self.classes[_class.get_name()]
def get_source_class(self, _class): """ Return the Java source code of a whole class :param _class: `ClassDefItem` object, to get the source from :return: """ if not _class.get_name() in self.classes: return "" return self.classes[_class.get_name()]
[ "Return", "the", "Java", "source", "code", "of", "a", "whole", "class" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/decompiler.py#L767-L776
[ "def", "get_source_class", "(", "self", ",", "_class", ")", ":", "if", "not", "_class", ".", "get_name", "(", ")", "in", "self", ".", "classes", ":", "return", "\"\"", "return", "self", ".", "classes", "[", "_class", ".", "get_name", "(", ")", "]" ]
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
is_ascii_obfuscation
Tests if any class inside a DalvikVMObject uses ASCII Obfuscation (e.g. UTF-8 Chars in Classnames) :param vm: `DalvikVMObject` :return: True if ascii obfuscation otherwise False
androguard/core/analysis/analysis.py
def is_ascii_obfuscation(vm): """ Tests if any class inside a DalvikVMObject uses ASCII Obfuscation (e.g. UTF-8 Chars in Classnames) :param vm: `DalvikVMObject` :return: True if ascii obfuscation otherwise False """ for classe in vm.get_classes(): if is_ascii_problem(classe.get_name...
def is_ascii_obfuscation(vm): """ Tests if any class inside a DalvikVMObject uses ASCII Obfuscation (e.g. UTF-8 Chars in Classnames) :param vm: `DalvikVMObject` :return: True if ascii obfuscation otherwise False """ for classe in vm.get_classes(): if is_ascii_problem(classe.get_name...
[ "Tests", "if", "any", "class", "inside", "a", "DalvikVMObject", "uses", "ASCII", "Obfuscation", "(", "e", ".", "g", ".", "UTF", "-", "8", "Chars", "in", "Classnames", ")" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1743-L1757
[ "def", "is_ascii_obfuscation", "(", "vm", ")", ":", "for", "classe", "in", "vm", ".", "get_classes", "(", ")", ":", "if", "is_ascii_problem", "(", "classe", ".", "get_name", "(", ")", ")", ":", "return", "True", "for", "method", "in", "classe", ".", "g...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
MethodAnalysis.show
Prints the content of this method to stdout. This will print the method signature and the decompiled code.
androguard/core/analysis/analysis.py
def show(self): """ Prints the content of this method to stdout. This will print the method signature and the decompiled code. """ args, ret = self.method.get_descriptor()[1:].split(")") if self.code: # We patch the descriptor here and add the registers, if c...
def show(self): """ Prints the content of this method to stdout. This will print the method signature and the decompiled code. """ args, ret = self.method.get_descriptor()[1:].split(")") if self.code: # We patch the descriptor here and add the registers, if c...
[ "Prints", "the", "content", "of", "this", "method", "to", "stdout", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L439-L461
[ "def", "show", "(", "self", ")", ":", "args", ",", "ret", "=", "self", ".", "method", ".", "get_descriptor", "(", ")", "[", "1", ":", "]", ".", "split", "(", "\")\"", ")", "if", "self", ".", "code", ":", "# We patch the descriptor here and add the regist...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
MethodClassAnalysis.is_android_api
Returns True if the method seems to be an Android API method. This method might be not very precise unless an list of known API methods is given. :return: boolean
androguard/core/analysis/analysis.py
def is_android_api(self): """ Returns True if the method seems to be an Android API method. This method might be not very precise unless an list of known API methods is given. :return: boolean """ if not self.is_external(): # Method must be external ...
def is_android_api(self): """ Returns True if the method seems to be an Android API method. This method might be not very precise unless an list of known API methods is given. :return: boolean """ if not self.is_external(): # Method must be external ...
[ "Returns", "True", "if", "the", "method", "seems", "to", "be", "an", "Android", "API", "method", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L637-L663
[ "def", "is_android_api", "(", "self", ")", ":", "if", "not", "self", ".", "is_external", "(", ")", ":", "# Method must be external to be an API", "return", "False", "# Packages found at https://developer.android.com/reference/packages.html", "api_candidates", "=", "[", "\"L...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
ExternalClass.GetMethod
.. deprecated:: 3.1.0 Use :meth:`get_method` instead.
androguard/core/analysis/analysis.py
def GetMethod(self, name, descriptor): """ .. deprecated:: 3.1.0 Use :meth:`get_method` instead. """ warnings.warn("deprecated, use get_method instead. This function might be removed in a later release!", DeprecationWarning) return self.get_method(name, descriptor)
def GetMethod(self, name, descriptor): """ .. deprecated:: 3.1.0 Use :meth:`get_method` instead. """ warnings.warn("deprecated, use get_method instead. This function might be removed in a later release!", DeprecationWarning) return self.get_method(name, descriptor)
[ "..", "deprecated", "::", "3", ".", "1", ".", "0", "Use", ":", "meth", ":", "get_method", "instead", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L774-L781
[ "def", "GetMethod", "(", "self", ",", "name", ",", "descriptor", ")", ":", "warnings", ".", "warn", "(", "\"deprecated, use get_method instead. This function might be removed in a later release!\"", ",", "DeprecationWarning", ")", "return", "self", ".", "get_method", "(",...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
ExternalClass.get_method
Get the method by name and descriptor, or create a new one if the requested method does not exists. :param name: method name :param descriptor: method descriptor, for example `'(I)V'` :return: :class:`ExternalMethod`
androguard/core/analysis/analysis.py
def get_method(self, name, descriptor): """ Get the method by name and descriptor, or create a new one if the requested method does not exists. :param name: method name :param descriptor: method descriptor, for example `'(I)V'` :return: :class:`ExternalMethod` ""...
def get_method(self, name, descriptor): """ Get the method by name and descriptor, or create a new one if the requested method does not exists. :param name: method name :param descriptor: method descriptor, for example `'(I)V'` :return: :class:`ExternalMethod` ""...
[ "Get", "the", "method", "by", "name", "and", "descriptor", "or", "create", "a", "new", "one", "if", "the", "requested", "method", "does", "not", "exists", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L783-L796
[ "def", "get_method", "(", "self", ",", "name", ",", "descriptor", ")", ":", "key", "=", "name", "+", "str", "(", "descriptor", ")", "if", "key", "not", "in", "self", ".", "methods", ":", "self", ".", "methods", "[", "key", "]", "=", "ExternalMethod",...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
ClassAnalysis.is_android_api
Tries to guess if the current class is an Android API class. This might be not very precise unless an apilist is given, with classes that are in fact known APIs. Such a list might be generated by using the android.jar files. :return: boolean
androguard/core/analysis/analysis.py
def is_android_api(self): """ Tries to guess if the current class is an Android API class. This might be not very precise unless an apilist is given, with classes that are in fact known APIs. Such a list might be generated by using the android.jar files. :return: boolea...
def is_android_api(self): """ Tries to guess if the current class is an Android API class. This might be not very precise unless an apilist is given, with classes that are in fact known APIs. Such a list might be generated by using the android.jar files. :return: boolea...
[ "Tries", "to", "guess", "if", "the", "current", "class", "is", "an", "Android", "API", "class", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L916-L942
[ "def", "is_android_api", "(", "self", ")", ":", "# Packages found at https://developer.android.com/reference/packages.html", "api_candidates", "=", "[", "\"Landroid/\"", ",", "\"Lcom/android/internal/util\"", ",", "\"Ldalvik/\"", ",", "\"Ljava/\"", ",", "\"Ljavax/\"", ",", "\...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
ClassAnalysis.get_fake_method
Search for the given method name and descriptor and return a fake (ExternalMethod) if required. :param name: name of the method :param descriptor: descriptor of the method, for example `'(I I I)V'` :return: :class:`ExternalMethod`
androguard/core/analysis/analysis.py
def get_fake_method(self, name, descriptor): """ Search for the given method name and descriptor and return a fake (ExternalMethod) if required. :param name: name of the method :param descriptor: descriptor of the method, for example `'(I I I)V'` :return: :class:`Externa...
def get_fake_method(self, name, descriptor): """ Search for the given method name and descriptor and return a fake (ExternalMethod) if required. :param name: name of the method :param descriptor: descriptor of the method, for example `'(I I I)V'` :return: :class:`Externa...
[ "Search", "for", "the", "given", "method", "name", "and", "descriptor", "and", "return", "a", "fake", "(", "ExternalMethod", ")", "if", "required", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L974-L992
[ "def", "get_fake_method", "(", "self", ",", "name", ",", "descriptor", ")", ":", "if", "self", ".", "external", ":", "# An external class can only generate the methods on demand", "return", "self", ".", "orig_class", ".", "get_method", "(", "name", ",", "descriptor"...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
ClassAnalysis.AddFXrefRead
Add a Field Read to this class :param method: :param classobj: :param field: :return:
androguard/core/analysis/analysis.py
def AddFXrefRead(self, method, classobj, field): """ Add a Field Read to this class :param method: :param classobj: :param field: :return: """ if field not in self._fields: self._fields[field] = FieldClassAnalysis(field) self._fields[f...
def AddFXrefRead(self, method, classobj, field): """ Add a Field Read to this class :param method: :param classobj: :param field: :return: """ if field not in self._fields: self._fields[field] = FieldClassAnalysis(field) self._fields[f...
[ "Add", "a", "Field", "Read", "to", "this", "class" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L994-L1005
[ "def", "AddFXrefRead", "(", "self", ",", "method", ",", "classobj", ",", "field", ")", ":", "if", "field", "not", "in", "self", ".", "_fields", ":", "self", ".", "_fields", "[", "field", "]", "=", "FieldClassAnalysis", "(", "field", ")", "self", ".", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
ClassAnalysis.AddFXrefWrite
Add a Field Write to this class :param method: :param classobj: :param field: :return:
androguard/core/analysis/analysis.py
def AddFXrefWrite(self, method, classobj, field): """ Add a Field Write to this class :param method: :param classobj: :param field: :return: """ if field not in self._fields: self._fields[field] = FieldClassAnalysis(field) self._fields...
def AddFXrefWrite(self, method, classobj, field): """ Add a Field Write to this class :param method: :param classobj: :param field: :return: """ if field not in self._fields: self._fields[field] = FieldClassAnalysis(field) self._fields...
[ "Add", "a", "Field", "Write", "to", "this", "class" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1007-L1018
[ "def", "AddFXrefWrite", "(", "self", ",", "method", ",", "classobj", ",", "field", ")", ":", "if", "field", "not", "in", "self", ".", "_fields", ":", "self", ".", "_fields", "[", "field", "]", "=", "FieldClassAnalysis", "(", "field", ")", "self", ".", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
ClassAnalysis.AddXrefTo
Creates a crossreference to another class. XrefTo means, that the current class calls another class. The current class should also be contained in the another class' XrefFrom list. :param REF_TYPE ref_kind: type of call :param classobj: :class:`ClassAnalysis` object to link :par...
androguard/core/analysis/analysis.py
def AddXrefTo(self, ref_kind, classobj, methodobj, offset): """ Creates a crossreference to another class. XrefTo means, that the current class calls another class. The current class should also be contained in the another class' XrefFrom list. :param REF_TYPE ref_kind: type of ...
def AddXrefTo(self, ref_kind, classobj, methodobj, offset): """ Creates a crossreference to another class. XrefTo means, that the current class calls another class. The current class should also be contained in the another class' XrefFrom list. :param REF_TYPE ref_kind: type of ...
[ "Creates", "a", "crossreference", "to", "another", "class", ".", "XrefTo", "means", "that", "the", "current", "class", "calls", "another", "class", ".", "The", "current", "class", "should", "also", "be", "contained", "in", "the", "another", "class", "XrefFrom"...
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1030-L1042
[ "def", "AddXrefTo", "(", "self", ",", "ref_kind", ",", "classobj", ",", "methodobj", ",", "offset", ")", ":", "self", ".", "xrefto", "[", "classobj", "]", ".", "add", "(", "(", "ref_kind", ",", "methodobj", ",", "offset", ")", ")" ]
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
ClassAnalysis.AddXrefFrom
Creates a crossreference from this class. XrefFrom means, that the current class is called by another class. :param REF_TYPE ref_kind: type of call :param classobj: :class:`ClassAnalysis` object to link :param methodobj: :param offset: Offset in the methods bytecode, where the c...
androguard/core/analysis/analysis.py
def AddXrefFrom(self, ref_kind, classobj, methodobj, offset): """ Creates a crossreference from this class. XrefFrom means, that the current class is called by another class. :param REF_TYPE ref_kind: type of call :param classobj: :class:`ClassAnalysis` object to link :p...
def AddXrefFrom(self, ref_kind, classobj, methodobj, offset): """ Creates a crossreference from this class. XrefFrom means, that the current class is called by another class. :param REF_TYPE ref_kind: type of call :param classobj: :class:`ClassAnalysis` object to link :p...
[ "Creates", "a", "crossreference", "from", "this", "class", ".", "XrefFrom", "means", "that", "the", "current", "class", "is", "called", "by", "another", "class", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1044-L1055
[ "def", "AddXrefFrom", "(", "self", ",", "ref_kind", ",", "classobj", ",", "methodobj", ",", "offset", ")", ":", "self", ".", "xreffrom", "[", "classobj", "]", ".", "add", "(", "(", "ref_kind", ",", "methodobj", ",", "offset", ")", ")" ]
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.add
Add a DalvikVMFormat to this Analysis :param vm: :class:`dvm.DalvikVMFormat` to add to this Analysis
androguard/core/analysis/analysis.py
def add(self, vm): """ Add a DalvikVMFormat to this Analysis :param vm: :class:`dvm.DalvikVMFormat` to add to this Analysis """ self.vms.append(vm) for current_class in vm.get_classes(): self.classes[current_class.get_name()] = ClassAnalysis(current_class) ...
def add(self, vm): """ Add a DalvikVMFormat to this Analysis :param vm: :class:`dvm.DalvikVMFormat` to add to this Analysis """ self.vms.append(vm) for current_class in vm.get_classes(): self.classes[current_class.get_name()] = ClassAnalysis(current_class) ...
[ "Add", "a", "DalvikVMFormat", "to", "this", "Analysis" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1168-L1179
[ "def", "add", "(", "self", ",", "vm", ")", ":", "self", ".", "vms", ".", "append", "(", "vm", ")", "for", "current_class", "in", "vm", ".", "get_classes", "(", ")", ":", "self", ".", "classes", "[", "current_class", ".", "get_name", "(", ")", "]", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.create_xref
Create Class, Method, String and Field crossreferences for all classes in the Analysis. If you are using multiple DEX files, this function must be called when all DEX files are added. If you call the function after every DEX file, the crossreferences might be wrong!
androguard/core/analysis/analysis.py
def create_xref(self): """ Create Class, Method, String and Field crossreferences for all classes in the Analysis. If you are using multiple DEX files, this function must be called when all DEX files are added. If you call the function after every DEX file, the c...
def create_xref(self): """ Create Class, Method, String and Field crossreferences for all classes in the Analysis. If you are using multiple DEX files, this function must be called when all DEX files are added. If you call the function after every DEX file, the c...
[ "Create", "Class", "Method", "String", "and", "Field", "crossreferences", "for", "all", "classes", "in", "the", "Analysis", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1190-L1211
[ "def", "create_xref", "(", "self", ")", ":", "log", ".", "debug", "(", "\"Creating Crossreferences (XREF)\"", ")", "tic", "=", "time", ".", "time", "(", ")", "# TODO on concurrent runs, we probably need to clean up first,", "# or check that we do not write garbage.", "# TOD...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis._create_xref
Create the xref for `current_class` There are four steps involved in getting the xrefs: * Xrefs for classes * for method calls * for string usage * for field manipulation All these information are stored in the *Analysis Objects. Note that thi...
androguard/core/analysis/analysis.py
def _create_xref(self, current_class): """ Create the xref for `current_class` There are four steps involved in getting the xrefs: * Xrefs for classes * for method calls * for string usage * for field manipulation All these information ...
def _create_xref(self, current_class): """ Create the xref for `current_class` There are four steps involved in getting the xrefs: * Xrefs for classes * for method calls * for string usage * for field manipulation All these information ...
[ "Create", "the", "xref", "for", "current_class" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1213-L1318
[ "def", "_create_xref", "(", "self", ",", "current_class", ")", ":", "cur_cls_name", "=", "current_class", ".", "get_name", "(", ")", "log", ".", "debug", "(", "\"Creating XREF/DREF for %s\"", "%", "cur_cls_name", ")", "for", "current_method", "in", "current_class"...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.get_method_by_name
Search for a :class:`EncodedMethod` in all classes in this analysis :param class_name: name of the class, for example 'Ljava/lang/Object;' :param method_name: name of the method, for example 'onCreate' :param method_descriptor: descriptor, for example '(I I Ljava/lang/String)V :return: ...
androguard/core/analysis/analysis.py
def get_method_by_name(self, class_name, method_name, method_descriptor): """ Search for a :class:`EncodedMethod` in all classes in this analysis :param class_name: name of the class, for example 'Ljava/lang/Object;' :param method_name: name of the method, for example 'onCreate' ...
def get_method_by_name(self, class_name, method_name, method_descriptor): """ Search for a :class:`EncodedMethod` in all classes in this analysis :param class_name: name of the class, for example 'Ljava/lang/Object;' :param method_name: name of the method, for example 'onCreate' ...
[ "Search", "for", "a", ":", "class", ":", "EncodedMethod", "in", "all", "classes", "in", "this", "analysis" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1333-L1346
[ "def", "get_method_by_name", "(", "self", ",", "class_name", ",", "method_name", ",", "method_descriptor", ")", ":", "if", "class_name", "in", "self", ".", "classes", ":", "for", "method", "in", "self", ".", "classes", "[", "class_name", "]", ".", "get_vm_cl...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.get_method_analysis
Returns the crossreferencing object for a given Method. Beware: the similar named function :meth:`~get_method()` will return a :class:`MethodAnalysis` object, while this function returns a :class:`MethodClassAnalysis` object! This Method will only work after a run of :meth:`~create_xref()` ...
androguard/core/analysis/analysis.py
def get_method_analysis(self, method): """ Returns the crossreferencing object for a given Method. Beware: the similar named function :meth:`~get_method()` will return a :class:`MethodAnalysis` object, while this function returns a :class:`MethodClassAnalysis` object! This Meth...
def get_method_analysis(self, method): """ Returns the crossreferencing object for a given Method. Beware: the similar named function :meth:`~get_method()` will return a :class:`MethodAnalysis` object, while this function returns a :class:`MethodClassAnalysis` object! This Meth...
[ "Returns", "the", "crossreferencing", "object", "for", "a", "given", "Method", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1348-L1363
[ "def", "get_method_analysis", "(", "self", ",", "method", ")", ":", "class_analysis", "=", "self", ".", "get_class_analysis", "(", "method", ".", "get_class_name", "(", ")", ")", "if", "class_analysis", ":", "return", "class_analysis", ".", "get_method_analysis", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.get_method_analysis_by_name
Returns the crossreferencing object for a given method. This function is similar to :meth:`~get_method_analysis`, with the difference that you can look up the Method by name :param class_name: name of the class, for example `'Ljava/lang/Object;'` :param method_name: name of the method,...
androguard/core/analysis/analysis.py
def get_method_analysis_by_name(self, class_name, method_name, method_descriptor): """ Returns the crossreferencing object for a given method. This function is similar to :meth:`~get_method_analysis`, with the difference that you can look up the Method by name :param class_name...
def get_method_analysis_by_name(self, class_name, method_name, method_descriptor): """ Returns the crossreferencing object for a given method. This function is similar to :meth:`~get_method_analysis`, with the difference that you can look up the Method by name :param class_name...
[ "Returns", "the", "crossreferencing", "object", "for", "a", "given", "method", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1365-L1380
[ "def", "get_method_analysis_by_name", "(", "self", ",", "class_name", ",", "method_name", ",", "method_descriptor", ")", ":", "method", "=", "self", ".", "get_method_by_name", "(", "class_name", ",", "method_name", ",", "method_descriptor", ")", "if", "method", ":...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.get_field_analysis
Get the FieldAnalysis for a given fieldname :param field: TODO :return: :class:`FieldClassAnalysis`
androguard/core/analysis/analysis.py
def get_field_analysis(self, field): """ Get the FieldAnalysis for a given fieldname :param field: TODO :return: :class:`FieldClassAnalysis` """ class_analysis = self.get_class_analysis(field.get_class_name()) if class_analysis: return class_analysis....
def get_field_analysis(self, field): """ Get the FieldAnalysis for a given fieldname :param field: TODO :return: :class:`FieldClassAnalysis` """ class_analysis = self.get_class_analysis(field.get_class_name()) if class_analysis: return class_analysis....
[ "Get", "the", "FieldAnalysis", "for", "a", "given", "fieldname" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1382-L1392
[ "def", "get_field_analysis", "(", "self", ",", "field", ")", ":", "class_analysis", "=", "self", ".", "get_class_analysis", "(", "field", ".", "get_class_name", "(", ")", ")", "if", "class_analysis", ":", "return", "class_analysis", ".", "get_field_analysis", "(...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.get_methods
Returns a list of `MethodClassAnalysis` objects
androguard/core/analysis/analysis.py
def get_methods(self): """ Returns a list of `MethodClassAnalysis` objects """ for c in self.classes.values(): for m in c.get_methods(): yield m
def get_methods(self): """ Returns a list of `MethodClassAnalysis` objects """ for c in self.classes.values(): for m in c.get_methods(): yield m
[ "Returns", "a", "list", "of", "MethodClassAnalysis", "objects" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1460-L1467
[ "def", "get_methods", "(", "self", ")", ":", "for", "c", "in", "self", ".", "classes", ".", "values", "(", ")", ":", "for", "m", "in", "c", ".", "get_methods", "(", ")", ":", "yield", "m" ]
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.get_fields
Returns a list of `FieldClassAnalysis` objects
androguard/core/analysis/analysis.py
def get_fields(self): """ Returns a list of `FieldClassAnalysis` objects """ for c in self.classes.values(): for f in c.get_fields(): yield f
def get_fields(self): """ Returns a list of `FieldClassAnalysis` objects """ for c in self.classes.values(): for f in c.get_fields(): yield f
[ "Returns", "a", "list", "of", "FieldClassAnalysis", "objects" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1469-L1476
[ "def", "get_fields", "(", "self", ")", ":", "for", "c", "in", "self", ".", "classes", ".", "values", "(", ")", ":", "for", "f", "in", "c", ".", "get_fields", "(", ")", ":", "yield", "f" ]
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.find_classes
Find classes by name, using regular expression This method will return all ClassAnalysis Object that match the name of the class. :param name: regular expression for class name (default ".*") :param no_external: Remove external classes from the output (default False) :rtype: gen...
androguard/core/analysis/analysis.py
def find_classes(self, name=".*", no_external=False): """ Find classes by name, using regular expression This method will return all ClassAnalysis Object that match the name of the class. :param name: regular expression for class name (default ".*") :param no_external: R...
def find_classes(self, name=".*", no_external=False): """ Find classes by name, using regular expression This method will return all ClassAnalysis Object that match the name of the class. :param name: regular expression for class name (default ".*") :param no_external: R...
[ "Find", "classes", "by", "name", "using", "regular", "expression", "This", "method", "will", "return", "all", "ClassAnalysis", "Object", "that", "match", "the", "name", "of", "the", "class", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1478-L1492
[ "def", "find_classes", "(", "self", ",", "name", "=", "\".*\"", ",", "no_external", "=", "False", ")", ":", "for", "cname", ",", "c", "in", "self", ".", "classes", ".", "items", "(", ")", ":", "if", "no_external", "and", "isinstance", "(", "c", ".", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.find_methods
Find a method by name using regular expression. This method will return all MethodClassAnalysis objects, which match the classname, methodname, descriptor and accessflags of the method. :param classname: regular expression for the classname :param methodname: regular expression for the ...
androguard/core/analysis/analysis.py
def find_methods(self, classname=".*", methodname=".*", descriptor=".*", accessflags=".*", no_external=False): """ Find a method by name using regular expression. This method will return all MethodClassAnalysis objects, which match the classname, methodname, descriptor and ac...
def find_methods(self, classname=".*", methodname=".*", descriptor=".*", accessflags=".*", no_external=False): """ Find a method by name using regular expression. This method will return all MethodClassAnalysis objects, which match the classname, methodname, descriptor and ac...
[ "Find", "a", "method", "by", "name", "using", "regular", "expression", ".", "This", "method", "will", "return", "all", "MethodClassAnalysis", "objects", "which", "match", "the", "classname", "methodname", "descriptor", "and", "accessflags", "of", "the", "method", ...
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1494-L1520
[ "def", "find_methods", "(", "self", ",", "classname", "=", "\".*\"", ",", "methodname", "=", "\".*\"", ",", "descriptor", "=", "\".*\"", ",", "accessflags", "=", "\".*\"", ",", "no_external", "=", "False", ")", ":", "for", "cname", ",", "c", "in", "self"...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.find_strings
Find strings by regex :param string: regular expression for the string to search for :rtype: generator of `StringAnalysis`
androguard/core/analysis/analysis.py
def find_strings(self, string=".*"): """ Find strings by regex :param string: regular expression for the string to search for :rtype: generator of `StringAnalysis` """ for s, sa in self.strings.items(): if re.match(string, s): yield sa
def find_strings(self, string=".*"): """ Find strings by regex :param string: regular expression for the string to search for :rtype: generator of `StringAnalysis` """ for s, sa in self.strings.items(): if re.match(string, s): yield sa
[ "Find", "strings", "by", "regex" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1522-L1531
[ "def", "find_strings", "(", "self", ",", "string", "=", "\".*\"", ")", ":", "for", "s", ",", "sa", "in", "self", ".", "strings", ".", "items", "(", ")", ":", "if", "re", ".", "match", "(", "string", ",", "s", ")", ":", "yield", "sa" ]
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.find_fields
find fields by regex :param classname: regular expression of the classname :param fieldname: regular expression of the fieldname :param fieldtype: regular expression of the fieldtype :param accessflags: regular expression of the access flags :rtype: generator of `FieldClassAnaly...
androguard/core/analysis/analysis.py
def find_fields(self, classname=".*", fieldname=".*", fieldtype=".*", accessflags=".*"): """ find fields by regex :param classname: regular expression of the classname :param fieldname: regular expression of the fieldname :param fieldtype: regular expression of the fieldtype ...
def find_fields(self, classname=".*", fieldname=".*", fieldtype=".*", accessflags=".*"): """ find fields by regex :param classname: regular expression of the classname :param fieldname: regular expression of the fieldname :param fieldtype: regular expression of the fieldtype ...
[ "find", "fields", "by", "regex" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1533-L1550
[ "def", "find_fields", "(", "self", ",", "classname", "=", "\".*\"", ",", "fieldname", "=", "\".*\"", ",", "fieldtype", "=", "\".*\"", ",", "accessflags", "=", "\".*\"", ")", ":", "for", "cname", ",", "c", "in", "self", ".", "classes", ".", "items", "("...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.get_call_graph
Generate a directed graph based on the methods found by the filters applied. The filters are the same as in :meth:`~androguard.core.analaysis.analaysis.Analysis.find_methods` A networkx.DiGraph is returned, containing all edges only once! that means, if a method calls some method twice ...
androguard/core/analysis/analysis.py
def get_call_graph(self, classname=".*", methodname=".*", descriptor=".*", accessflags=".*", no_isolated=False, entry_points=[]): """ Generate a directed graph based on the methods found by the filters applied. The filters are the same as in :meth:`~androguard.core...
def get_call_graph(self, classname=".*", methodname=".*", descriptor=".*", accessflags=".*", no_isolated=False, entry_points=[]): """ Generate a directed graph based on the methods found by the filters applied. The filters are the same as in :meth:`~androguard.core...
[ "Generate", "a", "directed", "graph", "based", "on", "the", "methods", "found", "by", "the", "filters", "applied", ".", "The", "filters", "are", "the", "same", "as", "in", ":", "meth", ":", "~androguard", ".", "core", ".", "analaysis", ".", "analaysis", ...
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1555-L1613
[ "def", "get_call_graph", "(", "self", ",", "classname", "=", "\".*\"", ",", "methodname", "=", "\".*\"", ",", "descriptor", "=", "\".*\"", ",", "accessflags", "=", "\".*\"", ",", "no_isolated", "=", "False", ",", "entry_points", "=", "[", "]", ")", ":", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.create_ipython_exports
.. warning:: this feature is experimental and is currently not enabled by default! Use with caution! Creates attributes for all classes, methods and fields on the Analysis object itself. This makes it easier to work with Analysis module in an iPython shell. Classes can be search by typing :cod...
androguard/core/analysis/analysis.py
def create_ipython_exports(self): """ .. warning:: this feature is experimental and is currently not enabled by default! Use with caution! Creates attributes for all classes, methods and fields on the Analysis object itself. This makes it easier to work with Analysis module in an iPytho...
def create_ipython_exports(self): """ .. warning:: this feature is experimental and is currently not enabled by default! Use with caution! Creates attributes for all classes, methods and fields on the Analysis object itself. This makes it easier to work with Analysis module in an iPytho...
[ "..", "warning", "::", "this", "feature", "is", "experimental", "and", "is", "currently", "not", "enabled", "by", "default!", "Use", "with", "caution!" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1615-L1656
[ "def", "create_ipython_exports", "(", "self", ")", ":", "# TODO: it would be fun to have the classes organized like the packages. I.e. you could do dx.CLASS_xx.yyy.zzz", "for", "cls", "in", "self", ".", "get_classes", "(", ")", ":", "name", "=", "\"CLASS_\"", "+", "bytecode",...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.get_permissions
Returns the permissions and the API method based on the API level specified. This can be used to find usage of API methods which require a permission. Should be used in combination with an :class:`~androguard.core.bytecodes.apk.APK`. The returned permissions are a list, as some API methods requ...
androguard/core/analysis/analysis.py
def get_permissions(self, apilevel=None): """ Returns the permissions and the API method based on the API level specified. This can be used to find usage of API methods which require a permission. Should be used in combination with an :class:`~androguard.core.bytecodes.apk.APK`. ...
def get_permissions(self, apilevel=None): """ Returns the permissions and the API method based on the API level specified. This can be used to find usage of API methods which require a permission. Should be used in combination with an :class:`~androguard.core.bytecodes.apk.APK`. ...
[ "Returns", "the", "permissions", "and", "the", "API", "method", "based", "on", "the", "API", "level", "specified", ".", "This", "can", "be", "used", "to", "find", "usage", "of", "API", "methods", "which", "require", "a", "permission", ".", "Should", "be", ...
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1658-L1701
[ "def", "get_permissions", "(", "self", ",", "apilevel", "=", "None", ")", ":", "# TODO maybe have the API level loading in the __init__ method and pass the APK as well?", "permmap", "=", "load_api_specific_resource_module", "(", "'api_permission_mappings'", ",", "apilevel", ")", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Analysis.get_permission_usage
Find the usage of a permission inside the Analysis. example:: from androguard.misc import AnalyzeAPK a, d, dx = AnalyzeAPK("somefile.apk") for meth in dx.get_permission_usage('android.permission.SEND_SMS', a.get_effective_target_sdk_version()): print("Using ...
androguard/core/analysis/analysis.py
def get_permission_usage(self, permission, apilevel=None): """ Find the usage of a permission inside the Analysis. example:: from androguard.misc import AnalyzeAPK a, d, dx = AnalyzeAPK("somefile.apk") for meth in dx.get_permission_usage('android.permission....
def get_permission_usage(self, permission, apilevel=None): """ Find the usage of a permission inside the Analysis. example:: from androguard.misc import AnalyzeAPK a, d, dx = AnalyzeAPK("somefile.apk") for meth in dx.get_permission_usage('android.permission....
[ "Find", "the", "usage", "of", "a", "permission", "inside", "the", "Analysis", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/analysis/analysis.py#L1703-L1740
[ "def", "get_permission_usage", "(", "self", ",", "permission", ",", "apilevel", "=", "None", ")", ":", "# TODO maybe have the API level loading in the __init__ method and pass the APK as well?", "permmap", "=", "load_api_specific_resource_module", "(", "'api_permission_mappings'", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Save
save your session to use it later. Returns the filename of the written file. If not filename is given, a file named `androguard_session_<DATE>.ag` will be created in the current working directory. `<DATE>` is a timestamp with the following format: `%Y-%m-%d_%H%M%S`. This function will overwrite ex...
androguard/session.py
def Save(session, filename=None): """ save your session to use it later. Returns the filename of the written file. If not filename is given, a file named `androguard_session_<DATE>.ag` will be created in the current working directory. `<DATE>` is a timestamp with the following format: `%Y-%m-%d...
def Save(session, filename=None): """ save your session to use it later. Returns the filename of the written file. If not filename is given, a file named `androguard_session_<DATE>.ag` will be created in the current working directory. `<DATE>` is a timestamp with the following format: `%Y-%m-%d...
[ "save", "your", "session", "to", "use", "it", "later", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/session.py#L18-L69
[ "def", "Save", "(", "session", ",", "filename", "=", "None", ")", ":", "if", "not", "filename", ":", "filename", "=", "\"androguard_session_{:%Y-%m-%d_%H%M%S}.ag\"", ".", "format", "(", "datetime", ".", "datetime", ".", "now", "(", ")", ")", "if", "os", "....
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Session.show
Print information to stdout about the current session. Gets all APKs, all DEX files and all Analysis objects.
androguard/session.py
def show(self): """ Print information to stdout about the current session. Gets all APKs, all DEX files and all Analysis objects. """ print("APKs in Session: {}".format(len(self.analyzed_apk))) for d, a in self.analyzed_apk.items(): print("\t{}: {}".format(d, ...
def show(self): """ Print information to stdout about the current session. Gets all APKs, all DEX files and all Analysis objects. """ print("APKs in Session: {}".format(len(self.analyzed_apk))) for d, a in self.analyzed_apk.items(): print("\t{}: {}".format(d, ...
[ "Print", "information", "to", "stdout", "about", "the", "current", "session", ".", "Gets", "all", "APKs", "all", "DEX", "files", "and", "all", "Analysis", "objects", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/session.py#L166-L181
[ "def", "show", "(", "self", ")", ":", "print", "(", "\"APKs in Session: {}\"", ".", "format", "(", "len", "(", "self", ".", "analyzed_apk", ")", ")", ")", "for", "d", ",", "a", "in", "self", ".", "analyzed_apk", ".", "items", "(", ")", ":", "print", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Session.addAPK
Add an APK file to the Session and run analysis on it. :param filename: (file)name of APK file :param data: binary data of the APK file :return: a tuple of SHA256 Checksum and APK Object
androguard/session.py
def addAPK(self, filename, data): """ Add an APK file to the Session and run analysis on it. :param filename: (file)name of APK file :param data: binary data of the APK file :return: a tuple of SHA256 Checksum and APK Object """ digest = hashlib.sha256(data).hexd...
def addAPK(self, filename, data): """ Add an APK file to the Session and run analysis on it. :param filename: (file)name of APK file :param data: binary data of the APK file :return: a tuple of SHA256 Checksum and APK Object """ digest = hashlib.sha256(data).hexd...
[ "Add", "an", "APK", "file", "to", "the", "Session", "and", "run", "analysis", "on", "it", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/session.py#L183-L206
[ "def", "addAPK", "(", "self", ",", "filename", ",", "data", ")", ":", "digest", "=", "hashlib", ".", "sha256", "(", "data", ")", ".", "hexdigest", "(", ")", "log", ".", "debug", "(", "\"add APK:%s\"", "%", "digest", ")", "apk", "=", "APK", "(", "da...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Session.addDEX
Add a DEX file to the Session and run analysis. :param filename: the (file)name of the DEX file :param data: binary data of the dex file :param dx: an existing Analysis Object (optional) :return: A tuple of SHA256 Hash, DalvikVMFormat Object and Analysis object
androguard/session.py
def addDEX(self, filename, data, dx=None): """ Add a DEX file to the Session and run analysis. :param filename: the (file)name of the DEX file :param data: binary data of the dex file :param dx: an existing Analysis Object (optional) :return: A tuple of SHA256 Hash, Dalv...
def addDEX(self, filename, data, dx=None): """ Add a DEX file to the Session and run analysis. :param filename: the (file)name of the DEX file :param data: binary data of the dex file :param dx: an existing Analysis Object (optional) :return: A tuple of SHA256 Hash, Dalv...
[ "Add", "a", "DEX", "file", "to", "the", "Session", "and", "run", "analysis", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/session.py#L208-L246
[ "def", "addDEX", "(", "self", ",", "filename", ",", "data", ",", "dx", "=", "None", ")", ":", "digest", "=", "hashlib", ".", "sha256", "(", "data", ")", ".", "hexdigest", "(", ")", "log", ".", "debug", "(", "\"add DEX:%s\"", "%", "digest", ")", "lo...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Session.add
Generic method to add a file to the session. This is the main method to use when adding files to a Session! If an APK file is supplied, all DEX files are analyzed too. For DEX and ODEX files, only this file is analyzed (what else should be analyzed). Returns the SHA256 of the ...
androguard/session.py
def add(self, filename, raw_data=None, dx=None): """ Generic method to add a file to the session. This is the main method to use when adding files to a Session! If an APK file is supplied, all DEX files are analyzed too. For DEX and ODEX files, only this file is analyzed (what ...
def add(self, filename, raw_data=None, dx=None): """ Generic method to add a file to the session. This is the main method to use when adding files to a Session! If an APK file is supplied, all DEX files are analyzed too. For DEX and ODEX files, only this file is analyzed (what ...
[ "Generic", "method", "to", "add", "a", "file", "to", "the", "session", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/session.py#L280-L316
[ "def", "add", "(", "self", ",", "filename", ",", "raw_data", "=", "None", ",", "dx", "=", "None", ")", ":", "if", "not", "raw_data", ":", "log", ".", "debug", "(", "\"Loading file from '{}'\"", ".", "format", "(", "filename", ")", ")", "with", "open", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Session.get_classes
Returns all Java Classes from the DEX objects as an array of DEX files.
androguard/session.py
def get_classes(self): """ Returns all Java Classes from the DEX objects as an array of DEX files. """ for idx, digest in enumerate(self.analyzed_vms): dx = self.analyzed_vms[digest] for vm in dx.vms: filename = self.analyzed_digest[digest] ...
def get_classes(self): """ Returns all Java Classes from the DEX objects as an array of DEX files. """ for idx, digest in enumerate(self.analyzed_vms): dx = self.analyzed_vms[digest] for vm in dx.vms: filename = self.analyzed_digest[digest] ...
[ "Returns", "all", "Java", "Classes", "from", "the", "DEX", "objects", "as", "an", "array", "of", "DEX", "files", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/session.py#L318-L326
[ "def", "get_classes", "(", "self", ")", ":", "for", "idx", ",", "digest", "in", "enumerate", "(", "self", ".", "analyzed_vms", ")", ":", "dx", "=", "self", ".", "analyzed_vms", "[", "digest", "]", "for", "vm", "in", "dx", ".", "vms", ":", "filename",...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Session.get_analysis
Returns the :class:`~androguard.core.analysis.analysis.Analysis` object which contains the `current_class`. :param current_class: The class to search for :type current_class: androguard.core.bytecodes.dvm.ClassDefItem :rtype: androguard.core.analysis.analysis.Analysis
androguard/session.py
def get_analysis(self, current_class): """ Returns the :class:`~androguard.core.analysis.analysis.Analysis` object which contains the `current_class`. :param current_class: The class to search for :type current_class: androguard.core.bytecodes.dvm.ClassDefItem :rtype: an...
def get_analysis(self, current_class): """ Returns the :class:`~androguard.core.analysis.analysis.Analysis` object which contains the `current_class`. :param current_class: The class to search for :type current_class: androguard.core.bytecodes.dvm.ClassDefItem :rtype: an...
[ "Returns", "the", ":", "class", ":", "~androguard", ".", "core", ".", "analysis", ".", "analysis", ".", "Analysis", "object", "which", "contains", "the", "current_class", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/session.py#L328-L341
[ "def", "get_analysis", "(", "self", ",", "current_class", ")", ":", "for", "digest", "in", "self", ".", "analyzed_vms", ":", "dx", "=", "self", ".", "analyzed_vms", "[", "digest", "]", "if", "dx", ".", "is_class_present", "(", "current_class", ".", "get_na...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Session.get_filename_by_class
Returns the filename of the DEX file where the class is in. Returns the first filename this class was present. For example, if you analyzed an APK, this should return the filename of the APK and not of the DEX file. :param current_class: ClassDefItem :returns: None if class was...
androguard/session.py
def get_filename_by_class(self, current_class): """ Returns the filename of the DEX file where the class is in. Returns the first filename this class was present. For example, if you analyzed an APK, this should return the filename of the APK and not of the DEX file. :p...
def get_filename_by_class(self, current_class): """ Returns the filename of the DEX file where the class is in. Returns the first filename this class was present. For example, if you analyzed an APK, this should return the filename of the APK and not of the DEX file. :p...
[ "Returns", "the", "filename", "of", "the", "DEX", "file", "where", "the", "class", "is", "in", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/session.py#L352-L366
[ "def", "get_filename_by_class", "(", "self", ",", "current_class", ")", ":", "for", "digest", ",", "dx", "in", "self", ".", "analyzed_vms", ".", "items", "(", ")", ":", "if", "dx", ".", "is_class_present", "(", "current_class", ".", "get_name", "(", ")", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Session.get_digest_by_class
Return the SHA256 hash of the object containing the ClassDefItem Returns the first digest this class was present. For example, if you analyzed an APK, this should return the digest of the APK and not of the DEX file.
androguard/session.py
def get_digest_by_class(self, current_class): """ Return the SHA256 hash of the object containing the ClassDefItem Returns the first digest this class was present. For example, if you analyzed an APK, this should return the digest of the APK and not of the DEX file. """ ...
def get_digest_by_class(self, current_class): """ Return the SHA256 hash of the object containing the ClassDefItem Returns the first digest this class was present. For example, if you analyzed an APK, this should return the digest of the APK and not of the DEX file. """ ...
[ "Return", "the", "SHA256", "hash", "of", "the", "object", "containing", "the", "ClassDefItem" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/session.py#L368-L379
[ "def", "get_digest_by_class", "(", "self", ",", "current_class", ")", ":", "for", "digest", ",", "dx", "in", "self", ".", "analyzed_vms", ".", "items", "(", ")", ":", "if", "dx", ".", "is_class_present", "(", "current_class", ".", "get_name", "(", ")", "...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Session.get_strings
Yields all StringAnalysis for all unique Analysis objects
androguard/session.py
def get_strings(self): """ Yields all StringAnalysis for all unique Analysis objects """ seen = [] for digest, dx in self.analyzed_vms.items(): if dx in seen: continue seen.append(dx) yield digest, self.analyzed_digest[digest], ...
def get_strings(self): """ Yields all StringAnalysis for all unique Analysis objects """ seen = [] for digest, dx in self.analyzed_vms.items(): if dx in seen: continue seen.append(dx) yield digest, self.analyzed_digest[digest], ...
[ "Yields", "all", "StringAnalysis", "for", "all", "unique", "Analysis", "objects" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/session.py#L381-L390
[ "def", "get_strings", "(", "self", ")", ":", "seen", "=", "[", "]", "for", "digest", ",", "dx", "in", "self", ".", "analyzed_vms", ".", "items", "(", ")", ":", "if", "dx", "in", "seen", ":", "continue", "seen", ".", "append", "(", "dx", ")", "yie...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Session.get_nb_strings
Return the total number of strings in all Analysis objects
androguard/session.py
def get_nb_strings(self): """ Return the total number of strings in all Analysis objects """ nb = 0 seen = [] for digest, dx in self.analyzed_vms.items(): if dx in seen: continue seen.append(dx) nb += len(dx.get_strings_...
def get_nb_strings(self): """ Return the total number of strings in all Analysis objects """ nb = 0 seen = [] for digest, dx in self.analyzed_vms.items(): if dx in seen: continue seen.append(dx) nb += len(dx.get_strings_...
[ "Return", "the", "total", "number", "of", "strings", "in", "all", "Analysis", "objects" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/session.py#L392-L403
[ "def", "get_nb_strings", "(", "self", ")", ":", "nb", "=", "0", "seen", "=", "[", "]", "for", "digest", ",", "dx", "in", "self", ".", "analyzed_vms", ".", "items", "(", ")", ":", "if", "dx", "in", "seen", ":", "continue", "seen", ".", "append", "...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Session.get_objects_apk
Returns APK, DalvikVMFormat and Analysis of a specified APK. You must specify either `filename` or `digest`. It is possible to use both, but in this case only `digest` is used. example:: s = Session() digest = s.add("some.apk") a, d, dx = s.get_objects_apk(...
androguard/session.py
def get_objects_apk(self, filename=None, digest=None): """ Returns APK, DalvikVMFormat and Analysis of a specified APK. You must specify either `filename` or `digest`. It is possible to use both, but in this case only `digest` is used. example:: s = Session() ...
def get_objects_apk(self, filename=None, digest=None): """ Returns APK, DalvikVMFormat and Analysis of a specified APK. You must specify either `filename` or `digest`. It is possible to use both, but in this case only `digest` is used. example:: s = Session() ...
[ "Returns", "APK", "DalvikVMFormat", "and", "Analysis", "of", "a", "specified", "APK", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/session.py#L413-L449
[ "def", "get_objects_apk", "(", "self", ",", "filename", "=", "None", ",", "digest", "=", "None", ")", ":", "if", "not", "filename", "and", "not", "digest", ":", "raise", "ValueError", "(", "\"Must give at least filename or digest!\"", ")", "if", "digest", "is"...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
Session.get_objects_dex
Yields all dex objects inclduing their Analysis objects :returns: tuple of (sha256, DalvikVMFormat, Analysis)
androguard/session.py
def get_objects_dex(self): """ Yields all dex objects inclduing their Analysis objects :returns: tuple of (sha256, DalvikVMFormat, Analysis) """ # TODO: there is no variant like get_objects_apk for digest, d in self.analyzed_dex.items(): yield digest, d, self...
def get_objects_dex(self): """ Yields all dex objects inclduing their Analysis objects :returns: tuple of (sha256, DalvikVMFormat, Analysis) """ # TODO: there is no variant like get_objects_apk for digest, d in self.analyzed_dex.items(): yield digest, d, self...
[ "Yields", "all", "dex", "objects", "inclduing", "their", "Analysis", "objects" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/session.py#L451-L459
[ "def", "get_objects_dex", "(", "self", ")", ":", "# TODO: there is no variant like get_objects_apk", "for", "digest", ",", "d", "in", "self", ".", "analyzed_dex", ".", "items", "(", ")", ":", "yield", "digest", ",", "d", ",", "self", ".", "analyzed_vms", "[", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
TreeWindow.fill
Parse all the paths (['Lcom/example/myclass/MyActivity$1;', ...]) and build a tree using the QTreeWidgetItem insertion method.
androguard/gui/treewindow.py
def fill(self): """Parse all the paths (['Lcom/example/myclass/MyActivity$1;', ...]) and build a tree using the QTreeWidgetItem insertion method.""" log.debug("Fill classes tree") for idx, filename, digest, classes in self.session.get_classes(): for c in sorted(classes, k...
def fill(self): """Parse all the paths (['Lcom/example/myclass/MyActivity$1;', ...]) and build a tree using the QTreeWidgetItem insertion method.""" log.debug("Fill classes tree") for idx, filename, digest, classes in self.session.get_classes(): for c in sorted(classes, k...
[ "Parse", "all", "the", "paths", "(", "[", "Lcom", "/", "example", "/", "myclass", "/", "MyActivity$1", ";", "...", "]", ")", "and", "build", "a", "tree", "using", "the", "QTreeWidgetItem", "insertion", "method", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/gui/treewindow.py#L33-L72
[ "def", "fill", "(", "self", ")", ":", "log", ".", "debug", "(", "\"Fill classes tree\"", ")", "for", "idx", ",", "filename", ",", "digest", ",", "classes", "in", "self", ".", "session", ".", "get_classes", "(", ")", ":", "for", "c", "in", "sorted", "...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
_dump_additional_attributes
try to parse additional attributes, but ends up to hexdump if the scheme is unknown
androguard/core/bytecodes/apk.py
def _dump_additional_attributes(additional_attributes): """ try to parse additional attributes, but ends up to hexdump if the scheme is unknown """ attributes_raw = io.BytesIO(additional_attributes) attributes_hex = binascii.hexlify(additional_attributes) if not len(additional_attributes): ret...
def _dump_additional_attributes(additional_attributes): """ try to parse additional attributes, but ends up to hexdump if the scheme is unknown """ attributes_raw = io.BytesIO(additional_attributes) attributes_hex = binascii.hexlify(additional_attributes) if not len(additional_attributes): ret...
[ "try", "to", "parse", "additional", "attributes", "but", "ends", "up", "to", "hexdump", "if", "the", "scheme", "is", "unknown" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L48-L67
[ "def", "_dump_additional_attributes", "(", "additional_attributes", ")", ":", "attributes_raw", "=", "io", ".", "BytesIO", "(", "additional_attributes", ")", "attributes_hex", "=", "binascii", ".", "hexlify", "(", "additional_attributes", ")", "if", "not", "len", "(...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
show_Certificate
Print Fingerprints, Issuer and Subject of an X509 Certificate. :param cert: X509 Certificate to print :param short: Print in shortform for DN (Default: False) :type cert: :class:`asn1crypto.x509.Certificate` :type short: Boolean
androguard/core/bytecodes/apk.py
def show_Certificate(cert, short=False): """ Print Fingerprints, Issuer and Subject of an X509 Certificate. :param cert: X509 Certificate to print :param short: Print in shortform for DN (Default: False) :type cert: :class:`asn1crypto.x509.Certificate` :type short: Boolean ...
def show_Certificate(cert, short=False): """ Print Fingerprints, Issuer and Subject of an X509 Certificate. :param cert: X509 Certificate to print :param short: Print in shortform for DN (Default: False) :type cert: :class:`asn1crypto.x509.Certificate` :type short: Boolean ...
[ "Print", "Fingerprints", "Issuer", "and", "Subject", "of", "an", "X509", "Certificate", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L2068-L2081
[ "def", "show_Certificate", "(", "cert", ",", "short", "=", "False", ")", ":", "print", "(", "\"SHA1 Fingerprint: {}\"", ".", "format", "(", "cert", ".", "sha1_fingerprint", ")", ")", "print", "(", "\"SHA256 Fingerprint: {}\"", ".", "format", "(", "cert", ".", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
ensure_final_value
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.
androguard/core/bytecodes/apk.py
def ensure_final_value(packageName, arsc, value): """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 look...
def ensure_final_value(packageName, arsc, value): """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 look...
[ "Ensure", "incoming", "value", "is", "always", "the", "value", "not", "the", "resid" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L2084-L2104
[ "def", "ensure_final_value", "(", "packageName", ",", "arsc", ",", "value", ")", ":", "if", "value", ":", "returnValue", "=", "value", "if", "value", "[", "0", "]", "==", "'@'", ":", "# TODO: @packagename:DEADBEEF is not supported here!", "try", ":", "# can be a...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
get_apkid
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...
androguard/core/bytecodes/apk.py
def get_apkid(apkfile): """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 Androi...
def get_apkid(apkfile): """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 Androi...
[ "Read", "(", "appid", "versionCode", "versionName", ")", "from", "an", "APK" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L2107-L2158
[ "def", "get_apkid", "(", "apkfile", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "apkfile", ")", ":", "log", ".", "error", "(", "\"'{apkfile}' does not exist!\"", ".", "format", "(", "apkfile", "=", "apkfile", ")", ")", "appid", "=", "...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
APK.get_app_name
Return the appname of the APK This name is read from the AndroidManifest.xml using the application android:label. If no label exists, the android:label of the main activity is used. If there is also no main activity label, an empty string is returned. :rtype: :class:`str`
androguard/core/bytecodes/apk.py
def get_app_name(self): """ Return the appname of the APK This name is read from the AndroidManifest.xml using the application android:label. If no label exists, the android:label of the main activity is used. If there is also no main activity label, an empty string is ...
def get_app_name(self): """ Return the appname of the APK This name is read from the AndroidManifest.xml using the application android:label. If no label exists, the android:label of the main activity is used. If there is also no main activity label, an empty string is ...
[ "Return", "the", "appname", "of", "the", "APK" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L441-L499
[ "def", "get_app_name", "(", "self", ")", ":", "app_name", "=", "self", ".", "get_attribute_value", "(", "'application'", ",", "'label'", ")", "if", "app_name", "is", "None", ":", "activities", "=", "self", ".", "get_main_activities", "(", ")", "main_activity_n...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
APK.get_app_icon
Return the first icon file name, which density is not greater than max_dpi, unless exact icon resolution is set in the manifest, in which case return the exact file. This information is read from the AndroidManifest.xml From https://developer.android.com/guide/practices/screens_support...
androguard/core/bytecodes/apk.py
def get_app_icon(self, max_dpi=65536): """ Return the first icon file name, which density is not greater than max_dpi, unless exact icon resolution is set in the manifest, in which case return the exact file. This information is read from the AndroidManifest.xml From ht...
def get_app_icon(self, max_dpi=65536): """ Return the first icon file name, which density is not greater than max_dpi, unless exact icon resolution is set in the manifest, in which case return the exact file. This information is read from the AndroidManifest.xml From ht...
[ "Return", "the", "first", "icon", "file", "name", "which", "density", "is", "not", "greater", "than", "max_dpi", "unless", "exact", "icon", "resolution", "is", "set", "in", "the", "manifest", "in", "which", "case", "return", "the", "exact", "file", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L501-L585
[ "def", "get_app_icon", "(", "self", ",", "max_dpi", "=", "65536", ")", ":", "main_activity_name", "=", "self", ".", "get_main_activity", "(", ")", "app_icon", "=", "self", ".", "get_attribute_value", "(", "'activity'", ",", "'icon'", ",", "name", "=", "main_...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
APK._get_file_magic_name
Return the filetype guessed for a buffer :param buffer: bytes :returns: str of filetype
androguard/core/bytecodes/apk.py
def _get_file_magic_name(self, buffer): """ Return the filetype guessed for a buffer :param buffer: bytes :returns: str of filetype """ default = "Unknown" # Faster way, test once, return default. if self.__no_magic: return default tr...
def _get_file_magic_name(self, buffer): """ Return the filetype guessed for a buffer :param buffer: bytes :returns: str of filetype """ default = "Unknown" # Faster way, test once, return default. if self.__no_magic: return default tr...
[ "Return", "the", "filetype", "guessed", "for", "a", "buffer", ":", "param", "buffer", ":", "bytes", ":", "returns", ":", "str", "of", "filetype" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L625-L670
[ "def", "_get_file_magic_name", "(", "self", ",", "buffer", ")", ":", "default", "=", "\"Unknown\"", "# Faster way, test once, return default.", "if", "self", ".", "__no_magic", ":", "return", "default", "try", ":", "# Magic is optional", "import", "magic", "except", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
APK.get_files_types
Return the files inside the APK with their associated types (by using python-magic) At the same time, the CRC32 are calculated for the files. :rtype: a dictionnary
androguard/core/bytecodes/apk.py
def get_files_types(self): """ Return the files inside the APK with their associated types (by using python-magic) At the same time, the CRC32 are calculated for the files. :rtype: a dictionnary """ if self._files == {}: # Generate File Types / CRC List ...
def get_files_types(self): """ Return the files inside the APK with their associated types (by using python-magic) At the same time, the CRC32 are calculated for the files. :rtype: a dictionnary """ if self._files == {}: # Generate File Types / CRC List ...
[ "Return", "the", "files", "inside", "the", "APK", "with", "their", "associated", "types", "(", "by", "using", "python", "-", "magic", ")" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L681-L695
[ "def", "get_files_types", "(", "self", ")", ":", "if", "self", ".", "_files", "==", "{", "}", ":", "# Generate File Types / CRC List", "for", "i", "in", "self", ".", "get_files", "(", ")", ":", "buffer", "=", "self", ".", "_get_crc32", "(", "i", ")", "...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
APK._patch_magic
Overwrite some probably wrong detections by mime libraries :param buffer: bytes of the file to detect :param orig: guess by mime libary :returns: corrected guess
androguard/core/bytecodes/apk.py
def _patch_magic(self, buffer, orig): """ Overwrite some probably wrong detections by mime libraries :param buffer: bytes of the file to detect :param orig: guess by mime libary :returns: corrected guess """ if ("Zip" in orig) or ('(JAR)' in orig) and androconf.i...
def _patch_magic(self, buffer, orig): """ Overwrite some probably wrong detections by mime libraries :param buffer: bytes of the file to detect :param orig: guess by mime libary :returns: corrected guess """ if ("Zip" in orig) or ('(JAR)' in orig) and androconf.i...
[ "Overwrite", "some", "probably", "wrong", "detections", "by", "mime", "libraries" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L697-L708
[ "def", "_patch_magic", "(", "self", ",", "buffer", ",", "orig", ")", ":", "if", "(", "\"Zip\"", "in", "orig", ")", "or", "(", "'(JAR)'", "in", "orig", ")", "and", "androconf", ".", "is_android_raw", "(", "buffer", ")", "==", "'APK'", ":", "return", "...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
APK._get_crc32
Calculates and compares the CRC32 and returns the raw buffer. The CRC32 is added to `files_crc32` dictionary, if not present. :param filename: filename inside the zipfile :rtype: bytes
androguard/core/bytecodes/apk.py
def _get_crc32(self, filename): """ Calculates and compares the CRC32 and returns the raw buffer. The CRC32 is added to `files_crc32` dictionary, if not present. :param filename: filename inside the zipfile :rtype: bytes """ buffer = self.zip.read(filename) ...
def _get_crc32(self, filename): """ Calculates and compares the CRC32 and returns the raw buffer. The CRC32 is added to `files_crc32` dictionary, if not present. :param filename: filename inside the zipfile :rtype: bytes """ buffer = self.zip.read(filename) ...
[ "Calculates", "and", "compares", "the", "CRC32", "and", "returns", "the", "raw", "buffer", "." ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L710-L727
[ "def", "_get_crc32", "(", "self", ",", "filename", ")", ":", "buffer", "=", "self", ".", "zip", ".", "read", "(", "filename", ")", "if", "filename", "not", "in", "self", ".", "files_crc32", ":", "self", ".", "files_crc32", "[", "filename", "]", "=", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
APK.get_files_crc32
Calculates and returns a dictionary of filenames and CRC32 :returns: dict of filename: CRC32
androguard/core/bytecodes/apk.py
def get_files_crc32(self): """ Calculates and returns a dictionary of filenames and CRC32 :returns: dict of filename: CRC32 """ if self.files_crc32 == {}: for i in self.get_files(): self._get_crc32(i) return self.files_crc32
def get_files_crc32(self): """ Calculates and returns a dictionary of filenames and CRC32 :returns: dict of filename: CRC32 """ if self.files_crc32 == {}: for i in self.get_files(): self._get_crc32(i) return self.files_crc32
[ "Calculates", "and", "returns", "a", "dictionary", "of", "filenames", "and", "CRC32" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L729-L739
[ "def", "get_files_crc32", "(", "self", ")", ":", "if", "self", ".", "files_crc32", "==", "{", "}", ":", "for", "i", "in", "self", ".", "get_files", "(", ")", ":", "self", ".", "_get_crc32", "(", "i", ")", "return", "self", ".", "files_crc32" ]
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
APK.get_files_information
Return the files inside the APK with their associated types and crc32 :rtype: str, str, int
androguard/core/bytecodes/apk.py
def get_files_information(self): """ Return the files inside the APK with their associated types and crc32 :rtype: str, str, int """ for k in self.get_files(): yield k, self.get_files_types()[k], self.get_files_crc32()[k]
def get_files_information(self): """ Return the files inside the APK with their associated types and crc32 :rtype: str, str, int """ for k in self.get_files(): yield k, self.get_files_types()[k], self.get_files_crc32()[k]
[ "Return", "the", "files", "inside", "the", "APK", "with", "their", "associated", "types", "and", "crc32" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L741-L748
[ "def", "get_files_information", "(", "self", ")", ":", "for", "k", "in", "self", ".", "get_files", "(", ")", ":", "yield", "k", ",", "self", ".", "get_files_types", "(", ")", "[", "k", "]", ",", "self", ".", "get_files_crc32", "(", ")", "[", "k", "...
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
APK.get_file
Return the raw data of the specified filename inside the APK :rtype: bytes
androguard/core/bytecodes/apk.py
def get_file(self, filename): """ Return the raw data of the specified filename inside the APK :rtype: bytes """ try: return self.zip.read(filename) except KeyError: raise FileNotPresent(filename)
def get_file(self, filename): """ Return the raw data of the specified filename inside the APK :rtype: bytes """ try: return self.zip.read(filename) except KeyError: raise FileNotPresent(filename)
[ "Return", "the", "raw", "data", "of", "the", "specified", "filename", "inside", "the", "APK" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L758-L768
[ "def", "get_file", "(", "self", ",", "filename", ")", ":", "try", ":", "return", "self", ".", "zip", ".", "read", "(", "filename", ")", "except", "KeyError", ":", "raise", "FileNotPresent", "(", "filename", ")" ]
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
APK.get_dex_names
Return the names of all DEX files found in the APK. This method only accounts for "offical" dex files, i.e. all files in the root directory of the APK named classes.dex or classes[0-9]+.dex :rtype: a list of str
androguard/core/bytecodes/apk.py
def get_dex_names(self): """ Return the names of all DEX files found in the APK. This method only accounts for "offical" dex files, i.e. all files in the root directory of the APK named classes.dex or classes[0-9]+.dex :rtype: a list of str """ dexre = re.compile...
def get_dex_names(self): """ Return the names of all DEX files found in the APK. This method only accounts for "offical" dex files, i.e. all files in the root directory of the APK named classes.dex or classes[0-9]+.dex :rtype: a list of str """ dexre = re.compile...
[ "Return", "the", "names", "of", "all", "DEX", "files", "found", "in", "the", "APK", ".", "This", "method", "only", "accounts", "for", "offical", "dex", "files", "i", ".", "e", ".", "all", "files", "in", "the", "root", "directory", "of", "the", "APK", ...
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L785-L794
[ "def", "get_dex_names", "(", "self", ")", ":", "dexre", "=", "re", ".", "compile", "(", "r\"classes(\\d*).dex\"", ")", "return", "filter", "(", "lambda", "x", ":", "dexre", ".", "match", "(", "x", ")", ",", "self", ".", "get_files", "(", ")", ")" ]
984c0d981be2950cf0451e484f7b0d4d53bc4911
train
APK.get_all_attribute_value
Yields all the attribute values in xml files which match with the tag name and the specific attribute :param str tag_name: specify the tag name :param str attribute: specify the attribute :param bool format_value: specify if the value needs to be formatted with packagename
androguard/core/bytecodes/apk.py
def get_all_attribute_value( self, tag_name, attribute, format_value=True, **attribute_filter ): """ Yields all the attribute values in xml files which match with the tag name and the specific attribute :param str tag_name: specify the tag name :param str attribute: specify ...
def get_all_attribute_value( self, tag_name, attribute, format_value=True, **attribute_filter ): """ Yields all the attribute values in xml files which match with the tag name and the specific attribute :param str tag_name: specify the tag name :param str attribute: specify ...
[ "Yields", "all", "the", "attribute", "values", "in", "xml", "files", "which", "match", "with", "the", "tag", "name", "and", "the", "specific", "attribute" ]
androguard/androguard
python
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/apk.py#L893-L910
[ "def", "get_all_attribute_value", "(", "self", ",", "tag_name", ",", "attribute", ",", "format_value", "=", "True", ",", "*", "*", "attribute_filter", ")", ":", "tags", "=", "self", ".", "find_tags", "(", "tag_name", ",", "*", "*", "attribute_filter", ")", ...
984c0d981be2950cf0451e484f7b0d4d53bc4911