summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--api-docs/Makefile3
-rw-r--r--api-docs/source/conf.py13
-rw-r--r--api-docs/source/old-index.rst (renamed from api-docs/source/index.rst)0
-rw-r--r--binaryninjaapi.cpp20
-rw-r--r--binaryninjaapi.h3
-rw-r--r--binaryninjacore.h3
-rw-r--r--docs/about/license.md82
-rw-r--r--docs/about/open-source.md2
-rw-r--r--docs/guide/interface.md2
-rw-r--r--docs/guide/troubleshooting.md6
-rw-r--r--python/__init__.py15
-rw-r--r--python/architecture.py4
-rw-r--r--python/basicblock.py4
-rw-r--r--python/binaryview.py8
-rw-r--r--python/examples/version_switcher.py34
-rw-r--r--python/function.py6
-rw-r--r--python/types.py14
-rw-r--r--python/update.py24
19 files changed, 218 insertions, 26 deletions
diff --git a/.gitignore b/.gitignore
index b2e5b79f..4c87edbd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,4 @@ api-docs/build/*
api-docs/source/binaryninja.*
*.pyc
api-docs/source/python.rst
+api-docs/source/index.rst
diff --git a/api-docs/Makefile b/api-docs/Makefile
index 4092950c..fe751410 100644
--- a/api-docs/Makefile
+++ b/api-docs/Makefile
@@ -6,6 +6,7 @@ SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
+SOURCEDIR = source
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
@@ -47,6 +48,8 @@ help:
.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*
+ rm $(SOURCEDIR)/binaryninja.*.rst
+ rm $(SOURCEDIR)/python.rst
.PHONY: html
html:
diff --git a/api-docs/source/conf.py b/api-docs/source/conf.py
index 379d6d7e..c87cb114 100644
--- a/api-docs/source/conf.py
+++ b/api-docs/source/conf.py
@@ -31,7 +31,7 @@ import binaryninja
def modulelist(modulename):
modules = inspect.getmembers(modulename, inspect.ismodule)
- return filter(lambda x: x[0] not in ("abc", "ctypes", "core", "struct", "sys", "_binaryninjacore", "traceback", "code", "enum", "json", "threading"), modules)
+ return filter(lambda x: x[0] not in ("abc", "ctypes", "core", "struct", "sys", "_binaryninjacore", "traceback", "code", "enum", "json", "threading", "startup", "associateddatastore"), modules)
def classlist(module):
@@ -43,7 +43,7 @@ def classlist(module):
def generaterst():
- pythonrst = open("python.rst", "w")
+ pythonrst = open("index.rst", "w")
pythonrst.write('''Binary Ninja Python API Documentation
=====================================
@@ -53,7 +53,7 @@ def generaterst():
''')
for modulename, module in modulelist(binaryninja):
- filename = 'binaryninja.{module}.rst'.format(module=modulename)
+ filename = 'binaryninja.{module}-module.rst'.format(module=modulename)
pythonrst.write(' {module} <{filename}>\n'.format(module=modulename, filename=filename))
modulefile = open(filename, "w")
modulefile.write('''{module} module
@@ -69,6 +69,11 @@ def generaterst():
modulefile.write('''\n.. toctree::
:maxdepth: 2\n''')
+
+ modulefile.write('''\n\n.. automodule:: binaryninja.{module}
+ :members:
+ :undoc-members:
+ :show-inheritance:'''.format(module=modulename))
modulefile.close()
pythonrst.write('''.. automodule:: binaryninja
@@ -125,7 +130,7 @@ source_suffix = '.rst'
# source_encoding = 'utf-8-sig'
# The master toctree document.
-master_doc = 'python'
+master_doc = 'index'
# General information about the project.
project = u'Binary Ninja API'
diff --git a/api-docs/source/index.rst b/api-docs/source/old-index.rst
index 355d6901..355d6901 100644
--- a/api-docs/source/index.rst
+++ b/api-docs/source/old-index.rst
diff --git a/binaryninjaapi.cpp b/binaryninjaapi.cpp
index 099f35eb..6b303bcd 100644
--- a/binaryninjaapi.cpp
+++ b/binaryninjaapi.cpp
@@ -122,6 +122,26 @@ string BinaryNinja::GetVersionString()
return result;
}
+string BinaryNinja::GetProduct()
+{
+ char* str = BNGetProduct();
+ string result = str;
+ BNFreeString(str);
+ return result;
+}
+
+string BinaryNinja::GetProductType()
+{
+ char* str = BNGetProductType();
+ string result = str;
+ BNFreeString(str);
+ return result;
+}
+
+int BinaryNinja::GetLicenseCount()
+{
+ return BNGetLicenseCount();
+}
uint32_t BinaryNinja::GetBuildId()
{
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 4f3a0275..370a9ae2 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -353,6 +353,9 @@ namespace BinaryNinja
std::string& output, std::string& errors, bool stdoutIsText=false, bool stderrIsText=true);
std::string GetVersionString();
+ std::string GetProduct();
+ std::string GetProductType();
+ int GetLicenseCount();
uint32_t GetBuildId();
bool AreAutoUpdatesEnabled();
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 7c4b6db0..b8531742 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -1237,6 +1237,9 @@ extern "C"
BINARYNINJACOREAPI uint32_t BNGetBuildId(void);
BINARYNINJACOREAPI bool BNIsLicenseValidated(void);
+ BINARYNINJACOREAPI char* BNGetProduct(void);
+ BINARYNINJACOREAPI char* BNGetProductType(void);
+ BINARYNINJACOREAPI int BNGetLicenseCount(void);
BINARYNINJACOREAPI void BNRegisterObjectDestructionCallbacks(BNObjectDestructionCallbacks* callbacks);
BINARYNINJACOREAPI void BNUnregisterObjectDestructionCallbacks(BNObjectDestructionCallbacks* callbacks);
diff --git a/docs/about/license.md b/docs/about/license.md
index fe1e65c6..0fdad2df 100644
--- a/docs/about/license.md
+++ b/docs/about/license.md
@@ -2,7 +2,7 @@
Binary Ninja comes in different versions. Depending on the terms under which you purchased it, a different license below may apply.
-## Personal License
+## Non-commercial / Student License (NAMED)
BINARY NINJA SOFTWARE LICENSE AGREEMENT
@@ -42,7 +42,7 @@ We will license Binary Ninja™, a software application (the “Software”), to
14. Choice of Law & Jurisdiction. This License will be governed solely by the internal laws of the State of Florida, without reference to such State’s principles of conflicts of law. The parties consent to the personal and exclusive jurisdiction of the federal and state courts in or for Brevard County, Florida.
-## Commercial License
+## Commercial License (NAMED)
BINARY NINJA SOFTWARE LICENSE AGREEMENT
@@ -80,6 +80,84 @@ We will license Binary Ninja™, a software application (the "Software"), to you
14. Choice of Law & Jurisdiction. This License will be governed solely by the internal laws of the State of Florida, without reference to such State’s principles of conflicts of law. The parties consent to the personal and exclusive jurisdiction of the federal and state courts in or for Brevard County, Florida.
+## Non-commercial / Student License (COMPUTER)
+
+BINARY NINJA SOFTWARE LICENSE AGREEMENT
+
+(Non-commercial Computer License)
+
+IMPORTANT! BE SURE TO CAREFULLY READ AND UNDERSTAND ALL OF THE TERMS SET FORTH IN THIS LICENSE AGREEMENT (”LICENSE”). BY CLICKING THE "I ACCEPT" BUTTON OR OTHERWISE ACCEPTING THIS LICENSE THROUGH AN ORDERING DOCUMENT THAT INCORPORATES THIS LICENSE, YOU AGREE TO FOLLOW AND BE BOUND BY THE TERMS AND CONDITIONS OF THIS LICENSE. IF YOU DO NOT AGREE TO ALL THE TERMS AND CONDITIONS IN THIS LICENSE, YOU MUST SELECT THE "I DECLINE" BUTTON AND MAY NOT USE THE SOFTWARE.
+
+This License is entered into by and between you (“you” or “your”) and Vector 35 LLC, a Florida limited liability company (“us,” “we” or “our”).
+
+We will license Binary Ninja™, a software application (the “Software”), to you under the mutual terms and conditions in this License. By installing the Software, you agree to be bound by the terms of this License. If you do not agree to the terms of this License, please do not install or attempt to use the Software.
+
+1. Non-Exclusive License Grant for Non-commercial Use. Under the terms of this License, the Software is licensed on a non-exclusive basis and is not sold. This License is for non- commercial purposes only. This means that you may not exercise any of the rights granted to you under this License in any manner that is intended for or directed toward commercial advantage or private monetary gain such as (a) activities undertaken for profit, or (b) activities intended to produce works, services, or data for commercial use, or (c) activities conducted, or funded, by a person or an entity engaged in the commercial use, application or exploitation of works similar to the Software. If you have any question regarding a particular use, please feel free to contact us regarding your particular circumstances. Please note, the Software under this non-commercial license is a different version than the standard version of Binary Ninja™. There is a fee to upgrade to the standard version of Binary Ninja™. This License grants you the rights to a computer license that allows a copy of the Software to be installed and used by you on a particular single computer you own (the “Designated Computer”) which Designated Computer may be used by any user as long as it is used for non-commercial purposes. In other words, you may install the Software only on one computer owned by you but you may allow multiple users to use the Software on such Designated Computer as long as the Designated Computer is the only physical computer running the Software at any time and it is used for non-commercial purposes. This License does not permit any concurrent use. If you will use the Software on any computers other than the Designated Computer that the application will be installed on, then you are required to obtain additional licenses for each such computer upon which the Software will be installed. If your needs require concurrent use, please contact us for alternative licensing arrangements. We reserve all rights not expressly granted in this License.
+
+2. License Fee. Prices are subject to change without prior notice and the price of a License today does not guarantee a similar price in the future.
+
+3. Termination. Your license to the Software automatically terminates if you fail to comply with the terms of this License. Upon termination of this License, all licenses granted in Section 1 will terminate and you are required to stop using the Software and delete all copies in your possession or control. The following provisions will survive termination of this License: (i) your obligation to pay for services rendered before termination; (ii) Sections 6 through 14; and (iii) any other provision of this License that must survive termination to fulfill its essential purpose.
+
+4. Modification and Upgrades. We may, from time to time, and in certain cases for a fee, replace, modify or upgrade the Software. The license fee includes one year of free upgrades. When accepted by you, any such replacement or modified Software code or upgrade to the Software will be considered part of the Software and subject to the terms of this License (unless this License is superseded by a further License accompanying such replacement or modified version of or upgrade to the Software).
+
+5. Restrictions. Subject to applicable copyright, trade secret and other laws, you are permitted under this License to reverse engineer or de-compile the Software but you may not alter, duplicate, modify, rent, lease, loan, sublicense, create derivative works from or provide others with the Software in whole or part, or transmit or communicate any of the Software over a network in order to share it with others. These restrictions include prohibitions on the use the Software for service bureau or time-sharing purposes or in any other way allow third parties to exploit the Software. Time-sharing means sharing the Software with customers or other third parties and permitting their use of the Software. Service bureau involves your use of the Software on behalf of third parties, instead of your own use. It is your responsibility to determine if your use of the Software is in compliance with applicable laws.
+
+6. Export Restrictions. You must use the Software in accordance with export laws and this means that you may not export, ship, transmit or re-export the Software, in whole or in part, in violation of any applicable law or regulation including but not limited to applicable export administration regulations issued by the U.S. Department of Commerce.
+
+7. Disclaimer of Warranties. The Software is provided "as is" which means that we are providing no warranty of any kind. WE MAKE NO WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. We do not warrant that the Software will perform without error or that it will run without interruption.
+
+8. Limitation of Liability. IN NO EVENT WILL OUR LIABILITY ARISING OUT OF OR RELATED TO THIS LICENSE EXCEED THE AGGREGATE OF FEES PAYABLE TO US UNDER THIS LICENSE (INCLUDING FEES BOTH PAID AND DUE) AT THE TIME OF THE EVENT GIVING RISE TO THE LIABILITY. IN NO EVENT WILL WE BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT, SPECIAL, INCIDENTAL, OR PUNITIVE DAMAGES. THE LIABILITIES LIMITED BY THIS SECTION 8 APPLY: (A) TO LIABILITY FOR NEGLIGENCE; (B) REGARDLESS OF THE FORM OF ACTION, WHETHER IN CONTRACT, TORT, STRICT PRODUCT LIABILITY, OR OTHERWISE; (C) EVEN IF WE ARE ADVISED IN ADVANCE OF THE POSSIBILITY OF THE DAMAGES IN QUESTION AND EVEN IF SUCH DAMAGES WERE FORESEEABLE; AND (D) EVEN IF YOUR REMEDIES FAIL OF THEIR ESSENTIAL PURPOSE. If applicable law limits the application of the provisions of this Section 8, our liability will be limited to the maximum extent permissible.
+
+9. Severability. To the extent permitted by law, we waive and you waive any provision of law that would render any clause of this License invalid or otherwise unenforceable in any respect. In the event that a provision of this License is held to be invalid or otherwise unenforceable, such provision will be interpreted to fulfill its intended purpose to the maximum extent permitted by applicable law, and the remaining provisions of this License will continue in full force and effect.
+
+10. Independent Contractors. We are not your agent and you are not our agent and so neither party may bind the other in any way. The parties are independent contractors and will represent themselves in all regards as independent contractors.
+
+11. No Waiver. Neither party will be deemed to have waived any of its rights under this License by lapse of time or by any statement or representation other than in an explicit written waiver. No waiver of a breach of this License will constitute a waiver of any prior or subsequent breach of this License.
+
+12. Force Majeure. To the extent caused by force majeure, no delay, failure, or default will constitute a breach of this License.
+
+13. Assignment & Successors. Neither party may assign this License or any of its rights or obligations hereunder without the other’s express written consent, except that either party may assign this License to the surviving party in a merger of that party into another entity. Except to the extent forbidden in the previous sentence, this License will be binding upon and inure to the benefit of the respective successors and assigns of the parties.
+
+14. Choice of Law & Jurisdiction. This License will be governed solely by the internal laws of the State of Florida, without reference to such State’s principles of conflicts of law. The parties consent to the personal and exclusive jurisdiction of the federal and state courts in or for Brevard County, Florida.
+
+## Commercial License (COMPUTER)
+
+BINARY NINJA SOFTWARE LICENSE AGREEMENT
+
+IMPORTANT! BE SURE TO CAREFULLY READ AND UNDERSTAND ALL OF THE TERMS SET FORTH IN THIS LICENSE AGREEMENT ("LICENSE"). BY CLICKING THE "I ACCEPT" BUTTON OR OTHERWISE ACCEPTING THIS LICENSE THROUGH AN ORDERING DOCUMENT THAT INCORPORATES THIS LICENSE, YOU AGREE TO FOLLOW AND BE BOUND BY THE TERMS AND CONDITIONS OF THIS LICENSE. IF YOU ARE ENTERING INTO THIS LICENSE ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE AUTHORITY TO BIND SUCH ENTITY TO THE TERMS AND CONDITIONS OF THIS LICENSE AND, IN SUCH EVENT, "YOU" AND "YOUR" AS USED IN THIS LICENSE SHALL REFER TO SUCH ENTITY, IF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT AGREE TO ALL THE TERMS AND CONDITIONS IN THIS LICENSE, YOU MUST SELECT THE "I DECLINE" BUTTON AND MAY NOT USE THE SOFTWARE.
+
+This License is entered into by and between you ("you" or "your") and Vector 35 LLC, a Florida limited liability company ("us", "we" or "our").
+
+We will license Binary Ninja™, a software application (the "Software"), to you under the mutual terms and conditions in this License. By installing the Software, you agree to be bound by the terms of this License. If you do not agree to the terms of this License, please do not install or attempt to use the Software.
+
+1. Non-Exclusive License Grant. Under the terms of this License, the Software is licensed on a non-exclusive basis and is not sold. You receive no title to or ownership of the Software itself. This License grants you the rights to a computer license that allows a copy of the Software to be installed and used by you on a particular single computer you own (the “Designated Computer”) which Designated Computer may be used by any user. In other words, you may install the Software only on one computer owned by you but you may allow multiple users to use the Software on such Designated Computer as long as the Designated Computer is the only physical computer running the Software at any time. This License does not permit any concurrent use. If you will use the Software on any computers other than the Designated Computer that the application will be installed on, then you are required to obtain additional licenses for each such computer upon which the Software will be installed. If your needs require concurrent use, please contact us for alternative licensing arrangements. All rights not expressly granted herein reserved by us.
+
+2. License Fee. Prices are subject to change without prior notice and the price of a License today does not guarantee a similar price in the future.
+
+3. Termination. Your license to the Software automatically terminates if you fail to comply with the terms of this License. Upon termination of this License, all licenses granted in Section 1 will terminate and you are required to stop using the Software and delete all copies in your possession or control. The following provisions will survive termination of this License: (i) your obligation to pay for services rendered before termination; (ii) Sections 6 through 14; and (iii) any other provision of this License that must survive termination to fulfill its essential purpose.
+
+4. Modification and Upgrades. We may, from time to time, and in certain cases for a fee, replace, modify or upgrade the Software. The license fee includes one year of free upgrades. When accepted by you, any such replacement or modified Software code or upgrade to the Software will be considered part of the Software and subject to the terms of this License (unless this License is superseded by a further License accompanying such replacement or modified version of or upgrade to the Software).
+
+5. Restrictions. Subject to applicable copyright, trade secret and other laws, you are permitted under this License to reverse engineer or de-compile the Software but you may not alter, duplicate, modify, rent, lease, loan, sublicense, create derivative works from or provide others with the Software in whole or part, or transmit or communicate any of the Software over a network in order to share it with others. These restrictions include prohibitions on the use the Software for service bureau or time-sharing purposes or in any other way allow third parties to exploit the Software. Time-sharing means sharing the Software with customers or other third parties and permitting their use of the Software. Service bureau involves your use of the Software on behalf of third parties, instead of your own use. It is your responsibility to determine if your use of the Software is in compliance with applicable laws.
+
+6. Export Restrictions. You must use the Software in accordance with export laws and this means that you may not export, ship, transmit or re-export the Software, in whole or in part, in violation of any applicable law or regulation including but not limited to applicable export administration regulations issued by the U.S. Department of Commerce.
+
+7. Disclaimer of Warranties. The Software is provided "as is" which means that we are providing no warranty of any kind. WE MAKE NO WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. We do not warrant that the Software will perform without error or that it will run without interruption.
+
+8. Limitation of Liability. IN NO EVENT WILL OUR LIABILITY ARISING OUT OF OR RELATED TO THIS LICENSE EXCEED THE AGGREGATE OF FEES PAYABLE TO US UNDER THIS LICENSE (INCLUDING FEES BOTH PAID AND DUE) AT THE TIME OF THE EVENT GIVING RISE TO THE LIABILITY. IN NO EVENT WILL WE BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT, SPECIAL, INCIDENTAL, OR PUNITIVE DAMAGES. THE LIABILITIES LIMITED BY THIS SECTION 8 APPLY: (A) TO LIABILITY FOR NEGLIGENCE; (B) REGARDLESS OF THE FORM OF ACTION, WHETHER IN CONTRACT, TORT, STRICT PRODUCT LIABILITY, OR OTHERWISE; (C) EVEN IF WE ARE ADVISED IN ADVANCE OF THE POSSIBILITY OF THE DAMAGES IN QUESTION AND EVEN IF SUCH DAMAGES WERE FORESEEABLE; AND (D) EVEN IF YOUR REMEDIES FAIL OF THEIR ESSENTIAL PURPOSE. If applicable law limits the application of the provisions of this Section 8, our liability will be limited to the maximum extent permissible.
+
+9. Severability. To the extent permitted by law, we waive and you waive any provision of law that would render any clause of this License invalid or otherwise unenforceable in any respect. In the event that a provision of this License is held to be invalid or otherwise unenforceable, such provision will be interpreted to fulfill its intended purpose to the maximum extent permitted by applicable law, and the remaining provisions of this License will continue in full force and effect.
+
+10. Independent Contractors. We are not your agent and you are not our agent and so neither party may bind the other in any way. The parties are independent contractors and will represent themselves in all regards as independent contractors.
+
+11. No Waiver. Neither party will be deemed to have waived any of its rights under this License by lapse of time or by any statement or representation other than in an explicit written waiver. No waiver of a breach of this License will constitute a waiver of any prior or subsequent breach of this License.
+
+12. Force Majeure. To the extent caused by force majeure, no delay, failure, or default will constitute a breach of this License.
+
+13. Assignment & Successors. Neither party may assign this License or any of its rights or obligations hereunder without the other’s express written consent, except that either party may assign this License to the surviving party in a merger of that party into another entity. Except to the extent forbidden in the previous sentence, this License will be binding upon and inure to the benefit of the respective successors and assigns of the parties.
+
+14. Choice of Law & Jurisdiction. This License will be governed solely by the internal laws of the State of Florida, without reference to such State’s principles of conflicts of law. The parties consent to the personal and exclusive jurisdiction of the federal and state courts in or for Brevard County, Florida.
+
## Demo License
BINARY NINJA™ TRIAL PERIOD SOFTWARE DEMONSTRATION LICENSE AGREEMENT
diff --git a/docs/about/open-source.md b/docs/about/open-source.md
index dcebbfa5..f884b0b7 100644
--- a/docs/about/open-source.md
+++ b/docs/about/open-source.md
@@ -31,7 +31,7 @@ The previous tools are used in the generation of our documentation, but are not
* Other
- [yasm] ([yasm license] - 2-clause BSD)
-* Upvector update Library
+* Upvector update library
- [tomcrypt] ([tomcrypt license] - public domain)
diff --git a/docs/guide/interface.md b/docs/guide/interface.md
index 460b8df3..74bf141c 100644
--- a/docs/guide/interface.md
+++ b/docs/guide/interface.md
@@ -2,6 +2,8 @@
## UI
+### Zoom
+You can change the zoom of level of the graph view by holding CTRL and scrolling with the mouse.
## Views
diff --git a/docs/guide/troubleshooting.md b/docs/guide/troubleshooting.md
index a74ecb68..af91f6f1 100644
--- a/docs/guide/troubleshooting.md
+++ b/docs/guide/troubleshooting.md
@@ -7,6 +7,12 @@
- Did you read all the items on this page?
- Then you should contact [support]!
+## Bug Reproduction
+Running Binary Ninja with debug logging will make your bug report more useful.
+```
+./binaryninja --debug --stderr-log
+```
+
## License Problems
- 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).
diff --git a/python/__init__.py b/python/__init__.py
index 9b87aa47..b1f5cd08 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -48,6 +48,9 @@ from .scriptingprovider import *
def shutdown():
+ """
+ ``shutdown`` cleanly shuts down the core, stopping all workers and closing all log files.
+ """
core.BNShutdown()
@@ -80,4 +83,16 @@ bundled_plugin_path = core.BNGetBundledPluginDirectory()
user_plugin_path = core.BNGetUserPluginDirectory()
core_version = core.BNGetVersionString()
+'''Core version'''
+
core_build_id = core.BNGetBuildId()
+'''Build ID'''
+
+core_product = core.BNGetProduct()
+'''Product string from the license file'''
+
+core_product_type = core.BNGetProductType()
+'''Product type from the license file'''
+
+core_license_count = core.BNGetLicenseCount()
+'''License count from the license file'''
diff --git a/python/architecture.py b/python/architecture.py
index 4cd0c597..5bafe949 100644
--- a/python/architecture.py
+++ b/python/architecture.py
@@ -1164,8 +1164,8 @@ class Architecture(object):
def get_instruction_low_level_il(self, data, addr, il):
"""
- ``get_instruction_low_level_il`` appends LowLevelILExpr objects for the instruction at the given virtual
- address ``addr`` with data ``data``.
+ ``get_instruction_low_level_il`` appends LowLevelILExpr objects to ``il`` for the instruction at the given
+ virtual address ``addr`` with data ``data``.
:param str data: max_instruction_length bytes from the binary at virtual address ``addr``
:param int addr: virtual address of bytes in ``data``
diff --git a/python/basicblock.py b/python/basicblock.py
index ffbcd217..f6dbd60d 100644
--- a/python/basicblock.py
+++ b/python/basicblock.py
@@ -217,6 +217,8 @@ class BasicBlock(object):
"""
if not isinstance(color, HighlightStandardColor) and not isinstance(color, highlight.HighlightColor):
raise ValueError("Specified color is not one of HighlightStandardColor, highlight.HighlightColor")
+ if isinstance(color, HighlightStandardColor):
+ color = highlight.HighlightColor(color)
core.BNSetAutoBasicBlockHighlight(self.handle, color._get_core_struct())
def set_user_highlight(self, color):
@@ -231,4 +233,6 @@ class BasicBlock(object):
"""
if not isinstance(color, HighlightStandardColor) and not isinstance(color, highlight.HighlightColor):
raise ValueError("Specified color is not one of HighlightStandardColor, highlight.HighlightColor")
+ if isinstance(color, HighlightStandardColor):
+ color = highlight.HighlightColor(color)
core.BNSetUserBasicBlockHighlight(self.handle, color._get_core_struct())
diff --git a/python/binaryview.py b/python/binaryview.py
index caa5d780..9753b653 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -348,7 +348,11 @@ class BinaryViewType(object):
return None
for available in view.available_view_types:
if available.name != "Raw":
- bv = cls[available.name].open(filename)
+ if filename.endswith(".bndb"):
+ bv = view.get_view_of_type(available.name)
+ else:
+ bv = cls[available.name].open(filename)
+
if update_analysis:
bv.update_analysis_and_wait()
return bv
@@ -1952,7 +1956,7 @@ class BinaryView(object):
def get_basic_blocks_starting_at(self, addr):
"""
- ``get_basic_blocks_at`` get a list of :py:Class:`BasicBlock` objects which start at the provided virtual address.
+ ``get_basic_blocks_starting_at`` get a list of :py:Class:`BasicBlock` objects which start at the provided virtual address.
:param int addr: virtual address of BasicBlock desired
:return: a list of :py:Class:`BasicBlock` objects
diff --git a/python/examples/version_switcher.py b/python/examples/version_switcher.py
index bc4f576c..9d5bbf05 100644
--- a/python/examples/version_switcher.py
+++ b/python/examples/version_switcher.py
@@ -20,10 +20,12 @@
# IN THE SOFTWARE.
import sys
-import binaryninja
+
+from binaryninja.update import UpdateChannel, are_auto_updates_enabled, set_auto_updates_enabled, is_update_installation_pending, install_pending_update
+from binaryninja import core_version
import datetime
-chandefault = binaryninja.UpdateChannel.list[0].name
+chandefault = UpdateChannel.list[0].name
channel = None
versions = []
@@ -31,17 +33,17 @@ versions = []
def load_channel(newchannel):
global channel
global versions
- if (channel is None and newchannel == channel.name):
+ if (channel is not None and newchannel == channel.name):
print "Same channel, not updating."
else:
try:
print "Loading channel %s" % newchannel
- channel = binaryninja.UpdateChannel[newchannel]
+ channel = UpdateChannel[newchannel]
print "Loading versions..."
versions = channel.versions
except Exception:
print "%s is not a valid channel name. Defaulting to " % chandefault
- channel = binaryninja.UpdateChannel[chandefault]
+ channel = UpdateChannel[chandefault]
def select(version):
@@ -66,16 +68,20 @@ def select(version):
print "Requesting update to latest version."
else:
print "Requesting update to prior version."
- if binaryninja.are_auto_updates_enabled():
+ if are_auto_updates_enabled():
print "Disabling automatic updates."
- binaryninja.set_auto_updates_enabled(False)
- if (version.version == binaryninja.core_version):
+ set_auto_updates_enabled(False)
+ if (version.version == core_version):
print "Already running %s" % version.version
else:
print "version.version %s" % version.version
- print "binaryninja.core_version %s" % binaryninja.core_version
- print "Updating..."
+ print "core_version %s" % core_version
+ print "Downloading..."
print version.update()
+ print "Installing..."
+ if is_update_installation_pending:
+ #note that the GUI will be launched after update but should still do the upgrade headless
+ install_pending_update()
# forward updating won't work without reloading
sys.exit()
else:
@@ -86,7 +92,7 @@ def list_channels():
done = False
print "\tSelect channel:\n"
while not done:
- channel_list = binaryninja.UpdateChannel.list
+ channel_list = UpdateChannel.list
for index, item in enumerate(channel_list):
print "\t%d)\t%s" % (index + 1, item.name)
print "\t%d)\t%s" % (len(channel_list) + 1, "Main Menu")
@@ -104,7 +110,7 @@ def list_channels():
def toggle_updates():
- binaryninja.set_auto_updates_enabled(not binaryninja.are_auto_updates_enabled())
+ set_auto_updates_enabled(not are_auto_updates_enabled())
def main():
@@ -114,8 +120,8 @@ def main():
while not done:
print "\n\tBinary Ninja Version Switcher"
print "\t\tCurrent Channel:\t%s" % channel.name
- print "\t\tCurrent Version:\t%s" % binaryninja.core_version
- print "\t\tAuto-Updates On:\t%s\n" % binaryninja.are_auto_updates_enabled()
+ print "\t\tCurrent Version:\t%s" % core_version
+ print "\t\tAuto-Updates On:\t%s\n" % are_auto_updates_enabled()
for index, version in enumerate(versions):
date = datetime.datetime.fromtimestamp(version.time).strftime('%c')
print "\t%d)\t%s (%s)" % (index + 1, version.version, date)
diff --git a/python/function.py b/python/function.py
index 5f9f475a..3aeb8e22 100644
--- a/python/function.py
+++ b/python/function.py
@@ -766,7 +766,9 @@ class Function(object):
"""
if arch is None:
arch = self.arch
- if not isinstance(color, highlight.HighlightColor):
+ if not isinstance(color, HighlightStandardColor) and not isinstance(color, highlight.HighlightColor):
+ raise ValueError("Specified color is not one of HighlightStandardColor, highlight.HighlightColor")
+ if isinstance(color, HighlightStandardColor):
color = highlight.HighlightColor(color = color)
core.BNSetAutoInstructionHighlight(self.handle, arch.handle, addr, color._get_core_struct())
@@ -786,6 +788,8 @@ class Function(object):
arch = self.arch
if not isinstance(color, HighlightStandardColor) and not isinstance(color, highlight.HighlightColor):
raise ValueError("Specified color is not one of HighlightStandardColor, highlight.HighlightColor")
+ if isinstance(color, HighlightStandardColor):
+ color = highlight.HighlightColor(color)
core.BNSetUserInstructionHighlight(self.handle, arch.handle, addr, color._get_core_struct())
diff --git a/python/types.py b/python/types.py
index f66625f8..43aaa66f 100644
--- a/python/types.py
+++ b/python/types.py
@@ -378,6 +378,12 @@ class Type(object):
@classmethod
def int(self, width, sign = True, altname=""):
+ """
+ ``int`` class method for creating an int Type.
+
+ :param int width: width of the integer in bytes
+ :param bool sign: optional variable representing signedness
+ """
return Type(core.BNCreateIntegerType(width, sign, altname))
@classmethod
@@ -427,6 +433,14 @@ class Type(object):
@classmethod
def function(self, ret, params, calling_convention=None, variable_arguments=False):
+ """
+ ``function`` class method for creating an function Type.
+
+ :param Type ret: width of the integer in bytes
+ :param list(Type) params: list of parameter Types
+ :param CallingConvention calling_convention: optional argument for function calling convention
+ :param bool variable_arguments: optional argument for functions that have a variable number of arguments
+ """
param_buf = (core.BNNameAndType * len(params))()
for i in xrange(0, len(params)):
if isinstance(params[i], Type):
diff --git a/python/update.py b/python/update.py
index 7e2bd4ef..6417e4a0 100644
--- a/python/update.py
+++ b/python/update.py
@@ -238,5 +238,29 @@ def get_time_since_last_update_check():
return core.BNGetTimeSinceLastUpdateCheck()
+def is_update_installation_pending():
+ """
+ ``is_update_installation_pending`` whether an update has been downloaded and is waiting installation
+
+ :return: boolean True if an update is pending, false if no update is pending
+ :rtype: bool
+ """
+ return core.BNIsUpdateInstallationPending()
+
+
+def install_pending_update():
+ """
+ ``install_pending_update`` installs any pending updates
+
+ :rtype: None
+ """
+ errors = ctypes.c_char_p()
+ core.BNInstallPendingUpdate(errors)
+ if errors:
+ error_str = errors.value
+ core.BNFreeString(ctypes.cast(errors, ctypes.POINTER(ctypes.c_byte)))
+ raise IOError(error_str)
+
+
def updates_checked():
core.BNUpdatesChecked()