egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Advert v1.05 by David Proper (Dr. Nibble [DrN])
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
nsrafk
Halfop


Joined: 11 May 2007
Posts: 73

PostPosted: Sun May 27, 2007 7:22 pm    Post subject: Advert v1.05 by David Proper (Dr. Nibble [DrN]) Reply with quote

Hi. Anybody tried this script on eggdrop 1.6.18? As far as i can read, this advert script suits all my needs for advertising. But nomatter what i do, it wont actually advert.
If anybody can get it to work, pelase post in here, cos i need it badly!!
Search the archive for "advert" and hit the "advert105.tcl.gz" link Wink

I hope somebody will try looking at this, since the author doesnt respond :<

Thanks!
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun May 27, 2007 8:01 pm    Post subject: Reply with quote

I doubt someone would actually search for the script and download it to help you. Post the code here instead.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
nsrafk
Halfop


Joined: 11 May 2007
Posts: 73

PostPosted: Sun May 27, 2007 8:44 pm    Post subject: Reply with quote

okay, i will do that.
Code:
#         Script : Advert v1.05 by David Proper (Dr. Nibble [DrN])
#                  Copyright 1999-2002 Radical Computer Systems
#                             All Rights Reserved
#
#       Testing
#      Platforms : Linux 2.2.16   TCL v8.3
#                  Eggdrop v1.6.2
#                  Eggdrop v1.6.6
#            And : SunOS 5.8      TCL v8.3
#                  Eggdrop v1.5.4
#
#    Description : Advert will allow you to define advertisment lines to
#                  be sent to anyone leaving a channel the bot is on.
#                  May also be used with a connected bot to send the ads
#                  threw. Definable probability if it will advertise.
#
#       History : 06/16/1999 - First Release
#                 03/23/2001 - v1.01
#                             o Added in a nochannel list
#                 11/19/2001 - v1.02           
#                             o Added in a random "Starter Line"
#                               Added in botnet ability
#                                One bot sees the part and tells the other
#                                bot to advertise. Best if used in bots on
#                                different sitemasks.
#                             o Added NOTICE or PRIVMSG message types
#                             o Advertisments can be sent randomly or
#                               in sequencial order.
#                             o Wont advertise to itself. :)
#                             o Probability of sending the advertisment
#                 04/11/2002 - v1.03
#                             o Optional advert on part and/or join.
#                             o Added 1 more starterline
#                             o Optional random time before sending advert
#                               (Requested by Chad \ hockey@IRC)
#                 06/21/2002 - v1.04
#                             o Fixed $channel variable error in on-join
#                               (Reported by illusi0n)
#                 12/09/2002 - v1.05
#                             o Fixed reverse variable error.
#                               (Reported by: \L\ @DALnet)
#                             o Fixed missing sendit proc
#                               (Reported by: \L\ @DALnet)
#                             o Fixed [die] nick vulnerability
#
#      Donations : https://www.paypal.com/xclick/business=rainbows%40stx.rr.com
# (If you don't have PayPal and want to donate, EMail me for an address.
#  Will take money or hardware/computer donations)
#  Significant (or even non-significant donations) can be published on a
#  web site if you so choose.
#
#   Future Plans : Make a suggestion
#[\L\(asdf@cmb7-137.dial-up.arnes.si)] Btw, can you add function, that bot will advertise adverts in public channel, automaticaly every x mins all adverts.. ?
#[\L\(asdf@cmb7-137.dial-up.arnes.si)] and "!searchadvert" will be also welcome
#[\L\(asdf@cmb7-137.dial-up.arnes.si)] for example:
#[\L\(asdf@cmb7-137.dial-up.arnes.si)] !searchadvert *old car*
#[\L\(asdf@cmb7-137.dial-up.arnes.si)] will find all adverts that are like this:  I'm selling 3 years old car, white color, ....
#(\L\@DN) can you also add - AUTO-EXPIRE-ADVERT ... so advertisement will expire after x days
#(\L\@DN) can you do some kind of MAIN SWITCH ... so if I turn that !mainswitch off, then it will totaly disable script ...
#
#
# Author Contact :     Email - DProper@chaotix.net
#                   Homepage - http://www.chaotix.net/~dproper
#                        IRC - Primary Nick: DrN
#                     UseNet - alt.irc.bots.eggdrop
# Support Channels: #RCS @UnderNet.Org
#                   #RCS @DALnet
#                   #RCS @EFnet
#                   #RCS @GalaxyNet
#                   #RCS @Choatix Addiction
#            Other channels - Check contact page for current list
#
#                Current contact information can be located at:
#                 http://www.chaotix.net/rcs/contact.html
#
# New TCL releases are sent to the following sites as soon as they're released:
#
# FTP Site                   | Directory                     
# ---------------------------+-------------------------------
# ftp.chaotix.net            | /pub/RCS
# ftp.eggheads.org           | Various
# ftp.realmweb.org           | /drn
#
# Radical Computer System's Main Support Site: http://rcs.chaotix.net
# To subscribe to the RCS mailing list:
#  http://www.chaotix.net/mailman/listinfo/rcs-list

