--- ansh/src/ansh.c 2011/10/13 16:08:52 1.1.1.1.2.5 +++ ansh/src/ansh.c 2015/05/19 23:30:06 1.3.2.1 @@ -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.3.2.1 2015/05/19 23:30:06 misho Exp $ * ************************************************************************* The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 +Copyright 2004 - 2015 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -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,7 +74,7 @@ main(int argc, char **argv) { char ch, szDev[STRSIZ] = { 0 }; int h, len; - struct ether_addr ea; + struct e_ether_addr ea; srandomdev(); do { @@ -80,7 +83,9 @@ main(int argc, char **argv) Get1stEth(szDev, STRSIZ); - while ((ch = getopt(argc, argv, "hvut:d:")) != -1) + strlcpy(Key, DEFAULT_KEY, sizeof Key); + + 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 (!e_ether_aton(argv[0], &ea)) { printf("Error:: invalid mac ...\n"); return 1; }