├── ReadMe ├── requirements.txt ├── run.py └── test2.py /ReadMe: -------------------------------------------------------------------------------- 1 | # Nessus 一键下载 最新更新脚本 2 | 1、需要安装Python3.8以上版本。 3 | 2、执行pip install -r requirements.txt 4 | 3、执行python run.py 5 | 4、下载完成后文件在脚本同级目录 6 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests~=2.25.1 2 | tqdm~=4.55.1 -------------------------------------------------------------------------------- /run.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | import test2 4 | test2.run() -------------------------------------------------------------------------------- /test2.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | # /usr/bin/env python 3 | import os 4 | import re 5 | import json 6 | import time 7 | import random 8 | import requests 9 | from tqdm import tqdm 10 | 11 | 12 | class Nessus: 13 | def __init__(self): 14 | self.req = requests.Session() 15 | self.name = ''.join(random.sample(['z','y','x','w','v','u','t','s','r','q','p','o','n','m','l','k','j','i','h','g','f','e','d','c','b','a'], 5)) 16 | 17 | def ten_mail(self): 18 | self.req.request( 19 | method="GET", 20 | url="https://mailtemp.top/mailbox?name={0}".format(self.name), 21 | verify=True 22 | ) 23 | print("临时申请邮箱为:{0}@mailtemp.top".format(self.name)) 24 | return "{0}@mailtemp.top".format(self.name) 25 | 26 | def ten_mail_2(self): 27 | time.sleep(10) 28 | tmp2 = self.req.request( 29 | method="GET", 30 | url="https://mailtemp.top/api/v1/mailbox/{0}".format(self.name), 31 | headers={ 32 | "Accept": "application/json, text/javascript, */*; q=0.01", 33 | "X-Requested-With": "XMLHttpRequest", 34 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36", 35 | "Referer": "https://mailtemp.top/mailbox?name=", 36 | "Accept-Language": "zh-CN,zh;q=0.9" 37 | }, 38 | verify=True 39 | ) 40 | b = tmp2.text 41 | b2 = json.loads(b) 42 | tmp3 = self.req.request( 43 | method="GET", 44 | url="https://mailtemp.top/mailbox/{0}/{1}".format(self.name, b2[0]["id"]), 45 | headers = { 46 | "Accept": "application/json, text/javascript, */*; q=0.01", 47 | "X-Requested-With": "XMLHttpRequest", 48 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36", 49 | "Referer": "https://mailtemp.top/mailbox?name=", 50 | "Accept-Language": "zh-CN,zh;q=0.9" 51 | }, 52 | ) 53 | key = re.findall("[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}", tmp3.text) 54 | key = key[0] 55 | print("https://plugins.nessus.org/register.php?serial={0}".format(key)) 56 | self.req.close() 57 | tmp4 = requests.get(url="https://plugins.nessus.org/register.php?serial={0}".format(key)) 58 | tmp5 = tmp4.text.split("\n") 59 | print("https://plugins.nessus.org/v2/nessus.php?f=all-2.0.tar.gz&u={0}&p={1}".format(tmp5[1],tmp5[2])) 60 | print("开始下载文件.") 61 | url = "https://plugins.nessus.org/v2/nessus.php?f=all-2.0.tar.gz&u={0}&p={1}".format(tmp5[1],tmp5[2]) 62 | response = requests.get(url, stream=True) # (1) 63 | file_size = int(response.headers['content-length']) # (2) 64 | dst = "all-2.0.tar.gz" 65 | if os.path.exists(dst): 66 | first_byte = os.path.getsize(dst) # (3) 67 | else: 68 | first_byte = 0 69 | if first_byte >= file_size: # (4) 70 | return file_size 71 | 72 | header = {"Range": f"bytes={first_byte}-{file_size}"} 73 | 74 | pbar = tqdm(total=file_size, initial=first_byte, unit='B', unit_scale=True, desc=dst) 75 | req = requests.get(url, headers=header, stream=True) # (5) 76 | with open(dst, 'ab') as f: 77 | for chunk in req.iter_content(chunk_size=1024): # (6) 78 | if chunk: 79 | f.write(chunk) 80 | pbar.update(1024) 81 | pbar.close() 82 | 83 | def s_Nessus(self): 84 | tmp = requests.post( 85 | url="https://zh-cn.tenable.com/products/nessus/nessus-essentials", 86 | data={ 87 | "first_name": "1", 88 | "last_name": "1", 89 | "email": "{0}@mailtemp.top".format(self.name), 90 | "org_name": "", 91 | "opt_in": "on", 92 | "robot": "human", 93 | "type": "homefeed", 94 | "token": "", 95 | "country": "CN", 96 | "submit": "注册", 97 | }, 98 | verify=True 99 | ) 100 | self.ten_mail_2() 101 | 102 | def run(): 103 | ben = "》》》》》》Nessus 更新包下载脚本《《《《《《\r\nby:柠檬菠萝" 104 | print(ben) 105 | print("*开始执行程序,保障网络通畅,如有问题请反馈。") 106 | a = Nessus() 107 | a.s_Nessus() 108 | 109 | --------------------------------------------------------------------------------