#
#  Feel free to Email me any suggestions/bug reports/etc.
#
# You are free to use this TCL/script as long as:
#  1) You don't remove or change author credit
#  2) You don't release it in modified form. (Only the original)
#
# If you have a "too cool" modification, send it to me and it'll be
# included in the official. (With your credit)
#
# Commands Added:
#  Where     F CMD                     F CMD       
# ---------- - ---------               - ----------
#  Public:   o !listadvert             m !deladvert
#            m !addadvert              m !adverts
#            - !adverthelp
#     MSG:   - adverthelp
#     DCC:   - adverthelp
#

set cmdchar_ "!"

# Datafile to store adverts in
set advert(datafile) "adverts"

# [0/1] Set this to 1 if you want the advert to be sent on join
set advert(onjoin) 0

# [0/1] Set this to 1 if you want the advert to be sent on part
set advert(onpart) 1

# [0+] (Seconds) Set this above 0 if you want a delay on sending the advert.
set advert(delay) 15

# [0+] (Seconds) Set this to the minimum delay.
set advert(delay_base) 10

# Delay is calculated as:  delay_base + (random number from 0 to delay)


# Channels not to send adverts to people when parting
set advert(ignore) "#channel1 #channel2"

# [NOTICE/PRIVMSG] Method of sending text
set advert(type) "NOTICE"

# [0/1] Set to 0 for random adverts, set to 1 for sequencial
set advert(gettype) 1

# Set this to the botnet nick of the bot to spam for you. Set to ""
# if you want this bot to do the adverts.
set advert(usebot) ""

# Netcode. Change for each network this script is run on so you don't send
# advert requests for UnderNet to DALnet or so.
set advert(netcode) 927

# This is the percentage chance they will get an advertisment.
# Set to 100 to always send an advertisment.
set advert(prob) 85


# This is the starter line to send before the actually advert. Set to ""
# if you don't want anything sent.
set advert(starterline) {
 {Hi. How are you?}
 {Hi there.}
 {You looked bored in $chan.}
 {Hey There!}
                        }

set advert(ver) "1.05.01"
set advert(tag) "\[\002AdverT\002\]"

proc cmdchar { } {
global cmdchar_
return $cmdchar_
}


bind pub o [cmdchar]listadvert pub_advertlist
proc pub_advertlist {nick uhost hand channel rest} {
global random_advert
advert_load
putserv "NOTICE $nick :Listing Advertisments Database"
set looper 0
while {($looper < [llength $random_advert])} {
  putserv "NOTICE $nick :\026 $looper \026 : [lindex $random_advert $looper]"
  incr looper 1
                                             }
putserv "NOTICE $nick :--EOF"
}

bind pub m [cmdchar]deladvert pub_advertdel
proc pub_advertdel {nick uhost hand channel rest} {
global random_advert
set delwhat [lindex $rest 0]
if {($delwhat == "")} {putserv "NOTICE $nick :Calling Syntax:    [cmdchar]deladvert #"
                       return 1}
if {($delwhat < 0) || ($delwhat > [llength $random_advert])} {
 putserv "NOTICE $nick :You specified an invalid reference."
 return 1
                                                             }
 set advert_temp $random_advert
 unset random_advert
 set deleted [lindex $advert_temp $delwhat]

set looper 0
while {($looper < [llength $advert_temp])} {
  if {($looper != $delwhat)} {lappend random_advert [lindex $advert_temp $looper]}
            incr looper 1
                                             }
putserv "NOTICE $nick :Deleted advert #$delwhat - $deleted"
advert_write
}

bind pub m [cmdchar]addadvert pub_advertadd
proc pub_advertadd {nick uhost hand channel rest} {
global random_advert
set addwhat [lrange $rest 0 end]
if {($addwhat == "")} {putserv "NOTICE $nick :Calling Syntax: [cmdchar]addadvert \[advertisment line\]"
                       return 1}

lappend random_advert $addwhat

putserv "NOTICE $nick :Added advert #[llength $random_advert] - $addwhat"
advert_write
}

proc advert_load {} {
   global random_advert advert adverts

   if {[info exists random_advert]} {unset random_advert}
   if {[catch {set fd [open $advert(datafile) r]}] != 0} {return 0}
   set adverts [gets $fd]
   while {![eof $fd]} {
      set inp [gets $fd]
      if {[eof $fd]} {break}
      if {[string trim $inp " "] == ""} {continue}
      lappend random_advert [lrange $inp 0 end]
   }
   close $fd
   return 1
}

proc advert_write {} {
   global advert random_advert adverts_changed adverts

set fd [open $advert(datafile) w]
puts $fd "$adverts"
set looper 0
while {($looper < [llength $random_advert])} {
            puts $fd "[lindex $random_advert $looper]"
            incr looper 1
                                             }
   close $fd

   set advertss_changed 0
   return 1
}

bind join - ***** do_advert_join
proc do_advert_join {nick uhost hand chan} {
global adverts random_advert advert botnick
 if {$advert(onjoin) == 0} {return 1}
 if {$adverts == 0} {return 1}
 if {[string tolower $nick] == [string tolower $botnick]} {return 0} 
 if {$advert(usebot) != ""} {putbot $advert(usebot) "ADVERT $advert(netcode) $nick $chan"
                           } else {utimer [get_adverttime] "advert_do $nick $chan"
                                  }
}

bind part - ***** do_advert_part
proc do_advert_part {nick uhost hand channel {msg ""}} {
global adverts random_advert advert botnick
subst -nobackslashes -nocommands -novariables nick
subst -nobackslashes -nocommands -novariables msg

regsub -all {\[} $nick "\\\[" nick
regsub -all {\]} $nick "\\\]" nick

regsub -all {\[} $nick "\\\[" msg
regsub -all {\]} $nick "\\\]" msg

#regsub -all {\[} $nick "!BRAKET!" nick
#if {[string match "*!BRAKET!*" "$nick"] > 0 } {
# putserv "privmsg #rcs :Found a \[ so [censored]'um"
# return 0
#}


 if {$advert(onpart) == 0} {return 1}
 if {$adverts == 0} {return 1}
 if {[string tolower $nick] == [string tolower $botnick]} {return 0} 
 if {$advert(usebot) != ""} {putbot $advert(usebot) "ADVERT $advert(netcode) $nick $channel"
                           } else {utimer [get_adverttime] "advert_do $nick $channel"
                                  }
}

bind bot - advert advert_in
proc advert_in {bot cmd arg} {
subst -nobackslashes -nocommands -novariables arg
 global advert network
 set c [lindex $arg 0]
 set nick [lindex $arg 1]
 set chan [lindex $arg 2]
 if {$c == $advert(netcode)} {
  putlog "$advert(tag) Advertisment requested for $nick on $chan from $bot"
  utimer [get_adverttime] "advert_do $nick $chan
                            }
}

proc get_adverttime {} {
global advert
 return [expr $advert(delay_base) + [rand $advert(delay)]]
}

proc advert_do {nick chan} {
subst -nobackslashes -nocommands -novariables nick
global adverts random_advert advert

 if {![probability $advert(prob)]} {return 1}

if {[lsearch -glob $advert(ignore) [string tolower "*$chan*"] ] == -1 } {
 if {$advert(starterline) != ""} {
  set txt [randomline $advert(starterline)]
  regsub -all {\$chan} $txt "$chan" txt
  putserv "$advert(type) $nick :$txt"
                                 }
 if {$advert(gettype) == 0} {set theadvert [lindex $random_advert [rand [llength $random_advert]]]}
 if {$advert(gettype) == 1} {set theadvert [lindex $random_advert $advert(current)]
                             set advert(current) [expr $advert(current) + 1]
                             if {$advert(current) > [llength $random_advert]} {set advert(current) 0}
                            }
 putserv "$advert(type) $nick :$theadvert"
                                                                    }
}

proc probability {prob} {
 if {$prob == 100} {return 1}
 set r [rand 100]
 set rng [rand [expr 100 - $prob]]
 set rngu [expr $rng + $prob]
 if {($r > $rng) && ($r < $rngu)} {return 1}
 return 0
}


proc randomline {text} {
 return [lindex $text [rand [llength $text]]]
}


