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;









4

















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










share|improve this question




























  • 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 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 a lighthttpd binary, found it with find / -name "*http*". I'll try to research this one

    – user907860
    7 hours ago

















4

















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










share|improve this question




























  • 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 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 a lighthttpd binary, found it with find / -name "*http*". I'll try to research this one

    – user907860
    7 hours ago













4












4








4








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










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question



share|improve this question








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: busybox has 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 a lighthttpd binary, found it with find / -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











  • @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 a lighthttpd binary, found it with find / -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










1 Answer
1






active

oldest

votes


















4


















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/






share|improve this answer


























  • 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












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
);



);














draft saved

draft discarded
















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









4


















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/






share|improve this answer


























  • 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















4


















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/






share|improve this answer


























  • 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













4














4










4









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/






share|improve this answer














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/







share|improve this answer













share|improve this answer




share|improve this answer



share|improve this answer










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

















  • 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


















draft saved

draft discarded















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480