-
-
Save parly/a62d3f69abab8a16e878134d610d8cdc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# SPDX-License-Identifier: CC0-1.0 | |
# 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() | |
for download in data['props']['pageProps']['page']['downloads']: | |
filename = download['file'] | |
if filename.endswith('-fc20.x86_64.rpm'): | |
sha256sum = download['meta_data']['sha256'] | |
url = f'https://www.tenable.com/downloads/api/v1/public/pages/nessus/downloads/{download["id"]}/download?i_agree_to_tenable_license_agreement=true' | |
print(filename) | |
print(sha256sum) | |
print(url) | |
return | |
print('Error: 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment