-- 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
Could you please upload to the resources' site to make sure it won't be lost again? ::)
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... =)