Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jul 17th, 2016 108 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #malware.testing.google.test/testing/malware/
  2. function get-BrowseSafe() {
  3.     Param(
  4.         [Parameter(Mandatory = $true)][string]$search,
  5.         [AllowEmptyString()]$api_key="<your key>"
  6.     )
  7.  
  8. #build the json object to send to google:
  9. $json = '{
  10.    "client": {
  11.      "clientId":      "BrowseSafe_monitor",
  12.      "clientVersion": "1"
  13.    },
  14.    "threatInfo": {
  15.      "threatTypes":      ["MALWARE", "SOCIAL_ENGINEERING"],
  16.      "platformTypes":    ["ANY_PLATFORM" ],
  17.      "threatEntryTypes": ["URL"],
  18.      "threatEntries": ['
  19.  
  20.     #loop through multiple semi-colon delimited urls
  21.     $search_arr = $search -split ";"
  22.     $count_max = $search_arr.count
  23.     $count = 1
  24.     foreach($item in $search_arr) {
  25.             if($count -eq $count_max) {
  26.             $json = $json + "{""url"": ""$item""}"
  27.             } else {
  28.             $json = $json + "{""url"": ""$item""},"
  29.             }
  30.         $count++
  31.     }
  32. #close Json
  33. $json = $json + ']}}'
  34.  
  35. #build url with correct api_key
  36. $url = "https://safebrowsing.googleapis.com/v4/threatMatches:find?key=" + $api_key
  37.     try {
  38.     $result = Invoke-RestMethod "$url" -Method POST -Body $json -ContentType 'application/json'
  39.     $result = $result.matches
  40.     } catch {
  41.     echo $_
  42.     }
  43.  
  44.     if($($result.count) -eq 0) {
  45.     return $false
  46.     } else {
  47.     return $result
  48.     }
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top