General - GradedJestRisk/network-training GitHub Wiki

List:

  • talk to HTTP server
    • raw: netcat <HOST_IP> <HOSTPORT>, then
    • user-friendly: curl <URL>
  • get domain name from IP: nslookup <IP>
  • get IP from domain name: host <DOMAIN_NAME> (<DNS>)
  • get DNS name from host: host -t NS <DOMAIN_NAME>
  • trace route to : traceroute <URL>

Netcat

Get content (200)

╰─$ printf "%s\r\n" "GET /blog/ HTTP/1.1" "Host: ut7.fr" "" | nc 94.23.20.149 80                                                130 ↵
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 32670
Content-Type: text/html
Date: Thu, 07 Jan 2021 08:18:24 GMT
Etag: "5faf8bc6-7f9e"
Last-Modified: Sat, 14 Nov 2020 07:48:22 GMT
Server: nginx/1.11.10

<!doctype html>
<html class="no-js" lang="en">
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="/ut7">
(..)

Redirection (301)

printf "%s\r\n" "GET /blog HTTP/1.1" "Host: ut7.fr" "" | nc 94.23.20.149 80
HTTP/1.1 301 Moved Permanently
Content-Length: 186
Content-Type: text/html
Date: Thu, 07 Jan 2021 08:16:18 GMT
Location: /blog/
Server: nginx/1.11.10

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.11.10</center>
</body>
</html>

⚠️ **GitHub.com Fallback** ⚠️