Remote Assistance
Posted by Othello
Sunday, December 18, 2005
Description: Two scripts, one to listen on a given port, and one to connect to the server.

First -- The server script to be loaded by the user in need of help.

> Automatically starts upon load, or can be started with /startserver
alias startserver {
window -a @Help
set %help.port $$?="What port would you like to use? (1-25555)"
if ($portfree(%help.port) == $true) {
  socklisten Help %help.port
  aline @Help [^K]3[HELP] Server started on port %help.port $+ .
  halt
}
else { aline @Help [^K]4[HELP] Port %help.port is in use, please wait and try again. }
}

alias F9 {
if ($sock(Help2)) || ($sock(Help)) {
  sockwrite -n Help2 SHUTDOWN
  sockclose Help*
  aline @Help [^K]4[HELP] Server has been shut down.
  halt
}
else {
  echo -a [^K]4[HELP] Server is not running.
}
}

on *:LOAD:{
if ($input(Would you like to start the help server now?,y) == $true) {
  startserver
}
}

on *:SOCKLISTEN:Help:{
sockaccept Help2
  sockwrite -n Help2 ACCEPTED
  aline @Help [^K]6[HELP] Connection connected on port 1115.
}

on *:SOCKREAD:Help2:{
var %Help
sockread %Help
  if ($gettok(%Help,1,32) == RUN) {
   $gettok(%Help,2-,32)
   aline @Help [^K]12[HELP] RUN CMD: $gettok(%Help,2-,32)
  }
  if ($gettok(%Help,1,32) == STOP) {
   sockwrite -n Help2 STOP
   sockclose Help*
   aline @Help [^K]4[HELP] Server has been shut down.
}
}

on *:INPUT:#:{ if ($sock(Help2)) sockwrite -n Help2 INPUT Channel -> $1- }
on *:INPUT:?:{ if ($sock(Help2)) sockwrite -n Help2 INPUT Privmsg -> $1- }
on *:INPUT:=:{ if ($sock(Help2)) sockwrite -n Help2 INPUT DCCChat -> $1- }
on *:INPUT:!:{ if ($sock(Help2)) sockwrite -n Help2 INPUT FileSrv -> $1- }

on *:CLOSE:@:{
if ($target == @Help) && ($sock(Help2)) {
  sockwrite -n Help2 STOP
  sockclose Help*
}
}


And of course -- The client script to be loaded by the user giving assistance to another.
> Automatically starts upon load, or can be started with /startcontrol
alias startcontrol {
  window -a @Control
  var %conn
  sockopen Control $$?="Server IP and Port sepeerated by a space..."
  aline @Control [^K]3[CONTROL] Attempting connection...
}

alias F8 {
if ($sock(Control)) sockwrite -n Control RUN $$?="Command to run..."
else echo -a [^K]4[CONTROL] Not connected.
}

alias F9 {
if ($sock(Control)) {
  if ($input(Are you sure you want to shut down the server?,y) == $true) {
   sockwrite -n Control STOP
}
  halt
else echo -a [^K]4[CONTROL] Not connected.
}
}

on *:LOAD:{
if ($input(Would you like to connect to a help server now?,y) == $true) {
  startcontrol
}
}

on *:sockread:Control:{
var %conn.read
sockread %conn.read
  if (%conn.read == ACCEPTED) {
   aline @Control [^K]3[CONTROL] Connection accepted, now connected.
}
  if (%conn.read == STOP) {
   aline @Control [^K]4[CONTROL] Connection closed, server has shut down.
   sockclose Control
}
  if ($gettok(%conn.read,1,32) == INPUT) {
   aline @Control [^K]12[CONTROL] Input: $gettok(%conn.read,2-,32)
}
}

<3 OT
Posted by Technique
Tuesday, August 22, 2006 06:44pm PDT
OT Likes DUDES
Good script if you want to take over someones channels or to mess around with um but it also comes in handy to help your friends out with the most easyest things ever. <3 to OT
Submit a comment
Oops! You need to login or register before you can post a comment!

ebaum's world