Projects STRLCPY linuxprivchecker Commits abecafd2
🤬
  • added print messages and a blank line to indicate the end.

  • Loading...
  • linted committed 7 years ago
    abecafd2
    1 parent 514633b9
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    privcheckerserver.py
    skipped 8 lines
    9 9   
    10 10  class SearchHandler(socketserver.StreamRequestHandler):
    11 11   def handle(self):
    12  - output = []
     12 + print('[+] Connection from '+ self.client_address[0])
    13 13   data = self.rfile.readline().decode().strip()
    14  - while not 'done' in data:
    15  - print(data)
     14 + while not data == '':
     15 + print('[ ] Searching for: ' + data)
     16 + output = [ ]
    16 17   results = self.server.search(data)
    17  - print(results)
    18 18   for exploits in results:
    19 19   output.append(exploits[0]['description'] + ' id: ' + exploits[0]['id'])
     20 + self.wfile.write('\n'.join(output).encode() + b'\n')
    20 21   data = self.rfile.readline().decode().strip()
    21  - buff = '\n'.join(output).encode()
    22  - self.wfile.write(buff)
     22 + print('[-] Closing connection from ' + self.client_address[0])
    23 23  
    24 24   
    25 25   
    skipped 10 lines
    36 36  def main():
    37 37   exploit = ExploitServer((_IP_, _PORT_), SearchHandler)
    38 38   print('[ ] Starting server on port ' + str(_PORT_))
    39  - exploit.serve_forever()
     39 + try:
     40 + exploit.serve_forever()
     41 + except:
     42 + print('[-] Caught exception. Shutting down.')
     43 + exploit.shutdown()
     44 + exploit.server_close()
    40 45  
    41 46  if __name__ == "__main__":
    42 47   main()
Please wait...
Page is in error, reload to recover