You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
2.2 KiB

# Connect to firewalled sysreset fserves without /dccserver
# Everything here was derived through simple experimentation while learning how everything involved
# works. If there's a better way I'm in no rush figure it out.
# Firewalled sysreset fserves try to open a dcc chat connection to the target port and send
# the message "100 fservenick". After the fserve sends the "100 fservenick" message it expects a
# "101 recipientnick" message, with "recipientnick" being the nick of whoever got the message.
# I wasn't able to send it some1 else's nick and get a connection that way, which would be
# interesting since you could theoretically serve connections to other ppl behind firewalls.
# This code requires opening a listening socket, but since sysreset is mircx specific (essentially
# winhozed specific) it doesn't hestitate to asking people who connect to open a listening port in
# the well known/privileged range which requires root (NONO). To deal with this, I setup iptables
# to forward packets bound for port 59 to port 12345 (which can be bound by non-root) by using:
# "iptables -t nat -I PREROUTING -p tcp -m multiport --dports 59 -j DNAT --to-destination :12345"
# (this requires root)
# There also appears to also be an option for some firewalled dcc send protocol. I've only
# encountered this once though and didn't care to figure it out.
# Execute all the following code in the "New code tester" window
alias(srfs) # Create alias: srfs
if($0 && $1) # make sure there are enough parameters
{ -n -u -p=12345 $0; # listen on port 12345 for incoming chat
ctcp $0 $1-; # send the ctcp trigger
echo "Usage: /srfs <nick> <trigger>"; # when there aren't enough parameters
event(OnDCCChatMessage,srfsHook) # Create OnDCCChatMessage event: srfs
# Since this event will parse ALL dcc chat messages, it looks for a message in the format
# "100 word" with no other trailing text. This is only a hack so it doesn't verify that
# "word" is a nickname, much less the nick of an expected fserve.
if(!$str.cmp($str.word(0, $0-), "100") && $str.cmp($str.word(1, $0-), "") && !$str.cmp($str.word(2, $0-), ""))
say "101 $me"; # reply 101 mynick # reply "101 mynick"
# End