wok-6.x view icmpshell/stuff/ishd.u @ rev 19802
pgrouting: update bdeps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Feb 25 21:46:07 2017 +0100 (2017-02-25) |
parents | |
children |
line source
1 --- ishell.h
2 +++ ishell.h
3 @@ -39,6 +39,7 @@
4 uint8_t type; /* icmp type to send packet as */
5 uint16_t packetsize; /* packetsize of data */
6 uint32_t seq; /* sequence number tracking */
7 + char *shell;
8 };
11 --- ishd.c
12 +++ ishd.c
13 @@ -28,6 +28,7 @@
14 " -i <id> Set session id; range: 0-65535 (default: 1515)\n"
15 " -t <type> Set ICMP type (default: 0)\n"
16 " -p <packetsize> Set packet size (default: 512)\n"
17 + " -s <shell> Set shell (default: /bin/sh)\n"
18 "\nexample:\n"
19 "%s -i 65535 -t 0 -p 1024\n"
20 "\n", VERSION, program, program);
21 @@ -74,7 +75,7 @@
22 int n, fd, maxfd;
23 char send_buf[ish_info.packetsize], recv_buf[ish_info.packetsize];
25 - fd = popen2("/bin/sh");
26 + fd = popen2(ish_info.shell);
27 sendhdr.cntrl = 0;
29 while(1) {
30 @@ -122,7 +123,8 @@
31 int opt, sockfd;
32 struct sockaddr_in sin;
34 - while((opt = getopt(argc, argv, "hdi:t:p:")) != -1) {
35 + ish_info.shell = "/bin/sh";
36 + while((opt = getopt(argc, argv, "hdi:t:p:s:")) != -1) {
37 switch(opt) {
38 case 'h':
39 usage(argv[0]);
40 @@ -138,6 +140,8 @@
41 break;
42 case 'p':
43 ish_info.packetsize = atoi(optarg);
44 + case 's':
45 + ish_info.shell = optarg;
46 break;
47 }
48 }