黑名单接口
1. 添加黑名单接口列表
黑名单可以添加IP、IP段、IP属性、UA、城市、国家、指纹,添加成功后按照自己设置的规则来拦截,来保护自己的产品。
1.1 添加黑名单
接口地址: https://tj.wuthreat.com/tj/next_captcha/api_control/put_black
请求方法: post/get
请求类型: multipart/form-data
请求参数:
| 参数名 | 类型 | 必填 | 示例值 | 参数说明 |
|---|---|---|---|---|
AppKey |
String |
是 | 01HQ********RLO9 | 无胁安全平台创建验证码后得到的AppKey |
AppToken |
String |
是 | 10t5********ntz3 | 无胁安全平台创建验证码后得到的AppToken |
BlackType |
Number |
是 | 1 | 类型(1:IP,2:IP属性,3:UA,4:城市,5:国家,6:指纹) |
Value |
String |
是 | 6.6.6.6 | 值(IP(IP段最大支持c段),IP属性(IDC,基站),UA,城市,国家,指纹) *注:类型必须与值对应。例:BlackType=1&Value=127.0.0.1,BlackType=4&Value=北京市 |
PluggingTime |
String |
是 | 1d | 有效时间。*注:范围是1-9999(m或h或d)。例:1m(1分钟),1h(1小时),1d(1天) |
Rule |
Number |
是 | 1 | 规则(0:验证,1:拦截) |
Delete |
String |
是 | Y | 强制删除(Y或N)。Y:添加IP段时,如果和已添加的IP或IP段有冲突直接删除已添加的IP或IP段;N:添加IP段时,如果和已添加的IP或IP段有冲突返回冲突IP或IP段的信息 |
返回参数说明:
| 参数名 | 类型 | 示例值 | 参数说明 |
|---|---|---|---|
code |
Number |
1 | 响应码 |
message |
String |
success | 响应信息 |
返回示例:
-
正常返回:
例:{ "code": 1, "message": "success" }
1.2 响应码解析
响应码列表
| 返回码 | 说明 |
|---|---|
| 1 | 添加黑名单成功 |
| 1102 | 参数名错误 |
| 1103 | 参数类型错误 |
| 1105 | 值重复 |
| 1143 | 删除已有的IP或IP段失败 |
| 1155 | 值格式错误(IP段最大支持c段) |
| 1158 | 有效时间格式错误 |
| 1163 | 黑名单条数超出限制 |
| 1165 | AppKey或AppToken错误 |
| 1166 | 类型格式错误 |
| 1167 | 规则格式错误 |
| 1172 | 二维码策略不能添加黑白名单 |
| 1181 | 黑名单已有此IP,请勿重复添加 |
| 1182 | 返回的IP或IP段与添加IP有冲突 |
| 1187 | 强制删除参数错误 |
| 1188 | 您的IP不在平台白名单中,请添加IP到平台白名单 |
1.3 示例代码
1.3.1 Python
import requests
data = {
'AppKey': '01HQ********RLO9',
'AppToken': '10t5********ntz3',
'BlackType': 1,
'Value': '6.6.6.6',
'PluggingTime': '1d',
'Rule': 1,
'Delete': 'Y'
}
response = requests.post('https://tj.wuthreat.com/tj/next_captcha/api_control/put_black', data=data)
1.3.2 Java
Request request = Request.Post("https://tj.wuthreat.com/tj/next_captcha/api_control/put_black");
String body = "AppKey=01HQ********RLO9&AppToken=10t5********ntz3&BlackType=1&Value=6.6.6.6&PluggingTime=1d&Rule=1&Delete=Y"; request.bodyString(body,ContentType.APPLICATION_FORM_URLENCODED); request.setHeader("Content-Type", "application/x-www-form-urlencoded");
HttpResponse httpResponse = request.execute().returnResponse(); System.out.println(httpResponse.getStatusLine());
if (httpResponse.getEntity() != null) {
String html = EntityUtils.toString(httpResponse.getEntity());
System.out.println(html);
}
2. 获取黑名单接口列表
获取单个类型的黑名单列表,可以直观看到已经添加的黑名单。
2.1 获取黑名单
接口地址: https://tj.wuthreat.com/tj/next_captcha/api_control/get_black
请求方法: post/get
请求类型: multipart/form-data
请求参数:
| 参数名 | 类型 | 必填 | 示例值 | 参数说明 |
|---|---|---|---|---|
AppKey |
String |
是 | 01HQ********RLO9 | 无胁安全平台创建验证码后得到的AppKey |
AppToken |
String |
是 | 10t5********ntz3 | 无胁安全平台创建验证码后得到的AppToken |
BlackType |
Number |
是 | 1 | 类型(1:IP,2:IP属性,3:UA,4:城市,5:国家,6:指纹)。 例:BlackType=1代表查询项目黑名单所有IP |
返回参数说明:
| 参数名 | 类型 | 示例值 | 参数说明 |
|---|---|---|---|
code |
Number |
1 | 响应码 |
data |
Array |
["6.6.6.6",......] | 返回数据 |
message |
String |
success | 响应信息 |
返回示例:
-
正常返回:
例:{ "code": 1, "data": [ "6.6.6.6" ], "message": "success" }
2.2 响应码解析
响应码列表
| 返回码 | 说明 |
|---|---|
| 1 | 添加黑名单成功 |
| 1102 | 参数名错误 |
| 1103 | 参数类型错误 |
| 1165 | AppKey或AppToken错误 |
| 1166 | 类型格式错误 |
| 1188 | 您的IP不在平台白名单中,请添加IP到平台白名单 |
2.3 示例代码
2.3.1 Python
import requests
data = {
'AppKey': '01HQ********RLO9',
'AppToken': '10t5********ntz3',
'BlackType': 1
}
response = requests.post('https://tj.wuthreat.com/tj/next_captcha/api_control/get_black', data=data)
2.3.2 Java
Request request = Request.Post("https://tj.wuthreat.com/tj/next_captcha/api_control/get_black");
String body = "AppKey=01HQ********RLO9&AppToken=10t5********ntz3&BlackType=1"; request.bodyString(body,ContentType.APPLICATION_FORM_URLENCODED); request.setHeader("Content-Type", "application/x-www-form-urlencoded");
HttpResponse httpResponse = request.execute().returnResponse(); System.out.println(httpResponse.getStatusLine());
if (httpResponse.getEntity() != null) {
String html = EntityUtils.toString(httpResponse.getEntity());
System.out.println(html);
}
3. 删除黑名单接口列表
删除黑名单后,之前设置的拦截规则将失效。
3.1 删除黑名单
接口地址: https://tj.wuthreat.com/tj/next_captcha/api_control/del_black
请求方法: post/get
请求类型: multipart/form-data
请求参数:
| 参数名 | 类型 | 必填 | 示例值 | 参数说明 |
|---|---|---|---|---|
AppKey |
String |
是 | 01HQ********RLO9 | 无胁安全平台创建验证码后得到的AppKey |
AppToken |
String |
是 | 10t5********ntz3 | 无胁安全平台创建验证码后得到的AppToken |
BlackType |
Number |
是 | 1 | 类型(1:IP,2:IP属性,3:UA,4:城市,5:国家,6:指纹) |
Value |
String |
是 | 6.6.6.6 | 值(IP(IP段最大支持c段),IP属性(IDC,基站),UA,城市,国家,指纹) *注:类型必须与值对应,否则会显示删除失败。例:BlackType=1&Value=127.0.0.1,BlackType=4&Value=北京市 |
返回参数说明:
| 参数名 | 类型 | 示例值 | 参数说明 |
|---|---|---|---|
code |
Number |
1 | 响应码 |
message |
String |
success | 响应信息 |
返回示例:
-
正常返回:
例:{ "code": 1, "message": "success" }
3.2 响应码解析
响应码列表
| 返回码 | 说明 |
|---|---|
| 1 | 添加黑名单成功 |
| 1102 | 参数名错误 |
| 1103 | 参数类型错误 |
| 1143 | 删除失败,IP不在黑名单 |
| 1155 | 值格式错误(IP段最大支持c段) |
| 1165 | AppKey或AppToken错误 |
| 1166 | 类型格式错误 |
| 1188 | 您的IP不在平台白名单中,请添加IP到平台白名单 |
3.3示例代码
3.3.1 Python
import requests
data = {
'AppKey': '01HQ********RLO9',
'AppToken': '10t5********ntz3',
'BlackType': 1,
'Value': '6.6.6.6'
}
response = requests.post('https://tj.wuthreat.com/tj/next_captcha/api_control/del_black', data=data)
3.3.2 Java
Request request = Request.Post("https://tj.wuthreat.com/tj/next_captcha/api_control/del_black");
String body = "AppKey=01HQ********RLO9&AppToken=10t5********ntz3&BlackType=1&Value=6.6.6.6";
request.bodyString(body,ContentType.APPLICATION_FORM_URLENCODED); request.setHeader("Content-Type", "application/x-www-form-urlencoded");
HttpResponse httpResponse = request.execute().returnResponse(); System.out.println(httpResponse.getStatusLine());
if (httpResponse.getEntity() != null) {
String html = EntityUtils.toString(httpResponse.getEntity());
System.out.println(html);
}