PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: plop on 21 December, 2003, 20:56:27

Title: sneaky anti advertising
Post by: plop on 21 December, 2003, 20:56:27
makes spammers work for you.
instead of stopping the advert it replaces the url for you own  hub/website url(s).
-- sneaky anti advertising bot by plop
-- it replaces the url's users post for your own.   lol
-- let them work for you, instead of against you
-- thx again for the hints from rabidwombat


WEBSITE = "http://www.dcvikings.com/~goldenangel/"
HUBADRESS ="goldenangel.no-ip.org"

OKSITES = { ["www.plop.nl"] = 1, ["www.dcvikings.com"] = 1 }

OKHUBS = { ["tga-darkstar.no-ip.com"] = 1, ["goldenangel.no-ip.org"] = 1, ["tga-norge.2waky.com"] = 1}

function DataArrival(user, data)
   if user.iProfile == -1 or user.iProfile == 3 then
      if (strsub(data, 1, 1) == "<") then
      --if not(strsub(data, 1, 4) == "$To:") then
         data = strsub(data, 1, (strlen(data)-1))
         local s,e,msg,webadver,msg2 = strfind(data, "%b<>%s(.*)http://([^%.]+%.[^%.]+%.%S+)(.*)$")
         if webadver ~= nil then
            local s,e,webby = strfind(webadver, "(%S+%.[^%.]+%.%a+)/.*")
            if webby == nil then webby = webadver end
            if OKSITES[webby] == nil then
               SendToAll(user.sName, msg..WEBSITE..msg2)
               return 1
            end
         else
            local s,e,msg,webadver,msg2 = strfind(data, "%b<>%s(.*)(www+%.[^%.]+%.%S+)(.*)$")
            if webadver ~= nil then
               local s,e,webby = strfind(webadver, "(%S+%.[^%.]+%.%a+)/.*")
               if webby == nil then webby = webadver end
               if OKSITES[webby] == nil then
                  SendToAll(user.sName, msg..WEBSITE..msg2)
                  return 1
               end
            else
               local s,e, adver = strfind(data, "%b<>%s(%S+%.[^%.]+%.[^%.]+)")
               if adver ~= nil then
                  local s,e,hubby = strfind(adver, "(%S+%.[^%.]+%.%a+)/.*")
                  if hubby == nil then hubby = adver end
                  if OKHUBS[hubby] == nil then
                     SendToAll(user.sName, HUBADRESS)
                     return 1
                  end
               else
                  local s,e,msg,adver,msg2 = strfind(data, "%b<>%s(.*)%s([^%.]+%.[^%.]+%.%S+)(.*)$")
                  if adver ~= nil then
                     local s,e,hubby = strfind(adver, "(%S+%.[^%.]+%.%a+)/.*")
                     if hubby == nil then hubby = adver end
                     if OKHUBS[hubby] == nil then
                        SendToAll(user.sName, msg.." "..HUBADRESS..msg2)
                        return 1
                     end
                  end
               end
            end
         end
      else
         --local s,e,to,text = strfind(data, "%$To: (%S+) From: %S %$(.+)$")
                            local s,e,to,text = strfind(data,    "%$To:%s(%S+)%sFrom:%s%S+%s$(.*)$")
         if(to == nil) then return 0 end
         to = GetItemByName(to)
         if to.iProfile == -1 or to.iProfile == 3 then
            text = strsub(text, 1, (strlen(text)-1))
            local s,e,msg,webadver,msg2 = strfind(text, "%b<>%s(.*)http://([^%.]+%.[^%.]+%.%S+)(.*)$")
            if webadver ~= nil then
               local s,e,webby = strfind(webadver, "(%S+%.[^%.]+%.%a+)/.*")
               if webby == nil then webby = webadver end
               if OKSITES[webby] == nil then
                  SendPmToNick(to.sName, user.sName, msg..WEBSITE..msg2)
                  return 1
               end
            else
               local s,e,msg,webadver,msg2 = strfind(text, "%b<>%s(.*)(www+%.[^%.]+%.%S+)(.*)$")
               if webadver ~= nil then
                  local s,e,webby = strfind(webadver, "(%S+%.[^%.]+%.%a+)/.*")
                  if webby == nil then webby = webadver end
                  if OKSITES[webby] == nil then
                     SendPmToNick(to.sName, user.sName, msg..WEBSITE..msg2)
                     return 1
                  end
               else
                  local s,e, adver = strfind(text, "%b<>%s(%S+%.[^%.]+%.[^%.]+)")
                  if adver ~= nil then
                     local s,e,hubby = strfind(adver, "(%S+%.[^%.]+%.%a+)/.*")
                     if hubby == nil then hubby = adver end
                     if OKHUBS[hubby] == nil then
                        SendPmToNick(to.sName, user.sName, HUBADRESS)
                        return 1
                     end
                  else
                     local s,e,msg,adver,msg2 = strfind(text, "%b<>%s(.*)%s([^%.]+%.[^%.]+%.%S+)(.*)$")
                     if adver ~= nil then
                        local s,e,hubby = strfind(adver, "(%S+%.[^%.]+%.%a+)/.*")
                        if hubby == nil then hubby = adver end
                        if OKHUBS[hubby] == nil then
                           SendPmToNick(to.sName, user.sName, msg.." "..HUBADRESS..msg2)
                           return 1
                        end
                     end
                  end
               end
            end
         end
      end
   end
