mIRC Home    About    Download    Register    News    Help

Print Thread
W
w00dy
w00dy
W
Hello there,

I am one of the ops on a chat system that caters for several thousand users.

Unfortunately quite often we get people trying to be smart posting urls to websites containing porn, warez, hack sites, etc. Things which are against the T&C of our system and who knows why they do it.

Anyway to combat this Ive been using simple text matching scripts for each bad url such as:

on 1:TEXT:$(*offensiveurl.com*):#channel1,#channel2,#channel3: {
/msg $nick You have been banned for pasting that OFFENSIVE link (This is an Auto Ban)
/msg $nick Please Read the Terms & Conditions
/msg $chan **WARNING** DO NOT click on that link it contains a very OFFENSIVE picture!
/msg $chan $nick has just managed to ban themeselves posting that OFFENSIVE URL! DO NOT post things like that (AutoBan)

Followed by the command to ban the user from one or more channels.

This works aok but its a pain to update as you could imagine with new nasty URL's which become the flavour of the week (outwar, etc) as each url requires (well, with my novice scipting knowledge) its own trigger script.

What I would like to work out is how to allow myself and other ops to add/remove urls which we deem offensive to a master list with a command so that the 1 central script just uses a lookup table of badwords so to speak.

We dont want to try block everything under the sun as this would be stupid and impossible, theres usually only 1/2 doz favorite common crude sites that people spam, but occasionally we'd love to add/remove some with more ease than me just having to edit my script manually.

Any help would be greatly appreciated.

M
MTech
MTech
M
on 1:TEXT:http://*:#channel1,#channel2,#channel3: {
if ($read(bannedurls.txt, w, * $+ $1- $+ *) {
/commands
}
on 1:TEXT:www.*:#channel1,#channel2,#channel3: {
if ($read(bannedurls.txt, w, * $+ $1- $+ *) {
/commands
}

and in bannedurls.txt
www.xwarez.com
http://xwarez.com
www.trojans.org
http://trojans.org


try /help $read also




----------------------------
but then again maybe im wrong

Last edited by MTech; 29/03/03 04:11 PM.
Joined: Dec 2002
Posts: 332
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
well in some respects that would work but only if they just spam and leave it at that if some person comes in and says

hi everyone come visit my site at skankystuff.com

then the above wouldnt work i was thinking on how to accomplish that your going to have to find the position of www. then fill it in to the right till you hit the next space then $read etc etc
i will take a look at it further later when i have some free time

ok i gotta run out for awhile and this prolly doesnt work but it is an example of what i meant

Code:
  
on 1:TEXT:*www*:#channel: {
set %where $pos($1-,www,1)
set %what $strip($right(%where,$chr(32)))
set %url %where $+ %what
if ( %url isin $read(badurls.txt,w,%url) ) {
 ban kick user etc
 /msg $chan etc.. 
}
}


Last edited by Cheech; 29/03/03 04:45 PM.
M
MTech
MTech
M
o... but most people will make it so the link can be clicked on. so people can come now...so it would work alot...

Joined: Dec 2002
Posts: 332
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
ok i thought abaout it and this was the best i could come up with
Code:
  
on 1:TEXT:*www*:#: {
  set %urltext $strip($1-)
  set %spammer $nick
  var %g = $url(0)
  while (%g > 0) {
    if ( $url(%g) isin %urltext ) { set %urltext1 $url(%g) }
    dec %g
  }
  if ( %urltext1 isin $read(badurls.txt,w,* $+ %urltext $+ *) ) {
    /ban # %spammer
    /kick # %spammer
    [color:red] you can insert your channel msgs in this area   [/color] 
  }
}



most http address still contain www. in them so it should work you will need to just update the badurls.txt with the new addresses you could do that like this
Code:
  
.EditBadUrls:/write badurls.txt $$?="BadUrl:"
[color:red] this will go in a popup file and when you click on it  you can just copy and paste the url to be added  [/color] 


