|
|
|
@ -65,7 +65,7 @@ public class natLib {
|
|
|
|
|
rm status.htm
|
|
|
|
|
*/
|
|
|
|
|
try {
|
|
|
|
|
ArrayList x = nxTools.strings(httpc.wget(new yacyURL("http://192.168.0.1:80/status.htm", null), "192.168.0.1", 5000, "admin", password, null, null, null));
|
|
|
|
|
ArrayList<String> x = nxTools.strings(httpc.wget(new yacyURL("http://192.168.0.1:80/status.htm", null), "192.168.0.1", 5000, "admin", password, null, null, null));
|
|
|
|
|
x = nxTools.grep(x, 1, "IP Address");
|
|
|
|
|
if ((x == null) || (x.size() == 0)) return null;
|
|
|
|
|
String line = nxTools.tail1(x);
|
|
|
|
@ -77,7 +77,7 @@ public class natLib {
|
|
|
|
|
|
|
|
|
|
private static String getWhatIsMyIP() {
|
|
|
|
|
try {
|
|
|
|
|
ArrayList x = nxTools.strings(httpc.wget(new yacyURL("http://www.whatismyip.com/", null), "www.whatsmyip.com", 5000, null, null, null, null, null));
|
|
|
|
|
ArrayList<String> x = nxTools.strings(httpc.wget(new yacyURL("http://www.whatismyip.com/", null), "www.whatsmyip.com", 5000, null, null, null, null, null));
|
|
|
|
|
x = nxTools.grep(x, 0, "Your IP is");
|
|
|
|
|
String line = nxTools.tail1(x);
|
|
|
|
|
return nxTools.awk(line, " ", 4);
|
|
|
|
@ -88,7 +88,7 @@ public class natLib {
|
|
|
|
|
|
|
|
|
|
private static String getStanford() {
|
|
|
|
|
try {
|
|
|
|
|
ArrayList x = nxTools.strings(httpc.wget(new yacyURL("http://www.slac.stanford.edu/cgi-bin/nph-traceroute.pl", null), "www.slac.stanford.edu", 5000, null, null, null, null, null));
|
|
|
|
|
ArrayList<String> x = nxTools.strings(httpc.wget(new yacyURL("http://www.slac.stanford.edu/cgi-bin/nph-traceroute.pl", null), "www.slac.stanford.edu", 5000, null, null, null, null, null));
|
|
|
|
|
x = nxTools.grep(x, 0, "firewall protecting your browser");
|
|
|
|
|
String line = nxTools.tail1(x);
|
|
|
|
|
return nxTools.awk(line, " ", 7);
|
|
|
|
@ -99,7 +99,7 @@ public class natLib {
|
|
|
|
|
|
|
|
|
|
private static String getIPID() {
|
|
|
|
|
try {
|
|
|
|
|
ArrayList x = nxTools.strings(httpc.wget(new yacyURL("http://ipid.shat.net/", null), "ipid.shat.net", 5000, null, null, null, null, null), "UTF-8");
|
|
|
|
|
ArrayList<String> x = nxTools.strings(httpc.wget(new yacyURL("http://ipid.shat.net/", null), "ipid.shat.net", 5000, null, null, null, null, null), "UTF-8");
|
|
|
|
|
x = nxTools.grep(x, 2, "Your IP address");
|
|
|
|
|
String line = nxTools.tail1(x);
|
|
|
|
|
return nxTools.awk(nxTools.awk(nxTools.awk(line, " ", 5), ">", 2), "<", 1);
|
|
|
|
@ -153,10 +153,14 @@ public class natLib {
|
|
|
|
|
String[] ips = ip.split("\\.");
|
|
|
|
|
if (ips.length != 4) return null;
|
|
|
|
|
byte[] ipb = new byte[4];
|
|
|
|
|
ipb[0] = (byte) Integer.parseInt(ips[0]);
|
|
|
|
|
ipb[1] = (byte) Integer.parseInt(ips[1]);
|
|
|
|
|
ipb[2] = (byte) Integer.parseInt(ips[2]);
|
|
|
|
|
ipb[3] = (byte) Integer.parseInt(ips[3]);
|
|
|
|
|
try {
|
|
|
|
|
ipb[0] = (byte) Integer.parseInt(ips[0]);
|
|
|
|
|
ipb[1] = (byte) Integer.parseInt(ips[1]);
|
|
|
|
|
ipb[2] = (byte) Integer.parseInt(ips[2]);
|
|
|
|
|
ipb[3] = (byte) Integer.parseInt(ips[3]);
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
return InetAddress.getByAddress(ipb);
|
|
|
|
|
} catch (UnknownHostException e) {
|
|
|
|
|