**本文僅為技術原理分析,嚴禁用於破壞投票公平性、刷票、攻擊網站等非法用途。** 實際部署此類程式可能違反《刑法》破壞電腦使用罪、《網路安全法》及網站服務條款,承擔法律責任。請僅於授權測試環境或教學研究中參考。
| 環節 | 技術 | 關鍵點 |
|---|---|---|
| 清除 Cookie | Shell32 + File.Delete | 遍歷 shell:Cookies (CSIDL 33),跳過 index.dat 系統鎖定檔 |
| 提交表單 | WebClient.UploadData | POST 方式、application/x-www-form-urlencoded、模擬瀏覽器 Header |
| 排程 | Timer | 定時觸發清除→提交循環 |
// 清除 Cookie (需參考 Microsoft Shell Controls And Automation)
const int CSIDL_COOKIES = 33;
Shell32.ShellClass sh = new Shell32.ShellClass();
Shell32.Folder folder = sh.NameSpace(CSIDL_COOKIES);
foreach (Shell32.FolderItem item in folder.Items())
{
if (!item.Name.Equals("index.dat", StringComparison.OrdinalIgnoreCase))
File.Delete(item.Path);
}
// 提交投票
using (WebClient wc = new WebClient())
{
wc.Headers["Content-Type"] = "application/x-www-form-urlencoded";
byte[] resp = wc.UploadData("https://site/vote.asp", "POST",
Encoding.Default.GetBytes("username=xxx&vote=1"));
// 檢查 resp 確認成功
}
技術本身中性,**防禦永遠比攻擊更有價值**。理解自動化腳本原理,才能建構更健壯的風控體系。