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 21 Oct 2014, 13:02
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 Posts_count  
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   461 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  202 Time(s) 
Back to top
View user's profile Send_private_message 
technosaurus


Joined: 18 May 2008
Posts: 4353

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:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


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