botlending forum  

Go Back   botlending forum > Eggdrop & TCL > Tcl scripting

Tcl scripting Tcl scripting related questions

Reply
 
LinkBack Thread Tools Display Modes
Old 31-01-2006, 14:12   #1 (permalink)
TCB & Ratings projects Member, #Mythic representative
 
arcade's Avatar
 
Join Date: Jun 2004
Location: In fatza calculatorului!!
Age: 19
Posts: 221
Rep Power: 37
arcade is on a distinguished road
Send a message via Yahoo to arcade
Default Anti Drone Spam Script

Am si eu nevoie de un script anti boti (sau persoane infectate) care dak ii iei la privat trimit automat un mesaj care contine spam. Eu ma gandeam la ceva care la join da automat un mesaj gen: Sunt un bot bla bla bla NU RASPUNDE LA ACEST MESAJ SAU VEI FI BANAT, iar daca raspunde sa ii dea automat ban. Prima parte e usor de facut dar partea cu banul in caz ca raspunde nush cum sa o fac... Ideea mea era sa setez o variabila si sa pun un timer care sa o dezactiveze, iar dak la un measaj privat variabila (care contine si informatii despre respectivul user, nick & host) este inca activa sa il baneze.

Asta e ce am facut eu, astept suggestii spre a il face functional:P
Code:
bind join - * clone:check

setudef flag clonecheck

proc clone:check {nick uhost hand chan} {

if {![channel get $chan clonecheck]} {return}
puthelp "PRIVMSG $nick :-ATENTIE- Sunt un robot al canalului $chan si verific daca esti o persoana virusata si faci reclama pe privat!Nu raspunde la acest mesaj deoarece vei fi considerat virusat si vei primi ban! Multumesc. ;-)"
set clonecheck($nick,$uhost) 1
timer 10[list unset punished($nick)]

}

bind msg - * pub:clone:execute


proc pub:clone:execute {nick uhost hand chan} {
    golbal punished($nick,$uhost)
    
    if {punished($nick,$uhost) == "1"} {
    newchanban $chan $uhost "Out clona"
    }
}

puthelp "anticlone tcl loaded"
PS: partea cu join mere dar cand dau mesaj botul nu face nimic
arcade is offline   Reply With Quote
Old 31-01-2006, 17:21   #2 (permalink)
lsn
Member
 
lsn's Avatar
 
Join Date: Jun 2004
Location: In the NeXuS
Posts: 160
Rep Power: 37
lsn will become famous soon enough
Default

Incearca ceva de genu dar mai trebuie sa lucrezi la el
Code:
bind join - * clone:check
 
setudef flag clonecheck
 
proc clone:check {nick uhost hand chan} {
 
if {![channel get $chan clonecheck]} {return}
if { [matchattr $hand f|f $chan]} {return}
  global punished
  puthelp "PRIVMSG $nick :-ATENTIE- Sunt un robot al canalului $chan si verific daca esti o persoana virusata si faci reclama pe privat!Nu raspunde la acest mesaj deoarece vei fi considerat virusat si vei primi ban! Multumesc. :-)"
  set punished($nick,$uhost) "$chan"
  timer 10[list unset punished($nick,$uhost)]
 
}
 
bind msgm - * pub:clone:execute
 
proc pub:clone:execute {nick uhost hand arg} {
  global punished botnick
  if {[info exists punished($nick,$uhost)] } {
        set ban "*!*@[lindex [split $uhost @] 1]"
        newchanban $punished($nick,$uhost) $ban $botnick "reason for ban" 15m sticky
    }
}
 
putlog ".... tcl loaded"

Last edited by lsn; 31-01-2006 at 18:20.
lsn is offline   Reply With Quote
Old 01-02-2006, 10:27   #3 (permalink)
Junior Member
 
UltraS99's Avatar
 
Join Date: Dec 2004
Location: Cu mata in dormitor
Age: 20
Posts: 46
Rep Power: 0
UltraS99 is an unknown quantity at this point
Default

Ok deci am facut cum ai zis u dar acuma imi da alta eroare :
[07:27] Tcl error [clone:check]: wrong # args: should be "timer minutes command" de la ce draq nush
UltraS99 is offline   Reply With Quote
Old 09-02-2006, 00:36   #4 (permalink)
TCB & Ratings projects Member, #Mythic representative
 
arcade's Avatar
 
