> For the complete documentation index, see [llms.txt](https://mysther.gitbook.io/knowledge-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mysther.gitbook.io/knowledge-base/ataques/infra/port-knocking.md).

# Port Knocking

Port Knocking funciona como um segredo para ter acesso ao servidor, onde o usuário ou invasor terá que "bater" em um determinado número de portas com um limite de tempo também determinado para fazer a sequência para só assim liberar o IP que ele estiver usando também por um determinado tempo.\
**OBS.:** Essa técnica é mais utilizada em CTF, na vida real é pouco utilizada.

### Knock

```bash
knock <ip> <port> <port> <port> <port>
```

**OBS.:** Caso não tenha instalado, utilize o comando `sudo apt install knockd`

### Nmap

```bash
for x in <port> <port> <port>; do sudo nmap -Pn --host-timeout 201 --max-retries 0 -p $x <ip>; done
```

### Netcat

```bash
nc <ip> <port>
nc <ip> <port>
nc <ip> <port>
nc <ip> <port>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://mysther.gitbook.io/knowledge-base/ataques/infra/port-knocking.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.
