Skip to content

Instantly share code, notes, and snippets.

@md-5
Created June 29, 2012 11:44
Show Gist options
  • Save md-5/3017513 to your computer and use it in GitHub Desktop.
Save md-5/3017513 to your computer and use it in GitHub Desktop.
try {
String[] split = ip.split("\\.");
StringBuilder lookup = new StringBuilder();
for (int i = split.length - 1; i >= 0; i--) {
lookup.append(split[i]);
lookup.append(".");
}
lookup.append("xbl.spamhaus.org.");
if (java.net.InetAddress.getByName(lookup.toString()) != null) {
return "Your IP address is flagged as unsafe by spamhaus.org/xbl";
}
} catch (Exception ex) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment