Download blocker
 

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

Download blocker

Started by witch, 22 April, 2005, 14:35:10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

witch

Hola amigos!
Was looking thrue forum, but could'n find solution of my problem. I want to make downloads from me avalible ONLY for regs and above.
Don't know what can help me, script or different client. Now i'm on 0.401 and hub runs on 0.3.3.0.b16.09 powered by RC 10.01c

thx on advince  :))



damo

why not use the blocker in robo so that only redistered users can download

jiten

#2
If I understood ur request, here it is:
-- requested by witch
-- unreg users upload blocker by jiten 
-- modded to LUA 5 by jiten from
-- 100% Blocker by chill
-- Table Load and Save (added by nErBoS)


sBot = "[fow]-Leech"

cmd1 = "!add"
cmd2 = "!del"
cmd3 = "!show"

BlockedNicks = {}
fBlock = "block.dat"

function Main()
	frmHub:RegBot(sBot)
	LoadFromFile(fBlock)
end

function OnExit()
	SaveToFile(fBlock , BlockedNicks , "BlockedNicks")
end

function ConnectToMeArrival(curUser,data)
	local _,_,conNick = string.find(data,"(%S+)|$")
	if BlockedNicks[string.lower(conNick)] then
		if not curUser.bRegistered then
			curUser:SendData("*** The user "..conNick.." you are trying to download from is not authorized to upload to Unreg Users.")
			return 1
		else
		end
	end 
	local _,_,conNick = string.find(string.sub(data,14,string.len(data)),"^(%S+)")
	if BlockedNicks[string.lower(conNick)] then
		if not curUser.bRegistered then
			curUser:SendData("*** The user "..conNick.." you are trying to download from is not authorized to upload to Unreg Users.")
			return 1
		else
		end
	end
end

RevConnectToMeArrival = ConnectToMeArrival

function ChatArrival(curUser,data)
	if curUser.bOperator then
		data = string.sub(data,1,string.len(data)-1)
		local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
		local _,_,nick = string.find(data,"%b<>%s+%S+%s+(%S+)")
		if cmd and cmd == cmd2 and nick then
			if BlockedNicks[string.lower(nick)] then
				BlockedNicks[string.lower(nick)] = nil
				curUser:SendPM(sBot, nick.." is now unblocked. Now he can upload to anyone.")
				return 1
			end
		elseif cmd and cmd == cmd1 then
			if BlockedNicks[string.lower(nick)] == 1 then
				curUser:SendPM(sBot, nick.." is already blocked. Use !del  to unblock this user.")
				return 1 
			else
				BlockedNicks[string.lower(nick)] = curUser.sName
				curUser:SendPM(sBot, nick.." is now blocked. Now he only uploads to registered users.") 
				return 1
			end
			OnExit()
			return 1  -- TELLS THE HUB TO STOP PROCESSING THE DATA
		elseif (cmd and cmd == cmd3 and curUser.bOperator) then
			local sTmp,aux,nick = "Upload Blocker Users in this HUB:\r\n\r\n"
			for nick, aux in BlockedNicks do
				sTmp = sTmp.."User:-->> "..nick.."\t Was Blocked by: "..aux.."\r\n"
			end
			curUser:SendPM(sBot, sTmp)
			return 1		
		end
	end
end

ToArrival = ChatArrival

function Serialize(tTable, sTableName, sTab)
        assert(tTable, "tTable equals nil");
        assert(sTableName, "sTableName equals nil");

        assert(type(tTable) == "table", "tTable must be a table!");
        assert(type(sTableName) == "string", "sTableName must be a string!");

        sTab = sTab or "";
        sTmp = ""

        sTmp = sTmp..sTab..sTableName.." = {\n"

        for key, value in tTable do
                local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);

                if(type(value) == "table") then
                        sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
                else
                        local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
                        sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
                end

                sTmp = sTmp..",\n"
        end

        sTmp = sTmp..sTab.."}"
        return sTmp
end

function SaveToFile(file , table , tablename)
	local handle = io.open(file,"w+")
        handle:write(Serialize(table, tablename))
	handle:flush()
        handle:close()
end

function LoadFromFile(file)
	local handle = io.open(file,"r")
	if (handle ~= nil) then
                dofile(file)
		handle:flush()
		handle:close()
        end
