This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Botnet relay script

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Botnet relay script

Post by Fire-Fox »

Hey!

I have found and tried to get this to work (IM NOT A TCL GURU!)
so it's proberly the wrong way i have done it, but atleast i have tried :)

Bot 1. where it should grab text from

Code: Select all

bind pubm - "\$send" send:msg
proc send:msg {nick host hand chan text} {
set leaf "YoYo"
putlog $leaf $text
putserv "privmsg addpre $text"
putbot $leaf "output [join [lrange [split $text] 0 end]]"
}
putlog "output1.tcl - loaded"
BOT 2. - Where is should output the text

Code: Select all

bind bot - "output" get:msg
proc get:msg {bot command text} {
putserv "privmsg #chan :[join $text]"
}
putlog "output2.tcl - loaded"
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Post by arfer »

I'm not sure if it's the only problem but the mask in a pubm bind is matched against #channelname followed by channel text. In any event, even if it worked, your proc would only respond to $send and not $send <text here>.

Code: Select all

bind PUBM - "#% \$send ?*" myproc
proc myproc {nick uhost hand chan text} {
  # code to execute here
}
The above code would now work in response to $send followed by a space followed by anything at least 1 character in length and in any bot channel. It isn't perfect because presumably that one character could be another space. Adding some form of text checking routine inside the proc could prevent this.
I must have had nothing to do
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

A few more remarks:
  • putlog only expects one parameter, the text to be logged. You are currently passing two parameters; "YoYo" and the text written in the channel.
    Enclose both variables within a string if you'd like to prefix the log message with YoYo:

    Code: Select all

    putlog "$leaf $text"
  • All irc command expects the last parameter to be prefixed by a colon : if it's the last command and it may contain spaces. For convenience, you may also use the same prefix with the last parameter even if it does not contain a space

    Code: Select all

    putserv "PRIVMSG addpre :$text"
  • lrange with ranges 0 - end will return the original list unaltered. Thus, the following piece of code is completely pointless:

    Code: Select all

    join [lrange [split $text] 0 end]
    Eggdrop handles the botnet message as a string, and extracts the first word as the command, leaving the rest as the text. Thus, you don't need to bother with list conversions:

    Code: Select all

    putbot $leaf "output $text"
  • Within your get:msg proc, $text is already a string. Don't use join here.
Fixing the above (and arfer's) remarks, the code should look somewhat like this:

Code: Select all

bind pubm - "% \$send *" send:msg
proc send:msg {nick host handle channel text} {
  putlog "YoYo => $text"
  putserv "PRIVMSG addpre :$text"
  putbot "output $text"
}

#####
bind bot - "output" get:msg
proc get:msg {bot command text} {
  putserv "PRIVMSG #channel :$text"
}
NML_375
Post Reply