version 1.1.1.1.2.1, 2011/10/07 13:41:26
|
version 1.1.1.1.2.2, 2011/10/10 07:50:18
|
Line 10
|
Line 10
|
#include "ansh.h" |
#include "ansh.h" |
|
|
|
|
int Verbose, Kill; | int Timeout, Verbose, Kill; |
u_int Crypted; |
u_int Crypted; |
|
|
extern char compiled[], compiledby[], compilehost[]; |
extern char compiled[], compiledby[], compilehost[]; |
Line 23 Usage()
|
Line 23 Usage()
|
" Syntax: ansh [options] <connect2host>\n\n" |
" Syntax: ansh [options] <connect2host>\n\n" |
"\t-d <dev>\tBind to host interface, like 'em0' (default is first host interface)\n" |
"\t-d <dev>\tBind to host interface, like 'em0' (default is first host interface)\n" |
"\t-i <id>\tService ID (default is 42)\n" |
"\t-i <id>\tService ID (default is 42)\n" |
|
"\t-t <timeout>\tClient session timeout (default is 0 sec)\n" |
"\t-u\t\tSwitch to unencrypted traffic between hosts\n" |
"\t-u\t\tSwitch to unencrypted traffic between hosts\n" |
"\t-v\t\tVerbose (more -v, more verbosity ...)\n" |
"\t-v\t\tVerbose (more -v, more verbosity ...)\n" |
"\t-h\t\tThis help screen!\n" |
"\t-h\t\tThis help screen!\n" |
Line 37 main(int argc, char **argv)
|
Line 38 main(int argc, char **argv)
|
u_short id = ANSH_ID; |
u_short id = ANSH_ID; |
struct ether_addr ea; |
struct ether_addr ea; |
|
|
|
srandomdev(); |
|
do { |
|
Crypted = (u_int) random() % UINT_MAX; |
|
} while (!Crypted); |
|
|
Get1stEth(szDev, STRSIZ); |
Get1stEth(szDev, STRSIZ); |
|
|
while ((ch = getopt(argc, argv, "hvui:d:")) != -1) | while ((ch = getopt(argc, argv, "hvui:t:d:")) != -1) |
switch (ch) { |
switch (ch) { |
|
case 't': |
|
Timeout = abs(strtol(optarg, NULL, 0)); |
|
break; |
case 'd': |
case 'd': |
strlcpy(szDev, optarg, sizeof szDev); |
strlcpy(szDev, optarg, sizeof szDev); |
break; |
break; |