-
Notifications
You must be signed in to change notification settings - Fork 0
/
Request.java
52 lines (37 loc) · 1.04 KB
/
Request.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
import java.io.*;
import java.net.*;
import java.util.HexFormat;
import java.util.Random;
public class Request {
private int cursor;
private String[] domains;
private byte[] requestData;
public Request(String[] domainsList) {
domains = domainsList;
this.requestData=new byte[512];
Random rand = new Random();
int id = rand.nextInt(256);
requestData[1] = (byte)id;
requestData[5] = 1;
cursor = 12;
for (int i = 0; i < domains.length; i++){
requestData[cursor] = (byte) domains[i].length();
cursor++;
for (int x = 0; x < domains[i].length(); x++){
requestData[cursor] = (byte)domains[i].charAt(x);
cursor++;
}
}
cursor += 2;
requestData[cursor] = 1;
cursor += 2;
requestData[cursor] = 1;
cursor += 1;
}
public int getCursor(){
return this.cursor;
}
public byte[] getRequest(){
return this.requestData;
}
}