From ee1ee97717c2c5e9e7060c61d52aa926d09a8618 Mon Sep 17 00:00:00 2001 From: Francesco Date: Fri, 3 Apr 2020 16:03:03 +0200 Subject: [PATCH] Fix for pptpsetup without specifing --password parameter Use also perl module Term::ReadKey in order to prevent display the password in clear text --- pptpsetup | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pptpsetup b/pptpsetup index bd9c8ce..e20d656 100755 --- a/pptpsetup +++ b/pptpsetup @@ -4,7 +4,9 @@ use strict; use Getopt::Long; use vars qw($VERSION); -$VERSION = '0.03'; +$VERSION = '0.04'; + +require Term::ReadKey; # Command-line parameters: @@ -53,10 +55,11 @@ sub create { # ask password if ( !$PASSWORD ) { - print "Password: "; - $PASSWORD = ; - chomp $PASSWORD; - $PASSWORD =~ s/([^\x20\x21\x23-\x7e])/sprintf ("\\x%02x", ord ($1))/eg; + Term::ReadKey::ReadMode('noecho'); + print "Password: "; + $PASSWORD = Term::ReadKey::ReadLine(0); + $PASSWORD =~ s/\R\z//; + Term::ReadKey::ReadMode('restore'); } # put '\' between domain and username IF specified a domain