<?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/9925" />

	<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>2005-07-08T14:12:02-04:00</updated>

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

		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-07-08T14:12:02-04:00</updated>

		<published>2005-07-08T14:12:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=52001#p52001</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=52001#p52001"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=52001#p52001"><![CDATA[
well, the arrays is Tcl are associative per se, i.e. able to store key/value pairs, not limited to integer type key/index as most compiled languages<br><br>here's what I had in mind:<div class="codebox"><p>Code: </p><pre><code>[demond@whitepine demond]$ cat test.tclproc countwords str {  global count  set idx 0  while {1} {    set buf [string range $str $idx end]    if {[scan $buf %s word] &gt; 0} {      incr idx [expr [string first $word $buf] + [string length $word]]      if {[info exists count($word)]} {incr count($word)} {set count($word) 1}    } {break}  }}[demond@whitepine demond]$ tclsh8.4% source test.tcl% set a "abc def   \t123\n  xyz\tabc\nabc     123\t"abc def         123  xyz   abcabc     123% countwords $a% array get count123 2 abc 3 xyz 1 def 1</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Fri Jul 08, 2005 2:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2005-07-08T04:56:18-04:00</updated>

		<published>2005-07-08T04:56:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51988#p51988</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51988#p51988"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51988#p51988"><![CDATA[
Hehe, okay that wasn't difficult enough, just using normal arrays. Incr count if a similar word is found, else there is a new word.<img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"> <br><br>Sometimes the easiest things can take alot of time to receive from the brain.<br>No I am not good with scan, I use lindex, split to get away from it.<br><br>NOTE: I was trying to develop a way to deteriorate flood bots who use messages with repeating words and text. Based on varying score for words in a string this can be handy.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_lol.gif" width="15" height="15" alt=":lol:" title="Laughing"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Fri Jul 08, 2005 4:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-07-08T04:46:06-04:00</updated>

		<published>2005-07-08T04:46:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51985#p51985</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51985#p51985"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51985#p51985"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>foreach word $words {   if {[info exists count($word)]} {      incr count($word)   } {      set count($word) 1   }}</code></pre></div>on a second thought, you can do that without splitting into a list, just by using [scan] - but I'm going to bed already <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Fri Jul 08, 2005 4:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2005-07-08T04:28:03-04:00</updated>

		<published>2005-07-08T04:28:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51982#p51982</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51982#p51982"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51982#p51982"><![CDATA[
First of all:<br>set string [string trim [split $text]]<br><br>Then:<br>Umm, tcl assoicated arrays. Actually I am unable to get the logic on how to count for repeated words using the array logic in my head currently. Have any rough example or so?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Fri Jul 08, 2005 4:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-07-08T03:50:58-04:00</updated>

		<published>2005-07-08T03:50:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51980#p51980</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51980#p51980"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51980#p51980"><![CDATA[
if by "word" you mean sequence of non-whitespace characters, you need to split, trim and then count repeating list elements (be careful to avoid redundant string comparisons); hint: use Tcl's associative array<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Fri Jul 08, 2005 3:50 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2005-07-08T03:35:20-04:00</updated>

		<published>2005-07-08T03:35:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51979#p51979</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51979#p51979"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51979#p51979"><![CDATA[
So about that:<br><blockquote class="uncited"><div>Also I was wondering how can I detect repeated words in a string through regexp? Then count how many are present like with the -all switch I can do that. The main thing is to detect repeated words not characters.</div></blockquote>Anyone?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Fri Jul 08, 2005 3:35 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-07-07T11:02:14-04:00</updated>

		<published>2005-07-07T11:02:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51923#p51923</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51923#p51923"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51923#p51923"><![CDATA[
I suggest adding a check for server advertising and those lame decode messages.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Thu Jul 07, 2005 11:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[greenbear]]></name></author>
		<updated>2005-07-07T10:05:28-04:00</updated>

		<published>2005-07-07T10:05:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51922#p51922</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51922#p51922"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51922#p51922"><![CDATA[
