-
Notifications
You must be signed in to change notification settings - Fork 5
/
Main.java
101 lines (79 loc) · 2.84 KB
/
Main.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package src.Main.DDosSoftware;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;
import src.Main.DDosSoftware.DDosLogic.Packets.Packet_1_18_2;
import src.Main.DDosSoftware.GUI.GUI;
public class Main {
public static void main(String[] args) {
GUI.start();
}
public static void proxyStart() {
Scanner scan = new Scanner(System.in);
int DEFAULT_BYTE_SIZE = 10000;
int DEFAULT_SERVER_BYTE_SIZE = 10000;
String IP;
String PORT;
ServerSocket proxySocket = null;
Socket client = null;
Socket server = null;
InputStream cIS = null;
OutputStream cOS = null;
byte[] cBuffer = new byte[DEFAULT_BYTE_SIZE];
InputStream sIS = null;
OutputStream sOS = null;
byte[] sBuffer = new byte[DEFAULT_SERVER_BYTE_SIZE];
System.out.println("Type IP: ");
IP = scan.nextLine();
if (IP.equalsIgnoreCase("")) {
IP = "127.0.0.1";
}
System.out.println("Type PORT:");
PORT = scan.nextLine();
if (PORT.equalsIgnoreCase("")) {
PORT = "25565";
}
try {
proxySocket = new ServerSocket(5000);
System.out.println("Proxy is started!");
client = proxySocket.accept();
System.out.println(client.getLocalPort() + " accepted");
if (client != null) {
cIS = client.getInputStream();
cOS = client.getOutputStream();
}
server = new Socket(IP, Integer.parseInt(PORT));
if (server != null) {
sIS = server.getInputStream();
sOS = server.getOutputStream();
}
Packet_1_18_2 packet = new Packet_1_18_2();
while (true) {
if (cIS.available() > 0) {
int similarCounter = 0;
cIS.read(cBuffer);
sOS.write(cBuffer);
System.out.print("\u001B[31mCLIENT: ");
for (int index = 0; index < cBuffer.length; index++) {
System.out.print(cBuffer[index] + " ");
}
System.out.println("\n");
Thread.sleep(2000);
cBuffer = new byte[DEFAULT_BYTE_SIZE];
System.out.println("\u001B[37m");
}
if (sIS.available() > 0) {
sIS.read(sBuffer);
cOS.write(sBuffer);
System.out.print("SERVER: + ");
System.out.println("\n");
Thread.sleep(2000);
sBuffer = new byte[DEFAULT_SERVER_BYTE_SIZE];
}
}
} catch (Exception e) {
}
}
}