icmdline with printf+nc and curl - gopher-tutorials - The gopher tutorials project. Err bitreich.org 70
hgit clone git://bitreich.org/gopher-tutorials/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/gopher-tutorials/ URL:git://bitreich.org/gopher-tutorials/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/gopher-tutorials/ bitreich.org 70
1Log /scm/gopher-tutorials/log.gph bitreich.org 70
1Files /scm/gopher-tutorials/files.gph bitreich.org 70
1Refs /scm/gopher-tutorials/refs.gph bitreich.org 70
1Tags /scm/gopher-tutorials/tag bitreich.org 70
i--- Err bitreich.org 70
1commit f7ab9d87c22c7522af42fcd997468e20ded31152 /scm/gopher-tutorials/commit/f7ab9d87c22c7522af42fcd997468e20ded31152.gph bitreich.org 70
1parent 2eb761ef9eb86c59f63f78a0504deee794bb4582 /scm/gopher-tutorials/commit/2eb761ef9eb86c59f63f78a0504deee794bb4582.gph bitreich.org 70
hAuthor: Solene Rapenne <solene@perso.pw> URL:mailto:solene@perso.pw bitreich.org 70
iDate: Tue, 30 Jan 2018 20:11:47 +0100 Err bitreich.org 70
i Err bitreich.org 70
icmdline with printf+nc and curl Err bitreich.org 70
i Err bitreich.org 70
iDiffstat: Err bitreich.org 70
i A cmdline.txt | 44 +++++++++++++++++++++++++++++++ Err bitreich.org 70
i Err bitreich.org 70
i1 file changed, 44 insertions(+), 0 deletions(-) Err bitreich.org 70
i--- Err bitreich.org 70
1diff --git a/cmdline.txt b/cmdline.txt /scm/gopher-tutorials/file/cmdline.txt.gph bitreich.org 70
i@@ -0,0 +1,44 @@ Err bitreich.org 70
i+Dear reader, in this document we will see differents command line Err bitreich.org 70
i+software which can be used to connect to a gopher server. Err bitreich.org 70
i+ Err bitreich.org 70
i+ Err bitreich.org 70
i+Printf + netcat Err bitreich.org 70
i+=============== Err bitreich.org 70
i+ Err bitreich.org 70
i+It's possible to write request "by hand" using printf to format the Err bitreich.org 70
i+request string and then netcat to send it to the remote server. Err bitreich.org 70
i+ Err bitreich.org 70
i+A request of the file "/tutorials/cmdline.txt" will looks like this : Err bitreich.org 70
i+ Err bitreich.org 70
i+ printf "/tutorials/cmdline.txt" | nc somedomain.com 70 Err bitreich.org 70
i+ Err bitreich.org 70
i+You will get the server answer directly into your output. Be careful Err bitreich.org 70
i+if you ask binary files, it will be displayed on your screen, this is Err bitreich.org 70
i+not something a regular user want. If you want to download a binary Err bitreich.org 70
i+file, you can redirect the output to a file using ">" or pipe it to Err bitreich.org 70
i+another software (or using tee for both at the same time). Err bitreich.org 70
i+ Err bitreich.org 70
i+The following example will download a music file, save it on the Err bitreich.org 70
i+filesystem and play it with mpv while downloading. Err bitreich.org 70
i+ Err bitreich.org 70
i+ printf "/some_music.ogg" | tee saved_music.ogg | mpv - Err bitreich.org 70
i+ Err bitreich.org 70
i+You may have seen that the data type is not part of the request Err bitreich.org 70
i+string, this is because it is only useful for the client to decide how Err bitreich.org 70
i+to handle the content. In the current case, the client is YOU, so if Err bitreich.org 70
i+you ask a menu and you want to download a file which has been tagged Err bitreich.org 70
i+with type "I" then you should use the right process to deal with an Err bitreich.org 70
i+image file. Err bitreich.org 70
i+ Err bitreich.org 70
i+ Err bitreich.org 70
i+Curl Err bitreich.org 70
i+==== Err bitreich.org 70
i+ Err bitreich.org 70
i+It is possible to use curl to connect to a gopher server, most of its Err bitreich.org 70
i+options are supported, like timeout or traffic shaping. You need to Err bitreich.org 70
i+pass a full url with "gopher://&; at the start to curl to tell it you Err bitreich.org 70
i+want to request a gopher server. Err bitreich.org 70
i+ Err bitreich.org 70
i+By default, curl will output the server result to stdout. Explanations Err bitreich.org 70
i+can be found in the previous section about this. Err bitreich.org 70
i+ Err bitreich.org 70
.
Response:
text/plain