All pastes #538819 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-06-05 03:43 UTC
rendered paste body
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;             bl/i/nkenraid for /b/lackup               ;;
;;                        luapur                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                      Linking                          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;  This is a TCP implementation, so the b&hammer won't  ;;
;;        effect any links that are in progress.         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

on *:START:{
  if ($read(linkconf.txt,1) == goahead) {
    echo [/i/] initialized blinkenl/i/nk daemon, operating on port $read(linkconf.txt,1)
    socklisten blinkenlink $read(linkconf.txt,1)
  }
}

on *:socklisten:blinkenlink:{
  if (%blnk.linkproc.tmp == 1) { halt }
  else {
    set %blnk.lnksock.tmp blinkenlnk $+ $rand(1,1000) $+ $rand(A,Z)
    sockaccept %blnk.lnksock.tmp
    echo [/i/] I just accepted a link. We're going through the link identification process right now. The IP is $sock( $+ %blinkenlnk.tmp $+ ).ip
  set %blnk.linkproc.tmp 1 }
}

on *:sockread:blinkenlnk*:{
  sockread %blnk.sockread.tmp
  if ($sockname == %blnk.lnksock.tmp) { linknego %blnk.sockread.tmp }
  else { linkproc %blnk.sockread.tmp }
}

alias linknego {
  if ($1 == LINKREQ) { 
    set %blnk.bot1.tmp $1 
    set %blnk.authcode.tmp $2 
  linkauthfunc codechk }
  if ($1 == LINKACC) {
   set %blnk.bot1. $+ %blnk.lnksock.tmp
   set %blnk
}

alias -l linkauthfunc {
  if ($1 == codechk) {
    if (%blnk.authcode.tmp == $read(linkconf.txt,2)) {
      echo [/i/] %blnk.bot1.tmp has the correct authcode. Continuing.. 
    sockwrite -n %blnk.lnksock.tmp %furc.usr1.username }
    else { [/i/] %blnk.bot1.tmp did not have the correct authcode. Disconnecting.. | sockwrite -n %blnk.sockread.tmp TERM IPASS | sockclose %blnk.lnksock.tmp }
  }
}