summaryrefslogtreecommitdiff
path: root/python/examples/version_switcher.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2017-01-05 09:14:31 -0500
committerPeter LaFosse <peter@vector35.com>2017-01-05 09:14:31 -0500
commit4761ea9c83104b872d8d49fcde45f17d17e7872d (patch)
tree0acca0d74701a834c36f85aebd7dd9955ecbfb8f /python/examples/version_switcher.py
parent96acbed85902d8dfd43ef624afac72145ae6e577 (diff)
Modifying how enumerations are exposed and used, and a bunch of cleanup of existing plugins
Diffstat (limited to 'python/examples/version_switcher.py')
-rw-r--r--python/examples/version_switcher.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/python/examples/version_switcher.py b/python/examples/version_switcher.py
index e8f8814d..bc4f576c 100644
--- a/python/examples/version_switcher.py
+++ b/python/examples/version_switcher.py
@@ -27,10 +27,11 @@ chandefault = binaryninja.UpdateChannel.list[0].name
channel = None
versions = []
+
def load_channel(newchannel):
global channel
global versions
- if (channel != None and newchannel == channel.name):
+ if (channel is None and newchannel == channel.name):
print "Same channel, not updating."
else:
try:
@@ -42,6 +43,7 @@ def load_channel(newchannel):
print "%s is not a valid channel name. Defaulting to " % chandefault
channel = binaryninja.UpdateChannel[chandefault]
+
def select(version):
done = False
date = datetime.datetime.fromtimestamp(version.time).strftime('%c')
@@ -74,34 +76,37 @@ def select(version):
print "binaryninja.core_version %s" % binaryninja.core_version
print "Updating..."
print version.update()
- #forward updating won't work without reloading
+ # forward updating won't work without reloading
sys.exit()
else:
print "Invalid selection"
+
def list_channels():
done = False
print "\tSelect channel:\n"
while not done:
channel_list = binaryninja.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")
+ print "\t%d)\t%s" % (index + 1, item.name)
+ print "\t%d)\t%s" % (len(channel_list) + 1, "Main Menu")
selection = raw_input('Choice: ')
if selection.isdigit():
selection = int(selection)
else:
selection = 0
- if (selection <= 0 or selection > len(channel_list)+1):
+ if (selection <= 0 or selection > len(channel_list) + 1):
print "%s is an invalid choice." % selection
else:
done = True
if (selection != len(channel_list) + 1):
load_channel(channel_list[selection - 1].name)
+
def toggle_updates():
binaryninja.set_auto_updates_enabled(not binaryninja.are_auto_updates_enabled())
+
def main():
global channel
done = False