proc pub_adverts {nick uhost hand channel rest} {
global adverts
switch [string tolower [lindex $rest 0]] {
 ""    { putserv "NOTICE $nick :Syntax: [cmdchar]adverts \[on/off\]" }
 "off" { set adverts 0 }
 "on"  { set adverts 1 }
 }
if {$adverts == 0} { putserv "NOTICE $nick :Adverts are currentlly off"
                   } else { putserv "NOTICE $nick :Adverts are currentlly on" }
advert_write
 }
 bind pub m [cmdchar]adverts pub_adverts


############# HELP SECTION #######################################[START]#

proc adverthelp {nick channel dirc dire args} {
global adverts advert
set topic [string tolower [lindex $args 0]]
if {([string length $topic]) < 3} { sendit $nick $channel $dirc "Use \002ADVERTHELP help\002 to list avliable topics." }
switch [string tolower $topic] {
 "status" {
           if {($adverts == 0)} {set adverttemp Off} else {set adverttemp On}
           sendit $nick $channel $dirc "Adverts are currentlly $adverttemp."
          }
 "adverts" {
           sendit $nick $channel $dirc "ADVERTS - Syntax: adverts \[on/off\]"
           sendit $nick $channel $dirc "(MAS)    This command allows you to turn advertisments on or off."
          }
 "addadvert" {
           sendit $nick $channel $dirc "ADDADVERT - Syntax: addadvert <advertline>"
           sendit $nick $channel $dirc "(MAS)    This command allows you to add an advertisment to the database."
          }
 "deladvert" {
           sendit $nick $channel $dirc "DELADVERT - Syntax: deladvert  <number>"
           sendit $nick $channel $dirc "(MAS)    This command allows you to delete an advertisment from the database."
          }
 "listadvert" {
             sendit $nick $channel $dirc "LISTADVERT - Syntax: listadvert"
             sendit $nick $channel $dirc "(OPs)      This command will list all advertisments in the database."
             }
 "help" {
     sendit $nick $channel $dirc "Help Topics Avaliable:"
     sendit $nick $channel $dirc "listadvert deladvert addadvert adverts status"
    }
                             }
}

proc pub_adverthelp {nick uhost handle channel args} {
global advert
sendit $nick $channel 1 "Advert v$advert(ver) by David Proper (DrN)"
adverthelp $nick $channel 1 1 $args
}
bind pub - [cmdchar]adverthelp pub_adverthelp

proc msg_adverthelp {nick uhost handle args} {
global advert
sendit $nick $nick 2 "Advert v$advert(ver) by David Proper (DrN)"
adverthelp $nick $nick 2 2 $args
}
bind msg - adverthelp msg_adverthelp

proc dcc_adverthelp {handle idx args} {
global advert
sendit $idx $idx 4 "Advert v$advert(ver) by David Proper (DrN)"
adverthelp $idx $idx 4 4 $args
}
bind dcc - adverthelp dcc_adverthelp

proc sendit {nick channel dirc txt} {

 if {$dirc == "1"} { putserv "PRIVMSG $channel :$txt" }
 if {$dirc == "2"} { putserv "PRIVMSG $nick :$txt" }
 if {$dirc == "3"} { putserv "NOTICE $nick :$txt" }
 if {$dirc == "4"} { putdcc $nick "$txt" }
}


############# HELP SECTION #########################################[END]#

set adverts_changed 0
set random_advert ""
set adverts 1
set advert(current) 0

advert_load

putlog "Advert v$advert(ver) by David Proper (DrN) -=:LoadeD:=-"
return "Advert v$advert(ver) by David Proper (DrN) -=:LoadeD:=-"

There you go Smile
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun May 27, 2007 9:07 pm    Post subject: Reply with quote

What exactly is the problem? Are there any errors? Post your script's configurations.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
nsrafk
Halfop


Joined: 11 May 2007
Posts: 73

PostPosted: Mon May 28, 2007 8:30 am    Post subject: Reply with quote

Well, im using the script as i posted. Exact same settings as i posted. The problem is kinda simple. The bot wont advertise. Nomatter if i set the actualy bot to do the advertising, or another bot in the botnet. When i set the advertise messages it says its all ok, but no advertising is being sent to people when they join channels :\
I dont get any errors in partyline either.. Its weird
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon May 28, 2007 9:22 am    Post subject: Reply with quote

