*** Advanced BadFile Search - Page 2
 

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

*** Advanced BadFile Search

Started by NightLitch, 04 March, 2005, 12:43:32

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Leun

Here is a little help, only not tested

---------------------------------------------------------------------------------------------------
-- Advanced BadFile Active Search // Stripped from Thor 6
-- By: NightLitch 2005-03-04
---------------------------------------------------------------------------------------------------
--BanTime
sBanTime = 60

tBadFiles = {

	{"explorer.scf" , "NO sharing of installed / packed programs or games","Warn"},
	{".temp.mp3" , "NO sharing of incomplete downloads","Warn"},
	{"_INCOMPLETE_" , "NO sharing of incomplete downloads","Warn"},
	{"download123456789.dat" , "NO sharing of incomplete downloads","Warn"},
	{"part.met" , "NO sharing of incomplete downloads","Warn"},
	{".getright" , "NO sharing of incomplete downloads","Warn"},
	{"autorun.inf" , "NO sharing of installed / packed programs or games","Ban"},
	{"DCPlusPlus.exe" , "NO sharing of installed / packed programs or games","Ban"},
	{"valve.avi" , "NO sharing of installed / packed programs or games","Ban"},
	{"virscan .dat" , "NO sharing of installed / packed programs or games","Ban"},
	{"Netlimiter" , "NO sharing of installed / packed programs or games","Ban"},

}
---------------------------------------------------------------------------------------------------
--// Don't Edit below this point if you don't now what you are doing
---------------------------------------------------------------------------------------------------

tTimer = {}

function Main()
	RegTimer(SearchForBadFiles, 20 * 1000, "ActiveBadFileSearch")  -- Active Search Each 20 Sec
	SetTimer(1000)
	StartTimer()
end

function OnTimer()
	for i=1,table.getn(tTimer) do
		tTimer[i][3] = tTimer[i][3] + 1
		if tTimer[i][3] > tTimer[i][2] then
			tTimer[i][3]=1
			tTimer[i][1]()
		end
	end
end

function SRArrival(sUser,sData)
	local _,_,From,Path,FileSize,FreeSlots,TotalSlots,Who = string.find(sData, "^%$SR%s+(%S+)%s+(.*)(%d+)%s+(%d+)%/(%d+).*(%S+)%|$")
	if tCall["BadFileSearch"] then pcall(tCall["BadFileSearch"],sUser,Path,Who,FileSize) end
end

tCall = {}
tCall["BadFileSearch"] = function(sUser,Path,Who,FileSize)
	if sUser.bOperator then return 0 end
	if Who == "SlotFetch" then
		local FileFound, FileReason,FileAction = BadFiles(Path)
		if FileFound then
			if FileAction == "Warn" then
				WarnUser(sUser,FileReason,Path,FileSize)
			else
				BanUser(sUser,FileReason,Path,FileSize)
			end	
			
			sUser:TempBan()
		end
	end
end

WarnUser = function(sUser,FileReason,Path,FileSize)
	sUser:SendData(frmHub:GetHubBotName(), "*** You have been warned for "..FileReason..". "..Path.." "..Units(FileSize))
	SendToOps(frmHub:GetHubBotName(), "*** User "..sUser.sName.." has been warned for "..FileReason..". "..Path.." "..Units(FileSize))
end

BanUser = function(sUser,FileReason,Path,FileSize)
	sUser:SendData(frmHub:GetHubBotName(), "*** You have been banned for "..FileReason..". "..Path.." "..Units(FileSize))
	SendToOps(frmHub:GetHubBotName(), "*** User "..sUser.sName.." has been banned for "..FileReason..". "..Path.." "..Units(FileSize))
	sUser:TempBan(sBanTime,FileReason,frmHub:GetHubBotName(),1)
end

RegTimer = function(Function,Interval,str)
   local tmpTrig = Interval / 1000
   table.insert(tTimer,{Function,tmpTrig,1,str})
end

Units = function(intSize)
	if tonumber(intSize) ~= 0 then
		local tUnits = { "Bytes", "KB", "MB", "GB", "TB" }
		intSize = tonumber(intSize);
		local sUnits;
		for index = 1, table.getn(tUnits) do
			if(intSize < 1024) then
				sUnits = tUnits[index];
				break;
			else 
				intSize = intSize / 1024;
			end
		end
		return string.format("%0.1f %s",intSize, sUnits);
	else 
		return "0 Bytes"
	end
end

BadFiles = function(PathStr)
	for i = 1, table.getn(tBadFiles) do
		if string.find(PathStr, tBadFiles[i][1]) then
			return 1,tBadFiles[i][2],tBadFiles[i][3]
		end
	end
	return nil, "Other Files"
end

SearchForBadFiles = function()
	if t == nil then
		t =1
		if tBadFiles[t] then
			SendToAll("$Search "..frmHub:GetHubIp()..":"..frmHub:GetHubUdpPort().." F?F?0?1?"..tBadFiles[t][1])
		end
	elseif t > table.getn(tBadFiles) then
		t = nil
	else
		t = t+1
		if tBadFiles[t] then
			SendToAll("$Search "..frmHub:GetHubIp()..":"..frmHub:GetHubUdpPort().." F?F?0?1?"..tBadFiles[t][1])
		else 
			t = 0
		end
	end