you can add a /write line to delete them also but i would just manually open the file and delete what isnt needed
i hope this helps smile

you will need to turn the Catcher Option on in Mirc by going to <file> <options> <irc> <catcher> then enable address catching for url's

edit for color stripping so that if the url is color coded it will still trigger

Last edited by Cheech; 29/03/03 11:42 PM.
Joined: Dec 2002
Posts: 698
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 698
Code:
on *:start:{
  hmake offensive 5
  hload -n offensive [color:gray]badurls.txt[/color]
}
 
on *:quit:hsave -n offensive [color:gray]badurls.txt[/color]
 
on [color:blue]*[/color]:text:[color:purple]!???url &amp;[/color]:[color:green]#channel[/color]:{
  [color:blue]if $nick isop # || $level($fulladdress) == Access {[/color]
  if $1 == !addurl {
    var %a = $+(*,$2,*)
    if !$read([color:gray]badurls.txt[/color],w,%a) { write [color:gray]badurls.txt[/color] %a }
   }
  if $1 = !delurl {
    var %a = $+(*,$2,*)
    if $read([color:gray]badurls.txt[/color],w,%a) { write -dl $+ $readn [color:gray]badurls.txt[/color] }
  }
  if $hget(offensive) hload -n offensive [color:gray]badurls.txt[/color]
}
 
on [color:red]@+1[/color]:text:*:[color:green]#channel[/color]:{
  if $hfind(offensive,$1-,1,W).data {
    [color:brown]; Here is where your code for
    ; messaging, kicking, banning etc.
    ; should be put[/color]
  }
}

Blue text needs to be altered to the method of access checking you prefer to use
"#channel" obviously should be the channel(s) you want the script to cover
"@+1" means the script will only trigger where you are opped (@), and only for level 1, or no level, users (+1)
"!???url &" defines "!+3chars+url site.to.add|del" ('!addurl somesite.com' or '!delurl whatever.net') to allow the adding/removing urls from the list
badurls.txt is a plain text file containing a list of wildcarded sites to trigger on.
*.offensive.tv*
*www.geopoopies.com*
*http://badness.org*

...

Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
Just a detail, you can avoid the $read() in the !delurl section with
/write -dw $+ %a badurls.txt

Joined: Dec 2002
Posts: 698
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 698
Yeah good point. I was going to add notifications that the url was or wasn't added|removed, but I forgot. laugh

W
w00dy
w00dy
W
Hello Again,

Thanks to your excellent help on here my script progressed to quite an excellent working level, esp with Nimue's help.

Heres the script that I've been using and its been going quite well other than a few problems.

As you can see from the script, in a nutshell I have 3 text files which contain words layed out as:

*grossurl.com*

depending on which file that has been added too by anyone in our #admin channel the bot will either ban, mute or just warn the person.

The problems I have at the moment are that for some reason new entries to the ban listing whlst being written out to the text file don't seem to be active in the hash table unless i unload/reload the script. Very odd, as it was working fine until about the 30th entry in the textfile/hash table. Ive tried all combinations of clearning, initialisting and restarting/reloading the hash tables but I cant get it to work smoothly as it was frown.

If someone also types one of the listed triggers in a
/me says grossurl.com
the bot doesnt trigger. Admitingly I'll rtfm 'on *' a tad more, but seeing im posting I might as well ask here smile

The other thing which is annoying but doesnt seem to stop functionality is that when sending messages to the user, admin channel or even myself (for logging what the bot is doing) I always seem to get it 2x. This has me stumped I can't work out why its doing this. For example, when a user triggers the bot on a badword, this gets sent to me in a PM (as it should, but only once):

<me> Banned 1337user for grossurl.com spam @ 00:40:01 26/04/2003 on #users
<me> Banned 1337user for grossurl.com spam @ 00:40:01 26/04/2003 on #users

