Import java.net .*;
Import java. Io .*;
Public class implements runnable
{
Private inetaddress IPaddress;
Private int port;
Private thread allportthread;
Public IP (string IPaddress, int port)
{
Try
{
This. IPaddress = This. IPaddress. getbyname (IPaddress );
This. Port = port;
}
Catch (exception E)
{
System. Out. println ("the host does not exist .");
}
}
Public void run ()
{
Try
{
Socket testport = new socket (this. IPaddress, this. Port); // if this port cannot been connected, throw a exception.
System. Out. println (this. Port + ": exist"); // If connected, print out.
}
Catch (exception e ){}
}
Public static void main (string [] ARGs)
{
String STR;
STR = "tpoi route 1.0-network host failed/N ";
STR + = "Author: t.t (tpoi: http://www.tpoi.net)/n ";
STR + = "Usage: usage <Options> STR + = "<Options> List:/N ";
STR + = "-Allport: scan the status of all the ports of the specified host/N ";
STR + = "-port % 0: scan the status of the specified ports (% 0) of the specified host/n ";
STR + = "Examples:/N ";
STR + = "Your-Allport www.microsoft.com/N ";
STR + = "Your-port 80 21.64.34.191 ";
If (ARGs. Length = 0)
{
System. Out. println (STR );
}
Else
{
ARGs [0] = ARGs [0]. touppercase (). Trim ();
Char switchargs = ARGs [0]. charat (1 );
Switch (switchargs)
{
Case 'A ':
{
For (INT I = 1; I <= 65535; I ++)
{
Using maindomains = new domains (ARGs [1], I );
If (maindomains. allportthread. activecount ()> 100)
Maindomains. Run ();
Else
{
Mainpipeline. allportthread = new thread (mainpipeline );
Mainusers. allportthread. Start ();
}
}
Break;
}
Case 'p ':
{
Using mainvertex = new vertex (ARGs [2], java. Lang. Integer. parseint (ARGs [1], 10 ));
Try
{
Maindomains. Run ();
}
Catch (exception E)
{
System. Out. println ("parameter error ");
}
Break;
}
Default:
System. Out. println (STR );
}
}
}
}