Raw Socket Writing Tool

By CinosModnar on Sep 05, 2011

This script allows you to easily communicate with servers listening on ports. This is good for debugging and experimenting with raw socket writing. This script is one of my older scripts and might be a bit buggy. If you find any bugs, please comment.

;SOCKET by Cinos Modnar
;An integrated raw socket writing add-on for mIRC!
;/server -m irc.cinos.biz -j #Chat

alias socket {
  if (!$2) { 
    echo $color(info) -a * /socket: Usage: .socket <host|ip> <port>
    halt
  } 
  if ($2 !isnum 1-65535) { echo $color(info) -a * .socket: PORT must be a number from 1-65535 inclusive.
  halt }
  if (!$sock($+(socket-,$1,:,$2))) {
    sockopen $+(socket-,$1,:,$2) $1 $2
    window -gke103 $+(@,socket-,$1,:,$2)
    aline -ph 2 $+(@,socket-,$1,:,$2) * Connecting to $+($1,:,$2)
  }
}
on *:SOCKOPEN:socket-*: {
  if ($sock($sockname).status == active) {
  ;fixed bug here by checking socket status.
    aline -ph 3 $+(@,$sockname) * Connected!
  } 
  else { aline -ph 3 $+(@,$sockname) * Unable to connect. 
  }
}
on *:SOCKREAD:socket-*: {
  sockread -f %t.sr
  aline -ph $+(@,$sockname) %t.sr
  unset %t.sr
}
on *:SOCKCLOSE:socket-*: {
  aline -ph 2 $+(@,$sockname) * Disconnected from $sock($sockname).addr $+[(,$sock($sockname).ip,]) (Host disconnected)
}
on *:CLOSE:@socket-*: {
  sockclose $remove($target,@)
}
on *:INPUT:@socket-*: {
  if ($mid($1,1,1) != .) {
    sockwrite -nt $remove($target,@) $1-
    aline -ph $target $1-
  }
}

Comments

Sign in to comment.
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.