From b898569df5c7388500d76d9b96f9111ba09c2ff3 Mon Sep 17 00:00:00 2001 From: Håkon Nessjøen Date: Fri, 1 Oct 2010 12:24:39 +0200 Subject: Made the password parameter optional; You may now write your password in a prompt instead of polluting your history with passwords. --- main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 7c62abb..a9dd7eb 100644 --- a/main.c +++ b/main.c @@ -18,6 +18,7 @@ */ #include #include +#include #include #include #include @@ -200,21 +201,28 @@ int main (int argc, char **argv) { fd_set read_fds; if (argc < 4) { - fprintf(stderr, "Usage: %s \n", argv[0]); + fprintf(stderr, "Usage: %s [password]\n", argv[0]); if (argc > 1) { - fprintf(stderr, "\nRequired parameters:\n"); + fprintf(stderr, "\nParameters:\n"); fprintf(stderr, " ifname Network interface that the RouterOS resides on. (example: eth0)\n"); fprintf(stderr, " MAC MAC-Address of the RouterOS device. Use mndp to discover them.\n"); fprintf(stderr, " username Your username.\n"); fprintf(stderr, " password Your password.\n"); } return 1; + } else if (argc == 4) { + char *tmp; + tmp = getpass("Passsword: "); + strncpy(password, tmp, 254); + /* security */ + memset(tmp, 0, strlen(tmp)); + } else { + strncpy(password, argv[4], 254); } ether_aton_r(argv[2], (struct ether_addr *)dstmac); strncpy(username, argv[3], 254); - strncpy(password, argv[4], 254); srand(time(NULL)); -- cgit v1.2.3