independent911

independent911

Joined
Feb 12, 2005

Threads

independent911   -  Aug 21, 2019

;Made by independent
;Use it only if my name stays on it.

menu * {
TCPWatch-dataforward:init
}

alias init {
inc %aaa
if (%aaa == 1) {
hadd -m conf ip 127.0.0.1
hadd -m conf port 9051
hadd -m conf p2 9050
}
if (!$sock(fromnet).name) socklisten -d 0.0.0.0 fromnet $hget(conf,port)
if (!$dialog(tcpwatch)) dialog -m tcpwatch tcpwatch
did -a tcpwatch 11 [Info] listening on port $hget(conf,port) redirect to $hget(conf,ip) $+ : $+ $hget(conf,p2) $crlf
did -a tcpwatch 11 [Info] Script has been started %aaa times

}

dialog tcpwatch {
title "TCPWatch-dataforward"
size -1 -1 347 93
option dbu
box "Config", 1, 4 4 66 65
edit "9051", 2, 42 16 22 10
text "Listen Port", 3, 7 17 32 8
edit "127.0.0.1", 4, 13 36 50 10
text "forward to ip", 5, 14 27 47 8
edit "9050", 6, 39 47 23 10
text "To Port", 7, 9 47 25 8
button "START", 8, 4 71 34 12
button "STOP", 9, 39 71 30 12
box "Debug", 10, 69 4 268 65
edit "", 11, 72 13 263 54, result multi autohs autovs hsbar vsbar limit 99999
button "CLEAR", 12, 116 72 37 12
button "SAVE", 13, 214 72 37 12
}

on 1:dialog:tcpwatch:sclick:8:{
init
}
on 1:dialog:tcpwatch:edit:2:{
hadd -m conf port $did(tcpwatch,2)
did -a tcpwatch 11 [Info] changed listen port to $did(tcpwatch,2) $crlf
}
on 1:dialog:tcpwatch:edit:4:{
hadd -m conf ip $did(tcpwatch,4)
did -a tcpwatch 11 [Info] changed ip to $did(tcpwatch,4) $crlf
}
on 1:dialog:tcpwatch:edit:6:{
hadd -m conf p2 $did(tcpwatch,6)
did -a tcpwatch 11 [Info] changed forward port to $did(tcpwatch,6) $crlf
}
on 1:dialog:tcpwatch:sclick:9:{
sockclose fromnet
sockclose redirect

sockclose tcpwatch*
did -a tcpwatch 11 [Info] Closed port. $crlf
}
on 1:dialog:tcpwatch:sclick:13:{
%ticks = $ticks
savebuf -oi tcpwatch 11 data $+ %ticks $+ .txt
run data $+ %ticks $+ .txt

}
on 1:dialog:tcpwatch:sclick:12:{
cleardiag 11
}
alias cleardiag {
did -r tcpwatch $1
}
on 1:SOCKREAD:fromnet*:{
sockread &fromnet
if (!$sock($replace($sockname,fromnet,redirect)).name) sockopen $replace($sockname,fromnet,redirect) $hget(conf,ip) $hget(conf,p2)
if ($sock($replace($sockname,fromnet,redirect)).name) sockwrite -n $replace($sockname,fromnet,redirect) &fromnet
did -a tcpwatch 11 From Net Bin : $bvar(&fromnet,1,$bvar(&fromnet,0)) $crlf
did -a tcpwatch 11 From Net Text: $bvar(&fromnet,1,$bvar(&fromnet,0)).text $crlf

}
on 1:SOCKREAD:redirect*:{
sockread &redirect
if ($sock($replace($sockname,redirect,fromnet)).name) sockwrite -n $replace($sockname,redirect,fromnet) &redirect
did -a tcpwatch 11 Redirect Bin: $bvar(&redirect,1,$bvar(&redirect,0)) $crlf
did -a tcpwatch 11 Redirect Text: $bvar(&redirect,1,$bvar(&redirect,0)).text $crlf

}

on 1:SOCKLISTEN:fromnet:{ %name = fromnet $+ $r(0,99999) | sockaccept %name | if (!$sock($replace($sockname,fromnet,redirect)).name) sockopen $replace(%name,fromnet,redirect) $hget(conf,ip) $hget(conf,p2) }

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.