I consider myself a complete noob when it comes to java.....
A couple minutes before finding this, I wrote this....doesn't it do the same thing?
Code:
import java.io.*;
import java.net.*;
public class PortScan {
public static void main(String[] args) throws IOException {
Socket j = new Socket();
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter outFile = new BufferedWriter(new FileWriter(new File("PortScan.txt")));
System.out.println("IP Address or Computer Name?");
String compname = input.readLine();
System.out.print("\nFrom: ");
String x1 = input.readLine();
int start = 0; int finish = 0;
System.out.print("\nTo: ");
String x2 = input.readLine();
try {
start = (Integer.parseInt(x1));
finish = (Integer.parseInt(x2));
}
catch(Exception gay1) {
System.out.println("Invalid Ports");
System.exit(1);
}
System.out.println("Scanning...");
for(int x = start; x <= finish; x++) {
System.out.println("Checking Port " + x);
outFile.write("Port " + x + ":");
try {
j = new Socket(compname,x);
System.out.println("Port Open");
outFile.write(" Open");
outFile.newLine();
}
catch(Exception gay2) {
System.out.println("Port Closed");
outFile.write(" Closed");
outFile.newLine();
}
}
outFile.close();
System.out.println("\nScan Complete");
}
}