some tests with reverse dns lookup

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2954 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 18 years ago
parent 24ac4e8860
commit d34f10c63d

@ -54,6 +54,7 @@ import de.anomic.data.robotsParser;
import de.anomic.http.httpHeader;
import de.anomic.http.httpc;
import de.anomic.net.URL;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.tools.nxTools;
@ -78,8 +79,8 @@ public class getpageinfo_p {
}
if (actions.indexOf("title")>=0) {
try {
content = nxTools.strings(httpc.wget(new URL(url)));
URL u = new URL(url);
content = nxTools.strings(httpc.wget(u, u.getHost(), 6000, null, null, ((plasmaSwitchboard) env).remoteProxyConfig, null));
Iterator it = content.iterator();
String line;
String title;

@ -1302,7 +1302,7 @@ do upload
}
public static byte[] wget(URL url) throws IOException{
return wget(url, url.getHost(), 6000, null, null, plasmaSwitchboard.getSwitchboard().remoteProxyConfig, null);
return wget(url, url.getHost(), 10000, null, null, null, null);
}
public static byte[] wget(

@ -44,8 +44,12 @@ package de.anomic.net;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Properties;
import de.anomic.http.httpc;
import de.anomic.tools.nxTools;
public class whois {
public static Properties Whois(String dom) {
@ -83,7 +87,23 @@ public class whois {
return "unknown";
}
public static String reversedns(String ip) {
try {
ArrayList x = nxTools.strings(httpc.wget(new URL("http://www.dnsstuff.com/tools/ptr.ch?ip=" + ip)));
x = nxTools.grep(x, 0, "PTR record:");
if ((x == null) || (x.size() == 0)) return null;
String line = nxTools.tail1(x);
int p = line.indexOf("<B>");
int q = line.indexOf("</B>");
if ((p > 0) && (q > 0)) return line.substring(p + 3, q);
} catch (Exception e) {
return null;
}
return null;
}
public static void main(String[] args) {
/*
Properties p = Whois(args[0]);
if (p != null) {
System.out.println(p);
@ -91,5 +111,7 @@ public class whois {
} else {
System.out.println("whois cannot execute");
}
*/
System.out.println(reversedns("85.212.45.94"));
}
}

Loading…
Cancel
Save