Ruario's Journal [extract]

2022-01-27


11:30 +0100


Re: On HTTP vs Gemini simplicity


@alexey raises some fair points about HTTP servers.


Though, I figured I woud try his one-liner HTTP server example.


$ nc -lk -p 1234 -e /bin/sh -c 'printf "HTTP/1.0 200 OK\r\n\r\n"; sed "/^.$/q"'
nc: invalid option -- 'k'
nc -h for help

Some information about my system.


$ cat /etc/os-release 
NAME=Slackware
VERSION="15.0"
ID=slackware
VERSION_ID=15.0
PRETTY_NAME="Slackware 15.0 x86_64"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:slackware:slackware_linux:15.0"
HOME_URL="http://slackware.com/"
SUPPORT_URL="http://www.linuxquestions.org/questions/slackware-14/"
BUG_REPORT_URL="http://www.linuxquestions.org/questions/slackware-14/"
VERSION_CODENAME=stable

Here is the package info for the netcat installed on this version of Slackware.


$ head -n 16 /var/lib/pkgtools/packages/nc-1.10-x86_64-4
PACKAGE NAME:     nc-1.10-x86_64-4
COMPRESSED PACKAGE SIZE:     56.0K
UNCOMPRESSED PACKAGE SIZE:     170K
PACKAGE LOCATION: /var/log/mount/treecache/slackware64/n/nc-1.10-x86_64-4.txz
PACKAGE DESCRIPTION:
nc: nc (Netcat network utility)
nc:
nc: Netcat, or "nc" as the actual program is named, is a simple utility
nc: which reads and writes data across network connections, using TCP or
nc: UDP protocol. It is designed to be a reliable "back-end" tool that
nc: can be used directly or easily driven by other programs and scripts.
nc: At the same time, it is a feature-rich network debugging and
nc: exploration tool, since it can create almost any kind of connection
nc: you would need and has several interesting built-in capabilities.
nc: Netcat was written by *Hobbit* <hobbit@avian.org>, and is a product
nc: of Avian Research.

As an additional test I tried on one of the macOS machines in our test lab.


$ nc -lk -p 1234 -e /bin/sh -c 'printf "HTTP/1.0 200 OK\r\n\r\n"; sed "/^.$/q"'
nc: invalid option -- e
usage: nc [-46AacCDdEFhklMnOortUuvz] [-K tc] [-b boundif] [-i interval] [-p source_port]
          [--apple-recv-anyif] [--apple-awdl-unres]
          [--apple-boundif ifbound]
          [--apple-no-cellular] [--apple-no-expensive]
          [--apple-no-flowadv] [--apple-tcp-timeout conntimo]
          [--apple-tcp-keepalive keepidle] [--apple-tcp-keepintvl keepintvl]
          [--apple-tcp-keepcnt keepcnt] [--apple-tclass tclass]
          [--tcp-adp-rtimo num_probes] [--apple-initcoproc-allow]
          [--apple-tcp-adp-wtimo num_probes]
          [--setsockopt-later] [--apple-no-connectx]
          [--apple-delegate-pid pid] [--apple-delegate-uuid uuid]
          [--apple-kao] [--apple-ext-bk-idle]
          [--apple-netsvctype svc] [---apple-nowakefromsleep]
          [--apple-notify-ack] [--apple-sockev]
          [--apple-tos tos] [--apple-tos-cmsg]
          [-s source_ip_address] [-w timeout] [-X proxy_version]
          [-x proxy_address[:port]] [hostname] [port[s]]

Some info on that machine.


$ uname -a
Darwin megatron.viv.osl 19.6.0 Darwin Kernel Version 19.6.0: Mon Apr 12 20:57:45 PDT 2021; root:xnu-6153.141.28.1~1/RELEASE_X86_64 x86_64

🤷


@alexey what kind of fancy-ass version of netcat are you running?



📝 Journal [complete]



ruario.flounder.online/