提交API
接口描述
提交API渗透的测试目标,如:Pcap流量文件或接口描述文件
请求说明
HTTP方法:
POST
请求URL:
http://api.imiyoo.com/service/apitest/task
请求参数:
参数名称 | 参数位置 | 参数类型 | 参数说明 |
---|---|---|---|
access_token | query | string | 接口认证token |
api_file | body | string | 包含接口的文件,Pcap流量文件或接口描述文件 |
- 代码示例
import requests
url = "http://api.imiyoo.com/service/apitest/task"
access_token = "xxxxxx"
params = "access_token=%s" % access_token
files = {'api_file': open('api.json', 'rb')}
r = requests.post(url,params=params,files=files)
print r.content
返回说明
- 返回参数
参数名称 | 参数类型 | 参数说明 |
---|---|---|
code | int | 服务端响应的状态信息,0代表正常,-1代表异常 |
msg | string | 服务端处理响应的描述信息 |
success | bool | 接口处理是否成功 |
taskid | int | API渗透任务的ID |
- 返回示例
{ "code":0, "msg":u"API渗透任务提交成功", "success":true, "result":{ "taskid":600001, } }
获取结果
接口描述
获取接口测试的安全风险结果。
请求说明
- HTTP方法:
GET
- 请求URL:
http://api.imiyoo.com/service/apitest/task
- 请求参数:
参数名称 | 参数位置 | 参数类型 | 参数说明 |
---|---|---|---|
access_token | query | int | 接口认证token |
taskid | query | int | API接口扫描任务的ID |
- 请求示例:
GET /service/apitest/task?access_token=xxxxxx&taskid=600001
Host: api.imiyoo.com
返回说明
- 返回参数
参数名称 | 参数类型 | 参数说明 |
---|---|---|
code | int | 服务端响应的状态信息,0代表正常,-1代表异常 |
msg | string | 服务端处理响应的描述信息 |
success | bool | 接口处理是否成功 |
result | object | API渗透的测试结果 |
apilist | array | API列表信息,并对API进行分类标注 |
vulnlist | array | API安全检测出来的风险信息 |
scan_report | string | API安全测试的完整报告地址 |
- 返回示例
{
"code":0,
"msg":u"接口测试完成",
"success":true,
"result":{
"apilist":[{
"api":"http://passport.imiyoo.com:80/auth/info/login",
"req":"POST /auth/info/login HTTP/1.1\r\nx-auth-token: 3d40c8ac-37d5-4ebf-a8c1-d52ff7985402\r\nContent-Length: 0\r\nHost: passport.imiyoo.com\r\nConnection: Keep-Alive\r\nUser-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_51)\r\nAccept-Encoding: gzip,deflate\r\nX-B3-TraceId: fb6499cca3eb5885\r\nX-B3-SpanId: cc6cab4fab9df554\r\nX-B3-ParentSpanId: fb6499cca3eb5885\r\nX-B3-Sampled: 1\r\n\r\n",
"res":"HTTP/1.1 200 \r\nServer: nginx\r\nDate: Mon, 04 Jun 2018 09:31:54 GMT\r\nContent-Type: application/json;charset=UTF-8\r\nTransfer-Encoding: chunked\r\nConnection: close\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Methods: POST, GET\r\nAccess-Control-Allow-Headers: Origin, No-Cache, x-auth-token, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type,Authorization\r\nAccess-Control-Max-Age: 3600\r\nX-Content-Type-Options: nosniff\r\nX-XSS-Protection: 1; mode=block\r\nCache-Control: no-cache, no-store, max-age=0, must-revalidate\r\nPragma: no-cache\r\nExpires: 0\r\nX-Frame-Options: DENY\r\n\r\n{\"msg\":\"\u53bb\u501f\u6b3e\",\"code\":\"0000\",\"data\":{\"data1\":null,\"status\":1},\"success\":true}"}",
//接口功能名称
"name":u"登录认证",
//公开接口,不需要携带认证特征的接口;授权接口,需要携带认证特征的接口
"type":u"授权接口",
//接口中敏感数据标签
"tag":["token","mobile"]
}],
"vulnlist":[
{
//风险名称
"name":u"X-Requested-With请求头缺失",
//风险等级
"rank":u"低危",
//风险类型
"type":u"配置缺陷",
//风险API
"api":["http://passportapi.imiyoo.com:80/auth/info/login"]
}
],
"scan_report":"http://api.imiyoo.com/api_report/xxxxxx"
}
}