only regged can download - 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

only regged can download

Started by GanjaMan, 21 October, 2003, 22:36:06

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[ES]latinmusic

Fixed, i had a conflict between 2 scripts, in one i use User in the other i use curUser.
Anyway i think there is a bug inside last ptokax beta, i think one script could not affect other scripts in any way, functions, names, variables, etc, could be local or global but only inside the the current script and no for all scripts inside the server!.

[ES]latinmusic

Back into this again:
The following code taken from hub-secure is not working ok and also is not giving any message about errors, the command "!letleech" without parameters works but the same command with parameters does not work. Seems to have some troubles with the line:
local s, e, cmd, arg1 = strfind(sData, "%b<>%s+(%S+)%s*([^|]*)%|$")
or the line:
who = GetItemByName(arg1)

and with variables 'who' and 'arg1'

The code who is not working is the following:
if strsub(sData, 1, 1) == "<" then
		local s, e, cmd, arg1 = strfind(sData, "%b<>%s+(%S+)%s*([^|]*)%|$")
		if not cmd == nil then
			if strlower(cmd) == strlower(sCmdReg) then
				curUser:SendPM(sBotName, sRegistrationHelpMessage)
				return 1
			elseif strlower(cmd) == strlower(sCmdLetLeech) and curUser.bOperator then
				if not arg1 == nil and arg1 ~= "" then
					who = GetItemByName(arg1)
					if not who then
						curUser:SendData(sBotName, gsub(sLeechError_UserOffilne, "", arg1))
					elseif who.iProfile ~= -1 then
						curUser:SendData(sBotName, gsub(sLeechError_UserIsReg, "", arg1))
					else
						LetLeech[arg] = 1
						curUser:SendData(sBotName, gsub(sMessageNotifyOp, "", arg1))
						who:SendData(sBotName, sMessageNotifyLeech)
					end
				else
					curUser:SendData(sBotName, sLeechError_NoUserName)
				end
				return 1
			end
		end
	end
Can anyone take a look into this to see what is happening and give me a little help?.

[ES]latinmusic

Re- requesting help here, please help me.

OpiumVolage

The only thing i see is that you use arg1 everywhere, but not in:

LetLeech[arg] = 1

[ES]latinmusic

QuoteOriginally posted by OpiumVolage
The only thing i see is that you use arg1 everywhere, but not in:

LetLeech[arg] = 1
Great, seems you are my main helper, totally cool :))
I don't catch what exactly you mean :(  can you explain a little more?.
For me the problem is in the line:
who = GetItemByName(arg1)  
When i type the command !leetleech without parameters the script works and the error message 'sLeechError_NoUserName' is displayed but for instance, when i type '!leetleech' with an argument '!letleech opium' an supposing you are not connected, the message 'sLeechError_UserOffilne' should be displayed.
This not happend and ptokax does not generated any error message in every where.
Seems that the if procedure:
if not who then
....
end
are not working at all.
What can i do here?.

OpiumVolage

ok, who is the user object.
arg1 is the username (who.sName)

you create or modify LetLeech table with key username i think, it should be arg1, not arg.

It think the error is in this part of the code:

else
	LetLeech[arg] = 1
	curUser:SendData(sBotName, gsub(sMessageNotifyOp, "", arg1))
	who:SendData(sBotName, sMessageNotifyLeech)
end

[ES]latinmusic

I'm back here again, the solution not work but i think i have identified the problem, also i have detected a bug into ptokax last beta build available because this.
The problem is exactly in this line i think:
who = GetItemByName(arg1)
The above line seems to be totally ok but who is always nill, dunno why.
I have also made some probe adding the following code, see mainly black letters:
if not arg1 == nil and arg1 ~= "" then
	who = GetItemByName(arg1)
	[B]SendToAll (sBotName,"arg1: "..arg1)
	SendToAll (sBotName,"who: "..who)[/B]
	if not who then
		curUser:SendData(sBotName, gsub(sLeechError_UserOffilne, "", arg1))
	elseif who.iProfile ~= -1 then
		curUser:SendData(sBotName, gsub(sLeechError_UserIsReg, "", arg1))
	else
		LetLeech[arg] = 1
		curUser:SendData(sBotName, gsub(sMessageNotifyOp, "", arg1))
		who:SendData(sBotName, sMessageNotifyLeech)
	end
else
	curUser:SendData(sBotName, sLeechError_NoUserName)
