| View previous topic :: View next topic |
| Author |
Message |
level6 Voice
Joined: 07 Mar 2017 Posts: 6 Location: DALLAS, TX, USA
|
Posted: Tue Mar 07, 2017 8:15 am Post subject: Determining the bot's own current nick? |
|
|
Hi. New here, but have been using eggdrop since the 90s.
Is there any [built-in] way to determine the eggdrop bot's own nick at any given time?
What I really want is to allow it to become self-aware of its own attributes via getuser with the BOTFL, but those functions appear to be dependent on nick. If there is any way to get "my own" attributes on each bot, that would work, too.
My end game is to be able to write and distribute a single script for all bots on a botnet, then have leaf bots behave differently than hub bots using code in that script. I am just getting tired of maintaining two scripts for every thing (one for hubs, one for leaves). So, if I am missing some other obvious way to do this, please let me know.
Thanks!
Raymond. |
|
| Back to top |
|
 |
Get_A_Fix Master

Joined: 07 May 2005 Posts: 206 Location: New Zealand
|
Posted: Tue Mar 07, 2017 12:34 pm Post subject: |
|
|
Have you checked the ~/eggdrop/doc/tcl-commands.doc file?
The built-in method would be the $botnick variable. You can return your own handle with [matchattr [nick2hand $nick]] and your attributes using [chattr [nick2hand $nick] $chan] _________________ We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
Last edited by Get_A_Fix on Tue Mar 07, 2017 8:31 pm; edited 1 time in total |
|
| Back to top |
|
 |
level6 Voice
Joined: 07 Mar 2017 Posts: 6 Location: DALLAS, TX, USA
|
Posted: Tue Mar 07, 2017 12:41 pm Post subject: |
|
|
I did. But, the names of things are a little scattered and it makes it difficult to search. I was looking for "my" and "is". Coulda sworn I searched for "bot"... but now I feel dumb.
Thank you! That is exactly what I was looking for. You rock. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Tue Mar 07, 2017 12:43 pm Post subject: Re: Determining the bot's own current nick? |
|
|
| level6 wrote: | Hi. New here, ...
|
Welcome.
| Quote: |
Is there any [built-in] way to determine the eggdrop bot's own nick at any given time?
|
Wouldn't that be the global variable, botnick ?
http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html#globvars
| Quote: |
What I really want is to allow it to become self-aware of its own attributes via getuser with the BOTFL, but those functions appear to be dependent on nick. If there is any way to get "my own" attributes on each bot, that would work, too.
|
I think that I'm not understanding you.
Attributes are flags saved in an account on a bot. It seems like to do what you want, the bot would have to have an account on itself.
Why would the bot have itself in it's .user file?
| Quote: |
My end game is to be able to write and distribute a single script for all bots on a botnet, then have leaf bots behave differently than hub bots using code in that script. I am just getting tired of maintaining two scripts for every thing (one for hubs, one for leaves). So, if I am missing some other obvious way to do this, please let me know.
|
What would trigger the behavior to which they would react differently?
If you don't care if others see your script(s), you might get more results if you posted them here with the /[code/] /[/code/] tags.
Or:
http://paste.tclhelp.net/ _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
level6 Voice
Joined: 07 Mar 2017 Posts: 6 Location: DALLAS, TX, USA
|
Posted: Tue Mar 07, 2017 2:34 pm Post subject: |
|
|
I was hoping to trigger that on the "h"ub vs. "l"eaf bot flags. I am seeing your point, now, though. If the bot currently running the script is not in users, then there will be no attributes to get. Bleh.
I was going for something like this:
| Code: |
# not going to work...
set bothandle [nick2hand $botnick]
if {[set nfo [getuser $bothandle BOTFL]] != "" && [string match "*h*" $nfo]} {
set ismaster=1
} else {
set ismaster=0
}
if {$ismaster}
{
bind pub - .attack botnet_fruitattack_pub
bind dcc - attack botnet_fruitattack
putlog "Botnet Fruit Attacker v1.0 Loaded as MASTER!"
} else {
bind bot - attack botnet_fruitattack
putlog "Botnet Fruit Attacker v1.0 Loaded as SLAVE!"
}
|
Then, in the procs:
| Code: |
.
.
if {$ismaster} {
putlog "MASTER $botnick - Sending orders to all bots to Fruit Attack!"
putallbots "attack $whotoattack $chan"
dccbroadcast "MASTER $botnick - Command accepted. I will $how $whotoattack with $what!"
dccbroadcast "MASTER $botnick - Command sent to all bots!"
} else {
putlog "SLAVE $botnick - Command accepted. I will $how $whotoattack with $what!"
dccbroadcast "SLAVE $botnick - Command accepted. I will $how $whotoattack with $what!"
}
putserv "PRIVMSG $chan : -=( $how $whotoattack with $what )=-"
.
.
|
I think I will just have to hardcode my own global assigning ismaster or isslave in a separate script on each bot and consider that part of the initial set-up. Then I could use that for the rest of my scripts.
Mostly, I just need to separate the binds and the putallbots so that the same script can be transferred across all bots.
Or, is this all just crazy talk?  |
|
| Back to top |
|
 |
