androguard.gui package

Submodules

androguard.gui.Banners module

class androguard.gui.Banners.Banner

Bases: object

changeDisplay()
getDesiredGeometry()
getOrientation()
getPixmap()
setViewMode(viewMode)
class androguard.gui.Banners.Banners

Bases: androguard.gui.Banners.Observer

BOTTOM_SEPARATOR = 5
add(banner)
banners()
draw(qp, offsetLeft, offsetBottom, maxY)
getBottomOffset()
getLeftOffset()
getTopOffset()
resize(width, height)
setViewMode(viewMode)
class androguard.gui.Banners.BottomBanner(themes, dataModel, viewMode)

Bases: androguard.gui.Banners.Banner

draw()
getDesiredGeometry()
getOrientation()
getPixmap()
resize(width, height)
setViewMode(viewMode)
class androguard.gui.Banners.FileAddrBanner(themes, dataModel, viewMode)

Bases: androguard.gui.Banners.Banner

draw()
getDesiredGeometry()
getOrientation()
getPixmap()
resize(width, height)
setViewMode(viewMode)
class androguard.gui.Banners.Observer

Bases: object

changeViewMode(viewMode)
class androguard.gui.Banners.TopBanner(themes, dataModel, viewMode)

Bases: androguard.gui.Banners.Banner

draw()
getDesiredGeometry()
getOrientation()
getPixmap()
resize(width, height)
setViewMode(viewMode)

androguard.gui.BinViewMode module

class androguard.gui.BinViewMode.BinViewMode(themes, width, height, data, cursor, widget=None)

Bases: androguard.gui.ViewMode.ViewMode

addop(t)
anon(dx, dy)
cache()
computeTextArea()
draw(refresh=False, row=0, howMany=0)
draw2(qp, refresh=False)
drawAdditionals()
drawCursor(qp)
drawTextMode(qp, row=0, howMany=1)
fontHeight
fontWidth
getColumnsbyRow(row)
getCursorAbsolutePosition()
getDataModel()
getGeometry()
getHeaderInfo()
getPageOffset()
getPixmap()
handleEditMode(modifiers, key, event)
handleKeyEvent(modifiers, key, event=None)
isEditable()
isInCache(page)
keyFilter()
moveCursor(direction)
resize(width, height)
scroll(dx, dy, cachePix=None, pageOffset=None)
scrollPages(number, cachePix=None, pageOffset=None)
scroll_h(dx)
scroll_v(dy, cachePix=None, pageOffset=None)
setEditMode(mode)
setTransformationEngine(engine)
startCaching()
startSelection()
stopSelection()

androguard.gui.DataModel module

class androguard.gui.DataModel.ApkModel(apkobj)

Bases: androguard.gui.DataModel.DataModel

GetViews()
close()
flush()
size()
source
class androguard.gui.DataModel.BufferDataModel(data, name)

Bases: androguard.gui.DataModel.DataModel

close()
flush()
size()
source
class androguard.gui.DataModel.DataModel(data)

Bases: androguard.gui.DataModel.Observer

close()
dataOffset
flush()
getBYTE(offset, asString=False)
getChar(offset)
getDWORD(offset, asString=False)
getData()
getDataSize()
getLastOffset()
getOffset()
getPageOffset(page)
getQWORD(offset, asString=False)
getStream(start, end)
getWORD(offset, asString=False)
getXYInPage(off)
goTo(off)
inLimits(x)
isDirty()
offsetInPage(off)
setData_b(offset, b)
setData_s(u, v, s)
size()
slide(off)
slideLine(factor)
slidePage(factor)
slideToFirstPage()
slideToLastPage()
source
update_geometry(rows, cols)
write()
class androguard.gui.DataModel.DexClassModel(current_class)

Bases: androguard.gui.DataModel.DataModel

GetRawData(current_class)
GetViews()
close()
flush()
getDataSize()
source
class androguard.gui.DataModel.FileDataModel(filename)

Bases: androguard.gui.DataModel.DataModel

close()
flush()
size()
source
write(offset, stream)
class androguard.gui.DataModel.MyByte(data)

Bases: bytearray

read(size)
seek(a, b=0)
class androguard.gui.DataModel.MyStringIO(data)

Bases: _io.StringIO, object

class androguard.gui.DataModel.Observer

Bases: object

update_geometry()

androguard.gui.DisasmViewMode module

