예제 #1
0
 def check_for_updates(self, success_cb=None, failure_cb=None):
   """Send out a request to the web server to check the current version information
   Returns True so that it is rescheduled to be called again later.
   success_cb=what to do when we've gotten the current version info
   failure_cb=what to do if we fail to get the current version info"""
   try:
     if not success_cb:
       success_cb = self.update_request_done
     url = self.baseURL + "current_version.txt"
     def on_failure(failure, instance, failure_cb=failure_cb):
       log_ex(failure, "Failed while downloading current version document", [ConnectionDone])
       if failure_cb:
         failure_cb(failure, instance)
     #TODO:  go through a circuit if the user wants to be stealthy:
     BitBlinder.http_download(url, None, success_cb, on_failure)
   except Exception, e:
     log_ex(e, "Failed while attempting to get update document")
예제 #2
0
 def download_update(self, newVersionData):
   """Download the latest version of InnomiNet from the web server
   newVersion=the version to download"""
   self.newVersion = newVersionData[0]
   self.trueHash = newVersionData[1]
   self.updateString = newVersionData[2]
   if System.IS_WINDOWS:
     #if we're not already doing the update:
     if not self.downloadingUpdate:
       self.downloadingUpdate = True
       #baseURL += "BitBlinderUpdate-%s-%s.exe" % (Globals.VERSION, self.newVersion)
       fileName = "BitBlinderInstaller-%s.exe" % (self.newVersion)
       url = self.baseURL + fileName
       #TODO:  go through a circuit if the user wants to be stealthy:
       BitBlinder.http_download(url, None, self.request_done, self.request_failed, progressCB=self.progressCB, fileName=Globals.UPDATE_FILE_NAME+".download")
       GUIController.get().show_msgbox("BitBlinder found a new version (%s)!\n\nDownloading update now... (you can choose whether to restart later)" % (self.newVersion))
   else:
     #url = self.baseURL + "python-bitblinder_%s_%s.deb" % (self.newVersion, platform.machine())
     url = "%s/download/" % (ProgramState.Conf.BASE_HTTP)
     if ProgramState.USE_GTK:
       link = GTKUtils.make_html_link(url, url)
     else:
       link = url
     GUIController.get().show_msgbox("A new linux package is available!  Changes:\n\n%s\n\nGo download and install it from:" % (self.updateString), title="Update Available", link=link)
예제 #3
0
 def launch_test_download(self, widget, event=None):    
   test = None
   #get the selected item (either a Stream or Circuit)
   circ = self.getSelected()
   #if there was no selection or the selection was a stream, let BitBlinder pick the circuit
   if not circ or circ.__class__.__name__ != "Circuit":
     #TODO:  actually use the test URL/port here...
     circ = BitBlinder.get().find_or_build_best_circuit("", 80)
     #make sure there is a circuit:
     if not circ:
       log_msg("Failed to find an appropriate circuit", 1)
       return
   #make sure we dont try to attach to a close circuit
   if not circ.is_open():
     log_msg("Circuit %d is closed" % circ.id, 2)
     return
   
   def page_done(data, httpDownloadInstance):
     self.end_time = time.time()
     log_msg("Test downloaded " + str(len(data)) + " bytes", 2)
   test = BitBlinder.http_download(Globals.TEST_URL, circ, page_done)
예제 #4
0
    def launch_test_download(self, widget, event=None):
        test = None
        #get the selected item (either a Stream or Circuit)
        circ = self.getSelected()
        #if there was no selection or the selection was a stream, let BitBlinder pick the circuit
        if not circ or circ.__class__.__name__ != "Circuit":
            #TODO:  actually use the test URL/port here...
            circ = BitBlinder.get().find_or_build_best_circuit("", 80)
            #make sure there is a circuit:
            if not circ:
                log_msg("Failed to find an appropriate circuit", 1)
                return
        #make sure we dont try to attach to a close circuit
        if not circ.is_open():
            log_msg("Circuit %d is closed" % circ.id, 2)
            return

        def page_done(data, httpDownloadInstance):
            self.end_time = time.time()
            log_msg("Test downloaded " + str(len(data)) + " bytes", 2)

        test = BitBlinder.http_download(Globals.TEST_URL, circ, page_done)