# the first case is the easiest, we're just reading a plain text file | |
$ cat /etc/passwd | |
root:x:0:0:root:/root:/bin/bash | |
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin | |
... | |
# now here, we think we're reading a file but we are not! (technically yes.. anyway) | |
$ cat /proc/meminfo | |
MemTotal: 2046844 kB | |
MemFree: 546984 kB | |
MemAvailable: 1535688 kB | |
Buffers: 162676 kB | |
Cached: 892000 kB | |
# and finally we open a file (using fd=3) for read/write | |
# the "file" being a socket, we then send a request to this file >&3 | |
# and we read from this same "file" | |
$ exec 3<> /dev/tcp/www.google.com/80 | |
$ printf 'HEAD / HTTP/1.1\nHost: www.google.com\nConnection: close\n\n' >&3 | |
$ cat <&3 | |
HTTP/1.1 200 OK | |
Date: Wed, 21 Aug 2019 12:48:40 GMT | |
Expires: -1 | |
Cache-Control: private, max-age=0 | |
Content-Type: text/html; charset=ISO-8859-1 | |
P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info." | |
Server: gws | |
X-XSS-Protection: 0 | |
X-Frame-Options: SAMEORIGIN | |
Set-Cookie: 1P_JAR=2019-08-21-12; expires=Fri, 20-Sep-2019 12:48:40 GMT; path=/; domain=.google.com | |
Set-Cookie: NID=188=K69nLKjqge87Ymv4h-gAW_lRfLCo7-KrTf01ULtY278lUUcaNxlEqXExDtVB104pdA8CLUZI8LMvJv26P_D8RMF3qCDzLTpjji96B9v_miGlZOIBro6pDreHP0yW7dz-9myBfOgdQjroAc0wWvOAkBu-zgFW_Of9VpK3IfIaBok; expires=Thu, 20-Feb-2020 12:48:40 GMT; path=/; domain=.google.com; HttpOnly | |
Accept-Ranges: none | |
Vary: Accept-Encoding | |
Connection: close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment