-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtcpcopy_handshake.html
201 lines (182 loc) · 7.32 KB
/
tcpcopy_handshake.html
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TCPCopy Animation</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
background-color: #222;
color: #eee;
padding-top: 50px;
position: relative;
}
.container {
display: flex;
justify-content: space-around;
align-items: center;
width: 90%;
margin: 50px auto;
position: relative;
}
.box {
width: 250px;
height: 100px;
line-height: 100px;
font-size: 16px;
font-weight: bold;
border-radius: 10px;
border: 2px solid #ccc;
position: relative;
}
.closed { background-color: gray; }
.before_established { background-color: #f1c40f; }
.established { background-color: #2ecc71; }
.packet {
position: absolute;
width: 130px;
height: 45px;
line-height: 45px;
font-size: 14px;
font-weight: bold;
border-radius: 5px;
background-color: #3498db;
color: #fff;
visibility: hidden;
}
.shadow_packet {
position: absolute;
width: 130px;
height: 45px;
line-height: 45px;
font-size: 14px;
font-weight: bold;
border-radius: 5px;
background-color: green;
color: #fff;
visibility: hidden;
}
.state {
font-size: 14px;
font-weight: bold;
margin-top: 5px;
color: #f1c40f;
}
/* Watermark style */
.watermark {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 50px;
font-weight: bold;
color: rgba(255, 255, 255, 0.15); /* Light color for watermark */
pointer-events: none; /* Ensures it's not interactive */
z-index: 10;
user-select: none; /* Prevents text selection */
}
</style>
</head>
<body>
<h2>TCPCopy Three-Way Handshake Animation</h2>
<div class="container">
<div>
<div id="clientBox" class="box closed">Client</div>
<div id="clientState" class="state">CLOSED</div>
</div>
<div>
<div id="serverBox" class="box closed">Server(tcpcopy)</div>
<div id="serverState" class="state">LISTEN</div>
</div>
<div>
<div id="testServerBox" class="box closed">Target Server</div>
<div id="testServerState" class="state">LISTEN</div>
</div>
<div>
<div id="auxServerBox" class="box closed">Assistant Server(intercept)</div>
<div id="auxServerState" class="state">CLOSED</div>
</div>
</div>
<div id="synPacket" class="packet">SYN -></div>
<div id="synAckPacket" class="packet"><- SYN-ACK</div>
<div id="ackPacket" class="packet">ACK -></div>
<div id="synPacket2" class="shadow_packet">SYN -></div>
<div id="synAckPacket2" class="shadow_packet"><- SYN-ACK</div>
<div id="synAckPacket2_info" class="shadow_packet"><- MESSAGE</div>
<div id="ackPacket2" class="shadow_packet">ACK -></div>
<div class="watermark">wangbin579</div>
<script>
function updateState(element, text) {
document.getElementById(element).innerText = text;
}
function startHandshake() {
let clientBox = document.getElementById("clientBox");
let serverBox = document.getElementById("serverBox");
let testServerBox = document.getElementById("testServerBox");
let auxServerBox = document.getElementById("auxServerBox");
let clientX = clientBox.getBoundingClientRect().x + 80;
let serverX = serverBox.getBoundingClientRect().x;
let testServerX = testServerBox.getBoundingClientRect().x;
let auxServerX = auxServerBox.getBoundingClientRect().x;
let syn = document.getElementById("synPacket");
let synAck = document.getElementById("synAckPacket");
let ack = document.getElementById("ackPacket");
let syn2 = document.getElementById("synPacket2");
let synAck2 = document.getElementById("synAckPacket2");
let synAck2_info = document.getElementById("synAckPacket2_info");
let ack2 = document.getElementById("ackPacket2");
// First handshake
gsap.timeline()
.set(syn, { visibility: "visible", x: clientX, y: -50 })
.call(() => {
updateState("clientState", "SYN_SENT");
clientBox.className = "box before_established";
})
.to(syn, { x: serverX, duration: 5 })
.set(syn, { visibility: "hidden" })
.call(() => {
updateState("serverState", "SYN_RCVD");
serverBox.className = "box before_established";
})
.set(syn2, { visibility: "visible", x: serverX, y: 50 })
.to(syn2, { x: testServerX, duration: 5 })
.set(syn2, { visibility: "hidden" })
.call(() => {
updateState("testServerState", "SYN_RCVD");
testServerBox.className = "box before_established";
})
.set(synAck, { visibility: "visible", x: serverX, y: -50 })
.to(synAck, { x: clientX, duration: 5 })
.set(synAck, { visibility: "hidden" })
.call(() => {
updateState("clientState", "ESTABLISHED");
clientBox.className = "box established";
})
.set(synAck2, { visibility: "visible", x: testServerX, y: 50 })
.to(synAck2, { x: auxServerX, duration: 5 })
.set(synAck2, { visibility: "hidden" })
.set(synAck2_info, { visibility: "visible", x: auxServerX, y: 50 })
.to(synAck2_info, { x: serverX, duration: 5 })
.set(synAck2_info, { visibility: "hidden" })
.set(ack, { visibility: "visible", x: clientX, y: -50 })
.to(ack, { x: serverX, duration: 5 })
.set(ack, { visibility: "hidden" })
.call(() => {
updateState("serverState", "ESTABLISHED");
serverBox.className = "box established";
})
.set(ack2, { visibility: "visible", x: serverX, y: 50 })
.to(ack2, { x: testServerX, duration: 5 })
.set(ack2, { visibility: "hidden" })
.call(() => {
updateState("testServerState", "ESTABLISHED");
testServerBox.className = "box established";
});
}
setTimeout(startHandshake, 1000);
</script>
</body>
</html>