Jump to content


Spam Filter in PM's


49 replies to this topic

#1 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 04 January 2009 - 01:18 PM

I think it's better to move my project to a new topic.

There is version 0.2 - OLD - LATEST VERSION IS ALVAYS IN THE LAST POST
changes:
-counting the blocked PM's number, and display it
-behavior:

what its do
1. chek the PM'-s text for key words (www, /fav, dchub://, http, flood )
2. If not find key word, checks the text lenght. (as version 0.1)
3. If one of the upper things presents in the text, it's block the PM, and paste it's text to the hub's main chat window. (just you will see)

I'm currently working on to the script don't checks favorite users, I finded some intresting code from botlehated, but it's not better jet.

-------------
Somebody tryd to flood me jesterday, sent 1376 PM to me, but the script blcoked all of them.


#2 Guest_Toast_*

  • Guest

Posted 04 January 2009 - 01:54 PM

may i add a small suggestion

add a txt or something similar with words that are forbidden and load em into the script :)

and a small suggestion to moderator - create a lua forum in here :)

Edited by Toast, 04 January 2009 - 01:58 PM.


#3 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 04 January 2009 - 02:18 PM

View PostToast, on Jan 4 2009, 02:54 PM, said:

may i add a small suggestion

add a txt or something similar with words that are forbidden and load em into the script :)

and a small suggestion to moderator - create a lua forum in here :)

That will be a good feature on the future, thanx to mentioned it. Now i had problems with some script from BotledHate. They have a script, witch reads out the nicks from the Favorites.xml.

--//load DC++ favorite users into talble (LUA5 BCDC / DCDM only)
--// easily modded to do other things.
--// returns a table in the format {["nick1"] = 1, ["nick2"] = 1, ["nick3"] = 1, ... } ...so the names are hashed
		 function loadFavUsers()
			local start=0
			local favUsers={}
			for line in io.lines("Favorites.xml") do
			   if string.find(line, "</Users>") then
				  return favUsers
				  [b]break[/b]		 
			   end
			   if start ==1 then
				  local s,e,favnick = string.find(line, "<User Nick=\"(.-)\"")
				  favUsers[favnick] = 1
			   end
			   if string.find(line, "<Users>") then 
				  start=1
			   end
		 end

When the break is in the code, the lua says "end" excepted. Without the brake it runs, but had some problem.

--filtering
dcpp:setListener( "pm", "pmlistener",
function( hub, user, text )
	if not favUsers[user:getNick()] then

filteringg script from v0.2...
..
.
couple of ends

So if the break is not in the code, it runs, but not care about who is favorite user, filter all PM-s.

Uploaded the file for testing.

#4 en_dator

    Swedish Translator

  • Translator
  • 131 posts

Posted 04 January 2009 - 07:56 PM

its the format of the favorite xml that has changed since that script was written,
i'll have a quick look to see if i can make something out of it

#5 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 04 January 2009 - 08:07 PM

View Posten_dator, on Jan 4 2009, 08:56 PM, said:

its the format of the favorite xml that has changed since that script was written,
i'll have a quick look to see if i can make something out of it

This line is not good in BotledHate's code:
local s,e,favnick = string.find(line, "<User Nick=\"(.-)\"")

If u try it, change to this:
local s,e,favnick = string.find(line, "Nick=\"(.-)\"")

With this modification, it's reads out the names correctly, but without the "break", it's runs more than one times.

#6 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 11 January 2009 - 08:03 PM

There is version 0.3!

With a greatly rewrited code, there is the new wersion!

most important:
--- the script uses a Filter.txt file, witch contains the words what you do not want to see, and it's easly editable, just add a word in a new line to the file.

--- some other improovements on displaying why not allowed the pm. The script tells the first word witch they findes first. (or "too mutch line" if not finds any not wanted words but the pm is too long... )

--- the TXT file, and a FAQ is packed to the uploaded .rar file.

---------------
To do:

-Don't check FAV's
-From client add/remowe words to Filters.txt
-What you sad... :thumbsup:

----------------

Known isues:
-if too mutch pm's blocked (5-10+) at the same time, apexDC says "someone trying to use your client to spaming..." - it's Apex specific, because BCDC++ won't says that.
-some bots not ignored - Thats FIXED, I uploaded a new file

#7 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 16 January 2009 - 12:45 PM

I removed the old versions...

Next version will bee include a user interface witch will allow to add/remove words to the list + display the words from list, and an on/off switch.

I think about a new function, witch checks the pm text, and if the filter paste it's text to the hub, will not paste it anymore.

#8 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 19 February 2009 - 10:46 AM

There is version 0.4!

- improoved filtering (mutch less double filtering), now using UTF-8 character set when the source is not utf-8
- control interface
- now the script don't copy the spam contant to the hub's main chat, to prevenet Apex's client spamming detection.
- the script copy the spam content to a txt file in the scripts folder, and the file content is stored for the next start

contorl interface:
the "add" and the "remove" is not jet functional, but other thing works fine!

Attached Files

  • Attached File  dc1.jpg   39.32K   32 downloads
  • Attached File  dc2.jpg   21.14K   26 downloads


#9 Guest_Toast_*

  • Guest

Posted 19 February 2009 - 12:01 PM

Keep going doing a great job :)