end
If i type for instance this: !letleech OpiumVolage
With the first SendToAll i get this result: arg1: OpiumVolage. But the second SendToAll does not return anything in mainchat.
Thanks to a bug inside Ptokax i have obtained the following line in ptokax script editor: attempt to concat global `who' (a nil value)
Now, how can i make this line works as we suppose it do it?. Because if i declare at the begining like who = " " The variable is global but nothing is solved.
Also an alternate solution to do what that line does is a totally valid way to fix my problem.
What do you think opium?.
Now going to post or mail to Ptacek about the Ptokax bug.

Skrollster

if there was a who you have to index it with .sName

SendToAll (sBotName,"who: "..who.sName)

[ES]latinmusic

QuoteOriginally posted by Skrollster
if there was a who you have to index it with .sName

SendToAll (sBotName,"who: "..who.sName)
Great more help!!!
Anyway still does not work:
Syntax error: attempt to index global `who' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 179 [file `D:\PtokaxDeveloping\scripts\HubSecure.lua'
I don't understand why this script does not want to work, i know there is a mistake in some place but where?.

Skrollster

I'm sorry about this, but i will rewrite it a bit, not much, what i will do is using my old tested functions as helpfunction, i'll be right back...

Skrollster

try this:

 sCmdLetLeech = "letleech"
  sCmdReg = "reg"
	
	if strsub(sData, 1, 1) == "<" then
		-- create a table
		local tArgs = {}
		-- Save sData in an array
		tArgs = tHelpFunctions:GetArgs(sData)
		-- Check if the user has used any of the hubprefixes
		tArgs = tHelpFunctions:CheckIfHasPrefix(tArgs)
		-- add sData as a variable to tArgs
		tArgs.sData = sData
		if tArgs.sPrefix then
			if tArgs.sCmd == sCmdReg then
				curUser:SendPM(sBotName, sRegistrationHelpMessage)
				return 1
			elseif tArgs.sCmd == sCmdLetLeech and curUser.bOperator then
				if tArgs[1] and tArgs[1] ~= "" then
					who = GetItemByName(tArgs[1])
					if not who then
						curUser:SendData(sBotName, gsub(sLeechError_UserOffilne, "", tArgs[1]))
					elseif who.iProfile ~= -1 then
						curUser:SendData(sBotName, gsub(sLeechError_UserIsReg, "", tArgs[1]))
					else
						LetLeech[arg] = 1
						curUser:SendData(sBotName, gsub(sMessageNotifyOp, "", tArgs[1]))
						who:SendData(sBotName, sMessageNotifyLeech)
					end
				else
					curUser:SendData(sBotName, sLeechError_NoUserName)
				end
				return 1
			end
		end
	end

tSettings = {tCmdPrefixes = {"!","+","gs:","?","#","?"}}

tHelpFunctions = {
	CheckIfHasPrefix = function(self,tArgs)
			sToCheck = tArgs.sCmd
			local i
			local err
			for i = 1, getn(tSettings.tCmdPrefixes) do
				if strsub(sToCheck, 1, strlen(tSettings.tCmdPrefixes[i])) == tSettings.tCmdPrefixes[i] then
					tArgs.sCmd = strsub(sToCheck, strlen(tSettings.tCmdPrefixes[i])+1, strlen(sToCheck))
					tArgs.sPrefix = tSettings.tCmdPrefixes[i]
					break
				end
			end
			return tArgs
		end,
	GetArgs = function(self,sData)
			local tArgs = {}
			_,_,sData = strfind(sData, "%b<>%s+(.+)|")
			tArgs.sMessage = sData
			sData = strlower(sData)
			gsub(sData, "(%S+)", function (w) tinsert(%tArgs,w) end)
			tArgs.sCmd = tArgs[1]
			tremove(tArgs, 1)
			return tArgs
		end,
	}

i hope you don't have to change too much

[ES]latinmusic

#36
Editing this one i have made a double post  :(

[ES]latinmusic

QuoteOriginally posted by Skrollster
I'm sorry about this...
Never be surry, you are always helping people here and we have to say you thanks for now and ever.
I'm  going to test the code, i will tell you how goes but probably tomorrow, here is too late
Thanks for help me, you opium and all the board too
  :P

[ES]latinmusic

Hi again, seems that i condenated to be posting in this thread, here we goes:
Hub-Secure have some errors from begining, at least seems to me.
Skrollster, your code works and totally good, but it give exactly the same errors that the previouws one, so the problem is not in your code as usual.
Explanation (3 problems):
1.- If you try to grant an access to an allien, command: '!letleech OpiumVolage' Ptokax answer:
Syntax error: attempt to index global `LetLeech' (a nil value)  stack traceback:     1:  function `DataArrival' at line 190 [file `D:\PtokaxDeveloping\scripts\HubSecure.lua'].
This is caused by the line: LetLeech[arg] = 1. if i change this line by this one: LetLeech[tArgs] = 1, i have no success anyway. If i comment the line for test, i get no errors, but the messages sMessageNotifyLeech and sMessageNotifyOp are not displayed at all.
2.- If i try to grant an access to a user who is not connected, command !letleech Skrollster the mesage: sLeechError_UserOffilne should be displayed, this is not happening, Ptokax does not give any error too.
3.- If i try to grant an acces to a registered user, command !letleech [NL]Pur, the message sLeechError_UserIsReg should be displayed, this is not happening, Ptokax does not give any error too.
The only thing who seems to works is the command without parameters: !letleech, the message: sLeechError_NoUserName is correctly displayed.
******
I think i probably will be not capable to fix this problem, is very difficult, anyway, what can i do next?. I will continues trying...

