GenPass
 

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

GenPass

Started by Madman, 27 February, 2006, 00:45:20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Madman

-- GenPass by Madman and Mutor
-- A Password Generator
-- 06-01-11
-- Togheter we fought the beast at night, at dawn we had conquerd it
-- Use !genpass for help
-- Added: !genpass reg. Gives a pass with 2 nr, 4 letters (2 low/2 up)

Table = {0,0,0,0}

function ChatArrival(curUser, data)
	local data = string.sub(data, 1, -2)
	local s,e,cmd = string.find(data, "^%b<>%s+%p(%S+)")
	if cmd then
		local tCmds = {
		["genpass"] = function(curUser, data)
			local s,e,lc,uc,sc,nr = string.find(data, "^%b<>%s+%S+%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)")
			if lc and uc and sc and nr then
				if lc + uc + sc + nr > 20 then
					curUser:SendData(frmHub:GetHubBotName(), "Max 20 chars") return 1
				elseif lc + uc + sc + nr <= 3 then
					curUser:SendData(frmHub:GetHubBotName(), "Min 4 chars") return 1
				end
				Table[1] = tonumber(lc)
				Table[2] = tonumber(uc)
				Table[3] = tonumber(sc)
				Table[4] = tonumber(nr)
				local Pass = ""
				while Table[1] + Table[2] + Table[3] + Table[4] > 0 do
					Pass = Pass..GenPass()
				end
				curUser:SendData(frmHub:GetHubBotName(), "Generated pass: "..Pass) return 1
			else
				local s,e,text = string.find(data, "^%b<>%s%S+%s+(%S+)")
				if text then
					if text == "reg" then
						Table[1] = 2
						Table[2] = 2
						Table[3] = 0
						Table[4] = 2
						local Pass = ""
						while Table[1] + Table[2] + Table[3] + Table[4] > 0 do
							Pass = Pass..GenPass()
						end
						curUser:SendData(frmHub:GetHubBotName(), "Generated pass: "..Pass) return 1
					end
				end
				curUser:SendData(frmHub:GetHubBotName(), "GenPass Help:\r\n"..
				"The syntax is <nr> <nr> <nr> <nr>\r\n"..
				"The nr's stands for how many lowcase, upercase, special chars and numbers you want\r\n"..
				"in that order. If you wish to have 0 of something, just write 0 in that place\r\n"..
				"If you dont wan't any special chars, the command is !genpass 1 1 0 2\r\n"..
				"That would give a pass like tV92. The min is 4 chars and 20 max") return 1
			end
		end,
		}
		if tCmds[cmd] then
			return tCmds[cmd](curUser, data)
		end
	end
end

function GenPass()
	local Char = ""
	if Table[1] > 0 then
		Char = Char..GenChar(97,122)
		Table[1] = Table[1] - 1
	end
	if Table[2] > 0 then
		Char = Char..GenChar(65,90)
		Table[2] = Table[2] - 1
	end
	if Table[3] > 0 then
		local X = GenChar(33,47)
			if X == "$" then
				X = GenChar(37,47)
			end
		Char = Char..X
		Table[3] = Table[3] - 1
	end
	if Table[4] > 0 then
		Char = Char..GenChar(48,57)
		Table[4] = Table[4] - 1
	end
	return Char
end

function GenChar(A,B)
	local String = string.char(math.random(A,B))
	return String
end
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

bastya_elvtars

Could you please upload to the resources' site to make sure it won't be lost again?  ::)
Everything could have been anything else and it would have just as much meaning.

Madman

Quote from: bastya_elvtars on 27 February, 2006, 00:49:50
Could you please upload to the resources' site to make sure it won't be lost again?? ::)

Yes, i'm gonna upload more then this.. ill upload all the scripts i'm posting now... =)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

SMF spam blocked by CleanTalk