end

*EDIT* Small fix
*EDIT 2* Fixed problem with passive users
Cheers

witch

#3
Thx a lot jiten dude, didn't tested yet....but looks exact what i need. If any errors i will get, i 'll let ya know.

emm 4 got to ask, can u convert this script to lua 4 as well? i also running hub on old ptokax and will be cool to have it there too....

thx man  :D



jiten

QuoteOriginally posted by witch
Thx a lot jiten dude, didn't tested yet....but looks exact what i need. If any errors i will get, i 'll let ya know.

emm 4 got to ask, can u convert this script to lua 4 as well? i also running hub on old ptokax and will be cool to have it there too....

thx man  :D
ym m8 :]
I'll have a look at this one and post the Lua 4 version l8r... maybe at night.

Best regards,

jiten

jiten

#5
Here you go (not fully tested):
-- requested by witch
-- unreg users upload blocker by jiten (lua 4 version)
--100% Blocker by chill
--Table Load and Save (added by nErBoS)

sBot = "[fow]-Leech"

cmd1 = "!add"
cmd2 = "!del"
cmd3 = "!show"


BlockedNicks = {}
fBlock = "block.dat"
OpChatName = frmHub:GetOpChatName()	--Use this line for inbuilt Px opchat


--## Configuration ##--

uLaterPtokax = 0	-- Choose 0 if you are using Ptokax Version 0.3.3.0 or higher
			-- Choose 1 if you are using Ptokax Version lower then 0.3.3.0

--## END ##--

function Main()
	frmHub:RegBot(sBot)
	frmHub:EnableFullData(1) 
	LoadFromFile(fBlock)
end

function OnExit()
	SaveToFile(fBlock , BlockedNicks , "BlockedNicks")
end

BlockTriggs = {
	["$Con"] = 1,
	["$Rev"] = 1,
}

function DataArrival(curUser,data)
	if strsub(data,1,1) == "$" then
		local str1 = strsub(data,1,4)
		if BlockTriggs[str1] == 1 then
			local _,_,conNick = strfind(strsub(data,14,strlen(data)),"^(%S+)")
			if BlockedNicks[strlower(conNick)] then
				if curUser.iProfile == -1 then
					curUser:SendData("*** The user "..conNick.." you are trying to download from is not authorized to upload to Unreg Users.")
					return 1
				end
			end
		end
	end
--	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) and curUser.iProfile == 5 or curUser.iProfile == 0 then
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) and curUser.bOperator then
		data = strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind(data,"%b<>%s+(%S+)")
		local _,_,nick = strfind(data,"%b<>%s+%S+%s+(%S+)")
		if cmd and cmd == cmd2 and nick then
			if BlockedNicks[strlower(nick)] then
				BlockedNicks[strlower(nick)] = nil
				curUser:SendPM(sBot, nick.." is now unblocked. Now he can upload to anyone.")
				return 1
			end
		elseif cmd and cmd == cmd1 then
			if BlockedNicks[strlower(nick)] == 1 then
				curUser:SendPM(sBot, nick.." is already blocked. Use !del  to unblock this user.")
				return 1 
			else
				BlockedNicks[strlower(nick)] = curUser.sName
				curUser:SendPM(sBot, nick.." is now blocked. Now he only uploads to registered users.") 
				return 1
			end
			if (uLaterPtokax == 1) then
				OnExit()
			end
				
			return 1  -- TELLS THE HUB TO STOP PROCESSING THE DATA
		elseif (cmd and cmd == cmd3 and curUser.bOperator) then
			local sTmp,aux,nick = "Upload Blocker Users in this HUB:\r\n\r\n"
			for nick, aux in BlockedNicks do
				sTmp = sTmp.."User:-->> "..nick.."\t Was Blocked by: "..aux.."\r\n"
			end
			curUser:SendPM(sBot, sTmp)
			return 1		
		end
	end
end

