--- ansh/src/ansh.c 2011/10/13 16:08:52 1.1.1.1.2.5 +++ ansh/src/ansh.c 2011/10/14 09:04:04 1.1.1.1.2.7 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ - * $Id: ansh.c,v 1.1.1.1.2.5 2011/10/13 16:08:52 misho Exp $ + * $Id: ansh.c,v 1.1.1.1.2.7 2011/10/14 09:04:04 misho Exp $ * ************************************************************************* The ELWIX and AITNET software is distributed under the following @@ -47,8 +47,10 @@ SUCH DAMAGE. #include "ansh.h" -int Timeout, Verbose, Kill; +intptr_t Kill; +int Timeout, Verbose; u_int Crypted; +char Key[STRSIZ]; extern char compiled[], compiledby[], compilehost[]; @@ -60,6 +62,7 @@ Usage() " Syntax: ansh [options] \n\n" "\t-d \tBind to host interface, like 'em0' (default is first host interface)\n" "\t-t \tClient session timeout (default is 0 sec)\n" + "\t-k \tService cipher key\n" "\t-u\t\tSwitch to unencrypted traffic between hosts\n" "\t-v\t\tVerbose (more -v, more verbosity ...)\n" "\t-h\t\tThis help screen!\n" @@ -71,16 +74,18 @@ main(int argc, char **argv) { char ch, szDev[STRSIZ] = { 0 }; int h, len; - struct ether_addr ea; + struct io_ether_addr ea; srandomdev(); do { Crypted = (u_int) random() % UINT_MAX; } while (!Crypted); + strlcpy(Key, DEFAULT_KEY, sizeof Key); + Get1stEth(szDev, STRSIZ); - while ((ch = getopt(argc, argv, "hvut:d:")) != -1) + while ((ch = getopt(argc, argv, "hvut:d:k:")) != -1) switch (ch) { case 't': Timeout = abs(strtol(optarg, NULL, 0)); @@ -88,6 +93,9 @@ main(int argc, char **argv) case 'd': strlcpy(szDev, optarg, sizeof szDev); break; + case 'k': + strlcpy(Key, optarg, sizeof Key); + break; case 'u': Crypted ^= Crypted; break; @@ -105,7 +113,7 @@ main(int argc, char **argv) printf("Error:: not specified mac for connect ...\n"); return 1; } - if (!ether_aton_r(argv[0], &ea)) { + if (!io_ether_aton(argv[0], &ea)) { printf("Error:: invalid mac ...\n"); return 1; }