Join Date: Jun 2004
Location: In fatza calculatorului!!
Age: 19
Posts: 221
Rep Power: 37
arcade is on a distinguished road
Send a message via Yahoo to arcade
Default

aleck ia ia dacilea
Code:
bind join - * clone:check
 
setudef flag anticlone
 
proc clone:check {nick uhost hand chan} {
 
if {![channel get $chan anticlone]} {return}
if {[matchattr $hand f|f $chan]} {return}
  global punished
  puthelp "PRIVMSG $nick :-ATENTIE- Sunt un robot al canalului $chan si verific daca esti o persoana virusata si faci reclama pe privat!Nu raspunde la acest mesaj deoarece vei fi considerat virusat si vei primi ban! Multumesc. :-)"
  set punished($nick,$uhost) "$chan"
  timer 10[list unset punished($nick,$uhost)]
 
}
 
bind msgm - * pub:clone:execute
 
proc pub:clone:execute {nick uhost hand arg} {
  global punished botnick
  if {[info exists punished($nick,$uhost)]} {
        set ban *!*@[lindex [split $uhost @] 1]
        newchanban $punished($nick,$uhost) $ban $botnick "Ai grija s-ar putea sa ai scriptul infectat. Intra pentru #dmsetup, #nohack sau #vh pentru a verifica!" 15m sticky
    }
}
 
putlog "anticlone tcl loaded"
PS: data viitoare uita-te atent k am postat eu un cod la un script asemanator kre nu merea si pe care mi l-a reparat lsn

A da si vezi k in randul asta:
Code:
timer 10[list unset punished($nick,$uhost)]
trebuie pus spatiu intre 10 si [
arcade is offline   Reply With Quote
Old 09-04-2006, 02:44   #5 (permalink)
Junior Member
 
Madalin's Avatar
 
Join Date: Oct 2004
Posts: 29
Rep Power: 0
Madalin is an unknown quantity at this point
Send a message via Yahoo to Madalin
Default help

<(BesTTeam> [06:48] Tcl error in script for 'timer420809':
<(BesTTeam> [06:48] can't unset "punished(Madalin--,Madalin@82.78.210.218)": no such element in array

Ia dat BAN.. dar ca sa il scoata.. nimic.. da ce am scris mai sus
Madalin is offline   Reply With Quote
Old 09-04-2006, 15:15   #6 (permalink)
Administrator

aka aqwzsx
 
Join Date: Jun 2004
Posts: 832
Blog Entries: 126
Rep Power: 3
UniversaliA is on a distinguished road
Default

Code:
if {![channel get $chan anticlone]} {return}
if {[matchattr $hand f|f $chan]} {return}
De ce doua randuri si nu un singur rand ? De ce numai f|f ? nu stii ca sunt unii care au +Nnmnv si nu au +f ?
Code:
timer 10[list unset punished($nick,$uhost)]
In acest rand ti-a gasit Madalin eroare si cum am mai zis pe IRC, problema nu este ca a gasit cineva eroare, problema este ca tu nu ai prevazut in caz de eroare ce sa faca script`ul tau. De exemplu mai jos ai asta
Code:
if {[info exists punished($nick,$uhost)]} {
Foarte simpla si eficasa modalitate pentru a verifica daca exista asa element in array si daca exista, sa dai unset. Sau altele, despre care ai spus singur pe IRC, de exemplu bind, dar exista si multe altele. In continuare, acest rand
Code:
set punished($nick,$uhost) "$chan"
care isi are continuare mai jos in acest rand
Code:
if {[info exists punished($nick,$uhost)]} {
Adica tu mai sus faci foarte bine, dai o valoare la variabila ta, si anume denumirea de canal, pentru ca pe acel canal lucreaza clonecheck si pe acel canal duci evidenta. Dar mai jos ? cand primesti un msg ? tu doar verifici daca el a dat msg in privat, nu verifici daca el se afla pe canalul setat anticlone. Adica exista o posibilitate putin probabila, dar exista si anume ca omul va intra pe mai multe canale unde e botul, va iesi de pe canalul unde e setat anticlone, si va scrie ceva in privat la bot, de exemplu: comanda de autorizare, sau poate nici nu va iesi de pe canal, va face autorizare si gata. Bot`ul tau ii va da BAN. In orice caz, de ce mai sus dai valorea $chan ca pe urma sa nu o folosesti deloc ? Sau e o setare in plus sau ai o verificare in minus.

In plus, nu sunt sigur ca cel mai optimal timer e de zece secunde, script`urile infectate pot avea si lag apropos, ca fac publicitate la greu :) Deasemenea unii au script care automat in privat poate sa spuna "bla bla sunt away" sau "bla bla am cel mai tare script". Adica eu as sugera sa vezi cum sunt facute alte script`uri de asa gen, si sa postezi ceva mai amplu/complex, si ca proceduri de verificare si ca cod de executie.

La putlog posteaza autorul si ar fi bine reteaua si canalul. Ca sa fie mai informativ si ca sa nu te miri ca poimaine apare script`ul tau undeva fara copyright.

In plus, inainte de a posta, sa verificati script`urile mai atent. In special pe canale si cu nick/ident cu semne speciale de gen {{[\.
UniversaliA is offline   Reply With Quote
Old 19-04-2006, 00:03   #7 (permalink)
Member
 
caesar's Avatar
 
Join Date: Dec 2004
Location: Under a rock!
Posts: 116
Rep Power: 32
caesar will become famous soon enough
Default

Eu unu am facut un hash md5 la $nick:$uhost (parca) si am memorat asta intr-o variabila. Cand primeam raspuns, simplu verificam daca hash-ul pe care il facem atunci exista in lista mea, iar de canale pur si simplu le luam pe toate la rand pe care era eggdrop-ul. Codul meu arata asa:
Code:
## ¤ dronecheck.tcl
# version 1.0
# author: caesar
# e-mail: <cezarica01 [at] yahoo [dot] com>
# IRC: #eggdrop @ Undernet.org

##
# ¤ Description:
#   Will send a private message upon join to check either or not that person is in fact a drone not a real person.

##
# ¤ Available commands:
#    Where  Flag Command   Description
#    -----  ---- -------   -----------
#     PUB :  N/A
#     MSG :  N/A
#     DCC :  n|n .chanset   Use .chanset to set what protections to active for the particular channel or not.
#                           Example: .chanset #mychan +dronecheck
#                                    .chanset #otherchan -dronecheck

##
# ¤ Notes:
#   This script was tested to work properly on eggdrop 1.6.17 or greater. Please upgrade
# your eggdrop or remove/unload the script.
#
#   Some sort of feedback will be appreciated!

##
# ¤ Custom channel flags:
#    Flag:         Description:
#    -----         ------------
#    +dronecheck   Will send that on join message.
#
# ¤ Notes:
#    By default the channel flag 'dronechek' is disabled. Enable it on the channels you wish.
# The only things that you should change are 'drone(*)' (where * stands for a specific setting).

package require Tcl 8.3
package require eggdrop 1.6

namespace eval drone {

  ##
  # .1. Message that will be sent to users upon joining to check either or not it's a drone or a real person:
  set drone(join) {Hi. I'm a bot of $chan channel and I'm checking either or not you are a drone. Please don't reaply to this message because you will get banned if you do. Thank you for your cooperation.}

  ##
  # .2. Define the flasg that should be excepted from the on join message:
  set drone(flags) {f|f}

  ##
  # .3. Reason for banning the drones:
  set drone(reason) {Begone drone!}

  ##
  # .4. How much time the ban should last:
  set drone(bantime) {15m}

  ##
  # .5. Define the type of the banmask:
  # 0/1 ~> *!*foo@*.bar.com
  #  2 ~> *!*@moo.bar.com
  #  3 ~> *!*@*.bar.com
  #  4 ~> *!*foo@moo.bar.com
  #  5 ~> *!*foo@*
  set drone(type) {2}

  #
  ## ¤ Don't edit past here unless you know TCL! ¤
  #

  variable version {1.0}
  setudef flag dronecheck

  variable binds {join:check msgm:execute time:t1mer}

  # quick cleanup
  foreach elem [binds] {
    foreach {type flags name hits proc} $elem {
      if {[string match [namespace current]::* $proc]} {
        unbind $type $flags $name $proc
      }
    }
  }

  foreach elem $binds {
    scan $elem {%[^:]:%s} bind name
    bind $bind - * [namespace current]::$name
  }

  # taken from xchannel.tcl by demond@demond.net
  proc maskhost {nuhost {type 0}} {
    scan $nuhost {%[^!]!%[^@]@%s} nick user host
    scan [set mask [::maskhost $nuhost]] {%*[^@]@%s} mhost
    switch $type {
      0 - 1 { return $mask } ;# *!*foo@*.bar.com
      2 { return *!*@$host } ;# *!*@moo.bar.com
      3 { return *!*@$mhost } ;# *!*@*.bar.com
      4 { return *!*$user@$host } ;# *!*foo@moo.bar.com
      5 { return *!*$user@* } ;# *!*foo@*
      6 { return $nuhost }
    }
  }

  proc check {nick uhost hand chan} {
    variable drones; variable drone
    if {![channel get $chan dronecheck] || [matchattr $hand $drone(flags) $chan]} return
    if {![botisop $chan] || [isbotnick $nick]} return
    set hash [md5 $nick,$uhost]
    if {[info exists drones($hash)]} return
    puthelp "PRIVMSG $nick :[subst $drone(join)]"
    set drones($hash) [unixtime]
  }

  proc execute {nick uhost hand text} {
    variable drones; variable drone
    set hash [md5 $nick,$uhost]
    if {![info exists drones($hash)]} return
    foreach chan [channels] {
      if {![channel get $chan dronecheck] || ![onchan $nick $chan] || ![botisop $chan]} continue
      newchanban $chan [maskhost $nick!$uhost $drone(type)] Drone? $drone(reason) $drone(bantime)
    }
      purge $hash
  }

  proc t1mer {min hour day month year} {
    variable drones
    foreach {hash data} [array get drones] {
      if {[expr [unixtime] - [set ts [lindex $data 0]]] >= 60} {
        purge $hash
      }
    }
  }

  proc purge {hash} {
    variable drones
    if {![info exists drones($hash)]} return
    unset drones($hash)
  }

  putlog "dronecheck.tcl v$version loaded.."
}
caesar is offline   Reply With Quote
Old 28-06-2006, 01:15   #8 (permalink)
Junior Member
 
Join Date: Jun 2006
Posts: 1
Rep Power: 0
EmiIian is an unknown quantity at this point
Default

am luat acest script si l`am pus intr`un fisier spam.tcl . l`am uploadat pe shell l`am pus in folder`ul pentru tcl`uri, iar in eggdrop.conf am setat source scripts/spam.tcl ....
am dat rehash la bot
intrebarea mea este cum pun botul sa dea acele mesaje ce mai trebuie sa fac. Sunt incepator in tcl`uri si am nevoie de ajutor ... ma puteti ajuta ?
Multumesc anticipat

Last edited by lsn; 10-08-2006 at 15:48.
EmiIian is offline   Reply With Quote
Old 28-06-2006, 01:36   #9 (permalink)
Junior Member
 
Join Date: Dec 2005
Posts: 71
Rep Power: 0
krimson will become famous soon enough
Default

nota pentru EmiIian: .chanset #canal +anticlone
krimson is offline   Reply With Quote
Old 28-06-2006, 02:08   #10 (permalink)
Junior Member
 
ReaL|DoG's Avatar
 
Join Date: Jul 2005
Location: Italy
Age: 21
Posts: 63
Rep Power: 0
ReaL|DoG is an unknown quantity at this point
Send a message via Yahoo to ReaL|DoG
Default

ca sa iti mearga pe de pe canal, trebuie sa adaugi anticlone in procesu de ChanSet, care-l gasesti in fisieru a&a_22_a_local_n.tcl din folderu /ascript/

Un exemplu unde l-ai putea pune este linia asta:
Code:
[regexp {^[+-](anticlone|auto(op|voice)|bitch|cycle|revenge(bot|)|dontkickops|nodesynch|(dynamic|enforce|user)bans|inactive|protect(friends|ops)|secret|greet|seen|anti(pub|colour|bold|underline|notice|url|reverse|repeat|action)|limit|secure|voice|op|enforcetopic)$} $mode]} {channel set $chan $mode} elseif {
Acolo unde este cu rosu, pui anticlone. Dupa care salvezi si dai !rehash pe IRC.

Last edited by lsn; 10-08-2006 at 15:49. Reason: varianta pentru ascript de adaugare chanset
ReaL|DoG is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Modify script] Spam Script zappu Tcl scripting 5 07-09-2008 12:53
Anti-Idle TCL GoRaPiD Tcl scripting 4 15-01-2005 21:22
Anti Repeat GoRaPiD Tcl scripting 1 10-12-2004 01:59


All times are GMT +3. The time now is 10:07.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.