or you can use this if you want to find a url inside a string and dont want to use a regexp longer than your arm..<div class="codebox"><p>Code: </p><pre><code>regexp -nocase {((http|ftp)://[^\s]+)} $text url</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=24">greenbear</a> — Thu Jul 07, 2005 10:05 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2005-07-07T07:37:59-04:00</updated>

		<published>2005-07-07T07:37:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51915#p51915</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51915#p51915"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51915#p51915"><![CDATA[
Here is a good match pattern for regexp to detect all types of urls:<br><div class="codebox"><p>Code: </p><pre><code>(https?|ftp|file)://[-A-Z0-9+&amp;@#/%?=~_|!:,.;]*[-A-Z0-9+&amp;@#/%=~_|]</code></pre></div>Also I was wondering how can I detect repeated words in a string through regexp or even string match? Then count how many are present? For regexp I found this:<br><div class="codebox"><p>Code: </p><pre><code>(\w+)\s+\1</code></pre></div>I can do that by using 2 foreach loops on the same string, checking one word, matching against others and going for the next one and doing all again and going further. But is there a simpler and easier way?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Thu Jul 07, 2005 7:37 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dizzle]]></name></author>
		<updated>2005-07-06T11:55:07-04:00</updated>

		<published>2005-07-06T11:55:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51872#p51872</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51872#p51872"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51872#p51872"><![CDATA[
i tested the script untill now i like it, no bugs or weird things happend, butt one question metroid. <br><br>Is there a way i can putt in aline where the doesnt react on ?? <br><br>in my channel ppl can request relay's (based on your forum script) <br><br>butt ppl get warned or even kicked when they use !request 01 #chan<br><br>is there a way i can make the script ingore ONLY this ?? <br><br>greetz Dizzle<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6156">Dizzle</a> — Wed Jul 06, 2005 11:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[metroid]]></name></author>
		<updated>2005-07-05T09:37:26-04:00</updated>

		<published>2005-07-05T09:37:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51811#p51811</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51811#p51811"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51811#p51811"><![CDATA[
That proc will detect if an channel name or website is being advertised and that's all it does. Hence the procname<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5078">metroid</a> — Tue Jul 05, 2005 9:37 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dizzle]]></name></author>
		<updated>2005-07-05T03:19:24-04:00</updated>

		<published>2005-07-05T03:19:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51799#p51799</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51799#p51799"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51799#p51799"><![CDATA[
I see its reacting on these advertise lines <br><div class="codebox"><p>Code: </p><pre><code>proc spamscan::advertisement {line} { if {[regexp -- {\x23\S+|[a-zA-Z0-9]+://\S+\.[a-zA-Z0-9]+|www[0-9]*\.\S+\.[a-zA-Z]+} $line]} {  return 1 } return 0}</code></pre></div>Does this detect most off the advertisment?? <br><br>Im going too test it outonmy channel if i find something ill post it here<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6156">Dizzle</a> — Tue Jul 05, 2005 3:19 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-07-02T03:18:17-04:00</updated>

		<published>2005-07-02T03:18:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51648#p51648</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51648#p51648"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51648#p51648"><![CDATA[
hmm I was actually more interested in the spam detection method - what your definition for spam is and how it gets applied to channel traffic<br><br>I presume it's in the [advertisement] proc<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Sat Jul 02, 2005 3:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[metroid]]></name></author>
		<updated>2005-07-02T02:54:50-04:00</updated>

		<published>2005-07-02T02:54:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51646#p51646</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51646#p51646"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51646#p51646"><![CDATA[
Here are parts of the script, that should make you understand i guess <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><div class="codebox"><p>Code: </p><pre><code># /* Configuration# * In seconds, If the last time they spammed was 20 seconds they will get 15 points added (default settings)variable time      "10"variable time2     "15"variable time3     "20"# * Points we give for spamming/advertisingvariable advert    "40"variable advert2   "50"variable advert3   "60"# * Points we give out for flood/spamvariable flood     "15"variable flood2    "10"variable flood3    "5"# * Points they need to get punished.variable warn      "80"variable kick      "100"variable ban       "120"</code></pre></div><div class="codebox"><p>Code: </p><pre><code>  if {$spamscan::spamscan} {   if {[advertisement $arguments]} {    if {$checktime &gt;= $spamscan::time3} {     incr db($channel,$ident) $spamscan::advert3    } elseif {$checktime &gt;= $spamscan::time2} {     incr db($channel,$ident) $spamscan::advert2    } else {     incr db($channel,$ident) $spamscan::advert    }   }  }</code></pre></div><div class="codebox"><p>Code: </p><pre><code>  if {$db($channel,$ident) &gt;= $ban} {    putlog "$nickname was \0034banned\003 in $channel. \(score: $db($channel,$ident)\)"    set banmask [banmask $hostname]    putquick "MODE $channel +b $banmask"    putquick "KICK $channel $nickname :[string map "%nickname $nickname %channel $channel %id [expr [channel get $channel spamkicked] + 1]" [join $kickmsg]]"    channel set $channel spamkicked "[expr [channel get $channel spamkicked] + 1]"    if {$bantime != "0"} {     timer $bantime [list pushmode $channel -b $banmask]    }  } elseif {$db($channel,$ident) &gt;= $kick} {    putlog "$nickname was \0038kicked\003 in $channel. \(score: $db($channel,$ident)\)"    putquick "KICK $channel $nickname :[string map "%nickname $nickname %channel $channel %id [expr [channel get $channel spamkicked] + 1]" [join $kickmsg]]"    channel set $channel spamkicked "[expr [channel get $channel spamkicked] + 1]"  }</code></pre></div>It will just add a score for each line said and decrease the score over time, If the score gets to a certain point the script will do something, like warn or kick that person.<br><br>It's purely for text and stuff, not other things <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>(This is how the spamscan service on Quakenet works)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5078">metroid</a> — Sat Jul 02, 2005 2:54 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-07-01T21:22:14-04:00</updated>

		<published>2005-07-01T21:22:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51628#p51628</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51628#p51628"/>
		<title type="html"><![CDATA[SpamScan]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51628#p51628"><![CDATA[
care to explain how does it do its job, maybe paste some relevant code?<br><br>I'm curious, but can't be bothered to download and examine it hehe<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Fri Jul 01, 2005 9:22 pm</p><hr />
]]></content>
	</entry>
	</feed>
