73 lines
1.7 KiB
Plaintext
73 lines
1.7 KiB
Plaintext
module SetUp{
|
|
form 80, 50
|
|
print "Password Generator"
|
|
|
|
input "Set seed (press enter without number to skip):"; seed$
|
|
seed$=trim$(seed$)
|
|
' we always push a new seed - there is a two stage queue
|
|
if len(seed$)>0 then
|
|
x=random(!val(seed$))
|
|
else
|
|
x=random(!timecount)
|
|
end if
|
|
def zone(x, a, b) = x >=a and x<=b
|
|
do
|
|
Input "Length for password (6 to 30), Number of passwords (1 to 20):", a%, b%
|
|
until zone(a%, 6, 30) and zone(b%, 1, 20)
|
|
print "choose mode:";
|
|
menu "safe", "unsafe"
|
|
unsafe= menu=2
|
|
if unsafe then print "unsafe" else print "safe"
|
|
menu ' clear menu
|
|
flush
|
|
data not unsafe, a%, b%
|
|
}
|
|
module pass (safe as boolean, a1 as integer, b1 as integer) {
|
|
dim a(0 to 4) as string, b(1 to 4) as boolean
|
|
if safe then
|
|
a(1) := "346789", "ABCDEFGHJKLMNPQRTUVWXY", "abcdefghijkmnopqrstuvwxyz"
|
|
else
|
|
a(1) := "0123456789", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"
|
|
end if
|
|
a(4) = "!" + """" + "#$%&'()*+,-./:;<=>?@[]^_{|}~"
|
|
a(0)= a(1) + a(2) + a(3) + a(4)
|
|
string s, d
|
|
integer k=1
|
|
while b1
|
|
do
|
|
s=""
|
|
for j=1 to 4: b(j)=false:next
|
|
for i=1 to a1
|
|
s+=mid$((a(0)), random(1, len(a(0))), 1)
|
|
for j=1 to 4
|
|
if instr(a(j), d)>0 then b(j)=true
|
|
next
|
|
next
|
|
until b(1) and b(2) and b(3) and b(4)
|
|
menu + format$("{0::-2}. {1}", k, s)
|
|
b1--
|
|
k++
|
|
end while
|
|
x=random(!) ' pop the old seed back
|
|
}
|
|
module copy2clipboard {
|
|
if menuitems>0 then
|
|
print "choose one:";
|
|
menu !
|
|
if menu>0 then
|
|
m=menu
|
|
else
|
|
m=1
|
|
end if
|
|
print mid$(menu$(m), 5)
|
|
try {
|
|
clipboard mid$(menu$(m), 5)
|
|
print "clipboard set"
|
|
}
|
|
end if
|
|
}
|
|
' now we call the three parts - modules
|
|
setup
|
|
pass ' paraneters are in stack of values
|
|
copy2clipboard
|