function Serialize(tTable, sTableName, sTab)
	assert(tTable, "tTable equals nil");
	assert(sTableName, "sTableName equals nil");
	assert(type(tTable) == "table", "tTable must be a table!");
	assert(type(sTableName) == "string", "sTableName must be a string!");
	sTab = sTab or "";
	sTmp = ""
	sTmp = sTmp..sTab..sTableName.." = {\n"
	for key, value in tTable do
		local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);
		if(type(value) == "table") then
			sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
		else
			local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
			sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
		end
		sTmp = sTmp..",\n"
	end
	sTmp = sTmp..sTab.."}"
	return sTmp
end

function SaveToFile(file , table , tablename)
	writeto(file)
	write(Serialize(table, tablename))
	writeto()
end

function LoadFromFile(file)
	if (readfrom(file) ~= nil) then
		readfrom(file)
		dostring(read("*all"))
		readfrom()
	end
end
*EDIT* Fixed problem with passive users
Cheers

ruler

sorry guys i saw this section and just had to comment!
ive used many download/search blockers and even totally disabled it for all users under to test something and found that there are still some users who are in passive mode that can still download and search!
one user in particular was named 'Komaland' who always got a slot from me even though he was NOT registered and was totally blocked, anyone know why this could be???  
thanks

The Direct Connect Global Banlist get protected.

witch

GRATE script jiten dude, works with no errors so far on bouth versions!!!

Thx a lot m8  :))

...but ja ruler was right some users in passive mode snickin a slot, damn what we can do about it m8  ?(



Dessamator

#8
just change this ::

BlockTriggs = {
	["$Con"] = 1,
}


to this ::
BlockTriggs = {
	["$Con"] = 1,
                ["$Rev"] = 1,
}
Ignorance is Bliss.

jiten

Well, I hope the bug is fixed now in both scripts.
Fast guy, hein Dessamator? :D

Cheers

Dessamator

lol, i just wrote that, i never tested it,  its all based on theory,:D,
Ignorance is Bliss.

witch

#11
well bad luck guys, they r still coming even after fix  :rolleyes:



jiten

QuoteOriginally posted by witch
well bad luck guys, they r still coming even after fix  :rolleyes:
Well, maybe someone else can give us a hint...

Dessamator

#13
lol
try adding::
BlockTriggs = {

["$Con"] = 1,
["$Rev"] = 1,
["$Mul"]=1,
}
 
Ignorance is Bliss.

witch

QuoteOriginally posted by Dessamator
lol
try adding::
BlockTriggs = {

["$Con"] = 1,
["$Rev"] = 1,
["$Mul"]=1,
}
 
still no luck Dessamator, they still coming  ;(



witch

it's 2 weeks since last post now and no replays  ;(

..so is it posseble to block downloads from passive users or not?

thx in advince



Pothead

QuoteOriginally posted by witch
it's 2 weeks since last post now and no replays  ;(

..so is it posseble to block downloads from passive users or not?

thx in advince
Easily. Switch to passive mode.  :D
Or block passive users from entering a hub.
Or block passive users sending a RevConnectToMe.

witch

QuoteOriginally posted by Pothead
QuoteOriginally posted by witch
it's 2 weeks since last post now and no replays  ;(

..so is it posseble to block downloads from passive users or not?

thx in advince
Easily. Switch to passive mode.  :D
Or block passive users from entering a hub.
Or block passive users sending a RevConnectToMe.
thx 4 replay Pothead!

- switched to passive: result: no1 can download from me, even regs and above...that's no good
- can't block passive from entering the hub, will loose half users.....hehhe
- but i didn't tryed this 1: plz tell me how to block passive users sending a RevConnectToMe

thx :))



Pothead

#18
Write a script.
from Scripting-Interface.txt (you should READ these files)
RevConnectToMeArrival(User, Data)      - Incoming pasive connection request from user. If script return 1 hub don't process data.

So make a script when it receives RevConnectToMeArrival, checks the user is registered (i think this was the original request).  If the user is registered return 0, if unregistered return 1. :)

*** Edit, also do the same for:

SearchArrival(User, Data)         - Incoming search request from user. If script return 1 hub don't process data.

p.s. Are you trying the LUA 4 or LUA 5 script ?.

witch

yeah if i would be an scripter, i deffenetly would write it....but atfortunacly i'm not scripter  :rolleyes:



Pothead

Well for the above script (lua 5) try adding this at some point.
SearchArrival = ConnectToMeArrival

