<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: авторизация в фейсбуке facebook]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=17655&amp;type=atom" />
	<updated>2023-03-12T02:04:09Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=17655</id>
		<entry>
			<title type="html"><![CDATA[AHK: авторизация в фейсбуке facebook]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=157092#p157092" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>email := &quot;blah-blah@gmail.com&quot;
password := &quot;pass&quot;

HTTP := ComObjCreate(&quot;WinHTTP.WinHTTPRequest.5.1&quot;)
HTTP.Open(&quot;GET&quot;, &quot;https://facebook.com&quot;, true)
HTTP.SetRequestHeader(&quot;User-Agent&quot;, &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36&quot;)
HTTP.SetRequestHeader(&quot;Pragma&quot;, &quot;no-cache&quot;)
HTTP.SetRequestHeader(&quot;Cache-Control&quot;, &quot;no-cache, no-store&quot;)
HTTP.SetRequestHeader(&quot;If-Modified-Since&quot;, &quot;Sat, 1 Jan 2000 00:00:00 GMT&quot;)
HTTP.SetRequestHeader(&quot;accept&quot;, &quot;text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9&quot;)
HTTP.SetRequestHeader(&quot;sec-fetch-dest&quot;, &quot;document&quot;)
HTTP.SetRequestHeader(&quot;sec-fetch-mode&quot;, &quot;navigate&quot;)
HTTP.SetRequestHeader(&quot;sec-fetch-site&quot;, &quot;same-origin&quot;)
HTTP.SetRequestHeader(&quot;sec-fetch-user&quot;, &quot;?1&quot;)
HTTP.SetRequestHeader(&quot;upgrade-insecure-requests&quot;, &quot;1&quot;)
HTTP.Send()
HTTP.WaitForResponse()
RegExMatch(HTTP.ResponseText, &quot;s)&quot;&quot;__spin_t&quot;&quot;:(.+?),.+?&lt;input type=&quot;&quot;hidden&quot;&quot; name=&quot;&quot;(.+?)&quot;&quot; value=&quot;&quot;(.+?)&quot;&quot;.+?name=&quot;&quot;(.+?)&quot;&quot; value=&quot;&quot;(.+?)&quot;&quot;.+?_js_datr&quot;&quot;,&quot;&quot;(.+?)&quot;&quot;&quot;, match)
datr := match6

HTTP.Open(&quot;POST&quot;, &quot;https://www.facebook.com/login/?privacy_mutation_token=&quot; URIEncode(b64Encode(&quot;{&quot;&quot;type&quot;&quot;:0,&quot;&quot;creation_time&quot;&quot;:&quot; match1 &quot;,&quot;&quot;callsite_id&quot;&quot;:381229079575946}&quot;)), true)
HTTP.SetRequestHeader(&quot;User-Agent&quot;, &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36&quot;)
HTTP.SetRequestHeader(&quot;Pragma&quot;, &quot;no-cache&quot;)
HTTP.SetRequestHeader(&quot;Cache-Control&quot;, &quot;no-cache, no-store&quot;)
HTTP.SetRequestHeader(&quot;If-Modified-Since&quot;, &quot;Sat, 1 Jan 2000 00:00:00 GMT&quot;)
HTTP.SetRequestHeader(&quot;content-type&quot;, &quot;application/x-www-form-urlencoded&quot;)
HTTP.SetRequestHeader(&quot;accept&quot;, &quot;text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9&quot;)
HTTP.SetRequestHeader(&quot;origin&quot;, &quot;https://www.facebook.com&quot;)
HTTP.SetRequestHeader(&quot;referer&quot;, &quot;https://www.facebook.com&quot;)
HTTP.SetRequestHeader(&quot;sec-fetch-dest&quot;, &quot;document&quot;)
HTTP.SetRequestHeader(&quot;sec-fetch-mode&quot;, &quot;navigate&quot;)
HTTP.SetRequestHeader(&quot;sec-fetch-site&quot;, &quot;same-origin&quot;)
HTTP.SetRequestHeader(&quot;sec-fetch-user&quot;, &quot;?1&quot;)
HTTP.SetRequestHeader(&quot;upgrade-insecure-requests&quot;, &quot;1&quot;)
HTTP.SetRequestHeader(&quot;cookie&quot;, &quot;datr=&quot; datr)
HTTP.Send(match2 &quot;=&quot; match3 &quot;&amp;&quot; match4 &quot;=&quot; match5 &quot;&amp;email=&quot; URIEncode(email) &quot;&amp;login_source=comet_headerless_login&amp;next=&amp;encpass=&quot; URIEncode(password))
HTTP.WaitForResponse()
msgbox % HTTP.ResponseText



URIEncode(str, encoding := &quot;UTF-8&quot;)
{
   VarSetCapacity(var, StrPut(str, encoding))
   StrPut(str, &amp;var, encoding)

   While code := NumGet(Var, A_Index - 1, &quot;UChar&quot;)  {
      bool := (code &gt; 0x7F || code &lt; 0x30 || code = 0x3D)
      UrlStr .= bool ? &quot;%&quot; . Format(&quot;{:02X}&quot;, code) : Chr(code)
   }
   Return UrlStr
}

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|0x40000000, &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|0x40000000, &quot;ptr&quot;, &amp;buf, &quot;uint*&quot;, size))
        throw Exception(&quot;CryptBinaryToString failed&quot;, -1)
    return StrGet(&amp;buf)
}</code></pre></div><p><a href="http://forum.script-coding.com/viewtopic.php?id=15875">Тема для обсуждения</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2023-03-12T02:04:09Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=157092#p157092</id>
		</entry>
</feed>