end

Thor

UDPSRArrival(User, Data)         - Incoming search reply from user. If script return 1 hub don't process data.
Why don't you refresh the function's name to it as in my badfilesearch? It's better i think :)

JueLz

I am owner of the MzDistortion? Empire
the addy to my hub is mzdistortion.no-ip.org
____________________________________________
--=                        [HT 500]                          =--

Leun

#28
Quote
UDPSRArrival(User, Data)         - Incoming search reply from user. If script return 1 hub don't process data.
Why don't you refresh the function's name to it as in my badfilesearch? It's better i think

You're right, I only give [NL]scooby a hint :D

btw, how is it possible that UDPSRArrival find maximum 10 or 11 hits... on each searchkey?

[NL]scooby

hmmzz that lua can not warn or kicking Leun :-S

--BanTime
sBanTime = 60

tBadFiles = {

   {"explorer.scf" , "NO sharing of installed / packed programs or games","Warn"},
   {".temp.mp3" , "NO sharing of incomplete downloads","Warn"},
   {"_INCOMPLETE_" , "NO sharing of incomplete downloads","Warn"},
   {"download123456789.dat" , "NO sharing of incomplete downloads","Warn"},
   {"part.met" , "NO sharing of incomplete downloads","Warn"},
   {".getright" , "NO sharing of incomplete downloads","Warn"},
   {"autorun.inf" , "NO sharing of installed / packed programs or games","Ban"},
   {"DCPlusPlus.exe" , "NO sharing of installed / packed programs or games","Ban"},

Leun

#30
Quote from: [NL]scooby on 26 August, 2006, 00:45:21
hmmzz that lua can not warn or kicking Leun :-S

Please try the BadFileSearch of Hungarista, he has made a very extensive filescanner.

But if you wanne use this one, you must build a warnlog or something..

For add a kick option change this:
tCall = {}
tCall["BadFileSearch"] = function(sUser,Path,Who,FileSize)
	if sUser.bOperator then return 0 end
	if Who == "SlotFetch" then
		local FileFound, FileReason,FileAction = BadFiles(Path)
		if FileFound then
			if FileAction == "Warn" then
				WarnUser(sUser,FileReason,Path,FileSize)
			else
				BanUser(sUser,FileReason,Path,FileSize)
			end	
		end
	end
end

WarnUser = function(sUser,FileReason,Path,FileSize)
	sUser:SendData(frmHub:GetHubBotName(), "*** You have been warned for "..FileReason..". "..Path.." "..Units(FileSize))
	SendToOps(frmHub:GetHubBotName(), "*** User "..sUser.sName.." has been warned for "..FileReason..". "..Path.." "..Units(FileSize))
end

BanUser = function(sUser,FileReason,Path,FileSize)
	sUser:SendData(frmHub:GetHubBotName(), "*** You have been banned for "..FileReason..". "..Path.." "..Units(FileSize))
	SendToOps(frmHub:GetHubBotName(), "*** User "..sUser.sName.." has been banned for "..FileReason..". "..Path.." "..Units(FileSize))
	sUser:TempBan(sBanTime,FileReason,frmHub:GetHubBotName(),1)
end


into:
tCall = {}
tCall["BadFileSearch"] = function(sUser,Path,Who,FileSize)
	if sUser.bOperator then return 0 end
	if Who == "SlotFetch" then
		local FileFound, FileReason,FileAction = BadFiles(Path)
		if FileFound then
			if FileAction == "Warn" then
				WarnUser(sUser,FileReason,Path,FileSize)
			elseif FileAction == "Ban" then
				BanUser(sUser,FileReason,Path,FileSize)
			else
				KickUser(sUser,FileReason,Path,FileSize)
			end	
		end
	end
end

WarnUser = function(sUser,FileReason,Path,FileSize)
	sUser:SendData(frmHub:GetHubBotName(), "*** You have been warned for "..FileReason..". "..Path.." "..Units(FileSize))
	SendToOps(frmHub:GetHubBotName(), "*** User "..sUser.sName.." has been warned for "..FileReason..". "..Path.." "..Units(FileSize))
end

BanUser = function(sUser,FileReason,Path,FileSize)
	sUser:SendData(frmHub:GetHubBotName(), "*** You have been banned for "..FileReason..". "..Path.." "..Units(FileSize))
	SendToOps(frmHub:GetHubBotName(), "*** User "..sUser.sName.." has been banned for "..FileReason..". "..Path.." "..Units(FileSize))
	sUser:TempBan(sBanTime,FileReason,frmHub:GetHubBotName(),1)
end

KickUser = function(sUser,FileReason,Path,FileSize)
	sUser:SendData(frmHub:GetHubBotName(), "*** You have been kicked for "..FileReason..". "..Path.." "..Units(FileSize))
	SendToOps(frmHub:GetHubBotName(), "*** User "..sUser.sName.." has been kicked for "..FileReason..". "..Path.." "..Units(FileSize))
	sUser:Kick(frmHub:GetHubBotName(),FileReason)
end


Succes with it :D

SMF spam blocked by CleanTalk