6、get_tasks 方法
I、调用文档
def get_tasks(self, page=1, size=10, order_by='created_time', order='desc'):
# 测试 获取任务列表
task_list = sdk.get_tasks(page=1,size=3)
print(task_list)
POST /api/v1/getTasks HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 73
Authorization: Basic dXNlcjpwYXNz
host: 192.168.136.133:8361
Connection: close
{"options":{"order":{"created_time":"desc"},"page":{"page":1,"size":15}}}
HTTP/1.1 200 OK
Content-Type: application/json
Date: Mon,
10 Apr 2023 07: 15: 39 GMT
Connection: close
Content-Length: 20222
{
"statusCode": 200,
"messages": "",
"data": {
"lists": [
{
"taskId": "20230410043102",
"name": "",
"created_time": "2023-04-10 06:48:54",
"end_time": "2023-04-10 06:49:07",
"targets": "192.168.136.0/24",
"ports": "21,22,23,25,53,U:53,U:69,80,81,U:88,110,111,U:111,123,U:123,135,U:137,139,U:161,U:177,389,U:427,443,445,465,500,515,U:520,U:523,548,623,U:626,636,873,902,1080,1099,1433,U:1434,1521,U:1604,U:1645,U:1701,1883,U:1900,2049,2181,2375,2379,U:2425,3128,3306,3389,4730,U:5060,5222,U:5351,U:5353,5432,5555,5601,5672,U:5683,5900,5938,5984,6000,6379,7001,7077,8080,8081,8443,8545,8686,9000,9001,9042,9092,9100,9200,9418,9999,11211,U:11211,27017,U:33848,37777,50000,50070,61616",
"state": 4,
"progress": 0,
"memo": "{\"taskName\":\"\",\"taskId\":null,\"asset\":{\"ips\":[\"192.168.136.0/24\"],\"blackIps\":[],\"ports\":\"21,22,23,25,53,U:53,U:69,80,81,U:88,110,111,U:111,123,U:123,135,U:137,139,U:161,U:177,389,U:427,443,445,465,500,515,U:520,U:523,548,623,U:626,636,873,902,1080,1099,1433,U:1434,1521,U:1604,U:1645,U:1701,1883,U:1900,2049,2181,2375,2379,U:2425,3128,3306,3389,4730,U:5060,5222,U:5351,U:5353,5432,5555,5601,5672,U:5683,5900,5938,5984,6000,6379,7001,7077,8080,8081,8443,8545,8686,9000,9001,9042,9092,9100,9200,9418,9999,11211,U:11211,27017,U:33848,37777,50000,50070,61616\"},\"vulnerability\":{\"type\":\"0\",\"pocs_hosts\":{}},\"options\":{\"queue\":0,\"rate\":1000,\"random\":true,\"interface\":\"\",\"portScanMode\":0,\"checkAliveMode\":2,\"retryTimes\":0,\"socketTimeout\":6,\"proxy\":\"http://192.168.1.1:1080\",\"connectionSize\":100,\"screenshot\":false,\"screenshotRDP\":false,\"extractHost\":false,\"disableMdns\":null,\"disableUpnp\":null,\"matchPoCQuery\":null,\"fofaFetchSubdomainEnabled\":false,\"bruteforceSubdomainEnabled\":false,\"fofaKey\":\"\",\"fofaEmail\":\"\",\"fofaFetchSize\":100,\"pingFirst\":false,\"pingCheckSize\":10,\"pingConcurrent\":2,\"pingSendCount\":2,\"deepAnalysis\":true,\"scanICMP\":false,\"scanICMP6\":false,\"checkHoneyPot\":false,\"enableCrawler\":false,\"crawlerScope\":0,\"crawlerConcurrent\":5,\"crawlerMaxLinks\":50,\"crawlerMaxCrawlLinks\":1000,\"defaultUserAgent\":\"\",\"defaultDeepAnalysisCheckString\":\"\",\"hostListMode\":null,\"enableSutraCloud\":false,\"enableSutraQueryJson\":false}}",
"total": {
"assets": 0,
"ips": 0,
"ports": 0,
"vulnerabilities": 0,
"allassets": 0,
"allips": 0,
"allports": 0,
"allvulnerabilities": 0,
"scan_ips": 0,
"scan_ports": 91
},
"agenttaskid": ""
}
],
"total": 11
}
}
II、字段文档
options: 获取任务列表的选项
order: 任务列表的排序方式,包含一个键值对
created_time: 按创建时间排序
desc: 降序排列
page: 分页信息,包含两个键值对
page: 当前页码
size: 每页展示的任务数目
更多使用说明访问:https://www.exp-9.com
7、get_statistics_data 方法
I、调用文档
get_statistics_data 接受参数:
def get_statistics_data(self, task_id):
# 获取任务的统计数据
task_id = "20230403082842"
statistics_data = sdk.get_statistics_data(task_id)
print(statistics_data)
POST /api/v1/getStatisticsData HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 27
Authorization: Basic dXNlcjpwYXNz
host: 192.168.136.133:8361
Connection: close
{"taskId":"20230404080804"}
HTTP/1.1 200 OK
Content-Type: application/json
Date: Mon, 10 Apr 2023 07:23:47 GMT
Content-Length: 1541
Connection: close
{"statusCode":200,"messages":"","data":{"taskId":"20230404080804","total":{"assets":10,"ips":5,"ports":14,"vulnerabilities":0,"allassets":10,"allips":5,"allports":18,"allvulnerabilities":0,"scan_ips":0,"scan_ports":0},"software_products":[{"name":"Windows10","value":1,"source":null},{"name":"Windows","value":1,"source":null},{"name":"Vmware","value":1,"source":null},{"name":"VMware-Authentication Service","value":1,"source":null},{"name":"Ubuntu-system","value":1,"source":null}],"software_companies":[{"name":"other","value":2,"source":null},{"name":"Vmware, Inc.","value":1,"source":null},{"name":"VMware, Inc.","value":1,"source":null},{"name":"Oracle Corporation","value":1,"source":null},{"name":"Microsoft Corporation","value":1,"source":null}],"hardware_products":null,"hardware_companies":null,"vulnerabilities":null,"parent_category":[{"name":"Support System","value":2,"source":null},{"name":"Software System","value":2,"source":null},{"name":"Enterprise Application","value":1,"source":null}],"favicons":null,"fids":[{"name":"bclL6A9aXzKBK/xoJrZeckSQ7gymt98+","value":1,"source":{"fohash":"bclL6A9aXzKBK/xoJrZeckSQ7gymt98+"}},{"name":"OW8AeC9cKwa8TI0980pN7obnRtGFlnWv","value":1,"source":{"fohash":"OW8AeC9cKwa8TI0980pN7obnRtGFlnWv"}}],"ips":[{"name":"192.168.136.1","value":7},{"name":"192.168.136.132","value":3}],"ports":[{"name":"7001","value":1,"source":null},{"name":"6379","value":1,"source":null},{"name":"3389","value":1,"source":null},{"name":"1080","value":1,"source":null},{"name":"902","value":1,"source":null}]}}
II、字段文档
statusCode:响应状态码,本例中为200,表示请求成功。
messages:消息,本例中为空字符串。
data:数据主体,包含了统计数据信息。
taskId:任务ID,本例中为20230404080804。
total:总体统计数据,包含以下字段:
software_products:软件产品列表,包含以下字段:
name:产品名称。
value:产品数量。
source:数据来源。
software_companies:软件公司列表,包含以下字段:
name:公司名称。
value:公司数量。
source:数据来源。
hardware_products:硬件产品列表,本例中为null。
hardware_companies:硬件公司列表,本例中为null。
vulnerabilities:漏洞列表,本例中为null。
parent_category:父级分类列表,包含以下字段:
name:分类名称。
value:分类数量。
source:数据来源。
favicons:收藏夹图标列表,本例中为null。
fids:收藏夹ID列表,包含以下字段:
name:收藏夹ID。
value:ID数量。
source:数据来源。
ips:IP地址列表,包含以下字段:
name:IP地址。
value:IP地址对应的数量。
ports:端口列表,包含以下字段:
8、asset_search 方法
I、调用文档
def asset_search(self, task_id, query='', page=1, page_size=20,order_by={'vulnerabilities': 'desc', 'assets': 'desc'}):
# 测试资产搜索
asset_search = sdk.asset_search(task_id="20230403070712")
print(asset_search)
POST /api/v1/assetSearch HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 134
Authorization: Basic dXNlcjpwYXNz
host: 192.168.136.133:8361
Connection: close
{"query":"taskId=\"20230404080804\" && ()","options":{"order":{"vulnerabilities":"desc","assets":"desc"},"page":{"page":1,"size":20}}}
HTTP/1.1 200 OK
Content-Type: application/json
Date: Mon, 10 Apr 2023 07:23:47 GMT
Connection: close
Content-Length: 6842
{"statusCode":200,"messages":"","data":{"query":"taskId=\"20230404080804\" \u0026\u0026 ()","options":{"TaskID":"20230404080804","Page":1,"size":20,"OrderField":"","OrderASC":""},"taskId":"20230404080804","query_total":{"ips":5,"ports":17,"protocols":13,"assets":10,"vulnerabilities":0,"dist_ports":14,"dist_protocols":11,"dist_assets":10,"dist_vulnerabilities":0},"total":{"assets":10,"ips":5,"ports":18,"vulnerabilities":0,"allassets":0,"allips":0,"allports":0,"allvulnerabilities":0,"scan_ips":0,"scan_ports":0},"ips":[{"ip":"192.168.136.1","mac":"00:50:56:c0:00:08","os":"","hostname":"PC-202211290939,PC-202211290939\n","honeypot":"0","ports":[{"port":"139","baseprotocol":"tcp"},{"port":"1080","baseprotocol":"tcp"},{"port":"22","baseprotocol":"tcp"},{"port":"135","baseprotocol":"tcp"},{"port":"137","baseprotocol":"udp"},{"port":"7001","baseprotocol":"tcp"},{"port":"3389","baseprotocol":"tcp"},{"port":"6379","baseprotocol":"tcp"},{"port":"902","baseprotocol":"tcp"},{"port":"3306","baseprotocol":"tcp"},{"port":"443","baseprotocol":"tcp"},{"port":"445","baseprotocol":"tcp"}],"protocols":{"192.168.136.1:1080":{"port":"1080","hostinfo":"192.168.136.1:1080","url":"","product":"Proxy server","protocol":"socks5","json":"","fid":[""],"products":["Proxy server"],"protocols":["socks5"]},"192.168.136.1:135":{"port":"135","hostinfo":"192.168.136.1:135","url":"","product":"","protocol":"unknown","json":"","fid":[""],"products":[""],"protocols":["unknown"]},"192.168.136.1:137":{"port":"137","hostinfo":"192.168.136.1:137","url":"","product":"","protocol":"netbios","json":"","fid":[""],"products":[""],"protocols":["netbios"]},"192.168.136.1:139":{"port":"139","hostinfo":"192.168.136.1:139","url":"","product":"","protocol":"netbios-ssn","json":"","fid":[""],"products":[""],"protocols":["netbios-ssn"]},"192.168.136.1:3389":{"port":"3389","hostinfo":"192.168.136.1:3389","url":"","product":"Microsoft-Windows远程连接|Windows10","protocol":"rdp","json":"","fid":[""],"products":["Microsoft-Windows远程连接","Windows10"],"protocols":["rdp"]},"192.168.136.1:445":{"port":"445","hostinfo":"192.168.136.1:445","url":"","product":"Windows","protocol":"smb","json":"","fid":[""],"products":["Windows"],"protocols":["smb"]},"192.168.136.1:6379":{"port":"6379","hostinfo":"192.168.136.1:6379","url":"","product":"","protocol":"unknown","json":"","fid":[""],"products":[""],"protocols":["unknown"]},"192.168.136.1:7001":{"port":"7001","hostinfo":"192.168.136.1:7001","url":"","product":"JSP","protocol":"http","json":"","fid":["OW8AeC9cKwa8TI0980pN7obnRtGFlnWv"],"products":["JSP"],"protocols":["http","web"]},"192.168.136.1:902":{"port":"902","hostinfo":"192.168.136.1:902","url":"","product":"VMware-Authentication Service","protocol":"vmware_authentication_daemon","json":"","fid":[""],"products":["VMware-Authentication Service"],"protocols":["vmware_authentication_daemon"]}},"tags":[{"rule_id":"30000001","product":"Vmware","company":"Vmware, Inc.","level":"1","category":"Virtualization","parent_category":"Support System","softhard":"2","version":""},{"rule_id":"270","product":"JSP","company":"Oracle Corporation","level":"4","category":"Scripting Language","parent_category":"Support System","softhard":"2","version":""},{"rule_id":"7220","product":"Windows","company":"Microsoft Corporation","level":"2","category":"Operating System","parent_category":"Software System","softhard":"2","version":"10.0.19041 Ntlm 15"},{"rule_id":"19961","product":"Windows10","company":"Microsoft Corporation","level":"2","category":"Operating System","parent_category":"Software System","softhard":"2","version":""},{"rule_id":"7203","product":"Microsoft-Windows远程连接","company":"Microsoft Corporation","level":"3","category":"Other Enterprise Application","parent_category":"Enterprise Application","softhard":"2","version":""},{"rule_id":"7206","product":"VMware-Authentication Service","company":"VMware, Inc.","level":"3","category":"Other Enterprise Application","parent_category":"Enterprise Application","softhard":"2","version":""},{"rule_id":"710524","product":"Proxy server","company":"other","level":"3","category":"Service","parent_category":"Support System","softhard":"2","version":""}],"vulnerabilities":null,"screenshots":null,"favicons":null,"hostnames":[""]},{"ip":"192.168.136.132","mac":"","os":"","hostname":"","honeypot":"0","ports":[{"port":"80","baseprotocol":"tcp"},{"port":"22","baseprotocol":"tcp"}],"protocols":{"192.168.136.132:22":{"port":"22","hostinfo":"192.168.136.132:22","url":"","product":"Ubuntu-system|OpenSSH","protocol":"ssh","json":"","fid":[""],"products":["Ubuntu-system","OpenSSH"],"protocols":["ssh"]},"192.168.136.132:80":{"port":"80","hostinfo":"192.168.136.132:80","url":"","product":"Ubuntu-system|Nginx","protocol":"http","json":"","fid":["bclL6A9aXzKBK/xoJrZeckSQ7gymt98+"],"products":["Ubuntu-system","Nginx"],"protocols":["http","web"]}},"tags":[{"rule_id":"209","product":"Nginx","company":"other","level":"3","category":"Service","parent_category":"Support System","softhard":"2","version":"1.18.0"},{"rule_id":"4528","product":"Ubuntu-system","company":"Canonical Ltd.","level":"2","category":"Operating System","parent_category":"Software System","softhard":"2","version":""},{"rule_id":"7512","product":"OpenSSH","company":"other","level":"3","category":"Other Support System","parent_category":"Support System","softhard":"2","version":"8.2p1"}],"vulnerabilities":null,"screenshots":null,"favicons":null,"hostnames":[""]},{"ip":"192.168.136.2","mac":"","os":"","hostname":"","honeypot":"0","ports":[{"port":"53","baseprotocol":"udp"},{"port":"53","baseprotocol":"tcp"}],"protocols":{"192.168.136.2:53":{"port":"53","hostinfo":"192.168.136.2:53","url":"","product":"","protocol":"dns","json":"","fid":[""],"products":[""],"protocols":["dns"]}},"tags":null,"vulnerabilities":null,"screenshots":null,"favicons":null,"hostnames":[""]},{"ip":"192.168.136.0","mac":"","os":"","hostname":"","honeypot":"0","ports":[{"port":"53","baseprotocol":"udp"}],"protocols":{},"tags":null,"vulnerabilities":null,"screenshots":null,"favicons":null,"hostnames":[""]},{"ip":"192.168.136.255","mac":"","os":"","hostname":"","honeypot":"0","ports":[{"port":"53","baseprotocol":"udp"}],"protocols":{},"tags":null,"vulnerabilities":null,"screenshots":null,"favicons":null,"hostnames":[""]}],"products":{"software":{"total_assets":2,"risk_assets":0,"lists":[{"name":"Vmware","company":"Vmware, Inc.","total_assets":1,"risk_assets":0},{"name":"Nginx","company":"other","total_assets":1,"risk_assets":0}]},"hardware":{"total_assets":0,"risk_assets":0,"lists":null}},"companies":{"software":{"total_assets":2,"risk_assets":0,"lists":[{"name":"Vmware, Inc.","total_assets":1,"risk_assets":0},{"name":"other","total_assets":1,"risk_assets":0}]},"hardware":{"total_assets":0,"risk_assets":0,"lists":null}}}}
II、字段文档
query:查询字符串,用于指定查询的条件
options:查询选项,包含两个子属性:
"ports": 表示查询的端口号数量。
"protocols": 表示查询的协议数量。
"assets": 表示查询的资产总数,即具有唯一IP地址和端口号的组合数。
"vulnerabilities": 表示查询的漏洞总数。
"dist_ports": 表示查询的不同端口号数量。
"dist_protocols": 表示查询的不同协议数量。
"dist_assets": 表示查询的不同资产总数,即具有唯一IP地址和端口号的组合数。
"dist_vulnerabilities": 表示查询的不同漏洞总数。
更多使用说明访问:https://www.exp-9.com
9、get_value_category 方法
I、调用文档
def get_value_category(self, task_id):
# 测试 产品类别
value_category = sdk.get_value_category(task_id="20230403070712")
print(value_category)
POST /api/v1/getValueCategory HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 27
Authorization: Basic dXNlcjpwYXNz
host: 192.168.136.133:8361
Connection: close
{"taskId":"20230404080804"}
HTTP/1.1 200 OK
Content-Type: application/json
Date: Mon, 10 Apr 2023 07:23:47 GMT
Content-Length: 122
Connection: close
{"statusCode":200,"messages":"","data":{"hardwares":[{"name":"Virtualization","value":1,"source":null}],"softwares":null}}
II、字段文档
10、get_children_category 方法
I、调用文档
get_children_category 接受参数:
def get_children_category(self, task_id, parent_category):
# 测试 get_children_category 函数
response = sdk.get_children_category(task_id="20230403070712", parent_category="Support System")
print(response)
POST /api/v1/getChildrenCategory HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 75
Authorization: Basic dXNlcjpwYXNz
host: 192.168.136.133:8361
Connection: close
{"query":"taskId=\"20230404080804\" && parent_category=\"Support System\""}
HTTP/1.1 200 OK
Content-Type: application/json
Date: Mon, 10 Apr 2023 08:04:24 GMT
Content-Length: 264
Connection: close
{"statusCode":200,"messages":"","data":{"total":5,"lists":[{"name":"Service","value":2,"source":null},{"name":"Virtualization","value":1,"source":null},{"name":"Scripting Language","value":1,"source":null},{"name":"Other Support System","value":1,"source":null}]}}
II、字段文档