Help wiht badfiles script
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Help wiht badfiles script

Started by TiMeTrAVelleR, 28 December, 2003, 22:52:47

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

TiMeTrAVelleR

script gives a message to user in main but nothing to ops  what is wrong here

-- vim:ts=4:sw=4:noet
-- FileChecker.lua, rewrite of a 'SearchKick' bot for PtokaX by ptaczek and
-- Leon (called The Illegalist)
-- version 1.0 for DCH++
-- by Sedulus 20030910, requested by BSOD2600
-- 20030919: 1.0
--
-- Translated back to PtokaX (OpiumVolage 9 Sept. 2003)
-- Added timer for automating search
--
-- (using more mem (3 tables, instead of one) but less cpu)
--
-- searches for all terms in the SearchFor table,
-- sends a message to the user that he/she shares the file, with the response
-- message.
-- set disconnectUser to 1 if you want the user disconnected as well (not
-- recommended, as bots always seem to find a way to misinterpret data ;) )
--
-- spaces in the SearchFor table will be converted to dollar's, but they will
-- (purposely) only match if there's a space in the result later.
-- so "a b" won't match "b a" or "aXXXb"

--// useful stuff
botName = "::??nt?`sC?p::"
disconnectUser = nil -- disconnect the user, nil = don't
-- opchatName = "nil" -- set opchat nick here if you want messages to opchat instead of mainchat, else nil
mb = 1024 * 1024
gb = 1024 * mb
-- Timer value, will send search for 1 of the file on all users at each timer
timerValue = 10*1000 -- Every 10 seconds (higher value will reduce load)
useTimer = 1 -- set to 1 to enable timer functions
counter = 1
--// do not modify this table, lookup the meanings in the $Search section in the protocol documentation
SearchTypes = {
   ANY = 1,
   AUDIO = 2,
   COMPRESSED = 3,
   DOCUMENT = 4,
   EXECUTABLE = 5,
   IMAGE = 6,
   VIDEO = 7,
   FOLDER = 8, -- do not use FOLDER's! the $SR's are formatted differently
}

st = SearchTypes
--// MODIFY THIS TABLE <-------
--      { searchType, words[, minimumSize[, regexMatch]] }
SearchFor = {
   ["Please don't share (pre)teen/incest/sick porn."] = {
      { st.IMAGE, "preteen" },
      { st.VIDEO, "preteen" },
      { st.IMAGE, "incest" },
      { st.VIDEO, "incest" },
      { st.IMAGE, "underage" },
      { st.VIDEO, "underage" },
                { st.IMAGE, "animal sex" },
                { st.VIDEO, "animal sex" },
                { st.VIDEO, "rape" },
   },
   ["Please don't share ANY installed application nor any UNZIPPED installer!"] = {
      { st.ANY, "explorer.scf" },
      { st.ANY, "explore.ex_" },
      { st.ANY, "cd_clint.dll" },
      { st.EXECUTABLE, "express msimn.exe", 0, "express\\msimn%.exe$" },
      { st.EXECUTABLE, "IEXPLORE.EXE" },
      { st.ANY, "bfdist.vlu" },
      { st.ANY, "War3Inst.log" },
      { st.ANY, "ut2003.log" },
      { st.EXECUTABLE, "NFSHP2.exe" },
      { st.ANY, "avp2.rez" },
      { st.ANY, "ntuser.dat" },
      { st.EXECUTABLE, "winword.exe" },
      { st.ANY, "sav", 0, "%.sav$" },
   },


   ["Do not share incomplete downloads!"] = {
      { st.ANY, "antifrag", 0, "antifrag$" },
      { st.ANY, "download dat", 0, "download[0-9]+%.dat$" },
                { st.ANY, "__INCOMPLETE__" },
                { st.ANY, "incomplete~" },
   },
   ["No, we don't allow uncompressed DVD's in here. Please remove all your VOB files."] = {
      { st.ANY, "VTS_01_1.VOB" },
   },
   ["Please do not share large WAV files."] = {
      { st.AUDIO, ".wav", 30*mb, "wav$" },
   },
   ["If you're sharing copies of your files to increase your share size, we are on to you."] = {
      { st.ANY, "copy of", 300*mb, "\\Copy of" },
      { st.ANY, "kopie van", 300*mb, "\\Kopie van" },
   },
--   ["Please do not share unzipped DVD's and/or other large files. Use rar-sets."] = {
--      { st.ANY, ".", 1*gb },
--   },
}

--// convert the tables
SearchTable = {}
ResultTable = {}

