download new module links
(link)
| 455 | |
| 456 | |
| 457 | def download_modules(link): |
| 458 | """ |
| 459 | download new module links |
| 460 | """ |
| 461 | import re |
| 462 | import requests |
| 463 | import tempfile |
| 464 | |
| 465 | lib.output.info('downloading: {}'.format(link)) |
| 466 | retval = "" |
| 467 | req = requests.get(link) |
| 468 | content = req.content |
| 469 | split_data = content.split(" ") |
| 470 | searcher = re.compile("exploit/\w+/\w+") |
| 471 | storage_file = tempfile.NamedTemporaryFile(delete=False) |
| 472 | for item in split_data: |
| 473 | if searcher.search(item) is not None: |
| 474 | retval += item + "\n" |
| 475 | with open(storage_file.name, 'a+') as tmp: |
| 476 | tmp.write(retval) |
| 477 | return storage_file.name |
| 478 | |
| 479 | |
| 480 | def find_similar(command, internal, external): |