Google安全浏览API查找Node.js

我无法获得谷歌安全search查找工作。 这是我正在尝试的代码,我总是在响应中获得{}

 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) }) 

不知道我是否正确理解文档,或者是否缺less我的请求中的任何参数。 我曾尝试过不同的url。 尝试search恶意urlforms的networking,我的浏览器识别为恶意的,但也返回空白的回应。 这是我正在遵循的文档

我也尝试过他们的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> 

威胁列表工作示例:

威胁:list工作没有:list 。 例如curl https://safebrowsing.googleapis.com/v4/threatLists?key=YOUR_KEY

威胁匹配工作示例:

方法:POST

内容types:应用程序/ JSON

https://safebrowsing.googleapis.com/v4/threatMatches:find?key=YOUR_KEY

{ "client": { "clientId": "testing", "clientVersion": "0.0.1" }, "threatInfo": { "threatTypes": ["MALWARE","SOCIAL_ENGINEERING","UNWANTED_SOFTWARE","MALICIOUS_BINARY"], "platformTypes": ["ANY_PLATFORM"], "threatEntryTypes": ["URL"], "threatEntries": [ {"url": "http://goooogleadsence.biz/"} ] } }{ "client": { "clientId": "testing", "clientVersion": "0.0.1" }, "threatInfo": { "threatTypes": ["MALWARE","SOCIAL_ENGINEERING","UNWANTED_SOFTWARE","MALICIOUS_BINARY"], "platformTypes": ["ANY_PLATFORM"], "threatEntryTypes": ["URL"], "threatEntries": [ {"url": "http://goooogleadsence.biz/"} ] } }

代码是正确的。 我有同样的…

看来Chrome浏览器还有其他(更准确的)来源可以安全浏览。 也许他们专门为特定的客户保留这些新的数据。 结果是一样的查找协议版本,你可以使用。 如果您使用更新API,这也是一样的。

如果有人知道,真的,为什么…我对这个信息非常感兴趣。

请确保您在请求中的URL中附加“/”。 这很重要。

在这种情况下,您的URL将变成http://some-malicious-url/

让我知道这个是否奏效!

Interesting Posts