class androguard.gui.DisasmViewMode.DisasmViewMode(themes, width, height, data, cursor, widget=None)

Bases: androguard.gui.ViewMode.ViewMode

FeedOpcodes(cnt)
GetLengthOpcodes()
addop(t)
computeTextArea()
draw(refresh=False)
drawAdditionals()
drawBranch(qp)
drawBranch2(qp)
drawCursor(qp)
drawSelected(qp)
drawTextMode(qp)
fontHeight
fontWidth
getColumnsbyRow(row)
getCursorAbsolutePosition()
getCursorOffsetInPage()
getDataModel()
getGeometry()
getHeaderInfo()
getPageOffset()
getPixmap()
goTo(offset)
handleKeyEvent(modifiers, key, event=None)
moveCursor(direction)
resize(width, height)
scroll(dx, dy, cachePix=None, pageOffset=None)
scrollPages(number, cachePix=None, pageOffset=None)
scroll_v(dy, cachePix=None, pageOffset=None)
setTransformationEngine(engine)
startSelection()
stopSelection()
class androguard.gui.DisasmViewMode.InstructionView(ins)

Bases: object

AddComment(cmt)
Load()
getEndCursor()
getNearestCursor(cx)
getNextCursor(cx, direction='')
getSelectedToken(cx)
getSelectionWidth(cx)
get_comments()
get_hex()
get_length()
get_name()
get_operands(idx=-1)
get_output()
get_symbol()
indexTable
tokens()

androguard.gui.HexViewMode module

class androguard.gui.HexViewMode.AnnonItem(x, parent, color)

Bases: PyQt5.QtWidgets.QTreeWidgetItem

ID_COLOR = 5
ID_DESCRIPTION = 4
ID_NAME = 0
ID_OFFSET = 1
ID_SIZE = 2
ID_VALUE = 3
getDescription()
getName()
getOffset()
getSize()
getValue()
setDescription(description)
setName(name)
setOffset(offset)
setSize(size)
setValue(value)
class androguard.gui.HexViewMode.Annotation(parent, view)

Bases: PyQt5.QtWidgets.QDialog

initUI()
newFieldName()
show(self)
class androguard.gui.HexViewMode.ComboBoxItem(item, column)

Bases: PyQt5.QtWidgets.QComboBox

class androguard.gui.HexViewMode.HexViewMode(themes, width, height, data, cursor, widget=None)

Bases: androguard.gui.ViewMode.ViewMode

add_annotation(mode)
addop(t)
annotationWindow()
anon(dx, dy)
changeHexColumns()
computeTextArea()
draw(refresh=False, row=0, howMany=0)
drawAdditionals()
drawCursor(qp)
drawTextMode(qp, row=0, howMany=1)
fontHeight
fontWidth
getColumnsbyRow(row)
getCursorAbsolutePosition()
getDataModel()
getGeometry()
getHeaderInfo()
getPageOffset()
getPixmap()
handleEditMode(modifiers, key, event)
handleKeyEvent(modifiers, key, event=None)
isEditable()
itemChanged(item, column)
keyFilter()
moveCursor(direction)
resize(width, height)
scroll(dx, dy)
scrollPages(number)
scroll_h(dx)
scroll_v(dy)
selectionChanged(selected, deselected)
setEditMode(mode)
setTransformationEngine(engine)
startSelection()
stopSelection()
class androguard.gui.HexViewMode.NoEditDelegate(parent=None)

Bases: PyQt5.QtWidgets.QStyledItemDelegate

createEditor(self, QWidget, QStyleOptionViewItem, QModelIndex) → QWidget
class androguard.gui.HexViewMode.QColorButton(*args, **kwargs)

Bases: PyQt5.QtWidgets.QPushButton

Custom Qt Widget to show a chosen color.

Left-clicking the button shows the color-chooser, while right-clicking resets the color to None (no-color).

color()
colorChanged
mousePressEvent(self, QMouseEvent)
onColorPicker()

Show color-picker dialog to select color.

Qt will use the native dialog by default.

setColor(color)
class androguard.gui.HexViewMode.treeEventFilter(view, widget)

Bases: PyQt5.QtCore.QObject

eventFilter(self, QObject, QEvent) → bool

androguard.gui.SourceViewMode module

class androguard.gui.SourceViewMode.SourceViewMode(themes, width, height, data, cursor, widget=None)

