Node.js Google安全浏览API查找节点.js
我在使用谷歌安全搜索查找时遇到问题。这是我正在尝试的代码,我总是在响应中得到Node.js Google安全浏览API查找节点.js,node.js,safe-browsing,Node.js,Safe Browsing,我在使用谷歌安全搜索查找时遇到问题。这是我正在尝试的代码,我总是在响应中得到{} var request = require("request-promise") var body = { "client": { "clientId": "myclientid", "clientVersion": "1.0" }, "threatInfo": { "threatTypes": ["MALWARE"], "platformTypes
{}
var request = require("request-promise")
var body = {
"client": {
"clientId": "myclientid",
"clientVersion": "1.0"
},
"threatInfo": {
"threatTypes": ["MALWARE"],
"platformTypes": ["WINDOWS", "LINUX"],
"threatEntryTypes": ["URL"],
"threatEntries": [
{"url": "http://some-malicious-url"}
]
}
}
var options = {
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
},
method: "POST",
url: "https://safebrowsing.googleapis.com/v4/threatMatches:find?key=my-api-key",
form: body
}
request(options).then(function (data){
console.log(data)
})
不确定我是否正确理解了文档,或者我的请求中是否缺少任何参数。我尝试了不同的网址。尝试从web上搜索被我的浏览器识别为恶意的恶意URL,但这些URL也返回空白响应。这是我正在关注的问题
我还尝试了他们的threatLists:list
API,结果总是出错
curl -XGET https://safebrowsing.googleapis.com/v4/threatLists:list?key=my_api_key
以下是我得到的输出:
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 404 (Not Found)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>404.</b> <ins>That’s an error.</ins>
<p>The requested URL <code>/v4/threatLists:list?key=my_api_key</code> was not found on this server. <ins>That’s all we know.</ins>
代码是正确的。我有同样的 Chrome浏览器似乎还有其他(更准确的)安全浏览来源。也许他们只为某些特定客户保留这些新数据。 无论使用何种查找协议版本,结果都是相同的。 如果您使用更新API,这是相同的
如果有人知道,真的,为什么。。。我对这些信息非常感兴趣。请确保您在请求的URL中添加了“/”。这样做很重要 在这种情况下,您的URL将变成
http://some-malicious-url/
让我知道这是否有效 威胁列表工作示例: ThreatList在没有
的情况下工作:list
。e、 g.curlhttps://safebrowsing.googleapis.com/v4/threatLists?key=YOUR_KEY
威胁匹配工作示例:
方法:邮寄
内容类型:application/json
正文:
{
“客户”:{
“客户ID”:“测试”,
“客户端版本”:“0.0.1”
},
“threatInfo”:{
“威胁类型”:[“恶意软件”、“社会工程”、“不需要的软件”、“恶意二进制”],
“平台类型”:[“任何平台”],
“threatEntryTypes”:[“URL”],
“威胁”:[
{“url”:http://goooogleadsence.biz/"}
]
}
}
但到目前为止,我还无法识别任何恶意url。而且,他们的threatLists:list
API总是给出一个错误。你知道吗?终于有了几个网址。我觉得它没有多大用处,因为它无法检测到Chrome可以检测到的大多数恶意URL