level6 Voice
Joined: 07 Mar 2017 Posts: 6 Location: DALLAS, TX, USA
|
Posted: Wed Mar 08, 2017 3:16 am Post subject: |
|
|
Bad TCL, for sure. Frankly, I struggle with TCL. But, that's neither here nor there.
So, this is what worked:
1) Either in your eggdrop,conf or in a separate script (botcfg.tcl or something) you load via eggdrop.conf:
Change that to 0 on the slave bots, of course.
2) Then, in the script that is being .netupdate'd around, shared by all bots:
| Code: |
proc botnet_fruitattack_pub {nick uhost handle chan argv} {
.
.
global ismaster
global botnick
.
.
if { $ismaster == 1 } {
putlog "MASTER $botnick - Sending orders to all bots to Fruit Attack!"
putallbots "attack $whotoattack $chan"
dccbroadcast "MASTER $botnick - Command accepted. I will $how $whotoattack with $what!"
dccbroadcast "MASTER $botnick - Command sent to all bots!"
} else {
putlog "SLAVE $botnick - Command accepted. I will $how $whotoattack with $what!"
dccbroadcast "SLAVE $botnick - Command accepted. I will $how $whotoattack with $what!"
}
putserv "PRIVMSG $chan : -=( $how $whotoattack with $what )=-"
.
.
|
And, the dependent binds:
| Code: |
if {$ismaster == 1} {
bind pub - .attack botnet_fruitattack_pub
bind dcc - attack botnet_fruitattack
putlog "Botnet Fruit Attacker v1.0 Loaded as MASTER!"
} else {
bind bot - attack botnet_fruitattack
putlog "Botnet Fruit Attacker v1.0 Loaded as SLAVE!"
}
|
Now, the botnet'ed bots will behave differently, using the same script.
Again, if you notice something screwy about my TCL code, sorry. I struggle with it. It's not that I hate it - TCL has its place.
Anyway, you guys really did help. Thanks. |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Wed Mar 08, 2017 10:14 am Post subject: |
|
|
I can tell you that it is completely possible to add the bots own handle and attributes to its own user file. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
level6 Voice
Joined: 07 Mar 2017 Posts: 6 Location: DALLAS, TX, USA
|
Posted: Wed Mar 08, 2017 10:29 am Post subject: |
|
|
Thanks, SpiKe^^. If I need more precision or granularity (maybe using the flags) it's great to know there is another possibility. But, for now, all my slave bots are equal and there is only one master, so this solution will work for me.
| Code: |
[08:28:26] MASTER liar - Sending orders to all bots to Fruit Attack!
*** MASTER liar - Command accepted. I will stabs tda with a basket of peaches!
*** MASTER liar - Command sent to all bots!
*** (liar_botnet_1) SLAVE liar_botnet_1 - Command accepted. I will teabags tda with passion fruits!
*** (liar_botnet_2) SLAVE liar_botnet_2 - Command accepted. I will pummels tda with bananas!
|
Perfect. |
|
| Back to top |
|
 |
level6 Voice
Joined: 07 Mar 2017 Posts: 6 Location: DALLAS, TX, USA
|
Posted: Wed Mar 08, 2017 10:43 am Post subject: |
|
|
Full script, in case anyone finds it useful... again, please excuse any sloppy TCL.
botnet_fruitattack_1.0.tcl:
| Code: |
proc botnet_fruitattack_pub {nick uhost handle chan argv} {
if {[regexp {[\{]} $argv]>0} {
putserv "NOTICE $chan :ERROR\: OK! Dumping my /etc/shadow file ... please wait."
return 0
}
if {[regexp {[\}]} $argv]>0} {
putserv "NOTICE $chan :ERROR\: OK! Dumping my /etc/shadow file ... please wait."
return 0
}
if {[regexp {[\']} $argv]>0} {
putserv "NOTICE $chan :ERROR\: OK! Dumping my /etc/shadow file ... please wait."
return 0
}
if {[regexp {[\"]} $argv]>0} {
putserv "NOTICE $chan :ERROR\: OK! Dumping my /etc/shadow file ... please wait."
return 0
}
if {[regexp {[\!]} $argv]>0} {
putserv "NOTICE $chan :ERROR\: OK! Dumping my /etc/shadow file ... please wait."
return 0
}
if {[regexp {[\`]} $argv]>0} {
putserv "NOTICE $chan :ERROR\: OK! Dumping my /etc/shadow file ... please wait."
return 0
}
set whotoattack [lindex $argv 0]
global ismaster
global botnick
set verb {
"rapes"
"makes passionate love to"
"pummels"
"stabs"
"plays hide-the-fruit with"
"teabags"
"socks the [censored] outta"
"replaces the existance of"
"shoots laser beams at"
"makes emo poetry at"
}
set fruit {
"apples"
"bananas"
"oranges"
"mangos"
"pinnapples"
"pears"
"passion fruits"
"a bunch of grapes"
"a bag of plums"
"a basket of peaches"
}
if {$whotoattack == ""} {
putserv "NOTICE $chan :ERROR\: Please supply a nick to attack. derp."
return 0
}
if {$whotoattack == "spin"} {
putserv "NOTICE $chan :ERROR\: Nawp. Ain't gunna do eet. derp."
return 0
}
if {![onchan $whotoattack $chan]} {
putserv "NOTICE $chan :ERROR\: No such person here, dummay."
return 0
}
set how [lindex $verb [rand [llength $verb]]]
set what [lindex $fruit [rand [llength $fruit]]]
if { $ismaster == 1 } {
putlog "MASTER $botnick - Sending orders to all bots to Fruit Attack!"
putallbots "attack $whotoattack $chan"
dccbroadcast "MASTER $botnick - Command accepted. I will $how $whotoattack with $what!"
dccbroadcast "MASTER $botnick - Command sent to all bots!"
} else {
putlog "SLAVE $botnick - Command accepted. I will $how $whotoattack with $what!"
dccbroadcast "SLAVE $botnick - Command accepted. I will $how $whotoattack with $what!"
}
putserv "PRIVMSG $chan : -=( $how $whotoattack with $what )=-"
return 1
}
proc botnet_fruitattack {handle idx argv} {
if {[regexp {[\{]} $argv]>0} {
putserv "NOTICE $chan :ERROR\: OK! Dumping my /etc/shadow file ... please wait."
return 0
}
if {[regexp {[\}]} $argv]>0} {
putserv "NOTICE $chan :ERROR\: OK! Dumping my /etc/shadow file ... please wait."
return 0
}
if {[regexp {[\']} $argv]>0} {
putserv "NOTICE $chan :ERROR\: OK! Dumping my /etc/shadow file ... please wait."
return 0
}
if {[regexp {[\"]} $argv]>0} {
putserv "NOTICE $chan :ERROR\: OK! Dumping my /etc/shadow file ... please wait."
return 0
}
if {[regexp {[\!]} $argv]>0} {
putserv "NOTICE $chan :ERROR\: OK! Dumping my /etc/shadow file ... please wait."
return 0
}
if {[regexp {[\`]} $argv]>0} {
putserv "NOTICE $chan :ERROR\: OK! Dumping my /etc/shadow file ... please wait."
return 0
}
set whotoattack [lindex $argv 0]
set chan "#LIEnet"
global ismaster
global botnick
set verb {
"rapes"
"makes passionate love to"
"pummels"
"stabs"
"plays hide-the-fruit with"
"teabags"
"socks the [censored] outta"
}
set fruit {
"apples"
"bananas"
"oranges"
"mangos"
"pinnapples"
"pears"
"passion fruits"
"grapes"
}
if {$whotoattack == ""} {
putserv "NOTICE $chan :ERROR\: Please supply a nick to attack. derp."
return 0
}
set how [lindex $verb [rand [llength $verb]]]
set what [lindex $fruit [rand [llength $fruit]]]
if { $ismaster == 1 } {
putlog "MASTER $botnick - Sending orders to all bots to Fruit Attack!"
putallbots "attack $whotoattack $chan"
dccbroadcast "MASTER $botnick - Command accepted. I will $how $whotoattack with $what!"
dccbroadcast "MASTER $botnick - Command sent to all bots!"
} else {
putlog "SLAVE $botnick - Command accepted. I will $how $whotoattack with $what!"
dccbroadcast "SLAVE $botnick - Command accepted. I will $how $whotoattack with $what!"
}
putserv "PRIVMSG $chan : -=( $how $whotoattack with $what )=-"
return 1
}
if {$ismaster == 1} {
bind pub - .attack botnet_fruitattack_pub
bind dcc - attack botnet_fruitattack
putlog "Botnet Fruit Attacker v1.0 Loaded as MASTER!"
} else {
bind bot - attack botnet_fruitattack
putlog "Botnet Fruit Attacker v1.0 Loaded as SLAVE!"
}
|
Some things I know could use more dev:
1) I had to hardcode a channel in to get the DCC to work. Need to add an option to direct it to any channel, then make sure they are all on it, etc.. DCC bound commands do not include channel, of course.
2) There is probably a much easier one-liner to regexp for cleaning the input, but I had enough trouble finding how to just get "{" to match, so I was happy to make a lot of separate statements. Maybe this would work?:
if {[regexp {[\{\}\"\!\`\]} $argv]>0} {
There is probably a lot more "wrong" with it. Use at your own peril. But, it works. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|