| skipped 6 lines |
7 | 7 | | import argparse |
8 | 8 | | import re |
9 | 9 | | import subprocess |
| 10 | + | import json |
10 | 11 | | except Exception as e: |
11 | 12 | | print("Caught exception: {}\nAre you running with python3?".format(e)) |
12 | 13 | | exit(1) |
| skipped 17 lines |
30 | 31 | | break #bad term break so we don't search it |
31 | 32 | | else: |
32 | 33 | | print('[ ] Searching for: {}'.format(' '.join(term))) |
33 | | - | proc = subprocess.Popen([_searchsploit, *splitTerms], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
34 | | - | self.wfile.write('{}\n'.format(proc.stdout.read()).encode()) |
| 34 | + | proc = subprocess.Popen([_searchsploit, '-j', *splitTerms], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
| 35 | + | output = proc.stdout.read() |
| 36 | + | if json.loads(output).get("results", False): |
| 37 | + | self.wfile.write(output.encode()) |
35 | 38 | | |
36 | 39 | | print('[$] Closing connection from {}\n'.format(self.client_address[0])) |
37 | 40 | | except Exception as e: |
| skipped 38 lines |