From 65662db674cb3529331dc5db83be9bd9220f072d Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 10 Dec 2019 13:41:57 -0600 Subject: Read password from stdin --- src/hashpwd.cpp | 43 ++++++++++++++++++++++++++++++++++++++----- src/ubpasswd.sh | 23 ++++++++++++++++++++--- 2 files changed, 58 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/hashpwd.cpp b/src/hashpwd.cpp index 6bc322c..1ea3e2c 100644 --- a/src/hashpwd.cpp +++ b/src/hashpwd.cpp @@ -153,6 +153,7 @@ void usage(void) " -V version" << endl << " -v verbose" << endl << " -d did Device ID (serial #)" << endl << + " -i Read password from standard input" << endl << " -m mac Ethernet mac address" << endl << " -p password" << endl << " -u uuid UUID (base 16)" << endl << @@ -163,17 +164,20 @@ void usage(void) } int main(int argc, char **argv) { - int opt = 0, p = 0, d = 0, m = 0, u=0; + int opt = 0, p = 0, d = 0, m = 0, u=0, iopt = 0; + char c; unsigned long long fudge = 0; short unsigned int prefix; string did, mac, pwd, salt, uuid; + int supplied_password = 0; - while ((opt = getopt(argc,argv,"Vd:m:p:u:v")) != EOF) + while ((opt = getopt(argc,argv,"Vd:im:p:u:v")) != EOF) switch(opt) { case 'V': cout << MYVERSION << endl; exit(0); case 'v': v = 1; cout << " verbose" <