bowlhost.blogg.se

Socat tutorial
Socat tutorial










socat tutorial

The "-u" flag tells socat to run in unidirectional mode. Finally, one more up arrow for the fifth, and again enter for the sixth. The I pressed up arrow to get the third line, and enter to get the fourth. To get this output, I first typed "hello, world!", pressed enter. It utilizes the GNU Readline socat -u READLINE STDOUT We can add a history, so that we can just hit up arrow to repeat what we've typed in earlier, just like bash can do. "socat STDOUT STDOUT", "socat STDIN STIN", and "socat STDIO STDIO" all appear to work identically.īut even here socat can improve the situation. Here's the equivalent using socat STDIN STDOUTĪpparantly, STDIN and STDOUT are both synonyms for STDIO, and socat doesn't care if you send input to the STDOUT address, or read output from the STDIN address. The first line after the command is typed in, the second is printed by the command. If you just run "cat" by itself, it will read from standard input and write to standard output, and you have to press control-D to cat We'll see lots of address types in this post, as well as in a couple follow-on posts that I've got planned. It's customary but not required to spell the address name in upper case.

socat tutorial socat tutorial

is one address, and STDOUT is the second. Use socat to display a file on standard socat FILE:file.txt STDOUT Use cat to display a file on standard cat file.txt socat 2.0 addresses these limitation, but uses an enhanced syntax, which means 1) it will be even more complicated to use, and 2) this post may become obsolete rather sooner than expected.īut before we compare socat to netcat, let's compare it to their common namesake, cat. Similarly, there's no way to have an SSL connection be tunneled through a web PROXY, meaning you have to resort to the hack found in sslrsh. For example, there's no way to run SSL over UDP, even thought socat knows about both protocols. socat 2.0 addresses a limitation in socat 1.x, which is that "addresses" in socat 1.x are not completely uniform, and they are not layerable. As of this writing, socat version 2.0 has entered some beta release. The next one will delve into UDP with socat, and the last one will get into some advanced topics.įinal comment before we start.

#SOCAT TUTORIAL HOW TO#

Hopefully, it will clarify how to use socat, demonstrate how much more featureful socat is, but also show why you shouldn't go ahead and delete netcat outright. I'm not the only person who has a socat tutorial, but I think this post is unique because it will attempt to describe socat by comparing it to a tool that is doubtless a major inspiration for socat, namely, netcat. Note that these aren't general purpose scripts they are just snippets of functionality listed here for future reference. It reminded me of how feature-complete socat is, and has motivated me to capture some socat recipes. In my previous post on sslrsh I wrote about a script to allow remote shell access over SSL.












Socat tutorial