blob: 27debbfc052f0d4b9b118c567ec316c3613a11d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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()
|