日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

AWVS13批量脚本

發布時間:2023/12/9 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 AWVS13批量脚本 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

你可以在以下渠道聯系到我,轉載請注明文章來源地址~

  • 知乎:Sp4rkW
  • GITHUB:Sp4rkW
  • B站:一只技術君
  • 博客:https://sp4rkw.blog.csdn.net/
  • 聯系郵箱:getf_own@163.com

文章目錄

  • 前言
  • 核心接口
    • 儀表盤接口
    • 新增任務接口
    • 設置掃描速度
    • 啟動掃描任務
  • 絲滑腳本

前言

最近在改reaper的awvs互動功能,因為自己的服務器垃圾,一次最多掃四個站,否則就卡死了。所以需要對現有的批量腳本進行修改處理。邏輯比較簡單:

  • 拿到web資產,django異步啟掃描任務
  • 從list中取出前四個,丟入awvs,選擇slow模式慢慢掃
  • 一分鐘判斷一次目前正在掃描的任務數量,不滿4個自動新增補全到4個任務
  • 知道列表為空

django部分代碼略去,awvs的部分代碼我提取出來了,供大家使用

核心接口

儀表盤接口

/api/v1/me/stats 參數說明
most_vulnerable_targets最脆弱的目標
scans_conducted_count總進行掃描個數
scans_running_count正在掃描的個數
scans_waiting_count等待掃描的個數
targets_count總進行掃描個數
top_vulnerabilities排名靠前漏洞分布
vuln_count_by_criticality通過危險程度進行漏洞等級個數分布
vuln_count漏洞數據
vuln_count_by_criticality通過危險程度進行漏洞等級個數分布
top_vulnerabilities排名靠前漏洞分布
vulnerabilities_open_count共發現漏洞總數
#核心代碼如下 api_running_url = 'https://x/api/v1/me/stats' headers = {'X-Auth': 'x','Content-type': 'application/json' } r = requests.get(url=api_running_url, headers=headers, verify=False).json() print(r['scans_running_count']) # 正在掃描的個數# 返回數據如下: {'most_vulnerable_targets': [], 'scans_conducted_count': 0, 'scans_running_count': 0, 'scans_waiting_count': 0, 'targets_count': 0, 'top_vulnerabilities': [], 'vuln_count': {'high': None, 'low': None, 'med': None}, 'vuln_count_by_criticality': {'critical': None, 'high': None, 'low': None, 'normal': None}, 'vulnerabilities_open_count': 0}

新增任務接口

Method:POST URL: /api/v1/targets 發送參數類型說明
addressstring目標網址:需http或https開頭
criticalityInt危險程度;范圍:[30,20,10,0];默認為10
descriptionstring備注
# 發送代碼如下 api_add_url = "https://x/api/v1/targets" headers = {'X-Auth': 'x','Content-type': 'application/json' }data = '{"address":"http://vulnweb.com/","description":"create_by_reaper","criticality":"10"}'r = requests.post(url=api_add_url, headers=headers, data=data,verify=False).json() print(r) 返回參數說明
address目標網址
criticality危險程度
description備注
type類型
domain域名
target_id目標id
target_type目標類型
canonical_address根域名
canonical_address_hash根域名hash
# 返回包如下{'address': 'http://vulnweb.com/', 'criticality': 10, 'description': 'create_by_reaper', 'type': 'default', 'domain': 'vulnweb.com', 'target_id': '13564b22-7fd8-46d5-b10f-3c87a6cc6afa', 'target_type': None, 'canonical_address': 'vulnweb.com', 'canonical_address_hash': '823a9c89d4aea02ab8a4f5d31fd603c7'}

設置掃描速度

Method:PATCH URL: /api/v1/targets/{target_id}/configuration 參數類型說明
scan_speedstring由慢到快:sequential slow moderate fast
# 核心代碼 api_speed_url = "https://x/api/v1/targets/{}/configuration".format(target_id) data = json.dumps({"scan_speed":"sequential"})r = requests.patch(url=api_speed_url, headers=headers, data=data, verify=False)print(r)# 返回 <Response [204]> #代表成功

