-
Notifications
You must be signed in to change notification settings - Fork 11
/
MainDetector.java
34 lines (31 loc) · 1.16 KB
/
MainDetector.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package itzbenz;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
//LDAPListener
public class MainDetector {
public static int port = 1389;
public static String address = "0.0.0.0";
public static void main(String[] args) throws IOException {
if (args.length != 0) {
String[] addressAndPort = args[0].split(":");
address = addressAndPort[0];
if (addressAndPort.length == 2) {
port = Integer.parseInt(addressAndPort[1]);
}
}
System.out.println();
System.out.println();
System.out.println("${jndi:ldap://localhost:1389/o=reference}");
System.out.println();
System.out.println();
System.out.println("Listening on " + address + ":" + port);
ServerSocket serverSocket = new ServerSocket(port, 50, java.net.InetAddress.getByName(address));
while (true) {
try (Socket socket = serverSocket.accept()) {
System.out.println("Accepted connection from " + socket.getInetAddress().getHostAddress() + ":" +
socket.getPort());
}
}
}
}