Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Masking Windows Passwords

by zentara (Archbishop)
on Sep 29, 2011 at 18:04 UTC ( [id://928637]=note: print w/replies, xml ) Need Help??


in reply to Masking Windows Passwords

If you can use Tk , this will do it in a GUI. It pops the GUI, gets the user and pass, then undefines the password after it is used to authorize.
#!/usr/bin/perl use warnings; use strict; use Tk; my ($user, $password); my $mw = MainWindow->new; $mw->title("Password Entry"); $mw->withdraw; # let size be determined before centering $mw->fontCreate('big', -weight=>'bold', -size=> 14 ); my $buttom = $mw -> Button(-text => "SUBMIT", -font => 'big', -bg => 'white', -command => \&somesub) ->pack(-side => 'bottom',-anchor => 'center'); my $label = $mw -> Label(-text => "Enter User and Password", -font => 'big', -bg => 'white', )->pack(-side => 'top', -anchor => 'center'); my $label1 = $mw -> Label(-justify => 'left', -text => "User: ", -font => 'big', -bg => 'white', ) ->pack(-side => 'left', -expand => 1); my $entry = $mw -> Entry(-selectborderwidth => 10, -font => 'big', -bg => 'white', )->pack(-side => 'left', -expand => 1); ############################################################### my $label2 = $mw -> Label(-justify => 'left', -text => "Password: ", -font => 'big', -bg => 'white',) ->pack(-side => 'left', -anchor => 'n'); my $entry1 = $mw -> Entry(-selectborderwidth => 10, -show => "*", -font => 'big', -bg => 'white', )->pack(-side => 'top', -anchor => 'w'); ############################################################## # an enter in the password entry will submit $entry1->bind('<Return>',[\&somesub]); $entry->focus; center($mw); MainLoop; sub somesub { $user = $entry->get; chomp $user; $password = $entry1->get; chomp $password; #print "$user $password"; $mw -> destroy; } sub center { my $win = shift; $win->withdraw; # Hide the window while we move it about $win->update; # Make sure width and height are current # Center window my $xpos = int(($win->screenwidth - $win->width ) / 2 ); my $ypos = int(($win->screenheight - $win->height ) / 2 ); $win->geometry("+$xpos+$ypos"); $win->deiconify; # Show the window again } # now Tk is finished, you can send the $user and $password to your ser +ver # your script continues here, the prints are just for demo purposes he +re print "Hit Enter to continue and send info to server\n"; <>; # send to server or wherever print "user->$user password->$password\n"; # now undefine password $password = undef; print "Hit Enter to exit, password is undefined\n"; <>;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://928637]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-03-29 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found