; NetSession 0.9d UDF by Synthetisoft (www.Synthetisoft.com) - AutoIt forum user: drego ; For updates and details on usage visit http://www.autoitscript.com/forum/topic/166902-netsession-udf-new-net-capabilites-for-autoit-processes/ #include-once #Include #include #include Func _SetProxy($proxy, $proxybypass = "") Local $INTERNET_OPTION_PROXY = 38 Local $INTERNET_OPEN_TYPE_PROXY = 3 Local $tBuff = DllStructCreate("dword;ptr;ptr") DllStructSetData($tBuff, 1, $INTERNET_OPEN_TYPE_PROXY) Local $pproxy = DllStructCreate("char[" & (StringLen($proxy) + 1) & "]") DllStructSetData($pproxy, 1, $proxy) DllStructSetData($tBuff, 2, DllStructGetPtr($pproxy)) Local $pproxybypass = DllStructCreate("char[" & (StringLen($proxybypass) + 1) & "]") DllStructSetData($pproxybypass, 1, $proxybypass) DllStructSetData($tBuff, 3, DllStructGetPtr($pproxybypass)) $chk_UrlMkSetSessionOption = DllCall("urlmon.dll", "long", "UrlMkSetSessionOption", "dword", $INTERNET_OPTION_PROXY, "ptr", DllStructGetPtr($tBuff), "dword", DllStructGetSize($tbuff), "dword", 0) EndFunc Func _UseTOR($TORPort = 9150) _SetProxy("socks=127.0.0.1:"&$TORPort) EndFunc Func _SetUserAgent($agent) $agentLen = StringLen($agent) Dim $tBuff = DllStructCreate("char["&$agentLen&"]") DllStructSetData($tBuff, 1, $agent) $chk_UrlMkSetSessionOption = DllCall("urlmon.dll", "long", "UrlMkSetSessionOption", "dword", 0x10000001, "ptr", DllStructGetPtr($tBuff), "dword", $agentLen, "dword", 0) EndFunc Func _ClearCookies() ShellExecute("RunDll32.exe","InetCpl.cpl,ClearMyTracksByProcess 2","","open",@SW_HIDE) $cookieFolders = _FileListToArray(@AppDataDir&"\Macromedia\Flash Player\#SharedObjects","*",2) If @error Then Return FALSE Else For $i = 1 To UBound($cookieFolders) -1 $siteFolders = _FileListToArray(@AppDataDir&"\Macromedia\Flash Player\#SharedObjects\"&$cookieFolders[$i],"*",2) For $j = 1 To UBound($siteFolders) -1 DirRemove(@AppDataDir&"\Macromedia\Flash Player\#SharedObjects\"&$cookieFolders[$i]&"\"&$siteFolders[$j],1) Next Next EndIf Return TRUE EndFunc