NightLitch

Well if I get some time I can see what I can do about it.

It is not hard at all.

Just make a table with the "Special" Users that shouldn't be accessable by Users ( -1 ) and check that in RevConnectToMeArrival and ConnectToMeArrival. And if even i search the SearchArrival.

Later
//NL

witch




jiten

QuoteOriginally posted by NightLitch
Well if I get some time I can see what I can do about it.

It is not hard at all.

Just make a table with the "Special" Users that shouldn't be accessable by Users ( -1 ) and check that in RevConnectToMeArrival and ConnectToMeArrival. And if even i search the SearchArrival.

Later
In fact that's what the script should do, but, some unregistered passive users seem to get slots from the "special" ones even not being allowed to.
Maybe there's something missing...

Cheers

jiten

Here goes another attempt:
-- requested by witch
-- unreg users upload blocker by jiten 
-- ideas from 100% Blocker by chill

sBot = frmHub:GetHubBotName()

BlockedNicks = {}
fBlock = "block.dat"

function Main()
	if loadfile(fBlock) then dofile(fBlock) end
end

function OnExit()
	local f = io.open(fBlock,"w+")
	f:write(Serialize(BlockedNicks, "BlockedNicks"))
	f:flush()
	f:close()
end

function ChatArrival(curUser,data)
	if curUser.bOperator then
		data = string.sub(data,1,-2)
		local s,e,cmd = string.find ( data, "%b<>%s+[%!%?%+%#](%S+)" )
		if cmd then
			local tCmds = {
			["del"] =	function(curUser,data)
					local s,e,nick = string.find ( data, "%b<>%s+%S+%s+(%S+)" )
					if BlockedNicks[string.lower(nick)] then
						BlockedNicks[string.lower(nick)] = nil
						curUser:SendPM(sBot, nick.." is now unblocked. Now he can upload to anyone.")
					end
				end,
			["add"] =	function(curUser,data)
					local s,e,nick = string.find ( data, "%b<>%s+%S+%s+(%S+)" )
					if BlockedNicks[string.lower(nick)] == 1 then
						curUser:SendPM(sBot, nick.." is already blocked. Use !del  to unblock this user.")
					else
						BlockedNicks[string.lower(nick)] = curUser.sName
						curUser:SendPM(sBot, nick.." is now blocked. Now he only uploads to registered users.") 
					end
					OnExit()
				end,
			["show"] =	function (curUser,data)
					local sTmp,aux,nick = "Upload Blocker Users in this HUB:\r\n\r\n"
					for nick, aux in BlockedNicks do
						sTmp = sTmp.."User:-->> "..nick.."\t Was Blocked by: "..aux.."\r\n"
					end
					curUser:SendPM(sBot, sTmp)
				end,
			}
			if tCmds[cmd] then 
				return tCmds[cmd](curUser,data), 1
			end
		end
	end
end

ToArrival = ChatArrival

function ConnectToMeArrival(curUser, data)
	data = string.sub(data,1,-2);
	local s,e,nick = string.find(data,"%S+%s+(%S+)");
	nick = GetItemByName(nick);
	if (nick == nil) then return 1; end
	if BlockedNicks[string.lower(nick.sName)] then
		if not curUser.bRegistered then
			curUser:SendData("*** The user "..nick.sName.." you are trying to download from is not authorized to upload to Unreg Users.")
			return 1
		end
	end
end

RevConnectToMeArrival = ConnectToMeArrival
SearchArrival = ConnectToMeArrival

function Serialize(tTable, sTableName, sTab)
        assert(tTable, "tTable equals nil");
        assert(sTableName, "sTableName equals nil");

        assert(type(tTable) == "table", "tTable must be a table!");
        assert(type(sTableName) == "string", "sTableName must be a string!");

        sTab = sTab or "";
        sTmp = ""

        sTmp = sTmp..sTab..sTableName.." = {\n"

        for key, value in tTable do
                local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);

                if(type(value) == "table") then
                        sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
                else
                        local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
                        sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
                end

                sTmp = sTmp..",\n"
        end

        sTmp = sTmp..sTab.."}"
        return sTmp
end
Best regards,

jiten

SMF spam blocked by CleanTalk