Anyway, if any of you kind souls would be kind enough to pick over my script and see if you can spot fault Id be more than happy.

Things todo are to merge the repeat spamming scipt section at the bottom with the main ban/mute script to give the users 2 warnings before actually activating a ban/mute.

Anyway, the script which others might also find helpfull in its current form:

; Start Up and Init section

on *:start:{
hfree -sw chanban
hfree -sw chanmute
hfree -sw chanwarn
hmake chanban 200
hload -sn chanban chanban.txt
hmake chanmute 200
hload -sn chanmute chanmute.txt
hmake chanwarn 100
hload -sn chanwarn chanwarn.txt
}

on me:*:quit:{
hsave -son chanban chanban.txt
hsave -son chanmute chanmute.txt
hsave -son chanwarn chanwarn.txt
}

; Admin Section

on *:TEXT:!listban:#testing,#admin:{
play $nick c:\mirc\chanban.txt
msg $mnick Admin: $nick requested chan ban list @ $time $date on $chan
}

on *:TEXT:!listmute:#testing,#admin:{
play $nick c:\mirc\chanmute.txt
msg $mnick Admin: $nick requested chan mute list @ $time $date on $chan
}

on *:TEXT:!listwarn:#testing,#admin:{
play $nick c:\mirc\chanwarn.txt
msg $mnick Admin: $nick requested chan warning list @ $time $date on $chan
}

on *:TEXT:!helpbot:#testing,#admin:{
msg $nick AdminBot v1.2 - Simple Help
msg $nick -=-=-=-=-=-=-=-=-=-=-=-=-=-
msg $nick !addban matchtext - Will ban anyone saying matchtext
msg $nick !delban matchtext - Will remove matchtext from the ban list
msg $nick !addmute matchtext - Will mute anyone saying matchtext
msg $nick !delmute matchtext - Will remove matchtext from the mute list
msg $nick !addwarn matchtext - Will warn with T&C URL on saying matchtext
msg $nick !delwarn matchtext - Will remove matchtext from the warning list
msg $nick !listban !listmute and !listwarn echo lists to you in a PM
msg $mnick Admin: $nick requested Adminbot Help @ $time $date on $chan
}

; BAN SECTION

on *:TEXT:!???ban &:#admin,#testing:{
if $1 == !addban {
var %a = $+(*,$2,*)
if !$read(chanban.txt,w,%a) {
write chanban.txt %a
msg # $2 has been added to the chan banlist
msg $mnick Admin: $2 has been added to the chan banlist by $nick @ $time $date
}
else msg # Sorry $2 is already listed on the chan banlist
}
if $1 = !delban {
var %a = $+(*,$2,*)
if $read(chanban.txt,w,%a) {
write -dl $+ $readn chanban.txt
msg # $2 has been removed from the chan banlist
msg $mnick Admin: $2 has been removed from the chan banlist by $nick @ $time $date
}
else msg # Sorry $2 is NOT on the chan banlist
}
if $hget(chanban) { hload -sn chanban chanban.txt }
}

; MUTE SECTION

on *:TEXT:!???mute &:#admin,#testing:{
if $1 == !addmute {
var %a = $+(*,$2,*)
if !$read(chanmute.txt,w,%a) {
write chanmute.txt %a
msg # $2 has been added to the chan Mute list
msg $mnick Admin: $2 has been added to the chan mutelist by $nick @ $time $date
}
else msg # Sorry $2 is already listed on the chan Mute list
}
if $1 = !delmute {
var %a = $+(*,$2,*)
if $read(chanmute.txt,w,%a) {
write -dl $+ $readn chanmute.txt
msg # $2 has been removed from the chan Mute list
msg $mnick Admin: $2 has been removed from the chan mutelist by $nick @ $time $date
hfree -sw chanmute
hmake chanmute 200
hload -sn chanmute chanmute.txt
}
else msg # Sorry $2 is NOT on the chan Mute list
}
if $hget(chanmute) { hload -sn chanmute chanmute.txt }
}

