load exploits from a given file
(path, node="exploits")
| 21 | |
| 22 | |
| 23 | def load_exploit_file(path, node="exploits"): |
| 24 | """ |
| 25 | load exploits from a given file |
| 26 | """ |
| 27 | selected_file_path = path |
| 28 | |
| 29 | retval = [] |
| 30 | try: |
| 31 | with open(selected_file_path) as exploit_file: |
| 32 | # loading it like this has been known to cause Unicode issues later on down |
| 33 | # the road |
| 34 | _json = json.loads(exploit_file.read()) |
| 35 | for item in _json[node]: |
| 36 | # so we'll reload it into a ascii string before we save it into the file |
| 37 | retval.append(str(item)) |
| 38 | except IOError as e: |
| 39 | lib.settings.close(e) |
| 40 | return retval |
| 41 | |
| 42 | |
| 43 | def load_exploits(path, node="exploits"): |