Exemplo n.º 1
0
Arquivo: thread.py Projeto: zc0nf/POST
 def run(self):
     self.server = nntp.NNTP(**self.credentials)
     try:
         while True:
             if self.stop:
                 self.server.quit()
                 return
             
             # Try to grab a segment from queue
             f, segment, bytes = self.segments.get(False)
             
             # Check for the article on the server
             try:
                 self.server.stat(segment)
                 #print "Found: %s" % segment
             except nntplib.NNTPTemporaryError, e:
                 # Error code 430 is "No such article"
                 error = nntp.get_error_code(e)
                 if error == '430':
                     # Found missing segment                    
                     self.missing.put((f, segment, bytes))
                     self.missing.task_done()
                     #print "Missing: %s" % segment
                 else:
                     # Some other error, put the segment back in the
                     # queue to be checked again
                     print "Error: %s" % e
                     self.segments.put(segment)
             except Exception, e:
                 print "Unknown error: %s" % e
                 return
Exemplo n.º 2
0
    def init_and_stat(self, msg):
        self.tn = nntp.NNTP(self.conf['host'], 443, self.conf['user'],
                            self.conf['pass'], True)
        #~ print self.tn.welcome
        self.stat_all(msg)

        try:
            self.tn.quit()
        except Exception as e:
            #~ print "Error disconnecting: "  + " %s" % e,
            print "d",

        if (self.idx == self.conf['connections'] - 1):
            with lock:
                global completion_counter_allout
                completion_counter_allout = self.idx
Exemplo n.º 3
0
def _init_worker(nntp_credentials):
    WORKERS[threading.current_thread()] = nntp.NNTP(
        nntp_credentials['host'], nntp_credentials['port'],
        nntp_credentials['username'], nntp_credentials['password'],
        nntp_credentials['use_ssl'])
Exemplo n.º 4
0
 def create_connection(self):
     return nntp.NNTP(self.host, self.conf.get("port"),
                      self.conf.get("user"), self.conf.get("password"),
                      self.conf.get("use_ssl"), self.conf.get("timeout"))