Is it possible to listen to a TCP port only with a shell, with no additional tools?TCP port numberHost information with TCP portTCP Handshake and port numbersTCP port numbers reused and TCP RetransmissionHitting Ephemeral TCP Port Exhaustionnotify when a TCP port start listeningrsyslog server listen only on tcp 514tcp source port is not randomlyCatch TCP packets with router
What kind of tools would be used to carve bone?
Looking for PC graphics demo software from the early 90s called "Unreal"
Conveying the idea of " judge a book by its cover" by " juger un livre par sa couverture"
What is this dial on my old SLR for?
Does journal access significantly influence choice in which journal to publish in?
Why is it so hard to land on The Moon?
AD823 current sense
Why did Batman design Robin's suit with only the underwear without pants?
I'm largest when I'm five, what am I?
XGBoost validation for number of trees
Why is matter-antimatter asymmetry surprising, if asymmetry can be generated by a random walk in which particles go into black holes?
How effective are nunchaku as a choking weapon?
Is it fine to ask this kind of question to the corresponding author of a paper?
What can I do to avoid potential charges for bribery?
Can I perform Umrah while on a Saudi Arabian visit e-visa
How are steel imports supposed to threaten US national security?
Why can I ping 10.0.0.0/8 addresses from a 192.168.1.0/24 subnet?
Are there any privately owned large commercial airports?
useState hook setter incorrectly overwrites state
What is this cast-iron device on my water supply pipe?
Can I use I2C over 2m cables?
Can a surprised monster use lair actions if they roll an initiative above 20?
Did Feynman cite a fallacy about only circles having the same width in all directions as a reason for the Challenger disaster?
Is there any way today to recover/dump 2M disks?
Is it possible to listen to a TCP port only with a shell, with no additional tools?
TCP port numberHost information with TCP portTCP Handshake and port numbersTCP port numbers reused and TCP RetransmissionHitting Ephemeral TCP Port Exhaustionnotify when a TCP port start listeningrsyslog server listen only on tcp 514tcp source port is not randomlyCatch TCP packets with router
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I need a very simple web server on a very small embedded system with a MISP processor. I thought that the simplest server could be a shell script listening to a TCP port.
The problem is that the system doesn't have even perl. Only some basic shell /bin/sh. I searched the web for "how to listen to a port from a shell", but answers I found all referred to some other tools like nc, which I don't have.
Is it even possible to do?
The system, it's a router, has busybox installed and some other binaries in the /bin directory, they are:
#ls /bin
chown df fatattr gzip login mount
ping rm shuf touch usleep
busybox comgt dmesg fgrep hostname ls
mv ping6 rmdir sleep true vi
busybox-new cp echo flock ip mkdir
netstat printf sdparm split umount watch
cat date egrep grep kill mknod
nice ps sed sync uname wget
chmod dd false gunzip ln more
pidof pwd sh tar unlink zcat
And the busybox:
Currently defined functions:
[, arp, ash, awk, basename, busybox, cat, chmod, chown, cp, crond,
cut,date, dd, df, dirname, dmesg, du, echo, egrep, env, expr, false,
fdisk, fgrep, find, free, ftpget, getty, grep, head, hexdump,
hostname, ifconfig, init, insmod, ip, kill, killall, klogd, ln,
login, ls, lsmod, md5sum, mkdir, mknod, mkswap, modprobe, more,
mount, mv, netstat, nslookup, passwd, pidof, ping, ping6, ps, pwd,
readlink, reboot, renice, rm, rmdir, rmmod, route, sed, seq, sh,
sleep, sort, swapoff, swapon, sync, sysctl, syslogd, tail, tar,
taskset, test, tftp, time, top, touch, tr, traceroute, true, udhcpd,
umount, uname, unzip, uptime, usleep, vi, watch, wc, which,
xargs, yes
It has some other stuff too in other locations from the PATH, but no nc, no httpd or something like that
networking linux-networking tcp shell shell-scripting
add a comment
|
I need a very simple web server on a very small embedded system with a MISP processor. I thought that the simplest server could be a shell script listening to a TCP port.
The problem is that the system doesn't have even perl. Only some basic shell /bin/sh. I searched the web for "how to listen to a port from a shell", but answers I found all referred to some other tools like nc, which I don't have.
Is it even possible to do?
The system, it's a router, has busybox installed and some other binaries in the /bin directory, they are:
#ls /bin
chown df fatattr gzip login mount
ping rm shuf touch usleep
busybox comgt dmesg fgrep hostname ls
mv ping6 rmdir sleep true vi
busybox-new cp echo flock ip mkdir
netstat printf sdparm split umount watch
cat date egrep grep kill mknod
nice ps sed sync uname wget
chmod dd false gunzip ln more
pidof pwd sh tar unlink zcat
And the busybox:
Currently defined functions:
[, arp, ash, awk, basename, busybox, cat, chmod, chown, cp, crond,
cut,date, dd, df, dirname, dmesg, du, echo, egrep, env, expr, false,
fdisk, fgrep, find, free, ftpget, getty, grep, head, hexdump,
hostname, ifconfig, init, insmod, ip, kill, killall, klogd, ln,
login, ls, lsmod, md5sum, mkdir, mknod, mkswap, modprobe, more,
mount, mv, netstat, nslookup, passwd, pidof, ping, ping6, ps, pwd,
readlink, reboot, renice, rm, rmdir, rmmod, route, sed, seq, sh,
sleep, sort, swapoff, swapon, sync, sysctl, syslogd, tail, tar,
taskset, test, tftp, time, top, touch, tr, traceroute, true, udhcpd,
umount, uname, unzip, uptime, usleep, vi, watch, wc, which,
xargs, yes
It has some other stuff too in other locations from the PATH, but no nc, no httpd or something like that
networking linux-networking tcp shell shell-scripting
Well, would be useful to know what commands/packages are available. For example:busyboxhas a build-in http daemon.
– duenni
8 hours ago
@duenni I've added a list
– user907860
8 hours ago
@duenni it says httpd: applet not found .
– user907860
7 hours ago
1
Mhh, you also have abusybox-new, I wonder what is available with that. Anyway you can have multiple instances of busybox installed, so you could compile busybox yourself with the httpd option enabled and install it.
– duenni
7 hours ago
1
@duenni I looked into it and it seemed to have nothing useful for meegrep, ether-wake, fatattr, fgrep, flock, grep, gunzip, gzip, nice, printf, shuf, split, udhcpc, unlink, wget, zcat. But the router has alighthttpdbinary, found it withfind / -name "*http*". I'll try to research this one
– user907860
7 hours ago
add a comment
|
I need a very simple web server on a very small embedded system with a MISP processor. I thought that the simplest server could be a shell script listening to a TCP port.
The problem is that the system doesn't have even perl. Only some basic shell /bin/sh. I searched the web for "how to listen to a port from a shell", but answers I found all referred to some other tools like nc, which I don't have.
Is it even possible to do?
The system, it's a router, has busybox installed and some other binaries in the /bin directory, they are:
#ls /bin
chown df fatattr gzip login mount
ping rm shuf touch usleep
busybox comgt dmesg fgrep hostname ls
mv ping6 rmdir sleep true vi
busybox-new cp echo flock ip mkdir
netstat printf sdparm split umount watch
cat date egrep grep kill mknod
nice ps sed sync uname wget
chmod dd false gunzip ln more
pidof pwd sh tar unlink zcat
And the busybox:
Currently defined functions:
[, arp, ash, awk, basename, busybox, cat, chmod, chown, cp, crond,
cut,date, dd, df, dirname, dmesg, du, echo, egrep, env, expr, false,
fdisk, fgrep, find, free, ftpget, getty, grep, head, hexdump,
hostname, ifconfig, init, insmod, ip, kill, killall, klogd, ln,
login, ls, lsmod, md5sum, mkdir, mknod, mkswap, modprobe, more,
mount, mv, netstat, nslookup, passwd, pidof, ping, ping6, ps, pwd,
readlink, reboot, renice, rm, rmdir, rmmod, route, sed, seq, sh,
sleep, sort, swapoff, swapon, sync, sysctl, syslogd, tail, tar,
taskset, test, tftp, time, top, touch, tr, traceroute, true, udhcpd,
umount, uname, unzip, uptime, usleep, vi, watch, wc, which,
xargs, yes
It has some other stuff too in other locations from the PATH, but no nc, no httpd or something like that
networking linux-networking tcp shell shell-scripting
I need a very simple web server on a very small embedded system with a MISP processor. I thought that the simplest server could be a shell script listening to a TCP port.
The problem is that the system doesn't have even perl. Only some basic shell /bin/sh. I searched the web for "how to listen to a port from a shell", but answers I found all referred to some other tools like nc, which I don't have.
Is it even possible to do?
The system, it's a router, has busybox installed and some other binaries in the /bin directory, they are:
#ls /bin
chown df fatattr gzip login mount
ping rm shuf touch usleep
busybox comgt dmesg fgrep hostname ls
mv ping6 rmdir sleep true vi
busybox-new cp echo flock ip mkdir
netstat printf sdparm split umount watch
cat date egrep grep kill mknod
nice ps sed sync uname wget
chmod dd false gunzip ln more
pidof pwd sh tar unlink zcat
And the busybox:
Currently defined functions:
[, arp, ash, awk, basename, busybox, cat, chmod, chown, cp, crond,
cut,date, dd, df, dirname, dmesg, du, echo, egrep, env, expr, false,
fdisk, fgrep, find, free, ftpget, getty, grep, head, hexdump,
hostname, ifconfig, init, insmod, ip, kill, killall, klogd, ln,
login, ls, lsmod, md5sum, mkdir, mknod, mkswap, modprobe, more,
mount, mv, netstat, nslookup, passwd, pidof, ping, ping6, ps, pwd,
readlink, reboot, renice, rm, rmdir, rmmod, route, sed, seq, sh,
sleep, sort, swapoff, swapon, sync, sysctl, syslogd, tail, tar,
taskset, test, tftp, time, top, touch, tr, traceroute, true, udhcpd,
umount, uname, unzip, uptime, usleep, vi, watch, wc, which,
xargs, yes
It has some other stuff too in other locations from the PATH, but no nc, no httpd or something like that
networking linux-networking tcp shell shell-scripting
networking linux-networking tcp shell shell-scripting
edited 7 hours ago
user907860
asked 8 hours ago
user907860user907860
2152 silver badges8 bronze badges
2152 silver badges8 bronze badges
Well, would be useful to know what commands/packages are available. For example:busyboxhas a build-in http daemon.
– duenni
8 hours ago
@duenni I've added a list
– user907860
8 hours ago
@duenni it says httpd: applet not found .
– user907860
7 hours ago
1
Mhh, you also have abusybox-new, I wonder what is available with that. Anyway you can have multiple instances of busybox installed, so you could compile busybox yourself with the httpd option enabled and install it.
– duenni
7 hours ago
1
@duenni I looked into it and it seemed to have nothing useful for meegrep, ether-wake, fatattr, fgrep, flock, grep, gunzip, gzip, nice, printf, shuf, split, udhcpc, unlink, wget, zcat. But the router has alighthttpdbinary, found it withfind / -name "*http*". I'll try to research this one
– user907860
7 hours ago
add a comment
|
Well, would be useful to know what commands/packages are available. For example:busyboxhas a build-in http daemon.
– duenni
8 hours ago
@duenni I've added a list
– user907860
8 hours ago
@duenni it says httpd: applet not found .
– user907860
7 hours ago
1
Mhh, you also have abusybox-new, I wonder what is available with that. Anyway you can have multiple instances of busybox installed, so you could compile busybox yourself with the httpd option enabled and install it.
– duenni
7 hours ago
1
@duenni I looked into it and it seemed to have nothing useful for meegrep, ether-wake, fatattr, fgrep, flock, grep, gunzip, gzip, nice, printf, shuf, split, udhcpc, unlink, wget, zcat. But the router has alighthttpdbinary, found it withfind / -name "*http*". I'll try to research this one
– user907860
7 hours ago
Well, would be useful to know what commands/packages are available. For example:
busybox has a build-in http daemon.– duenni
8 hours ago
Well, would be useful to know what commands/packages are available. For example:
busybox has a build-in http daemon.– duenni
8 hours ago
@duenni I've added a list
– user907860
8 hours ago
@duenni I've added a list
– user907860
8 hours ago
@duenni it says httpd: applet not found .
– user907860
7 hours ago
@duenni it says httpd: applet not found .
– user907860
7 hours ago
1
1
Mhh, you also have a
busybox-new, I wonder what is available with that. Anyway you can have multiple instances of busybox installed, so you could compile busybox yourself with the httpd option enabled and install it.– duenni
7 hours ago
Mhh, you also have a
busybox-new, I wonder what is available with that. Anyway you can have multiple instances of busybox installed, so you could compile busybox yourself with the httpd option enabled and install it.– duenni
7 hours ago
1
1
@duenni I looked into it and it seemed to have nothing useful for me
egrep, ether-wake, fatattr, fgrep, flock, grep, gunzip, gzip, nice, printf, shuf, split, udhcpc, unlink, wget, zcat. But the router has a lighthttpd binary, found it with find / -name "*http*". I'll try to research this one– user907860
7 hours ago
@duenni I looked into it and it seemed to have nothing useful for me
egrep, ether-wake, fatattr, fgrep, flock, grep, gunzip, gzip, nice, printf, shuf, split, udhcpc, unlink, wget, zcat. But the router has a lighthttpd binary, found it with find / -name "*http*". I'll try to research this one– user907860
7 hours ago
add a comment
|
1 Answer
1
active
oldest
votes
No, a basic Bourne/POSIX shell (/bin/sh) cannot be expected to include any built-in facilities for TCP connections. See comparision of command shells in Wikipedia.
The bash shell would have TCP and UDP client capabilities with a special handling of certain filenames: for example, using /dev/tcp/<hostname>/<port> in input/output redirection on a command line causes bash connect to the specified host and port and use the connection as input source or output destination. But bash cannot listen on a port: it cannot act as a TCP server.
The zsh shell would have both client and server functionality, but only using TCP. On the other hand, zsh is not a simple shell: it's probably the most feature-rich (and so the largest) of the common unix-style shells as far as I know. Finding zsh on a small embedded system would be rather unlikely.
While I was writing my answer, you indicated in the comments that you found a "lighthttpd" binary. Is it perhaps this? https://www.lighttpd.net/
thank you and duenni , yes, the lighttpd is exactly what I wanted originally, it runs ok, but the answer to the question is useful for general conceptual knowledge
– user907860
7 hours ago
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f986506%2fis-it-possible-to-listen-to-a-tcp-port-only-with-a-shell-with-no-additional-too%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
No, a basic Bourne/POSIX shell (/bin/sh) cannot be expected to include any built-in facilities for TCP connections. See comparision of command shells in Wikipedia.
The bash shell would have TCP and UDP client capabilities with a special handling of certain filenames: for example, using /dev/tcp/<hostname>/<port> in input/output redirection on a command line causes bash connect to the specified host and port and use the connection as input source or output destination. But bash cannot listen on a port: it cannot act as a TCP server.
The zsh shell would have both client and server functionality, but only using TCP. On the other hand, zsh is not a simple shell: it's probably the most feature-rich (and so the largest) of the common unix-style shells as far as I know. Finding zsh on a small embedded system would be rather unlikely.
While I was writing my answer, you indicated in the comments that you found a "lighthttpd" binary. Is it perhaps this? https://www.lighttpd.net/
thank you and duenni , yes, the lighttpd is exactly what I wanted originally, it runs ok, but the answer to the question is useful for general conceptual knowledge
– user907860
7 hours ago
add a comment
|
No, a basic Bourne/POSIX shell (/bin/sh) cannot be expected to include any built-in facilities for TCP connections. See comparision of command shells in Wikipedia.
The bash shell would have TCP and UDP client capabilities with a special handling of certain filenames: for example, using /dev/tcp/<hostname>/<port> in input/output redirection on a command line causes bash connect to the specified host and port and use the connection as input source or output destination. But bash cannot listen on a port: it cannot act as a TCP server.
The zsh shell would have both client and server functionality, but only using TCP. On the other hand, zsh is not a simple shell: it's probably the most feature-rich (and so the largest) of the common unix-style shells as far as I know. Finding zsh on a small embedded system would be rather unlikely.
While I was writing my answer, you indicated in the comments that you found a "lighthttpd" binary. Is it perhaps this? https://www.lighttpd.net/
thank you and duenni , yes, the lighttpd is exactly what I wanted originally, it runs ok, but the answer to the question is useful for general conceptual knowledge
– user907860
7 hours ago
add a comment
|
No, a basic Bourne/POSIX shell (/bin/sh) cannot be expected to include any built-in facilities for TCP connections. See comparision of command shells in Wikipedia.
The bash shell would have TCP and UDP client capabilities with a special handling of certain filenames: for example, using /dev/tcp/<hostname>/<port> in input/output redirection on a command line causes bash connect to the specified host and port and use the connection as input source or output destination. But bash cannot listen on a port: it cannot act as a TCP server.
The zsh shell would have both client and server functionality, but only using TCP. On the other hand, zsh is not a simple shell: it's probably the most feature-rich (and so the largest) of the common unix-style shells as far as I know. Finding zsh on a small embedded system would be rather unlikely.
While I was writing my answer, you indicated in the comments that you found a "lighthttpd" binary. Is it perhaps this? https://www.lighttpd.net/
No, a basic Bourne/POSIX shell (/bin/sh) cannot be expected to include any built-in facilities for TCP connections. See comparision of command shells in Wikipedia.
The bash shell would have TCP and UDP client capabilities with a special handling of certain filenames: for example, using /dev/tcp/<hostname>/<port> in input/output redirection on a command line causes bash connect to the specified host and port and use the connection as input source or output destination. But bash cannot listen on a port: it cannot act as a TCP server.
The zsh shell would have both client and server functionality, but only using TCP. On the other hand, zsh is not a simple shell: it's probably the most feature-rich (and so the largest) of the common unix-style shells as far as I know. Finding zsh on a small embedded system would be rather unlikely.
While I was writing my answer, you indicated in the comments that you found a "lighthttpd" binary. Is it perhaps this? https://www.lighttpd.net/
answered 7 hours ago
telcoMtelcoM
2,9877 silver badges15 bronze badges
2,9877 silver badges15 bronze badges
thank you and duenni , yes, the lighttpd is exactly what I wanted originally, it runs ok, but the answer to the question is useful for general conceptual knowledge
– user907860
7 hours ago
add a comment
|
thank you and duenni , yes, the lighttpd is exactly what I wanted originally, it runs ok, but the answer to the question is useful for general conceptual knowledge
– user907860
7 hours ago
thank you and duenni , yes, the lighttpd is exactly what I wanted originally, it runs ok, but the answer to the question is useful for general conceptual knowledge
– user907860
7 hours ago
thank you and duenni , yes, the lighttpd is exactly what I wanted originally, it runs ok, but the answer to the question is useful for general conceptual knowledge
– user907860
7 hours ago
add a comment
|
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f986506%2fis-it-possible-to-listen-to-a-tcp-port-only-with-a-shell-with-no-additional-too%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Well, would be useful to know what commands/packages are available. For example:
busyboxhas a build-in http daemon.– duenni
8 hours ago
@duenni I've added a list
– user907860
8 hours ago
@duenni it says httpd: applet not found .
– user907860
7 hours ago
1
Mhh, you also have a
busybox-new, I wonder what is available with that. Anyway you can have multiple instances of busybox installed, so you could compile busybox yourself with the httpd option enabled and install it.– duenni
7 hours ago
1
@duenni I looked into it and it seemed to have nothing useful for me
egrep, ether-wake, fatattr, fgrep, flock, grep, gunzip, gzip, nice, printf, shuf, split, udhcpc, unlink, wget, zcat. But the router has alighthttpdbinary, found it withfind / -name "*http*". I'll try to research this one– user907860
7 hours ago