From 4837ed6a909a3d9d5b7494f0c2f898592eaaba45 Mon Sep 17 00:00:00 2001 From: lucasduffey Date: Mon, 24 Oct 2016 11:48:14 -0700 Subject: Update getting-started.md --- docs/getting-started.md | 1 + 1 file changed, 1 insertion(+) (limited to 'docs') diff --git a/docs/getting-started.md b/docs/getting-started.md index 82c833a5..72c4796c 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -63,6 +63,7 @@ Switching views happens multiple ways. In some instances, it's automatic (clicki - `i` : Switches between disassembly and low-level il in graph view - `y` : Change type - [1248] : Change type directly to a data variable of the indicated widths + - `a` : Change the data type to an ASCII string - `d` : Switches between data variables of various widths - `r` : Change the data type to single ASCII character - `o` : Create a pointer data type -- cgit v1.3.1 From 0d81eb27c3ca11d00b76c942a9160e598a10fefb Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Sun, 20 Nov 2016 08:44:25 -0500 Subject: add link to recovery page to license troubleshooting --- docs/guide/troubleshooting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/guide/troubleshooting.md b/docs/guide/troubleshooting.md index 4f761cfd..a74ecb68 100644 --- a/docs/guide/troubleshooting.md +++ b/docs/guide/troubleshooting.md @@ -9,7 +9,7 @@ ## License Problems -- If experiencing problems with Windows UAC permissions during an update, the easiest fix is to completely un-install and re-download the latest installer. Preferences are saved outside the installation folder and are preserved, though you might want to remove your [license](/getting-started/index.html#license). +- If experiencing problems with Windows UAC permissions during an update, the easiest fix is to completely un-install and [recover][recover] the latest installer and license. Preferences are saved outside the installation folder and are preserved, though you might want to remove your [license](/getting-started/index.html#license). - If you need to change the email address on your license, contact [support]. ## Linux -- cgit v1.3.1 From 2421d9a6e6e86ff3f37056a68454b7437fb60860 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Mon, 2 Jan 2017 16:15:07 -0500 Subject: Manual merging with dev --- api-docs/source/conf.py | 8 +- binaryninjaapi.h | 2 + binaryninjacore.h | 3 + binaryview.cpp | 7 ++ docs/.s3_website.yaml | 3 + docs/getting-started.md | 1 + docs/guide/troubleshooting.md | 22 +++- platform.cpp | 9 ++ python/binaryview.py | 29 ++++- python/bntype.py | 18 +-- python/examples/nsf.py | 138 ++++++++++++++++++++++ python/lowlevelil.py | 267 +++++++++++++++++++++--------------------- 12 files changed, 354 insertions(+), 153 deletions(-) create mode 100644 docs/.s3_website.yaml create mode 100644 python/examples/nsf.py (limited to 'docs') diff --git a/api-docs/source/conf.py b/api-docs/source/conf.py index 42bcfb87..15e06045 100644 --- a/api-docs/source/conf.py +++ b/api-docs/source/conf.py @@ -121,7 +121,7 @@ exclude_patterns = [] # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # -# add_module_names = True +add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. @@ -211,7 +211,7 @@ html_static_path = ['_static'] # If false, no module index is generated. # -# html_domain_indices = True +html_domain_indices = True # If false, no index is generated. # @@ -219,11 +219,11 @@ html_static_path = ['_static'] # If true, the index is split into individual pages for each letter. # -# html_split_index = False +html_split_index = False # If true, links to the reST sources are added to the pages. # -# html_show_sourcelink = True +html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 6311271c..a918fc42 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -926,6 +926,7 @@ namespace BinaryNinja std::vector> GetSymbolsOfType(BNSymbolType type, uint64_t start, uint64_t len); void DefineAutoSymbol(Ref sym); + void DefineAutoSymbolAndVariableOrFunction(Ref platform, Ref sym, Ref type); void UndefineAutoSymbol(Ref sym); void DefineUserSymbol(Ref sym); @@ -2243,6 +2244,7 @@ namespace BinaryNinja Ref GetRelatedPlatform(Architecture* arch); void AddRelatedPlatform(Architecture* arch, Platform* platform); + Ref GetAssociatedPlatformByAddress(uint64_t& addr); }; class ScriptingOutputListener diff --git a/binaryninjacore.h b/binaryninjacore.h index ea81c388..b2ed7cd3 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -1877,6 +1877,8 @@ extern "C" BINARYNINJACOREAPI void BNDefineUserSymbol(BNBinaryView* view, BNSymbol* sym); BINARYNINJACOREAPI void BNUndefineUserSymbol(BNBinaryView* view, BNSymbol* sym); BINARYNINJACOREAPI void BNDefineImportedFunction(BNBinaryView* view, BNSymbol* importAddressSym, BNFunction* func); + BINARYNINJACOREAPI void BNDefineAutoSymbolAndVariableOrFunction(BNBinaryView* view, BNPlatform* platform, + BNSymbol* sym, BNType* type); BINARYNINJACOREAPI BNSymbol* BNImportedFunctionFromImportAddressSymbol(BNSymbol* sym, uint64_t addr); @@ -2135,6 +2137,7 @@ extern "C" BINARYNINJACOREAPI BNPlatform* BNGetRelatedPlatform(BNPlatform* platform, BNArchitecture* arch); BINARYNINJACOREAPI void BNAddRelatedPlatform(BNPlatform* platform, BNArchitecture* arch, BNPlatform* related); + BINARYNINJACOREAPI BNPlatform* BNGetAssociatedPlatformByAddress(BNPlatform* platform, uint64_t* addr); //Demangler BINARYNINJACOREAPI bool BNDemangleMS(BNArchitecture* arch, diff --git a/binaryview.cpp b/binaryview.cpp index ff19de18..cc6667c5 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -1156,6 +1156,13 @@ void BinaryView::DefineAutoSymbol(Ref sym) } +void BinaryView::DefineAutoSymbolAndVariableOrFunction(Ref platform, Ref sym, Ref type) +{ + BNDefineAutoSymbolAndVariableOrFunction(m_object, platform ? platform->GetObject() : nullptr, sym->GetObject(), + type ? type->GetObject() : nullptr); +} + + void BinaryView::UndefineAutoSymbol(Ref sym) { BNUndefineAutoSymbol(m_object, sym->GetObject()); diff --git a/docs/.s3_website.yaml b/docs/.s3_website.yaml new file mode 100644 index 00000000..02c4a996 --- /dev/null +++ b/docs/.s3_website.yaml @@ -0,0 +1,3 @@ +s3_bucket: docs.binary.ninja +site: ../site +s3_reduced_redundancy: True diff --git a/docs/getting-started.md b/docs/getting-started.md index 82c833a5..c78aa737 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -62,6 +62,7 @@ Switching views happens multiple ways. In some instances, it's automatic (clicki - `;` : Adds a comment - `i` : Switches between disassembly and low-level il in graph view - `y` : Change type + - `a` : Change the data type to an ASCII string - [1248] : Change type directly to a data variable of the indicated widths - `d` : Switches between data variables of various widths - `r` : Change the data type to single ASCII character diff --git a/docs/guide/troubleshooting.md b/docs/guide/troubleshooting.md index 68a4d328..a74ecb68 100644 --- a/docs/guide/troubleshooting.md +++ b/docs/guide/troubleshooting.md @@ -9,22 +9,36 @@ ## License Problems -- If experiencing problems with Windows UAC permissions during an update, the easiest fix is to completely un-install and re-download the latest installer. Preferences are saved outside the installation folder and are preserved, though you might want to remove your [license](/getting-started/index.html#license). +- If experiencing problems with Windows UAC permissions during an update, the easiest fix is to completely un-install and [recover][recover] the latest installer and license. Preferences are saved outside the installation folder and are preserved, though you might want to remove your [license](/getting-started/index.html#license). - If you need to change the email address on your license, contact [support]. -## Arch Linux +## Linux -Arch Linux is not an officially supported operating system, but many of our users have run it, and there are a few pitfalls to watch out for. +Given the diversity of Linux distributions, some work-arounds are required to run Binary Ninja on platforms that are not [officially supported][faq]. + +### Arch Linux - Install python2 from the [official repositories][archrepo] - Install the [libcurl-compat] library from AUR, and run Binary Ninja via `LD_PRELOAD=libcurl.so.3 ~/binaryninja/binaryninja` +### KDE + +To run Binary Ninja in a KDE based environment, set the `QT_PLUGIN_PATH` to the `QT` sub-folder: + +``` +cd ~/binaryninja +QT_PLUGIN_PATH=./qt ./binaryninja +``` + + ## API - - If the GUI launches but the license file is not valid, check that you're using the right version of Python. Only a 64-bit Python 2.7 is supported at this time. + - If the GUI launches but the license file is not valid when launched from the command-line, check that you're using the right version of Python. Only a 64-bit Python 2.7 is supported at this time. Additionally, the [personal][purchase] edition does not support headless operation. [known issues]: https://github.com/Vector35/binaryninja-api/issues?q=is%3Aissue [libcurl-compat]: https://aur.archlinux.org/packages/libcurl-compat/ [archrepo]: https://wiki.archlinux.org/index.php/Official_repositories [recover]: https://binary.ninja/recover.html [support]: https://binary.ninja/support.html +[faq]: https://binary.ninja/faq.html +[purchase]: https://binary.ninja/purchase.html diff --git a/platform.cpp b/platform.cpp index 9b4053db..7a6571cc 100644 --- a/platform.cpp +++ b/platform.cpp @@ -244,3 +244,12 @@ void Platform::AddRelatedPlatform(Architecture* arch, Platform* platform) { BNAddRelatedPlatform(m_object, arch->GetObject(), platform->GetObject()); } + + +Ref Platform::GetAssociatedPlatformByAddress(uint64_t& addr) +{ + BNPlatform* platform = BNGetAssociatedPlatformByAddress(m_object, &addr); + if (!platform) + return nullptr; + return new Platform(platform); +} diff --git a/python/binaryview.py b/python/binaryview.py index 7c85cd52..b4be159c 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -590,6 +590,16 @@ class BinaryView(object): @classmethod def set_default_session_data(cls, name, value): + """ + ```set_default_session_data``` saves a variable to the BinaryView. + :param name: name of the variable to be saved + :param value: value of the variable to be saved + + :Example: + >>> BinaryView.set_default_session_data("variable_name", "value") + >>> bv.session_data.variable_name + 'value' + """ _BinaryViewAssociatedDataStore.set_default(name, value) def __del__(self): @@ -1932,6 +1942,19 @@ class BinaryView(object): return basicblock.BasicBlock(self, block) def get_code_refs(self, addr, length=None): + """ + ``get_code_refs`` returns a list of ReferenceSource objects (xrefs or cross-references) that point to the provided virtual address. + + :param int addr: virtual address to query for references + :return: List of References for the given virtual address + :rtype: list(ReferenceSource) + :Example: + + >>> bv.get_code_refs(here) + [] + >>> + + """ count = ctypes.c_ulonglong(0) if length is None: refs = core.BNGetCodeReferences(self.handle, addr, count) @@ -3434,7 +3457,7 @@ class BinaryWriter(object): def write16(self, value): """ - ```` writes the lowest order two bytes from the integer ``value`` to the current offset, using internal endianness. + ``write16`` writes the lowest order two bytes from the integer ``value`` to the current offset, using internal endianness. :param int value: integer value to write. :return: boolean True on success, False on failure. @@ -3444,7 +3467,7 @@ class BinaryWriter(object): def write32(self, value): """ - ```` writes the lowest order four bytes from the integer ``value`` to the current offset, using internal endianness. + ``write32`` writes the lowest order four bytes from the integer ``value`` to the current offset, using internal endianness. :param int value: integer value to write. :return: boolean True on success, False on failure. @@ -3454,7 +3477,7 @@ class BinaryWriter(object): def write64(self, value): """ - ```` writes the lowest order eight bytes from the integer ``value`` to the current offset, using internal endianness. + ``write64`` writes the lowest order eight bytes from the integer ``value`` to the current offset, using internal endianness. :param int value: integer value to write. :return: boolean True on success, False on failure. diff --git a/python/bntype.py b/python/bntype.py index 9f070168..1822c5df 100644 --- a/python/bntype.py +++ b/python/bntype.py @@ -235,8 +235,8 @@ class Type(object): return Type(core.BNCreateBoolType()) @classmethod - def int(self, width, sign = True): - return Type(core.BNCreateIntegerType(width, sign)) + def int(self, width, sign = True, altname=""): + return Type(core.BNCreateIntegerType(width, sign, altname)) @classmethod def float(self, width): @@ -251,13 +251,13 @@ class Type(object): return Type(core.BNCreateUnknownType(unknown_type.handle)) @classmethod - def enumeration_type(self, arch, e, width = None): + def enumeration_type(self, arch, e, width=None): if width is None: width = arch.default_int_size return Type(core.BNCreateEnumerationType(e.handle, width)) @classmethod - def pointer(self, arch, t, const = False): + def pointer(self, arch, t, const=False): return Type(core.BNCreatePointerType(arch.handle, t.handle, const)) @classmethod @@ -265,7 +265,7 @@ class Type(object): return Type(core.BNCreateArrayType(t.handle, count)) @classmethod - def function(self, ret, params, calling_convention = None, variable_arguments = False): + def function(self, ret, params, calling_convention=None, variable_arguments=False): param_buf = (core.BNNameAndType * len(params))() for i in xrange(0, len(params)): if isinstance(params[i], Type): @@ -287,7 +287,7 @@ class Type(object): class UnknownType(object): - def __init__(self, handle = None): + def __init__(self, handle=None): if handle is None: self.handle = core.BNCreateUnknownType() else: @@ -324,7 +324,7 @@ class StructureMember(object): class Structure(object): - def __init__(self, handle = None): + def __init__(self, handle=None): if handle is None: self.handle = core.BNCreateStructure() else: @@ -416,7 +416,7 @@ class EnumerationMember(object): class Enumeration(object): - def __init__(self, handle = None): + def __init__(self, handle=None): if handle is None: self.handle = core.BNCreateEnumeration() else: @@ -472,7 +472,7 @@ class TypeParserResult(object): return "{types: %s, variables: %s, functions: %s}" % (self.types, self.variables, self.functions) -def preprocess_source(source, filename = None, include_dirs = []): +def preprocess_source(source, filename=None, include_dirs=[]): """ ``preprocess_source`` run the C preprocessor on the given source or source filename. diff --git a/python/examples/nsf.py b/python/examples/nsf.py new file mode 100644 index 00000000..9d4ebd5c --- /dev/null +++ b/python/examples/nsf.py @@ -0,0 +1,138 @@ +# Copyright (c) 2015-2016 Vector 35 LLC +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# +# Simple NSF file loader, primarily for analyzing: +# https://scarybeastsecurity.blogspot.com/2016/11/0day-exploit-compromising-linux-desktop.html +# + +from binaryninja import * +import struct +import traceback +import os + +class NSFView(BinaryView): + name = "NSF" + long_name = "Nintendo Sound Format" + + def __init__(self, data): + BinaryView.__init__(self, parent_view = data, file_metadata = data.file) + + @classmethod + def is_valid_for_data(self, data): + hdr = data.read(0, 128) + if len(hdr) < 128: + return False + if hdr[0:5] != "NESM\x1a": + return False + song_count = struct.unpack("B", hdr[6])[0] + if song_count < 1: + log_info("Appears to be an NSF, but no songs.") + return False + return True + + def init(self): + try: + hdr = self.parent_view.read(0, 128) + self.version = struct.unpack("B", hdr[5])[0] + self.song_count = struct.unpack("B", hdr[6])[0] + self.starting_song = struct.unpack("B", hdr[7])[0] + self.load_address = struct.unpack("{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_ADD, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_ADD, a.index, b.index, size=size, flags=flags) - def add_carry(self, size, a, b, flags = None): + def add_carry(self, size, a, b, flags=None): """ ``add_carry`` adds with carry expression ``a`` to expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -518,9 +518,9 @@ class LowLevelILFunction(object): :return: The expression ``adc.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_ADC, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_ADC, a.index, b.index, size=size, flags=flags) - def sub(self, size, a, b, flags = None): + def sub(self, size, a, b, flags=None): """ ``sub`` subtracts expression ``b`` from expression ``a`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -532,9 +532,9 @@ class LowLevelILFunction(object): :return: The expression ``sub.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_SUB, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_SUB, a.index, b.index, size=size, flags=flags) - def sub_borrow(self, size, a, b, flags = None): + def sub_borrow(self, size, a, b, flags=None): """ ``sub_borrow`` subtracts with borrow expression ``b`` from expression ``a`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -546,9 +546,9 @@ class LowLevelILFunction(object): :return: The expression ``sbc.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_SBB, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_SBB, a.index, b.index, size=size, flags=flags) - def and_expr(self, size, a, b, flags = None): + def and_expr(self, size, a, b, flags=None): """ ``and_expr`` bitwise and's expression ``a`` and expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -560,9 +560,9 @@ class LowLevelILFunction(object): :return: The expression ``and.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_AND, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_AND, a.index, b.index, size=size, flags=flags) - def or_expr(self, size, a, b, flags = None): + def or_expr(self, size, a, b, flags=None): """ ``or_expr`` bitwise or's expression ``a`` and expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -574,9 +574,9 @@ class LowLevelILFunction(object): :return: The expression ``or.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_OR, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_OR, a.index, b.index, size=size, flags=flags) - def xor_expr(self, size, a, b, flags = None): + def xor_expr(self, size, a, b, flags=None): """ ``xor_expr`` xor's expression ``a`` with expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -588,9 +588,9 @@ class LowLevelILFunction(object): :return: The expression ``xor.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_XOR, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_XOR, a.index, b.index, size=size, flags=flags) - def shift_left(self, size, a, b, flags = None): + def shift_left(self, size, a, b, flags=None): """ ``shift_left`` subtracts with borrow expression ``b`` from expression ``a`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -602,9 +602,9 @@ class LowLevelILFunction(object): :return: The expression ``lsl.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_LSL, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_LSL, a.index, b.index, size=size, flags=flags) - def logical_shift_right(self, size, a, b, flags = None): + def logical_shift_right(self, size, a, b, flags=None): """ ``logical_shift_right`` shifts logically right expression ``a`` by expression ``b`` potentially setting flags ``flags``and returning an expression of ``size`` bytes. @@ -616,9 +616,9 @@ class LowLevelILFunction(object): :return: The expression ``lsr.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_LSR, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_LSR, a.index, b.index, size=size, flags=flags) - def arith_shift_right(self, size, a, b, flags = None): + def arith_shift_right(self, size, a, b, flags=None): """ ``arith_shift_right`` shifts arithmatic right expression ``a`` by expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -630,9 +630,9 @@ class LowLevelILFunction(object): :return: The expression ``asr.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_ASR, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_ASR, a.index, b.index, size=size, flags=flags) - def rotate_left(self, size, a, b, flags = None): + def rotate_left(self, size, a, b, flags=None): """ ``rotate_left`` bitwise rotates left expression ``a`` by expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -644,9 +644,9 @@ class LowLevelILFunction(object): :return: The expression ``rol.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_ROL, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_ROL, a.index, b.index, size=size, flags=flags) - def rotate_left_carry(self, size, a, b, flags = None): + def rotate_left_carry(self, size, a, b, flags=None): """ ``rotate_left_carry`` bitwise rotates left with carry expression ``a`` by expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -658,9 +658,9 @@ class LowLevelILFunction(object): :return: The expression ``rcl.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.LLIL_RLC, a.index, b.index, size = size, flags = flags) + return self.expr(core.LLIL_RLC, a.index, b.index, size=size, flags=flags) - def rotate_right(self, size, a, b, flags = None): + def rotate_right(self, size, a, b, flags=None): """ ``rotate_right`` bitwise rotates right expression ``a`` by expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -672,9 +672,9 @@ class LowLevelILFunction(object): :return: The expression ``ror.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_ROR, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_ROR, a.index, b.index, size=size, flags=flags) - def rotate_right_carry(self, size, a, b, flags = None): + def rotate_right_carry(self, size, a, b, flags=None): """ ``rotate_right_carry`` bitwise rotates right with carry expression ``a`` by expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -686,9 +686,9 @@ class LowLevelILFunction(object): :return: The expression ``rcr.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_RRC, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_RRC, a.index, b.index, size=size, flags=flags) - def mult(self, size, a, b, flags = None): + def mult(self, size, a, b, flags=None): """ ``mult`` multiplies expression ``a`` by expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -700,9 +700,9 @@ class LowLevelILFunction(object): :return: The expression ``sbc.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_MUL, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_MUL, a.index, b.index, size=size, flags=flags) - def mult_double_prec_signed(self, size, a, b, flags = None): + def mult_double_prec_signed(self, size, a, b, flags=None): """ ``mult_double_prec_signed`` multiplies signed with double precision expression ``a`` by expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -714,9 +714,9 @@ class LowLevelILFunction(object): :return: The expression ``muls.dp.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_MULS_DP, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_MULS_DP, a.index, b.index, size=size, flags=flags) - def mult_double_prec_unsigned(self, size, a, b, flags = None): + def mult_double_prec_unsigned(self, size, a, b, flags=None): """ ``mult_double_prec_unsigned`` multiplies unsigned with double precision expression ``a`` by expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -728,9 +728,9 @@ class LowLevelILFunction(object): :return: The expression ``muls.dp.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_MULU_DP, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_MULU_DP, a.index, b.index, size=size, flags=flags) - def div_signed(self, size, a, b, flags = None): + def div_signed(self, size, a, b, flags=None): """ ``div_signed`` signed divide expression ``a`` by expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -742,9 +742,9 @@ class LowLevelILFunction(object): :return: The expression ``divs.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_DIVS, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_DIVS, a.index, b.index, size=size, flags=flags) - def div_double_prec_signed(self, size, hi, lo, b, flags = None): + def div_double_prec_signed(self, size, hi, lo, b, flags=None): """ ``div_double_prec_signed`` signed double precision divide using expression ``hi`` and expression ``lo`` as a single double precision register by expression ``b`` potentially setting flags ``flags`` and returning an @@ -758,9 +758,9 @@ class LowLevelILFunction(object): :return: The expression ``divs.dp.{}(hi:lo, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_DIVS_DP, hi.index, lo.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_DIVS_DP, hi.index, lo.index, b.index, size=size, flags=flags) - def div_unsigned(self, size, a, b, flags = None): + def div_unsigned(self, size, a, b, flags=None): """ ``div_unsigned`` unsigned divide expression ``a`` by expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -772,9 +772,9 @@ class LowLevelILFunction(object): :return: The expression ``divs.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_DIVS, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_DIVS, a.index, b.index, size=size, flags=flags) - def div_double_prec_unsigned(self, size, hi, lo, b, flags = None): + def div_double_prec_unsigned(self, size, hi, lo, b, flags=None): """ ``div_double_prec_unsigned`` unsigned double precision divide using expression ``hi`` and expression ``lo`` as a single double precision register by expression ``b`` potentially setting flags ``flags`` and returning an @@ -788,9 +788,9 @@ class LowLevelILFunction(object): :return: The expression ``divs.dp.{}(hi:lo, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_DIVS_DP, hi.index, lo.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_DIVS_DP, hi.index, lo.index, b.index, size=size, flags=flags) - def mod_signed(self, size, a, b, flags = None): + def mod_signed(self, size, a, b, flags=None): """ ``mod_signed`` signed modulus expression ``a`` by expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -802,9 +802,9 @@ class LowLevelILFunction(object): :return: The expression ``mods.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_MODS, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_MODS, a.index, b.index, size=size, flags=flags) - def mod_double_prec_signed(self, size, hi, lo, b, flags = None): + def mod_double_prec_signed(self, size, hi, lo, b, flags=None): """ ``mod_double_prec_signed`` signed double precision modulus using expression ``hi`` and expression ``lo`` as a single double precision register by expression ``b`` potentially setting flags ``flags`` and returning an expression @@ -818,9 +818,9 @@ class LowLevelILFunction(object): :return: The expression ``mods.dp.{}(hi:lo, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_MODS_DP, hi.index, lo.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_MODS_DP, hi.index, lo.index, b.index, size=size, flags=flags) - def mod_unsigned(self, size, a, b, flags = None): + def mod_unsigned(self, size, a, b, flags=None): """ ``mod_unsigned`` unsigned modulus expression ``a`` by expression ``b`` potentially setting flags ``flags`` and returning an expression of ``size`` bytes. @@ -832,9 +832,9 @@ class LowLevelILFunction(object): :return: The expression ``modu.{}(a, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_MODS, a.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_MODS, a.index, b.index, size=size, flags=flags) - def mod_double_prec_unsigned(self, size, hi, lo, b, flags = None): + def mod_double_prec_unsigned(self, size, hi, lo, b, flags=None): """ ``mod_double_prec_unsigned`` unsigned double precision modulus using expression ``hi`` and expression ``lo`` as a single double precision register by expression ``b`` potentially setting flags ``flags`` and returning an @@ -848,9 +848,9 @@ class LowLevelILFunction(object): :return: The expression ``modu.dp.{}(hi:lo, b)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_MODS_DP, hi.index, lo.index, b.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_MODS_DP, hi.index, lo.index, b.index, size=size, flags=flags) - def neg_expr(self, size, value, flags = None): + def neg_expr(self, size, value, flags=None): """ ``neg_expr`` two's complement sign negation of expression ``value`` of size ``size`` potentially setting flags @@ -860,9 +860,9 @@ class LowLevelILFunction(object): :return: The expression ``neg.{}(value)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_NEG, value.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_NEG, value.index, size=size, flags=flags) - def not_expr(self, size, value, flags = None): + def not_expr(self, size, value, flags=None): """ ``not_expr`` bitwise inverse of expression ``value`` of size ``size`` potentially setting flags @@ -872,29 +872,30 @@ class LowLevelILFunction(object): :return: The expression ``not.{}(value)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_NOT, value.index, size = size, flags = flags) + return self.expr(core.BNLowLevelILOperation.LLIL_NOT, value.index, size=size, flags=flags) - def sign_extend(self, size, value): + def sign_extend(self, size, value, flags=None): """ ``sign_extend`` two's complement sign-extends the expression in ``value`` to ``size`` bytes :param int size: the size of the result in bytes - :param LowLevelILExpr value: the expression to sign extend + :param LowLevelILExpr value: the expression to sign extn + :param str flags: optional, flags to set :return: The expression ``sx.(value)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_SX, value.index, size = size) + return self.expr(core.BNLowLevelILOperation.LLIL_SX, value.index, size=size, flags=flags) def zero_extend(self, size, value): """ - ``sign_extend`` zero-extends the expression in ``value`` to ``size`` bytes + ``zero_extend`` zero-extends the expression in ``value`` to ``size`` bytes :param int size: the size of the result in bytes :param LowLevelILExpr value: the expression to zero extend :return: The expression ``sx.(value)`` :rtype: LowLevelILExpr """ - return self.expr(core.BNLowLevelILOperation.LLIL_ZX, value.index, size = size) + return self.expr(core.BNLowLevelILOperation.LLIL_ZX, value.index, size=size) def jump(self, dest): """ -- cgit v1.3.1