PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: VERMiN on 16 November, 2003, 11:34:19

Title: How to find unwanted files, always.
Post by: VERMiN on 16 November, 2003, 11:34:19
I', still on the lookout for a great script which detect unwanted files. LatinMusic was kind enough to provide me with this fine script.

The only problem is that it doesn't always discover a "badshare".
I have several machines connected to my testhub, and all of them have c:\windows and c:\program shared
but the script will only detect badshares from time to time. Can this script be altered to be more accurate and
trusted?
- Also if somebody can tell me how to move out the defined "bad files" to an external file instead. This will make it a lot easier to add files to the for example UnWanted.txt file-list.


-- BadFilesDetecter V: 1.0 by [ES]latinmusic. Date: 05/11/2003
-- Base on Illegalist by Ptaczek, Jan-3, 2003
-- Searches for specified patterns. Useful for illegal share checking
-- Modificed by Leo (for music hub)
-- Modified by nErBoS
-- Operators are now checked as normal users
-- Some extensions added
-- All known bugs fixed by ----------->>> OpiumVolage
 
BotName = "![BadFilesDetecter]!?"
MessageToSend = " are not allowed in this hub."
time = 3 --Value in minutes
Files = {
[".dll"]="No .dll files in this hub, you have been banned for "..time.." minutes.",
[".sys"]="No .sys files in this hub, you have been banned for "..time.." minutes.",
[".ini"]="No .ini files in this hub, you have been banned for "..time.." minutes.",
[".php"]="No .php files in this hub, you have been banned for "..time.." minutes.",
[".hlp"]="No .hlp files in this hub, you have been banned for "..time.." minutes.",
[".lnk"]="No .lnk files in this hub, you have been banned for "..time.." minutes.",
[".cue"]="No .cue files in this hub, you have been banned for "..time.." minutes.",
[".pkg"]="No .pkg files in this hub, you have been banned for "..time.." minutes.",
[".lib"]="No .lib files in this hub, you have been banned for "..time.." minutes.",
[".ins"]="No .ins files in this hub, you have been banned for "..time.." minutes.",
[".cmd"]="No .cmd files in this hub, you have been banned for "..time.." minutes.",
[".bat"]="No .bat files in this hub, you have been banned for "..time.." minutes.",
[".cod"]="No .cod files in this hub, you have been banned for "..time.." minutes.",
[".cox"]="No .cox files in this hub, you have been banned for "..time.." minutes.",
[".loc"]="No .loc files in this hub, you have been banned for "..time.." minutes.",
[".cnt"]="No .cnt files in this hub, you have been banned for "..time.." minutes.",
[".vxd"]="No .vxd files in this hub, you have been banned for "..time.." minutes.",
[".vga"]="No .vga files in this hub, you have been banned for "..time.." minutes.",
[".stb"]="No .stb files in this hub, you have been banned for "..time.." minutes.",
[".chp"]="No .chp files in this hub, you have been banned for "..time.." minutes.",
[".nrg"]="No .nrg files in this hub, you have been banned for "..time.." minutes.",
[".iso"]="No .iso files in this hub, you have been banned for "..time.." minutes.",
[".vob"]="No .vob files in this hub, you have been banned for "..time.." minutes.",
[".pas"]="No .pas files in this hub, you have been banned for "..time.." minutes.",
[".vcf"]="No .vcf files in this hub, you have been banned for "..time.." minutes.",
[".dfm"]="No .dfm files in this hub, you have been banned for "..time.." minutes.",
[".res"]="No .res files in this hub, you have been banned for "..time.." minutes.",
[".reg"]="No .reg files in this hub, you have been banned for "..time.." minutes.",
[".vdi"]="No .vdi files in this hub, you have been banned for "..time.." minutes.",
[".map"]="No .map files in this hub, you have been banned for "..time.." minutes.",
[".scr"]="No .scr files in this hub, you have been banned for "..time.." minutes.",
[".diz"]="No .diz files in this hub, you have been banned for "..time.." minutes.",
[".lst"]="No .lst files in this hub, you have been banned for "..time.." minutes.",
[".pdf"]="No .pdf files in this hub, you have been banned for "..time.." minutes."
}
function NewUserConnected(curUser)
   frmHub:EnableSearchData(1)
   for i,v in Files do
   curUser:SendData("$Search Hub:"..BotName..random(1, 100) .." F?F?0?1?"..i)
   end
