1 package com.jsql.view.swing.terminal;
2
3 import java.io.IOException;
4 import java.net.ServerSocket;
5 import java.net.Socket;
6
7 public class ServerInput {
8
9 private ServerSocket serverSocket = null;
10 private final int port;
11 private ServerInputConnection serverInputConnection;
12 private final ExploitReverseShell exploitReverseShell;
13
14 public ServerInput(ExploitReverseShell exploitReverseShell, int port) {
15 this.port = port;
16 this.exploitReverseShell = exploitReverseShell;
17 }
18
19 public void startServer() throws IOException {
20 this.serverSocket = new ServerSocket(this.port);
21 this.serverSocket.setSoTimeout(10000);
22 Socket clientSocket = this.serverSocket.accept();
23 this.serverInputConnection = new ServerInputConnection(this.exploitReverseShell, clientSocket, this);
24 this.serverInputConnection.run();
25 }
26
27 void close() throws IOException {
28 this.serverSocket.close();
29 }
30
31 public ServerInputConnection getServerInputConnection() {
32 return this.serverInputConnection;
33 }
34 }