Bases: androguard.gui.ViewMode.ViewMode

computeTextArea()
draw(refresh=False)
drawAdditionals()
drawCursor(qp)
drawLine(qp)
drawTextMode(qp)
fontHeight
fontWidth
getColumnsbyRow(row)
getCursorAbsolutePosition()
getCursorOffsetInPage()
getDataModel()
getGeometry()
getPageOffset()
getPixmap()
handleKeyEvent(modifiers, key, event=None)
resize(width, height)
setTransformationEngine(engine)

androguard.gui.TextDecorators module

class androguard.gui.TextDecorators.CTextDecorator

Bases: object

MZbrush = <PyQt5.QtGui.QBrush object>
grayBrush = <PyQt5.QtGui.QBrush object>
greenPen = <PyQt5.QtGui.QPen object>
normalPen = <PyQt5.QtGui.QPen object>
redPen = <PyQt5.QtGui.QPen object>
whitePen = <PyQt5.QtGui.QPen object>
class androguard.gui.TextDecorators.HighlightASCII(decorated)

Bases: androguard.gui.TextDecorators.PageDecorator

decorate(pageOffset=None)
class androguard.gui.TextDecorators.HighlightPrefix(decorated, text, additionalLength=0, brush=None, pen=None)

Bases: androguard.gui.TextDecorators.PageDecorator

decorate(pageOffset=None)
highliteWithPrefix(page, text, additionalLength=0, brush=None, pen=None)
class androguard.gui.TextDecorators.HighlightWideChar(decorated)

Bases: androguard.gui.TextDecorators.PageDecorator

decorate(pageOffset=None)
highliteWidechar2(page)
class androguard.gui.TextDecorators.PageDecorator(decorated)

Bases: androguard.gui.TextDecorators.TextDecorator

doit()
getBrushMap()
getDataModel()
getPenMap()
reset()
class androguard.gui.TextDecorators.RangePen(decorated, a, b, pen, ignoreHighlights=True)

Bases: androguard.gui.TextDecorators.PageDecorator

decorate(pageOffset=None)
class androguard.gui.TextDecorators.TextDecorator(viewmode)

Bases: androguard.gui.TextDecorators.CTextDecorator

addPenInterval(a, b, pen, ignoreHighlights=True)
chooseBrush(idx)
choosePen(idx)
decorate(pageOffset=None)
getChar(idx)
getDataModel()
isText(c)

D = [] for i in range(256):

b = False if self.isText(chr(i)):

b = True

D.append(b)

print D sys.exit()

reset()

androguard.gui.TextSelection module

class androguard.gui.TextSelection.DefaultSelection(themes, viewMode)

Bases: androguard.gui.TextSelection.Selection

drawSelection(qp, start, end, brush=None, opacity=0.4)
class androguard.gui.TextSelection.DisasmSelection(themes, viewMode)

Bases: androguard.gui.TextSelection.Selection

drawSelection(qp, start, end, brush=None, opacity=0.4)
class androguard.gui.TextSelection.HexSelection(themes, viewMode)

Bases: androguard.gui.TextSelection.Selection

drawSelection(qp, start, end, brush=None, opacity=0.4)
class androguard.gui.TextSelection.Selection(themes, viewMode)

Bases: object

addSelection(t, seltype=None)
drawSelection(qp, start, end, brush=None, opacity=0.4)
drawSelections(qp)
getCurrentSelection()
highlightText()
removeSelection(u, v, seltype)
resetSelections()
startSelection()
stopSelection()
class androguard.gui.TextSelection.SelectionType

Bases: object

NORMAL = 0
PERMANENT = 1
TEXTHIGHLIGHT = 2

androguard.gui.ViewMode module

class androguard.gui.ViewMode.Observable

Bases: object

addHandler(h)
notify(rows, cols)
class androguard.gui.ViewMode.ViewMode

Bases: androguard.gui.ViewMode.Observable, object

