View Single Post
  #3   (View Single Post)  
Old 5th October 2020
fvgit's Avatar
fvgit fvgit is offline
Spikes in tights
 
Join Date: May 2016
Location: perl -MMIME::Base64 -le 'print decode_base64("U2hlcndvb2QgRm9yZXN0")'
Posts: 306
Default

Thanks for the kind words. To use nc with HTTPS remember to set the -c flag, it's easy to overlook. I speak from experience. I actually didn't even look closely at the HTTP protocol. There are numerous ways in which this can fail. That being said, for what it is, it's actually pretty neat. I have a follow-up piece coming up regarding some of the popular image sites. And maybe a few other ideas. And there's probably some potential just waiting to be unlocked when it comes to HTTP::Tiny. After all it supports cookies, redirects, POST requests and whatnot.

In the meantime how about some quick'n'dirty gopher fun?

Using technique #2 to access a gopher server (commands in green, follow-up target in red)
Code:
$ printf "/fun/xkcd \r\n" | nc gopher.floodgap.com 70
1Floodgap Gopher Fun and Games  /fun    gopher.floodgap.com     70
i               error.host      1
i            88 A Webcomic of Romance,    88            error.host      1
i            88 Sarcasm, Math & Language. 88            error.host      1
i            88                           88            error.host      1
i8b,     ,d8 88   ,d8  ,adPPYba,  ,adPPYb,88            error.host      1
i `Y8, ,8P'  88 ,a8"  a8"     "" a8"    `Y88            error.host      1
i   )888(    8888[    8b         8b       88            error.host      1
i ,d8" "8b,  88`"Yba, "8a,   ,aa "8a,   ,d88            error.host      1
i8P'     `Y8 88   `Y8a `"Ybbd8"'  `"8bbdP"Y8            error.host      1
i               error.host      1
iCurrent comic:         error.host      1
1xkcd - A Webcomic - Masks (2367)       /fun/xkcd/comics/2360/2367      gopher.floodgap.com     70
i               error.host      1
1Browse all xkcd comics /fun/xkcd/comics        gopher.floodgap.com     70
i               error.host      1
iWarning: this comic occasionally contains strong language (which               error.host      1
imay be unsuitable for children), unusual humor (which may be           error.host      1
iunsuitable for adults), and advanced mathematics (which may be         error.host      1
iunsuitable for liberal-arts majors).           error.host      1
iUpdates usually Monday/Wednesday/Friday.               error.host      1
iSome older Gopher clients may not understand PNG itemtype.             error.host      1
hAbout xkcd (WWW)       URL:http://www.xkcd.com/about/  gopher.floodgap.com     70
i               error.host      1
iComics reproduced from www.xkcd.com under license.             error.host      1
hxkcd License (WWW)     URL:http://www.xkcd.com/license.html    gopher.floodgap.com     70
hxkcd Web Site (WWW)    URL:http://www.xkcd.com/        gopher.floodgap.com     70

.
Now the subpage:
Code:
 $ printf "/fun/xkcd/comics/2360/2367 \r\n" | nc gopher.floodgap.com 70
1xkcd - A Webcomic of Romance, Sarcasm, Math and Language.      /fun/xkcd       gopher.floodgap.com     70
1Floodgap Gopher Fun and Games  /fun    gopher.floodgap.com     70
i               error.host      1
ixkcd - A Webcomic - Masks (2367)               error.host      1
i               error.host      1
iImage:         error.host      1
pmasks.png      /fun/xkcd/comics/2360/2367/masks.png    gopher.floodgap.com     70
i               error.host      1
iHaunted Halloween masks from a mysterious costume shop that turn               error.host      1
iyou evil and grow into your skin score a surprisingly high 80%         error.host      1
ifiltration efficiency in R. L. Stine-sponsored NIOSH tests.            error.host      1
i               error.host      1
iComics reproduced from www.xkcd.com under license.             error.host      1
hxkcd License (WWW)     URL:https://www.xkcd.com/license.html   gopher.floodgap.com     70
hxkcd Web Site (WWW)    URL:https://www.xkcd.com/       gopher.floodgap.com     70
i               error.host      1
iPrevious:              error.host      1
1xkcd - A Webcomic - Amelia's Farm Fresh Cookies (2366) /fun/xkcd/comics/2360/2366      gopher.floodgap.com     70
.
And retrieving the image:
Code:
printf "/fun/xkcd/comics/2360/2367/masks.png \r\n" | nc gopher.floodgap.com 70 > masks.png
To access the root directory just do a:
Code:
printf "/ \r\n" | nc gopher.floodgap.com 70
or
Code:
telnet gopher.floodgap.com 70
and hit Enter.
Reply With Quote