wok-next annotate icmpshell/stuff/ishd.u @ rev 20237

Add Qt5 applications: notes, qtav, miam-player
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Nov 06 15:59:23 2017 +0200 (2017-11-06)
parents
children
rev   line source
pascal@17457 1 --- ishell.h
pascal@17457 2 +++ ishell.h
pascal@17457 3 @@ -39,6 +39,7 @@
pascal@17457 4 uint8_t type; /* icmp type to send packet as */
pascal@17457 5 uint16_t packetsize; /* packetsize of data */
pascal@17457 6 uint32_t seq; /* sequence number tracking */
pascal@17457 7 + char *shell;
pascal@17457 8 };
pascal@17457 9
pascal@17457 10
pascal@17457 11 --- ishd.c
pascal@17457 12 +++ ishd.c
pascal@17457 13 @@ -28,6 +28,7 @@
pascal@17457 14 " -i <id> Set session id; range: 0-65535 (default: 1515)\n"
pascal@17457 15 " -t <type> Set ICMP type (default: 0)\n"
pascal@17457 16 " -p <packetsize> Set packet size (default: 512)\n"
pascal@17457 17 + " -s <shell> Set shell (default: /bin/sh)\n"
pascal@17457 18 "\nexample:\n"
pascal@17457 19 "%s -i 65535 -t 0 -p 1024\n"
pascal@17457 20 "\n", VERSION, program, program);
pascal@17457 21 @@ -74,7 +75,7 @@
pascal@17457 22 int n, fd, maxfd;
pascal@17457 23 char send_buf[ish_info.packetsize], recv_buf[ish_info.packetsize];
pascal@17457 24
pascal@17457 25 - fd = popen2("/bin/sh");
pascal@17457 26 + fd = popen2(ish_info.shell);
pascal@17457 27 sendhdr.cntrl = 0;
pascal@17457 28
pascal@17457 29 while(1) {
pascal@17457 30 @@ -122,7 +123,8 @@
pascal@17457 31 int opt, sockfd;
pascal@17457 32 struct sockaddr_in sin;
pascal@17457 33
pascal@17457 34 - while((opt = getopt(argc, argv, "hdi:t:p:")) != -1) {
pascal@17457 35 + ish_info.shell = "/bin/sh";
pascal@17457 36 + while((opt = getopt(argc, argv, "hdi:t:p:s:")) != -1) {
pascal@17457 37 switch(opt) {
pascal@17457 38 case 'h':
pascal@17457 39 usage(argv[0]);
pascal@17457 40 @@ -138,6 +140,8 @@
pascal@17457 41 break;
pascal@17457 42 case 'p':
pascal@17457 43 ish_info.packetsize = atoi(optarg);
pascal@17457 44 + case 's':
pascal@17457 45 + ish_info.shell = optarg;
pascal@17457 46 break;
pascal@17457 47 }
pascal@17457 48 }