* Reads commands from the command line:
* test host [commands...]
* -s file file sends file to host
+ * -S file file sends encrypted file to host
* -i file sends instruction file to host
* -x file executes instructions
* -n nop
file = argv[++i];
rfile = argv[++i];
fprintf(stderr, "Sending file %s to %s as %s\n", file, host, rfile);
- send_file(file, rfile);
+ send_file(file, rfile, 0);
+ break;
+ case 'S':
+ if (i+2 >= argc) usage();
+ file = argv[++i];
+ rfile = argv[++i];
+ fprintf(stderr, "Sending (encrypted) file %s to %s as %s\n", file, host, rfile);
+ send_file(file, rfile, 1);
break;
case 'i':
if (i+1 >= argc) usage();
mktemp(buf);
fprintf(stderr, "Sending instructions %s to %s as %s\n",
file, host, buf);
- send_file(file, buf);
+ send_file(file, buf, 0);
break;
case 'I':
if (i+2 >= argc) usage();
strcpy(buf, rfile);
fprintf(stderr, "Sending instructions %s to %s as %s\n",
file, host, buf);
- send_file(file, buf);
+ send_file(file, buf, 0);
break;
case 'x':
fprintf(stderr, "Executing instructions %s on %s\n", buf, host);
fprintf(stderr, "Usage: test host [commands...]\n");
fprintf(stderr, " Commands are:\n");
fprintf(stderr, "\t-s srcfile dstfile\tsends file\n");
+ fprintf(stderr, "\t-S srcfile dstfile\tsends encrypted file\n");
fprintf(stderr, "\t-i srcfile\t\tsends instructions\n");
fprintf(stderr, "\t-I srcfile dstfile\tsends instructions\n");
fprintf(stderr, "\t-x\t\texecutes last instructions\n");