wok-next rev 17457

Add icmpshell
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Dec 18 15:59:17 2014 +0100 (2014-12-18)
parents 7cb58ceb1fb0
children 5b11ba4415cf
files icmpshell/receipt icmpshell/stuff/ishd.u
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/icmpshell/receipt	Thu Dec 18 15:59:17 2014 +0100
     1.3 @@ -0,0 +1,27 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="icmpshell"
     1.7 +SOURCE="ish"
     1.8 +VERSION="0.2"
     1.9 +CATEGORY="network"
    1.10 +SHORT_DESC="A telnet-like protocol over icmp."
    1.11 +MAINTAINER="pascal.bellard@slitaz.org"
    1.12 +LICENSE="GPL2"
    1.13 +TARBALL="$SOURCE-v$VERSION.tar.gz"
    1.14 +WEB_SITE="http://icmpshell.sourceforge.net/"
    1.15 +WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
    1.16 +
    1.17 +# Rules to configure and make the package.
    1.18 +compile_rules()
    1.19 +{
    1.20 +	patch -p0 < $stuff/ishd.u
    1.21 +	make -j 1 linux
    1.22 +}
    1.23 +
    1.24 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.25 +genpkg_rules()
    1.26 +{
    1.27 +	mkdir -p $fs/usr/sbin
    1.28 +	cp $src/ish $fs/usr/sbin
    1.29 +	cp $src/ishd $fs/usr/sbin
    1.30 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/icmpshell/stuff/ishd.u	Thu Dec 18 15:59:17 2014 +0100
     2.3 @@ -0,0 +1,48 @@
     2.4 +--- ishell.h
     2.5 ++++ ishell.h
     2.6 +@@ -39,6 +39,7 @@
     2.7 +     uint8_t    type;           /* icmp type to send packet as       */
     2.8 +     uint16_t   packetsize;     /* packetsize of data                */
     2.9 +     uint32_t   seq;            /* sequence number tracking          */
    2.10 ++    char       *shell;
    2.11 + };
    2.12 + 
    2.13 + 
    2.14 +--- ishd.c
    2.15 ++++ ishd.c
    2.16 +@@ -28,6 +28,7 @@
    2.17 +     " -i <id>          Set session id; range: 0-65535 (default: 1515)\n"
    2.18 +     " -t <type>        Set ICMP type (default: 0)\n"
    2.19 +     " -p <packetsize>  Set packet size (default: 512)\n"
    2.20 ++    " -s <shell>       Set shell (default: /bin/sh)\n"
    2.21 +     "\nexample:\n"
    2.22 +     "%s -i 65535 -t 0 -p 1024\n"
    2.23 +     "\n", VERSION, program, program);
    2.24 +@@ -74,7 +75,7 @@
    2.25 +     int     n, fd, maxfd;
    2.26 +     char    send_buf[ish_info.packetsize], recv_buf[ish_info.packetsize];
    2.27 + 
    2.28 +-    fd = popen2("/bin/sh");
    2.29 ++    fd = popen2(ish_info.shell);
    2.30 +     sendhdr.cntrl = 0;
    2.31 + 
    2.32 +     while(1) {
    2.33 +@@ -122,7 +123,8 @@
    2.34 +     int     opt, sockfd;
    2.35 +     struct  sockaddr_in sin;
    2.36 + 
    2.37 +-    while((opt = getopt(argc, argv, "hdi:t:p:")) != -1) {
    2.38 ++    ish_info.shell = "/bin/sh";
    2.39 ++    while((opt = getopt(argc, argv, "hdi:t:p:s:")) != -1) {
    2.40 +         switch(opt) {
    2.41 +         	case 'h':
    2.42 +             	usage(argv[0]);
    2.43 +@@ -138,6 +140,8 @@
    2.44 +             	break;
    2.45 +         	case 'p':
    2.46 +             	ish_info.packetsize = atoi(optarg);
    2.47 ++		case 's':
    2.48 ++		ish_info.shell = optarg;
    2.49 +             	break;
    2.50 +         }
    2.51 +     }