#10 en_dator

    Swedish Translator

  • Translator
  • 131 posts

Posted 22 February 2009 - 11:58 PM

Yes, its looking very good :)

Think i'll keep an eye on this thread, looks like this will be very useful

#11 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 23 February 2009 - 01:26 PM

Thanks guys! :thumbsup:


My next task is, to prevent filtering Favorite users, this will be included in version 0.5 soon.
Is required function to make switchable this fucntion, or enough good, to leave the script out of consideration of Fav's PM's?

I will put the default settings to a file, witch will bee editable like spamwords. Maybe it will also included in version 0.5



Maybe ver 0.6 will contain the add/remove functions correctly to the spamwords and the settings list.

#12 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 24 February 2009 - 11:50 AM

Tehere is version 0.5!

bugfix: now the script will listen to /fav instead of \fav

new function:
- Favorites: If you add a user to the favorites list, the script will not block his PM's (works instantly, not required to restart the client when you add a user to favs)
- some default functions now reads from the filtersettings.txt file while client's start. (copytext function, filter function, long pm lines number)

#13 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 03 March 2009 - 04:54 PM

There is version 0.6!

New:
-working ignore: if you add somebody to the client's ignorelist (settings/advanced/misc), the filter will instantly reject his PM, no matter what was it's text. I do this function, because the current version of apex do not block the ignored user's PM's. (This function only for Apex, BCDC++ not contains ignore fnction (i know, there is an ignore script written in lua for bcdc, but it's not a native function)). On Apex, ignored nicks stored in the DCPlusPlus.xml file)

Improove:
- Now using UTF8 when check for fav or ignored nicks.
- Little simplier controling, now all /antispam command reduced to /as, like "/as wlist" instead off "/antispam wlist"

#14 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 12 March 2009 - 02:27 PM

There is Version 0.7!

New function:

Ignore by nick! If u don't want PM-s from somebody or a group, just write his nick, or some part of it's nick to a new Filternicks.txt file. This function is not equal with the ignore function witch introduced in ver 0.6, this function is usable to ignore all people, who's name contains unwanted things, like BOT


bugfix:
In HubPM event, no more error with the Favorites.xml file.

Attached Files

  • Attached File  dc.jpg   43.19K   23 downloads


#15 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 24 March 2009 - 11:39 AM

Now, there is version 0.8


new:
-the script is again compatible with BCDC++

fixed:

- better UTF8 and non UTF8 text and nick handling
- better usage of variabels in code
- some english text corrected

#16 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 26 March 2009 - 04:26 PM

There is version 0.9 with great new things! :)

NEW:
Fully working interface, you can monitorize the script, add words to lists... (pic1)
For now, the script log it's actions. (script create log file) (pic2)
For this time, only the lua file is required, at first run, it will create the other txt files with the default settings and words. - please DELETE previous versions old files!

Fix:
Lot's of utf8 - nonutf8 isues fixed. -> Now correct nick ignoring, and correct handling of "áéőőűóöóű" and sepcial characters.
Filtering is now more precise, because previous versions are not readed correctly the .txt files.

Posted Image

Posted Image

#17 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 09 April 2009 - 07:47 PM

Now we arrived to version 1.0 :whistling:

New:

-copytext function removed
-complettly rewritted code, script size reduced to 3/4
-now able, to search back blocked PM. Type "/as readspam 25" - this will display the 25 th spam's text

Posted Image

-line counting filter replaced with a character counting one, because line counting was not enough precise
-some protocol handling improvements
-mutch more information saved to spamsfile, like date, hub name and address, hub protcol

Bugfix: spamsfile now again correct store the áéőú... chars

*NOTE: delete old version's files

#18 VODOLEY

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 09 April 2009 - 09:25 PM

You are great work. Big thanks for good job. :whistling: I wait for the further updatings. :thumbsup:
Ð??изн?? ????о п??о??????ан????во ва??иан???ов, нам о????ае????? ???ол??ко на?Ð»Ð°Ð¶Ð´Ð°??????? ?Ð²Ð¾Ð±Ð¾Ð´Ð¾Ð¹ в??бо??а.
" " " " " " Posted Image " " " " " " "

#19 Patch

    Member

  • Member
  • PipPip
  • 47 posts

Posted 10 April 2009 - 07:23 AM

View PostVODOLEY, on Apr 9 2009, 11:25 PM, said:

You are great work. Big thanks for good job. :whistling: I wait for the further updatings. :thumbsup:

Thanks!

They will come, but i need ideas about what function needed te the script.

#20 Asterisk

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 12 April 2009 - 03:26 PM

I put antispam.lua (last version) in ..\Scripts folder, but nothing is happen when i write /anispam help for examle or /as. What`s wrong with... me ;) ?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users