daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Aug 7th, 2016 173 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #https://www.projecthoneypot.org/faq.php#h
  2. function Get-projecthoneypot() {
  3. #https://www.projecthoneypot.org/terms_of_service_use.php
  4.     Param(
  5.         [Parameter(Mandatory = $true)][string]$ip,
  6.         [AllowEmptyString()]$api_key="<api_key>"
  7.     )
  8.     $ip_arr = $ip.split(".")
  9.     [array]::Reverse($ip_arr)
  10.     $ip = $ip_arr -join(".")
  11.     $query = $api_key+ "." + "$ip" + ".dnsbl.httpbl.org"
  12.     try {
  13.     $response = [System.Net.Dns]::GetHostAddresses("$query") | select -expandproperty IPAddressToString
  14.     } catch {
  15.     return $false
  16.     }
  17.     $decode = $response.split(".")
  18.     if($decode[0] -eq "127") {
  19.     $days_since_last_seen = $decode[1]
  20.     $threat_score = $decode[2]
  21.     switch ($decode[3]){
  22.     0 { $meaning = "Search Engine"}
  23.     1 { $meaning = "Suspicious"}
  24.     2 { $meaning = "Harvester"}
  25.     3 { $meaning = "Suspicious & Harvester"}
  26.     4 { $meaning = "Comment Spammer"}
  27.     5 { $meaning = "Suspicious & Comment Spammer"}
  28.     6 { $meaning = "Harvester & Comment Spammer"}
  29.     7 { $meaning = "Suspicious & Harvester & Comment Spammer"}
  30.     default {$meaning = "Unknown"}
  31.     }
  32.     $return_obj = [PSCustomObject] @{
  33.     last_seen = $days_since_last_seen
  34.     threat_score = $threat_score
  35.     meaning = $meaning
  36.     }
  37.     return $return_obj
  38.    
  39.     } else {
  40.     return "Illegal response"
  41.     }
  42.        
  43. }
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