forked from Srar/MemcacheDos
-
Notifications
You must be signed in to change notification settings - Fork 5
/
PacketsStruct.ts
92 lines (86 loc) · 1.81 KB
/
PacketsStruct.ts
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
export enum EthernetType {
ARP,
IPv4,
IPv6,
}
export interface BasePacket {
sourceAddress?: Buffer,
destinaltionAddress?: Buffer,
type?: EthernetType,
}
export interface ArpPacket extends BasePacket {
hardwareType: Buffer,
protocolType: Buffer,
hardwareSize: Buffer,
protocalSize: Buffer,
opCode: Buffer,
senderMacAddress: Buffer,
senderIpAdress: Buffer,
targetMacAddress: Buffer,
targetIpAddeess: Buffer,
}
export enum IpProtocol {
IPv6HopByHop = 0,
ICMPv4 = 1,
IGMP = 2,
IPv4 = 4,
TCP = 6,
UDP = 17,
RUDP = 27,
IPv6 = 41,
IPv6Routing = 43,
IPv6Fragment = 44,
GRE = 47,
ESP = 50,
AH = 51,
ICMPv6 = 58,
NoNextHeader = 59,
IPv6Destination = 60,
IPIP = 94,
EtherIP = 97,
SCTP = 132,
UDPLite = 136,
MPLSInIP = 137,
IPv4_PSEUDO_LENGTH = 12
}
export interface IpPacket extends BasePacket {
version?: number,
ipHeaderLength?: number,
TOS?: number,
totalLength?: number,
identification?: number,
flags?: number,
fragOffset?: number,
TTL?: number,
protocol?: IpProtocol,
checksum?: number,
sourceIp?: Buffer,
destinationIp?: Buffer
}
export interface TcpPacket extends IpPacket {
sourcePort?: number,
destinationPort?: number,
sequenceNumber?: number,
acknowledgmentNumber?: number,
tcpHeaderLength?: number,
FIN?: boolean,
SYN?: boolean,
RST?: boolean,
PSH?: boolean,
ACK?: boolean,
URG?: boolean,
ECE?: boolean,
CWR?: boolean,
NS?: boolean,
window?: number,
checksum?: number,
urgent?: number,
options?: Buffer,
payload?: Buffer,
}
export interface UdpPacket extends IpPacket {
sourcePort?: number,
destinationPort?: number,
totalLength: number,
payload: Buffer
}