end
function OpConnected(curUser)
   frmHub:EnableSearchData(1)
   for i,v in Files do
      curUser:SendData("$Search Hub:"..BotName..random(1, 100) .." F?F?0?1?"..i)
   end
end
function DataArrival(curUser, data)
   if( strsub(data, 1, 3) == "$SR" ) then
      _,_,nick = strfind( data, "\05(%S*)|$" )
      local s = 5 + strlen(curUser.sName)
      local e = strfind(data, "%d+%s%d+/%d+") - 2
      local path = strsub(data, s, e)
      local s = 5 + strlen(curUser.sName)
      Reason = FindWhat(curUser,data)
      if (Reason == "Other files") then return end
      curUser:SendData(BotName, "Disconnecting.....")
      curUser:SendData(BotName, "Reason: "..Reason)
      curUser:SendData(BotName, "Path: "..path.. ".")
      curUser:Disconnect()
      curUser:TimeBan(time) --This line tempban a user for an specific amount of time in minutes, to incree/decrease the time change the value in variable 'time'
--      curUser:TempBan() --This line tempban a user for an specific amount of time pre-setted inside ptokax advanced settings, to make it work, uncomment this line and comment the line above
   end
end
function FindWhat(curUser,data)
   for i,v in Files do
      if (strfind(strlower(data), "%"..i.."\005")) then
         return v
      end
   end
   return "Other files"
end
Title:
Post by: Tuben on 16 November, 2003, 12:28:19
What i now is that it only checks Active users not Passive..

Soo i think that it is nothing we can do about it.
Title:
Post by: [=robbase=] on 27 December, 2003, 00:26:38
So how can it check passive users - anyone?
Title:
Post by: toolmanwill on 27 December, 2003, 02:10:25
this is exactally what i needed for my lossless only hub!!! if someone could tell me how to stop it from checking ops and maybe vips also, that would be awesome!!

Will
Title:
Post by: plop on 27 December, 2003, 16:16:17
port 413 udp has 2 be opend, with that ptokax TD can search pasive users.
but scripts like these search like crazy and that causes trouble.
on shares around 200GB (maby more or less) it causes a search spam, and dc++ ignores everything when that happens.
maby it would be a better idea 2 search for 1 thing every minute, then the search spam should be solved.

toolmanwill this 1 is for you.
-- BadFilesDetecter V: 1.0 by [ES]latinmusic. Date: 05/11/2003
-- Base on Illegalist by Ptaczek, Jan-3, 2003
-- Searches for specified patterns. Useful for illegal share checking
-- Modificed by Leo (for music hub)
-- Modified by nErBoS
-- Operators are now checked as normal users
-- Some extensions added
-- All known bugs fixed by ----------->>> OpiumVolage

