--- ansh/src/ansh.c 2011/10/07 13:41:26 1.1.1.1.2.1 +++ ansh/src/ansh.c 2011/10/10 07:50:18 1.1.1.1.2.2 @@ -3,14 +3,14 @@ * by Michael Pounov * * $Author: misho $ - * $Id: ansh.c,v 1.1.1.1.2.1 2011/10/07 13:41:26 misho Exp $ + * $Id: ansh.c,v 1.1.1.1.2.2 2011/10/10 07:50:18 misho Exp $ * *************************************************************************/ #include "global.h" #include "ansh.h" -int Verbose, Kill; +int Timeout, Verbose, Kill; u_int Crypted; extern char compiled[], compiledby[], compilehost[]; @@ -23,6 +23,7 @@ Usage() " Syntax: ansh [options] \n\n" "\t-d \tBind to host interface, like 'em0' (default is first host interface)\n" "\t-i \tService ID (default is 42)\n" + "\t-t \tClient session timeout (default is 0 sec)\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" @@ -37,10 +38,18 @@ main(int argc, char **argv) u_short id = ANSH_ID; struct ether_addr ea; + srandomdev(); + do { + Crypted = (u_int) random() % UINT_MAX; + } while (!Crypted); + Get1stEth(szDev, STRSIZ); - while ((ch = getopt(argc, argv, "hvui:d:")) != -1) + while ((ch = getopt(argc, argv, "hvui:t:d:")) != -1) switch (ch) { + case 't': + Timeout = abs(strtol(optarg, NULL, 0)); + break; case 'd': strlcpy(szDev, optarg, sizeof szDev); break;