在 ASP.NET 網站中部署 AcuSensor
如要將 AcuSensor agent 需要部署到您要掃描的網站根目錄下,首先,您需要先在您要掃描的目標中下載 AcuSensor agent。本節將介紹如何將 AcuSensor 部署到使用 ASP.NET Framework 開發的 Web 應用程式中。
- 使用 AcuSensor Injector.exe 在網站的服務器上部署的首要條件:Microsoft .NET Framework 3.5 或更高版本
- 將 AcuSensor 安裝包 dotnet-acusensor.zip 複製到託管 .NET 網站的伺服器中
- 解壓縮 dotnet-acusensor.zip 檔案,開啟 .NET Framework 資料夾後開啟 Injector.exe
- 在啟動時,Injector 將自動搜尋並列出安裝您服務器上的 .NET 應用。選擇您希望使用 AcuSensor 的網站,然後點選「Install Sensor」以在選定的 .NET 網站中安裝 AcuSensor 技術傳感器。
- 安裝傳感器後,關閉確認視窗和 Injector.exe。
在 ASP.NET 網站中卸載並移除 AcuSensor
依以下步驟在您的網站中關閉並移除 Acusensor:
- 開啟 Injector.exe
- 選擇已部署 AcuSensor 的網站,然後點選「Remove Sensor」以從站點中移除 AcuSensor agent
- 關閉 Injector.exe。
使用命令提示字元部署 AcuSensor
將 dotnet-acusensor.zip 文件複製並解壓縮到託管 .NET 網站伺服器後,您可以部署和刪除 AcuSensor agent 到您的網站中,還可以列出可部署的網站,如下所示:C:\Users\Administrator\Desktop\dotnet-acusensor>injector -m inject -t http://localhost:86/yaf_forums
Target Found. Injecting sensor to: http://localhost:86/yaf_forums
C:\Users\Administrator\Desktop\dotnet-acusensor>injector -m uninject -t http://localhost:86/yaf_forums
Target Found. Uninjecting sensor from: http://localhost:86/yaf_forums
C:\Users\Administrator\Desktop\dotnet-acusensor>injector -m list
http://localhost:86/
http://localhost:86/yaf_forums
http://localhost:86/kartris
http://localhost:86/bugnet
C:\Users\Administrator\Desktop\dotnet-acusensor>
- -m 參數後面可以是:
- inject – 將 AcuSensor agent 注入到網站中。
- uninject – 將 AcuSensor agent 從網站中移除。
- list – 列出伺服器上所有的網站
- -t 參數應指定為您希望注入或刪除 AcuSensor agent 的 URL
注意:如果網站位於 URL 路徑的根目錄,則須在 URL 末尾包含正斜(在本例中為 http://localhost:86/);如果網站位於子文件夾中,則不得在 URL 末尾包含正斜(在本例中為 http://localhost:86/yaf_forums)
注意:雖然 Acunetix AcuSensor agent 使用強密碼保護,但如果不再使用 AcuSensor agent 文件,建議從 Web 中卸載並刪除它們。
手動部署 AcuSensor
- 首先確定可從您的目標網站可以訪問 AcuSensorBridge,更多詳細訊息可參閱這裡。
- 於託管 .NET 網站的伺服器中下載 dotnet-acusensor.zip
- 解壓縮剛下載完的壓縮檔到任何資料夾,在這邊我們使用的範例是「
%programdata%\Acunetix\Acusensor
」 - 於此目錄下新增一個資料夾並名為「Acunetix .NET AcuSensor」。
- .NET Sensor 必須使用到 SensorModule.dll,如果 Injector.exe 因任何因素導致無法執行,則必須由其他可正常開啟 Injector.exe 並已安裝完 AcuSensor 的伺服器提取,位於
%programdata%\Acunetix\Acunetix .NET AcuSensor\
。 - SensorProfiler.dll、SensorModule.dll 和 settings.ini 應放置在正確的路徑中。
- 從 Acusensor 資料夾中瀏覽「.\AcuSensor.NET Core」並找到 SensorProfiler.dll,然後將其複製到「%programdata%\Acunetix\Acunetix .NET AcuSensor\」資料夾下(SensorProfiler.dll 對於 .NET Framework 和 .Net Core 都是相同的)。
- 於「%programdata%\Acunetix\.NET Framework\」資料夾中找到 settings.ini 並複製到「%programdata%\Acunetix\Acunetix .NET AcuSensor」資料夾下
- 將 SensorModule.dll 複製到站台跟目錄的 .\bin 資料夾下,如:C:\inetpub\YourWebSite\bin\SensorModule.dll
- 於「%programdata%\Acunetix\Acunetix .NET AcuSensor」的資料夾中打開並編輯 settings.ini ,加入「
log.path=C:\inetpub\temp\IIS Temporary Compressed Files\logs
」 - 如要安裝 IIS 模組,請將以下模組部分加入該站台的 web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
…
…
<system.webServer>
…
<modules>
…
<add name="InvictiSensorModule" type="SensorModule.RequestsHandlerModule, SensorModule, version=5.0.0.0, culture=neutral, publicKeyToken=068f0ac6f5c4405b" />
…
</modules>
</system.webServer>
…
</configuration> - 要加載 SensorProfiler.dll .NET 分析器,您需要添加以下環境變數;您可以通過更改 IIS 主機配置文件來做到這一點:“%windir%\System32\inetsrv\config\applicationHost.config”
備註:下列程式碼僅於 IIS 10以上受到支援,小於此版本的請直接在系統變數中加入;或改用 IIS Express<environmentVariables>
<add name="SENSOR_SETTINGS_PATH" value="C:\ProgramData\Acunetix\Acunetix .NET AcuSensor\settings.ini" />
<add name="COR_ENABLE_PROFILING" value="1" />
<add name="COR_PROFILER" value="{F23266E3-B53E-44EB-862C-D7DDB4C620D0}" />
<add name="COR_PROFILER_PATH" value="C:\ProgramData\Acunetix\Acunetix .NET AcuSensor\SensorProfiler.dll" />
<add name="SENSOR_SETTINGS_PATH" value="w3wp.exe" />
</environmentVariables> - 在 IIS 中重新啟動要掃描的站台(您可能需要重新啟動 W3SVC 服務才能使更改生效)後在此目標上運行掃描,現在將在掃描的“Activity”窗口中顯示「AcuSensor used for this scan」
- AcuSensor 應在您在上述步驟 8 中於 settings.ini 所設定的目錄中生成日誌。如果有任何問題,請將這些日誌轉發給我們。