啟動掃描任務

Method:POST URL: /api/v1/scans 參數類型說明
profile_idstring掃描類型
ui_session_istring可不傳
schedulejson掃描時間設置(默認即時)
report_template_idstring掃描報告類型(可不傳)
target_idstring目標id
掃描類型值國光翻譯的理解
Full Scan11111111-1111-1111-1111-111111111111完全掃描
High Risk Vulnerabilities11111111-1111-1111-1111-111111111112高風險漏洞
Cross-site Scripting Vulnerabilities11111111-1111-1111-1111-111111111116XSS漏洞
SQL Injection Vulnerabilities11111111-1111-1111-1111-111111111113SQL注入漏洞
Weak Passwords11111111-1111-1111-1111-111111111115弱口令檢測
Crawl Only11111111-1111-1111-1111-111111111117Crawl Only
Malware Scan11111111-1111-1111-1111-111111111120惡意軟件掃描
# 核心代碼 data = '{"profile_id":"11111111-1111-1111-1111-111111111111","schedule":{"disable":false,"start_date":null,"time_sensitive":false},"target_id":"%s"}'% target_idr = requests.post(url=api_run_url, headers=headers, data=data, verify=False).json() print(r)# 返回包 {'profile_id': '11111111-1111-1111-1111-111111111111', 'schedule': {'disable': False, 'start_date': None, 'time_sensitive': False, 'triggerable': False}, 'target_id': '13564b22-7fd8-46d5-b10f-3c87a6cc6afa', 'incremental': False, 'max_scan_time': 0, 'ui_session_id': None}

絲滑腳本

import requests import json import time from requests.packages.urllib3.exceptions import InsecureRequestWarningrequests.packages.urllib3.disable_warnings(InsecureRequestWarning)# 請自行對接子域名列表,格式demo見mainawvs_token = 'xxx' website = ""def awvs_reaper(domainlist):# 接受域名list類型headers = {'X-Auth': awvs_token,'Content-type': 'application/json;charset=utf8'}api_running_url = website+'/api/v1/me/stats'api_add_url = website+"/api/v1/targets"api_run_url = website+"/api/v1/scans"# 先把所有任務添加上并調整速度target_list = []for target in domainlist:data = '{"address":"%s","description":"create_by_reaper","criticality":"10"}'% targetr = requests.post(url=api_add_url, headers=headers, data=data, verify=False).json()target_id = r['target_id']api_speed_url = website+"/api/v1/targets/{}/configuration".format(target_id)data = json.dumps({"scan_speed":"fast"})# slow最慢,一般建議fastr = requests.patch(url=api_speed_url, headers=headers, data=data, verify=False)target_list.append(target_id)target_num = len(target_list)if target_num <= 4:for target_id in target_list:data = '{"profile_id":"11111111-1111-1111-1111-111111111111","schedule":{"disable":false,"start_date":null,"time_sensitive":false},"target_id":"%s"}'% target_idr = requests.post(url=api_run_url, headers=headers, data=data, verify=False).json()else:r = requests.get(url=api_running_url, headers=headers, verify=False).json()runnum = int(r['scans_running_count']) # 正在掃描的個數flag = 0 # 做數組標志位while flag < target_num:if runnum < 4:target_id = target_list[flag]flag = flag + 1data = '{"profile_id":"11111111-1111-1111-1111-111111111111","schedule":{"disable":false,"start_date":null,"time_sensitive":false},"target_id":"%s"}'% target_idr = requests.post(url=api_run_url, headers=headers, data=data, verify=False).json()r = requests.get(url=api_running_url, headers=headers, verify=False).json()runnum = int(r['scans_running_count']) # 正在掃描的個數else:passtime.sleep(60)return target_numif __name__ == "__main__":domainlist = ['http://10086.1.com', 'http://10087.1.com', 'http://10088.1.com']#必須帶http或者httpsawvs_reaper(domainlist)# linux服務器配合screen持久化運行#注意,無授權請勿掃描,后果自負

總結

以上是生活随笔為你收集整理的AWVS13批量脚本的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。