添加引用 using System.Runtime.InteropServices; 声明useragent标志 private string userAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"; 添加API操作 [DllImport("urlmon.dll", CharSet = CharSet.Ansi)] private static extern int UrlMkSetSessionOption(int dwOption, string pBuffer, int dwBufferLength, int dwReserved); private const int UrlmonOptionUseragent = 0x10000001; public void ChangeUserAgent(string agent) { UrlMkSetSessionOption(UrlmonOptionUseragent, agent, agent.Length, 0); } private void Form1_Load(object sender, EventArgs e) { ChangeUserAgent(userAgent); }
最近看了下某安全狗绕过神器。用的方法就是利用百度的useragent,安全狗好像默认放行。所以导致了可以利用这个来注入检测之类的。用上面方法,可以轻轻松松绕过~~
转载请注明来自于博客:凤2鸡 http://www.cnblogs.com/jizhongfong/archive/2013/05/29/3105723.html