added WhoIsClient and parsing for whois.ripe.net

This commit is contained in:
jomu
2013-03-24 13:51:11 +00:00
parent e0d47d1251
commit c75e96964d
7 changed files with 390 additions and 1 deletions

View File

@ -0,0 +1,16 @@
package de.muehlencord.shared.network;
import org.junit.Test;
/**
*
* @author jomu
*/
public class RangeToCidrTest extends BaseTest {
@Test
public void testRangeToCidr() {
System.out.println (CidrTool.rangeToCidrList("212.204.60.0", "212.204.60.255"));
}
}

View File

@ -0,0 +1,48 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package de.muehlencord.shared.network;
import java.io.IOException;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.text.ParseException;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author jomu
*/
public class WhoisTest extends BaseTest {
@Test
@Ignore
public void testDenicWhoIs() throws UnknownHostException, SocketException, IOException, ParseException {
Whois whoIsClient = new Whois();
// Denic answers "status: connect" only
whoIsClient.execute ("whois.denic.de", "-T dn,ace muehlencord.de");
}
@Test
@Ignore
public void testInternic() throws UnknownHostException, SocketException, IOException, ParseException {
Whois whoIsClient = new Whois();
// Denic answers "status: connect" only
whoIsClient.execute ("whois.1api.net", "egameladder.com");
}
@Test
public void testStepWise() throws UnknownHostException, SocketException, IOException, ParseException {
Whois whoIsClient = new Whois();
// whoIsClient.execute ("whois.ripe.net", "88.198.181.181");
whoIsClient.execute ("whois.ripe.net", "212.204.60.1");
assertTrue ("network", whoIsClient.getNetwork().contains("212.204.60.0/24"));
// whoIsClient.execute ("whois.ripe.net", "212.204.60.0");
// whoIsClient.execute ("whois.ripe.net", "212.0.0.0/8");
}
}

View File

@ -5,4 +5,4 @@ log4j.debug=false
log4j.appender.ConsoleLogger=org.apache.log4j.ConsoleAppender
log4j.appender.ConsoleLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.ConsoleLogger.layout.ConversionPattern= %d - %m (%c)%n
log4j.appender.ConsoleLogger.threshold=INFO
log4j.appender.ConsoleLogger.threshold=DEBUG