<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Автоматизация роутеров через WinHttpRequest]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=17684</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=17684&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Автоматизация роутеров через WinHttpRequest».]]></description>
		<lastBuildDate>Mon, 13 Mar 2023 09:03:24 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[AHK: Автоматизация роутеров через WinHttpRequest]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=157154#p157154</link>
			<description><![CDATA[<p>TP-LINK.<br /></p><div class="codebox"><pre><code>login := &quot;login&quot;
pass := &quot;pass&quot;
link := &quot;http://192.168.0.1&quot;

WebRequest := ComObjCreate(&quot;WinHttp.WinHttpRequest.5.1&quot;)
WebRequest.Open(&quot;GET&quot;, link)
WebRequest.Send()
link .= &quot;/userRpm/LoginRpm.htm?Save=Save&quot;
Authorization := &quot;Authorization=Basic &quot; b64Encode(login &quot;:&quot; MD5(pass))
WebRequest.Open(&quot;GET&quot;, link)
WebRequest.SetRequestHeader(&quot;Cookie&quot;, Authorization)
WebRequest.Send()
msgbox % WebRequest.ResponseText   ; получаем ссылку для дальнейших действий, помимо Cookie нужно будет отправлять referer



b64Encode(string)
{
    VarSetCapacity(bin, StrPut(string, &quot;UTF-8&quot;)) &amp;&amp; len := StrPut(string, &amp;bin, &quot;UTF-8&quot;) - 1 
    if !(DllCall(&quot;crypt32\CryptBinaryToString&quot;, &quot;ptr&quot;, &amp;bin, &quot;uint&quot;, len, &quot;uint&quot;, 0x1, &quot;ptr&quot;, 0, &quot;uint*&quot;, size))
        throw Exception(&quot;CryptBinaryToString failed&quot;, -1)
    VarSetCapacity(buf, size &lt;&lt; 1, 0)
    if !(DllCall(&quot;crypt32\CryptBinaryToString&quot;, &quot;ptr&quot;, &amp;bin, &quot;uint&quot;, len, &quot;uint&quot;, 0x1, &quot;ptr&quot;, &amp;buf, &quot;uint*&quot;, size))
        throw Exception(&quot;CryptBinaryToString failed&quot;, -1)
    return StrGet(&amp;buf)
}

MD5(string, case := False)    ; by SKAN | rewritten by jNizM
{
    static MD5_DIGEST_LENGTH := 16
    hModule := DllCall(&quot;LoadLibrary&quot;, &quot;Str&quot;, &quot;advapi32.dll&quot;, &quot;Ptr&quot;)
    , VarSetCapacity(MD5_CTX, 104, 0), DllCall(&quot;advapi32\MD5Init&quot;, &quot;Ptr&quot;, &amp;MD5_CTX)
    , DllCall(&quot;advapi32\MD5Update&quot;, &quot;Ptr&quot;, &amp;MD5_CTX, &quot;AStr&quot;, string, &quot;UInt&quot;, StrLen(string))
    , DllCall(&quot;advapi32\MD5Final&quot;, &quot;Ptr&quot;, &amp;MD5_CTX)
    loop % MD5_DIGEST_LENGTH
        o .= Format(&quot;{:02&quot; (case ? &quot;X&quot; : &quot;x&quot;) &quot;}&quot;, NumGet(MD5_CTX, 87 + A_Index, &quot;UChar&quot;))
    return o, DllCall(&quot;FreeLibrary&quot;, &quot;Ptr&quot;, hModule)
}</code></pre></div><p><a href="http://forum.script-coding.com/viewtopic.php?id=14356">Тема для обсуждения</a></p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Mon, 13 Mar 2023 09:03:24 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=157154#p157154</guid>
		</item>
	</channel>
</rss>
