diff options
Diffstat (limited to 'get_nessus_link.py')
-rw-r--r-- | get_nessus_link.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/get_nessus_link.py b/get_nessus_link.py new file mode 100644 index 000000000000..27debbfc052f --- /dev/null +++ b/get_nessus_link.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# SPDX-License-Identifier: CC0-1.0 +# Source: https://gist.github.com/parly/a62d3f69abab8a16e878134d610d8cdc + +# To install the prerequisites, use the command below: +# pacman -S python python-beautifulsoup4 python-requests + +import json + +from bs4 import BeautifulSoup +import requests + + +def main(): + data = get_json() + url = None + for download in data['props']['pageProps']['page']['downloads']: + filename = download['file'] + if filename.endswith('-fc20.x86_64.rpm'): + url = f'https://www.tenable.com/downloads/api/v1/public/pages/nessus/downloads/{download["id"]}/download?i_agree_to_tenable_license_agreement=true' + break + + if url is not None: + print(filename) + print(url) + else: + print('Cannot find a download link!') + + +def get_json(): + res = requests.get('https://www.tenable.com/downloads/nessus') + soup = BeautifulSoup(res.text, 'html.parser') + tag = soup.find(id='__NEXT_DATA__') + return json.loads(tag.string) + + + +if __name__ == '__main__': + main() |