| skipped 23 lines |
24 | 24 | | for output in self.pool.imap(SearchHandler.search, iter(self.rfile.readline, b'\n')): |
25 | 25 | | if output: |
26 | 26 | | print(output) |
27 | | - | self.wfile.write(output.encode()) |
| 27 | + | self.wfile.write(output.encode() + b'\n') |
28 | 28 | | |
29 | 29 | | self.pool.close() |
30 | 30 | | print('[$] Closing connection from {}\n'.format(self.client_address[0])) |
| skipped 8 lines |
39 | 39 | | def search(cls, data): |
40 | 40 | | query = data.decode().strip().split(" ") |
41 | 41 | | query[-1] = query[-1][:3] #cut down on the last item which should be the version number |
42 | | - | output = ["[ ]" + data] |
| 42 | + | output = [] |
43 | 43 | | for rows in ExploitServer.exploitDatabase: |
44 | 44 | | if all([term in rows["description"] for term in query]): |
45 | | - | output.append('\t | '.join(rows["description"], rows["file"])) |
| 45 | + | output.append('\t'.join((rows["description"], rows["file"])) |
46 | 46 | | if output: |
47 | | - | return "\n".join(output) |
| 47 | + | return "\n".join(("[ ] " + query, *output) |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| skipped 45 lines |