SPACER = 4
cp437(c)
cp437ToUnicode = [32, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 28, 27, 127, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 26, 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197, 201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 162, 163, 165, 8359, 402, 225, 237, 243, 250, 241, 209, 170, 186, 191, 8976, 172, 189, 188, 161, 171, 187, 9617, 9618, 9619, 9474, 9508, 9569, 9570, 9558, 9557, 9571, 9553, 9559, 9565, 9564, 9563, 9488, 9492, 9524, 9516, 9500, 9472, 9532, 9566, 9567, 9562, 9556, 9577, 9574, 9568, 9552, 9580, 9575, 9576, 9572, 9573, 9561, 9560, 9554, 9555, 9579, 9578, 9496, 9484, 9608, 9604, 9612, 9616, 9600, 945, 223, 915, 960, 931, 963, 956, 964, 934, 920, 937, 948, 8734, 966, 949, 8745, 8801, 177, 8805, 8804, 8992, 8993, 247, 8776, 176, 8729, 183, 8730, 8319, 178, 9632, 160]
draw(refresh=False)
getCursorOffsetInPage()
getDisplayablePage(pageOffset=None)
getGeometry()
getHeaderInfo()
getPageOffset()
goTo(offset)
handleKeyPressEvent(modifier, key)
handleKeyReleaseEvent(modifier, key)
isEditable()
isInEditMode()
setEditMode(value)
startSelection()
stopSelection()

androguard.gui.apiwindow module

class androguard.gui.apiwindow.APIValueWindow(parent=None, win=None, session=None)

Bases: PyQt5.QtWidgets.QTreeView

slotDoubleClicked(mi)
class androguard.gui.apiwindow.APIWindow(parent=None, win=None, session=None)

Bases: PyQt5.QtWidgets.QWidget

filterRegExpChanged(value)

androguard.gui.binwindow module

class androguard.gui.binwindow.Observable

Bases: object

addHandler(h)
notify(viewMode)
class androguard.gui.binwindow.Observer

Bases: object

changeViewMode(viewMode)
class androguard.gui.binwindow.SearchWindow(parent, plugin, searchable)

Bases: PyQt5.QtWidgets.QDialog

initUI()
onClicked()
show(self)
class androguard.gui.binwindow.Searchable(dataModel, viewMode)

Bases: androguard.gui.binwindow.Observer

lastText
next(start=None)
previous(start=None)
search(text)
class androguard.gui.binwindow.binWidget(parent, source, title)

Bases: PyQt5.QtWidgets.QWidget, androguard.gui.binwindow.Observable

disable()
enable()
eventFilter(self, QObject, QEvent) → bool
initUI()
needsSave()
paintEvent(self, QPaintEvent)
resizeEvent(self, QResizeEvent)
save()
scroll_from_outside(i)
scrolled
setTextViewport(qp)
switchViewMode()

androguard.gui.cemu module

class androguard.gui.cemu.ConsoleEmulator(qp, rows, cols)

Bases: object

CR()
LF()
getXY()
gotoXY(x, y)
incrementPosition()
newLine()
write(s, noBackgroudOnSpaces=False)
writeAt(x, y, s, noBackgroudOnSpaces=False)
writeAt_c(x, y, c, noBackgroudOnSpaces=False)
writeLn()
write_c(c, noBackgroudOnSpaces=False)
class androguard.gui.cemu.Cursor(x, y)

Bases: object

getPosition()
move(dx, dy)
moveAbsolute(x, y)
androguard.gui.cemu.Directions

alias of androguard.gui.cemu.Enum

androguard.gui.cemu.enum(**enums)

androguard.gui.fileloading module

class androguard.gui.fileloading.FileLoadingThread(parent=None)

Bases: PyQt5.QtCore.QThread

file_loaded
load(file_path)
run(self)

androguard.gui.helpers module

class androguard.gui.helpers.Signature(cls, method=None, descriptor=None)

Bases: object

androguard.gui.helpers.class2func(path)

Convert a path such as ‘Landroid/support/v4/app/ActivityCompat;’ into a method string ‘CLASS_Landroid_support_v4_app_ActivityCompat’ so we can call d.CLASS_Landroid_support_v4_app_ActivityCompat.get_source()

androguard.gui.helpers.classdot2class(path)

Convert a path such as ‘android.support.v4.app.ActivityCompat’ into a string ‘Landroid/support/v4/app/ActivityCompat’ so we can change name of a class by d.CLASS_Landroid_support_v4_app_ActivityCompat.set_name(new_name)

androguard.gui.helpers.classdot2func(path)

Convert a path such as ‘android.support.v4.app.ActivityCompat’ into a method string ‘CLASS_Landroid_support_v4_app_ActivityCompat’ so we can call d.CLASS_Landroid_support_v4_app_ActivityCompat.get_source()