; Warnings SECTION

on *:TEXT:!???warn &:#admin,#testing:{
if $1 == !addwarn {
var %a = $+(*,$2,*)
if !$read(chanwarn.txt,w,%a) {
write chanwarn.txt %a
msg # $2 has been added to the chan Warning Only list
msg $mnick Admin: $2 has been added to the chan warnlist by $nick @ $time $date
}
else msg # Sorry $2 is already listed on the chan Warning Only list
}
if $1 = !delwarn {
var %a = $+(*,$2,*)
if $read(chanwarn.txt,w,%a) {
write -dl $+ $readn chanwarn.txt
msg # $2 has been removed from the chan Warning Only list
msg $mnick Admin: $2 has been removed from the chan warnlist by $nick @ $time $date
hfree -sw chanwarn
hmake chanwarn 200
hload -sn chanwarn chanwarn.txt
}
else msg # Sorry $2 is NOT on the chan Warning Only list
}
if $hget(chanwarn) { hload -sn chanwarn chanwarn.txt }
}

on *:TEXT:*:#users,#testing:{
if $hfind(chanban,$1-,1,W).data {
/msg $nick You have been BANNED for pasting that Inappropriate link/text/word into chan. (This is an Auto BAN)
/msg $mnick Banned $nick for $1- spam @ $time $date on $chan
/msg #admin Bot has Banned $nick ( $mask($fulladdress,3) ) for: $1- @ $time $date on $chan
/msg chanserv BAN $chan $nick
}
if $hfind(chanmute,$1-,1,W).data {
/msg $nick You have been MUTED for pasting that Inappropriate link/text/word into chan. (This is an Auto BAN)
/msg $mnick Muted $nick for $1- spam @ $time $date on $chan
/msg #admin Bot has Muted $nick ( $mask($fulladdress,3) ) for: $1- @ $time $date on $chan
/msg chanserv MUTE $chan $nick
}
if $hfind(chanwarn,$1-,1,W).data {
/msg $nick Please do not repeat what you have Just said in chan (This is an Auto Warning)
/msg $nick If you keep posting the same thing, you will be BANNED!
/msg $mnick Warned $nick for $1- spam @ $time $date on $chan
/msg #admin Bot has Warned Only $nick ( $mask($fulladdress,3) ) for: $1- @ $time $date on $chan
}
}

; Repeat Spamming Section

on @*:TEXT:*:#testing: {
; If the user is repeating, increase the counter
if ( $hget($+(repeattext,$cid,$chan),$address) == $1- ) {
inc -u300 $+(%,repeatcount,$cid,$chan,$address)
; If the user is repeating more than three times, take action
if ( $eval($+(%,repeatcount,$cid,$chan,$address),2) > 3 ) {
; Increase the number of warnings and store the number to %warnings
; Warnings will be remembered for an hour (3600 seconds)
inc -u3600 $+(%,repeatwarnings,$cid,$chan,$address)
var %warnings = $eval($+(%,repeatwarnings,$cid,$chan,$address),2)
if ( %warnings > 2 ) {
msg chanserv BAN $chan $nick
msg $chan $nick has been Banned for Repeat Spamming after %warning warning (AutoBan)
msg $mnick Kicked & Banned $nick ( $mask($fulladdress,3) ) for Flooding @ $time $date on $chan
}
else {
msg chanserv MUTE $chan $nick
msg $chan $nick Stop Repeat Spamming $nick We Get the Point! (AutoMute Warning!)
}
}
}
else {
; If the user isn't repeating, reset the variables
; Set the time limit to five minutes (300 seconds)
hadd -mu300 $+(repeattext,$cid,$chan) $address $1-

; /set and /inc need the -u switch only to clean unneeded variables
set -u300 $+(%,repeatcount,$cid,$chan,$address) 1
}
}


Link Copied to Clipboard