function Main()
   frmHub:EnableSearchData(1)
   botLen = strlen( botName )
   local i = 0 -- add the serial botnames in here as well.. so the user doesn't think he is flooded by one person
   for k,v in SearchFor do
      for _,search in v do
         -- add $Search
         local s = "$Search Hub:"..botName..i.." "
         if search[3] then
            s = s.."T?F?"..search[3]
         else
            s = s.."F?F?0"
         end
         s = s.."?"..search[1].."?"..gsub( search[2], " ", "$" ).."|"
         tinsert( SearchTable, s )
         -- add $SR match
         local idx = strlower( search[2] )
         ResultTable[idx] = { msg = k }
         if search[4] then ResultTable[idx].regex = strlower( search[4] ) end
         -- next..
         i = i + 1
      end
   end
   st, SearchTypes, SearchFor = nil, nil, nil

   -- set options
   if opchatName then
      messageFunc = SendToOps
   else
      messageFunc = SendPmToOps

   end
   if useTimer then SetTimer(timerValue) StartTimer() end
end

-- on new user
function NewUserConnected( client )
   foreachi(SearchTable, function(_, v) %client:SendData( v ) end)
end

-- on $SR
function DataArrival( client, line )
   local match = nil
   if strsub( line, 1, 4 ) == "$SR " then
      -- test if it was a result to us only
      local ret,c,to = strfind( line, "\005([^\005|]*)|$" )
      if ret and strsub( to, 1, botLen ) == botName then
         local ret,c,file,size = strfind( line, "^%$SR [^ ]+ ([^\005]*)\005([0-9]+) " )
         if ret then
            file = strlower( file )
            for k,v in ResultTable do
               if ( v.regex and strfind( file, v.regex ) ) or ( not v.regex and strfind( file, k, 1, 1 ) ) then
                  match = 1
--                  warn( client, file.." ("..dchpp.formatBytes( size ).." ("..size.."))", v.msg )
                  warn( client, file.." ("..size..")", v.msg )
               end
            end
         end
      end
   end
   -- disconnect user
   if match and disconnectUser and not client.bOperator then
      client:SendData( "<"..botName.."> You are being kicked!!! Complains--> Info@timetraveller.tk/" )
      client:Disconnect()
      return 1
   end
end

function warn( client, file, response )
   -- send message to user
   client:SendData( "<"..botName.."> This file is forbidden here---> "..file..": "..response )
   if client.bOperator then return end
   message = client.sName.." shares forbidden files---->  "..file
   -- send message to all Operators
        messageFunc = SendToOps
   message = client.sName.." shares forbidden files---->  "..file
end

function OnTimer()
   if SearchTable.n < 1 then return end
   SendToAll(SearchTable[counter])
   counter = counter + 1
   if counter > SearchTable.n then counter =1 end
end


hope you can help me   TiMe 8)

TiMeTrAVelleR


TiMeTrAVelleR


plop

2 sleepy @ the moment, help me remember 2 check it 2morrow.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

TiMeTrAVelleR

Thanks  Plop  will do  :D

*??G??*

Seems like a useful script......I believe I would also like to have it once the script is fixed.

+--**T?T?? X???m?**--+   @    titanxtreme.kicks-ass.net

[NL]trucker

hi time

as far as i can see youhave commented out the op message completly

-- opchatName = "nil" -- set opchat nick here if you want messages to opchat instead of mainchat, else nil

so i suggest you remove the [--] in front of that line and if i,m right it should work fin.

-- set options
if opchatName then
messageFunc = SendToOps
else
messageFunc = SendPmToOps

and if there is no opchatname no messages are send anyway.
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


Skippy

