Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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

In reply to Re: Masking Windows Passwords by zentara
in thread Masking Windows Passwords by nimdokk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2022-09-26 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (116 votes). Check out past polls.

    Notices?