wok-next diff icmpshell/stuff/patches/ishd.u @ rev 20661

Unification of the patch system
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu May 10 21:12:00 2018 +0300 (2018-05-10)
parents icmpshell/stuff/ishd.u@c9ac918ca706
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/icmpshell/stuff/patches/ishd.u	Thu May 10 21:12:00 2018 +0300
     1.3 @@ -0,0 +1,48 @@
     1.4 +--- ishell.h
     1.5 ++++ ishell.h
     1.6 +@@ -39,6 +39,7 @@
     1.7 +     uint8_t    type;           /* icmp type to send packet as       */
     1.8 +     uint16_t   packetsize;     /* packetsize of data                */
     1.9 +     uint32_t   seq;            /* sequence number tracking          */
    1.10 ++    char       *shell;
    1.11 + };
    1.12 + 
    1.13 + 
    1.14 +--- ishd.c
    1.15 ++++ ishd.c
    1.16 +@@ -28,6 +28,7 @@
    1.17 +     " -i <id>          Set session id; range: 0-65535 (default: 1515)\n"
    1.18 +     " -t <type>        Set ICMP type (default: 0)\n"
    1.19 +     " -p <packetsize>  Set packet size (default: 512)\n"
    1.20 ++    " -s <shell>       Set shell (default: /bin/sh)\n"
    1.21 +     "\nexample:\n"
    1.22 +     "%s -i 65535 -t 0 -p 1024\n"
    1.23 +     "\n", VERSION, program, program);
    1.24 +@@ -74,7 +75,7 @@
    1.25 +     int     n, fd, maxfd;
    1.26 +     char    send_buf[ish_info.packetsize], recv_buf[ish_info.packetsize];
    1.27 + 
    1.28 +-    fd = popen2("/bin/sh");
    1.29 ++    fd = popen2(ish_info.shell);
    1.30 +     sendhdr.cntrl = 0;
    1.31 + 
    1.32 +     while(1) {
    1.33 +@@ -122,7 +123,8 @@
    1.34 +     int     opt, sockfd;
    1.35 +     struct  sockaddr_in sin;
    1.36 + 
    1.37 +-    while((opt = getopt(argc, argv, "hdi:t:p:")) != -1) {
    1.38 ++    ish_info.shell = "/bin/sh";
    1.39 ++    while((opt = getopt(argc, argv, "hdi:t:p:s:")) != -1) {
    1.40 +         switch(opt) {
    1.41 +         	case 'h':
    1.42 +             	usage(argv[0]);
    1.43 +@@ -138,6 +140,8 @@
    1.44 +             	break;
    1.45 +         	case 'p':
    1.46 +             	ish_info.packetsize = atoi(optarg);
    1.47 ++		case 's':
    1.48 ++		ish_info.shell = optarg;
    1.49 +             	break;
    1.50 +         }
    1.51 +     }