//Author: Unknown
;telnet
menu menubar {
  Clear:/clear
  $iif($sock(telnet).name == $null,Connect,Disconnect):{
    if ( $sock(telnet).name == $null ) { /telnet }
    else { /sockclose telnet }
  }
}
;Sock telnet client
on *:Sockopen:telnet:{
  if ($sockerr > 0) { echo @telnet 7*** Unable to connect to $sock($sockname).ip on port $sock($sockname).port | /write logs\telnet.log *** Unable to connect to $sock($sockname).ip on port $sock($sockname).port | halt }
  /echo @telnet 7*** Connected to $sock($sockname).ip on port $sock($sockname).port $+ . Please weit.
  /write logs\telnet.log *** Connected to $sock($sockname).ip on port $sock($sockname).port $+ . Please weit.
}
on *:sockread:telnet:{
  sockread %tmp
  /echo @telnet 14 $+ %tmp
  /write logs\telnet.log %tmp
}
on *:input:@telnet:{
  /sockwrite -tn telnet $1-
  /echo @telnet 6!> $1-
  /write logs\telnet.log !> $1-
}
alias telnet {
  if ($1 == $null) { 
    $_dg(telnet,m)
  }
  if ($2 == $null) { 
    $_dg(telnet,m)
  }
  else {
    if (!$sock(telnet)) {
      /sockopen telnet $1 $2
      /window -e @telnet
      /echo @telnet 7*** Connecting to $1 on port $2
      /write logs\telnet.log *** Connecting to $1 on port $2
    }
    else sinfo Telnet client is inuse.
  }
}
dialog telnet {
  title "Telnet client"
  size -1 -1 228 100
  icon c:\windows\telnet.exe
  box "Settings", 1, 0 -1 228 100
  edit "", 2, 88 19 134 21, autohs 
  text "Address", 3, 12 22 38 16
  edit "", 4, 88 49 70 21, autohs 
  text "Port", 5, 12 50 19 16
  button "&Connect", 6, 6 74 53 20, ok
}
on *:dialog:telnet:sclick:*:{
  if ($did == 6) {
    if ($did(2) == $null) { /info $ud 4Please enter host! | halt }
    if ($did(4) == $null) { /info $ud 4Please enter port! | halt }
    else {
      /sockopen telnet $did(2) $did(4) 
      /window -e @telnet
      /echo @telnet 7*** Connecting to $did(2) on port $did(4)
      /write logs\telnet.log *** Connecting to $did(2) on port $did(4)
    }
  }
}
on *:sockclose:telnet:{
  /echo @telnet 7*** Connection closed!
  /write logs\telnet.log *** Connection closed!
}
on *:close:@telnet:{
  /write logs\telnet.log *** Connection closed!
  /sinfo Telnet connection terminated!
  /sockclose telnet
}
Published in: mIRC
Download

Related snippets