BotName = "![BadFilesDetecter]!?"
MessageToSend = " are not allowed in this hub."
time = 3 --Value in minutes
Files = {
[".dll"]="No .dll files in this hub, you have been banned for "..time.." minutes.",
[".sys"]="No .sys files in this hub, you have been banned for "..time.." minutes.",
[".ini"]="No .ini files in this hub, you have been banned for "..time.." minutes.",
[".php"]="No .php files in this hub, you have been banned for "..time.." minutes.",
[".hlp"]="No .hlp files in this hub, you have been banned for "..time.." minutes.",
[".lnk"]="No .lnk files in this hub, you have been banned for "..time.." minutes.",
[".cue"]="No .cue files in this hub, you have been banned for "..time.." minutes.",
[".pkg"]="No .pkg files in this hub, you have been banned for "..time.." minutes.",
[".lib"]="No .lib files in this hub, you have been banned for "..time.." minutes.",
[".ins"]="No .ins files in this hub, you have been banned for "..time.." minutes.",
[".cmd"]="No .cmd files in this hub, you have been banned for "..time.." minutes.",
[".bat"]="No .bat files in this hub, you have been banned for "..time.." minutes.",
[".cod"]="No .cod files in this hub, you have been banned for "..time.." minutes.",
[".cox"]="No .cox files in this hub, you have been banned for "..time.." minutes.",
[".loc"]="No .loc files in this hub, you have been banned for "..time.." minutes.",
[".cnt"]="No .cnt files in this hub, you have been banned for "..time.." minutes.",
[".vxd"]="No .vxd files in this hub, you have been banned for "..time.." minutes.",
[".vga"]="No .vga files in this hub, you have been banned for "..time.." minutes.",
[".stb"]="No .stb files in this hub, you have been banned for "..time.." minutes.",
[".chp"]="No .chp files in this hub, you have been banned for "..time.." minutes.",
[".nrg"]="No .nrg files in this hub, you have been banned for "..time.." minutes.",
[".iso"]="No .iso files in this hub, you have been banned for "..time.." minutes.",
[".vob"]="No .vob files in this hub, you have been banned for "..time.." minutes.",
[".pas"]="No .pas files in this hub, you have been banned for "..time.." minutes.",
[".vcf"]="No .vcf files in this hub, you have been banned for "..time.." minutes.",
[".dfm"]="No .dfm files in this hub, you have been banned for "..time.." minutes.",
[".res"]="No .res files in this hub, you have been banned for "..time.." minutes.",
[".reg"]="No .reg files in this hub, you have been banned for "..time.." minutes.",
[".vdi"]="No .vdi files in this hub, you have been banned for "..time.." minutes.",
[".map"]="No .map files in this hub, you have been banned for "..time.." minutes.",
[".scr"]="No .scr files in this hub, you have been banned for "..time.." minutes.",
[".diz"]="No .diz files in this hub, you have been banned for "..time.." minutes.",
[".lst"]="No .lst files in this hub, you have been banned for "..time.." minutes.",
[".pdf"]="No .pdf files in this hub, you have been banned for "..time.." minutes."
}
function NewUserConnected(curUser)
   if curUser.iProfile ~= 2 then
      frmHub:EnableSearchData(1)
      for i,v in Files do
         curUser:SendData("$Search Hub:"..BotName..random(1, 100) .." F?F?0?1?"..i)
      end
   end
end

function DataArrival(curUser, data)
   if curUser.iProfile == 3 or curUser.iProfile == -1 then
      if( strsub(data, 1, 3) == "$SR" ) then
         _,_,nick = strfind( data, "\05(%S*)|$" )
         local s = 5 + strlen(curUser.sName)
         local e = strfind(data, "%d+%s%d+/%d+") - 2
         local path = strsub(data, s, e)
         local s = 5 + strlen(curUser.sName)
         Reason = FindWhat(curUser,data)
         if (Reason == "Other files") then return end
         curUser:SendData(BotName, "Disconnecting.....")
         curUser:SendData(BotName, "Reason: "..Reason)
         curUser:SendData(BotName, "Path: "..path.. ".")
         curUser:Disconnect()
         curUser:TimeBan(time) --This line tempban a user for an specific amount of time in minutes, to incree/decrease the time change the value in variable 'time'
         -- curUser:TempBan() --This line tempban a user for an specific amount of time pre-setted inside ptokax advanced settings, to make it work, uncomment this line and comment the line above
      end
   end
end

function FindWhat(curUser,data)
   for i,v in Files do
      if (strfind(strlower(data), "%"..i.."\005")) then
         return v
      end
   end
   return "Other files"
end
plop
Title:
Post by: [=robbase=] on 27 December, 2003, 22:45:11
Ok im new (can u tell?)

How do I open port 413?
Title:
Post by: toolmanwill on 27 December, 2003, 23:53:00
thanx plop, u da man!!  :)