()
| 115 | |
| 116 | |
| 117 | def main(): |
| 118 | global channel |
| 119 | done = False |
| 120 | load_channel(chandefault) |
| 121 | while not done: |
| 122 | print("\n\tBinary Ninja Version Switcher") |
| 123 | print("\t\tCurrent Install:\t%s" % get_install_directory()) |
| 124 | print("\t\tCurrent User Path:\t%s" % user_directory()) |
| 125 | print("\t\tCurrent Channel:\t%s" % channel.name) |
| 126 | print("\t\tCurrent Version:\t%s" % core_version_info()) |
| 127 | print("\t\tAuto-Updates On:\t%s\n" % are_auto_updates_enabled()) |
| 128 | for index, version in enumerate(versions): |
| 129 | date = datetime.datetime.fromtimestamp(version.time).strftime('%c') |
| 130 | print("\t%d)\t%s (%s)" % (index + 1, version.version, date)) |
| 131 | print("\t%d)\t%s" % (len(versions) + 1, "Switch Channel")) |
| 132 | print("\t%d)\t%s" % (len(versions) + 2, "Toggle Auto Updates")) |
| 133 | print("\t%d)\t%s" % (len(versions) + 3, "Exit")) |
| 134 | selection = input('Choice: ') |
| 135 | if selection.isdigit(): |
| 136 | selection = int(selection) |
| 137 | else: |
| 138 | selection = 0 |
| 139 | if (selection <= 0 or selection > len(versions) + 3): |
| 140 | print("%d is an invalid choice.\n\n" % selection) |
| 141 | else: |
| 142 | if (selection == len(versions) + 3): |
| 143 | done = True |
| 144 | elif (selection == len(versions) + 2): |
| 145 | toggle_updates() |
| 146 | elif (selection == len(versions) + 1): |
| 147 | list_channels() |
| 148 | else: |
| 149 | select(versions[selection - 1]) |
| 150 | |
| 151 | |
| 152 | if __name__ == "__main__": |
no test coverage detected