[ES]latinmusic

I have changed some code inside hub-secure script, read the comments inside the script to see what have changed, now i need a little help to see if the script is continous working as expected, mainly about 'Anti MediaForce blocker' and '-letleech command', in my current server configuration i can do it, please see if the script is working.

The requiered files for run the script can be found in the original script package at:
http://www.1stleg.com/1stleg/Download/Scripts/PtokaX/HubSecure_v1.0.rar
The script is posted in the following reply.

[ES]latinmusic

#40
-- HubSecure v2.0 --  for PtokaX TD4 by [ES]latinmusic on 11/19/03
--------------------------------------------------------------------------------
-- Based on HubSecure v1.0 created by Sid ([URL]http://www.1stleg.com[/URL]) 08/28/03
--
-- HubSecure is a script to prevent search bot access by companies like the MPAA, RIAA, and BSA.
-- This script will make your hub 100% safe from the  prying eyes of these individuals until they
-- adopt sneakier and more illegal methods of privacy invasion.
--
-- The following files should be included:
--	HubSecure.lua  -  The main script file
--	PermBan.dat    -  A black list of all MPAA, RIAA, and BSA related ip's
-- Default Commands:
--	-letleech   -  Op Only
--	-regme
-- ********** MAIN CHANGES **********
-- Fixed succefully: Duplicate messages  when a user connected into the HUB.
-- Fixed succefully: Some messages were not diplayed before.
-- Fixed hope succefully: letleech command now should work as expected. Still need some test.
-- Some code have been rewrited, removed or added
-- The commands: !RegHelp and !Reg have been removed because a different procedure to be
-- a registered user in our net
----------------------
-- GLOBAL VARIABLES --  make changes here only
----------------------
-- Global Setup
  sBotName = "![HubSecure]!?"
  sHubName = frmHub:GetHubName()
  sHubDescription = frmHub:GetHubDescr()
  sHubAddress = "YourHUB@Whatever.no-ip.com"
  sHubOwner = "@HubOwner"
-- Anti ML Donkey Setup
  bBlockMLDonkey = 0   -- (0 = False, 1 = True)
  bLogMLDonkeyAttempt = 1   -- (0 = False, 1 = True)
  aMLDonkeyDescriptions = { "mldonkey", "mldc client", "Lyon 2003", "dc client" }
  iMLDonkeyAction = 1   -- (0 = Nothing, 1 = Disconnect, 2 = TempBan, 3 = Ban)
  sDisconnectMessage = "You are using unauthorized client software!\r\n"..
                       "Disconnecting..."
-- Anti MediaForce Setup
  bBlockMediaForce = 1   -- (0 = False, 1 = True)
  bLogMediaForceAttempt = 1   -- (0 = False, 1 = True)
  aMediaForceVersions = {"1.0.25"}
  aMediaForceShareAmount = {"18552221398"}
  iMediaForceAction = 2   -- (0 = Nothing, 1 = Disconnect, 2 = TempBan, 3 = Ban)
  sMediaForceFoundMessage = " was a searchbot most likly MediaForce and was temporarily banned. ()"
-- User Registration
  sCmdReg = "-regme"
  sEmailAddress = "YourHUB@Whatever.com"
  sRegistrationHelpMessage = "***WARNING***\r\nBy registering to join this hub you agree that you are joining a PRIVATE NETWORK where the rules and policies are created by the network owner.\r\n"..
                             "You may NOT collect any statistics or log IP addresses for any purpose without explicit permission from the @HubOwner.\r\n"..
                             "You may NOT register to enter this hub if you are directly or indirectly affiliated with any law enforcement agency, The MPAA, The RIAA, The BSA, The SGAE or any other related organization.\r\n"..
                             "You may NOT register to enter this hub if you do not agree to these terms.\r\n\r\n"..
			     "ANY ATTEMPT TO ACCESS ANY INFORMATION ON THIS SERVER WITHOUT AGREEING TO THESE TERMS WILL BE CONSIDERED A 'HACK' AND VIOLATORS WILL BE PROSECUTED TO THE FULL EXTEND OF THE LAW!.\r\n\r\n"..
	                     "To be registered into this HUB send one mail to: "..sEmailAddress.." with the following information:\r\n"..
			     "Your desired 'nick', your desired 'password', 'your country' and the server you want to be joined.\r\n"
-- Leech Blocker
  bBlockSearches = 1   -- (0 = False, 1 = True)
  aBlockSearchExceptions = { }
  aToBlock = { "^$ConnectToMe%s(%S+)", "^$RevConnectToMe%s(%S+)", "^$Search%s+(%S+)"}
  LetLeech = {}  -- This is an array of users nicks who are exempt to 'search and download' rule.
  aLetLeech = { "zSearch[moglo]", "7www.glosearch.tk" }  -- This is an array of nicks that are exempt like search bots.
  sCmdLetLeech = "-letleech"
  sWelcomeMessage = "Welcome to "..sHubName.." "..sHubDescription.." a part of Aracnidos Net. If you have some troubles, please contact us at: "..sEmailAddress.."\r\n\r\n"
  sMessageToAliens = "*** WARNING***\r\n"..
                     "YOU ARE UNABLE TO SEARCH OR DOWNLOAD IN THIS HUB.\r\n"..
                     "This hub will only accept search and download requests from registered users to prevent any unauthorized access from users such as (but not limited to members) of the MPAA, RIAA, BSA, etc; to gathering information from our users. If you really want to join us, please register your 'User Name' as soon as possible typing the following command '"..sCmdReg.."' into the main chat.\r\n"..
                     "I am sorry for the inconvenience but, by taking this step we are ensuring that our users are safe from the prying eyes of these individuals.\r\n"..
                     "Thanks.\r\n"..sHubOwner.."\r\n"..
                     "This Annoying Message Will Stop After You Register Your Nick.\r\n"
  sMessageToRegNicks = "This hub will only accept search and download requests from registered users to prevent any unauthorized users such as but not limited to members of the MPAA, RIAA, and BSA from gathering information from our users.  "..
                       "I am sorry for the inconvenience but by taking this step. We are ensuring that our users are safe from the prying eyes of these individuals.\r\n\r\n"..
                       "Thank You\r\n"..sHubOwner.."\r\n----------------------------\r\n"
  sMessageNotifyLeech = "You are now authorized to download for one session."
  sLeechError_NoUserName = "You must provide a Nick to grant a leech access to a user."
----------------------------------
-- Do not change anything below --
----------------------------------
function Main()
	frmHub:RegBot(sBotName)
	frmHub:EnableFullData(1)
	local version = sBotName.." V:2.0 by [ES]latinmusic"
	SendToAll(sBotName, "Script restarted.\r\n"..version..date(" launched at %B/%d/%Y. Local Time: %X.\r\n"))
	if bBlockSearches == 0 then
		for i,v in aToBlock do
			if v == "^$Search%s+(%S+)" then aToBlock[i] = nil end
		end
	end
end
function NewUserConnected(curUser)
	if bBlockMLDonkey == 1 then
		-- Anti ML Donkey
		for key,checkWord in aMLDonkeyDescriptions do
			if strfind(curUser.sMyInfoString, checkWord, 1, 1) then
				if bLogMLDonkeyAttempt == 1 then
					AppendFile("../Logs/MLDonkeyBot_"..date("%m-%d-%y")..".txt", curUser.sName.." ("..curUser.sIP..") was detected as a MLDonkey Client.  Version: "..curUser.iVersion.." MyInfo: "..curUser.sMyInfoString)
				end
				curUser:SendData(sBotName, sDisconnectMessage)
				if iMLDonkeyAction == 1 then
					curUser:Disconnect()
				elseif iMLDonkeyAction == 2 then
					curUser:TempBan()
				elseif iMLDonkeyAction == 3 then
					curUser:Ban()
				else
					-- Do Nothing
				end
			end
		end
	end
	if bBlockMediaForce == 1 then
		-- Anti MediaForce
		local foundMediaForce = 0
		for key,checkWord in aMediaForceVersions do
			if strfind(curUser.iVersion, checkWord, 1, 1) then
				foundMediaForce = 1
			end 
		end
		if foundMediaForce == 0 then
			for key,checkWord in aMediaForceShareAmount do
				if strfind(curUser.sMyInfoString, checkWord, 1, 1) then
					foundMediaForce = 1
				end 
			end
		end
		if foundMediaForce ~= 0 then
			SendToAll (sBotName, gsub(gsub(sMediaForceFoundMessage, "", curUser.sName), "", curUser.sIP))
			if bLogMediaForceAttempt == 1 then
				AppendFile("../Logs/MediaforceBot_"..date("%m-%d-%y")..".txt", curUser.sName.." ("..curUser.sIP..") was detected as a Mediaforce Bot.  Version: "..curUser.iVersion.." MyInfo: "..curUser.sMyInfoString)
			end
			curUser:SendData(sBotName, sMediaForceFoundMessage)
			if iMediaForceAction == 1 then
				curUser:Disconnect()
			elseif iMediaForceAction == 2 then
				curUser:TempBan()
			elseif iMediaForceAction == 3 then
				curUser:Ban()
			else
				-- Do Nothing
			end
		end
	end
	if curUser.iProfile ~= -1 then
		curUser:SendData(sBotName, sWelcomeMessage)
	else
		curUser:SendData(sBotName, sWelcomeMessage)
		curUser:SendPM(sBotName, sMessageToAliens)
	end
end
function OpConnected(curUser)
	curUser:SendData(sBotName, sWelcomeMessage..sMessageToRegNicks)
end
function DataArrival(curUser, sData)
	-- if Chat Cmd
	if strsub(sData, 1, 1) == "<" then
		local s, e, cmd, arg1 = strfind(sData, "%b<>%s+(%S+)%s*([^|]*)%|$")
		if not cmd == nil then
			if strlower(cmd) == strlower(sCmdReg) then
				curUser:SendPM(sBotName, sRegistrationHelpMessage)
				return 1
			elseif strlower(cmd) == strlower(sCmdLetLeech) and curUser.bOperator then
				if not arg1 == nil and arg1 ~= "" then
					who = GetItemByName(arg1)
					if not who then
						curUser:SendData(sBotName, "The user '"..arg1.."' is not online.")
					elseif who.iProfile ~= -1 then
						curUser:SendData(sBotName, "The user '"..arg1.."' is already a registered user.")
					else
						LetLeech[arg1] = 1
						SendToAll(sBotName, "The user '"..arg1.."' has been granted with an special leech license for one session.")
						SendPmToOps(sBotName,"[MassMessage]?: Massive Message from: "..curUser.sName.."\r\n\r\nThe user '"..arg1.."' has been granted with an special leech license for one session.")
						who:SendPM(sBotName, sMessageNotifyLeech)
					end
				else
					curUser:SendData(sBotName, sLeechError_NoUserName)
				end
				return 1
			end
		end
	end
	-- Annoying message to send to users that havnt registered!
	if strsub(strlower(sData), 1, 7) == strlower("$MyINFO") then
		if (curUser.iProfile == -1) then
			curUser:SendPM(sBotName, sMessageToAliens)
			curUser:SendData(sBotName, sMessageToAliens)
		end
		return 1
	end
	-- See if data should be blocked:
	for _,blockstring in aToBlock do
		local _, _, who = strfind(sData, blockstring)
		if who then return smBlock(curUser, sData, who) end
	end

end
----------------------------
-- User Defined Functions --
----------------------------
function AppendFile(sFilePath, sData)
	appendto(sFilePath)
		write(sData.."\r\n")
	writeto()
end
function smBlock(user, data, who)
	local report
	local profnam = GetProfileName(user.iProfile)
	if profnam then
		profnam = strlower(profnam)
	else
		profnam = "alien"
	end
	-- Activity by Masters, OPs, VIPs and REGs are just reported to OPs:
	-- Also, searches pass if they are in the exception list:
	-- Data also passes if user is in LetLeech list:
	if (user.iProfile ~= -1) or smMatchException(data) or IsInLeechList(user) or IsInaLeechList(user) then
		report = "\t"..user.sName.." ("..profnam..") sends:\r\n\t"..data
		return nil
	end
	-- Alien (not registered) users get blocked:
	local report = "\tBlocked from "..user.sName.." ("..profnam.."):\r\n\t"..data
	return 1
end
function smMatchException(data)
	if strfind (data, "^$Search%s+(%S+)") then
		for _,exceptword in aBlockSearchExceptions do
			if strfind (strlower(data), strlower(exceptword)) then
				return 1
			end
		end
	end
	return nil
end
function IsInLeechList(user)
	for i,v in LetLeech do
		if i == user.sName then return 1 end
	end
	return nil
end
function IsInaLeechList(user)
	for i,v in aLetLeech do
		if i == user.sName then return 1 end
	end
	return nil
end
function SendDebug(sData)
	SendPmToNick(sHubOwner, "Debug", sData)
	return 1
end
function OnExit()
	frmHub:UnregBot(sBotName)
end

NightLitch

Nice update [ES]latinmusic.

Gonna try it...

/NL
//NL

[ES]latinmusic

QuoteOriginally posted by NightLitch
Gonna try it...
Thanks man, i can test it now, so i need to see what happend with it, thanks a lot.

plop

letleech fixed and tested.
-- HubSecure v2.0 --  for PtokaX TD4 by [ES]latinmusic on 11/19/03
--------------------------------------------------------------------------------
-- Based on HubSecure v1.0 created by Sid ([URL]http://www.1stleg.com[/URL]) 08/28/03
--
-- HubSecure is a script to prevent search bot access by companies like the MPAA, RIAA, and BSA.
-- This script will make your hub 100% safe from the  prying eyes of these individuals until they
-- adopt sneakier and more illegal methods of privacy invasion.
--
-- The following files should be included:
--	HubSecure.lua  -  The main script file
--	PermBan.dat    -  A black list of all MPAA, RIAA, and BSA related ip's
-- Default Commands:
--	-letleech   -  Op Only
--	-regme
-- ********** MAIN CHANGES **********
-- Fixed succefully: Duplicate messages  when a user connected into the HUB.
-- Fixed succefully: Some messages were not diplayed before.
-- Fixed hope succefully: letleech command now should work as expected. Still need some test.
-- Some code have been rewrited, removed or added
-- The commands: !RegHelp and !Reg have been removed because a different procedure to be
-- a registered user in our net
-- letleech  fixed by plop
-- letleech for 1 session fixed by plop
-- coffee served by [ES]latinmusic
----------------------
-- GLOBAL VARIABLES --  make changes here only
----------------------
-- Global Setup
  sBotName = "![HubSecure]!?"
  sHubName = frmHub:GetHubName()
  sHubDescription = frmHub:GetHubDescr()
  sHubAddress = "YourHUB@Whatever.no-ip.com"
  sHubOwner = "@HubOwner"
-- Anti ML Donkey Setup
  bBlockMLDonkey = 0   -- (0 = False, 1 = True)
  bLogMLDonkeyAttempt = 1   -- (0 = False, 1 = True)
  aMLDonkeyDescriptions = { "mldonkey", "mldc client", "Lyon 2003", "dc client" }
  iMLDonkeyAction = 1   -- (0 = Nothing, 1 = Disconnect, 2 = TempBan, 3 = Ban)
  sDisconnectMessage = "You are using unauthorized client software!\r\n"..
                       "Disconnecting..."
-- Anti MediaForce Setup
  bBlockMediaForce = 1   -- (0 = False, 1 = True)
  bLogMediaForceAttempt = 1   -- (0 = False, 1 = True)
  aMediaForceVersions = {"1.0.25"}
  aMediaForceShareAmount = {"18552221398"}
  iMediaForceAction = 2   -- (0 = Nothing, 1 = Disconnect, 2 = TempBan, 3 = Ban)
  sMediaForceFoundMessage = " was a searchbot most likly MediaForce and was temporarily banned. ()"
-- User Registration
  sCmdReg = "-regme"
  sEmailAddress = "YourHUB@Whatever.com"
  sRegistrationHelpMessage = "***WARNING***\r\nBy registering to join this hub you agree that you are joining a PRIVATE NETWORK where the rules and policies are created by the network owner.\r\n"..
                             "You may NOT collect any statistics or log IP addresses for any purpose without explicit permission from the @HubOwner.\r\n"..
                             "You may NOT register to enter this hub if you are directly or indirectly affiliated with any law enforcement agency, The MPAA, The RIAA, The BSA, The SGAE or any other related organization.\r\n"..
                             "You may NOT register to enter this hub if you do not agree to these terms.\r\n\r\n"..
			     "ANY ATTEMPT TO ACCESS ANY INFORMATION ON THIS SERVER WITHOUT AGREEING TO THESE TERMS WILL BE CONSIDERED A 'HACK' AND VIOLATORS WILL BE PROSECUTED TO THE FULL EXTEND OF THE LAW!.\r\n\r\n"..
	                     "To be registered into this HUB send one mail to: "..sEmailAddress.." with the following information:\r\n"..
			     "Your desired 'nick', your desired 'password', 'your country' and the server you want to be joined.\r\n"
-- Leech Blocker
  bBlockSearches = 1   -- (0 = False, 1 = True)
  aBlockSearchExceptions = { }
  aToBlock = { "^$ConnectToMe%s(%S+)", "^$RevConnectToMe%s(%S+)", "^$Search%s+(%S+)"}
  LetLeech = {}  -- This is an array of users nicks who are exempt to 'search and download' rule.
  aLetLeech = { "zSearch[moglo]", "7www.glosearch.tk" }  -- This is an array of nicks that are exempt like search bots.
  sCmdLetLeech = "-letleech"
  sWelcomeMessage = "Welcome to "..sHubName.." "..sHubDescription.." a part of Aracnidos Net. If you have some troubles, please contact us at: "..sEmailAddress.."\r\n\r\n"
  sMessageToAliens = "*** WARNING***\r\n"..
                     "YOU ARE UNABLE TO SEARCH OR DOWNLOAD IN THIS HUB.\r\n"..
                     "This hub will only accept search and download requests from registered users to prevent any unauthorized access from users such as (but not limited to members) of the MPAA, RIAA, BSA, etc; to gathering information from our users. If you really want to join us, please register your 'User Name' as soon as possible typing the following command '"..sCmdReg.."' into the main chat.\r\n"..
                     "I am sorry for the inconvenience but, by taking this step we are ensuring that our users are safe from the prying eyes of these individuals.\r\n"..
                     "Thanks.\r\n"..sHubOwner.."\r\n"..
                     "This Annoying Message Will Stop After You Register Your Nick.\r\n"
  sMessageToRegNicks = "This hub will only accept search and download requests from registered users to prevent any unauthorized users such as but not limited to members of the MPAA, RIAA, and BSA from gathering information from our users.  "..
                       "I am sorry for the inconvenience but by taking this step. We are ensuring that our users are safe from the prying eyes of these individuals.\r\n\r\n"..
                       "Thank You\r\n"..sHubOwner.."\r\n----------------------------\r\n"
  sMessageNotifyLeech = "You are now authorized to download for one session."
  sLeechError_NoUserName = "You must provide a Nick to grant a leech access to a user."
  
----------------------------------
-- Do not change anything below --
----------------------------------

function Main()
	frmHub:RegBot(sBotName)
	frmHub:EnableFullData(1)
	local version = sBotName.." V:2.0 by [ES]latinmusic"
	SendToAll(sBotName, "Script restarted.\r\n"..version..date(" launched at %B/%d/%Y. Local Time: %X.\r\n"))
	if bBlockSearches == 0 then
		for i,v in aToBlock do
			if v == "^$Search%s+(%S+)" then aToBlock[i] = nil end
		end
	end
end

function NewUserConnected(curUser)
	if bBlockMLDonkey == 1 then
		-- Anti ML Donkey
		for key,checkWord in aMLDonkeyDescriptions do
			if strfind(curUser.sMyInfoString, checkWord, 1, 1) then
				if bLogMLDonkeyAttempt == 1 then
					AppendFile("../Logs/MLDonkeyBot_"..date("%m-%d-%y")..".txt", curUser.sName.." ("..curUser.sIP..") was detected as a MLDonkey Client.  Version: "..curUser.iVersion.." MyInfo: "..curUser.sMyInfoString)
				end
				curUser:SendData(sBotName, sDisconnectMessage)
				if iMLDonkeyAction == 1 then
					curUser:Disconnect()
				elseif iMLDonkeyAction == 2 then
					curUser:TempBan()
				elseif iMLDonkeyAction == 3 then
					curUser:Ban()
				else
					-- Do Nothing
				end
			end
		end
	end
	if bBlockMediaForce == 1 then
		-- Anti MediaForce
		local foundMediaForce = 0
		for key,checkWord in aMediaForceVersions do
			if strfind(curUser.iVersion, checkWord, 1, 1) then
				foundMediaForce = 1
			end 
		end
		if foundMediaForce == 0 then
			for key,checkWord in aMediaForceShareAmount do
				if strfind(curUser.sMyInfoString, checkWord, 1, 1) then
					foundMediaForce = 1
				end 
			end
		end
		if foundMediaForce ~= 0 then
			SendToAll (sBotName, gsub(gsub(sMediaForceFoundMessage, "", curUser.sName), "", curUser.sIP))
			if bLogMediaForceAttempt == 1 then
				AppendFile("../Logs/MediaforceBot_"..date("%m-%d-%y")..".txt", curUser.sName.." ("..curUser.sIP..") was detected as a Mediaforce Bot.  Version: "..curUser.iVersion.." MyInfo: "..curUser.sMyInfoString)
			end
			curUser:SendData(sBotName, sMediaForceFoundMessage)
			if iMediaForceAction == 1 then
				curUser:Disconnect()
			elseif iMediaForceAction == 2 then
				curUser:TempBan()
			elseif iMediaForceAction == 3 then
				curUser:Ban()
			else
				-- Do Nothing
			end
		end
	end
	if curUser.iProfile ~= -1 then
		curUser:SendData(sBotName, sWelcomeMessage)
	else
		curUser:SendData(sBotName, sWelcomeMessage)
		curUser:SendPM(sBotName, sMessageToAliens)
	end
end

function OpConnected(curUser)
	curUser:SendData(sBotName, sWelcomeMessage..sMessageToRegNicks)
end

function DataArrival(curUser, sData)
	-- if Chat Cmd
	if strsub(sData, 1, 1) == "<" then
      sData=strsub(sData,1,strlen(sData)-1) 
      local s, e, cmd = strfind(sData, "%b<>%s(%S+)")
		if cmd ~= nil then
			if strlower(cmd) == strlower(sCmdReg) then
				curUser:SendPM(sBotName, sRegistrationHelpMessage)
				return 1
			elseif strlower(cmd) == strlower(sCmdLetLeech) and curUser.bOperator then
            local s,e,arg1 = strfind(sData, "%b<>%s%S+%s(%S+)")
				if arg1 ~= nil then
					who = GetItemByName(arg1)
					if not who then
						curUser:SendData(sBotName, "The user '"..arg1.."' is not online.")
					elseif who.iProfile ~= -1 then
						curUser:SendData(sBotName, "The user '"..arg1.."' is already a registered user.")
					else
						LetLeech[arg1] = 1
						SendToAll(sBotName, "The user '"..arg1.."' has been granted with an special leech license for one session.")
						SendPmToOps(sBotName,"[MassMessage]?: Massive Message from: "..curUser.sName.."\r\n\r\nThe user '"..arg1.."' has been granted with an special leech license for one session.")
						who:SendPM(sBotName, sMessageNotifyLeech)
					end
				else
					curUser:SendData(sBotName, sLeechError_NoUserName)
				end
				return 1
			end
		end
	end
	-- Annoying message to send to users that havnt registered!
	if strsub(strlower(sData), 1, 7) == strlower("$MyINFO") then
		if (curUser.iProfile == -1) then
			curUser:SendPM(sBotName, sMessageToAliens)
			curUser:SendData(sBotName, sMessageToAliens)
		end
		return 1
	end
	-- See if data should be blocked:
	for _,blockstring in aToBlock do
		local _, _, who = strfind(sData, blockstring)
		if who then return smBlock(curUser, sData, who) end
	end
end

function UserDisconnected(curUser)
   if LetLeech[curUser.sName] then
      LetLeech[curUser.sName] = nil
   end
end

----------------------------
-- User Defined Functions --
----------------------------

function AppendFile(sFilePath, sData)
	appendto(sFilePath)
		write(sData.."\r\n")
	writeto()
end

function smBlock(user, data, who)
	local report
	local profnam = GetProfileName(user.iProfile)
	if profnam then
		profnam = strlower(profnam)
	else
		profnam = "alien"
	end
	-- Activity by Masters, OPs, VIPs and REGs are just reported to OPs:
	-- Also, searches pass if they are in the exception list:
	-- Data also passes if user is in LetLeech list:
	if (user.iProfile ~= -1) or smMatchException(data) or IsInLeechList(user) or IsInaLeechList(user) then
		report = "\t"..user.sName.." ("..profnam..") sends:\r\n\t"..data
		return nil
	end
	-- Alien (not registered) users get blocked:
	local report = "\tBlocked from "..user.sName.." ("..profnam.."):\r\n\t"..data
	return 1
end

function smMatchException(data)
	if strfind (data, "^$Search%s+(%S+)") then
		for _,exceptword in aBlockSearchExceptions do
			if strfind (strlower(data), strlower(exceptword)) then
				return 1
			end
		end
	end
	return nil
end

function IsInLeechList(user)
	for i,v in LetLeech do
		if i == user.sName then return 1 end
	end
	return nil
end

function IsInaLeechList(user)
	for i,v in aLetLeech do
		if i == user.sName then return 1 end
	end
	return nil
end

function SendDebug(sData)
	SendPmToNick(sHubOwner, "Debug", sData)
	return 1
end

function OnExit()
	frmHub:UnregBot(sBotName)
end
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 <----<<

plop

i remember there were a couple ppl who asked me 2 mod this bot a little bit.
just who and what was it i had 2 change?????
latinmusic/divxjunkie were 2 of them.

gues i'm getting old   lol

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 <----<<

[ES]latinmusic

Well, wait a lite there plop, yesterday you saw the lite version and also you fix some bugs there, it will be posted here and after that you can do something about it, could be totally cool.

SMF spam blocked by CleanTalk