Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- [Program] PassGen
- @version 1.0, 09/02/2014, HK98
- @author Hellkid98, HK98
- --]]
- local args = {...}
- --# Checking for errors
- if #args < 2 then
- error( "Usage: <Lenght> <Output file>", 0 )
- end
- if not tonumber( args[1] ) then
- error( "Usage: <Lenght> <Output file>", 0 )
- end
- if fs.exists( args[2] ) then
- error( "File exists!\nUsage: <Lenght> <Output file>", 0 )
- end
- --# All the available characters
- local characters = {
- "A","B","C","D","E","F","G","H","I","J","K","L",
- "M","N","O","P","Q","R","S","T","U","V","W","X",
- "Y","Z","0","1","2","3","4","5","6","7","8","9",
- }
- local str = ""
- for i = 1, tonumber( args[1] ) do
- local s = characters[math.random( 1, #characters )]
- if math.random(1,2) % 2 == 0 then
- s = string.lower( s )
- end
- str = str .. s
- end
- local f = fs.open( args[2], "w" )
- f.writeLine( str )
- f.close()
- print( "Password generated: " .. str )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement