diff options
author | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2010-10-01 12:24:39 +0200 |
---|---|---|
committer | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2010-10-01 12:24:39 +0200 |
commit | b898569df5c7388500d76d9b96f9111ba09c2ff3 (patch) | |
tree | e336e5dd9d033785b86aad7c58dfb62689b6c8de | |
parent | 79153f655b1f8af1df6b36875c2d0b61386b33a9 (diff) | |
download | MAC-Telnet-b898569df5c7388500d76d9b96f9111ba09c2ff3.tar.gz MAC-Telnet-b898569df5c7388500d76d9b96f9111ba09c2ff3.zip |
Made the password parameter optional; You may now write your password in a prompt instead of polluting your history with passwords.
-rw-r--r-- | main.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -18,6 +18,7 @@ */ #include <stdlib.h> #include <stdio.h> +#include <unistd.h> #include <fcntl.h> #include <signal.h> #include <arpa/inet.h> @@ -200,21 +201,28 @@ int main (int argc, char **argv) { fd_set read_fds; if (argc < 4) { - fprintf(stderr, "Usage: %s <ifname> <MAC> <username> <password>\n", argv[0]); + fprintf(stderr, "Usage: %s <ifname> <MAC> <username> [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)); |