> For the complete documentation index, see [llms.txt](https://106-sam.gitbook.io/ejptv2-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://106-sam.gitbook.io/ejptv2-notes/introduction-to-the-web-and-http-protocol.md).

# Introduction to the Web and HTTP Protocol

### Introduction to Web

**What is a website?**

Websites are just the files on a server that you're accessing generally through a browser. Basically three files, we are likely to see HTML, CSS and JavaScript.

* If someone is hosting locally on their own server, Web server like Apache, Tomcat, Nginx, or IIS are used.
* If we have off-premise hosting in the cloud providers, it uses AWS, Azure, Google Cloud Platform.
* Other off-premise hosting services like Wordpress, Firebase, Digital Ocean, CloudFlare.

HTTP Protocols :&#x20;

**Headers**&#x20;

* Headers hold information about what you're requesting when you want files from a server.

<figure><img src="/files/UOdJKDnKIDGI7d9qGFK8" alt=""><figcaption></figcaption></figure>

**Requests**

* Client - Interacts with the server by requesting things through methods
* Methods - GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH
  * TRACE is the one that may or may not be used by every browser.
  * GET  is very common that retrieves a file.
  * HEAD is just going to pull the headers.
  * POST posts like a form or a login, where we send specific data to the server. But it still going to return something specific
  * PUT for putting files onto the server.
  * DELETE for deleting things off the server.
  * CONNECT which may or may not be used.
  * OPTIONS allows us to know which of these methods are available as options.
  * PATCH may or may not be available but to patch the software on the server.
* User-Agent, we get different sorts of information through it.

<figure><img src="/files/2HDsgSeYjVIBkHUswWNF" alt=""><figcaption></figcaption></figure>

**Response**

* Whatever we get back after request is made is called a response.
* The server sends the resources and to let your browser know what it's receiving. &#x20;
* There's status codes,&#x20;
  * 200 - OK - a good request here what we requested
  * 302 - REDIRECT - the website that we requesting actually goes to another website.
  * 404 - NOT FOUND - when resource not available or not found

<figure><img src="/files/pLeA9CFcvV55MWQ86b4H" alt=""><figcaption></figcaption></figure>

**Browsers (Interpret and Process)**

* A browser just interprets and which then connect to the CSS, HTML and JavaScript of the website. And serves it up to us in a fashion that you can work with it.
* PHP, which is just a software profile that's based on the back-end. It's just the another way for it to send those files&#x20;

**Sessions**

* HTTP does not maintain sessions as a protocol in and of itself instead utilizes Cookies.
* Cookies are codes that go alongside your requests.
* As long as that cookie stays there for as many times as you're connected to the website. then your session remains.
* If you login then we get a cookie.
* There are also tracking cookies, authentication cookies.
* Cookies are very helpful but racking cookies might be invasive.&#x20;

<figure><img src="/files/aNMVkG7HD1bdiyyZcU32" alt=""><figcaption></figcaption></figure>

**HTTPS**

* HTTPS is what we now using that is now the standard.
* Its just HTTP secured, as it just wraps our application level data in an application level encryption of TLS or SSL.&#x20;
* What it does is it takes our information over HTTPS, which is encrypted. If we have the keys, we can decrypt that&#x20;

  <figure><img src="/files/lNW9PvhkEv930ekKo1ku" alt=""><figcaption></figcaption></figure>
* But likely anyone sniffing can't make out what is going on there.

Lab

* Browse to <http://demo.ine.local>

```
nmap -sV <IP>
```

* take a look at the page source.
* We can also inspect element > storage > cookies&#x20;

Wireshark capture

> frame contains bee&#x20;

* Tool like curl for knowing the request and response

```
curl http://demo.ine.local -V
```

```
nmap -sV demossl.ine.local
```

* <https://demossl.ine.local>
* click on lock > Security > view certificate&#x20;
* dirb

```
dirb http://demo.ine.local
```

* &#x20;/robots.txt, /admin, /passwords

***
