Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 30 Sep 2014, 12:32
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
password generator
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [12 Posts]  
Author Message
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Wed 07 Dec 2011, 06:00    Post subject:  

Decided to create a gtkdialog front-end, which incorporates the above ideas in addition to making sure the end result has numbers, symbols, and letters. Generates to editable entry box

front end:

Code:

 
#!/bin/sh

## Front end for password-generator.sh. jpeps 12/11


touch /tmp/pass
export GEN="/usr/local/passgen/password-generate.sh"

Generate() {

"$GEN" >/tmp/pass



## check for symbols & numbers
 
while ([ ! "$var" ]); do

 # check for numbers
 var="$(cat /tmp/pass | grep "[0-9]")"
 ## check for sympbols
 [ "$var" ] &&  var="$(cat /tmp/pass | sed 's/[0-9a-Z]//g')"   

 ## if no sybols and numbers, re-generate
 [ "$var" ] || "$GEN" >/tmp/pass
done
}
export -f Generate


export MAIN_DIALOG='
<window title="Random Password" default-width="210">
  <vbox>
    <entry>
       <variable>ENTRY</variable>
       <input file>/tmp/pass</input>
    </entry>
    <hbox>
      <button tooltip-text="Generate new password" space-expand="true">
         <input file icon="gexec"></input>
         <label>" Generate "</label>
         <action>Generate</action>
         <action>refresh:ENTRY</action>
      </button>
   
      <button cancel></button>
    </hbox>
  </vbox>
</window>
'

gtkdialog --program=MAIN_DIALOG
rm /tmp/pass
passgen.png
 Description   
 Filesize   9.03 KB
 Viewed   460 Time(s)

passgen.png

passgen-1.0.pet
Description  Menu/System|Password Generator
exec: "pass-gen"
pet

 Download 
Filename  passgen-1.0.pet 
Filesize  1.41 KB 
Downloaded  198 Time(s) 
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Thu 08 Dec 2011, 06:28    Post subject:  

Code:
tr -cd [0-z] </dev/urandom |head -c ${PASSWORDLENGTH:-10}

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Thu 08 Dec 2011, 12:25    Post subject:  

technosaurus wrote:
Code:
tr -cd [0-z] </dev/urandom |head -c ${PASSWORDLENGTH:-10}


Seems to work better:
Code:

tr -cd '0-z' </dev/urandom |head -c ${PASSWORDLENGTH:-10}


For some reason, this tended to hang up from within a program, requiring me to kill the process.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [12 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2024s ][ Queries: 12 (0.0387s) ][ GZIP on ]