androguard.gui.helpers.classmethod2display(class_, method_, descriptor_)

Convert two strings such as “Lcom/mwr/example/sieve/AddEntryActivity;” and “onCreate” into a beautiful :) string to display Xrefs: “Lcom/mwr/example/sieve/AddEntryActivity; -> onCreate”

androguard.gui.helpers.classmethod2func(class_, method_)

Convert two strings such as “Lcom/mwr/example/sieve/AddEntryActivity;” and “onCreate” into a string “CLASS_Lcom_example_sieve_AddEntryActivity.METHOD_onCreate” so we can access d.CLASS_Lcom_example_sieve_AddEntryActivity.METHOD_onCreate.XREFfrom

androguard.gui.helpers.display2classmethod(display)

Opposite of classmethod2display.

androguard.gui.helpers.method2func(method)
androguard.gui.helpers.proto2methodprotofunc(proto)

Convert a prototype such as ‘Ljava/lang/String;’ into a string ‘Ljava_lang_String” so we can append that to the ‘METHOD_myMethod’ if its export python name contains the prototype

androguard.gui.mainwindow module

class androguard.gui.mainwindow.MainWindow(parent=None, session=<androguard.session.Session object>, input_file=None, input_plugin=None)

Bases: PyQt5.QtWidgets.QMainWindow

Main window: self.central: QTabWidget in center area self.dock: QDockWidget in left area self.tree: TreeWindow(QTreeWidget) in self.dock

about()

User clicked About menu. Display a Message box.

addFile()
cleanCentral()
closeEvent(event)

Clicked [x] to close main window

doesClassExist(path)
eventFilter(self, QObject, QEvent) → bool
getMeOpenedWindowIfExists(name)
loadedFile(success)
openAPIWindow()
openApkWindow()
openBinWindow(current_class)
openFile()
openMethodsWindow()
openResourcesWindow()
openRunPluginWindow()
openSourceWindow(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.

openStringsWindow()
saveFile()

User clicked Save menu. Display a Dialog to ask whwre to save.

saveSession(filepath)

Save androguard session.

setupCentral()

Setup empty window supporting tabs at startup.

setupDock()

Setup empty Dock at startup.

setupEmptyTree()

Setup empty Tree at startup.

setupFileMenu()
setupHelpMenu()
setupPluginsMenu()
setupSession()
setupTree()
setupViewMenu()
showStatus(msg)

Helper function called by any window to display a message in status bar.

updateDockWithTree(empty=False)

Update the classes tree. Called when - a new APK has been imported - a classe has been renamed (displayed in the tree)

class androguard.gui.mainwindow.TabsWindow(bin_windows, parent=None)

Bases: PyQt5.QtWidgets.QTabWidget

actioncloseAllTabs()
actioncloseLeftTabs()
actioncloseOtherTabs()
actioncloseRightTabs()
contextMenuEvent(self, QContextMenuEvent)
currentTabChanged(index)
tabCloseRequestedHandler(index)

androguard.gui.methodswindow module

class androguard.gui.methodswindow.MethodsValueWindow(parent=None, win=None, session=None)

Bases: PyQt5.QtWidgets.QTreeView

slotDoubleClicked(mi)
class androguard.gui.methodswindow.MethodsWindow(parent=None, win=None, session=None)

Bases: PyQt5.QtWidgets.QWidget

filterRegExpChanged(value)

androguard.gui.renamewindow module

class androguard.gui.renamewindow.RenameDialog(parent=None, win=None, element='', info=())

Bases: PyQt5.QtWidgets.QDialog

parent: SourceWindow that started the new XrefDialog

cancelClicked()
okClicked()

androguard.gui.resourceswindow module

class androguard.gui.resourceswindow.ResourcesValueWindow(parent=None, win=None, session=None)

Bases: PyQt5.QtWidgets.QTreeView

class androguard.gui.resourceswindow.ResourcesWindow(parent=None, win=None, session=None)

Bases: PyQt5.QtWidgets.QWidget

filterRegExpChanged(value)

androguard.gui.sourcewindow module

class androguard.gui.sourcewindow.MyHighlighter(parent, lexer=None)

Bases: PyQt5.QtGui.QSyntaxHighlighter

Syntax highlighter that uses Pygments for parsing.

highlightBlock(string)

Highlight a block of text.

set_style(style)

Sets the style to the specified Pygments style.

set_style_sheet(stylesheet)

Sets a CSS stylesheet. The classes in the stylesheet should correspond to those generated by:

pygmentize -S <style> -f html

Note that ‘set_style’ and ‘set_style_sheet’ completely override each other, i.e. they cannot be used in conjunction.

class androguard.gui.sourcewindow.PygmentsBlockUserData(**kwds)

Bases: PyQt5.QtGui.QTextBlockUserData

Storage for the user data associated with each line.

syntax_stack = ('root',)
class androguard.gui.sourcewindow.SolarizedStyle

Bases: pygments.style.Style

background_color = '#002B36'
styles = {Token: '#93A1A1', Token.Comment: '#586E75', Token.Comment.Hashbang: '', Token.Comment.Multiline: '', Token.Comment.Preproc: '#859900', Token.Comment.PreprocFile: '', Token.Comment.Single: '', Token.Comment.Special: '#859900', Token.Error: '', Token.Escape: '', Token.Generic: '', Token.Generic.Deleted: '#2AA198', Token.Generic.Emph: 'italic', Token.Generic.Error: '#DC322F', Token.Generic.Heading: '#CB4B16', Token.Generic.Inserted: '#859900', Token.Generic.Output: '', Token.Generic.Prompt: '', Token.Generic.Strong: 'bold', Token.Generic.Subheading: '#CB4B16', Token.Generic.Traceback: '', Token.Keyword: '#859900', Token.Keyword.Constant: '#CB4B16', Token.Keyword.Declaration: '#268BD2', Token.Keyword.Namespace: '', Token.Keyword.Pseudo: '', Token.Keyword.Reserved: '#268BD2', Token.Keyword.Type: '#DC322F', Token.Literal: '', Token.Literal.Date: '', Token.Literal.Number: '#2AA198', Token.Literal.Number.Bin: '', Token.Literal.Number.Float: '', Token.Literal.Number.Hex: '', Token.Literal.Number.Integer: '', Token.Literal.Number.Integer.Long: '', Token.Literal.Number.Oct: '', Token.Literal.String: '#2AA198', Token.Literal.String.Affix: '', Token.Literal.String.Backtick: '#586E75', Token.Literal.String.Char: '#2AA198', Token.Literal.String.Delimiter: '', Token.Literal.String.Doc: '#93A1A1', Token.Literal.String.Double: '', Token.Literal.String.Escape: '#CB4B16', Token.Literal.String.Heredoc: '#93A1A1', Token.Literal.String.Interpol: '', Token.Literal.String.Other: '', Token.Literal.String.Regex: '#DC322F', Token.Literal.String.Single: '', Token.Literal.String.Symbol: '', Token.Name: '', Token.Name.Attribute: '#93A1A1', Token.Name.Builtin: '#B58900', Token.Name.Builtin.Pseudo: '#268BD2', Token.Name.Class: '#268BD2', Token.Name.Constant: '#CB4B16', Token.Name.Decorator: '#268BD2', Token.Name.Entity: '#CB4B16', Token.Name.Exception: '#CB4B16', Token.Name.Function: '#268BD2', Token.Name.Function.Magic: '', Token.Name.Label: '', Token.Name.Namespace: '', Token.Name.Other: '', Token.Name.Property: '', Token.Name.Tag: '#268BD2', Token.Name.Variable: '#268BD2', Token.Name.Variable.Class: '', Token.Name.Variable.Global: '', Token.Name.Variable.Instance: '', Token.Name.Variable.Magic: '', Token.Operator: '#859900', Token.Operator.Word: '', Token.Other: '#CB4B16', Token.Punctuation: '', Token.Text: '', Token.Text.Whitespace: ''}
class androguard.gui.sourcewindow.SourceDocument(parent=None, lines=[])

Bases: PyQt5.QtGui.QTextDocument

QTextDocument associated with the SourceWindow.

class androguard.gui.sourcewindow.SourceWindow(parent=None, win=None, current_class=None, current_title=None, current_filename=None, current_digest=None, session=None)

Bases: PyQt5.QtWidgets.QTextEdit

Each tab is implemented as a Source Window class. Attributes:

mainwin: MainWindow path: class FQN title: last part of the class FQN class_item: ClassDefItem i.e. class.java object for which we create the tab
CustomContextMenuHandler(pos)
actionCopy()
actionGoto()
actionInfo()
actionRename()
actionXref()
browse_to_method(method)

Scroll to the right place were the method is.

TODO: implement it, because does not work for now.

cursor_position_changed()

Used to detect when cursor change position and to auto select word underneath it

field_name_exist(field_name)

Check if there is already a field_name field in the current class It is useful before allowing to rename a field to check name does not already exist.

keyPressEvent(event)

Keyboard shortcuts

method_name_exist(meth_name)

Check if there is already a meth_name method in the current class It is useful before allowing to rename a method to check name does not already exist.

reload_java_sources()

Reload completely the sources by asking Androguard to decompile it again. Useful when:

  • an element has been renamed to propagate the info
  • the current tab is changed because we do not know what user did since then, so we need to propagate previous changes as well
renameElement(oldname, newname, info)

Called back after a user chose a new name for an element.

androguard.gui.stringswindow module

class androguard.gui.stringswindow.StringsValueWindow(parent=None, win=None, session=None)

Bases: PyQt5.QtWidgets.QTreeView

slotDoubleClicked(mi)
class androguard.gui.stringswindow.StringsWindow(parent=None, win=None, session=None)

Bases: PyQt5.QtWidgets.QWidget

filterRegExpChanged(value)

androguard.gui.treewindow module

class androguard.gui.treewindow.HashableQTreeWidgetItem

Bases: PyQt5.QtWidgets.QTreeWidgetItem

class androguard.gui.treewindow.TreeWindow(parent=None, win=None, session=None)

Bases: PyQt5.QtWidgets.QTreeWidget

actionCollapse()
actionExpand()
actionXref()
collapse_children(item)
contextMenuEvent(self, QContextMenuEvent)
createActions()
expand_children(item)
fill()

Parse all the paths ([‘Lcom/example/myclass/MyActivity$1;’, …]) and build a tree using the QTreeWidgetItem insertion method.

itemDoubleClickedHandler(item, column)
setupCaches()

androguard.gui.xrefwindow module

class androguard.gui.xrefwindow.XrefDialog(parent=None, win=None, xrefs_list=None, method='')

Bases: PyQt5.QtWidgets.QDialog

Dialog holding our Xref listview. parent: SourceWindow that started the new XrefDialog path: complete path of the class we are looking an xref from method (optional): method of the class we are looking xref from xrefs_list: the list of “Class -> Method” strings representing the xrefs

path/method are used for the title of the window xrefs_list for the content of the QListView

classmethod get_xrefs_list(class_item, method=None)

Static method called before creating a XrefDialog to check if there are xrefs to display

method (optional): method of the class we are looking xref from
classmethod get_xrefs_list_from_element(element)

Helper for get_xrefs_list

element is a ClassDefItem or MethodDefItem

At the end of the function, we lost if we worked on a class or method but we do not care for now.

class androguard.gui.xrefwindow.XrefDialogClass(parent=None, win=None, current_class=None, class_analysis=None)

Bases: PyQt5.QtWidgets.QDialog

Dialog holding our Xref listview. parent: SourceWindow that started the new XrefDialog path: complete path of the class we are looking an xref from method (optional): method of the class we are looking xref from xrefs_list: the list of “Class -> Method” strings representing the xrefs

path/method are used for the title of the window xrefs_list for the content of the QListView

class androguard.gui.xrefwindow.XrefDialogField(parent=None, win=None, current_class=None, class_analysis=None, field_analysis=None)

Bases: PyQt5.QtWidgets.QDialog

class androguard.gui.xrefwindow.XrefDialogMethod(parent=None, win=None, method_analysis=None)

Bases: PyQt5.QtWidgets.QDialog

class androguard.gui.xrefwindow.XrefDialogString(parent=None, win=None, string_analysis=None)

Bases: PyQt5.QtWidgets.QDialog

class androguard.gui.xrefwindow.XrefListView(parent=None, win=None, xrefs=None, headers=['Origin', 'Method'])

Bases: PyQt5.QtWidgets.QWidget

close(self) → bool
filterRegExpChanged(value)
class androguard.gui.xrefwindow.XrefValueWindow(parent=None, win=None, xrefs=None, headers=None)

Bases: PyQt5.QtWidgets.QTreeView

slotDoubleClicked(mi)

Module contents