Fake an Ident Response Fake a simple Identification Protocol server to
convince IRC servers who you are The Code [Discuss (0) | Link to this hack]
The Code
Save the following in a file called
IdentServer.java:
import java.net.*;
import java.io.*;
public class IdentServer {
public static void ident(String login) throws IOException {
// Wait for a connection on port 113.
ServerSocket ss = new ServerSocket(113);
Socket socket = ss.accept( );
BufferedReader reader = new BufferedReader(
new InputStreamReader(socket.getInputStream( )));
BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(socket.getOutputStream( )));
// Read the line from the connecting client.
String line = reader.readLine( );
if (line != null) {
System.out.println(line);
// Create our line of reply and send it back.
line = line + " : USERID : UNIX : " + login;
System.out.println(line);
writer.write(line + "\r\n");
writer.flush( );
}
// Close the connection and let the program end.
writer.close( );
ss.close( );
}
public static void main(String[] args) {
try {
// Tell the ident server to respond with the login "paul".
ident("paul");
}
catch (IOException e) {
// If anything goes wrong, print it to the standard output.
e.printStackTrace( );
}
}
}