end
plop
Title:
Post by: Cyberia on 21 December, 2003, 20:59:07
haha, this is a good one.
lol
nice trick
Title:
Post by: acethecase on 21 December, 2003, 22:22:22
hehe nice one!!  :]  :D
Title:
Post by: BlazeXxX on 22 December, 2003, 08:09:31
Good one indeed! Plop, is it possible to make something lot effective like lucifier script?

That checks even if they advertise like h t t p : / /
or
H
t
t
p
:
/
/

I think its possible cuz opiumvolage did it! It will be cool , if u cud implement or modify that to replace the adverts to work for us? if its too hard and time consuming, its ok leave it..
Title:
Post by: plop on 22 December, 2003, 11:47:32
QuoteOriginally posted by BlazeXxX
Good one indeed! Plop, is it possible to make something lot effective like lucifier script?

That checks even if they advertise like h t t p : / /
or
H
t
t
p
:
/
/

I think its possible cuz opiumvolage did it! It will be cool , if u cud implement or modify that to replace the adverts to work for us? if its too hard and time consuming, its ok leave it..
both are posible 2 add but got some other things 2 do 1st.
the whole script can be optimized and work even better.
the last 1 btw can take a bit of power/memory.

plop
Title:
Post by: Pedro on 22 January, 2004, 12:51:07
any chance of getting this script for hub addys only, I have no need for //http:// restriction..

Thanx in advance


HAPPY DAYS
Title:
Post by: Smulf on 22 January, 2004, 21:31:03
Good one plop... thanks:)
Title:
Post by: plop on 22 January, 2004, 23:14:08
QuoteOriginally posted by Pedro
any chance of getting this script for hub addys only, I have no need for //http:// restriction..

Thanx in advance


HAPPY DAYS
not easy, that part in the script is actualy a bypase so it replaces them with your website instead of the hub url.
but soon gone update this script and gone try if i can solve it then.

plop
Title:
Post by: Pedro on 23 January, 2004, 05:08:55
thanx m8..


HAPPY DAYS
Title:
Post by: NightLitch on 28 January, 2004, 21:15:05
I find this bot doing and NOT doing it's job Plop.

when entering a speciall menings(lines) that are not even close
to advertising it reacts... this is a fix I would want. cause using it.

for ex: I posted a DC++ TAG in your hub and guess what...

Half the Tag was "censored" with your hub address...

otherwise I like this one better than Lucifer becouse of
the "bug" in Lucifer...

something to work on plop. :-)
Title:
Post by: plop on 28 January, 2004, 23:29:39
QuoteOriginally posted by NightLitch
I find this bot doing and NOT doing it's job Plop.

when entering a speciall menings(lines) that are not even close
to advertising it reacts... this is a fix I would want. cause using it.

for ex: I posted a DC++ TAG in your hub and guess what...

Half the Tag was "censored" with your hub address...

otherwise I like this one better than Lucifer becouse of
the "bug" in Lucifer...

something to work on plop. :-)
yep i seen it.
it responds 2 everything with enough dot's in it, even filenames can be filtered.
definatly time for a update.

plop
Title:
Post by: Pedro on 24 February, 2004, 01:44:29
Hey Plop,

Dont want to rush you, I know you got other projects BUT !!!

Any updates yet, I love this script but as you say if enough .......... in text then replaced with hub addy, I got users going daft and I am sitting back laffing at it.

Would be nice to get those other fixes  h u b . n o - i p . c o m , I got caught with that the other day..

Waiting patiently

HAPPY DAYS
Title:
Post by: Masta_Kein on 28 February, 2004, 18:52:09
HI Plop!!

Whats so sneaky about this anti pub???
Title:
Post by: NightLitch on 28 February, 2004, 18:54:25
QuoteMasta_Kein
   
HI Plop!!

Whats so sneaky about this anti pub???

Is change the advertising to your own address, hub.

The users work for you, not against you. :-)

/NL
Title:
Post by: Masta_Kein on 28 February, 2004, 18:58:48
Thks
Nice one!!
Title:
Post by: kazi on 07 March, 2004, 16:31:35
it gets me errors :(

Syntax Error: function arguments expected;
  last token read: `=' at line 8 in string "code:----------------------------------------------------------..."


i am using version 0.3.2.6 testdrive4

anyon knows how i can solve this?
Title:
Post by: plop on 07 March, 2004, 21:43:52
QuoteOriginally posted by kazi
it gets me errors :(

Syntax Error: function arguments expected;
  last token read: `=' at line 8 in string "code:----------------------------------------------------------..."


i am using version 0.3.2.6 testdrive4

anyon knows how i can solve this?
seems 2 me you copyed 2 bit 2 much.
try it again but make sure you copy everything between the ---------------------------------------------------------------------- lines.

about the updates.
haven't done anything the last 2 weeks as my g/f was here.
now i'm a bit busy as i kinda managed 2 kill my laptop, and have a bunch of scripts 2 make for bcdc++.
so patients pls.

plop