Google Safe Browsing API v4 - Empty response

275 views
Skip to first unread message

Talha Kabakuş

unread,
Dec 21, 2016, 5:47:38 AM12/21/16
to Google Safe Browsing API

Hi everyone,


Despite that I check a malicious URL (http://fileserver03.com), empty response returns from Google Safe Browsing API v4.


Here is the code I have tried:


String requestBody = "{" +
       
"    \"client\": {" +
       
"      \"clientId\":      \"twittersentidetector\"," +
       
"      \"clientVersion\": \"1.0\"" +
       
"    }," +
       
"    \"threatInfo\": {" +
       
"      \"threatTypes\":      [\"MALWARE\", \"SOCIAL_ENGINEERING\"]," +
       
"      \"platformTypes\":    [\"ANY_PLATFORM\"]," +
       
"      \"threatEntryTypes\": [\"URL\"]," +
       
"      \"threatEntries\": [" +
       
"        {\"url\": \"http://fileserver03.com\"}," +
       
"        {\"url\": \"https://bing.com\"}," +
       
"        {\"url\": \"https://yahoo.com\"}" +
       
"      ]" +
       
"    }" +
       
"  }";


URL url
= new URL(postURL);
HttpURLConnection con = (HttpURLConnection) url.openConnection();


con
.setRequestMethod("POST");
con
.setRequestProperty("User-Agent", USER_AGENT);
con
.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
con
.setRequestProperty("Content-Type", "application/json");


con
.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr
.writeBytes(requestBody);
wr
.flush();
wr
.close();


int responseCode = con.getResponseCode();
System.out.println("Response Code: " + responseCode);
System.out.println("Response Message: " + con.getResponseMessage());


BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String output;
StringBuffer response = new StringBuffer();


while ((output = in .readLine()) != null) {
    response
.append(output);
} in .close();


System.out.println("Response: " + response.toString());

Here is the output:

Response Code: 200
Response Message: OK
Response: {}

Avtar Gaur

unread,
Mar 17, 2017, 3:10:35 AM3/17/17
to Google Safe Browsing API
Hi Talha, 

This is coming as blank because as per Google, that website is not in "Malware"  or "Social_Engineering category".
Reply all
Reply to author
Forward
0 new messages