# Reconocimiento interno

### <mark style="color:purple;">\[ + ] Con credenciales</mark>

### <mark style="background-color:purple;">> AzureAD</mark>

{% content-ref url="/pages/1V7K8MW53N3XU5zCKchm" %}
[AzureAD](/pentesting-en-infraestructuras/cloud/azure/metodologia-de-azure-pentest/reconocimiento-interno/enum-con-herramientas-de-ms/azuread.md)
{% endcontent-ref %}

### <mark style="background-color:purple;">> Az PowerShell</mark>

{% content-ref url="/pages/QK2HmkujZ9HCnnFBQMHN" %}
[Az Powershell](/pentesting-en-infraestructuras/cloud/azure/metodologia-de-azure-pentest/reconocimiento-interno/enum-con-herramientas-de-ms/az-powershell.md)
{% endcontent-ref %}

### <mark style="background-color:purple;">> Az Cli</mark>

{% content-ref url="/pages/SvLXnKt2fCINMMTcKT4W" %}
[Az Cli](/pentesting-en-infraestructuras/cloud/azure/metodologia-de-azure-pentest/reconocimiento-interno/enum-con-herramientas-de-ms/az-cli.md)
{% endcontent-ref %}

### <mark style="background-color:purple;">></mark> [<mark style="background-color:purple;">Microsoft Graph Powershell</mark>](#microsoft-graph-powershell-overview-3)

### <mark style="color:purple;">Línea de comandos</mark>

#### Con credenciales

```powershell
Connect-MgGraph
Connect-MgGraph -Scopes "User.Read.All", "Group.ReadWrite.All"
```

#### Con código de dispositivo

{% code overflow="wrap" %}

```powershell
Connect-MgGraph -Scopes "User.Read.All", "Group.ReadWrite.All" -UseDeviceAuthentication
```

{% endcode %}

### <mark style="background-color:purple;">></mark> [<mark style="background-color:purple;">ROADTools</mark>](#roadtools)

* Iniciar sesión:

```
roadrecon auth -u <email> -p <contraseña>
```

* Obtener toda la información que puede leer el usuario actual:

```
roadrecon gather
```

* Iniciar la interfaz gráfica:

```
roadrecon gui
```

{% hint style="info" %}
El servidor web se ejecutará en la URL: <http://127.0.0.1:5000>
{% endhint %}

<figure><img src="/files/IusDXRTdOoy1gMZ5KZCd" alt=""><figcaption><p>ROADrecon</p></figcaption></figure>

* Obtención de políticas de accesos condicionales:

```powershell
roadrecon plugin policies
```

{% hint style="info" %}
Se genera un fichero llamado caps.html con la información.
{% endhint %}

<figure><img src="/files/AV2bk2xdLKWemCsthlTk" alt="" width="375"><figcaption><p>Polííticas de acceso condicionales</p></figcaption></figure>

### ScoutSuite

* Se [inicia sesión con az cli:](/pentesting-en-infraestructuras/cloud/azure/metodologia-de-azure-pentest/reconocimiento-interno/enum-con-herramientas-de-ms/az-cli.md#conexion)

```
az login
```

* Se ejecuta el siguiente comando:

```powershell
python scout.py azure --cli
```

### <mark style="background-color:purple;">></mark> [<mark style="background-color:purple;">StormPotter</mark>](#stormpotter)

Ejecución de StormPotter:

```
cd C:\Pentest\Tools\stormspotter\stormcollector\
pipenv shell
az login -u <email> -p <contraseña>
python C:\Pentest\Tools\stormspotter\stormcollector\sscollector.pyz cli
```

Acceso a la web: <http://localhost:9091/>

{% hint style="info" %}
Credenciales por defecto:&#x20;

* Usuario: neo4j
* Contraseña: password
  {% endhint %}

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

La información reconectada se encuentra en un ZIP dentro de la carpeta de `C:\Pentest\Tools\stormspotter\stormcollector`.

Para visualizar la información se pueden utilizar las consultas por defecto de la sección "Queries" o crear unas propias.

* Por ejemplo, para obtener todos los administradores:

```
MATCH (a:AADRole)<-[r:MemberOf]-(t) WHERE a.name = 'Company Administrator' RETURN *
```

### <mark style="color:purple;">\[ + ] Con token</mark>

### <mark style="background-color:purple;">></mark> [<mark style="background-color:purple;">AzureRA</mark>](#microsoft-graph-powershell-overview)

Esta herramienta contiene un conjunto de funciones que realizan peticiones contra Azure REST API de Microsoft.

<https://github.com/xtormin/PowerPentest/tree/main/Azure/AzureRA>

* Realizar una petición GET contra el recurso que se desee usando un token de acceso y la URL de la consulta que se quiera realizar:

{% code overflow="wrap" %}

```powershell
Get-RA-RequestAPI -AccessToken $AccessToken -URI '<URL>'
```

{% endcode %}

{% code overflow="wrap" %}

```powershell
Get-RA-RequestAPI -AccessToken $AccessToken -URI 'https://management.azure.com/subscriptions?api-version=2020-01-01'
```

{% endcode %}

* Obtener suscripciones:

```powershell
Get-RA-Subscriptions -AccessToken $AccessToken
```

* Obtener los recursos de una suscripción por su ID:

<pre class="language-powershell" data-overflow="wrap"><code class="lang-powershell"><strong>Get-RA-ResourcesBySubscriptionID -AccessToken $AccessToken -SubscriptionID '&#x3C;ID de suscripción>'
</strong></code></pre>

* Obtener roles asociados a un recurso:

{% code overflow="wrap" %}

```powershell
Get-RA-RoleAssignment -AccessToken $AccessToken -ResourcePath '<Resource path>'
```

{% endcode %}

{% code overflow="wrap" %}

```powershell
Get-RA-RoleAssignment -AccessToken $AccessToken -ResourcePath '/subscriptions/b413826f-108d-4049-8c11-d52d5d348768/resourceGroups/Test/providers/Microsoft.Compute/virtualMachines/infraadmin'
```

{% endcode %}

* Obtener un *nonce*:

```powershell
Get-RA-RequestNonce -TenantID '<Tenant ID>'
```


---

# 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://www.xtormin.com/pentesting-en-infraestructuras/cloud/azure/metodologia-de-azure-pentest/reconocimiento-interno.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.
