You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alert_user('Plugin downloaded successfully, please restart Binary Ninja to load it')
194
185
else:
195
-
# We don't have the latest version, alert user
196
-
alert_user(plugin_name, 'You are using outdated version of this plugin and it must be updated manually\n1. download the latest version from {}\n2. close Binary Ninja\n3. replace the outdated plugin with the newly downloaded file in {}'.format(file_url, binaryninja.user_plugin_path()))
197
-
# Plugin installed, but data shows it's outdated
198
-
elif (data_version!=latest_version):
199
-
# Make sure the version in the data directory is actually the version we have installed (we compare hashes - hash now and hash when we downloaded the plugin)
200
-
if (data_hash==calculate_hash(os.path.join(binaryninja.user_plugin_path(), file))):
201
-
# Yep, version noted in data corresponds to the hash of currently installed plugin
202
-
alert_user(plugin_name, 'You are using outdated version of this plugin and it must be updated manually\n1. download the latest version from {}\n2. close Binary Ninja\n3. replace the outdated plugin with the newly downloaded file in {}'.format(file_url, binaryninja.user_plugin_path()))
203
-
else:
204
-
# Nope, version noted in data doesn't correspond to the hash of currently installed plugin (user probably replaced the plugin)
205
-
delete_data_file(plugin_name)
186
+
alert_user('Failed to download plugin')
187
+
else:
188
+
# Plugin installed, no data about the plugin
189
+
if (data_version==Noneanddata_hash==None):
206
190
# Download latest version of the plugin and check if we have that version
207
191
download_file_to_temp(file_url, file)
208
192
if (calculate_hash(os.path.join(binaryninja.user_plugin_path(), file)) ==calculate_hash(os.path.join(binaryninja.user_plugin_path(), 'temp', file))):
209
-
# We have the latest version, register it in data directory so user is not prompted to update as he probably already did
alert_user(plugin_name, 'You are using outdated version of this plugin and it must be updated manually\n1. download the latest version from {}\n2. close Binary Ninja\n3. replace the outdated plugin with the newly downloaded file in {}'.format(file_url, binaryninja.user_plugin_path()))
215
-
# Plugin installed, data shows it's up to date, but let's make sure
216
-
elif (data_version==latest_version):
217
-
# Make sure the version in the data directory is actually the version we have installed (we compare hashes - hash now and hash when we downloaded the plugin)
218
-
if (data_hash!=calculate_hash(os.path.join(binaryninja.user_plugin_path(), file))):
219
-
# Nope, hash noted in data doesn't correspond to the hash of currently installed plugin (user probably replaced the plugin with different version)
220
-
delete_data_file(plugin_name)
221
-
# Let's check if our plugin matches the hash in the latest github release (developer could have replaced file in the github release and user updated to it)
222
-
download_file_to_temp(file_url, file)
223
-
if (calculate_hash(os.path.join(binaryninja.user_plugin_path(), file)) ==calculate_hash(os.path.join(binaryninja.user_plugin_path(), 'temp', file))):
224
-
# Yep, hash of the plugin in the github release corresponds to the hash of currently installed plugin so we have the latest one
alert_user('You are using outdated version of this plugin and it must be updated manually\n1. download the latest version from {}\n2. close Binary Ninja\n3. replace the outdated plugin with the newly downloaded file in {}'.format(file_url, binaryninja.user_plugin_path()))
199
+
# Plugin installed, but data shows it's outdated
200
+
elif (data_version!=latest_version):
201
+
# Make sure the version in the data directory is actually the version we have installed (we compare hashes - hash now and hash when we downloaded the plugin)
202
+
if (data_hash==calculate_hash(os.path.join(binaryninja.user_plugin_path(), file))):
203
+
# Yep, version noted in data corresponds to the hash of currently installed plugin
204
+
alert_user('You are using outdated version of this plugin and it must be updated manually\n1. download the latest version from {}\n2. close Binary Ninja\n3. replace the outdated plugin with the newly downloaded file in {}'.format(file_url, binaryninja.user_plugin_path()))
227
205
else:
228
-
# Not the latest one (according to the hash in the github release), but user might be intending to test different version of the plugin, add ignore option
229
-
alert_user(plugin_name, 'You are using outdated version of this plugin and it must be updated manually\n1. download the latest version from {}\n2. close Binary Ninja\n3. replace the outdated plugin with the newly downloaded file in {}'.format(file_url, binaryninja.user_plugin_path()))
230
-
else:
231
-
alert_user(plugin_name, 'This plugin is not supported on current platform or plugin not found or its github releases not found')
206
+
# Nope, version noted in data doesn't correspond to the hash of currently installed plugin (user probably replaced the plugin)
207
+
delete_data_file()
208
+
# Download latest version of the plugin and check if we have that version
209
+
download_file_to_temp(file_url, file)
210
+
if (calculate_hash(os.path.join(binaryninja.user_plugin_path(), file)) ==calculate_hash(os.path.join(binaryninja.user_plugin_path(), 'temp', file))):
211
+
# We have the latest version, register it in data directory so user is not prompted to update as he probably already did
alert_user('You are using outdated version of this plugin and it must be updated manually\n1. download the latest version from {}\n2. close Binary Ninja\n3. replace the outdated plugin with the newly downloaded file in {}'.format(file_url, binaryninja.user_plugin_path()))
217
+
# Plugin installed, data shows it's up to date, but let's make sure
218
+
elif (data_version==latest_version):
219
+
# Make sure the version in the data directory is actually the version we have installed (we compare hashes - hash now and hash when we downloaded the plugin)
220
+
if (data_hash!=calculate_hash(os.path.join(binaryninja.user_plugin_path(), file))):
221
+
# Nope, hash noted in data doesn't correspond to the hash of currently installed plugin (user probably replaced the plugin with different version)
222
+
delete_data_file()
223
+
# Let's check if our plugin matches the hash in the latest github release (developer could have replaced file in the github release and user updated to it)
224
+
download_file_to_temp(file_url, file)
225
+
if (calculate_hash(os.path.join(binaryninja.user_plugin_path(), file)) ==calculate_hash(os.path.join(binaryninja.user_plugin_path(), 'temp', file))):
226
+
# Yep, hash of the plugin in the github release corresponds to the hash of currently installed plugin so we have the latest one
# Not the latest one (according to the hash in the github release), but user might be intending to test different version of the plugin, add ignore option
231
+
alert_user('You are using outdated version of this plugin and it must be updated manually\n1. download the latest version from {}\n2. close Binary Ninja\n3. replace the outdated plugin with the newly downloaded file in {}'.format(file_url, binaryninja.user_plugin_path()))
232
+
else:
233
+
alert_user('This plugin is not supported on current platform or plugin not found or its github releases not found')
234
+
235
+
classUpdater(binaryninja.BackgroundTaskThread):
236
+
def__init__(self):
237
+
binaryninja.BackgroundTaskThread.__init__(self, 'Native plugin loader - checking for updates on: {}'.format(plugin_name), True)
0 commit comments