Patch

Spam Filter in PM's

50 posts in this topic

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

post-785-1235040357_thumb.jpg

post-785-1235040364_thumb.jpg

Share this post


Link to post
Share on other sites

Yes, its looking very good :)

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
Share on other sites

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.

post-785-1236867904_thumb.jpg

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

17304390896.jpg

17305341711.jpg

Share this post


Link to post
Share on other sites

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

21482231114.jpg

-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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 ;) ?

Share this post


Link to post
Share on other sites

Now, there is version 1.1, witch fully compatible with Apex 1.2.0 stabel.

I made this "quick fix" of the sript, because when you newly install the new apex, Favorites.xml file is not present while you not add a hub or a user to the favlist. Now the script is detect that.

Script and "how-to" file uploaded!

Share this post


Link to post
Share on other sites

OMG, i uploaded again the version 1.1, because the file in the upper post blcoks the main in some situations. ( i leaved some testing lines in the script, witch i don't want... ;) )

good file:

Share this post


Link to post
Share on other sites

When i add line dofile( DC():GetAppPath() .. "scripts\\antispam.lua" ) at bottom of startup.lua ApexDC crash on startup ;) I don`t understand how it works (scripts i mean)

Share this post


Link to post
Share on other sites

When i add line dofile( DC():GetAppPath() .. "scripts\\antispam.lua" ) at bottom of startup.lua ApexDC crash on startup :D I don`t understand how it works (scripts i mean)

Currently if u enter some hub, it's crash with lua 2.0 errors. Most of the hubs it's works good, but some hub (or hubs) in your favorites currently made some error. Remove my script, uncheck your fav hubs, then add my script again, and you will see, witch hub is the easter egg.

We are still search the source of this problem. ;)

Share this post


Link to post
Share on other sites