it is still not working :( if you take awa the  -- so....

plop

by making opchatName a comment you get the same result, nil.
changed it a tiny bit, and been anoying me all day.
i so hate these kind of scripts, but as you like it i have no trouble fixing it.

to the user:
<::??nt?`sC?p::> This file is forbidden here---> o:\nirvana\nirvana - rape me.mpg (30288692): Please don't share (pre)teen/incest/sick porn.

to the ops:
Private message from ::??nt?`sC?p::: <::??nt?`sC?p::> [TGA-VIP]plop is sharing this forbidden file ---> o:\nirvana\nirvana - rape me.mpg (30288692)

as you can see it works but not full proof.

-- Translated back to PtokaX (OpiumVolage 9 Sept. 2003)
-- Added timer for automating search
-- 
-- (using more mem (3 tables, instead of one) but less cpu)
-- 
-- searches for all terms in the SearchFor table,
-- sends a message to the user that he/she shares the file, with the response
-- message.
-- set disconnectUser to 1 if you want the user disconnected as well (not
-- recommended, as bots always seem to find a way to misinterpret data ;) )
-- 
-- spaces in the SearchFor table will be converted to dollar's, but they will
-- (purposely) only match if there's a space in the result later.
-- so "a b" won't match "b a" or "aXXXb"

--// useful stuff
botName = "::??nt?`sC?p::"
disconnectUser = nil -- disconnect the user, nil = don't
SendHow = 1 -- 1= pm 2 all the ops, 0 sends in mainchat

mb = 1024 * 1024
gb = 1024 * mb
-- Timer value, will send search for 1 of the file on all users at each timer
timerValue = 10*1000 -- Every 10 seconds (higher value will reduce load)
useTimer = 1 -- set to 1 to enable timer functions
counter = 1
--// do not modify this table, lookup the meanings in the $Search section in the protocol documentation
SearchTypes = {
ANY = 1,
AUDIO = 2,
COMPRESSED = 3,
DOCUMENT = 4,
EXECUTABLE = 5,
IMAGE = 6,
VIDEO = 7,
FOLDER = 8, -- do not use FOLDER's! the $SR's are formatted differently
}

st = SearchTypes
--// MODIFY THIS TABLE <-------
-- { searchType, words[, minimumSize[, regexMatch]] }
SearchFor = {
["Please don't share (pre)teen/incest/sick porn."] = {
{ st.IMAGE, "preteen" },
{ st.VIDEO, "preteen" },
{ st.IMAGE, "incest" },
{ st.VIDEO, "incest" },
{ st.IMAGE, "underage" },
{ st.VIDEO, "underage" },
{ st.IMAGE, "animal sex" },
{ st.VIDEO, "animal sex" },
{ st.VIDEO, "rape" },
},
["Please don't share ANY installed application nor any UNZIPPED installer!"] = {
{ st.ANY, "explorer.scf" },
{ st.ANY, "explore.ex_" },
{ st.ANY, "cd_clint.dll" },
{ st.EXECUTABLE, "express msimn.exe", 0, "express\\msimn%.exe$" },
{ st.EXECUTABLE, "IEXPLORE.EXE" },
{ st.ANY, "bfdist.vlu" },
{ st.ANY, "War3Inst.log" },
{ st.ANY, "ut2003.log" },
{ st.EXECUTABLE, "NFSHP2.exe" },
{ st.ANY, "avp2.rez" },
{ st.ANY, "ntuser.dat" },
{ st.EXECUTABLE, "winword.exe" },
{ st.ANY, "sav", 0, "%.sav$" },
},


["Do not share incomplete downloads!"] = {
{ st.ANY, "antifrag", 0, "antifrag$" },
{ st.ANY, "download dat", 0, "download[0-9]+%.dat$" },
{ st.ANY, "__INCOMPLETE__" },
{ st.ANY, "incomplete~" },
},
["No, we don't allow uncompressed DVD's in here. Please remove all your VOB files."] = {
{ st.ANY, "VTS_01_1.VOB" },
},
["Please do not share large WAV files."] = {
{ st.AUDIO, ".wav", 30*mb, "wav$" },
},
["If you're sharing copies of your files to increase your share size, we are on to you."] = {
{ st.ANY, "copy of", 300*mb, "\\Copy of" },
{ st.ANY, "kopie van", 300*mb, "\\Kopie van" },
},
-- ["Please do not share unzipped DVD's and/or other large files. Use rar-sets."] = {
-- { st.ANY, ".", 1*gb },
-- },
}

--// convert the tables
SearchTable = {}
ResultTable = {}

function Main()
   frmHub:EnableSearchData(1)
   botLen = strlen( botName )
   local i = 0 -- add the serial botnames in here as well.. so the user doesn't think he is flooded by one person
   for k,v in SearchFor do
      for _,search in v do
         -- add $Search
         local s = "$Search Hub:"..botName..i.." "
         if search[3] then
            s = s.."T?F?"..search[3]
         else
            s = s.."F?F?0"
         end
         s = s.."?"..search[1].."?"..gsub( search[2], " ", "$" ).."|"
         tinsert( SearchTable, s )
         -- add $SR match
         local idx = strlower( search[2] )
         ResultTable[idx] = { msg = k }
         if search[4] then ResultTable[idx].regex = strlower( search[4] ) end
         -- next..
         i = i + 1
      end
   end
   st, SearchTypes, SearchFor = nil, nil, nil
   if useTimer then SetTimer(timerValue) StartTimer() end
end

-- on new user
function NewUserConnected( client )
   foreachi(SearchTable, function(_, v) %client:SendData( v ) end)
end

-- on $SR
function DataArrival( client, line )
   local match = nil
   if strsub( line, 1, 4 ) == "$SR " then
      -- test if it was a result to us only
      local ret,c,to = strfind( line, "\005([^\005|]*)|$" )
      if ret and strsub( to, 1, botLen ) == botName then
         local ret,c,file,size = strfind( line, "^%$SR [^ ]+ ([^\005]*)\005([0-9]+) " )
         if ret then
            file = strlower( file )
            for k,v in ResultTable do
               if ( v.regex and strfind( file, v.regex ) ) or ( not v.regex and strfind( file, k, 1, 1 ) ) then
                  match = 1
                  -- warn( client, file.." ("..dchpp.formatBytes( size ).." ("..size.."))", v.msg )
                  warn( client, file.." ("..size..")", v.msg )
               end
            end
         end
      end
   end
   -- disconnect user
   if match and disconnectUser and not client.bOperator then
      client:SendData( "<"..botName.."> You are being kicked!!! Complains--> [EMAIL]Info@timetraveller.tk[/EMAIL]/" )
      client:Disconnect()
      return 1
   end
end

function warn( client, file, response )
   -- send message to user
   client:SendData( "<"..botName.."> This file is forbidden here---> "..file..": "..response )
   if client.bOperator then return end
   if SendHow == 0 then
      SendToOps(botName, client.sName.." is sharing this forbidden file ---> "..file.."|" )
   else
      SendPmToOps(botName, client.sName.." is sharing this forbidden file ---> "..file.."|" )
   end
end

function OnTimer()
   if SearchTable.n < 1 then return end
   SendToAll(SearchTable[counter])
   counter = counter + 1
   if counter > SearchTable.n then counter =1 end
end
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

[NL]trucker

skippy

as i said you had to remove the [--] in front of OPchatname and give it the name Opchat or equeal to the name you use for your Opchat so it wil look like this:

opchatName = "Opchat" -- set opchat nick here if you want messages to opchat instead of mainchat, else nil

then this part of the script should work also

-- set options
if opchatName then
messageFunc = SendToOps
else
messageFunc = SendPmToOps

cause if there is no opchat name there is no way the bot will use this part of the script


and thanks plop


as far i can see you have rewritten a lot of the script i hope it works fine for the rest i was just trying to give my thoughts and i hope i was right about it
so if you think i was wrong please give me a comment about it so the next time i can make another pass at this lua scripting as i said i,m still trying to figur this scripting out.
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


plop

they tryed some fancy tricks.

-- set options
if opchatName then ----- if this has a name
messageFunc = SendToOps --- then this is triggered
else --- if opchatName hasn't got a name
messageFunc = SendPmToOps  ---- then this is triggered

i stripped this from function Main and replaced the part in warn for a way witch is 100% by the rules.

if SendHow == 0 then -- if this = 0 then
SendToOps(botName, client.sName.." is sharing this forbidden file ---> "..file.."|" )-- this line is triggered
else -- otherwise
SendPmToOps(botName, client.sName.." is sharing this forbidden file ---> "..file.."|" )-- this line

the sending 2 the opchat is fully stripped but can be added easely again, and now with testdrive even without you typing the opchat name.

opchatName = frmHub:GetOpChatName()
but no need 2 declare that.
SendPmToNick(frmHub:GetOpChatName(), botName, client.sName.." is sharing this forbidden file ---> "..file.."|" )
should do it.

your on the right way trucker so if you don't mind, i'm gone leave it up 2 you 2 insert that sending 2 the opchat way 2 this script.
i know you can do it.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

TiMeTrAVelleR

Thanks very much plop and trucker   i was stuk whit this one  

TiMe :D

Whirlinurd

Hi, I have tried the filechecker script posted above. I have the ptokax td4 'opchat' bot running but it will not receive any messages send from the filechecker script. If this can be solved it will be appreciated alot.

Or another idea to register the filechecker bot and sending the pm messages there and that it only can be accessed by users with a operator and higher status. Not really needed that last request if it can be fixed/changed as it is now.

Thanks for anything that can be helped with.

WickeD

#13
What do I write here? Do I write the BotName or the OpChatName?:    local i = 0 -- add the serial botnames in here as well.. so the user doesn't think he is flooded by one person


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

And do this only send a massage to OP and not to SU+??

And do it not send a Warn massage in MainChat?

function warn( client, file, response )
   -- send message to user
   client:SendData( "<"..botName.."> This file is forbidden here---> "..file..": "..response )
   if client.bOperator then return end
   if SendHow == 0 then
      SendToOps(botName, client.sName.." is sharing this forbidden file ---> "..file.."|" )
   else
      SendPmToOps(botName, client.sName.." is sharing this forbidden file ---> "..file.."|" )



//WickeD

SMF spam blocked by CleanTalk