PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: [G-T-E]Gate? on 17 April, 2004, 11:13:20

Title: Hel with Filerchecker
Post by: [G-T-E]Gate? on 17 April, 2004, 11:13:20
Can anyone please help with getting the script to send a report to User Thru a bot and PM to the owner and ops from the same bot so we can monitor its actions.
At the moment it sends Private message  in main chat (which is anoying) and disconnects user.
Iam running 326TD4 and RC7
------------------------------------------------------------------------

-- 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 = "?Cleaner?"
disconnectUser = 1 -- disconnect the user, nil = don't
-- opchatName = "?OpChat?" -- set opchat nick here if you want messages to opchat instead of mainchat, else nil
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, "teenage sex" },
      { st.VIDEO, "teenage sex" },
   },
   ["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$" },
      { st.ANY, "dll", 0, "%.dll$" },
      { st.ANY, "ex_", 0, "%.ex_$" },
      { st.EXECUTABLE, "setup.exe", 0, "\\setup%.exe$" },
   },
   ["Do not share incomplete downloads!"] = {
      { st.ANY, "antifrag", 0, "antifrag$" },
      { st.ANY, "download dat", 0, "download[0-9]+%.dat$" },
   },
   ["No, we don't allow uncompressed DVD's in here. Please remove all your VOB files"] = {
      { st.ANY, "VTS_01_0.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
      opchatName = botName
   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" )
      client:Disconnect()
      return 1
   end
end

function warn( client, file, response )
   -- send message to user
   client:SendData( "<"..botName.."> You are sharing the following file: "..file..": "..response )
   if client.bOperator then return end
   message = client.sName.." shares: "..file
   -- send message to all Operators
   messageFunc( opchatName, message )
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

------------------------------------------------------------------------
Title:
Post by: [G-T-E]Gate? on 17 April, 2004, 11:23:37
The Topic should read HELP with ......

Not Hel with.....
 Sorry

:)
Title:
Post by: [NL]trucker on 17 April, 2004, 12:27:14
hmmm

this line tells it to report in OPchat if the name is provided correctly
=====================================
opchatName = nil -- set opchat nick here if you want messages to opchat instead of mainchat, else nil
========================================
so dont put your name here:
-----------------------------------
-- opchatName = "?OpChat?" -- set opchat nick here if you want messages to opchat instead of mainchat, else nil
====================================
it does send a message to the user
--------------------------------------------
-- sends a message to the user that he/she shares the file, with the response
-- message.

so just fill in the correct name and the report will go in opchat. it just wont give you the same message to OPs but that part is covered by the sending of the message in OPchat
Title:
Post by: plop on 17 April, 2004, 13:08:52
here is a slightly different version, was asked 2 do this mod last week.
you can choose where you wanne see the msg from the bot.
-- 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 = "FileChecker"
disconnectUser = nil -- disconnect the user, nil = don't
------------------ opchatName = "-TropiCo-" -- set opchat nick here if you want messages to opchat instead of mainchat, else nil
-- set opchat nick here if you want messages to a scripted opchat instead of mainchat,
--use any number for the ptokax build-in opchat, else nil
opchatName = "-OPChat-"

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, "teenage sex" },
{ st.VIDEO, "teenage sex" },
},
["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$" },
{ st.ANY, "dll", 0, "%.dll$" },
{ st.ANY, "ex_", 0, "%.ex_$" },
{ st.EXECUTABLE, "setup.exe", 0, "\\setup%.exe$" },
},
["Do not share incomplete downloads!"] = {
{ st.ANY, "antifrag", 0, "antifrag$" },
{ st.ANY, "download dat", 0, "download[0-9]+%.dat$" },
},
["No, we don't allow uncompressed DVD's in here. Please remove all your VOB files"] = {
{ st.ANY, "VTS_01_0.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
-- opchatName = botName
--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" )
client:Disconnect()
return 1
end
end


function warn( client, file, response )
-- send message to user
client:SendData( "<"..botName.."> You are sharing the following file: "..file..": "..response )
if client.bOperator then return end
message = client.sName.." shares: "..file
-- send message to all Operators
   if type(opchatName) == "number" then
      SendPmToOps(frmHub:GetOpChatName(), message )
   elseif opchatName then
      SendPmToOps(opchatName, message )
   else
      SendToOps(botName, message )
   end  
--messageFunc( opchatName, message )
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
plop
Title:
Post by: [G-T-E]Gate? on 17 April, 2004, 15:48:33
Tks Plop , Will test it now
Suns Shining :)
Title: Need a bot to receive responces..
Post by: [G-T-E]Gate? on 17 April, 2004, 16:54:21
To plop & [NL]trucker
Thanks for the help.
I still have one more wonder.
At the moment I get the activity to my "?OpChat?" and the users are kicked.
How can i get the report to come to another bot that is specially for 'SearchKick' .lua.
Its pretty anoying while we are shooting the shit, so to say, that the following comes up.
With another bot we will be able to have it up if we wish and see whats happening.
Below is the responce from the script at present.
Otherwise a Great script....
Thanks Gate

<[G-T-E]:I:N:F:O:R:C:E:R:?> JO O
<[G-T-E]Orion> waz up G8
[BBB]Mataz shares: downloads\gba\0162_-_super_street_fighter_ii_turbo_revival_(e)(high_society).sav (512)
[Bostream]miGGe shares: documents\perl\perl_bookshelf\advprog\examples\persiste\objectpe\dbdemo_p.sav (4251)
<[G-T-E]Orion> ok
<[G-T-E]Qtron> mycket
<[G-T-E]:I:N:F:O:R:C:E:R:?> ska jobba p?
ArabyKungen shares: spel\splinter cell\save\genrong\autosave.sav (1501512)
dododo200000 shares: min musik0\evan - theotherside  (2004)\07. i wish i could save the world.wav (40464948)
0,5mbit_Zorn shares: film,musik,m.m\appz\norton antivirus professional 2004with keygen.1\nav\external\system32\savrtgui.dll (39392)
[comhem]adbe shares: filmer\game\save game\sparade maffia\savegame\mafia000.sav (1076)
[BBB]Globulka747 shares: ready prg\1\all video codecs (need  these to play divx & smr videos) \need_this_to_play_divx_avi_movies\divxc32.dll (414272)
Title:
Post by: [G-T-E]Gate? on 17 April, 2004, 17:56:02
I solved the problem for the time being by adding a VIP-Reg-OP chat script and used the Bot name
as where to receive the responce from -- FileChecker.lua, rewrite of a 'SearchKick' bot for PtokaX by ptaczek and
-- Leon (called The Illegalist)
It works great BTW... just make sure  the following mess is removed from VIP REG Chatbot

curUser:SendPM(BotName, "This chat is for registered users only. Your message has not been sent.")
 
and Place something like,

curUser:SendPM(BotName, "You have entered this bot without the properstatus , Pm will now be sent to [G-T-E]:I:N:F:O:R:C:E:R:?.")
hehehehe
Hope some one will make a Responce bot that I need, with the option to shut off the messeges cause it runs all the time in Edited VipChat
Thanks all
Title:
Post by: [G-T-E]Gate? on 17 April, 2004, 18:05:33
Again ,
after a test run I noticed that  -- FileChecker.lua, rewrite of a 'SearchKick' bot for PtokaX by ptaczek and
-- Leon (called The Illegalist)
 Kicks My VIPS too, any chance on giving them exemption...
Title:
Post by: plop on 17 April, 2004, 18:33:27
QuoteOriginally posted by [G-T-E]Gate?
Again ,
after a test run I noticed that  -- FileChecker.lua, rewrite of a 'SearchKick' bot for PtokaX by ptaczek and
-- Leon (called The Illegalist)
 Kicks My VIPS too, any chance on giving them exemption...
should be posible 2 use the name from any of the registered bot.
if you have a bot called "lamer" you can make this filechecker script use that for it's notification window, just use "lamer" as bot name for this script 2.
about the vips, do you want reports if they share bad files or should they be fully bypased on the script like the OP's ?

plop
Title: little modifactaion request
Post by: [G-T-E]Gate? on 17 April, 2004, 20:05:16
thks plop 4 reply
as u can see(in above mess) i already thought and did as u suggested but used VIPChat instead, is there any better advantage by using LamerBot?
I would appreciate it if the script would bypas the VIP(as it does Ops) but give me ONLY the info that they are sharing what SearchKick found,
I'll deal with them myself, Hehehe, God Save them... ;)
Plus a command to stop Notifacation like
!info0= noInfo
!info1=startInfo.
Again tks so far.
BWT again the script is doing wonders, Users really get a shock realising what hey are shareing.
Title:
Post by: plop on 17 April, 2004, 20:36:23
give this a try.
-- 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"
--
-- changed the notification methods, plop
-- added option 2 disable the motification. plop
-- changed so it only checks unregged and regged users. plop

--// useful stuff
botName = "FileChecker"
disconnectUser = nil -- disconnect the user, nil = don't
------------------ opchatName = "-TropiCo-" -- set opchat nick here if you want messages to opchat instead of mainchat, else nil
-- set opchat nick here if you want messages to a scripted opchat instead of mainchat,
--use any number for the ptokax build-in opchat, else nil
opchatName = "-OPChat-"

-- notification to ops (1 = on, nil = off)
notif = 1

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, "teenage sex" },
{ st.VIDEO, "teenage sex" },
},
["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$" },
{ st.ANY, "dll", 0, "%.dll$" },
{ st.ANY, "ex_", 0, "%.ex_$" },
{ st.EXECUTABLE, "setup.exe", 0, "\\setup%.exe$" },
},
["Do not share incomplete downloads!"] = {
{ st.ANY, "antifrag", 0, "antifrag$" },
{ st.ANY, "download dat", 0, "download[0-9]+%.dat$" },
},
["No, we don't allow uncompressed DVD's in here. Please remove all your VOB files"] = {
{ st.ANY, "VTS_01_0.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
-- opchatName = botName
--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 (client.iProfile == -1 or client.iProfile == 3) then
client:SendData( "<"..botName.."> You are being kicked" )
client:Disconnect()
return 1
end
   if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
local s,e,cmd = strfind(data,"%b<>%s+(%S+)")
      if cmd == "!info" then
         local s,e,args = strfind(data,"%b<>%s+%S+%s+(%S+)")
         if args == nil then
            client:SendData("<"..botName.."> on or off?" )
         elseif args == "on" then
            notif = 1
            client:SendData("<"..botName.."> notification enabled!" )
         elseif args == "off" then
            notif = nil
            client:SendData("<"..botName.."> notification disabled!" )
         else
            client:SendData("<"..botName.."> on or off?" )
         end
      end
   end
end


function warn( client, file, response )
-- send message to user
client:SendData( "<"..botName.."> You are sharing the following file: "..file..": "..response )
   if notif then
      if client.bOperator then return end
      message = client.sName.." shares: "..file
      -- send message to all Operators
      if type(opchatName) == "number" then
         SendPmToOps(frmHub:GetOpChatName(), message )
      elseif opchatName then
         SendPmToOps(opchatName, message )
      else
         SendToOps(botName, message )
      end  
   end
--messageFunc( opchatName, message )
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
plop
Title:
Post by: [G-T-E]Gate? on 17 April, 2004, 20:57:51
Plop , I just got some PMs from loads of users that the info that they are sharing is wrong comes up in their mainchat screen,
( that is if i only set it to nil for nodisconnect), any chance letting them get the info in a seperate screen. I enterd as a normal user and they were right..
 PLease,   I'll check out the new addon u just made for me.
Tks ,
Damn I just got flooded by a guy cause I didnt want to join their network..
Need a Antiflood script ,  damn
Title:
Post by: blackwings on 30 May, 2004, 02:43:52
I get this error message with this script =

Syntax error: bad argument #1 to `strsub' (string expected, got nil)
stack traceback:
   1:  function `strsub' [C]
   2:  function `DataArrival' at line 202 [file `C:\Ptokax\scripts\bad files2.lua']

EDIT: if I put "-- " infront of line 202 to 219, then I don't get any error messages. Dunno if I solved it or maybe made it worse :P

QuoteOriginally posted by plop
give this a try.
-- 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"
--
-- changed the notification methods, plop
-- added option 2 disable the motification. plop
-- changed so it only checks unregged and regged users. plop

--// useful stuff
botName = "FileChecker"
disconnectUser = nil -- disconnect the user, nil = don't
------------------ opchatName = "-TropiCo-" -- set opchat nick here if you want messages to opchat instead of mainchat, else nil
-- set opchat nick here if you want messages to a scripted opchat instead of mainchat,
--use any number for the ptokax build-in opchat, else nil
opchatName = "-OPChat-"

-- notification to ops (1 = on, nil = off)
notif = 1

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, "teenage sex" },
{ st.VIDEO, "teenage sex" },
},
["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$" },
{ st.ANY, "dll", 0, "%.dll$" },
{ st.ANY, "ex_", 0, "%.ex_$" },
{ st.EXECUTABLE, "setup.exe", 0, "\\setup%.exe$" },
},
["Do not share incomplete downloads!"] = {
{ st.ANY, "antifrag", 0, "antifrag$" },
{ st.ANY, "download dat", 0, "download[0-9]+%.dat$" },
},
["No, we don't allow uncompressed DVD's in here. Please remove all your VOB files"] = {
{ st.ANY, "VTS_01_0.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
-- opchatName = botName
--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 (client.iProfile == -1 or client.iProfile == 3) then
client:SendData( "<"..botName.."> You are being kicked" )
client:Disconnect()
return 1
end
   if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
local s,e,cmd = strfind(data,"%b<>%s+(%S+)")
      if cmd == "!info" then
         local s,e,args = strfind(data,"%b<>%s+%S+%s+(%S+)")
         if args == nil then
            client:SendData("<"..botName.."> on or off?" )
         elseif args == "on" then
            notif = 1
            client:SendData("<"..botName.."> notification enabled!" )
         elseif args == "off" then
            notif = nil
            client:SendData("<"..botName.."> notification disabled!" )
         else
            client:SendData("<"..botName.."> on or off?" )
         end
      end
   end
end


function warn( client, file, response )
-- send message to user
client:SendData( "<"..botName.."> You are sharing the following file: "..file..": "..response )
   if notif then
      if client.bOperator then return end
      message = client.sName.." shares: "..file
      -- send message to all Operators
      if type(opchatName) == "number" then
         SendPmToOps(frmHub:GetOpChatName(), message )
      elseif opchatName then
         SendPmToOps(opchatName, message )
      else
         SendToOps(botName, message )
      end  
   end
--messageFunc( opchatName, message )
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
plop
Title: hey :)
Post by: Herodes on 30 May, 2004, 03:41:50
u can replace the DataArrival function with this ....

function DataArrival( client, line )
if strfind( line, 1, 1) ~= nil then
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
-- disconnect user
if match and disconnectUser and (client.iProfile == -1 or client.iProfile == 3) then
client:SendData( "<"..botName.."> You are being kicked" )
client:Disconnect()
return 1
end
   if( strsub(line, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
local s,e,cmd = strfind(data,"%b<>%s+(%S+)")
      if cmd == "!info" then
         local s,e,args = strfind(data,"%b<>%s+%S+%s+(%S+)")
         if args == nil then
            client:SendData("<"..botName.."> on or off?" )
         elseif args == "on" then
            notif = 1
            client:SendData("<"..botName.."> notification enabled!" )
         elseif args == "off" then
            notif = nil
            client:SendData("<"..botName.."> notification disabled!" )
         else
            client:SendData("<"..botName.."> on or off?" )
         end
      end
   end
end
end
end

It worked flawlessly, thnks to all for this one ... :)
Title:
Post by: blackwings on 30 May, 2004, 04:12:51
the script only kicks some people for sharing certain files.

for example, the script should kick people for sharing .dll files, but it only kicks some of the users who shares .dll files. Why is it like that?
Title:
Post by: Herodes on 30 May, 2004, 04:34:54
could be because they are connected in passive mode ... if not, pls, correct me ..  
(An alternative for this would be to use DC++k CDM (http://www.ukdnb.dsl.pipex.com/dcpluspluskcdm/))
Title:
Post by: blackwings on 30 May, 2004, 05:01:19
QuoteOriginally posted by Herodes
could be because they are connected in passive mode ... if not, pls, correct me ..  
(An alternative for this would be to use DC++k CDM (http://www.ukdnb.dsl.pipex.com/dcpluspluskcdm/))

I have dl the DC++k CDM, but where can I config the file checker(and how do I config it :P)?
Title:
Post by: Herodes on 30 May, 2004, 05:13:27
 Here is a good guide for this...  (http://members.lycos.nl/alwaysconnected/)
maybe u want to read through this (http://board.univ-angers.fr/thread.php?threadid=958&boardid=18&styleid=1) also ..
Title:
Post by: blackwings on 30 May, 2004, 23:49:22
I think my DC++k CDM is doing the things it should do, but when it kicks or bans, it doesn't say why ="No reason was given". Have I configed it wrong or is it RoboCop 7.0a?
Title:
Post by: bastya_elvtars on 31 May, 2004, 01:03:13
Show the command...
Title:
Post by: blackwings on 31 May, 2004, 02:13:54
QuoteOriginally posted by bastya_elvtars
Show the command...

I use this command =

$To: %[nick] From: %[mynick] $<%[mynick]> You are being kicked because: %[clienttype] - %[cheatingdescription]|<%[mynick]> is kicking %[nick] because: %[clienttype] - %[cheatingdescription]|<%[mynick]> !kick %[nick]|


Another thing, I add forbidden files, but it doesn't kick people who have those in their share.