-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInjector.jl
44 lines (33 loc) · 866 Bytes
/
Injector.jl
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
using Sockets
function conecta(c, cn)
println("\n[#] Client #$cn Received!")
request = readline(c)
println("[-] Cliente Request: ", request)
host = strip(split(split(request, ":")[1])[2])
port = parse(Int32, strip(split(split(request, ":")[2])[1]))
s = connect(host, port)
write(c, "HTTP/1.1 200 Established\r\n\r\n") # Send 200 OK to Client.
@async while true
# Download
data = readavailable(s)
length(data) == 0 ? break : Nothing
write(c, data)
end
while true
# Upload
data = readavailable(c)
length(data) == 0 ? break : Nothing
write(s, data)
end
println("[!] Client #$cn Disconnected!")
end
# Listen.
l = listen(ip"127.0.0.1", 8088)
println("[-] Listen on IP and Port: 127.0.0.1:8088")
cn = -1
while true
global cn += 1
c = accept(l)
atendimento() = conecta(c, cn)
schedule(Task(atendimento))
end