This script has a serious flaw that could permit remote code execution. It uses utimers in a very unsafe manner, allowing anyone to inject code using their nickname. The flawed code I noticed was this (from do_advert_join):
Code:
 } else {utimer [get_adverttime] "advert_do $nick $chan"

This same code also exists in do_advert_part, however, the author has made a crude attemt to prevent remote-code execution using multiple regsub's...
The proper way of doing it, would be something like this:
Code:
} else {utimer [get_adverttime] [list advert_do $nick $chan]

which does not require any extra filtering of possibly malicious nicks...

Also looking further, you'd find this line in advert_in (handling incoming requests from other bots), which purpose I really fail to understand, yet it makes me believe it's supposed to protect the script from above mentioned exploits aswell (which it will not):
Code:
subst -nobackslashes -nocommands -novariables arg

Also, this proc contains the same issue with utimer, allowing further remote code execution from any linked bot (regardless of userfile sharing, etc).

Also, there are numerous list-commands that use strings, which also is a bad idea.

Considdering the age, I'd guess this script has been abandoned by the author long ago.

Now, as why it does not work (apart from the above mentioned issues), have you checked that there actually is a list of ads loaded?
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon May 28, 2007 9:56 am    Post subject: Reply with quote

Forgot to mention, that all the issues mentioned in the previous post regarding nickname, also applies to channelnames..
So if you have any special characters in the name of any of the channels you intend to use the script in, this might also be a cause of problems.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
nsrafk
Halfop


Joined: 11 May 2007
Posts: 73

PostPosted: Mon May 28, 2007 10:19 am    Post subject: Reply with quote

Yea, i have adverts added ofcourse, hehe. Seriously, i have absolutely no clue on all that u wrote in your first post. Its nonsense to me, lol. If you have some spare time, i'd be very happy if u would fix the bugs. But only if u want to ofcourse.
Anyway, i still can't get it to work. Ive tried everything. Maybe its because of eggdrop 1.6.18.. Sucks :<
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon May 28, 2007 10:26 am    Post subject: Reply with quote

Yes, but have you verified they're "in the system" by using the listing command?
Those bugs I mentioned in my previous post basically means that anyone who figures you're running this script could gain total control over your bot by using specially crafted nicknames, and might possibly succeed in hijacking your shell-account aswell if they're enough creative...

Also, you never answered to my last question 'bout channel names and wether they have any "special" characters..
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
nsrafk
Halfop


Joined: 11 May 2007
Posts: 73

PostPosted: Mon May 28, 2007 10:47 am    Post subject: Reply with quote

Ow, sorry. well, ill paste you some info:
I've only tried to do some testing, so its only lame ads:

(16:46:3Cool -fel1cia- 0 : #nosser #nosser #nosser
(16:46:39) -fel1cia- 1 : #nosser #nosser #nosser
(16:46:41) -fel1cia- 2 : #nosser #nosser #nosser

the channels i've tested looks like this:

#nsrafk #wtfthiswontworkffs

so, no special chars at all. Neutral
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon May 28, 2007 1:10 pm    Post subject: Reply with quote

Then the only cause for ads not to be shown, yet no error-messages being reported, would be that "advert(onpart)" and/or "advert(onjoin)", or "adverts" have been set to 0.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
nsrafk
Halfop


Joined: 11 May 2007
Posts: 73

PostPosted: Mon May 28, 2007 1:58 pm    Post subject: Reply with quote

Heh, well the onjoin is set to 1, and onpart to 0. i dont get any errormessages myself Sad thats why i think its odd Sad
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon May 28, 2007 2:13 pm    Post subject: Reply with quote

Doublechecked the values using ".set" or ".tcl set" from the dcc-chat partyline?
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
nsrafk
Halfop


Joined: 11 May 2007
Posts: 73

PostPosted: Mon May 28, 2007 2:20 pm    Post subject: Reply with quote

(20:19:51) <nsrafk> .set
(20:19:51) (fel1cia) What? You need '.help'
(20:19:5Cool <nsrafk> .tcl set
(20:19:5Cool (fel1cia) What? You need '.help'

---

I guess they're disabled - lemme see how to enable it. wait 5 mins
Back to top
View user's profile Send private message
nsrafk
Halfop


Joined: 11 May 2007
Posts: 73

PostPosted: Mon May 28, 2007 2:20 pm    Post subject: Reply with quote

# Comment these two lines if you wish to enable the .tcl and .set commands.
# If you select your owners wisely, you should be okay enabling these.
#unbind dcc n tcl *dcc:tcl
#unbind dcc n set *dcc:set

-- hmm thats how it looks in the conf.. why doesnt it work? lol

-- nvm, works now. is it .set errorInfo i need to use to see errors?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber