<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/16610" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2009-02-12T13:18:59-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/16610</id>

		<entry>
		<author><name><![CDATA[Fill]]></name></author>
		<updated>2009-02-12T13:18:59-04:00</updated>

		<published>2009-02-12T13:18:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87369#p87369</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87369#p87369"/>
		<title type="html"><![CDATA[Banning a user second time he breaks the rule]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87369#p87369"><![CDATA[
Yup, I already knew that tcl-commands document, and I am following this website: <a href="http://johoho.eggheads.org/eggdrop/other/guide2tcl.html" class="postlink">http://johoho.eggheads.org/eggdrop/other/guide2tcl.html</a><br><br>I'll check <a href="http://www.tcl.tk/man/" class="postlink">http://www.tcl.tk/man/</a><br><br>Thanks for the tips <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10430">Fill</a> — Thu Feb 12, 2009 1:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2009-02-11T20:06:36-04:00</updated>

		<published>2009-02-11T20:06:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87357#p87357</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87357#p87357"/>
		<title type="html"><![CDATA[Banning a user second time he breaks the rule]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87357#p87357"><![CDATA[
ohh crap, thanks speechles<br><br>Its my fault,I just forget to remove it before paste. In first version there was smth like return "aaa bbb".<br><br>Its nonsens to make list from another list, he he <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>here is version without this split:<div class="codebox"><p>Code: </p><pre><code># Author: tomekk # e-mail:  tomekk/@/oswiecim/./eu/./org # home page: http://tomekk.oswiecim.eu.org/ # # Version 0.1 # # This file is Copyrighted under the GNU Public License. # http://www.gnu.org/copyleft/gpl.html# channel nameset nick_channel "#channel"# max nick lengthset nick_max_len 15# time between joins (minutes)set time_between_joins 180# kick messageset kick_msg "your nick is to long ;p"# ban kick messageset kick_ban_msg "now u got! ban! ;p"# 1 = *!*ident@somehost.com, 2 = *!*@somehost.comset ident_type 2# ban duration (minutes)set ban_time 120# check bans every X minutesset ban_check_int 2# db file with kicked hostsset kicks_db "kicks.txt"# db file with banned hostsset bans_db "bans.txt"########################################################################bind join - "*" job_onjoinif {![file exist $kicks_db]} {set k_h [open $kicks_db w]close $k_h}if {![file exist $bans_db]} {        set b_h [open $bans_db w]close $b_h}proc add_db_host { db input_data } {set add_h [open $db a]puts $add_h $input_dataclose $add_h}proc del_db_host { db input_host } {set all_h [open $db r]set all_data [read $all_h]close $all_hset new_data [open $db w]foreach db_host [split $all_data "\n"] {if {$db_host != ""} {set just_host [lindex [split $db_host ";"] 0]if {$just_host != $input_host} {puts $new_data $db_host}}}close $new_data}proc check_host { db input_host } {set host_exists 0set host_time 0set check_h [open $db r]set check_data [read $check_h]close $check_hforeach db_line [split $check_data "\n"] {if {$db_line != ""} {set data_split [split $db_line ";"]set db_host [lindex $data_split 0]set db_time [lindex $data_split 1]if {$input_host == $db_host} {set host_exists 1set host_time $db_timebreak}}}return [list $host_exists $host_time]}proc ban_clean { } {global ban_check_intrefresh_bansif {[string match *ban_clean* [timers]] != 1} {timer $ban_check_int ban_clean}}proc job_onjoin {nick uhost hand chan} {global nick_channel nick_max_len kicks_db bans_db ident_type time_between_joins kick_msg kick_ban_msg botnickif {$chan == $nick_channel} {if {$nick != $botnick} {set nick_l [string length $nick]if {$nick_l &gt; $nick_max_len} {if {$ident_type == 1} {set prepared_host "*!*$uhost"} {set prepared_host "*!*@[lindex [split $uhost "@"] 1]"}set proc_out [check_host $kicks_db $prepared_host]set host_in_db [lindex $proc_out 0]set host_add_time [lindex $proc_out 1]set clock_seconds [clock seconds]if {$host_in_db == 0} {add_db_host $kicks_db "$prepared_host;$clock_seconds"putkick $nick_channel $nick $kick_msg} {if {[expr $clock_seconds - $host_add_time] &gt; [expr $time_between_joins * 60]} {del_db_host $kicks_db $prepared_hostadd_db_host $kicks_db "$prepared_host;$clock_seconds"putkick $nick_channel $nick $kick_msg} {del_db_host $kicks_db $prepared_hostadd_db_host $bans_db "$prepared_host;$clock_seconds"putserv "MODE $nick_channel +b $prepared_host"putkick $nick_channel $nick $kick_ban_msg}}}}}}proc refresh_bans { } {global ban_time bans_db nick_channelset bans_h [open $bans_db r]set get_all_bans [read $bans_h]close $bans_hset curr_time [clock seconds]set new_bans_db [open $bans_db w]foreach simple_ban [split $get_all_bans "\n"] {if {$simple_ban != ""} {set data_rows [split $simple_ban ";"]set ban_add_host [lindex $data_rows 0]set ban_add_time [lindex $data_rows 1]if {[expr $curr_time - $ban_add_time] &gt; [expr $ban_time * 60]} {putserv "MODE $nick_channel -b $ban_add_host"} {puts $new_bans_db $simple_ban}}}close $new_bans_db}if {[string match *ban_clean* [timers]] != 1} {        timer $ban_check_int ban_clean}putlog "check-nick.tcl ver 0.1 by tomekk loaded"</code></pre></div>@Fill that's cool. TCL is not to hard, you need just solid documentation and some examples <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>HF<br><br>P.S.<br><a href="http://www.tcl.tk/man/" class="postlink">http://www.tcl.tk/man/</a><br><br>And look into eggdrop doc directory in source package. There is a txt file called "tcl-commands.doc",  you can find there descriptions of eggdrop TCL functions.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Wed Feb 11, 2009 8:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-02-11T16:59:05-04:00</updated>

		<published>2009-02-11T16:59:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87351#p87351</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87351#p87351"/>
		<title type="html"><![CDATA[Banning a user second time he breaks the rule]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87351#p87351"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc check_host { db input_host } {   ...snipped irrelevant sections...   return [list $host_exists $host_time]}proc job_onjoin {nick uhost hand chan} {   global nick_channel nick_max_len kicks_db bans_db ident_type time_between_joins kick_msg kick_ban_msg botnick   if {$chan == $nick_channel} {     ...snipped irrelevant sections...            set proc_out [split [check_host $kicks_db $prepared_host]] </code></pre></div>@ tomekk, you see your flaw above? Why do you return a list from your check_host proc and then split it? You can get rid of that split as it will introduce braces {} into the output...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Wed Feb 11, 2009 4:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fill]]></name></author>
		<updated>2009-02-11T12:18:00-04:00</updated>

		<published>2009-02-11T12:18:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87350#p87350</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87350#p87350"/>
		<title type="html"><![CDATA[Banning a user second time he breaks the rule]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87350#p87350"><![CDATA[
Hey there again.<br><br>I've added a new setting to this script (this does the same thing that happens on join, but instead of monitoring the joins it keeps track of nickchanges, so a user is kicked even if he changes from a small nick to a big nick):<br><div class="codebox"><p>Code: </p><pre><code>bind nick - "*" job_nickchangeproc job_nickchange {nick host hand chan newnick} {   global nick_channel nick_max_len kicks_db bans_db ident_type time_between_joins kick_msg kick_ban_msg botnick   if {$chan == $nick_channel} {      if {$nick != $botnick} {         set nick_l [string length $newnick]         if {$nick_l &gt; $nick_max_len} {            if {$ident_type == 1} {               set prepared_host "*!*$host"            } {               set prepared_host "*!*@[lindex [split $host "@"] 1]"            }            set proc_out [split [check_host $kicks_db $prepared_host]]            set host_in_db [lindex $proc_out 0]            set host_add_time [lindex $proc_out 1]            set clock_seconds [clock seconds]            if {$host_in_db == 0} {               add_db_host $kicks_db "$prepared_host;$clock_seconds"               putkick $nick_channel $newnick $kick_msg            } {               if {[expr $clock_seconds - $host_add_time] &gt; [expr $time_between_joins * 60]} {                  del_db_host $kicks_db $prepared_host                  add_db_host $kicks_db "$prepared_host;$clock_seconds"                  putkick $nick_channel $newnick $kick_msg               } {                  del_db_host $kicks_db $prepared_host                  add_db_host $bans_db "$prepared_host;$clock_seconds"                  putserv "MODE $nick_channel +b $prepared_host"                  putkick $nick_channel $newnick $kick_ban_msg               }            }         }      }   }}</code></pre></div>Tested and everything is working. Once again, thanks for the help.<br>See ya<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10430">Fill</a> — Wed Feb 11, 2009 12:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fill]]></name></author>
		<updated>2009-02-11T10:11:33-04:00</updated>

		<published>2009-02-11T10:11:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87346#p87346</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87346#p87346"/>
		<title type="html"><![CDATA[Banning a user second time he breaks the rule]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87346#p87346"><![CDATA[
wow, thanks a lot, it worked and helped me, because I got what I wanted and I learnt some new stuff with your script. Thanks ! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10430">Fill</a> — Wed Feb 11, 2009 10:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2009-02-11T06:31:00-04:00</updated>

		<published>2009-02-11T06:31:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87345#p87345</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87345#p87345"/>
		<title type="html"><![CDATA[Banning a user second time he breaks the rule]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87345#p87345"><![CDATA[
try:<div class="codebox"><p>Code: </p><pre><code># Author: tomekk # e-mail:  tomekk/@/oswiecim/./eu/./org # home page: http://tomekk.oswiecim.eu.org/ # # Version 0.1 # # This file is Copyrighted under the GNU Public License. # http://www.gnu.org/copyleft/gpl.html# channel nameset nick_channel "#channel"# max nick lengthset nick_max_len 15# time between joins (minutes)set time_between_joins 180# kick messageset kick_msg "your nick is to long ;p"# ban kick messageset kick_ban_msg "now u got! ban! ;p"# 1 = *!*ident@somehost.com, 2 = *!*@somehost.comset ident_type 2# ban duration (minutes)set ban_time 120# check bans every X minutesset ban_check_int 2# db file with kicked hostsset kicks_db "kicks.txt"# db file with banned hostsset bans_db "bans.txt"########################################################################bind join - "*" job_onjoinif {![file exist $kicks_db]} {set k_h [open $kicks_db w]close $k_h}if {![file exist $bans_db]} {        set b_h [open $bans_db w]close $b_h}proc add_db_host { db input_data } {set add_h [open $db a]puts $add_h $input_dataclose $add_h}proc del_db_host { db input_host } {set all_h [open $db r]set all_data [read $all_h]close $all_hset new_data [open $db w]foreach db_host [split $all_data "\n"] {if {$db_host != ""} {set just_host [lindex [split $db_host ";"] 0]if {$just_host != $input_host} {puts $new_data $db_host}}}close $new_data}proc check_host { db input_host } {set host_exists 0set host_time 0set check_h [open $db r]set check_data [read $check_h]close $check_hforeach db_line [split $check_data "\n"] {if {$db_line != ""} {set data_split [split $db_line ";"]set db_host [lindex $data_split 0]set db_time [lindex $data_split 1]if {$input_host == $db_host} {set host_exists 1set host_time $db_timebreak}}}return [list $host_exists $host_time]}proc ban_clean { } {global ban_check_intrefresh_bansif {[string match *ban_clean* [timers]] != 1} {timer $ban_check_int ban_clean}}proc job_onjoin {nick uhost hand chan} {global nick_channel nick_max_len kicks_db bans_db ident_type time_between_joins kick_msg kick_ban_msg botnickif {$chan == $nick_channel} {if {$nick != $botnick} {set nick_l [string length $nick]if {$nick_l &gt; $nick_max_len} {if {$ident_type == 1} {set prepared_host "*!*$uhost"} {set prepared_host "*!*@[lindex [split $uhost "@"] 1]"}set proc_out [split [check_host $kicks_db $prepared_host]]set host_in_db [lindex $proc_out 0]set host_add_time [lindex $proc_out 1]set clock_seconds [clock seconds]if {$host_in_db == 0} {add_db_host $kicks_db "$prepared_host;$clock_seconds"putkick $nick_channel $nick $kick_msg} {if {[expr $clock_seconds - $host_add_time] &gt; [expr $time_between_joins * 60]} {del_db_host $kicks_db $prepared_hostadd_db_host $kicks_db "$prepared_host;$clock_seconds"putkick $nick_channel $nick $kick_msg} {del_db_host $kicks_db $prepared_hostadd_db_host $bans_db "$prepared_host;$clock_seconds"putserv "MODE $nick_channel +b $prepared_host"putkick $nick_channel $nick $kick_ban_msg}}}}}}proc refresh_bans { } {global ban_time bans_db nick_channelset bans_h [open $bans_db r]set get_all_bans [read $bans_h]close $bans_hset curr_time [clock seconds]set new_bans_db [open $bans_db w]foreach simple_ban [split $get_all_bans "\n"] {if {$simple_ban != ""} {set data_rows [split $simple_ban ";"]set ban_add_host [lindex $data_rows 0]set ban_add_time [lindex $data_rows 1]if {[expr $curr_time - $ban_add_time] &gt; [expr $ban_time * 60]} {putserv "MODE $nick_channel -b $ban_add_host"} {puts $new_bans_db $simple_ban}}}close $new_bans_db}if {[string match *ban_clean* [timers]] != 1} {        timer $ban_check_int ban_clean}putlog "check-nick.tcl ver 0.1 by tomekk loaded"</code></pre></div>I tested it with 10k hosts, its working well.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Wed Feb 11, 2009 6:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-02-10T14:18:51-04:00</updated>

		<published>2009-02-10T14:18:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87333#p87333</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87333#p87333"/>
		<title type="html"><![CDATA[Banning a user second time he breaks the rule]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87333#p87333"><![CDATA[
Personally, I'd say using external files would be overkill for a first attempt.<br><br>First off, you'll need some kind of "id" to keep track of a single offender. This will very much affect the behaviour of your bot, as it will determine how easy it will be to "avoid" the second kick. A few ideas for id would be nickname, user@host, host, user@host#channel, etc.<br>I would also recommend converting the id to lowercase (<strong class="text-strong">string tolower</strong> is your friend here).<br><br>Secondly, you'll like to store some kind of time-dependant data along with this id, so you'll be able to determine whether sufficient has passed since the last offence or not. My recommendation would be to use timestamps (<strong class="text-strong">clock seconds</strong> is your friend here).<br><br>Finally, you'll need some kind of storage facility that allows you to "attach" this timestamp to the id. My suggestion here is arrays (indexed variables).<br><br>When this has been accomplished, what is left to do is a test whether this indeed is a repeated offence, and in such cases, add a temporary ban to your eggdrops internal banlist (<strong class="text-strong">newban</strong> / <strong class="text-strong">newchanban</strong>).<br><br>If you need a good example on this kind of approach, search the forum for "throttled", as you'll find several hits illustrating a generic way of doing this.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Feb 10, 2009 2:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fill]]></name></author>
		<updated>2009-02-10T10:08:51-04:00</updated>

		<published>2009-02-10T10:08:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87331#p87331</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87331#p87331"/>
		<title type="html"><![CDATA[Banning a user second time he breaks the rule]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87331#p87331"><![CDATA[
You're certainly right, but I don't know how to do that, is it very difficult? Thanks for the help, I'll try to read some tutorials, but if you posted the code it would be nice.<br><br>Thanks<br>Fill<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10430">Fill</a> — Tue Feb 10, 2009 10:08 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2009-02-10T06:55:46-04:00</updated>

		<published>2009-02-10T06:55:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87327#p87327</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87327#p87327"/>
		<title type="html"><![CDATA[Banning a user second time he breaks the rule]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87327#p87327"><![CDATA[
In my point of view, this should be something like this:<br><br>1st file with hosts of kicked ppl<br>2nd file with hosts of banned ppl<br><br>If someone joins the channel bot checking it host and compare it with hosts from file (file with kicked ppl hosts), if match (and time is less than 3 hours) bot making +b for this person.<br><br>After ban, bot moving this host entry from "kicked file" to "banned file".<br><br>Next, some timer in script is checking ie. for every 1 minute banned hosts file.<br>If some host has more than XX minutes ban bot making -b on this host.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Tue Feb 10, 2009 6:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fill]]></name></author>
		<updated>2009-02-09T13:31:08-04:00</updated>

		<published>2009-02-09T13:31:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87307#p87307</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87307#p87307"/>
		<title type="html"><![CDATA[Banning a user second time he breaks the rule]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87307#p87307"><![CDATA[
Hi mates, I am learning TCL and this is my first script:<br><div class="codebox"><p>Code: </p><pre><code>bind join - "#cyber-world *" nick:joinproc nick:join {nick host handle chan} { set nletters [string length $nick] if { $nletters &gt; 15 } {   putserv "KICK $chan $nick :Please choose a nick with less than 15 characters. To do so, please type /nick NewNickHere. Thanks." }}</code></pre></div>As you can see, it's quite simple, and all it does is banning someone who has more than 15 characteres in the nick length. Now, I wanted to improve this and make the bot ban the user for 3 hours if he returns after the kick. How could I do this?<br><br>Thanks in advance for the help,<br>Fill<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10430">Fill</a> — Mon Feb 09, 2009 1:31 pm</p><hr />
]]></content>
	</entry>
	</feed>
