I basically used this stuff as a frame: http://java.sun.com/docs/books/tutor...entServer.html
here are the other two programs:
netmulti.java
in the serverSocket = new ServerSocket(139); part, you can put any valid port number that is not alreadyCode:package fakenetpkg; import java.net.*; import java.io.*; public class netmulti { public static void main(String[] args) throws IOException { ServerSocket serverSocket = null; boolean listening = true; try { serverSocket = new ServerSocket(139); } catch (IOException e) { System.err.println("Could not listen on port: 139."); System.exit(-1); } while (listening) new netmultithread(serverSocket.accept()).start(); serverSocket.close(); } }
being used on your system. I used 139 because I was trying to fake the netbios thingy, but if you wanted
a fake telnet for example, you would put 23 in there and change the error to say 23 also, although you
don't have to change the error part.
netmultithread.java
I used that in jbuilder9 and that explains the package thing at the top. if you're not doing this as a project,Code:package fakenetpkg; import java.net.*; import java.io.*; public class netmultithread extends Thread { private Socket socket = null; public netmultithread(Socket socket) { super("netmultithread"); this.socket = socket; } public void run() { try { PrintWriter out = new PrintWriter(socket.getOutputStream(), true); BufferedReader in = new BufferedReader( new InputStreamReader( socket.getInputStream())); String inputLine, outputLine; netprotocol kkp = new netprotocol(); outputLine = kkp.processInput(null); out.println(outputLine); while ((inputLine = in.readLine()) != null) { outputLine = kkp.processInput(inputLine); out.println(outputLine); if (outputLine.equals("Your IP has been logged and your isp will be contacted")) break; } out.close(); in.close(); socket.close(); } catch (IOException e) { e.printStackTrace(); } } }
and by that I mean the different file type in jbuilder9, then you would just remove the line that says
"package fakenetpkg;". I originally did this in JCreator without using a project and that is the code I
posted initially, if I was using jbuilder with a project I would have had to put the package name at the top
of that file too. Well, there are the files, have fun developing.




Reply With Quote