<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>lander&#x27;s posts</title>
    <subtitle>nothing interesting</subtitle>
    <link rel="self" type="application/atom+xml" href="https://landaire.net/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://landaire.net"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-03-08T00:00:00+00:00</updated>
    <id>https://landaire.net/atom.xml</id>
    <entry xml:lang="en">
        <title>Reverse Engineering Binaries With AI</title>
        <published>2026-03-08T00:00:00+00:00</published>
        <updated>2026-03-08T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://landaire.net/reverse-engineering-with-ai/"/>
        <id>https://landaire.net/reverse-engineering-with-ai/</id>
        
        <content type="html" xml:base="https://landaire.net/reverse-engineering-with-ai/">&lt;h2 id=&quot;getting-into-security&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#getting-into-security&quot; aria-label=&quot;Anchor link for: getting-into-security&quot;
    &gt;#&lt;&#x2F;a
&gt;
Getting Into Security&lt;&#x2F;h2&gt;
&lt;p&gt;In middle school the gateway drug known as &lt;em&gt;Halo 3&lt;&#x2F;em&gt; and unapproved mods shared on the game&#x27;s File Share system got me interested in programming and security.&lt;&#x2F;p&gt;
&lt;p&gt;Through these mods and YouTube tutorials I discovered the (long defunct) Xbox-Tampers forum, followed tutorials on how to edit map files in a hex editor and make very basic MSN Messenger nudge bomb applications, and met some great people through that site who I&#x27;m still friends with.&lt;&#x2F;p&gt;
&lt;p&gt;I remember the struggles in the late 2000s and early 2010s of using &lt;del&gt;cracked&lt;&#x2F;del&gt; expensive copies of IDA Pro to reverse engineer bits of the Xbox 360 to better write modding tools, and begging my friends who were much better than me (like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;x.com&#x2F;carrot_c4k3&quot;&gt;@carrot_c4k3&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Xenomega&quot;&gt;Xenomega&lt;&#x2F;a&gt;, and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;x.com&#x2F;Grimdoomer&#x2F;&quot;&gt;@Grimdoomer&lt;&#x2F;a&gt;) to help me reverse some Xbox 360 OS functions that I could not understand.&lt;&#x2F;p&gt;
&lt;p&gt;I&#x27;ve invested a lot of time and energy to try to get better at these things over the past 18 or so years. It&#x27;s not what I live and breathe anymore and I&#x27;m not insanely cracked at RE, but I feel I&#x27;ve gotten pretty decent at being able to throw a binary into a static analysis tool and with disassembly&#x2F;pseudocode can reasonably understand what&#x27;s going on in an an application.&lt;&#x2F;p&gt;
&lt;p&gt;I&#x27;ve worked professional as a security engineer for the past 10 years and of course, AI &quot;happened&quot; and it&#x27;s shaken up a lot of things, but I&#x27;ve still felt fairly comfortable about my skills not being terribly threatened. I&#x27;ve seen people try traditional static analysis tools, data flow analysis, etc., and all tooling falls short somehow, so surely this won&#x27;t be too different in the near-term -- especially for such a niche skill -- right?&lt;&#x2F;p&gt;
&lt;p&gt;I think I was wrong.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;programming-w-ai&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#programming-w-ai&quot; aria-label=&quot;Anchor link for: programming-w-ai&quot;
    &gt;#&lt;&#x2F;a
&gt;
Programming w&#x2F; AI&lt;&#x2F;h2&gt;
&lt;p&gt;For non-ethical reasons I&#x27;ve felt pretty anti-LLM for coding. Mostly because it made me feel disconnected, dumb, and lose context. When Copilot first came out I gave it a shot but I felt like a monkey just smashing tab to have it complete some code. My subscription was soon cancelled as I felt like I was losing my edge when I didn&#x27;t have AI assistance readily available.&lt;&#x2F;p&gt;
&lt;p&gt;At my job, however, AI adoption is being driven fairly hard and I&#x27;ve taken to using Claude Code for some of my side projects to understand AI usage better.&lt;&#x2F;p&gt;
&lt;p&gt;A couple years ago I created a program called &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;landaire.net&#x2F;wows-toolkit&#x2F;&quot;&gt;WoWs Toolkit&lt;&#x2F;a&gt; which for about the last year went without any major updates because I just lost the steam to context switch all the time.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s a fairly straightforward application designed to datamine the naval warfare videogame &lt;em&gt;World of Warships&lt;&#x2F;em&gt;, but has some slightly complicated internals which are used to read game files, understand the match replay format, etc:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;ai-reverse-engineering&#x2F;replay_inspector.png&quot; alt=&quot;WoWs Toolkit&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;I&#x27;ve had people in the community ask for various features over time which were mostly filed away in the &quot;Nice To Have Eventually&quot; folder as some require significant time investment.&lt;&#x2F;p&gt;
&lt;p&gt;One requested feature was the ability to read the game&#x27;s proprietary 3D model format to understand the armor layout of ships in the game better. I started to reverse engineer the format about a year ago, lost steam, and just kind of dropped it.&lt;&#x2F;p&gt;
&lt;p&gt;There are various moving parts for that, some of which I&#x27;d already done:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reading the game&#x27;s virtual filesystem (VFS) without intermediate tools.&lt;&#x2F;li&gt;
&lt;li&gt;Understanding the game&#x27;s &quot;GameParams&quot; database which holds meta information about ships, upgrades, each component&#x27;s 3D model path, etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;And parts I&#x27;d not done:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;In the main VFS is a file called &quot;assets.bin&quot; which is a format very similar to the VFS it&#x27;s contained within, but different enough to break my parser and it also had a second string table that I hadn&#x27;t yet understood.&lt;&#x2F;li&gt;
&lt;li&gt;Any research on the &lt;code&gt;.geometry&lt;&#x2F;code&gt;, &lt;code&gt;.visual&lt;&#x2F;code&gt;, or &lt;code&gt;.model&lt;&#x2F;code&gt; files -- all of which are required to paint a complete picture of the mesh, model positions, world transform, etc.&lt;&#x2F;li&gt;
&lt;li&gt;Any understanding of how ship armor was represented and how it works in relation to the mesh.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;I was making some changes to the app and thought, &quot;Screw it, why not see if Claude can figure it out?&quot;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;claude-code-binary-ninja-mcp&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#claude-code-binary-ninja-mcp&quot; aria-label=&quot;Anchor link for: claude-code-binary-ninja-mcp&quot;
    &gt;#&lt;&#x2F;a
&gt;
Claude Code + Binary Ninja MCP&lt;&#x2F;h2&gt;
&lt;p&gt;I installed one of the MCP plugins for Binary Ninja, set it up in Claude Code, and gave it the following prompt:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;We have the Binary Ninja MCP running with WorldOfWarships64.exe running. There&#x27;s some code I&#x27;d like you to reverse engineer in order to figure out a file format. Please document findings in G:\dev\wowsunpack\MODELS.md&lt;&#x2F;p&gt;
&lt;p&gt;We&#x27;re going to be reverse engineering the WoWs .geometry file format. An example file can be found here: G:\wows_dump\res\content\gameplay\uk\ship\aircarrier\BSA013_Colossus_1945\BSA013_Colossus_1945.geometry&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s a 3D model format that I believe is proprietary to Wargaming&#x27;s BigWorld engine. There are some magic constants in the file like &lt;code&gt;45 4E 43 44&lt;&#x2F;code&gt; that I&#x27;ve used to find a possible candidate function to start at: sub_140a5a940&lt;&#x2F;p&gt;
&lt;p&gt;This has some interesting strings such as: &lt;code&gt;bufferHeader-&amp;gt;m_magicVal == EncodedBufferHeader::EncodedMagicVal&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;There are other functions with this magic value too that I have not looked at. Please remember if you search the binary in binary ninja for this magic value, it will need to be little-endian encoded.&lt;&#x2F;p&gt;
&lt;p&gt;If you want to write code to test, feel free to add a new command to the wowsunpack CLI and start adding code to a new models module.&lt;&#x2F;p&gt;
&lt;p&gt;We should use winnow for our binary parsing. Do not commit any changes.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Then came some early results:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;ai-reverse-engineering&#x2F;early_analysis.png&quot; alt=&quot;Early AI analysis&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: I&#x27;m using Claude Desktop here for no good reason. Normally I&#x27;d use the CLI or ACP interfaces.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;And after processing for a bit:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;ai-reverse-engineering&#x2F;later_analysis.png&quot; alt=&quot;Additional AI analysis&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;After about an hour or two (part of that time was waiting on me to accept some action prompt) I had some 3D models extracting into a format I could load into Blender piece-by-piece:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;ai-reverse-engineering&#x2F;first_3d_models.png&quot; alt=&quot;First 3D Models&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;And after more prompting, it was able to export the entire ship with its paint textures:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;ai-reverse-engineering&#x2F;yamato_full.png&quot; alt=&quot;Ship Model&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;And as a side note, it did label things&#x2F;create structs!&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;ai-reverse-engineering&#x2F;labeling.png&quot; alt=&quot;Binja Labeling&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As far as code is concerned, it tried to do some &lt;em&gt;very&lt;&#x2F;em&gt; dumb things along the way. For example, in one of these files there&#x27;s some XML data at some point. It generated code where after parsing a section header it would scan forward looking for the XML blob&#x27;s opening tag and do the same from that position to find the closing tag. I had to curse and yell telling it, &quot;You&#x27;re screwing this up, stop taking shortcuts. Do this the the right way. No heuristics.&quot;&lt;&#x2F;p&gt;
&lt;p&gt;Now obviously this binary has checked assertions (which I hope remain in the binary after this blog post :) ) and those make analysis overall easier. So maybe this is an extremely positive case.&lt;&#x2F;p&gt;
&lt;p&gt;But honestly, I&#x27;m impressed with what Claude was able to do. From this very dumb prompt I was able to go from a bit of info from myself + a very surface-level parser for a &lt;em&gt;dependency&lt;&#x2F;em&gt; of the model loading pipeline (not even the 3D model itself!) to code which is able to export 3D models of ships with their textures and armor models, at any LOD. And it built a custom 3D model viewer into WoWs Toolkit.&lt;&#x2F;p&gt;
&lt;p&gt;It even did some weird things I never thought of, like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;wows-toolkit&#x2F;blob&#x2F;36234afb178453fc262b113cfba1931d896f9fe7&#x2F;scripts&#x2F;crack_mfm_hashes.py&quot;&gt;cracking hashes&lt;&#x2F;a&gt; from a set of known strings in the binary to figure out items in the tree structure.&lt;&#x2F;p&gt;
&lt;p&gt;I barely wrote a line of code for this and it cost maybe ~$150 in tokens:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;ai-reverse-engineering&#x2F;armor_viewer.png&quot; alt=&quot;Early AI analysis&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If you would like to read its full analysis of the 3D model format, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;wows-toolkit&#x2F;blob&#x2F;36234afb178453fc262b113cfba1931d896f9fe7&#x2F;docs&#x2F;MODELS.md&quot;&gt;here is its braindump&lt;&#x2F;a&gt;. And &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;wows-toolkit&#x2F;tree&#x2F;36234afb178453fc262b113cfba1931d896f9fe7&#x2F;crates&#x2F;wowsunpack&#x2F;src&#x2F;models&quot;&gt;here is the code&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;learnings&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#learnings&quot; aria-label=&quot;Anchor link for: learnings&quot;
    &gt;#&lt;&#x2F;a
&gt;
Learnings&lt;&#x2F;h2&gt;
&lt;p&gt;While I really don&#x27;t have much to share about the specific &lt;em&gt;thing&lt;&#x2F;em&gt; being reverse engineered, I did learn quite a bit about interacting with Claude. I&#x27;m sure people who live and breathe LLMs have their own advice, but what I found personally valuable:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Developing custom CLIs for rapid testing&#x2F;iteration. I already had a CLI for interacting with game files which Claude was able to easily extend to test its analysis of the binary.&lt;&#x2F;li&gt;
&lt;li&gt;The existing tooling beyond just that single CLI was critical. Other CLI tools for examining related file formats or deobfuscating data were crucial. This wasn&#x27;t just a &quot;point it at Binja and profit&quot; sort of deal to achieve the polished result.&lt;&#x2F;li&gt;
&lt;li&gt;Watching the code as it streams in, or ensuring a mostly comprehensive review for reasons I&#x27;ve already mentioned like the AI trying to take shortcuts, is very important. I interrupted Claude many times when I noticed it was taking a subpar approach.&lt;&#x2F;li&gt;
&lt;li&gt;My project is in Rust, and Rust has a strong type system. Having the AI use strong newtypes for things like identifiers helped quite a bit with ensuring bug-free code.&lt;&#x2F;li&gt;
&lt;li&gt;My code was originally split into a couple different repos (one for the CLI tool and libraries, one for the UI). Swapping editor windows before all of this was kind of annoying, and it was even more annoying when trying to have the agents do cross-repo changes.&lt;&#x2F;li&gt;
&lt;li&gt;If you want to sniff out AI-assisted or generated code changes, look for unicode symbols like the fancy Unicode equivalent of &lt;code&gt;&amp;lt;-&amp;gt;&lt;&#x2F;code&gt; or &lt;code&gt;-&amp;gt;&lt;&#x2F;code&gt;, comments in Rust starting with &lt;code&gt;&#x2F;&#x2F;!&lt;&#x2F;code&gt;, or sudden introduction of section dividers like the following:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; ---------------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Helper: parse an array at a given offset, wrapping winnow errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; ---------------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And most importantly: there were still bugs along the way. Trying to debug some of these things and prompt for fixes without knowing specifics of how the pieces were interconnected was really annoying (e.g. ship turrets were sometimes not facing to the correct default orientation). For things I really care about being done right, I think it&#x27;s still worthwhile to go through the pains myself &lt;em&gt;first&lt;&#x2F;em&gt; and have AI assistance later if I can if for not other reason than to save time in correcting its mistakes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;mixed-feelings&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#mixed-feelings&quot; aria-label=&quot;Anchor link for: mixed-feelings&quot;
    &gt;#&lt;&#x2F;a
&gt;
Mixed Feelings&lt;&#x2F;h2&gt;
&lt;p&gt;I would consider myself a low-level person who thinks about allocations in my application, the performance cost of various approaches, and I like knowing the details of how something works. I might do the wrong thing at times for certain tradeoffs, but I like to be aware of that tradeoff existing and which decision was made. For this task though?&lt;&#x2F;p&gt;
&lt;p&gt;I have no idea how it works.&lt;&#x2F;p&gt;
&lt;p&gt;Before starting this project I had zero knowledge of 3D rendering, model formats, and while I did manually reverse engineer the game&#x27;s general virtual filesystem format for its packed files, I got about halfway through reversing the similar virtual filesystem used for 3D model assets. I have no idea how it works beyond what I started.&lt;&#x2F;p&gt;
&lt;p&gt;I read the code as Claude went along, pointing out things that I thought were obvious anti-patterns or incorrect... but I couldn&#x27;t tell you how the different ship mesh sections are read, then paired to their transformation matrix (which is located in another file).&lt;&#x2F;p&gt;
&lt;p&gt;That kind of sucks.&lt;&#x2F;p&gt;
&lt;p&gt;Don&#x27;t get me wrong -- I &lt;em&gt;am&lt;&#x2F;em&gt; happy that I&#x27;m giving people something they want and it otherwise may not have ever gotten done without Claude helping accelerate things. I&#x27;m also happy that the barrier to these types of tasks are lowered for a modest fee. There&#x27;s just not &quot;my code&quot; and the iteration over failure to be proud of, and I want people to feel confident that the person behind the software fully understands what it&#x27;s doing. Or supposed to be doing.&lt;&#x2F;p&gt;
&lt;p&gt;Even back in the days of asking my friends for help, I was still building a relationship with them in some capacity and they could help guide me. In some cases they would even just reverse engineer things, hand me the completed package, and explain to me the bullshit they had to understand, and I&#x27;d happily give them a shoutout for helping with the project. Now it&#x27;s a one-way trip with Claude and asking it to do a brain dump.&lt;&#x2F;p&gt;
&lt;p&gt;I suppose that just like I told the AI not to take shortcuts though, I find it hard to accept &lt;strong&gt;&amp;lt;Insert This Month&#x27;s Best Model&amp;gt;&lt;&#x2F;strong&gt; doing these things at the cost of building my own context, expanding my skillset to new areas, and keeping my existing skills sharp.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>A File Format Uncracked for 20 Years</title>
        <published>2025-11-06T00:00:00+00:00</published>
        <updated>2025-11-06T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://landaire.net/a-file-format-uncracked-for-20-years/"/>
        <id>https://landaire.net/a-file-format-uncracked-for-20-years/</id>
        
        <content type="html" xml:base="https://landaire.net/a-file-format-uncracked-for-20-years/">&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Tom_Clancy%27s_Splinter_Cell_(video_game)&quot;&gt;Splinter Cell (2002)&lt;&#x2F;a&gt; was one of the first games I had on the original Xbox and still remains one of my favorite games of all time. The game was developed by Ubisoft using Unreal Engine 2 -- licensed from a small indie dev called Epic Games who continues to use and license its game engine technology for contemporary small-budget indie games such as &lt;em&gt;Fortnite&lt;&#x2F;em&gt; and &lt;em&gt;Halo: Campaign Evolved&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;I got into programming&#x2F;hacking through video games and I still enjoy data mining&#x2F;exploring cut content from the few games I play nowadays. I recently randomly decided to look online for cut content from Splinter Cell and I was kind of surprised by the lack of datamined info. There isn&#x27;t really much information on the topic aside from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;hiddenpalace.org&#x2F;Tom_Clancy%27s_Splinter_Cell_(Sep_13,_2002_prototype)&quot;&gt;an OG Xbox review copy&lt;&#x2F;a&gt; of the game which contained two levels cut from the retail Xbox version and some other minor differences.&lt;&#x2F;p&gt;
&lt;p&gt;Naturally, I decided to &lt;em&gt;legally backup my personal disc copy of the game&lt;&#x2F;em&gt; and got to digging into the files.&lt;&#x2F;p&gt;
&lt;p&gt;My initial objective was to examine the format of the game data and sniff out if there&#x27;s any indicators of cut content such as textures, models, interesting strings -- whatever. Some nice finds would be debug menus, voice lines, weapon concepts, or levels that are unreachable through normal game progression.&lt;&#x2F;p&gt;
&lt;p&gt;The game&#x27;s (truncated) file tree looks like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── contentimage.xbx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── dashupdate.xbe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── default.xbe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── downloader.xbe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── dynamicxbox.umd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── LMaps&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── 000_menu&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │   ├── common.lin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │   └── menu.lin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── 001_Training&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │   ├── 0_0_2_Training.bik&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │   ├── 0_0_2_Training.lin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │   ├── 0_0_2_Training_progress.tga&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │   ├── 0_0_2_Training_start.tga&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │   ├── 0_0_3_Training.lin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │   ├── 0_0_3_Training_complete.tga&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │   ├── 0_0_3_Training_progress.tga&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │   ├── common.lin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │   └── French&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │       ├── 0_0_2_Training_progress.tga&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │       ├── 0_0_2_Training_start.tga&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │       ├── 0_0_3_Training_complete.tga&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │       └── 0_0_3_Training_progress.tga&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;.xbe&lt;&#x2F;code&gt; files are Xbox Executables, &lt;code&gt;.bik&lt;&#x2F;code&gt; are &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.radgametools.com&#x2F;bnkmain.htm&quot;&gt;Bink Video&lt;&#x2F;a&gt; files, and &lt;code&gt;.tga&lt;&#x2F;code&gt; are images... but &lt;code&gt;.lin&lt;&#x2F;code&gt; is new to me.&lt;&#x2F;p&gt;
&lt;p&gt;In Splinter Cell the maps are divided into separate parts. So in the training mission &lt;code&gt;001_Training&lt;&#x2F;code&gt;, you likely have &lt;code&gt;0_0_2_Training.lin&lt;&#x2F;code&gt; for the first part and &lt;code&gt;0_0_3_Training.lin&lt;&#x2F;code&gt; for the second which gets loaded via an in-game loading sequence after advancing to some zone in the map.&lt;&#x2F;p&gt;
&lt;p&gt;I instantly thought that &lt;code&gt;common.lin&lt;&#x2F;code&gt; might contain data common to both of these parts as a way to reduce file size. The Halo games for instance have a &lt;code&gt;shared.map&lt;&#x2F;code&gt; containing assets which are shared across most maps, and load data at a fixed address so that the file can be trivially transmuted from a binary blob to its in-memory data structures.&lt;&#x2F;p&gt;
&lt;p&gt;Examining the &lt;code&gt;common.lin&lt;&#x2F;code&gt; file in a hex editor, a few things become immediately apparent:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000000│ 04 00 00 00 0c 00 00 00 ┊ 78 9c 7b d7 97 c2 00 00 │........┊x.{.....│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000010│ 06 2e 01 e1 04 00 00 00 ┊ 0c 00 00 00 78 9c 63 60 │........┊....x.c`│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000020│ 90 66 00 00 00 3a 00 1c ┊ 04 00 00 00 0c 00 00 00 │.f...:..┊........│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000030│ 78 9c 73 48 67 60 00 00 ┊ 02 39 00 a8 04 00 00 00 │x.sHg`..┊.9......│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000040│ 0c 00 00 00 78 9c b3 e0 ┊ 65 60 00 00 01 0b 00 46 │....x...┊e`.....F│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Data between &lt;code&gt;0x0..0x4&lt;&#x2F;code&gt; and &lt;code&gt;0x4..0x8&lt;&#x2F;code&gt; are little-endian 32-bit integers: &lt;code&gt;0x00000004&lt;&#x2F;code&gt; and &lt;code&gt;0x0000000C&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;At offset &lt;code&gt;0x8&lt;&#x2F;code&gt; is what appears to be a zlib-compressed chunk of data -- denoted by the &#x27;x&#x27; in the ASCII view and &lt;code&gt;0x78 0x9c&lt;&#x2F;code&gt; in the hex view.&lt;&#x2F;li&gt;
&lt;li&gt;There&#x27;s another sequence of this at offset &lt;code&gt;0x14&lt;&#x2F;code&gt;, which happens to be &lt;code&gt;0xC&lt;&#x2F;code&gt; bytes past the offset of the zlib data (&lt;code&gt;0x8&lt;&#x2F;code&gt;), and another at &lt;code&gt;0x28&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Presumably the format here is &lt;code&gt;{decompressed_data_len, compressed_data_len, zlib_block[compressed_data_len]}&lt;&#x2F;code&gt; repeated.&lt;&#x2F;p&gt;
&lt;p&gt;So far so good.&lt;&#x2F;p&gt;
&lt;p&gt;I wrote a quick tool to decompress the archive and without a hitch ended up with a 64k file containing 4 &lt;code&gt;u32&lt;&#x2F;code&gt;s prefixing it. Since these 4 are in their own dedicated zlib-compressed chunks I consider to be separate from the main data. I later reverse engineered and identified how they are used:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uncompressed_data_size: 0x648EEE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;texture_cache_size? - later used when calling D3DDevice_CreateTexture2: 0x1B0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vertex_buffer_size? - ditto, D3DDevice_CreateVertexBuffer2: 0x6740&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;index_buffer_size? - ditto, XGSetIndexBufferHeader: 0xD38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And this is what the main data section&#x27;s first 0x100 bytes look like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000000│ 5c 58 9e 13 00 a3 c5 e3 ┊ 9f b4 92 9b 13 5c 58 9e │\X......┊.....\X.│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000010│ 13 01 00 00 00 04 2a d6 ┊ fe 7e 37 13 4d 61 70 73 │......*.┊.~7.Maps│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000020│ 5c 6d 65 6e 75 5c 6d 65 ┊ 6e 75 2e 75 6e 72 00 00 │\menu\me┊nu.unr..│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000030│ 00 00 00 ee de 00 00 00 ┊ 00 00 00 16 4d 61 70 73 │........┊....Maps│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000040│ 5c 31 5f 31 5f 30 54 62 ┊ 69 6c 69 73 69 2e 75 6e │\1_1_0Tb┊ilisi.un│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000050│ 72 00 f0 de 00 00 6d c9 ┊ 17 00 00 00 00 00 16 4d │r.....m.┊.......M│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000060│ 61 70 73 5c 31 5f 31 5f ┊ 31 54 62 69 6c 69 73 69 │aps\1_1_┊1Tbilisi│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000070│ 2e 75 6e 72 00 60 a8 18 ┊ 00 98 34 21 00 00 00 00 │.unr.`..┊..4!....│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000080│ 00 16 4d 61 70 73 5c 31 ┊ 5f 31 5f 32 54 62 69 6c │..Maps\1┊_1_2Tbil│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00000090│ 69 73 69 2e 75 6e 72 00 ┊ 00 dd 39 00 89 63 19 00 │isi.unr.┊..9..c..│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│000000a0│ 00 00 00 00 18 4d 61 70 ┊ 73 5c 30 5f 30 5f 32 5f │.....Map┊s\0_0_2_│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│000000b0│ 54 72 61 69 6e 69 6e 67 ┊ 2e 75 6e 72 00 90 40 53 │Training┊.unr..@S│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│000000c0│ 00 0f 9f 0c 00 00 00 00 ┊ 00 18 4d 61 70 73 5c 30 │........┊..Maps\0│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│000000d0│ 5f 30 5f 33 5f 54 72 61 ┊ 69 6e 69 6e 67 2e 75 6e │_0_3_Tra┊ining.un│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│000000e0│ 72 00 a0 df 5f 00 48 86 ┊ 11 00 00 00 00 00 1e 4d │r..._.H.┊.......M│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│000000f0│ 61 70 73 5c 31 5f 32 5f ┊ 31 44 65 66 65 6e 73 65 │aps\1_2_┊1Defense│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And at what appears to be the end of the file table:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c580│ 79 6e 63 68 5c 69 6e 74 ┊ 5c 55 73 61 53 6f 6c 64 │ynch\int┊\UsaSold│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c590│ 69 65 72 5c 55 53 4f 55 ┊ 4e 43 5f 33 2e 62 69 6e │ier\USOU┊NC_3.bin│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c5a0│ 00 40 8d 9b 13 74 05 00 ┊ 00 00 00 00 00 c1 83 2a │.@...t..┊.......*│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c5b0│ 9e 64 00 11 00 01 00 00 ┊ 00 10 0e 00 00 88 00 00 │.d......┊........│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c5c0│ 00 fa 0f 00 00 f3 7a 11 ┊ 00 4e 00 00 00 3e 78 11 │......z.┊.N...&amp;gt;x.│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c5d0│ 00 de ad f0 0f 42 01 9c ┊ 90 92 8f 96 93 9e 8b 96 │.....B..┊........│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c5e0│ 90 91 9a 9c 97 9a 93 90 ┊ 91 df af bc ba bc b7 ba │........┊........│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c5f0│ b3 b0 b1 df a6 c5 a3 ba ┊ bc b7 ba b3 b0 b1 a3 ac │........┊........│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c600│ a6 ac ab ba b2 a3 df ce ┊ cf d0 cd c9 d0 cf cd df │........┊........│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c610│ cd ce c5 cf cd c5 ce cb ┊ ff 00 00 00 00 00 00 00 │........┊........│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c620│ 00 00 00 00 00 00 00 00 ┊ 00 01 00 00 00 fa 0f 00 │........┊........│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c630│ 00 10 0e 00 00 05 4e 6f ┊ 6e 65 00 10 04 07 04 06 │......No┊ne......│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c640│ 43 6f 6c 6f 72 00 10 04 ┊ 07 04 0d 49 6e 74 65 72 │Color...┊...Inter│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c650│ 6e 61 6c 54 69 6d 65 00 ┊ 10 00 07 00 07 45 6e 67 │nalTime.┊.....Eng│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c660│ 69 6e 65 00 10 00 07 04 ┊ 05 43 6f 72 65 00 10 00 │ine.....┊.Core...│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│0002c670│ 07 04 07 53 79 73 74 65 ┊ 6d 00 10 00 07 04 06 55 │...Syste┊m......U│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Just to save some blog space on my trial and error process here, I&#x27;m going to drop some of the resources I found which discuss this format:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;oldunreal.com&#x2F;phpBB3&#x2F;viewtopic.php?t=4885&quot;&gt;https:&#x2F;&#x2F;oldunreal.com&#x2F;phpBB3&#x2F;viewtopic.php?t=4885&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;zenhax.com&#x2F;viewtopic.php@t=1049.html&quot;&gt;https:&#x2F;&#x2F;zenhax.com&#x2F;viewtopic.php@t=1049.html&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;reshax.com&#x2F;topic&#x2F;1421-ubisoft-unreal-engine-2-open-season-2006-video-game-umd-also-lin-xbox-xbox-360-pc-and-liv-latter-being-exclusive-to-xbox-360&#x2F;&quot;&gt;https:&#x2F;&#x2F;reshax.com&#x2F;topic&#x2F;1421-ubisoft-unreal-engine-2-open-season-2006-video-game-umd-also-lin-xbox-xbox-360-pc-and-liv-latter-being-exclusive-to-xbox-360&#x2F;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.unrealarchive.org&#x2F;wikis&#x2F;unreal-wiki&#x2F;Legacy:UMOD&#x2F;File_Format.html&quot;&gt;https:&#x2F;&#x2F;www.unrealarchive.org&#x2F;wikis&#x2F;unreal-wiki&#x2F;Legacy:UMOD&#x2F;File_Format.html&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The last two posts in particular had structure info that was helpful in figuring out the packed int format (think UTF-8 and its variable-length encoding) and a couple unknown vars.&lt;&#x2F;p&gt;
&lt;p&gt;What I gathered from all of these posts was that over time, nobody&#x27;s really been able to figure out this format&#x27;s quirks sufficiently to unpack the data. Everyone seems to think that some kind of VFS is created and the data gets mapped at a specific address and then read. Which may be true for some titles or consoles, but is not really the case for this one.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;My objective has now changed:&lt;&#x2F;strong&gt; I now want to reverse engineer this file format and be able to dump individual files from this filesystem. Then I can achieve my core goal of looking for cut content. Then I can maybe play the game.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;tl-dr-of-the-general-lin-structure&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#tl-dr-of-the-general-lin-structure&quot; aria-label=&quot;Anchor link for: tl-dr-of-the-general-lin-structure&quot;
    &gt;#&lt;&#x2F;a
&gt;
tl;dr of the general &lt;code&gt;.lin&lt;&#x2F;code&gt; structure&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;common.lin&lt;&#x2F;code&gt; has a different layout from the other &lt;code&gt;.lin&lt;&#x2F;code&gt; files that looks roughly like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;* ==== Standard Data ==== *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F; These three, from research + reverse engineering, should not be considered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F; as part of the &amp;quot;whole&amp;quot; file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;u32&lt;&#x2F;span&gt;&lt;span&gt;             maybe_load_address&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; 5C 58 9E 13 (0x139e585c) in common.lin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;compressed_int  name_length&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; 0 in common.lin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span&gt;            name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;name_length&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;* ==== common.lin-specific file header ==== *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;u32&lt;&#x2F;span&gt;&lt;span&gt;             magic&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;              &#x2F;&#x2F; 0x9fe3c5a3 in little endian, i.e. A3 C5 E3 9F&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;u32&lt;&#x2F;span&gt;&lt;span&gt;             unk_address&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; B4 92 9B 13, (0x139b92b4) suspiciously similar to maybe_load_address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;                                    &#x2F;&#x2F; unk_address - load_address gives you the start of the file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;                                    &#x2F;&#x2F; table, relative to the magic?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;u32&lt;&#x2F;span&gt;&lt;span&gt;             load_address2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; 5C 58 9E 13 same as maybe_load_address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;u8&lt;&#x2F;span&gt;&lt;span&gt;              unknown&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;         &#x2F;&#x2F; 01 00 00 00 04 2A D6 FE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;compressed_int  file_entry_count&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;FileEntry&lt;&#x2F;span&gt;&lt;span&gt;       file_entries&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;file_entry_count&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; FileEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    compressed_int  name_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    char&lt;&#x2F;span&gt;&lt;span&gt;            name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;name_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    u32&lt;&#x2F;span&gt;&lt;span&gt;             offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    u32&lt;&#x2F;span&gt;&lt;span&gt;             len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    u32&lt;&#x2F;span&gt;&lt;span&gt;             unk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then immediately following the &lt;code&gt;FileEntry&lt;&#x2F;code&gt; table are 54 Unreal Engine Package files in sequence (identified via their &lt;code&gt;0x9E2A83C1&lt;&#x2F;code&gt; magic -- these are also referred to as &lt;strong&gt;Linker&lt;&#x2F;strong&gt; files) that presumably map to the files in the file table.&lt;&#x2F;p&gt;
&lt;p&gt;The map-specific files like &lt;code&gt;menu.lin&lt;&#x2F;code&gt; and &lt;code&gt;0_0_2_Training.lin&lt;&#x2F;code&gt; do not have the file table, but they do have the first 3 fields (and a non-null string like &quot;menu\x0&quot; for the name field) then a sequence of Linker files.&lt;&#x2F;p&gt;
&lt;p&gt;But the difficulty with parsing this data starts with the file table.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;problems&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#problems&quot; aria-label=&quot;Anchor link for: problems&quot;
    &gt;#&lt;&#x2F;a
&gt;
Problems&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;file-table&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#file-table&quot; aria-label=&quot;Anchor link for: file-table&quot;
    &gt;#&lt;&#x2F;a
&gt;
File Table&lt;&#x2F;h3&gt;
&lt;p&gt;The file table is a very simple format that I&#x27;m able to parse with my program:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;FileEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Maps&lt;&#x2F;span&gt;&lt;span&gt;\\menu\\menu&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xDEEE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;FileEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Maps&lt;&#x2F;span&gt;&lt;span&gt;\\1_1_0Tbilisi&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xDEF0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x17C96D&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;FileEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Maps&lt;&#x2F;span&gt;&lt;span&gt;\\1_1_1Tbilisi&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x18A860&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x213498&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;FileEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Maps&lt;&#x2F;span&gt;&lt;span&gt;\\1_1_2Tbilisi&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x39DD00&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x196389&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;FileEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Maps&lt;&#x2F;span&gt;&lt;span&gt;\\0_0_2_Training&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x534090&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xC9F0F&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;FileEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Maps&lt;&#x2F;span&gt;&lt;span&gt;\\0_0_3_Training&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x5FDFA0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x118648&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;FileEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Maps&lt;&#x2F;span&gt;&lt;span&gt;\\1_2_1DefenseMinistry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x7165F0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x249AF6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;FileEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Maps&lt;&#x2F;span&gt;&lt;span&gt;\\1_2_2DefenseMinistry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x9600F0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x20F662&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;snip&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At first glance the files seem to be laid out sequentially, aligned to a pointer-width boundary. Except, notice that last file&#x27;s offset... &lt;code&gt;0x9600F0&lt;&#x2F;code&gt;. This is way outside of the range of my &lt;code&gt;0x648EEE&lt;&#x2F;code&gt;-length file, and this file list contains 3,582 files! Not 54 as expected from the count of Unreal Package magics!&lt;&#x2F;p&gt;
&lt;p&gt;The mismatch file count could be explained by not every file in this container being an Unreal Package, but the offsets so far are &lt;em&gt;extremely&lt;&#x2F;em&gt; wrong.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;file-reading&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#file-reading&quot; aria-label=&quot;Anchor link for: file-reading&quot;
    &gt;#&lt;&#x2F;a
&gt;
File Reading&lt;&#x2F;h3&gt;
&lt;p&gt;After debugging the game in the Original Xbox emulator &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;xemu.app&#x2F;&quot;&gt;xemu&lt;&#x2F;a&gt;, I was able to find the routine which opens the file, as well as the function which reads and decompresses data.&lt;&#x2F;p&gt;
&lt;details class=&quot;collapse-section my-4&quot;&gt;
    &lt;summary&gt;Function Identification Methodology&lt;&#x2F;summary&gt;
    &lt;div class=&quot;collapse-content&quot;&gt;
        If anyone&#x27;s curious on the methodology: I identified &lt;code&gt;NtCreateFile&lt;&#x2F;code&gt;, set a breakpoint, recorded the &lt;code&gt;HANDLE&lt;&#x2F;code&gt; returned for the file path I cared about, then set a breakpoint at &lt;code&gt;NtReadFile&lt;&#x2F;code&gt; and broke when the input &lt;code&gt;HANDLE&lt;&#x2F;code&gt; matched the expected value. The call stack&#x2F;stepping from here helped identify interesting callers. Alternatively, the string &quot;&lt;code&gt;unknown compression method&lt;&#x2F;code&gt;&quot; is useful in finding the decompression routine &lt;code&gt;inflateInit2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This is not super relevant to the blog post which is why it&#x27;s in this little collapse section. I hate reading posts like this that skip over a detail I&#x27;m interested in like it&#x27;s just common knowledge how something is done, so I&#x27;m trying to avoid doing that :)
    &lt;&#x2F;div&gt;
&lt;&#x2F;details&gt;
&lt;p&gt;&lt;em&gt;Note: Click images to see in higher res&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;compressed_fn_hlil.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;compressed_fn_hlil.png&quot; alt=&quot;Compressed read function high-level IL&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This function basically checks the requested read size against how much data it has precached in its decompressed data buffer. It will then copy as much data as it can from its precached buffer to the output buffer, then read the next block of compressed zlib data into its precache buffer if the previous one was exhausted. Repeat this process until the request is satisfied.&lt;&#x2F;p&gt;
&lt;p&gt;Identifying this function was pretty important for my reverse engineering process. I could now set breakpoints on the code which copies data to the output buffer and see who&#x27;s calling this function when data is read from offsets I care about.&lt;&#x2F;p&gt;
&lt;p&gt;I stepped through this code, set Memory Read breakpoints on data I didn&#x27;t yet understand, and noted something interesting early on!&lt;&#x2F;p&gt;
&lt;p&gt;Those &quot;addresses&quot; from the header (&lt;code&gt;0x139e585c&lt;&#x2F;code&gt;)? Those are actually passed to what I can only guess is a &lt;code&gt;Seek&lt;&#x2F;code&gt; routine which updates the &lt;code&gt;position&lt;&#x2F;code&gt; property of the file reader, which then makes an indirect call to another function that &lt;strong&gt;literally does nothing&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The entire content of the function is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;retn    4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;That&#x27;s it.&lt;&#x2F;p&gt;
&lt;p&gt;Then the reads just... continue from their last position? Since the function is an indirect call, I can only assume that I was looking at some composed C++ object where the outer class object updates its own &lt;code&gt;position&lt;&#x2F;code&gt; in &lt;code&gt;Seek()&lt;&#x2F;code&gt; and then calls its underlying file reader&#x27;s &lt;code&gt;Seek()&lt;&#x2F;code&gt;... which is a no-op?&lt;&#x2F;p&gt;
&lt;p&gt;After setting Memory Read breakpoints on the object&#x27;s &lt;code&gt;position&lt;&#x2F;code&gt; field, I noticed it&#x27;s only ever used in their file reader equivalent of &lt;code&gt;FTell()&lt;&#x2F;code&gt;. It doesn&#x27;t affect where data is actually being read from at all.&lt;&#x2F;p&gt;
&lt;p&gt;The reason for the &lt;code&gt;Seek()&lt;&#x2F;code&gt; being a no-op is likely because the underlying file reader is reading directly from the compressed buffer, which reads in &lt;code&gt;0x4000&lt;&#x2F;code&gt;-byte chunks. Since you cannot reasonably map an uncompressed data offset to a compressed offset the format must be designed to ignore seeks and just read data linearly.&lt;&#x2F;p&gt;
&lt;p&gt;...the &lt;code&gt;.lin&lt;&#x2F;code&gt; extension makes a lot more sense.&lt;&#x2F;p&gt;
&lt;p&gt;💡 In order to read these files, you have to assume that you cannot seek forward&#x2F;backward. Easy enough.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;load-order-matters&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#load-order-matters&quot; aria-label=&quot;Anchor link for: load-order-matters&quot;
    &gt;#&lt;&#x2F;a
&gt;
Load Order Matters&lt;&#x2F;h3&gt;
&lt;p&gt;We still have a problem that has not been addressed: why does the file table have a large count of files with bad offsets?&lt;&#x2F;p&gt;
&lt;p&gt;I continued to use breakpoints inside of the file read function to trace where interesting bits of data were read and forced a break when the data immediately following the file table was read. Eventually I traced the file read operation back far enough to find this function, &lt;code&gt;StaticLoadObject&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;static_load_object.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;static_load_object.png&quot; alt=&quot;StaticLoadObject implementation&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This function calls &lt;code&gt;ResolveName&lt;&#x2F;code&gt; which I was able to log the arguments to via a debugger breakpoint script, which told me the &lt;code&gt;InName&lt;&#x2F;code&gt; was &lt;code&gt;ini:Engine.Engine.GameEngine&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;resolve_name.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;resolve_name.png&quot; alt=&quot;ResolveName implementation&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This &lt;code&gt;ini:Engine.Engine.GameEngine&lt;&#x2F;code&gt; name gets parsed as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ini:&lt;&#x2F;code&gt; &amp;lt;- resolve the name from the game&#x27;s INI files&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Engine.Engine&lt;&#x2F;code&gt; &amp;lt;- the INI table to read from&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GameEngine&lt;&#x2F;code&gt; &amp;lt;- the key from the table to read&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If I look in &lt;code&gt;UW.ini&lt;&#x2F;code&gt; included with the game, this table is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[Engine.Engine]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;RenderDevice&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;D3DDrv.D3DRenderDevice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;GameRenderDevice&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;D3DDrv.D3DRenderDevice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;AudioDevice&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;XboxAudio.XboxAudioSubsystem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;Console&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Engine.Console&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;DefaultPlayerMenu&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;UPreview.UPreviewRootWindow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;Language&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;GameEngine&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Engine.GameEngine&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;EditorEngine&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Editor.EditorEngine&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;WindowedRenderDevice&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;D3DDrv.D3DRenderDevice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;DefaultGame&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Echelon.EchelonGameInfo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;DefaultServerGame&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;WarfareGame.WarfareTeamGame&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;ViewportManager&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;XboxDrv.XboxClient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;Render&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Render.Render&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;Input&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Engine.Input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;Canvas&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Echelon.ECanvas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;Editor3DRenderDevice&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;D3DDrv.D3DRenderDevice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;So the resulting value returned from this function is &lt;code&gt;Engine.GameEngine&lt;&#x2F;code&gt;, which matches what this function resolves.&lt;&#x2F;p&gt;
&lt;p&gt;This is then used to resolve the &lt;strong&gt;package&lt;&#x2F;strong&gt; &lt;code&gt;Engine&lt;&#x2F;code&gt; and its &lt;strong&gt;exported object&lt;&#x2F;strong&gt; &lt;code&gt;GameEngine&lt;&#x2F;code&gt;. The game binary looks for the file &lt;code&gt;Engine&lt;&#x2F;code&gt; in its available sources (partial matching strategy), which includes searching against the LIN file table, and then resolves that name as &lt;code&gt;System\Engine.u&lt;&#x2F;code&gt;. My tool that reads the file table confirms that this is declared in the LIN file:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;FileEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; System&lt;&#x2F;span&gt;&lt;span&gt;\\&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Engine&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;u&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x13482120&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x127DA1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Except the file start offset + len don&#x27;t make sense. If I assume the &lt;code&gt;Engine.u&lt;&#x2F;code&gt; file is the first file immediately following the file table, advancing forward by this length appears to land right in the middle of some string?&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00154330│ 09 45 4d 65 73 68 53 46 ┊ 58 00 10 00 07 00 1b 43 │.EMeshSF┊X......C│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00154340│ 68 61 6e 64 65 72 6c 65 ┊ 72 43 72 79 73 74 61 6c │handerle┊rCrystal│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│00154350│ 50 61 72 74 69 63 75 6c ┊ 65 00 10 00 07 00 12 46 │Particul┊e......F│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;I&#x27;ll save some time and just say that I did not identify the wrong file. The lengths just don&#x27;t matter, and for all intents and purposes are wrong. The reader in the game engine must just read the data in-order using its self-description in its own header?&lt;&#x2F;p&gt;
&lt;p&gt;The Unreal Engine Package&#x2F;Linker file format has been &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eliotvu.com&#x2F;page&#x2F;unreal-package-file-format&quot;&gt;well documented&lt;&#x2F;a&gt; and does include some sizes in its header. The packages contain about what you&#x27;d expect of some object-oriented programming (OOP) script&#x2F;data format.&lt;&#x2F;p&gt;
&lt;p&gt;It has &lt;em&gt;exported&lt;&#x2F;em&gt; objects which are named instances of some OOP type and has properties and data. Or the object can be a class&#x2F;struct definition. The exports may rely on types exported from other packages which are declared as &lt;em&gt;imports&lt;&#x2F;em&gt;. Both of these have names or string data associated with them which are defined in the &lt;em&gt;name&lt;&#x2F;em&gt; table.&lt;&#x2F;p&gt;
&lt;p&gt;I mapped the existing documentation to the following Rust struct:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;pub&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; PackageHeader&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; flags&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; name_count&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; name_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; export_count&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; export_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; import_count&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; import_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; Note: this is not in the above documented description&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; unk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; Ditto.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; Not shown: compressed int for length of this data at this position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; unknown_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: &amp;amp;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;u8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; guid_a&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; guid_b&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; guid_c&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; guid_d&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; Not shown: compressed int for length of this data at this position.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub&lt;&#x2F;span&gt;&lt;span&gt; generations&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Vec&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;GenerationInfo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And of course, the offsets in this format are also unusable (e.g. the &lt;code&gt;name_offset&lt;&#x2F;code&gt; lands you &lt;em&gt;after&lt;&#x2F;em&gt; the start of the name table). But the counts look good:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;PackageHeader&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x110064&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    flags&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name_count&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xE10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x88&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    export_count&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xFFA&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    export_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x117AF3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    import_count&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x4E&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    import_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x11783E&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xFF0ADDE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unknown_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    guid_a&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    guid_b&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    guid_c&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    guid_d&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    generations&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;        GenerationInfo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            export_count&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xFFA&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            name_count&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xE10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now with my tool updated to read these tables -- parsing by assuming that they immediately follow this header and each other -- I have imports that look like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Package Core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Core&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Import&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;span&gt; class_package&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; class_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; B64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; package_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; object_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; object&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; None&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Class Core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Object&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Import&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;span&gt; class_package&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; class_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; B62&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; package_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; FFFFFFFF&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; object_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 13&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; object&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; None&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Class Core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Import&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;span&gt; class_package&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; class_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; B62&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; package_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; FFFFFFFF&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; object_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BBD&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; object&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; None&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And exports:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Class Actor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; ObjectExport&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    class_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    super_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xFFFFFFFE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    package_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    object_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x206&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    object_flags&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x40F0004&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    serial_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x3A8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    serial_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xF719&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Class Pawn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; ObjectExport&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    class_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    super_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    package_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    object_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x1A&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    object_flags&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x40F0004&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    serial_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x281&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    serial_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xFAC1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Class GameEngine&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0xEFB&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; ObjectExport&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    class_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    super_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x1C8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    package_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    object_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x1D8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    object_flags&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x40F0004&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    serial_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x5B&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    serial_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xC50DB&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;So the &lt;code&gt;GameEngine&lt;&#x2F;code&gt; object has export index &lt;code&gt;0xEFB&lt;&#x2F;code&gt; and its data is supposedly located at offset &lt;code&gt;0xC50DB&lt;&#x2F;code&gt; relative to the package start. You guessed it though, its offset is wrong!&lt;&#x2F;p&gt;
&lt;h3 id=&quot;export-data&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#export-data&quot; aria-label=&quot;Anchor link for: export-data&quot;
    &gt;#&lt;&#x2F;a
&gt;
Export Data&lt;&#x2F;h3&gt;
&lt;p&gt;Up to this point we know:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;You cannot seek in the file reader.&lt;&#x2F;li&gt;
&lt;li&gt;The offsets do not map cleanly to the on-disk representation and aren&#x27;t really used other than for position tracking.&lt;&#x2F;li&gt;
&lt;li&gt;The sizes (at least in the file table, and I soon realized in the export data) are incorrect.&lt;&#x2F;li&gt;
&lt;li&gt;We know &lt;code&gt;GameEngine&lt;&#x2F;code&gt; is the first object requested by the C++ side of the game and is export index &lt;code&gt;0xEFB&lt;&#x2F;code&gt; in the &lt;code&gt;Engine&lt;&#x2F;code&gt; package. It may not be the first object actually &lt;em&gt;parsed&lt;&#x2F;em&gt;, but it&#x27;s the first object requested.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Now, to achieve my goal of dumping these files I attempted to simply sum the size of these exports to figure out the end offset of the file... but trying a combination of that calculated size + any of the &lt;code&gt;{end_of_export_table, start_of_file}&lt;&#x2F;code&gt; offsets landed me in weird places with other Linker files in-between.&lt;&#x2F;p&gt;
&lt;p&gt;By referencing &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;EliotVU&#x2F;Unreal-Library&quot;&gt;Unreal-Library&lt;&#x2F;a&gt; to help fill in some of the blanks, I observed the following high-level parsing logic in the game engine:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;An exported object is requested by the game. If it isn&#x27;t loaded already, the export is lazy loaded.&lt;&#x2F;li&gt;
&lt;li&gt;Lazy loading requires resolving the &lt;code&gt;super&lt;&#x2F;code&gt; type&#x27;s object. For some things this is the &lt;code&gt;Class&lt;&#x2F;code&gt; or &lt;code&gt;Struct&lt;&#x2F;code&gt; base types, for other things this is a different parent class which will eventually have &lt;code&gt;Class&lt;&#x2F;code&gt; as its parent type.&lt;&#x2F;li&gt;
&lt;li&gt;Exports have properties which can be of varying size. As you read an export, you deserialize its data as described by its &lt;code&gt;serial_size&lt;&#x2F;code&gt; and &lt;code&gt;serial_offset&lt;&#x2F;code&gt; fields, and however the types exported from the C++ side defines the deserialization routine.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Which visually results in something like the following flow when resolving imports&#x2F;exports:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;export_load_flow_diagram.svg&quot; alt=&quot;Export parsing flow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To give a concrete example, imagine that &lt;code&gt;GameEngine&lt;&#x2F;code&gt; has the following class hierarchy:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;GameEngine -&amp;gt; Engine -&amp;gt; Subsystem -&amp;gt; Class&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Also imagine that &lt;code&gt;GameEngine&lt;&#x2F;code&gt; is the very first object ever parsed -- nothing else has been loaded yet. Requesting to load &lt;code&gt;GameEngine&lt;&#x2F;code&gt; from the &lt;code&gt;Engine.u&lt;&#x2F;code&gt; package will trigger the following sequence of events:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;Engine.u&lt;&#x2F;code&gt; header read&#x2F;parse (since no package has been created yet)&lt;&#x2F;li&gt;
&lt;li&gt;Lookup &lt;code&gt;Engine&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;GameEngine&lt;&#x2F;code&gt; export. It&#x27;s not yet parsed, so we need to construct this object by constructing&#x2F;deserializing it.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GameEngine&lt;&#x2F;code&gt;&#x27;s parent class is &lt;code&gt;Engine.Engine&lt;&#x2F;code&gt;. It has not yet been parsed, so we need to deserialize it &lt;strong&gt;before&lt;&#x2F;strong&gt; &lt;code&gt;GameEngine&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Core.Subsystem&lt;&#x2F;code&gt; is &lt;code&gt;Engine.Engine&lt;&#x2F;code&gt;&#x27;s parent class. Same thing.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Core.u&lt;&#x2F;code&gt; header read&#x2F;parse (since &lt;code&gt;Core&lt;&#x2F;code&gt; hasn&#x27;t been loaded yet)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Core.Class&lt;&#x2F;code&gt; is &lt;code&gt;Core.Subsystem&lt;&#x2F;code&gt;&#x27;s parent class (and the base class). Construct this object.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Core.Class&lt;&#x2F;code&gt; property deserialization. We can now continue with &lt;code&gt;Core.Subsystem&lt;&#x2F;code&gt; creation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Core.Subsystem&lt;&#x2F;code&gt; property deserialization...&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Engine.Engine&lt;&#x2F;code&gt; property deserialization..&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Engine.GameEngine&lt;&#x2F;code&gt; property deserialization...&lt;&#x2F;li&gt;
&lt;li&gt;We can now return the fully constructed &lt;code&gt;Engine.GameEngine&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;I believe this can result in export data that is interleaved, unfortunately. For the above scenario the data may be on disk like the following diagram. &lt;strong&gt;Note:&lt;&#x2F;strong&gt; for space&#x2F;simplicity I&#x27;ve omitted &lt;code&gt;Core.Class&lt;&#x2F;code&gt;, as well as the potential for the &lt;em&gt;properties themselves&lt;&#x2F;em&gt; to trigger deserializing of other exports.&lt;&#x2F;p&gt;
&lt;img src=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;interleaved-data-layout.svg&quot; alt=&quot;Interleaved data layout diagram showing how GameEngine, Engine, and Core.Subsystem export data is interleaved on disk&quot; class=&quot;mx-auto block&quot; &#x2F;&gt;
&lt;p&gt;And now if you imagine that there&#x27;s a &lt;em&gt;second&lt;&#x2F;em&gt; object which also extends from &lt;code&gt;Engine&lt;&#x2F;code&gt; loaded after &lt;code&gt;GameEngine&lt;&#x2F;code&gt;, then their common the super class &lt;code&gt;Engine&lt;&#x2F;code&gt; has already been parsed and its information is already in-memory. i.e. if you serialize two objects of the same exact type, the first object might have all the data for its parent classes interleaved with &lt;em&gt;its own&lt;&#x2F;em&gt; export data and the second object only contains its own property data.&lt;&#x2F;p&gt;
&lt;p&gt;Unfortunately, this means that to read these files statically (even for just static recompilation) you need to have full knowledge of how each C++-implemented type is parsed in order to parse all exports and their properties. Additionally, reading one export may trigger resolving of imports in your own Linker object, which in turn trigger deserialization of exports in another Linker object.&lt;&#x2F;p&gt;
&lt;p&gt;This results in the export data&#x27;s size not necessarily being &lt;em&gt;wrong&lt;&#x2F;em&gt; per se, but not super usable without actually doing full parsing. If other exports are deserialized in the middle of deserializing an export, they will seek around and restore the original position. When the export is done deserializing it subtracts the post-deserialization &lt;code&gt;position&lt;&#x2F;code&gt; of the file reader from the saved pre-deserialization &lt;code&gt;position&lt;&#x2F;code&gt; and asserts that it equals the export&#x27;s expected length. It&#x27;s misleading though as you cannot simply read &lt;code&gt;SerialSize&lt;&#x2F;code&gt; bytes from its offset.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: I&#x27;m not 100% confident in the data being interleaved vs just sequential. Through observing seek&#x2F;read operations for various exports, I do see seeks going to a wildly different offset in the middle of deserializing an export, then another export deserializing, then seeking back to the original export and continuing to deserialize it again This is a PITA to debug though&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#why&quot; aria-label=&quot;Anchor link for: why&quot;
    &gt;#&lt;&#x2F;a
&gt;
Why??????&lt;&#x2F;h3&gt;
&lt;p&gt;I imagine there&#x27;s a very good reason for packaging data this way. It&#x27;s best to consider the constraints of the time:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The game is being shipped on a physical disc.&lt;&#x2F;li&gt;
&lt;li&gt;The Xbox has 64MB of RAM shared between the CPU and GPU, with some portion of that being dedicated to the OS.&lt;&#x2F;li&gt;
&lt;li&gt;The CPU wasn&#x27;t terribly slow for the time, but wasting cycles would have been noticed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;code&gt;.lin&lt;&#x2F;code&gt; format mitigates these issues with:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Compressing data means you save space on the disc... If you conveniently ignore the fact that &lt;code&gt;common.lin&lt;&#x2F;code&gt; is duplicated in each map&#x27;s directory and is the same for every map I tested, which kinda negates part of this.&lt;&#x2F;li&gt;
&lt;li&gt;Streaming data in from the file instead of decompressing the whole thing at once saves on overall memory pressure during the data loading phase.&lt;&#x2F;li&gt;
&lt;li&gt;Laying out the file in a byte-for-byte exact read order increases I&#x2F;O speeds by not having to seek around the physical media, and ensures that you don&#x27;t need magic to translate an uncompressed offset to a compressed one in a performant manner.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;logging-load-order-for-static-recompilation&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#logging-load-order-for-static-recompilation&quot; aria-label=&quot;Anchor link for: logging-load-order-for-static-recompilation&quot;
    &gt;#&lt;&#x2F;a
&gt;
Logging Load Order for Static Recompilation&lt;&#x2F;h2&gt;
&lt;p&gt;I really, really wanted to avoid doing any runtime dumping that requires playing the game in an emulator or physical console. It doesn&#x27;t scale well to other games and is generally less flexible. But doing runtime observations are extremely useful in making sense of the format, so I went ahead and added some logging to get an idea of the file read order from the compressed archive when booting the game:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\System\Engine.u&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\System\Core.u&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\System\Echelon.u&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\HUD.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\FisherFoley.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\CommonMusic.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\System\EchelonEffect.u&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\ETexSFX.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\2-1_CIA_tex.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\generic_shaders.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\LightGenTex.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\5_1_PresidentialPalace_tex.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\1_2_Def_Ministry_tex.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\EGO_Tex.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\ETexIngredient.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\1-1_TBilisi_tex.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\1_3_CaspianOilRefinery_TEX.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\StaticMeshes\EMeshSFX.usx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\StaticMeshes\EGO_OBJ.usx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\ETexCharacter.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\4_3_Chinese_Embassy_tex.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\4_3_0_Chinese_Embassy_tex.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\4_3_2_Chinese_Embassy_tex.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\water.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\DestroyableObjet.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\FisherVoice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\FisherEquipement.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\GunCommon.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\Interface.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\Electronic.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\Dog.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\Lambert.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\StaticMeshes\EMeshIngredient.usx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\StaticMeshes\EMeshCharacter.usx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\2_2_1_Kalinatek_tex.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\StaticMeshes\LightGenOBJ.usx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\ETexRenderer.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\Door.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\GenericLife.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\Special.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\ThrowObject.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\StaticMeshes\Generic_Mesh.usx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\StaticMeshes\prog\generic_obj.usx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\0_0_Training_tex.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\3_4_Severo_tex.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\System\EchelonIngredient.u&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\Gun.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\System\EchelonGameObject.u&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Animations\ESkelIngredients.ukx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\Metal.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Animations\ETrk.ukx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\StaticMeshes\2-1_cia_obj.usx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\System\EchelonHUD.u&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Animations\ESam.ukx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Maps\menu\menu.unr             &#x2F;&#x2F; &amp;lt;--- # 55&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Textures\2_2_Kalinatek_tex.utx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\StaticMeshes\2_2_Kalinatek_OBJ.usx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\System\EchelonPattern.u&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S3_4_2Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S3_4_3Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S2_2_2Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S2_1_2Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S5_1_2Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S3_2_2Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S4_2_2Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S4_1_1Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S1_2_1Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S1_1_2Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S0_0_3Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S3_2_1Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S4_2_1Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S1_3_3Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S0_0_2Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S4_3_2Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S1_1_1Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S2_2_1Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S4_3_1Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S5_1_1Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S4_1_2Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S2_1_1Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S1_1_0Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S2_2_3Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S2_1_0Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S1_2_2Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\Vehicules.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S1_1_Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S2_1_Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S4_3_0Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S1_3_2Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\Machine.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\FireSound.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\SoundEvent.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S0_0_Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S4_3_Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S4_2_Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\S5_1_Voice.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\XboxLive.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\System\EchelonCharacter.u&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\GearCommon.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Animations\ENPC.ukx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\Exspetsnaz.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\GeorgianSoldier.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\RussianMafioso.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\GeorgianCop.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\EliteForce.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\CiaSecurity.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\CiaAgentMale.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\ChineseSoldier.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Animations\EFemale.ukx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Animations\EDog.ukx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;..\Sounds\GeorgianPalaceGuard.uax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;details class=&quot;collapse-section my-4&quot;&gt;
    &lt;summary&gt;File Dumping Script&lt;&#x2F;summary&gt;
    &lt;div class=&quot;collapse-content&quot;&gt;
        I set a breakpoint in the prologue of a function with the string &quot;&lt;code&gt;LinkerExists&lt;&#x2F;code&gt;&quot; that I later determined to be the constructor for an object called &lt;code&gt;ULinkerLoad&lt;&#x2F;code&gt;. One of the arguments is the file name for this object.&lt;&#x2F;p&gt;
&lt;p&gt;When triggered, the breakpoint executes the following IDA Python script which reads the filename pointer, then the filename, outputs it to the IDA console, and continues execution:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ida_kernwin&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ctypes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;ida_dbg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;get_reg_val&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;ebx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;b&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; True:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    c&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; b&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;\x00\x00&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; c; p&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ida_kernwin&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;ULinkerLoad: &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; s&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;utf-16-le&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;)+&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;\n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
    &lt;&#x2F;div&gt;
&lt;&#x2F;details&gt;
&lt;p&gt;In the above file load order I annotated file #55 which is &lt;code&gt;..\Maps\menu\menu.unr&lt;&#x2F;code&gt;. The &lt;code&gt;common.lin&lt;&#x2F;code&gt; file has 54 Linker files and #55 in the above listing happens to be the map which is loading and has its own dedicated &lt;code&gt;.lin&lt;&#x2F;code&gt; file. This is a strong indicator that the &lt;code&gt;common.lin&lt;&#x2F;code&gt; archive genuinely contains only 54 files and anything else is read from level-specific archives.&lt;&#x2F;p&gt;
&lt;p&gt;I also set a breakpoint in the function which deserializes exports (called &lt;code&gt;Preload&lt;&#x2F;code&gt;) and did some logging of which export is read and when a stream seek occurred:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ULinkerLoad: ..\System\Engine.u&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ULinkerLoad: ..\System\Core.u&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Export offset: 0x0,0x0,0x0,0x97,0x40f0004,0x4d,0x1b05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Seeking to&#x2F;from: 0x1b05,0x10883&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Export offset: 0xfffffffe,0x0,0x3,0x13d,0x70004,0x1c,0x6531&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Seeking to&#x2F;from: 0x6531,0x1b18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Read complete: 0xfffffffe,0x0,0x3,0x13d,0x70004,0x1c,0x6531&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Seeking to&#x2F;from: 0x1b18,0x654d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Export offset: 0xfffffffe,0x0,0x3,0x13c,0x70004,0x1c,0x6515&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Seeking to&#x2F;from: 0x6515,0x1b18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Read complete: 0xfffffffe,0x0,0x3,0x13c,0x70004,0x1c,0x6515&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Seeking to&#x2F;from: 0x1b18,0x6531&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Export offset: 0xfffffffe,0x0,0x3,0x119d,0x70004,0x2c,0x6432&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Seeking to&#x2F;from: 0x6432,0x1b18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Seeking to&#x2F;from: 0x6451,0x6452&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Seeking to&#x2F;from: 0x6453,0x6454&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Seeking to&#x2F;from: 0x6454,0x6455&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Seeking to&#x2F;from: 0x6455,0x6456&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Export offset: 0xfffffffd,0x0,0x2d7,0x477,0x70004,0xb,0x1c35&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Seeking to&#x2F;from: 0x1c35,0x6457&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Read complete: 0xfffffffd,0x0,0x2d7,0x477,0x70004,0xb,0x1c35&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Seeking to&#x2F;from: 0x6457,0x1c40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Export offset: 0xfffffffd,0x0,0x2d7,0x46d,0x70004,0xb,0x2736&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;details class=&quot;collapse-section my-4&quot;&gt;
    &lt;summary&gt;Export Preload Script&lt;&#x2F;summary&gt;
    &lt;div class=&quot;collapse-content&quot;&gt;
        IDA Python breakpoint script at &lt;code&gt;Preload&lt;&#x2F;code&gt; entry, identifiable by the string &quot;&lt;code&gt;SerialSize&lt;&#x2F;code&gt;&quot; &lt;strong&gt;and&lt;&#x2F;strong&gt; after the deserialization routine is called:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; ida_dbg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ida_kernwin&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ctypes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;ida_dbg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;get_reg_val&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;ebp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;super_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;package_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;object_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 12&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;object_flags&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;serial_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;serial_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 24&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;edx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;ida_dbg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;get_reg_val&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;edx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;properties&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = [&lt;&#x2F;span&gt;&lt;span&gt;class_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; super_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; package_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; object_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; object_flags&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; serial_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; serial_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ida_kernwin&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;Export data: &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot; + &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;join&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;hex&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; properties&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) +&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;\n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
    &lt;&#x2F;div&gt;
&lt;&#x2F;details&gt;
&lt;p&gt;There is really no discernable pattern to the loads at all. The file&#x2F;export load order seems to be just satisfying the dependency graph (exports required for parents&#x2F;properties of yet-to-be-parsed types) for requested objects from the C++ side of the house.&lt;&#x2F;p&gt;
&lt;p&gt;I think an acceptable compromise to doing this statically would be requiring dumping the file&#x2F;export load order from the game... but more work is needed to prove the viability of this approach.&lt;&#x2F;p&gt;
&lt;p&gt;I adjusted my program to read my logged lines into a queue of exports to be parsed, using the &lt;strong&gt;completed&lt;&#x2F;strong&gt; reads (lines starting with &lt;code&gt;Read complete&lt;&#x2F;code&gt; rather than &lt;code&gt;Export offset&lt;&#x2F;code&gt;). It then attempted to find the matching export in the export table across any package, and read its size. Repeat until the next Linker object is encountered, parse that, add it to the list, and repeat.&lt;&#x2F;p&gt;
&lt;p&gt;This quickly proved to be non-viable with my very barebones program. I would hit a point where I failed to find a matching export for the line logged, presumably because I was not reading the correct amount of data required to reach the next Unreal Package where that export was declared.&lt;&#x2F;p&gt;
&lt;p&gt;This was either a bug, or maybe some of the types attempt to seek+read without triggering a &lt;code&gt;Preload()&lt;&#x2F;code&gt;. At any rate, I had now invested a week or longer on the static approach with no data successfully dumped yet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;dumping-at-runtime&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#dumping-at-runtime&quot; aria-label=&quot;Anchor link for: dumping-at-runtime&quot;
    &gt;#&lt;&#x2F;a
&gt;
Dumping at Runtime&lt;&#x2F;h2&gt;
&lt;p&gt;At some point during the above research, I discovered the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Joshhhuaaa&#x2F;EnhancedSC&quot;&gt;EnhancedSC&lt;&#x2F;a&gt; project -- a community patch for Splinter Cell 1 on PC which fixes bugs, adds gameplay improvements, and has folks who certainly know the game engine better than me. I joined their Discord and asked if anyone knew about this format and they said that it&#x27;s been a dead end for anyone who&#x27;s bothered.&lt;&#x2F;p&gt;
&lt;p&gt;They were quite interested though in any progress achieved as they want to port some content from the Xbox versions of the games to PC. Through this community I got some great help with various theories, ideas, and introduced to tooling like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;UE-Explorer&#x2F;UE-Explorer&quot;&gt;UE-Explorer&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;After spending about a week on static recompilation I didn&#x27;t want to spend even more time investing in getting things dumped only to hit a hard wall. For example discovering that the files were wildly different than expected, wouldn&#x27;t work on PC, or wouldn&#x27;t work with UE Explorer. I needed to dump &lt;em&gt;something&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The game can obviously read the data fine. The thought came to me that perhaps I could just dump the data into some crappy format after it&#x27;s read that makes piecing it back together easy.&lt;&#x2F;p&gt;
&lt;p&gt;While doing static analysis I came across a function that was very peculiar to me. I identified the &lt;code&gt;ULinkerLoad&lt;&#x2F;code&gt; function mentioned earlier by searching for the Unreal Package file magic (highlighted below), and found the following function:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;linker_load.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;linker_load.png&quot; alt=&quot;LinkerLoad HLIL&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As expected, the file magic is checked against what&#x27;s read from disk. But there&#x27;s another result for the magic in a different function that is &lt;strong&gt;setting&lt;&#x2F;strong&gt; some structure&#x27;s field to the magic:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;linker_save.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;linker_save.png&quot; alt=&quot;SerializeLinker HLIL&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;And what is the purpose of this code? As it turns out, user game saves are just Unreal Objects serialized in the same format -- sans compression and other oddities that go along with it!&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;save_fn.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;save_fn.png&quot; alt=&quot;SaveObject HLIL&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;patching-og-xbox-binaries&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#patching-og-xbox-binaries&quot; aria-label=&quot;Anchor link for: patching-og-xbox-binaries&quot;
    &gt;#&lt;&#x2F;a
&gt;
Patching OG Xbox Binaries&lt;&#x2F;h3&gt;
&lt;p&gt;In order to do interesting things, we need to run our own code alongside the game. Debugger scripts are simply too slow and unreliable, so we need something running in the emulator or on a physical device. It&#x27;d also be cool if I could write a QEMU plugin for the emulator... but that&#x27;s another rabbit hole.&lt;&#x2F;p&gt;
&lt;p&gt;Injecting code into a game on Windows or Unix is easy. You can &lt;code&gt;CreateRemoteThread()&lt;&#x2F;code&gt; or DLL hijack on Windows, and on Unix use &lt;code&gt;LD_PRELOAD&lt;&#x2F;code&gt;. On Xbox 360 you can &quot;inject&quot; persistent DLLs. On original Xbox, you have one process with (as far as I know), no DLLs.&lt;&#x2F;p&gt;
&lt;p&gt;This could probably be a blog post on its own since modern information is pretty scarce (RIP XboxHacker.org), but there are at least two tools I know of that can be used to manipulate original Xbox executables.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The Python library &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;mborgerson&#x2F;pyxbe&quot;&gt;pyxbe&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The CLI tool &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;grimdoomer&#x2F;XboxImageXploder&quot;&gt;XboxImageExploder&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Both of these tools allow you to add a new section to an executable and basically create a code cave that you can use for placing additional code or data. When the system loads the image, it maps that newly added section with the appropriate permissions. You then need to patch some place in the original executable so that your code runs.&lt;&#x2F;p&gt;
&lt;p&gt;Using XboxImageExploder and XePatcher &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;SplinterCellDumpPatch&#x2F;blob&#x2F;main&#x2F;SplinterCellFileDumper.asm&quot;&gt;I was able to write a patch&lt;&#x2F;a&gt; which calls the serialization routine on an object after it gets loaded into memory.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;tl;dr&lt;&#x2F;strong&gt; of the patch:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Define a hook point at the end of the&lt;code&gt;LoadMap()&lt;&#x2F;code&gt; function. This definition will cause XePatcher to write these instructions that jump execution to &lt;code&gt;Hack_LoadMap&lt;&#x2F;code&gt; at the declared file offset.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Hack_LoadMap&lt;&#x2F;code&gt; calls &lt;code&gt;Hack_DumpAllLinkers&lt;&#x2F;code&gt; and does the standard epilogue cleanup for &lt;code&gt;LoadMap()&lt;&#x2F;code&gt; which won&#x27;t be executed since we hijacked execution&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Hack_DumpAllLinkers&lt;&#x2F;code&gt; iterates a global list of &lt;code&gt;Linker&lt;&#x2F;code&gt; objects and calls &lt;code&gt;Hack_DumpFile&lt;&#x2F;code&gt; with that linker as an argument.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Hack_DumpFile&lt;&#x2F;code&gt; ensures that the output directory for the given &lt;code&gt;Linker&lt;&#x2F;code&gt; file is created, then calls the game-provided function which serializes the &lt;code&gt;Linker&lt;&#x2F;code&gt; to that path. For example, the &lt;code&gt;..\System\Engine.u&lt;&#x2F;code&gt; linker file from the &lt;code&gt;common.lin&lt;&#x2F;code&gt; file will be written to &lt;code&gt;z:\System\Engine.u&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;asm&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;;---------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;; At the very end of the LoadMap() routine&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;;---------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;; file offset, not a VA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;dd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;      73698h&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;dd&lt;&#x2F;span&gt;&lt;span&gt;      (_load_map_return_end - _load_map_return_start)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;_load_map_return_start&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Jump to our detour function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     eax&lt;&#x2F;span&gt;&lt;span&gt;, Hack_LoadMap&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    jmp     eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;_load_map_return_end&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;_Hack_LoadMapCalled&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    dd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;      0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;_Hack_LoadMap&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     eax&lt;&#x2F;span&gt;&lt;span&gt;, Hack_DumpAllLinkers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    call    eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     eax&lt;&#x2F;span&gt;&lt;span&gt;, Hack_LoadMapCalled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;     dword&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;eax&lt;&#x2F;span&gt;&lt;span&gt;], &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _load_map_restore_registers&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; return value that we clobbered in the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; hook&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    pop     eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Since we patched in the prologue, we will just&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; do the register restore ourselves&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    pop     edi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    pop     esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    pop     ebx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     esp&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;ebp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    pop     ebp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    retn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;_Hack_DumpAllLinkers&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    ebx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    %&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;define&lt;&#x2F;span&gt;&lt;span&gt; g_ObjectLinkers 0033c42ch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Load the linker count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     ebx&lt;&#x2F;span&gt;&lt;span&gt;, [g_ObjectLinkers + &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    test    ebx&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;ebx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    jz&lt;&#x2F;span&gt;&lt;span&gt;      _dump_all_linkers_restore_registers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; esi will be our index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     esi&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _dump_all_linkers_linker_loop_start&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    cmp     esi&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;ebx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    jz&lt;&#x2F;span&gt;&lt;span&gt;      _dump_all_linkers_linker_loop_finish&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Iterate the linkers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     eax&lt;&#x2F;span&gt;&lt;span&gt;, [g_ObjectLinkers]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     ecx&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    imul    ecx&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    add     eax&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;ecx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     eax&lt;&#x2F;span&gt;&lt;span&gt;, [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;eax&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     ecx&lt;&#x2F;span&gt;&lt;span&gt;, Hack_DumpFile&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    call    ecx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    add     esp&lt;&#x2F;span&gt;&lt;span&gt;, (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt; * &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _dump_all_linkers_linker_loop_end&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    inc     esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    jmp&lt;&#x2F;span&gt;&lt;span&gt;     _dump_all_linkers_linker_loop_start&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _dump_all_linkers_linker_loop_finish&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _dump_all_linkers_restore_registers&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    pop     esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    pop     ebx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    ret&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;_Hack_DumpFile&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Load the argument representing the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; object that&amp;#39;s being saved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     eax&lt;&#x2F;span&gt;&lt;span&gt;, [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;esp&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Save registers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    edi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    ebx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     edi&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _dump_file_do_dump&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Iterate the object&amp;#39;s exports and save their flags&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; ==== NOT USED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Grab the export data pointer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ;mov     ecx, [edi + 0x88]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Grab the number of exports&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ;mov     ebx, [edi + 0x8C]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; ==== NOT USED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Allocate space for the file path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    sub     esp&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0x200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Grab the linker&amp;#39;s filename&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     eax&lt;&#x2F;span&gt;&lt;span&gt;, [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;edi&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0x98&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Put the input filename in esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     esi&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; If the input filename is empty, jump to the cleanup routine&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; since this is not a file that&amp;#39;s in the packed .lin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    cmp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    word&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;eax&lt;&#x2F;span&gt;&lt;span&gt;], &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    jz&lt;&#x2F;span&gt;&lt;span&gt;     _Hack_DumpFile_Done&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ;===== DIRECTORY CREATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; The file path is located at the beginning of the stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     ebx&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;esp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Set the filename on the stack to `z:`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; This has to be a char*, not a wchar_t*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;     byte&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;esp&lt;&#x2F;span&gt;&lt;span&gt;], &amp;#39;z&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;     byte&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;esp&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;], &amp;#39;:&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; This will hold our position in the path we&amp;#39;re building&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     ebx&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _Hack_DumpFile_File_Directory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; We are looking for a backslash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; this is wchar_t `\`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    0x005c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Grab the position of the last backslash for the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; input file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     eax&lt;&#x2F;span&gt;&lt;span&gt;, appStrchr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    call    eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    add     esp&lt;&#x2F;span&gt;&lt;span&gt;, (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt; * &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Not found&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    test    eax&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    jz&lt;&#x2F;span&gt;&lt;span&gt;      _Hack_DumpFile_Directory_Finish&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; We found a slash -- check if we&amp;#39;ve discarded the first&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; bit of data before the slash (it&amp;#39;s expected to start&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; with &amp;quot;..\&amp;quot; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    test    ebx&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;ebx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    jnz&lt;&#x2F;span&gt;&lt;span&gt;     _Hack_DumpFile_File_Directory_Create_Directory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Update ebx to point to the first slash so we can use it&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; for later copying.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     ebx&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    jmp&lt;&#x2F;span&gt;&lt;span&gt;     _hack_dumpfile_directory_end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _Hack_DumpFile_File_Directory_Create_Directory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Skip the Z: part for the dest file path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    lea     ecx&lt;&#x2F;span&gt;&lt;span&gt;, [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;esp&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    edx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Start of the linker&amp;#39;s file path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     esi&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;ebx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Copy from ebx to eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _hack_dump_file_copy_directory_loop&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    cmp     esi&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    je&lt;&#x2F;span&gt;&lt;span&gt;      _hack_dump_file_copy_directory_loop_finish&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     dl&lt;&#x2F;span&gt;&lt;span&gt;,   [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;esi&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov&lt;&#x2F;span&gt;&lt;span&gt;     [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;ecx&lt;&#x2F;span&gt;&lt;span&gt;], &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;dl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    inc     ecx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; we&amp;#39;re doing some janky wchar_t to char&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; conversion tricks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    add     esi&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    jmp&lt;&#x2F;span&gt;&lt;span&gt;     _hack_dump_file_copy_directory_loop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _hack_dump_file_copy_directory_loop_finish&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Add null terminator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;     byte&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;ecx&lt;&#x2F;span&gt;&lt;span&gt;], &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    pop     esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    pop     edx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     ecx&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;esp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Make sure we don&amp;#39;t clobber eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Attributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    0x0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Create this directory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    ecx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     ecx&lt;&#x2F;span&gt;&lt;span&gt;, CreateDirectory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    call    ecx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; cdecl function, it cleans up&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    pop     eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _hack_dumpfile_directory_end&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Save the position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    lea     esi&lt;&#x2F;span&gt;&lt;span&gt;, [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;eax&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    jmp&lt;&#x2F;span&gt;&lt;span&gt;     _Hack_DumpFile_File_Directory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _Hack_DumpFile_Directory_Finish&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Set the file path we want to copy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     esi&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;ebx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ;===== FILE CREATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; The file path is located at the beginning of the stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     ebx&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;esp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Set the start of VeryLongString to `Z:`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push&lt;&#x2F;span&gt;&lt;span&gt;    ZDrive&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    ebx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     eax&lt;&#x2F;span&gt;&lt;span&gt;, wstrcpy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    call    eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    add     esp&lt;&#x2F;span&gt;&lt;span&gt;, (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt; * &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Set the copy target to the bytes immediatley&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; following `z:`, so the result should be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; `z:\filename`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    lea     eax&lt;&#x2F;span&gt;&lt;span&gt;, [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;ebx&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Copy the filename to the path buffer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Set ESI to the full file path for later use&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     esi&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;ebx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     eax&lt;&#x2F;span&gt;&lt;span&gt;, wstrcpy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    call    eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    add     esp&lt;&#x2F;span&gt;&lt;span&gt;, (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt; * &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     edx&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;dword&lt;&#x2F;span&gt;&lt;span&gt; [GlobalError]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; InOuter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     eax&lt;&#x2F;span&gt;&lt;span&gt;, [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;edi&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2Ch&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Pad size?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    0xFFFFFFFF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Conform&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    0x0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    edx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Filename&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; TopLeveLFlags&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push&lt;&#x2F;span&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Base&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    edi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; InOuter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    push    eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; ( UObject* InOuter,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ;   UObject* Base,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ;   DWORD TopLevelFlags,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ;   const TCHAR* Filename,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ;   FOutputDevice* Error=GError,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ;   ULinkerLoad* Conform=NULL );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    mov     eax&lt;&#x2F;span&gt;&lt;span&gt;, UObject_SavePackage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    call    eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    add     esp&lt;&#x2F;span&gt;&lt;span&gt;, (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt; * &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _Hack_DumpFile_Done&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Restore the stack to clean up the file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    add     esp&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0x200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Restore the export flags&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    _dump_file_restore_registers&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    ; Restore saved registers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    pop     ebx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    pop     esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    pop     edi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    ret&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Why assembly?&lt;&#x2F;em&gt; Sunk cost and not wanting to figure out tooling required to compile C to shell code targeting this platform. The functions could be written in C. The detour hooks must remain assembly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;results&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#results&quot; aria-label=&quot;Anchor link for: results&quot;
    &gt;#&lt;&#x2F;a
&gt;
Results&lt;&#x2F;h2&gt;
&lt;p&gt;We can now read the output files in UE Explorer, and even run the Xbox main menu and the in-engine cinematic from the first level on PC... albeit with some bugged lighting and textures. Anything past that first level cinematic, including the interactive bit of the level itself, has failed to load.&lt;&#x2F;p&gt;
&lt;p&gt;The above patch, dumping at &lt;code&gt;LoadMap()&lt;&#x2F;code&gt; end, resulted in the most reliable file dumping out of my many experiments. At the end of this function it seems nearly all data is read and ready to go, but there are definitely a couple of objects deserialized after this point. Dumping after all object reads are complete though actually seems to make things worse -- maybe because some object properties have changed in-memory from their default values?&lt;&#x2F;p&gt;
&lt;p&gt;Loading an Xbox file in UE Explorer:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;ue_explorer.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;ue_explorer.png&quot; alt=&quot;Engine.Engine package in UE Explorer&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;First level cinematic which should have a dimly-lit hallway with shadows:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;level_load.webp&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;level_load.webp&quot; alt=&quot;Training Mission Load&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Swapping a texture had some problems:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;corrupt_textures.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;corrupt_textures.png&quot; alt=&quot;Bugged Textures&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In fact, the textures were just straight up incomplete data. Since literally every texture object had a small size I figured that between the time the object was deserialized and the point I dumped it the original texture data must have been transformed to the target format and the original free&#x27;d.&lt;&#x2F;p&gt;
&lt;p&gt;To confirm my assumption, I set a breakpoint in the function which kicks off object deserialization so that it would break immediately before:&lt;&#x2F;p&gt;
&lt;details class=&quot;collapse-section my-4&quot;&gt;
    &lt;summary&gt;Targeted Export Breakpoint Code&lt;&#x2F;summary&gt;
    &lt;div class=&quot;collapse-content&quot;&gt;
        I set a breakpoint in the &lt;code&gt;Preload()&lt;&#x2F;code&gt; routine immediately before object deserialization with the following script.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; ida_dbg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ida_kernwin&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ctypes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;ida_dbg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;get_reg_val&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;ebp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;serial_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 24&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;super_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;package_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;object_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 12&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;object_flags&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;serial_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;serial_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ida_idd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dbg_read_memory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;export_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 24&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;little&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;edx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;ida_dbg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;get_reg_val&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;edx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;properties&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = [&lt;&#x2F;span&gt;&lt;span&gt;class_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; super_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; package_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; object_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; object_flags&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; serial_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; serial_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ida_kernwin&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;Export offset: &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot; + &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;join&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;hex&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; properties&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) +&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;\n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Break only when the object offset matches my target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt; serial_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;11f65f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
    &lt;&#x2F;div&gt;
&lt;&#x2F;details&gt;
&lt;p&gt;Then I set a breakpoint in the data read function and examined where the texture data from disk was being copied to. I had to do some stepping through to figure out where this destination pointer originated, then located immediately next to &lt;em&gt;that&lt;&#x2F;em&gt; pointer is the dynamic array&#x27;s length and capacity. Set a Memory Write breakpoint on the length field and wait for it to go to zero. Wherever it happened, that was the code and the &lt;code&gt;realloc&lt;&#x2F;code&gt; immediately following had to simply get nop&#x27;d out to prevent the texture data from being evicted.&lt;&#x2F;p&gt;
&lt;p&gt;After adjusting my patch and dumping data again I noted that the texture file&#x27;s size changed dramatically and I now had some nice textures to look at:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;cia_flag_texture.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;cia_flag_texture.png&quot; alt=&quot;CIA Flag Texture&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;hud_texture.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;splinter-cell&#x2F;hud_texture.png&quot; alt=&quot;HUD Texture&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;general-issues-with-dumping&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#general-issues-with-dumping&quot; aria-label=&quot;Anchor link for: general-issues-with-dumping&quot;
    &gt;#&lt;&#x2F;a
&gt;
General Issues With Dumping&lt;&#x2F;h2&gt;
&lt;p&gt;Since exports are lazy loaded, you can only dump what&#x27;s used in a level. The main menu uses some functionality from &lt;code&gt;Engine&lt;&#x2F;code&gt; and &lt;code&gt;Core&lt;&#x2F;code&gt;, but not all of it. So if I load the main menu map and dump all the linkers when it&#x27;s finished loading, I will only have a partial representation of &lt;code&gt;Engine&lt;&#x2F;code&gt; and &lt;code&gt;Core&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In the same vein, anything unreferenced or unused which might by happenstance be in the archive cannot be easily recovered without intelligent brute forcing since you don&#x27;t know where its data starts. e.g. the main menu has some brushes which are in the export table but appear to be unused, so nothing ever triggers their appropriate load.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;next-steps&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#next-steps&quot; aria-label=&quot;Anchor link for: next-steps&quot;
    &gt;#&lt;&#x2F;a
&gt;
Next Steps&lt;&#x2F;h2&gt;
&lt;p&gt;While we&#x27;ve had some wins with dumping data and I feel I&#x27;ve accomplished a lot, I&#x27;m not going to be satisfied until I can cleanly dump anything I want from the game. A major milestone would be to get the training mission on Xbox completely working on PC. I&#x27;m going to try to make some strides here and if I hit a wall, I&#x27;ll at least try to dump some data from the review copy of the game.&lt;&#x2F;p&gt;
&lt;p&gt;This format can certainly be read statically &lt;em&gt;with&lt;&#x2F;em&gt; load-order knowledge from the game engine. I&#x27;m hoping for now that someone from the community can use the work presented in this blog post to get it working in Unreal-Library.&lt;&#x2F;p&gt;
&lt;p&gt;Static recompilation would be a much more general approach which I hope only requires two debugger breakpoint scripts to dump package filenames and export loads on a per-game basis rather than a binary patch. We already have this for SC1. The difficulty would be in contributing to UELib (or some other project) so that it can match the game&#x27;s exact I&#x2F;O behavior and deserialize multiple packages simultaneously using the load-order data. If this interests you, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;EliotVU&#x2F;Unreal-Library&#x2F;issues&#x2F;125&quot;&gt;check out the issue I filed in the project repo&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If you have questions, feel free to reach out to me on Twitter: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;x.com&#x2F;landaire&quot;&gt;@landaire&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;thanks&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#thanks&quot; aria-label=&quot;Anchor link for: thanks&quot;
    &gt;#&lt;&#x2F;a
&gt;
Thanks&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Grimdoomer for getting me up to speed with writing OG Xbox patches and for listening to my rants about this format.&lt;&#x2F;li&gt;
&lt;li&gt;To the EnhancedSC developer community for helping inspect my dumped files and for investing in what success we&#x27;ve had so far.&lt;&#x2F;li&gt;
&lt;li&gt;EliotVU for developing the great UE Explorer and UELib.&lt;&#x2F;li&gt;
&lt;li&gt;The folks who documented their own findings on this format before me. Every little bit of information helps.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Saving My Commit With `jj evolog`</title>
        <published>2025-10-03T00:00:00+00:00</published>
        <updated>2025-10-03T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://landaire.net/jj-evolog/"/>
        <id>https://landaire.net/jj-evolog/</id>
        
        <content type="html" xml:base="https://landaire.net/jj-evolog/">&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jj-vcs&#x2F;jj&quot;&gt;&lt;code&gt;jj&lt;&#x2F;code&gt; (jujutsu)&lt;&#x2F;a&gt; is a newish git-compatible version control system that has some fresh ideas and a pretty great CLI UX (compared to &lt;code&gt;git&lt;&#x2F;code&gt;). I had a moment recently where I hadn&#x27;t yet committed my changes and while attempting to format the code I inadvertently made my diff &lt;em&gt;way&lt;&#x2F;em&gt; larger than it should have been.&lt;&#x2F;p&gt;
&lt;p&gt;Here&#x27;s what happened:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;I made some changes that I was quite happy with and did a quick &lt;code&gt;jj diff&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;jj status&lt;&#x2F;code&gt; to make sure there was nothing I was accidentally including in the change.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;❯&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; : jj status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Working&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; copy changes:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; Cargo.toml&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; src&#x2F;de.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; src&#x2F;lib.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; src&#x2F;ser.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; src&#x2F;value.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; src&#x2F;value_impls.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Working&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; copy&lt;&#x2F;span&gt;&lt;span&gt;  (@) &lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; zxsrvopz 43a4bc7d master &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;|&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; de:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; very rough PoC of refcounted data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Parent&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; commit&lt;&#x2F;span&gt;&lt;span&gt; (@-): xlzooroo 9b8d55a1 core: update quickcheck + rand and tests (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;tests&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; failing&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;
&lt;p&gt;I noticed that the changes were not well-formatted, so I ran &lt;code&gt;cargo fmt&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;I ran &lt;code&gt;jj status&lt;&#x2F;code&gt; and had an &lt;em&gt;oh shit&lt;&#x2F;em&gt; moment when I realized way more files were changed from the &lt;code&gt;cargo fmt&lt;&#x2F;code&gt; than I thought would be.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;❯&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; : jj status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Working&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; copy changes:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; Cargo.toml&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; src&#x2F;consts.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; src&#x2F;de.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; src&#x2F;error.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; src&#x2F;lib.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; src&#x2F;ser.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; src&#x2F;value.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; src&#x2F;value_impls.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; test&#x2F;arby.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; test&#x2F;mod.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Working&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; copy&lt;&#x2F;span&gt;&lt;span&gt;  (@) &lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; zxsrvopz 69322ff0 master &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;|&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; de:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; very rough PoC of refcounted data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Parent&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; commit&lt;&#x2F;span&gt;&lt;span&gt; (@-): xlzooroo 9b8d55a1 core: update quickcheck + rand and tests (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;tests&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; failing&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;So now I have a problem: how do I undo the &lt;code&gt;cargo fmt&lt;&#x2F;code&gt; step?&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;lobste.rs&#x2F;s&#x2F;xmlpu8&#x2F;saving_my_commit_with_jj_evolog#c_a6bdjg&quot;&gt;A lobste.rs reader helpfully pointed out&lt;&#x2F;a&gt; that &lt;code&gt;jj undo&lt;&#x2F;code&gt; would actually suffice at this point! Let&#x27;s pretend like this is more involved though :p&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;enter-jj-evolog&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#enter-jj-evolog&quot; aria-label=&quot;Anchor link for: enter-jj-evolog&quot;
    &gt;#&lt;&#x2F;a
&gt;
Enter &lt;code&gt;jj evolog&lt;&#x2F;code&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;One of &lt;code&gt;jj&lt;&#x2F;code&gt;&#x27;s commands is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;jj-vcs.github.io&#x2F;jj&#x2F;latest&#x2F;cli-reference&#x2F;#jj-evolog&quot;&gt;&lt;code&gt;evolog&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, which &quot;shows how a change has evolved over time&quot;. &lt;code&gt;jj&lt;&#x2F;code&gt; takes a snapshot of the working copy every time a command is run, so when I ran &lt;code&gt;jj diff&lt;&#x2F;code&gt; to check my work, it recorded a snapshot of my working copy from the last time I ran a &lt;code&gt;jj&lt;&#x2F;code&gt; command.&lt;&#x2F;p&gt;
&lt;p&gt;Running &lt;code&gt;jj evolog&lt;&#x2F;code&gt; you&#x27;ll see something like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;❯&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; : jj evolog&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;○&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;  mmxmynwt hidden example@example.com 2025-10-03 18:08:05 7aa68914&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;│&lt;&#x2F;span&gt;&lt;span&gt;  (no&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; description set&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;│&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;  -- operation f606802e1b09&lt;&#x2F;span&gt;&lt;span&gt; (2025-10-03&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; 18:08:05&lt;&#x2F;span&gt;&lt;span&gt;) snapshot working copy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;○&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;  mmxmynwt hidden example@example.com 2025-10-03 18:07:58 4970219f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;   (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;empty&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;no&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; description set&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;   --&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; operation bb8323da564f&lt;&#x2F;span&gt;&lt;span&gt; (2025-10-03&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; 18:07:58&lt;&#x2F;span&gt;&lt;span&gt;) new empty commit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Pretending that there&#x27;s more than the &lt;em&gt;empty commit&lt;&#x2F;em&gt; and &lt;em&gt;snapshot working copy&lt;&#x2F;em&gt; operations, this on its own is not super helpful in identifying what happened in each operation.&lt;&#x2F;p&gt;
&lt;p&gt;Running &lt;code&gt;jj evolog -p&lt;&#x2F;code&gt; shows more details:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;❯ : jj evolog -p&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@  zxsrvopz example@example.com 2025-10-03 18:07:03 master 69322ff0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│  de: very rough PoC of refcounted data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│  -- operation 0df245508eb8 (2025-10-03 18:07:03) snapshot working copy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│  src&#x2F;consts.rs --- Rust&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│  No syntactic changes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│  src&#x2F;error.rs --- 1&#x2F;3 --- Rust&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   6                                                                     6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   7 &#x2F;&#x2F;! Error objects and codes                                         7 &#x2F;&#x2F;! Error objects and codes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   8                                                                     8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   9 use std::fmt;                                                       9 use serde::{de, ser};&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│  10 use std::io;                                                       10 use std::error;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│  11 use std::error;                                                    11 use std::fmt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...skipping...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;○  zxsrvopz hidden example@example.com 2025-10-02 19:31:08 43a4bc7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   de: very rough PoC of refcounted data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Cargo.toml --- TOML&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   10 edition = &amp;quot;2024&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   12 [dependencies]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   13 serde = { version = &amp;quot;1.0.104&amp;quot;, features = [&amp;quot;rc&amp;quot;] }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   14 byteorder = &amp;quot;1.3.2&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   15 num-bigint = &amp;quot;0.4.0&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   16 num-traits = &amp;quot;0.2.10&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   src&#x2F;lib.rs --- Rust&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   68 68 &#x2F;&#x2F;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   69 69 &#x2F;&#x2F;! The minimum supported version of the toolchain is 1.41.1.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   70 ..&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   71 .. #![cfg_attr(feature = &amp;quot;unstable&amp;quot;, feature(test))]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   72 70&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   73 71 pub use self::ser::{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   74 72     Serializer,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;* The rest *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;There are two important lines here:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@  zxsrvopz example@example.com 2025-10-03 18:07:03 master 69322ff0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;○  zxsrvopz hidden example@example.com 2025-10-02 19:31:08 43a4bc7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;zxsrvopz&lt;&#x2F;code&gt; is the &lt;strong&gt;change ID&lt;&#x2F;strong&gt; (which is the same for both lines) while &lt;code&gt;43a4bc7d&lt;&#x2F;code&gt; and &lt;code&gt;69322ff0&lt;&#x2F;code&gt; are the unique &lt;strong&gt;commit IDs&lt;&#x2F;strong&gt;. In the above output I just searched for &lt;code&gt;zx&lt;&#x2F;code&gt; to jump from the first commit to the second and saw that the second is what I wanted to restore to.&lt;&#x2F;p&gt;
&lt;p&gt;So now I can &lt;code&gt;jj edit 43a4bc7d&lt;&#x2F;code&gt; to jump back to that specific operation and I see the following output:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;❯ : jj edit 43a4bc7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Working copy  (@) now at: zxsrvopz?? 43a4bc7d de: very rough PoC of refcounted data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Parent commit (@-)      : xlzooroo 9b8d55a1 core: update quickcheck + rand and tests (tests failing)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Added 0 files, modified 8 files, removed 0 files&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See the &lt;code&gt;zxsrvopz??&lt;&#x2F;code&gt; change ID? If the above was appropriately highlighted you&#x27;d see it in red, but &lt;code&gt;jj&lt;&#x2F;code&gt; now is telling me that I have a conflicted change by placing that text in red and showing the &lt;code&gt;??&lt;&#x2F;code&gt; after the change ID. If I run &lt;code&gt;jj log&lt;&#x2F;code&gt; I see my history has branched and I have two changes with the same ID:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;❯ : jj log&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@  zxsrvopz?? example@example.com 2025-10-02 19:31:08 43a4bc7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│  de: very rough PoC of refcounted data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│ ○  zxsrvopz?? example@example.com 2025-10-03 18:07:03 master 69322ff0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├─╯  de: very rough PoC of refcounted data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;○  xlzooroo example@example.com 2025-10-02 17:00:07 git_head() 9b8d55a1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│  core: update quickcheck + rand and tests (tests failing)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The change starting with &lt;code&gt;@&lt;&#x2F;code&gt; is the revision I&#x27;m currently on while the other with a &lt;code&gt;○&lt;&#x2F;code&gt; is the forked revision. I can now resolve this conflict by simply abandoning the other change:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt; : jj abandon 69322ff0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Abandoned 1 commits:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  zxsrvopz?? 69322ff0 master | de: very rough PoC of refcounted data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Deleted bookmarks: master&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;❯ : jj log&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@  zxsrvopz example@example.com 2025-10-02 19:31:08 43a4bc7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│  de: very rough PoC of refcounted data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;○  xlzooroo example@example.com 2025-10-02 17:00:07 git_head() 9b8d55a1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│  core: update quickcheck + rand and tests (tests failing)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And we&#x27;re fixed!&lt;&#x2F;p&gt;
&lt;p&gt;I&#x27;ve reproduced what happened here in a short shell session which will have better highlighting and more info (note: clicking will take you to &lt;code&gt;asciinema.org&lt;&#x2F;code&gt;):&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;asciinema.org&#x2F;a&#x2F;bqfYzlHbdAJegjV4xZ7cQqZgj&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;asciinema.org&#x2F;a&#x2F;bqfYzlHbdAJegjV4xZ7cQqZgj.svg&quot; alt=&quot;asciicast&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Writing a PE Loader for the Xbox in 2024</title>
        <published>2024-08-13T00:00:00+00:00</published>
        <updated>2024-08-13T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://landaire.net/reflective-pe-loader-for-xbox/"/>
        <id>https://landaire.net/reflective-pe-loader-for-xbox/</id>
        
        <content type="html" xml:base="https://landaire.net/reflective-pe-loader-for-xbox/">&lt;p&gt;Emma (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;twitter.com&#x2F;carrot_c4k3&quot;&gt;@carrot_c4k3&lt;&#x2F;a&gt;) is a good friend of mine. We met in 2007 from the Xbox 360 scene and have remained friends ever since. She recently participated in pwn2own in the Windows LPE category and ended up using a great bug for LPE.&lt;&#x2F;p&gt;
&lt;p&gt;The bug far exceeded the category though: this vulnerability was also a &lt;em&gt;sandbox escape&lt;&#x2F;em&gt;, i.e. it&#x27;s in an NT syscall which is reachable from the UWP sandbox. A couple months ago she got a wild idea: why not try to port the exploit over to the Xbox One? (Modern Xboxes, not to be confused with the OG Xbox)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;brief-primer-on-the-xbox-one-s-security&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#brief-primer-on-the-xbox-one-s-security&quot; aria-label=&quot;Anchor link for: brief-primer-on-the-xbox-one-s-security&quot;
    &gt;#&lt;&#x2F;a
&gt;
Brief Primer on the Xbox One&#x27;s Security&lt;&#x2F;h2&gt;
&lt;p&gt;Since I&#x27;ll be talking about this in the context of the Xbox, it&#x27;s worthwhile to spend a moment discussing the Xbox One&#x27;s security model. There&#x27;s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=U7VwtOrwceo&quot;&gt;a very great and in-depth overview of the Xbox One&#x27;s security model on YouTube&lt;&#x2F;a&gt; presented by Tony Chen who is one of the folks who designed it. I highly recommend watching it if you&#x27;re interested, but I&#x27;ll do my best at giving a crash course:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌────────────────────────────┐     ┌────────────────────────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│                            │     │                            │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│                            │     │                            │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│                            │     │                            │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│                            │     │                            │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│        ERA (GameOS)        │     │         SystemOS           │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│                            │     │                            │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│                            │     │                            │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│                            │     │     │             │        │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│                            │     │     │             │        │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└────────────────────────────┘     └─────┼─────────────┼┬───────┤&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               │                         │             ││ VMBus │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               │                         │             │└───────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌──────────────┼─────────────────────────┼─────────────┼────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│              │                         ▼             ▼        │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│              │           HostOS  ┌──────────┐ ┌───────────────┤&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│              │                   │ Synthetic│ │ VSPs&#x2F;Normal   │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│              └──────────────────▶│ Devices  │ │ Hyper-V Stuff │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└──────────────────────────────────┴──────────┴─┴───────────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────────────────────────────────────────────────────────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│                                                               │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│                          Hypervisor                           │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│                                                               │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│                                                               │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────────────────────────────────────────────────────────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is a very, very simplified drawing of what you&#x27;d find on Microsoft&#x27;s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;virtualization&#x2F;hyper-v-on-windows&#x2F;reference&#x2F;hyper-v-architecture&quot;&gt;Hyper-V Architecture page&lt;&#x2F;a&gt;. The main thing I&#x27;m trying to highlight here is that there are 3 VMs with 3 different purposes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;HostOS, which acts very similar to your standard Hyper-V host.&lt;&#x2F;li&gt;
&lt;li&gt;ERA OS (aka GameOS) which is where games run.&lt;&#x2F;li&gt;
&lt;li&gt;SystemOS which is where applications run. Here you&#x27;ll find the system shell and UWP applications from the Windows Store.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Each VM is running a very slimmed down version of Windows based on Windows Core OS (WCOS). The Hyper-V architecture is mostly what you&#x27;d encounter on a normal PC but with some additional Xbox-specific VSPs&#x2F;functionality.&lt;&#x2F;p&gt;
&lt;p&gt;Missing from the above diagram is the &lt;em&gt;security processor&lt;&#x2F;em&gt; (SP). The Xbox One&#x27;s security processor should be the only thing on the Xbox which can reveal a title&#x27;s plaintext on Xbox One. (&lt;em&gt;Random fact: Microsoft&#x27;s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;windows&#x2F;security&#x2F;hardware-security&#x2F;pluton&#x2F;microsoft-pluton-security-processor&quot;&gt;Pluton Processor&lt;&#x2F;a&gt; is based on learnings from the Xbox One&#x27;s security processor&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;The core idea behind all of this is to &lt;strong&gt;make piracy extremely difficult&lt;&#x2F;strong&gt;, if not impossible without breaking the SP. If you &lt;em&gt;do&lt;&#x2F;em&gt; hack the Xbox One, you can&#x27;t do it online trivially because the SP will attest that the console&#x27;s state is something unexpected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;ok-how-does-this-relate-to-the-pe-loader&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#ok-how-does-this-relate-to-the-pe-loader&quot; aria-label=&quot;Anchor link for: ok-how-does-this-relate-to-the-pe-loader&quot;
    &gt;#&lt;&#x2F;a
&gt;
OK, How Does This Relate to the PE loader?&lt;&#x2F;h2&gt;
&lt;p&gt;Unrelated to her pwn2own entry, Emma found a vulnerability&#x2F;feature in an application on the Xbox One marketplace called &lt;em&gt;GameScript&lt;&#x2F;em&gt;, which is an ImGui UI for messing with the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;kgabis&#x2F;ape&quot;&gt;Ape programming language&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;carrot-c4k3&#x2F;10fdb4f3d11ca568f5452bbaefdc20dd&quot;&gt;Through this vulnerability&lt;&#x2F;a&gt; Emma was able to read&#x2F;write arbitrary memory and run shellcode. So we have arbitrary code execution in SystemOS, but now the problem: writing shellcode is a pain, so how can we run arbitrary &lt;em&gt;executables&lt;&#x2F;em&gt; easily?&lt;&#x2F;p&gt;
&lt;p&gt;We have the ability to read&#x2F;write arbitrary memory and change page permissions which is enough to write a portable executable (PE&#x2F;.exe) loader. Emma asked if I would write one since it would simplify the exploit development pipeline while she worked on porting her LPE exploit over and it&#x27;ll be useful for homebrew later on too. Easy enough right?&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Wrong.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reinventing-the-wheel&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#reinventing-the-wheel&quot; aria-label=&quot;Anchor link for: reinventing-the-wheel&quot;
    &gt;#&lt;&#x2F;a
&gt;
Reinventing the Wheel&lt;&#x2F;h2&gt;
&lt;p&gt;The specific technique of PE loading outlined here is referred to as &quot;Reflective PE Loading&quot;. To me this sounds like some #redteam term I&#x27;d never heard before embarking on this project, and is not very descriptive in my opinion... but a &quot;reflective PE loader&quot; is simply some user-mode code that can load and execute a PE without going through the normal &lt;code&gt;LoadLibrary()&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;CreateProcess()&lt;&#x2F;code&gt; routines .&lt;&#x2F;p&gt;
&lt;p&gt;Avoiding &lt;code&gt;LoadLibrary()&lt;&#x2F;code&gt; and &lt;code&gt;CreateProcess()&lt;&#x2F;code&gt; is very important for us since those will check for code integrity and any code we write will not be properly signed.&lt;&#x2F;p&gt;
&lt;p&gt;I took a look at the work involved and decided I wanted to write my own loader for multiple reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;I despise dealing with C&#x2F;C++ build systems.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Since I&#x27;m targeting &lt;em&gt;Xbox Windows&lt;&#x2F;em&gt; and not &lt;em&gt;desktop Windows&lt;&#x2F;em&gt;, I might encounter some problems and I know how to debug my own code better than someone else&#x27;s.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;On the Xbox we&#x27;re required to use a PE loader for running unsigned executables until we eventually break code integrity. So we better know how it works and be able to load complex applications.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;I don&#x27;t give a shit about EDR evasion or any #redteam stuff like that.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We originally had some very, very strict size constraints that we found a workaround for, but we want to be able to control the loader size as much as possible.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It seemed simple enough at the time to just rewrite it in Rust, so I did.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;For my project&#x27;s base I combined two open-source Rust projects:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;b1tg&#x2F;rust-windows-shellcode&quot;&gt;b1tg&#x2F;rust-windows-shellcode&lt;&#x2F;a&gt; which provided a great template for writing and building Windows shellcode in Rust.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Thoxy67&#x2F;rspe&quot;&gt;Thoxy67&#x2F;rspe&lt;&#x2F;a&gt; which provides a basic reflective loader.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;rspe already got me most of the way there, but with a few caveats:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It needed some cleanup (e.g. lots of unnecessary copies)&lt;&#x2F;li&gt;
&lt;li&gt;It did not support loading imports by ordinal&lt;&#x2F;li&gt;
&lt;li&gt;It did not support thread-local storage at all&lt;&#x2F;li&gt;
&lt;li&gt;It did not support command line arguments&lt;&#x2F;li&gt;
&lt;li&gt;It did not support environments with W^X mitigations&lt;&#x2F;li&gt;
&lt;li&gt;It did not work with &lt;em&gt;shellcode-based programming&lt;&#x2F;em&gt; in mind.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;details class=&quot;collapse-section my-4&quot;&gt;
    &lt;summary&gt;What is shellcode-based programming?&lt;&#x2F;summary&gt;
    &lt;div class=&quot;collapse-content&quot;&gt;
        On that last point above you might be wondering, &quot;What is shellcode-based programming?&quot; Well why don&#x27;t I just give an example. Here&#x27;s how a &lt;code&gt;VirtualAlloc()&lt;&#x2F;code&gt; call in &lt;code&gt;rspe&lt;&#x2F;code&gt; worked before:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;#[&lt;&#x2F;span&gt;&lt;span&gt;link&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;kernel32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;extern&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;system&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    pub fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; VirtualAlloc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        lpaddress&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        dwsize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; usize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        flallocationtype&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; VIRTUAL_ALLOCATION_TYPE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        flprotect&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PAGE_PROTECTION_FLAGS&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    ) -&amp;gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F; Allocate memory for the image&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;let&lt;&#x2F;span&gt;&lt;span&gt; baseptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; VirtualAlloc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;null_mut&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(),&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; lpAddress: A pointer to the starting address of the region to allocate.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    imagesize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;             &#x2F;&#x2F; dwSize: The size of the region, in bytes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    MEM_COMMIT&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            &#x2F;&#x2F; flAllocationType: The type of memory allocation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    PAGE_EXECUTE_READWRITE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; flProtect: The memory protection for the region of pages to be allocated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And here&#x27;s how this would look with shellcode-based programming:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;pub&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; VirtualAllocFn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; unsafe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; extern&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;system&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    lpAddress&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dwSize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; usize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    flAllocationType&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    flProtect&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; PVOID&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;pub fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fetch_virtual_alloc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernelbase_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PVOID&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) -&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; VirtualAllocFn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; this is some macro that, using `kernelbase_ptr`, parses kernelbase&amp;#39;s export table to find `VirtualAlloc`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; and return its address. i.e. kind of a self-made version of `GetProcAddress`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    resolve_func!&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernelbase_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;VirtualAlloc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; VirtualAlloc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fetch_virtual_alloc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernelbase_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;let&lt;&#x2F;span&gt;&lt;span&gt; baseptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;VirtualAlloc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    preferred_load_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; lpAddress: A pointer to the starting address of the region to allocate.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    imagesize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;           &#x2F;&#x2F; dwSize: The size of the region, in bytes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    MEM_COMMIT&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;          &#x2F;&#x2F; flAllocationType: The type of memory allocation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    PAGE_READWRITE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;     &#x2F;&#x2F; flProtect: The memory protection for the region of pages to be allocated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As you might have noticed, we&#x27;re not linking against any libraries and calling those imports directly. Instead we&#x27;re using indirect calls to functions whose addresses we manually resolved at runtime. All you need for shellcode development that &lt;em&gt;isn&#x27;t&lt;&#x2F;em&gt; painful is to find &lt;code&gt;kernelbase.dll&lt;&#x2F;code&gt; which can be done using the &lt;code&gt;gs&lt;&#x2F;code&gt; register to grab the PEB:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;pub fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; get_module_by_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) -&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Option&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;PVOID&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; peb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; PEB&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    unsafe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;        asm!&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;mov &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;{}&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, gs:[0x60]&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;            out&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;reg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt; peb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; ldr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (*&lt;&#x2F;span&gt;&lt;span&gt;peb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Ldr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; module_list&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;amp;((*&lt;&#x2F;span&gt;&lt;span&gt;ldr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;InLoadOrderModuleList&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; The first entry of LDR_DATA_TABLE_ENTRY is a LIST_ENTRY, so transmuting this address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; from LIST_ENTRY to LDR_DATA_TABLE_ENTRY is legal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let mut&lt;&#x2F;span&gt;&lt;span&gt; cur_module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; LDR_DATA_TABLE_ENTRY&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;transmute&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module_list&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; The list is doubly-linked, so eventually we will wrap back around to the head.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; module_list_head&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; cur_module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        loop&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; cur_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (*&lt;&#x2F;span&gt;&lt;span&gt;cur_module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;BaseDllName&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Buffer&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;cur_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;is_null&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; icmp_raw_str_u16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; cur_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Some&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;((*&lt;&#x2F;span&gt;&lt;span&gt;cur_module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;BaseAddress&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; flink&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (*&lt;&#x2F;span&gt;&lt;span&gt;cur_module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;InLoadOrderModuleList&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Flink&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            cur_module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; flink&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; LDR_DATA_TABLE_ENTRY&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; cur_module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; module_list_head&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;                &#x2F;&#x2F; We wrapped the whole list and didn&amp;#39;t find a result.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; None&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;exploits-forsale&#x2F;solstice&#x2F;blob&#x2F;6c47b5a0cd155d629845412974e7580fa9dff840&#x2F;crates&#x2F;shellcode_utils&#x2F;src&#x2F;lib.rs#L121-L161&quot;&gt;parse the PE&#x27;s export table&lt;&#x2F;a&gt; to find &lt;code&gt;GetModuleHandleA()&lt;&#x2F;code&gt;, and &lt;code&gt;GetProcAddress()&lt;&#x2F;code&gt;.
    &lt;&#x2F;div&gt;
&lt;&#x2F;details&gt;
&lt;h2 id=&quot;the-easy-parts&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-easy-parts&quot; aria-label=&quot;Anchor link for: the-easy-parts&quot;
    &gt;#&lt;&#x2F;a
&gt;
The Easy Parts&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;BenjaminSoelberg&#x2F;ReflectivePELoader?tab=readme-ov-file&quot;&gt;Although it&#x27;s been talked about before&lt;&#x2F;a&gt;, I&#x27;ll give a brief overview of how a basic loader works:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Parse the PE headers and &lt;code&gt;VirtualAlloc()&lt;&#x2F;code&gt; some memory for the &quot;cloned&quot; PE with all the fixups applied. You&#x27;ll try to &lt;code&gt;VirtualAlloc()&lt;&#x2F;code&gt; at the PE&#x27;s preferred load address, but if you don&#x27;t get it fall back to a random address. This is your &lt;em&gt;load address&lt;&#x2F;em&gt;. From here you calculate the delta between the preferred and actual load address and this will be used for fixing relocations. (Note: copying the PE just to change its fields isn&#x27;t strictly necessary but simplifies some things)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;exploits-forsale&#x2F;solstice&#x2F;blob&#x2F;6c47b5a0cd155d629845412974e7580fa9dff840&#x2F;crates&#x2F;solstice_loader&#x2F;src&#x2F;pelib.rs#L211-L254&quot;&gt;Iterate each PE section and copy it over to the newly &lt;code&gt;VirtualAlloc&lt;&#x2F;code&gt;&#x27;d region&lt;&#x2F;a&gt;. The virtual addresses here are &lt;em&gt;relative&lt;&#x2F;em&gt; virtual addresses, so you just take each section&#x27;s VirtualAddress, add it to the load address, and copy the section from its old location to the new address.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;exploits-forsale&#x2F;solstice&#x2F;blob&#x2F;6c47b5a0cd155d629845412974e7580fa9dff840&#x2F;crates&#x2F;solstice_loader&#x2F;src&#x2F;pelib.rs#L256-L321&quot;&gt;Fix section permissions&lt;&#x2F;a&gt;. For each section, look at its &lt;code&gt;Characteristics&lt;&#x2F;code&gt; field and determine the correct permissions. &lt;code&gt;VirtualProtect()&lt;&#x2F;code&gt; the section according to the permissions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;exploits-forsale&#x2F;solstice&#x2F;blob&#x2F;6c47b5a0cd155d629845412974e7580fa9dff840&#x2F;crates&#x2F;solstice_loader&#x2F;src&#x2F;pelib.rs#L425-L545&quot;&gt;Fix imports&lt;&#x2F;a&gt;. For each import in the import table (&lt;code&gt;IMAGE_DIRECTORY_ENTRY_IMPORT&lt;&#x2F;code&gt;), ensure the imported DLL is loaded. Then use the loaded DLL&#x27;s handle with &lt;code&gt;GetProcAddress()&lt;&#x2F;code&gt; to get the address of the function being imported. For each import in the table, write the real address in the import&#x27;s thunk. Instead of &lt;code&gt;GetProcAddress()&lt;&#x2F;code&gt; could also parse the module&#x27;s exports and match things up, but I took the lazy way.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;exploits-forsale&#x2F;solstice&#x2F;blob&#x2F;6c47b5a0cd155d629845412974e7580fa9dff840&#x2F;crates&#x2F;solstice_loader&#x2F;src&#x2F;pelib.rs#L323-L398&quot;&gt;Fix relocations&lt;&#x2F;a&gt;. This basically involves walking the &lt;code&gt;IMAGE_DIRECTORY_ENTRY_BASERELOC&lt;&#x2F;code&gt; directory and fixing each &lt;code&gt;IMAGE_BASE_RELOCATION&lt;&#x2F;code&gt; such that you add the delta calculated in step 1 to the relocation&#x27;s &lt;code&gt;VirtualAddress&lt;&#x2F;code&gt; field. There&#x27;s some nuance here where you need to only modify certain bits, etc. etc. but this is the basic idea.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;exploits-forsale&#x2F;solstice&#x2F;blob&#x2F;main&#x2F;crates&#x2F;solstice_loader&#x2F;src&#x2F;lib.rs#L343-L347&quot;&gt;Call the module&#x27;s entrypoints&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;I learned through this experience that PEs can have multiple thread-local storage callbacks called before the actual module entrypoint. Calling these is fairly straightforward:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;let&lt;&#x2F;span&gt;&lt;span&gt; tls_directory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;ntheader_ref&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;OptionalHeader&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;DataDirectory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;IMAGE_DIRECTORY_ENTRY_TLS&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; usize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F; Grab the TLS data from the PE we&amp;#39;re loading&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;let&lt;&#x2F;span&gt;&lt;span&gt; tls_data_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    baseptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tls_directory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;VirtualAddress&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; isize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; IMAGE_TLS_DIRECTORY64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;let&lt;&#x2F;span&gt;&lt;span&gt; tls_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; IMAGE_TLS_DIRECTORY64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; unsafe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;transmute&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tls_data_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;let mut&lt;&#x2F;span&gt;&lt;span&gt; callbacks_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tls_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;AddressOfCallBacks&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;callbacks_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;is_null&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let mut&lt;&#x2F;span&gt;&lt;span&gt; callback&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; unsafe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; { *&lt;&#x2F;span&gt;&lt;span&gt;callbacks_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;callback&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;is_null&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;        execute_tls_callback&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;baseptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; callback&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        callbacks_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; callbacks_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;add&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        callback&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; unsafe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; { *&lt;&#x2F;span&gt;&lt;span&gt;callbacks_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;unsafe fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; execute_tls_callback&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;baseptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; entrypoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; func&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; ImageTlsCallbackFn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;transmute&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entrypoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    func&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;baseptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; DLL_THREAD_ATTACH&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;null_mut&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;());&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Executing the image entrypoint is pretty similar:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;let&lt;&#x2F;span&gt;&lt;span&gt; entrypoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (&lt;&#x2F;span&gt;&lt;span&gt;baseptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; usize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    + (*(&lt;&#x2F;span&gt;&lt;span&gt;ntheader&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; IMAGE_NT_HEADERS64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        .&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;OptionalHeader&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        .&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;AddressOfEntryPoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; usize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F; Create a new thread to execute the image&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;execute_image&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;baseptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; entrypoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; context&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fns&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;create_thread_fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;unsafe fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; execute_image&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dll_base&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    entrypoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    create_thread_fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; CreateThreadFn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; func&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; extern&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;system&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) -&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;        core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;transmute&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entrypoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    func&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dll_base&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; DLL_PROCESS_ATTACH&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;null&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;());&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;the-hard-parts&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-hard-parts&quot; aria-label=&quot;Anchor link for: the-hard-parts&quot;
    &gt;#&lt;&#x2F;a
&gt;
The Hard Parts&lt;&#x2F;h2&gt;
&lt;p&gt;There were some parts that really kicked my ass in figuring out, but in my opinion were very important for what I wanted in the PE loader.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The exploit &#x2F; PE loader must not cause the hijacked application to become unreliable. I don&#x27;t want to be debugging crashes in some of the existing threads that broke simply because we&#x27;re hijacking the address space.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We must be able to run complex applications. Since we&#x27;re using this technique to bypass code integrity, this will be our main method of running arbitrary applications.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The application shouldn&#x27;t &lt;em&gt;know&lt;&#x2F;em&gt; it&#x27;s been reflectively loaded, or care.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;thread-local-storage&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#thread-local-storage&quot; aria-label=&quot;Anchor link for: thread-local-storage&quot;
    &gt;#&lt;&#x2F;a
&gt;
Thread-Local Storage&lt;&#x2F;h3&gt;
&lt;p&gt;Related to #2, the absolute biggest challenge I faced was with applications that use thread-local storage (TLS). Having done all of my development in Rust, my test program that I was loading was also written in Rust.&lt;&#x2F;p&gt;
&lt;p&gt;I kept crashing on &lt;code&gt;int 29&lt;&#x2F;code&gt; instructions (&lt;code&gt;RtlFailFast(code)&lt;&#x2F;code&gt;) shortly after executing the module&#x27;s entrypoint. This was &lt;strong&gt;extremely&lt;&#x2F;strong&gt; painful to debug but eventually I figured out that I was failing after fetching data from TLS&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;pe-loader&#x2F;tls-thread-set-current.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;pe-loader&#x2F;tls-thread-set-current.png&quot; alt=&quot;Screenshot of assembly instructions from a Rust &amp;quot;hello world&amp;quot; application loading data from TLS in IDA pro&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;pe-loader&#x2F;int-29.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;pe-loader&#x2F;int-29.png&quot; alt=&quot;Screenshot of assembly instructions from a Rust &amp;quot;hello world&amp;quot; application executing an int 29 instruction in IDA pro&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;I was kind of confused because I didn&#x27;t expect my application to use TLS, but apparently even the most basic &quot;hello world&quot; Rust program uses TLS:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;pe-loader&#x2F;pe-bear-tls.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;pe-loader&#x2F;pe-bear-tls.png&quot; alt=&quot;Screenshot of a Rust &amp;quot;hello world&amp;quot; application loaded into the &amp;quot;PE Bear&amp;quot; program, showing its TLS directory&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It turns out that this is related to Rust&#x27;s thread initialization code that sets some thread-locals for the current thread and thread ID: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;rust-lang&#x2F;rust&#x2F;blob&#x2F;2e630267b2bce50af3258ce4817e377fa09c145b&#x2F;library&#x2F;std&#x2F;src&#x2F;thread&#x2F;mod.rs#L694&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;rust-lang&#x2F;rust&#x2F;blob&#x2F;2e630267b2bce50af3258ce4817e377fa09c145b&#x2F;library&#x2F;std&#x2F;src&#x2F;thread&#x2F;mod.rs#L694&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;So I came to realize that my original idea for how I was handling TLS data was completely flawed. Originally I was &lt;em&gt;allocating&lt;&#x2F;em&gt; new memory for my module&#x27;s TLS, but didn&#x27;t even realize it had some default state associated with it that I had to copy over. Simple fix right?&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;diff --git a&#x2F;crates&#x2F;loader&#x2F;src&#x2F;lib.rs b&#x2F;crates&#x2F;loader&#x2F;src&#x2F;lib.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;index 97311d0..d66773d 100755&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--- a&#x2F;crates&#x2F;loader&#x2F;src&#x2F;lib.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+++ b&#x2F;crates&#x2F;loader&#x2F;src&#x2F;lib.rs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@@ -180,34 +185,53 @@ unsafe fn reflective_loader_impl(context: LoaderContext) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             .OptionalHeader&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             .AddressOfEntryPoint as usize) as *const c_void;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-    let tls_directory = &amp;amp;ntheader_ref.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+    let tls_directory =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        &amp;amp;ntheader_ref.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS as usize];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+    &#x2F;&#x2F; Grab the TLS data from the PE we&amp;#39;re loading&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+    let tls_data_addr =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        baseptr.offset(tls_directory.VirtualAddress as isize) as *mut IMAGE_TLS_DIRECTORY64;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+    &#x2F;&#x2F; TODO: Patch the module list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+    let tls_index = patch_module_list(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        context.image_name,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        baseptr,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        imagesize,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        context.fns.get_module_handle_fn,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        tls_data_addr,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        context.fns.virtual_protect,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        entrypoint,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     if tls_directory.Size &amp;gt; 0 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; Grab the TLS data from the PE we&amp;#39;re loading&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         let tls_data_addr =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             baseptr.offset(tls_directory.VirtualAddress as isize) as *mut IMAGE_TLS_DIRECTORY64;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-        let tls_data: &amp;amp;IMAGE_TLS_DIRECTORY64 = unsafe { core::mem::transmute(tls_data_addr) };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        let tls_data: &amp;amp;mut IMAGE_TLS_DIRECTORY64 = unsafe { core::mem::transmute(tls_data_addr) };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; Grab the TLS start from the TEB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         let tls_start: *mut *mut c_void;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         unsafe { core::arch::asm!(&amp;quot;mov {}, gs:[0x58]&amp;quot;, out(reg) tls_start) }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-        let tls_index = unsafe { *(tls_data.AddressOfIndex as *const u32) };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         let tls_slot = tls_start.offset(tls_index as isize);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         let raw_data_size = tls_data.EndAddressOfRawData - tls_data.StartAddressOfRawData;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-        *tls_slot = (context.fns.virtual_alloc)(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        let tls_data_addr = (context.fns.virtual_alloc)(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             ptr::null(),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-            raw_data_size as usize,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+            raw_data_size as usize, &#x2F;&#x2F; + tls_data.SizeOfZeroFill as usize,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             MEM_COMMIT,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             PAGE_READWRITE,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-        &#x2F;&#x2F; if !tls_start.is_null() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-        &#x2F;&#x2F;     &#x2F;&#x2F; Zero out this memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-        &#x2F;&#x2F;     let tls_slots: &amp;amp;mut [u64] = unsafe { core::slice::from_raw_parts_mut(tls_start, 64) };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-        &#x2F;&#x2F;     tls_slots.iter_mut().for_each(|slot| *slot = 0);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-        &#x2F;&#x2F; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        core::ptr::copy_nonoverlapping(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+            tls_data.StartAddressOfRawData as *const _,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+            tls_data_addr,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+            raw_data_size as usize,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        &#x2F;&#x2F; Update the TLS index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        core::ptr::write(tls_data.AddressOfIndex as *mut u32, tls_index);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+        *tls_slot = tls_data_addr;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         let mut callbacks_addr = tls_data.AddressOfCallBacks as *const *const c_void;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if !callbacks_addr.is_null() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This code worked, but not for long. I obviously had no idea how TLS worked, and soon discovered that in a multi-threaded application I was &lt;em&gt;again&lt;&#x2F;em&gt; getting similar crashes because the TLS data was bad. Through much pain and debugging I ended up learning:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Changing the TLS for your current thread is obviously not enough. New threads that spawn won&#x27;t have the modifications I did above, so they&#x27;ll have &quot;default&quot; TLS without my module included since the changes I did above are only reflected for the current thread. Duh.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;TLS is allocated in slots for the current thread and each slot is a pointer to the TLS data.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Windows keeps a cache of TLS directories for each loaded module, which means you can&#x27;t just pave over the hijacked module&#x27;s TLS data with your new TLS data and things will &quot;just work&quot;. You&#x27;ll have to update the cache.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;fixing-tls-data&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#fixing-tls-data&quot; aria-label=&quot;Anchor link for: fixing-tls-data&quot;
    &gt;#&lt;&#x2F;a
&gt;
Fixing TLS Data&lt;&#x2F;h3&gt;
&lt;p&gt;In the above section I mentioned that Windows keeps a cache of TLS directories for each loaded module, and I think this is a critical reason why the reflective PE loaders I sampled didn&#x27;t bother with TLS data (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;DarthTon&#x2F;Blackbone&#x2F;blob&#x2F;5ede6ce50cd8ad34178bfa6cae05768ff6b3859b&#x2F;src&#x2F;BlackBone&#x2F;ManualMap&#x2F;Native&#x2F;NtLoader.cpp#L153&quot;&gt;only one loader sampled seemed to support TLS data&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;I really only discovered this by painfully debugging and figuring out the application only crashed when spawning new threads, that the crashes were relating to data in TLS, and figuring that something must be wrong with the TLS data.&lt;&#x2F;p&gt;
&lt;p&gt;It finally clicked when I noticed that the &lt;code&gt;ThreadLocalStoragePointer&lt;&#x2F;code&gt; for the crashing thread&#x27;s TEB didn&#x27;t match the spawning thread&#x27;s...&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;pe-loader&#x2F;teb-command.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;pe-loader&#x2F;teb-command.png&quot; alt=&quot;!teb command in WinDbg&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;pe-loader&#x2F;thread-local-storage.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;pe-loader&#x2F;thread-local-storage.png&quot; alt=&quot;Clicking the TEB pointer in WinDbg&amp;#39;s !teb output&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This is super obvious in hindsight! Each thread&#x27;s TLS has to be unique, but I don&#x27;t know... I thought the &lt;code&gt;ThreadLocalStoragePointer&lt;&#x2F;code&gt; was a pointer to the &lt;em&gt;default state&lt;&#x2F;em&gt; TLS and the per-thread slots were in the TEB&#x27;s &lt;code&gt;TlsSlots&lt;&#x2F;code&gt; field?&lt;&#x2F;p&gt;
&lt;p&gt;Anyways, I set a breakpoint at the thread initialization routine, &lt;code&gt;LdrpInitializeThread&lt;&#x2F;code&gt;, and debugged it to see if there was anything that stood out for TLS initialization. Like magic, I eventually stepped into &lt;code&gt;LdrpAllocateTls&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;pe-loader&#x2F;LdrpAllocateTls.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;pe-loader&#x2F;LdrpAllocateTls.png&quot; alt=&quot;WinDbg stack for a new user thread showing the call into LdrpAllocateTls&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;mirror&#x2F;reactos&#x2F;blob&#x2F;c6d2b35ffc91e09f50dfb214ea58237509329d6b&#x2F;reactos&#x2F;dll&#x2F;ntdll&#x2F;ldr&#x2F;ldrinit.c#L1215-L1273&quot;&gt;ReactOS source code&lt;&#x2F;a&gt; was of huge help here in figuring out what was going on, but essentially what happens when spawning a new thread is:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If any of the currently loaded modules has TLS, allocate a &lt;code&gt;ThreadLocalStoragePointer&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The size of this memory block is &lt;code&gt;sizeof(void*) * NUM_MODULES_WITH_TLS_DATA&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Iterate some &lt;code&gt;TlsLinks&lt;&#x2F;code&gt; list. This is a list of &lt;code&gt;LDRP_TLS_DATA&lt;&#x2F;code&gt;:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;typedef&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span&gt; _LDRP_TLS_DATA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    LIST_ENTRY TlsLinks&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    IMAGE_TLS_DIRECTORY TlsDirectory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;span&gt; LDRP_TLS_DATA&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, *&lt;&#x2F;span&gt;&lt;span&gt;PLDRP_TLS_DATA&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Calculate the size of the TLS data based on the &lt;code&gt;TlsDirectory&lt;&#x2F;code&gt;, and copy its contents.&lt;&#x2F;li&gt;
&lt;li&gt;Put the pointer to the memory allocated in step 4 in the appropriate slot, recorded as &lt;code&gt;TlsData-&amp;gt;TlsDirectory.Characteristics&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Now that I know the TLS data is cached, can&#x27;t I just overwrite the &lt;code&gt;TlsDirectory&lt;&#x2F;code&gt; data in this list from the host module with the data from the new module? Well yes... and no. The &lt;code&gt;LDRP_TLS_DATA&lt;&#x2F;code&gt; is heap-allocated, so I&#x27;d have to scan the heap which would be pretty bug-prone.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;janky-approach-to-fixing-tls-data&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#janky-approach-to-fixing-tls-data&quot; aria-label=&quot;Anchor link for: janky-approach-to-fixing-tls-data&quot;
    &gt;#&lt;&#x2F;a
&gt;
Janky Approach to Fixing TLS Data&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;tl;dr&lt;&#x2F;strong&gt;: use a private &lt;code&gt;ntdll&lt;&#x2F;code&gt; function that returns the cached &lt;code&gt;TLS_ENTRY&lt;&#x2F;code&gt; from a &lt;code&gt;LDR_DATA_TABLE_ENTRY*&lt;&#x2F;code&gt; to find the hijacked module&#x27;s TLS data. Once found, overwrite the cached &lt;code&gt;IMAGE_TLS_DIRECTORY&lt;&#x2F;code&gt; with the new module&#x27;s.&lt;&#x2F;p&gt;
&lt;p&gt;This has a big problem: if the program you&#x27;re loading requires TLS, you must inject into a program with TLS. Otherwise you&#x27;ll be replacing a random DLL&#x27;s TLS data if you aren&#x27;t careful.&lt;&#x2F;p&gt;
&lt;details class=&quot;collapse-section my-4&quot;&gt;
    &lt;summary&gt;List Patching Details&lt;&#x2F;summary&gt;
    &lt;div class=&quot;collapse-content&quot;&gt;
        I popped &lt;code&gt;ntdll.dll&lt;&#x2F;code&gt; into IDA to see what functions were using this &lt;code&gt;LdrpTlsList&lt;&#x2F;code&gt; to see if maybe there was some other way I could grab the list&#x27;s address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;pe-loader&#x2F;LdrpFindTlsEntry.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;pe-loader&#x2F;LdrpFindTlsEntry.png&quot; alt=&quot;IDA Pro window showing functions using LdrpTlsList&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;I found that in Windows (but not ReactOS) is a function, &quot;&lt;code&gt;LdrpFindTlsList&lt;&#x2F;code&gt;&quot;, which will return a &lt;code&gt;PTLS_ENTRY&lt;&#x2F;code&gt; (the actual name of the Windows data structure for ReactOS&#x27;s &lt;code&gt;LDRP_TLS_DATA&lt;&#x2F;code&gt;) given a &lt;code&gt;PLDR_DATA_TABLE_ENTRY&lt;&#x2F;code&gt;. &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;www.nynaeve.net&#x2F;Code&#x2F;VistaImplicitTls.cpp&quot;&gt;Ken Johnson even conviently provided the source code on his blog&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;PLDR_DATA_TABLE_ENTRY&lt;&#x2F;code&gt; can be found in the PEB which you can explore using the &lt;code&gt;!peb&lt;&#x2F;code&gt; command in WinDbg.&lt;&#x2F;p&gt;
&lt;p&gt;The complete code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F; Returns the Thread Environment Block (TEB)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;pub fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; teb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() -&amp;gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; TEB&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let mut&lt;&#x2F;span&gt;&lt;span&gt; teb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; TEB&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    unsafe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;arch&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;asm!&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;mov &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;{}&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, gs:[0x30]&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; out&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;reg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt; teb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    teb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;pub unsafe fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; patch_module_list&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    image_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Option&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&amp;amp;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;u16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_base_address&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    module_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; usize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    get_module_handle_fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; GetModuleHandleAFn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    this_tls_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; IMAGE_TLS_DIRECTORY64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    virtual_protect&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; VirtualProtectFn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    entrypoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) -&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; current_module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; get_module_handle_fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;null&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;());&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; teb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; teb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; peb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (*&lt;&#x2F;span&gt;&lt;span&gt;teb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;ProcessEnvironmentBlock&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; ldr_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (*&lt;&#x2F;span&gt;&lt;span&gt;peb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Ldr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; module_list_head&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (*&lt;&#x2F;span&gt;&lt;span&gt;ldr_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;InMemoryOrderModuleList&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; LIST_ENTRY&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let mut&lt;&#x2F;span&gt;&lt;span&gt; next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (*&lt;&#x2F;span&gt;&lt;span&gt;module_list_head&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Flink&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; module_list_head&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; -1 because this is the second field in the LDR_DATA_TABLE_ENTRY struct.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; the first one is also a LIST_ENTRY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; module_info&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (&lt;&#x2F;span&gt;&lt;span&gt;next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;))&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; LDR_DATA_TABLE_ENTRY&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (*&lt;&#x2F;span&gt;&lt;span&gt;module_info&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;DllBase&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; current_module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            (*&lt;&#x2F;span&gt;&lt;span&gt;module_info&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;DllBase&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_base_address&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            &#x2F;&#x2F; EntryPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            (*&lt;&#x2F;span&gt;&lt;span&gt;module_info&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Reserved3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span&gt; entrypoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            &#x2F;&#x2F; SizeOfImage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            (*&lt;&#x2F;span&gt;&lt;span&gt;module_info&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Reserved3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span&gt; module_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;this_tls_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;is_null&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;                let&lt;&#x2F;span&gt;&lt;span&gt; ntdll_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; get_module_handle_fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;ntdll.dll&lt;&#x2F;span&gt;&lt;span&gt;\0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;as_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Some&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ntdll_text&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; get_module_section&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ntdll_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; b&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;.text&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                    for&lt;&#x2F;span&gt;&lt;span&gt; window&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; ntdll_text&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;windows&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;LDRP_FIND_TLS_ENTRY_SIGNATURE_BYTES&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                        if&lt;&#x2F;span&gt;&lt;span&gt; window&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; LDRP_FIND_TLS_ENTRY_SIGNATURE_BYTES&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;                            &#x2F;&#x2F; Get this window&amp;#39;s pointer and move backwards to find the start of the fn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;                            let mut&lt;&#x2F;span&gt;&lt;span&gt; ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; window&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;as_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                            loop&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;                                let&lt;&#x2F;span&gt;&lt;span&gt; behind&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                                if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt;behind&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xcc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                                    break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;                            let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; LdrpFindTlsEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; LdrpFindTlSEntryFn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;transmute&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;                            let&lt;&#x2F;span&gt;&lt;span&gt; list_entry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; LdrpFindTlsEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module_info&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                            (*&lt;&#x2F;span&gt;&lt;span&gt;list_entry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;TlsDirectory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = *&lt;&#x2F;span&gt;&lt;span&gt;this_tls_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (*&lt;&#x2F;span&gt;&lt;span&gt;next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Flink&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; This stuff here is mostly unnecessary, but I did it anyways as a &amp;quot;just in case&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; The idea is to overwrite the `IMAGE_TLS_DIRECTORY` of the hijacked module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; to point at the new module&amp;#39;s.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; And to get the hijacked module&amp;#39;s TLS index since that&amp;#39;s the slot we&amp;#39;ll be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; hijacking for our new module.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;this_tls_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;is_null&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; dosheader&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; get_dos_header&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current_module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; ntheader&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; get_nt_header&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current_module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dosheader&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        #[&lt;&#x2F;span&gt;&lt;span&gt;cfg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;target_arch &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;x86_64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; ntheader_ref&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; IMAGE_NT_HEADERS64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; unsafe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;transmute&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ntheader&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        #[&lt;&#x2F;span&gt;&lt;span&gt;cfg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;target_arch &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;x86&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; ntheader_ref&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; IMAGE_NT_HEADERS32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; unsafe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;transmute&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ntheader&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; real_module_tls_entry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; ntheader_ref&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;OptionalHeader&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;DataDirectory&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;IMAGE_DIRECTORY_ENTRY_TLS&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; usize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; real_module_tls_dir&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            .&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;real_module_tls_entry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;VirtualAddress&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; isize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; IMAGE_TLS_DIRECTORY64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let mut&lt;&#x2F;span&gt;&lt;span&gt; old_perms&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;        virtual_protect&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            real_module_tls_dir&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;            core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size_of&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;IMAGE_TLS_DIRECTORY64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;(),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            PAGE_READWRITE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; old_perms&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = *((*&lt;&#x2F;span&gt;&lt;span&gt;real_module_tls_dir&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;AddressOfIndex&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        *&lt;&#x2F;span&gt;&lt;span&gt;real_module_tls_dir&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = *&lt;&#x2F;span&gt;&lt;span&gt;this_tls_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        idx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; else&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;        0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
    &lt;&#x2F;div&gt;
&lt;&#x2F;details&gt;
&lt;h4 id=&quot;the-good-method&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-good-method&quot; aria-label=&quot;Anchor link for: the-good-method&quot;
    &gt;#&lt;&#x2F;a
&gt;
The Good Method&lt;&#x2F;h4&gt;
&lt;p&gt;Remember how I said &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;DarthTon&#x2F;Blackbone&#x2F;blob&#x2F;5ede6ce50cd8ad34178bfa6cae05768ff6b3859b&#x2F;src&#x2F;BlackBone&#x2F;ManualMap&#x2F;Native&#x2F;NtLoader.cpp#L153&quot;&gt;only one loader sampled seemed to support TLS data&lt;&#x2F;a&gt;? This happens to be the same approach they took.&lt;&#x2F;p&gt;
&lt;p&gt;Building on the above list patching method, I saw a different function called &lt;code&gt;LdrpAllocateTlsEntry&lt;&#x2F;code&gt; referenced the &lt;code&gt;LdrpTlsList&lt;&#x2F;code&gt; cache and is called by &lt;code&gt;LdrpHandleTlsData&lt;&#x2F;code&gt;. The latter function is called when a new module is loaded and is responsible for setting up almost all of the state relating to a module&#x27;s TLS.&lt;&#x2F;p&gt;
&lt;p&gt;It has no sanity checks on whether or not the module&#x27;s TLS data has already been handled. Which is awesome, and actually makes sense! Why sanity check if this function is only ever called once during real loader scenarios?&lt;&#x2F;p&gt;
&lt;p&gt;We can abuse this by performing the following operations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Update the hijacked module&#x27;s &lt;code&gt;LDR_DATA_TABLE_ENTRY&lt;&#x2F;code&gt; (found via the PEB) to point to our new module&#x27;s base address.&lt;&#x2F;li&gt;
&lt;li&gt;Release the hijacked module&#x27;s TLS data (&lt;code&gt;LdrpReleaseTlsEntry&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;LdrpHandleTlsData&lt;&#x2F;code&gt; with the hijacked module to force the new TLS data to be loaded.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This also solves all of the problems we had with both prior methods!&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;We can inject into any process and not just processes that have TLS data&lt;&#x2F;li&gt;
&lt;li&gt;According to the &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;www.nynaeve.net&#x2F;Code&#x2F;VistaImplicitTls.cpp&quot;&gt;Ken Johnson code&lt;&#x2F;a&gt; this function updates the TLS info in the PEB (or maybe some kernel data?)&lt;&#x2F;li&gt;
&lt;li&gt;And according to the Ken Johnson code updates other threads&lt;&#x2F;li&gt;
&lt;li&gt;Is less code than &lt;em&gt;both&lt;&#x2F;em&gt; other solutions&lt;&#x2F;li&gt;
&lt;li&gt;Doesn&#x27;t require me to manually update the new module&#x27;s TLS index&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; LDRP_RELEASE_TLS_ENTRY_SIGNATURE_BYTES&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;u8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0x83&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xE1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x07&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xC1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xEA&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x03&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; LDRP_HANDLE_TLS_DATA_SIGNATURE_BYTES&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;u8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0xBA&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x23&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x00&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x00&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x00&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x83&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xC9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xFF&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F; Function signature&#x2F;type alias for LdrpReleaseTlsEntry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; LdrpReleaseTlsEntryFn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    unsafe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; extern&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;system&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; LDR_DATA_TABLE_ENTRY&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; unk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; NTSTATUS&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F; Function signature&#x2F;type alias for LdrpHandleTlsData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; LdrpHandleTlsDataFn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; unsafe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; extern&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;system&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; LDR_DATA_TABLE_ENTRY&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F; Returns the Thread Environment Block (TEB)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;pub fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; teb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() -&amp;gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; TEB&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let mut&lt;&#x2F;span&gt;&lt;span&gt; teb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; TEB&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    unsafe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;arch&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;asm!&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;mov &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;{}&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, gs:[0x30]&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; out&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;reg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt; teb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    teb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F; Patches the module list to change the hijacked module&amp;#39;s DLL base and entrypoint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F; TODO: Patch image name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F; This is useful to ensure that a program that depends on `GetModuleHandle*`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F; doesn&amp;#39;t fail simply because its module is not found&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;pub unsafe fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; patch_ldr_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_base_address&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    module_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; usize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    get_module_handle_fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; GetModuleHandleAFn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    this_tls_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; IMAGE_TLS_DIRECTORY64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    entrypoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; current_module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; get_module_handle_fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;null&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;());&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; teb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; teb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; peb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (*&lt;&#x2F;span&gt;&lt;span&gt;teb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;ProcessEnvironmentBlock&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; ldr_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (*&lt;&#x2F;span&gt;&lt;span&gt;peb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Ldr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; module_list_head&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (*&lt;&#x2F;span&gt;&lt;span&gt;ldr_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;InMemoryOrderModuleList&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; LIST_ENTRY&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let mut&lt;&#x2F;span&gt;&lt;span&gt; next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (*&lt;&#x2F;span&gt;&lt;span&gt;module_list_head&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Flink&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; module_list_head&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; -1 because this is the second field in the LDR_DATA_TABLE_ENTRY struct.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; the first one is also a LIST_ENTRY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; module_info&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (&lt;&#x2F;span&gt;&lt;span&gt;next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;))&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; LDR_DATA_TABLE_ENTRY&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (*&lt;&#x2F;span&gt;&lt;span&gt;module_info&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;DllBase&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; current_module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (*&lt;&#x2F;span&gt;&lt;span&gt;next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Flink&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            continue&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        (*&lt;&#x2F;span&gt;&lt;span&gt;module_info&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;DllBase&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_base_address&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; EntryPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        (*&lt;&#x2F;span&gt;&lt;span&gt;module_info&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Reserved3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span&gt; entrypoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; SizeOfImage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        (*&lt;&#x2F;span&gt;&lt;span&gt;module_info&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Reserved3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span&gt; module_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; c_void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; this_tls_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;is_null&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; ntdll_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; get_module_handle_fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;ntdll.dll&lt;&#x2F;span&gt;&lt;span&gt;\0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;as_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; ntdll_text&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; get_module_section&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ntdll_addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; b&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;.text&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; ntdll_text&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;is_none&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; ntdll_text&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ntdll_text&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;unwrap&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; Get the TLS entry for the current module and remove it from the list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Some&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;window&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span&gt; ntdll_text&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            .&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;windows&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;LDRP_RELEASE_TLS_ENTRY_SIGNATURE_BYTES&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;())&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            .&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;find&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(|&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;window&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;|&lt;&#x2F;span&gt;&lt;span&gt; window&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; LDRP_RELEASE_TLS_ENTRY_SIGNATURE_BYTES&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            &#x2F;&#x2F; Get this window&amp;#39;s pointer. It will land us in the middle of this function though&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            let mut&lt;&#x2F;span&gt;&lt;span&gt; ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; window&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;as_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            &#x2F;&#x2F; Walk backwards until we find the prologue. Pray this function retains padding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            loop&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xcc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;amp;&amp;amp; *&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xcc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                    break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            #[&lt;&#x2F;span&gt;&lt;span&gt;allow&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;non_snake_case&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; LdrpReleaseTlsEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; LdrpReleaseTlsEntryFn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;transmute&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;            LdrpReleaseTlsEntry&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module_info&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;null_mut&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;());&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Some&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;window&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span&gt; ntdll_text&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            .&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;windows&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;LDRP_HANDLE_TLS_DATA_SIGNATURE_BYTES&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;())&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            .&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;find&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(|&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;window&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;|&lt;&#x2F;span&gt;&lt;span&gt; window&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; LDRP_HANDLE_TLS_DATA_SIGNATURE_BYTES&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            &#x2F;&#x2F; Get this window&amp;#39;s pointer. It will land us in the middle of this function though&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            let mut&lt;&#x2F;span&gt;&lt;span&gt; ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; window&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;as_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            &#x2F;&#x2F; Walk backwards until we find the prologue. Pray this function retains padding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            loop&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xcc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;amp;&amp;amp; *&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0xcc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                    break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            #[&lt;&#x2F;span&gt;&lt;span&gt;allow&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;non_snake_case&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; LdrpHandleTlsData&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; LdrpHandleTlsDataFn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;transmute&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;            LdrpHandleTlsData&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module_info&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;patching-command-line-args&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#patching-command-line-args&quot; aria-label=&quot;Anchor link for: patching-command-line-args&quot;
    &gt;#&lt;&#x2F;a
&gt;
Patching Command-Line Args&lt;&#x2F;h3&gt;
&lt;p&gt;This has been done by other PE loaders, but I wanted to call this out as well: while the PEB contains the image name and process arugments, so does &lt;code&gt;kernelbase.dll&lt;&#x2F;code&gt;! Why? For &lt;code&gt;GetCommandLineW&lt;&#x2F;code&gt; and &lt;code&gt;GetCommandLineA&lt;&#x2F;code&gt; of course.&lt;&#x2F;p&gt;
&lt;p&gt;This one wasn&#x27;t &lt;em&gt;too&lt;&#x2F;em&gt; bad to patch so long as you want to rely on the fact that the &lt;code&gt;UNICODE_STRING&lt;&#x2F;code&gt; structure for the PEB and in &lt;code&gt;kernelbase.dll&lt;&#x2F;code&gt; share the same backing buffer (i.e. the latter is a shallow copy of the former). That also doesn&#x27;t account for the &lt;code&gt;ANSI_STRING&lt;&#x2F;code&gt; variant... but 🤷‍♂️&lt;&#x2F;p&gt;
&lt;p&gt;tl;dr of the following code: we scan the global memory of &lt;code&gt;kernelbase.dll&lt;&#x2F;code&gt; looking for the previously mentioned &lt;code&gt;UNICODE_STRING&lt;&#x2F;code&gt; buffer pointer we obtained from the PEB then, once found, update its pointer and length to match our new pointer and length.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;pub unsafe fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; patch_cli_args&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;args&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Option&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&amp;amp;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;u16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&amp;gt;,&lt;&#x2F;span&gt;&lt;span&gt; kernelbase_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Some&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;args&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span&gt; args&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; peb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;teb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;ProcessEnvironmentBlock&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; This buffer pointer should match the cached UNICODE_STRING in kernelbase&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; buffer&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (*(*&lt;&#x2F;span&gt;&lt;span&gt;peb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;ProcessParameters&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;CommandLine&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Buffer&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; Search this pointer in kernel32&amp;#39;s .data section&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Some&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernelbase_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; get_module_section&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernelbase_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; b&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;.data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; kernelbase_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;as_mut_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; kernelbase_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() &#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            &#x2F;&#x2F; Do not have two mutable references to the same memory range&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; data_as_wordsize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;from_raw_parts&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; usize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Some&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;found&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span&gt; data_as_wordsize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                .&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;iter&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                .&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;position&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(|&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;| *&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; buffer&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; usize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;                &#x2F;&#x2F; We originally found this while scanning usize-sized data, so we have to translate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;                &#x2F;&#x2F; this to a byte index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;                let&lt;&#x2F;span&gt;&lt;span&gt; found_buffer_byte_pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; found&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size_of&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;usize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;                &#x2F;&#x2F; Get the start of the unicode string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;                let&lt;&#x2F;span&gt;&lt;span&gt; unicode_str_start&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    found_buffer_byte_pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset_of!&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;UNICODE_STRING&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Buffer&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;                let&lt;&#x2F;span&gt;&lt;span&gt; unicode_str&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;transmute&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;_&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; UNICODE_STRING&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;unicode_str_start&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; isize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;                let&lt;&#x2F;span&gt;&lt;span&gt; args_byte_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; args&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size_of&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;u16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                unicode_str&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Buffer&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; args&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;as_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                unicode_str&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Length&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; args_byte_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                unicode_str&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;MaximumLength&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; args_byte_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;preventing-hijacked-application-crashes&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#preventing-hijacked-application-crashes&quot; aria-label=&quot;Anchor link for: preventing-hijacked-application-crashes&quot;
    &gt;#&lt;&#x2F;a
&gt;
Preventing Hijacked Application Crashes&lt;&#x2F;h3&gt;
&lt;p&gt;I thought a great idea to prevent the hijacked application from crashing by suspending all of its threads. I was surprised to learn that not only was this fairly easy to do on Windows, it was &lt;em&gt;even&lt;&#x2F;em&gt; easier to accidentally do this from a non-admin session for all other Medium-IL processes!&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;pe-loader&#x2F;thread_suspension.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;pe-loader&#x2F;thread_suspension.png&quot; alt=&quot;Tweet by @landaire with text, &amp;quot;it has been 0 minutes since I last accidentally suspended all medium-IL threads on my system&amp;quot;&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Yeah, don&#x27;t call &lt;code&gt;CreateToolhelp32Snapshot()&lt;&#x2F;code&gt; incorrectly&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The Windows examples were fairly straightforward but on Xbox the code crashed. And that&#x27;s because the &lt;code&gt;kernel32_ptr&lt;&#x2F;code&gt; here actually needs to be a pointer to &lt;code&gt;kernel32legacy.dll&lt;&#x2F;code&gt; since on Xbox &lt;code&gt;kernel32.dll&lt;&#x2F;code&gt; doesn&#x27;t exist.&lt;&#x2F;p&gt;
&lt;p&gt;That took me a while to figure out and hunt down and double-check where the functions got relocated to.&lt;&#x2F;p&gt;
&lt;p&gt;Here is the code I eventually came up with:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;pub unsafe fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; suspend_threads&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernel32_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PVOID&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; kernelbase_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PVOID&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; kernel32legacy.dll on xbox&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; CreateToolhelp32Snapshot&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fetch_create_tool_help32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernel32_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Thread32Next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fetch_thread_32_next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernel32_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Thread32First&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fetch_thread_32_first&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernel32_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; kernelbase.dll on xbox&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; GetCurrentThreadId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fetch_get_current_thread_id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernelbase_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; GetCurrentProcessId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fetch_get_current_process_id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernelbase_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; OpenThread&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fetch_open_thread&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernelbase_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; SuspendThread&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fetch_suspend_thread&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernelbase_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; CloseHandle&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fetch_close_handle&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;kernelbase_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; pid&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; GetCurrentProcessId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; Suspend all other threads except this one&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; CreateToolhelp32Snapshot&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;TH32CS_SNAPTHREAD&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pid&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; current_thread&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; GetCurrentThreadId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    let mut&lt;&#x2F;span&gt;&lt;span&gt; te&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; THREADENTRY32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;zeroed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    te&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;dwSize &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size_of_val&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;te&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; Thread32First&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; te&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        loop&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; te&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;dwSize &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; usize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                &amp;gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; offset_of!&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;THREADENTRY32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; th32OwnerProcessID&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                    +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size_of_val&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;te&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;th32OwnerProcessID&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; te&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;th32OwnerProcessID &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; pid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; current_thread&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; te&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;th32ThreadID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;                let&lt;&#x2F;span&gt;&lt;span&gt; thread_handle&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; OpenThread&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;THREAD_SUSPEND_RESUME&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, false,&lt;&#x2F;span&gt;&lt;span&gt; te&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;th32ThreadID&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;                SuspendThread&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;thread_handle&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; Thread32Next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; te&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            te&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;dwSize &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; core&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;mem&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size_of_val&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;te&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; u32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    CloseHandle&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;todo&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#todo&quot; aria-label=&quot;Anchor link for: todo&quot;
    &gt;#&lt;&#x2F;a
&gt;
TODO&lt;&#x2F;h2&gt;
&lt;p&gt;There are still some remaining items for the loader:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure that &lt;code&gt;GetModuleHandle(NULL)&lt;&#x2F;code&gt; (handle to self) works correctly.&lt;&#x2F;li&gt;
&lt;li&gt;Maybe load .NET binaries? We already have a technique for launching .NET code, but having an all-in-one solution might be nice.&lt;&#x2F;li&gt;
&lt;li&gt;Maybe make this a generic crate?&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;fin&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#fin&quot; aria-label=&quot;Anchor link for: fin&quot;
    &gt;#&lt;&#x2F;a
&gt;
fin&lt;&#x2F;h2&gt;
&lt;p&gt;This was a fun exercise that taught me a lot about how Windows binaries are loaded. I&#x27;d like to thank carrot_c4k3, tuxuser, and 0e9ca321209eca529d6988c276e4e4ed for their help&#x2F;support.&lt;&#x2F;p&gt;
&lt;p&gt;With this work, we&#x27;re now able to do cool things on Xbox!&lt;&#x2F;p&gt;
&lt;p&gt;For example, using the PE loader we can launch the main GameScript exploit, launch Emma&#x27;s Windows exploit binary to elevate privileges, spawn a new process as suspended, inject our shellcode&#x2F;PE loader, and execute a custom SSH&#x2F;SFTP daemon which uses tokio for async. I think I accomplished my goal of loading complex applications :)&lt;&#x2F;p&gt;
&lt;div class=&quot;video-container&quot;&gt;
    &lt;video controls&gt;
        &lt;source src=&quot;&amp;#x2F;img&amp;#x2F;pe-loader&amp;#x2F;xbox_hacks.mp4&quot; type=&quot;video&#x2F;mp4&quot; &#x2F;&gt;
    &lt;&#x2F;video&gt;
&lt;&#x2F;div&gt;
&lt;p&gt;&lt;em&gt;The top terminal session is the payload server running on my PC, while the bottom netcat session is the output from the exploit and SSH daemon running on my Xbox.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;tuxuser even managed to get toasts working!&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;pe-loader&#x2F;collat_achievement.webp&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;pe-loader&#x2F;collat_achievement.webp&quot; alt=&quot;Collateral Damage Executed Achievement&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>MITMing the Xbox 360 Dashboard for Fun and RCE</title>
        <published>2024-07-30T00:00:00+00:00</published>
        <updated>2024-07-30T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://landaire.net/mitming-the-xbox-360-dashboard-for-rce-and-fun/"/>
        <id>https://landaire.net/mitming-the-xbox-360-dashboard-for-rce-and-fun/</id>
        
        <content type="html" xml:base="https://landaire.net/mitming-the-xbox-360-dashboard-for-rce-and-fun/">&lt;p&gt;In the late 2000s and early 2010s my friends and I were living and breathing Xbox hacking. We were heavily interested in game betas, internal tools, and in general exploring everything the console had to offer.&lt;&#x2F;p&gt;
&lt;p&gt;In 2010 -- or maybe 2011? the dates are getting blurry to me -- my friend Emma (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;twitter.com&#x2F;carrot_c4k3&quot;&gt;@carrot_c4k3&lt;&#x2F;a&gt;) was reverse engineering how the Xbox 360 dashboard worked in order to get Hulu Plus on her retail console (there are a lot more details here missing, but that&#x27;s the &lt;em&gt;why&lt;&#x2F;em&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Somewhere along the way she discovered that there were different URLs and paths which served different &quot;dashboard channels&quot;. A normal console would load the following endpoint as the root manifest for content:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;http:&#x2F;&#x2F;epix.xbox.com&#x2F;epix&#x2F;en-US&#x2F;homepage.xml&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And alternate channels for beta audiences existed at URLs like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;http:&#x2F;&#x2F;epix.xbox.com&#x2F;beta&#x2F;preview_green&#x2F;epix&#x2F;en-US&#x2F;homepage.xml&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;http:&#x2F;&#x2F;epix.xbox.com&#x2F;beta&#x2F;takehome_green&#x2F;epix&#x2F;en-US&#x2F;homepage.xml&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;These manifest files contain the metadata for dynamic marketplace slots and channels that were used to serve ads:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;channel&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;XBOX360&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;definitionpath&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;epix:&#x2F;&#x2F;xbox360channel.xml&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;definitionpath&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;channel&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;channel&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;XBOX_PRE_RELEASE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;channeldef&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;description&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Xbox Pre-Release&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;description&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;online&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;slot&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Marker Scene&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;description&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Xbox Beta Program&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;description&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;description2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Preview LIVE update&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;description2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;rating&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;267242991&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;rating&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;shallowimg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;http:&#x2F;&#x2F;epix.xbox.com&#x2F;shaXam&#x2F;0201&#x2F;df&#x2F;e8&#x2F;dfe8c92a-84b2-4fbc-8ee3-7af37dee567d.JPG?v=1#Beta_Audiences.JPG&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;shallowimg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;slot&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;slot&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Beta Announcements&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;description&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Announcements&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;description&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;description2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Read the latest information&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;description2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;rating&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;267242991&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;rating&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;shallowimg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;http:&#x2F;&#x2F;epix.xbox.com&#x2F;shaXam&#x2F;0201&#x2F;37&#x2F;6b&#x2F;376b27a2-635b-4284-8fb4-713be4c98f60.JPG?v=1#Beta_Announcments.JPG&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;shallowimg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;epixid&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;46f2016d-0bd6-4d0b-8cb1-f2a81356b246&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;epixid&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;onclick&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;          &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;button&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;A&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;button&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;          &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;helptext&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Select&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;helptext&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;          &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;action&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;KeyDown&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;action&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;onclick&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;slot&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;epix&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;46f2016d-0bd6-4d0b-8cb1-f2a81356b246&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;format&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;LUAXZP&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;format&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;path&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;http:&#x2F;&#x2F;epix.xbox.com&#x2F;shaXam&#x2F;0204&#x2F;79&#x2F;35&#x2F;7935844a-91a8-45fe-a9c0-94dfa4d6c053.lzp?v=11#Beta_Announcements.lzp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;path&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;param&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;url=http:&#x2F;&#x2F;live:11&#x2F;xedl&#x2F;BetaChannelXml&#x2F;external&#x2F;announcements.xml&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;param&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;epix&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;preview_green&lt;&#x2F;code&gt; URL was for users in the public Xbox LIVE preview, which Emma was a part of and therefore stood out. Through examining the Lua scripts and other manifest files she discovered a reference to &lt;code&gt;epix-preview.xbox.com&lt;&#x2F;code&gt; and tried loading the &lt;code&gt;preview_green&lt;&#x2F;code&gt; path from that domain instead.&lt;&#x2F;p&gt;
&lt;p&gt;She discovered that the manifest from this domain contained &lt;em&gt;all&lt;&#x2F;em&gt; of the possible dashboard channels that were being tested for the various audiences.&lt;&#x2F;p&gt;
&lt;p&gt;Emma had just discovered some critical info that &lt;strong&gt;there were other beta dashboard channels&lt;&#x2F;strong&gt;, the content of the channels reflected things that employees would typically only see, and there were multiple variations of beta channels.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;inventing-man-in-the-middle-attacks&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#inventing-man-in-the-middle-attacks&quot; aria-label=&quot;Anchor link for: inventing-man-in-the-middle-attacks&quot;
    &gt;#&lt;&#x2F;a
&gt;
Inventing Man-in-the-Middle Attacks&lt;&#x2F;h2&gt;
&lt;p&gt;A year or two before all of this, Emma and I self-discovered what a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Man-in-the-middle_attack&quot;&gt;man-in-the-middle&lt;&#x2F;a&gt; (MITM) attack was in the most janky way possible. I had learned that you could share your ethernet adapter on your PC with your Xbox to tunnel your Xbox&#x27;s traffic through the PC and frequently used this technique to analyze the plaintext HTTP API calls the Xbox made to the marketplace services.&lt;&#x2F;p&gt;
&lt;p&gt;I had also learned about what a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Hosts_(file)&quot;&gt;&lt;code&gt;hosts&lt;&#x2F;code&gt; file&lt;&#x2F;a&gt; was, and one day decided to try something wild:&lt;&#x2F;p&gt;
&lt;p&gt;Redirect the ProdNet (retail) Xbox LIVE marketplace to the PartnerNet (developer) Xbox LIVE marketplace by adding an entry for marketplace.xboxlive.com in my hosts file, pointing at the PartnerNet IP address.&lt;&#x2F;p&gt;
&lt;p&gt;It didn&#x27;t work for me for some reason. But Emma tried it and it worked! She was seeing content from the developer network on her retail console.&lt;&#x2F;p&gt;
&lt;p&gt;We knew how to reverse engineer PowerPC but knew absolutely nothing about networking. At this time we were loosely familiar with the idea of a MITM attack but had no idea how to actually perform one if you control the network. We walked away feeling as if we&#x27;d just discovered electricity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;practical-mitm-attacks&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#practical-mitm-attacks&quot; aria-label=&quot;Anchor link for: practical-mitm-attacks&quot;
    &gt;#&lt;&#x2F;a
&gt;
Practical MITM Attacks&lt;&#x2F;h2&gt;
&lt;p&gt;Being the smart but dumb hackers we were, we decided to try using our hosts file&#x2F;networking sharing trick on something even &lt;em&gt;crazier&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;We were going to mirror the &lt;code&gt;http:&#x2F;&#x2F;epix-preview.xbox.com&#x2F;epix&#x2F;en-US&#x2F;homepage.xml&lt;&#x2F;code&gt; manifest and all of its dependencies on our local machine, then set up a web server that served the content.&lt;&#x2F;p&gt;
&lt;p&gt;Ditto with &lt;code&gt;http:&#x2F;&#x2F;epix.xbox.com&#x2F;beta&#x2F;preview_green&#x2F;epix&#x2F;en-US&#x2F;homepage.xml&lt;&#x2F;code&gt; URLs -- we would essentially rewrite the the manifest URL &lt;em&gt;we wanted&lt;&#x2F;em&gt; to be located on disk where the console &lt;em&gt;actually&lt;&#x2F;em&gt; loaded from. e.g. the &lt;code&gt;&#x2F;beta&#x2F;preview_green&#x2F;&lt;&#x2F;code&gt; part of the path was removed and would be located at &lt;code&gt;http:&#x2F;&#x2F;epix.xbox.com&#x2F;epix&#x2F;en-US&#x2F;homepage.xml&lt;&#x2F;code&gt; instead and &lt;code&gt;epix.xbox.com&lt;&#x2F;code&gt; would resolve to &lt;code&gt;127.0.0.1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s worth noting that these files were RSA signed and couldn&#x27;t be tampered with:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;epix-preview-signature.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;epix-preview-signature.png&quot; alt=&quot;Dashboard manifest header&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Ditto with the XUI Lua scripts referenced by them (e.g. &lt;code&gt;http:&#x2F;&#x2F;epix.xbox.com&#x2F;shaXam&#x2F;0204&#x2F;79&#x2F;35&#x2F;7935844a-91a8-45fe-a9c0-94dfa4d6c053.lzp?v=11#Beta_Announcements.lzp&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;This worked surprisingly well and for a long time we were happily accessing internal Xbox employee dashboards. With a C# utility to automate the work we were mirroring the manifest files every week or so and seeing what was new:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;epix-mirrored.jpg&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;epix-mirrored.jpg&quot; alt=&quot;Screenshot of the mirrored dashboard channels&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Please ignore Ron Jeremy. I had no idea who he was at the time and had searched for &quot;fat greasy man&quot; with the intention of replacing all images in for the Canadian region (&lt;code&gt;en-CA&lt;&#x2F;code&gt;) with that photo to prank one of our friends in Canada who was using our server. It&#x27;s unfortunate that this is one of the only clear screenshots of our MITM tricks that survived time.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;manifests-from-other-live-environments&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#manifests-from-other-live-environments&quot; aria-label=&quot;Anchor link for: manifests-from-other-live-environments&quot;
    &gt;#&lt;&#x2F;a
&gt;
Manifests from Other Live Environments&lt;&#x2F;h3&gt;
&lt;p&gt;A quick note about the dashboard manifest files: although the Xbox 360 had different signing keys for dev vs retail &lt;em&gt;executables and game content&lt;&#x2F;em&gt;, the dashboard files were signed with a shared key.&lt;&#x2F;p&gt;
&lt;p&gt;Through leaked internal Xbox 360 dev kit recoveries we were able to access alternate Xbox LIVE environments such as &quot;int2&quot;, &quot;vint&quot;, and a few others:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;xbox-live-environments.jpg&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;xbox-live-environments.jpg&quot; alt=&quot;Xbox LIVE environments as seen on the Xbox 360 dev launcher&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;live-environments-folder.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;live-environments-folder.png&quot; alt=&quot;A folder of different Xbox LIVE environment files&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Emma connected to int2 one day and discovered that the manifest files were set up for testing all of the available Xbox LIVE Gold offers... including Xbox LIVE for $1.&lt;&#x2F;p&gt;
&lt;p&gt;Since we could use these files on our retail Xboxes, we were able to continuously alternate between the Xbox LIVE Gold for free and Xbox Live Gold for $1 offers to get 1 year of Gold for $6&#x2F;year.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;what-s-a-preview-tool&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-s-a-preview-tool&quot; aria-label=&quot;Anchor link for: what-s-a-preview-tool&quot;
    &gt;#&lt;&#x2F;a
&gt;
What&#x27;s a &quot;Preview Tool&quot;?&lt;&#x2F;h3&gt;
&lt;p&gt;Eventually on one of the dashboard channels I saw something weird that caught my eye:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;preview-tool-listing.jpg&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;preview-tool-listing.jpg&quot; alt=&quot;A dashboard channel showing a Native American on a dashboard tile with the text &amp;quot;Xbox LIVE Marketplace Tools&amp;quot;&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s really hard to see on this terrible camera phone&#x2F;CRT photo but the tile says &quot;Xbox LIVE Programming Tools&quot; at the very top. Upon navigating to the card there was an option to download something called &quot;Preview Tool&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;This is a little more clear to see on the app&#x27;s boxart:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;preview-tool-modern-card.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;preview-tool-modern-card.png&quot; alt=&quot;A dashboard channel showing a Native American on a dashboard tile with the text &amp;quot;Xbox LIVE Marketplace Tools&amp;quot;&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The file was &lt;em&gt;very&lt;&#x2F;em&gt; small and only displayed a message box asking if you&#x27;d like to enable &quot;preview mode&quot;:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;preview-tool-message-box.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;preview-tool-message-box.png&quot; alt=&quot;An Xbox message box with options to enable&#x2F;disable preview mode&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Upon enabling preview mode we suddenly saw debug information on the dashboard:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;preview-tool-debug.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;preview-tool-debug.png&quot; alt=&quot;The Xbox dashboard with debug text printed out in the corner&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Again, the text is &lt;em&gt;very&lt;&#x2F;em&gt; hard to see but there is now red text in the top-right corner of the dashboard showing debug output including the frames per second the dashboard is rendering at. We also noticed that Preview Tool &lt;em&gt;on its own&lt;&#x2F;em&gt; could force our console to use the internal dashboard files without having to do the MITM which made life much easier for us.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;arbitrary-code-execution&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#arbitrary-code-execution&quot; aria-label=&quot;Anchor link for: arbitrary-code-execution&quot;
    &gt;#&lt;&#x2F;a
&gt;
Arbitrary Code Execution&lt;&#x2F;h2&gt;
&lt;p&gt;Preview Tool was a unique type of application in that it actually had an expiration date associated with it. You were required to be on Xbox LIVE to launch the app and its revocation&#x2F;expiration status would be checked by the system.&lt;&#x2F;p&gt;
&lt;p&gt;Sooner or later our copies of Preview Tool expired. Although we had the means of downloading anything we wanted from the Xbox LIVE marketplace we were too lazy to brute-force the randomized 32-bit ID required to download the newer packages that expired in the future. We had done this for other titles in the past but it was a process that took a couple days when distributed across multiple parties.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;halo4-offer-brute-force.jpg&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;halo4-offer-brute-force.jpg&quot; alt=&quot;Brute forcing the Halo 4 beta offer ID with Archangel&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Archangel was a utility developed by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;twitter.com&#x2F;xenomega9&quot;&gt;@xenomga9&lt;&#x2F;a&gt; for brute forcing the Halo 4 beta&#x27;s offer ID. If you were ever wondering how the &quot;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=POconAHU3aE&quot;&gt;Halo 4 barn video&lt;&#x2F;a&gt;&quot; came to be, this was it.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Brute forcing just wasn&#x27;t worth the time and effort though when we were still doing CDN cloning for our friends without Preview Tool. So we just stopped getting Preview Tool and started doing MITM again.&lt;&#x2F;p&gt;
&lt;p&gt;We didn&#x27;t realize how powerful Preview Tool was until our copies had expired. At some point I wanted to know how Preview Tool had been forcing the console to use internal dashboard channels, so I opened it up in IDA and noticed a call to an API I&#x27;d never seen before named &lt;code&gt;XamSetStagingMode&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;xam-set-staging-mode-call.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;xam-set-staging-mode-call.png&quot; alt=&quot;XamSetStagingMode function call&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;And the &lt;code&gt;XamSetStagingMode&lt;&#x2F;code&gt; API just sets some global:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;xam-set-staging-mode.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;xam-set-staging-mode.png&quot; alt=&quot;XamSetStagingMode function disassembly&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Ok... so who uses this global?&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;staging-mode-references.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;staging-mode-references.png&quot; alt=&quot;System staging mode global references&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Interesting! &lt;code&gt;XamVerifyXSignerSignature&lt;&#x2F;code&gt; is used for verifying certain things which aren&#x27;t checked by the hypervisor, like the dashboard manifest files and their Lua scripts. Checking how this is used:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;staging-mode-check.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;xbox-dashboard&#x2F;staging-mode-check.png&quot; alt=&quot;XamVerifyXSignerSignature diassembly&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Not shown in the above screenshot, but if staging mode is enabled and the file signature isn&#x27;t valid the console will debug print the following string:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;XamVerifyXSignerSignature: Signature not trusted, but ok since we&amp;#39;re in staging mode or on a devkit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;i.e. &lt;code&gt;XamSetStagingMode()&lt;&#x2F;code&gt;, and therefore Preview Tool, disables all signature checks of dashboard contents. &lt;em&gt;Correction: &lt;code&gt;XamVerifyXSignerSignature&lt;&#x2F;code&gt; will allow unsigned content if the caller provides a certain flag indicating they want to allow untrusted signatures in devkit&#x2F;staging mode. Back when we originally discovered Preview Tool, the dashboard provided this flag but does not appear to anymore.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This doesn&#x27;t actually answer the question though of how the alternate dashboard channels were being used.&lt;&#x2F;p&gt;
&lt;p&gt;Although I never looked into it fully, I believe the dashboard or another component called &lt;code&gt;XamGetStagingMode()&lt;&#x2F;code&gt; and used a different value for the epix CDN&#x2F;path. There also exists a &quot;Live Hive&quot; which is a key-value store used for dynamically configuring Xbox LIVE settings:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CatalogCDNUriPort=80&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CatalogCDNUriRoot=http:&#x2F;&#x2F;catalog.vint.xboxlive.com&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CatalogUriPort=80&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CatalogUriRoot=http:&#x2F;&#x2F;catalog.vint.xboxlive.com&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CloudStorageStatus=1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CommunityGamesTrialExpirationInSeconds=480&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ContractManagerUriRoot=http:&#x2F;&#x2F;contractfd.test.xboxlive.com&#x2F;v2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;I&#x27;m almost positive one of these settings was overwritten by Preview Tool (or something else) to point at a different base URL for epix.&lt;&#x2F;p&gt;
&lt;p&gt;Although this is a bit anticlimactic, we barely even bothered to use this newfound knowledge of disabling signature checks since we had dev kits and could run our own &lt;em&gt;native&lt;&#x2F;em&gt; code anyways. This only gave us arbitrary Lua scripting capabilities.&lt;&#x2F;p&gt;
&lt;p&gt;It also meant we&#x27;d have to grab Preview Tool versions that weren&#x27;t expired every now and then, which we were too lazy to do. But it was nice to know that if we wanted to, we now knew how to control scripts on the dashboard.&lt;&#x2F;p&gt;
&lt;p&gt;In the end what we got from this entire effort was access to Xbox employee-only game betas, tools, and interesting insight into how the dashboard worked.&lt;&#x2F;p&gt;
&lt;p&gt;You can download some of the interesting manifest files I had saved on an old HDD &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;archive.org&#x2F;details&#x2F;epix-playground-manifests&quot;&gt;on Archive.org&lt;&#x2F;a&gt;. Unfortunately I did not mirror the Lua scripts and &lt;code&gt;epix-preview.xbox.com&lt;&#x2F;code&gt; has since been killed off by Microsoft -- but that&#x27;s a story for another day :)&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>On Dependency Usage in Rust</title>
        <published>2024-06-03T00:00:00+00:00</published>
        <updated>2024-06-03T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://landaire.net/on-dependency-usage-in-rust/"/>
        <id>https://landaire.net/on-dependency-usage-in-rust/</id>
        
        <content type="html" xml:base="https://landaire.net/on-dependency-usage-in-rust/">&lt;h2 id=&quot;context&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#context&quot; aria-label=&quot;Anchor link for: context&quot;
    &gt;#&lt;&#x2F;a
&gt;
Context&lt;&#x2F;h2&gt;
&lt;p&gt;A couple months back I read &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;scribe.rip&#x2F;@john_25313&#x2F;c-isnt-a-hangover-rust-isn-t-a-hangover-cure-580c9b35b5ce&quot;&gt;&quot;C isn&#x27;t a Hangover; Rust isn&#x27;t a Hangover Cure&quot;&lt;&#x2F;a&gt; (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@john_25313&#x2F;c-isnt-a-hangover-rust-isn-t-a-hangover-cure-580c9b35b5ce&quot;&gt;original Medium link&lt;&#x2F;a&gt;) by John Viega. I &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;x.com&#x2F;landaire&#x2F;status&#x2F;1782890213146083625&quot;&gt;responded to the post&lt;&#x2F;a&gt; already on Twitter (sometimes known as X) and in hindsight should have just written a blog post to begin with since the platform is so terrible for longform comment.&lt;&#x2F;p&gt;
&lt;p&gt;What follows is hopefully a more organized, digestable, and better response to John&#x27;s post than what I wrote on Twitter. If you haven&#x27;t read his post, I recommend giving it a read for full context instead of reading just what I&#x27;ve decided to directly respond to.&lt;&#x2F;p&gt;
&lt;p&gt;John&#x27;s post goes into some concerns about using Rust and if Rust is really the right choice over something GC&#x27;d, and covers a few angles including whether memory safety really matters for you, what language best fits your &lt;em&gt;team&lt;&#x2F;em&gt;, and something that came up multiple times is dependency usage.&lt;&#x2F;p&gt;
&lt;p&gt;I disagree with some of the arguments John made surrounding dependencies and I frequently hear similar sentiments said by crowds who are anti-Rust. The idea that a program is less desirable or less secure because it has more dependencies. I find these arguments to be an easy jab lacking substance, and wanted to take an opportunity to challenge them.&lt;&#x2F;p&gt;
&lt;p&gt;My big complaint with John&#x27;s points is that he spells out negatives but ignores most positives, instead telling the reader to figure those out for themselves.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s important to understand who I am for a frame of reference: my background is in security and I first learned to program in C# making tools for Xbox 360 modding. That involved some reverse engineering and learning C++ for writing trainers&#x2F;tools&#x2F;cheats or whatever stuff would have to run on the console. Following my Xbox hacking in my teens, I professionally did web dev for some years (PHP), then web security, then hypervisor security at Microsoft, and now native code security focused on mobile applications. With the exception of my ~3 years in professional web dev, my title has always had &quot;Security Engineer&quot; in it -- not &quot;Software Engineer&quot;. I sure as shit write a lot of code though.&lt;&#x2F;p&gt;
&lt;p&gt;I was entirely self-taught in programming at age 13 mostly through following online tutorials, and got a bachelor&#x27;s degree in computer science.&lt;&#x2F;p&gt;
&lt;p&gt;My language of choice for about 8 years now has been Rust. This was settled upon after trying Go, D, Python, and some other languages inbetween. I am nobody in C&#x2F;C++ circles and I&#x27;m a nobody in Rust circles, but I do pay close attention to the Rust community because I love the language.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;why-are-dependencies-seen-as-insecure&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#why-are-dependencies-seen-as-insecure&quot; aria-label=&quot;Anchor link for: why-are-dependencies-seen-as-insecure&quot;
    &gt;#&lt;&#x2F;a
&gt;
Why are dependencies seen as insecure?&lt;&#x2F;h2&gt;
&lt;p&gt;John talks about this at good length and it&#x27;s worth reading his thoughts. If you&#x27;re too lazy to do so, I think it can be sufficiently summarized as:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&quot;Code review is a lot harder to do well than writing code&quot;&lt;&#x2F;li&gt;
&lt;li&gt;Dependencies can come from anyone and can generally be contributed to by anyone. Therefore the more dependencies you have, the larger your implicit circle of trust, and any break in that circle breaks your security. They become a single point of failure.&lt;&#x2F;li&gt;
&lt;li&gt;You trust the code you write, and you know the code you write.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;On #1, I don&#x27;t agree -- at least not broadly. It&#x27;s probably true for small bits of code that you have the technical know-how to write yourself, but in memory-safe langauges what&#x27;s the worst thing you can miss in a code review of something that&#x27;s not technically complicated? Probably minor bugs that would cause a DoS. So you bring in a dependency that you didn&#x27;t audit super closely and now you have a DoS in your application. Depends on your threat model how important this is to you, and whether that impacts your mental quality rating of the dependency.&lt;&#x2F;p&gt;
&lt;p&gt;On #2 I mostly agree. You are opening up your circle of trust, but done right you can protect yourself. The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Npm_left-pad_incident&quot;&gt;npm left-pad incident&lt;&#x2F;a&gt; is a prime example of what can go wrong from even a non-malicious dependency failure.&lt;&#x2F;p&gt;
&lt;p&gt;In the left-pad incident a package named &quot;left-pad&quot; was removed from the npm registry causing widespread build failures for almost every node.js application. The broad usage of this dependency shocked people since it was less than 50 lines of code and could be written by anyone.&lt;&#x2F;p&gt;
&lt;p&gt;If you&#x27;re pulling in a dependency that&#x27;s &lt;em&gt;already&lt;&#x2F;em&gt; compromised then you&#x27;re a bit late, but for avoiding &lt;em&gt;future&lt;&#x2F;em&gt; compromise you can:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Use a package service that does not delete yanked dependencies. This should only be possible in extremely rare scenarios where e.g. someone&#x27;s private information was exposed. crates.io, Rust&#x27;s default package source, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;crates.io&#x2F;policies&quot;&gt;does not permit deletion&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Commit lockfiles to ensure that builds are reproducible, the same dependencies are pulled every time, and a future compromise of a dependency doesn&#x27;t impact you unless you explicitly update. This is the default behavior for Cargo and npm. The lockfile will also ensure that the dependency&#x27;s location is preserved, preventing dependency substitution attacks and should ensure that with the first point above that even a yanked dependency can still be resolved.&lt;&#x2F;li&gt;
&lt;li&gt;Vendor dependencies so that you have a true complete snapshot of things without relying on 3rd parties. This weighs a lot more and is harder to manage over time but is an immediate solution to both of the above points.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;On #3, sure. This is reasonable, but there are costs to writing that code that I&#x27;ll cover later on.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;just-because-c-c-users-suffer-doesn-t-mean-everyone-else-has-to&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#just-because-c-c-users-suffer-doesn-t-mean-everyone-else-has-to&quot; aria-label=&quot;Anchor link for: just-because-c-c-users-suffer-doesn-t-mean-everyone-else-has-to&quot;
    &gt;#&lt;&#x2F;a
&gt;
Just because C&#x2F;C++ users suffer doesn&#x27;t mean everyone else has to&lt;&#x2F;h2&gt;
&lt;p&gt;I&#x27;m going to quote a few of John&#x27;s paragraphs for full context and then dissect some of them one-by-one:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Rust makes it easy to pull in outside dependencies, and much like in the JavaScript ecosystem, it seems to have encouraged lots of tiny dependencies. That makes it a lot harder to monitor and manage the problem.&lt;&#x2F;p&gt;
&lt;p&gt;But Rust’s situation is even worse than in most languages, in that core Rust libraries (major libraries officially maintained by the Rust project) make heavy use of third party dependencies. The project needs to take ownership and provide oversight for their libraries.&lt;&#x2F;p&gt;
&lt;p&gt;To me, this has long been one of the biggest risks in software. I can write C code that is reasonably defensive, but I have a hard time trusting any single dependency I use, never mind scaling that out.&lt;&#x2F;p&gt;
&lt;p&gt;Properly securing your dependency supply chain is a much harder problem than writing safe C code. Personally, I only pull in dependencies beyond standard libraries if the work I’d have to do in order to credibly replace the functionality is so great that, if I didn’t bring in a dependency, I would choose not to do the work.&lt;&#x2F;p&gt;
&lt;p&gt;C is a lot better than Rust in this regard, but it’s not particularly great. Partially, that’s because the C standard libraries (which I am always willing to use; the core language implementation and runtime is a given) are not at all extensive. People who write a lot of C end up building things themselves once and keeping them around and adapting them for decades, including basic data structures like hash tables.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;First of all, I strongly disagree with the sentiment that securing your dependency supply chain is harder than writing safe C&#x2F;C++ code.&lt;&#x2F;p&gt;
&lt;p&gt;You have to be at least a moderately advanced user in C++&#x2F;core memory safety ideas to come to the realization that modifying a container while iterating it with iterators is a bad idea, or that there are subtly different ways to zero-initialize a structure that result in subtly different ways of it being zero-initialized (which may or may not include its padding), or that &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;31774802&#x2F;455678&quot;&gt;some types of pointer arithmetic&#x2F;comparisons are undefined behavior&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;You don&#x27;t need to be an advanced programmer to do a short sniff test to see if a dependency you&#x27;re bringing in to your application looks fairly widely used and trusted by a community. Sure, the XZ backdoor is an extreme example of even experts who were &lt;em&gt;members of the project&lt;&#x2F;em&gt; missed something snuck in over time, but this is not what we&#x27;re talking about here.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Rust makes it easy to pull in outside dependencies&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Honestly? &lt;em&gt;Thank god&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;While C&#x2F;C++ applications generally require fewer dependencies, most of the time you&#x27;re relying on the project maintainer to provide you with a list of those dependencies and how to install them with your platform&#x27;s preferred package manager.&lt;&#x2F;p&gt;
&lt;p&gt;Something that I always find myself saying when try to build a C&#x2F;C++ application from source is &quot;shit I&#x27;m missing a header&quot; and general complaints about the build tools themselves. And of course the build&#x2F;configuration tool tells you what you lack but doesn&#x27;t tell you what you need to install because that&#x27;s not its responsibility. The build tool may support building on your favorite OS, but it doesn&#x27;t know how to install packages on that OS or even &lt;em&gt;what&lt;&#x2F;em&gt; the package is.&lt;&#x2F;p&gt;
&lt;p&gt;So you&#x27;re left with a terrible error message that can leave you wondering &quot;Do I need to install lib-dev-whatever2 or just lib-whatever2? Is this even available via my OS&#x27;s package manager?&quot;&lt;&#x2F;p&gt;
&lt;p&gt;Don&#x27;t forget all of the dependencies you need to install just to install the dependency too: pkgconf, autoconf, autotools, ninja, cmake, whatever, and any other libraries this single dependency may rely on. Kicking the problem into a Dockerfile is also not a good substitution for a quality build tool.&lt;&#x2F;p&gt;
&lt;p&gt;The developer experience surrounding dependencies in C&#x2F;C++ is so awful that you just default to not using any at all. Or you bring in a &quot;header-only library&quot; that makes integration easy because bringing in multiple external source&#x2F;header files makes people want to turn off their computer and consider another career.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;[Easy dependency usage] seems to have encouraged lots of tiny dependencies. That makes it a lot harder to monitor and manage the problem.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;I disagree that the dependency story becomes harder to manage. There are multiple tools to monitor and manage your dependency usage in Rust:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;cargo&#x2F;commands&#x2F;cargo-tree.html&quot;&gt;cargo-tree&lt;&#x2F;a&gt; can tell you your dependency tree&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;geiger-rs&#x2F;cargo-geiger&quot;&gt;cargo-geiger&lt;&#x2F;a&gt; can tell you if any of your dependencies in the graph use &lt;code&gt;unsafe{}&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;cackle-rs&#x2F;cackle&quot;&gt;cargo-acl&lt;&#x2F;a&gt; can tell you which crates use &lt;code&gt;unsafe{}&lt;&#x2F;code&gt;, run build scripts to see if any use network&#x2F;filesystem, and provides you with API usage information to see if a crate is doing things unexpected. It can even sandbox the build tools.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;blog.rust-lang.org&#x2F;inside-rust&#x2F;2020&#x2F;01&#x2F;23&#x2F;Introducing-cargo-audit-fix-and-more.html&quot;&gt;cargo-audit&lt;&#x2F;a&gt; can tell you if any of your crates are affected by a known security vulnerability and fix the used package version automatically.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These are all possible because Rust&#x27;s tooling ecosystem is so good. These are not things that are run by default so the argument is a bit weaker, but the fact that they exist means you have the option of using them if you want to. For example, I&#x27;ve seen many CI pipelines that use &lt;code&gt;cargo-audit&lt;&#x2F;code&gt; to ensure vulnerable crates aren&#x27;t being used.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;People who write a lot of C end up building things themselves once and keeping them around and adapting them for decades, including basic data structures like hash tables.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;I see this as a bad thing. You&#x27;re probably going to write bugs and it&#x27;s going to be hard to fix affected applications. No proper version tracking or update mechanism means that depending on how you use and manage this ad-hoc dependency, tracking where it&#x27;s used and patching affected programs might be difficult.&lt;&#x2F;p&gt;
&lt;p&gt;A hash table is also not necessarily a &quot;basic&quot; data structure but I would definitely consider it a &lt;em&gt;common&lt;&#x2F;em&gt; data structure. Common data structures and algorithms can still have bugs, and there are many examples of this (and if it&#x27;s so common why isn&#x27;t it in the stdlib?). No intent here to shame these folks, but just some examples: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;rustsec.org&#x2F;packages&#x2F;smallvec.html&quot;&gt;smallvec&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;blog.isosceles.com&#x2F;the-webp-0day&#x2F;&quot;&gt;libwebp&#x27;s Huffman tree decoding&lt;&#x2F;a&gt;, and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.openwall.com&#x2F;lists&#x2F;oss-security&#x2F;2024&#x2F;01&#x2F;30&#x2F;7&quot;&gt;glibc&#x27;s &lt;code&gt;qsort()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;. (I&#x27;m aware that glibc and libwebp would typically be installed using your distro&#x27;s package manager but that&#x27;s besides the point.)&lt;&#x2F;p&gt;
&lt;p&gt;So why are we shooting ourselves in the foot by making it difficult to track and manage our dependencies for C&#x2F;C++, including even our &lt;em&gt;own&lt;&#x2F;em&gt; first-party dependencies?&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;x.com&#x2F;Lucretiel&#x2F;status&#x2F;1772865033757679892&quot;&gt;@Lucretiel summarized this same sentiment fairly well on Twitter&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Quick reminder that I C doesn&#x27;t have a culture of minimal dependencies because of some kind of ingrained strong principles in its community, C has a culture of minimal dependencies because adding a dependency in C is a pain in the fucking ass.&lt;&#x2F;p&gt;
&lt;p&gt;Rust and Node.js have smaller projects and deeper dependency trees than C++ or Python for literally no other reason than the fact that the former languages make it very easy to create, publish, distribute, and declare dependencies.&lt;&#x2F;p&gt;
&lt;p&gt;This is systemic incentives 101.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;rust-isn-t-as-batteries-included-as-other-languages&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#rust-isn-t-as-batteries-included-as-other-languages&quot; aria-label=&quot;Anchor link for: rust-isn-t-as-batteries-included-as-other-languages&quot;
    &gt;#&lt;&#x2F;a
&gt;
Rust isn&#x27;t as &quot;batteries included&quot; as other languages&lt;&#x2F;h2&gt;
&lt;p&gt;One point John makes is:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Languages like Go and Python that have extensive standard libraries that the language maintainers take responsibility for are actually the best case scenario in my opinion. Yes, more people touch the code, but the DIY economics are often the wrong choice, and having organizations willing to both be accountable, and provide an environment where people can focus on minimizing dependencies if they feel its important, is a good thing.&lt;&#x2F;p&gt;
&lt;p&gt;...&lt;&#x2F;p&gt;
&lt;p&gt;Generally, I think Rust (and pretty much any programming language) would be served well to take ownership of their standard libraries. Pull in all the dependencies, and be willing to take ownership.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;I agree with John that having batteries included simplifies things for both new and established users, but I don&#x27;t think we should be so quick to add more batteries to the collection without sufficient testing.&lt;&#x2F;p&gt;
&lt;p&gt;My understanding is Rust has learned from the mistakes of other languages and explicitly tries not to include things in the standard library that the Rust core team believes don&#x27;t quite fit, including for reasons of figuring out the API. You simply have more freedom with packages: they&#x27;re semver-versioned and you can break compat with an appropriate version bump.&lt;&#x2F;p&gt;
&lt;p&gt;You don&#x27;t necessarily know the warts of an API until you start to really use it widely. Take for example the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;rand&quot;&gt;&lt;code&gt;rand&lt;&#x2F;code&gt; crate&lt;&#x2F;a&gt;. There is no random number generator in the Rust standard library, and &lt;code&gt;rand&lt;&#x2F;code&gt; is the de facto standard crate for this task.&lt;&#x2F;p&gt;
&lt;p&gt;That&#x27;s a bit odd, no? Random number generation is fairly common and one would think it&#x27;s in the standard library. There&#x27;s even a tracking issue for adding one: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;rust-lang&#x2F;rust&#x2F;issues&#x2F;27703&quot;&gt;#27703&lt;&#x2F;a&gt; (and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;rust-lang&#x2F;rust&#x2F;issues&#x2F;36999&quot;&gt;#36999&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;While I agree in principle, putting something into the standard library mostly means that the APIs for it are immutable. You know what&#x27;s changed in fairly minor but meaningful ways since those issues were closed? The &lt;code&gt;rand&lt;&#x2F;code&gt; crate&#x27;s APIs. If these had been brought into the standard library as-is we&#x27;d be mostly forever stuck with certain warts like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.rs&#x2F;rand&#x2F;0.6.5&#x2F;rand&#x2F;trait.Rng.html#method.gen_range&quot;&gt;&lt;code&gt;Rng::gen_range()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; accepting 2 args (low, high) instead of the more-natural &lt;code&gt;Range&lt;&#x2F;code&gt; (using &lt;code&gt;low..=high&lt;&#x2F;code&gt; syntax).&lt;&#x2F;p&gt;
&lt;p&gt;Rust itself is still a growing and changing language as well, and it may not make sense to land on an API that would be better once language improvements land. Good luck changing a stabilized API without breaking compat.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;package-management-in-other-languages-also-suck&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#package-management-in-other-languages-also-suck&quot; aria-label=&quot;Anchor link for: package-management-in-other-languages-also-suck&quot;
    &gt;#&lt;&#x2F;a
&gt;
Package management in other languages also suck&lt;&#x2F;h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Yes, Python has become so popular, that plenty of people use outside dependencies, and there are several popular package managers. However, it’s still in a vastly better place from a supply chain perspective than JavaScript, which has become famous among developers for hidden dependencies on trivially small packages.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;There&#x27;s no way to really sugarcoat this, but Python and Go package management really fucking sucked (Python still sucks, but some semi-recent tools are making it suck less).&lt;&#x2F;p&gt;
&lt;p&gt;So Python has monolithic dependencies... but why? Because the tooling and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;packaging.python.org&#x2F;en&#x2F;latest&#x2F;tutorials&#x2F;packaging-projects&#x2F;&quot;&gt;uploading dependencies&lt;&#x2F;a&gt; is high-friction&lt;sup&gt;&lt;sup&gt;(I&#x27;ve never uploaded -- maybe it&#x27;s easier than I think)&lt;&#x2F;sup&gt;&lt;&#x2F;sup&gt;. And we&#x27;re supposed to praise this? In what world is Python + pip &quot;in a vastly better place from a supply chain perspective than JavaScript&quot; because of this fact either?&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;pip dependencies are by default global which causes conflicts with other Python applications, forcing you to use virtual environments. &lt;em&gt;Note: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;rust&#x2F;comments&#x2F;1d86c62&#x2F;on_dependency_usage_in_rust&#x2F;l76qj85&#x2F;&quot;&gt;&#x2F;u&#x2F;encyclopedist on Reddit&lt;&#x2F;a&gt; pointed out that this has recently changed with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;peps.python.org&#x2F;pep-0668&#x2F;&quot;&gt;PEP 668&lt;&#x2F;a&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If pip hits a version conflict within your own project&#x27;s package graph you&#x27;re in for a headache&lt;&#x2F;li&gt;
&lt;li&gt;Packages with native dependencies are a mystery to basically everyone except the package author. Or is this just me?&lt;&#x2F;li&gt;
&lt;li&gt;There&#x27;s no strong lockfile containing metadata sufficient for guaranteeing the bits someone installing a project&#x27;s dependencies for the first time match the bits when the lockfile was generated (i.e. package hashes).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;pip in my experience has been so frustrating to use for dependency management that it inspires me to just simply not use dependencies to begin with. &lt;strong&gt;Yes there are tools that make this easier, but they are not defaults or even agreed upon by the community.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;And before Go had its &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;go.dev&#x2F;blog&#x2F;versioning-proposal&quot;&gt;package management renaissance&lt;&#x2F;a&gt; does anyone remember what it looked like to use dependencies in Go?&lt;&#x2F;p&gt;
&lt;p&gt;You imported a library like this in your code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;import&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;github.com&#x2F;codegangsta&#x2F;cli&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You use &lt;code&gt;go get&lt;&#x2F;code&gt; to download the dependencies to your local machine, and built the application.&lt;&#x2F;p&gt;
&lt;p&gt;There were no lock files, no versions, nothing. The latest version of the source code was grabbed and used until you updated it which may have had breaking changes. The community had to resort to package proxies to version packages. Today it&#x27;s pretty insane to think about letting a 3rd party man-in-the-middle your packages and deliver it to you with no integrity checks just to work around warts in the tools.&lt;&#x2F;p&gt;
&lt;p&gt;And what about other languages like C#? NuGet, .NET&#x27;s package manager, was also terrible.&lt;&#x2F;p&gt;
&lt;p&gt;I don&#x27;t know how it is today, but around ~2017 while working at Microsoft I discovered that NuGet had a &quot;feature&quot; where the client would reach out to all of your package feeds in parallel to fetch a package and whichever responded first won. I can&#x27;t find the issue for it on GitHub, but someone had reported this behavior and it was considered &quot;by-design&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;Even still when I presented the problem to the NuGet team internally, they did not see it as a vulnerability. The obvious problem here was that we were leaking our internal package names to external package feeds and a name collision could result in the wrong package being used (this was before dependency substitution&#x2F;confusion attacks were widely known).&lt;&#x2F;p&gt;
&lt;p&gt;NuGet also had no lock files, no integrity checks, and conveniently provides install&#x2F;build scripts and usually what you&#x27;re receiving is prebuilt binaries. Code integrity isn&#x27;t verified and the only thing that would have prevented you from using a completely different binary was &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;dotnet&#x2F;standard&#x2F;assembly&#x2F;strong-named&quot;&gt;Strong naming&lt;&#x2F;a&gt; which is not a security boundary. In fact, I&#x27;ve seen a lot of projects publish their strong name key.&lt;&#x2F;p&gt;
&lt;p&gt;Rust was fortunately blessed from the beginning (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;blog.rust-lang.org&#x2F;2014&#x2F;11&#x2F;20&#x2F;Cargo.html&quot;&gt;pre-1.0, 2014!&lt;&#x2F;a&gt;) with people who knew how to build a package manager. Cargo is not perfect, but it works pretty damn well for the majority of Rust users.&lt;&#x2F;p&gt;
&lt;p&gt;It is &lt;em&gt;because&lt;&#x2F;em&gt; the package management story in Rust is so good compared to other languages that the standard library doesn&#x27;t need to be as feature-complete. Shipping with a fantastic package manager in 1.0 allowed the community package ecosystem to explode without having to pause and shift towards better or different solutions (NuGet&#x27;s change to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;devblogs.microsoft.com&#x2F;nuget&#x2F;enable-repeatable-package-restores-using-a-lock-file&#x2F;&quot;&gt;JSON-based projects&lt;&#x2F;a&gt;, Go&#x27;s shift away from &lt;code&gt;go get&lt;&#x2F;code&gt; using git-based imports to Go modules, and many different Python package managers like poetry, rye, pipenv).&lt;&#x2F;p&gt;
&lt;p&gt;Rust developers are not bleeding from using the tools they depend on and it&#x27;s absurd to me that this is considered a weakness.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;what-about-dependency-explosion&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-about-dependency-explosion&quot; aria-label=&quot;Anchor link for: what-about-dependency-explosion&quot;
    &gt;#&lt;&#x2F;a
&gt;
What about dependency explosion?&lt;&#x2F;h2&gt;
&lt;p&gt;Here is an example of an application I&#x27;m working on that reads files in a custom filesystem specific to the Xbox 360 (known as XContent &#x2F; STFS). There&#x27;s crypto involved for signing the header and verifying file data and conceptually this single file contains many others similar to a tarball or zip file.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s a CLI application with the following dependencies in its &lt;code&gt;Cargo.toml&lt;&#x2F;code&gt; file:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;dependencies&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# For mmaping the input file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;memmap2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Parsing arguments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;clap&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = {&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;4.5.4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;,&lt;&#x2F;span&gt;&lt;span&gt; features&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = [&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;derive&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;] }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Easy error handling&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;anyhow&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Data serialization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;serde&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = {&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Reading the input file&amp;#39;s filesystem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stfs&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = {&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;0.1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;,&lt;&#x2F;span&gt;&lt;span&gt; path&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;..&#x2F;stfs&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Also for reading the input file&amp;#39;s filesystem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;xcontent&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = {&lt;&#x2F;span&gt;&lt;span&gt; path&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;..&#x2F;xcontent&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Date&#x2F;time operations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chrono&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;0.4.38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Converting data to&#x2F;from hexadecimal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;0.4.3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Converting file sizes to something human-readable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;humansize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;2.1.3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Serializing data to JSON&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;serde_json&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;According to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;lib.rs&#x2F;crates&#x2F;cargo-deps-list&quot;&gt;&lt;code&gt;cargo deps-list&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; this results in 102 dependencies from the 10 direct dependencies I specified. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jplatte&#x2F;cargo-depgraph&quot;&gt;&lt;code&gt;cargo depgraph&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; produced this graph:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;acceleration_dependency_graph.svg&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;acceleration_dependency_graph.svg&quot; alt=&quot;The application&amp;#39;s dependency graph in dotviz format&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Click for a larger image&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-sniff-test&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-sniff-test&quot; aria-label=&quot;Anchor link for: the-sniff-test&quot;
    &gt;#&lt;&#x2F;a
&gt;
The sniff test&lt;&#x2F;h3&gt;
&lt;p&gt;I&#x27;ve mentioned my &quot;quick checks&quot; or &quot;sniff test&quot; a couple times in this blog post, so it&#x27;s worth calling out what it is.&lt;&#x2F;p&gt;
&lt;p&gt;I 100% did not audit all 102 of these dependencies in the above graph, but for each of the 10 &lt;em&gt;I directly brought in to my application&lt;&#x2F;em&gt; I looked at the author to see if I knew of them, looked at their project setup, and decided their goals align with mine which led me to using the crate. I&#x27;ve passed on crates that to me looked like someone not necessarily intending for others to use their work, or simply did not pass my vibe check.&lt;&#x2F;p&gt;
&lt;p&gt;Here is what my personal flow looks like:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Do a search for the topic I&#x27;m interested in&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;convert_to_hex_search.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;convert_to_hex_search.png&quot; alt=&quot;Kagi serach for &amp;quot;convert to hex rust&amp;quot;&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Check the crates.io page&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;hex_crates_io.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;hex_crates_io.png&quot; alt=&quot;crates.io page for the &amp;quot;hex&amp;quot; crate&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;✅ The crate has good examples and information. I don&#x27;t recognize the author, but that&#x27;s not terribly uncommon.&lt;&#x2F;p&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Check the crate&#x27;s stats to get an idea of how widely used it is&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;hex_stats.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;hex_stats.png&quot; alt=&quot;&amp;quot;hex&amp;quot; crate usage stats&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;✅ Tons of usage. These numbers can be gamed, but probably not to this level.&lt;&#x2F;p&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Check the versions.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;hex_versions.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;hex_versions.png&quot; alt=&quot;hex crate versions showing 9 versions, last one was 3 years ago&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;✅ 9 versions since its original release 8 years ago. The last release was 3 years ago. The author isn&#x27;t changing stuff all the time which is good as I don&#x27;t expect a hex crate to have heavy code churn.&lt;&#x2F;p&gt;
&lt;ol start=&quot;5&quot;&gt;
&lt;li&gt;Check who is using this crate to see if I recognize any of them&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;hex_dependents.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;hex_dependents.png&quot; alt=&quot;dependents for the hex crate&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;✅ The hex crate has over 4,000 other crates depending on it and I recognize all of the top 5 biggest users.&lt;&#x2F;p&gt;
&lt;ol start=&quot;6&quot;&gt;
&lt;li&gt;Check the repo&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;a href=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;hex_repo.png&quot;&gt;&lt;img src=&quot;&#x2F;img&#x2F;dependency-usage-in-rust&#x2F;hex_repo.png&quot; alt=&quot;hex crate repo&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;✅ This is not a great example but the hex crate has some stars, the active development about matches the crates.io page (keep in mind the repository doesn&#x27;t have to match what&#x27;s uploaded to crates.io!), and the project looks decently put together. There&#x27;s also no build.rs script that I need to check out.&lt;&#x2F;p&gt;
&lt;p&gt;The crate passes all of my standard checks! I feel comfortable pulling the crate into my repository&lt;&#x2F;p&gt;
&lt;h3 id=&quot;economic-factors&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#economic-factors&quot; aria-label=&quot;Anchor link for: economic-factors&quot;
    &gt;#&lt;&#x2F;a
&gt;
Economic factors&lt;&#x2F;h3&gt;
&lt;p&gt;Something John mentions multiple times is weighing &quot;economic factors&quot; when considering what language or dependencies to use.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Avoid unnecessary dependencies. I will leave ‘unnecessary’ vaguely defined here; you need to be educated and judge all the economic factors. But note that, there are often other benefits to fewer dependencies, from shorter build times to less surface to test, to less risk from API changes or bugs from downstream dependencies.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Are all of these 10 crates I used above strictly necessarily? No. I could get away with writing my own hex converter, human-readable size converter, command-line argument parser, drop mmap support, drop support for chrono date&#x2F;time, and rewrite to use standard &lt;code&gt;Result&amp;lt;T, E&amp;gt;&lt;&#x2F;code&gt; instead of using &lt;code&gt;anyhow&lt;&#x2F;code&gt;. This is what such a &lt;code&gt;Cargo.toml&lt;&#x2F;code&gt; would look like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;dependencies&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Data serialization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;serde&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = {&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Reading the input file&amp;#39;s filesystem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stfs&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = {&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;0.1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;,&lt;&#x2F;span&gt;&lt;span&gt; path&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;..&#x2F;stfs&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Also for reading the input file&amp;#39;s filesystem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;xcontent&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = {&lt;&#x2F;span&gt;&lt;span&gt; path&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;..&#x2F;xcontent&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Serializing data to JSON&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;serde_json&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;But you know what I get from splurging on 6 extra deps?&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;I can just write my fucking code&lt;&#x2F;strong&gt;. That&#x27;s the biggest economic factor I care about.&lt;&#x2F;p&gt;
&lt;p&gt;I don&#x27;t have to worry about making my argument parser print out help and keeping its flags and info up-to-date and manually pretty. I don&#x27;t have to leave the user with a shitty &lt;code&gt;DateTime&lt;&#x2F;code&gt; field because I can&#x27;t write a good one for them since my app doesn&#x27;t revolve around dates. I don&#x27;t have to write boilerplate for bubbling up errors. &lt;strong&gt;The overall quality of the application and my dev experience is improved.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;hex&lt;&#x2F;code&gt; and &lt;code&gt;humansize&lt;&#x2F;code&gt; are arguably my application&#x27;s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Npm_left-pad_incident&quot;&gt;&lt;code&gt;left-pad&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;. Converting to&#x2F;from hex is not terribly complex and converting a number of bytes to the best unit of KB&#x2F;MB&#x2F;GB is extremely easy. In fact, I&#x27;m pretty sure I originally wrote it for this project and then removed it. These dependencies do one task that&#x27;s simple enough for me to write but I didn&#x27;t.&lt;&#x2F;p&gt;
&lt;p&gt;Why? Because each handles some edge cases that may matter for me, and I&#x27;m not wanting to spend 30m of my time writing something that&#x27;s not core to my application when someone already wrote the code and did it better than I would in those 30m. Instead I took 3 minutes to search around to find the crate, ensure it fit my needs and to sanity check it looked kinda legit, and then used it in my application.&lt;&#x2F;p&gt;
&lt;p&gt;I got. Shit. Done.&lt;&#x2F;p&gt;
&lt;p&gt;I will say that there have been times where I&#x27;ve compiled something and thought, &quot;Holy shit 500+ dependencies?&quot; But to me this isn&#x27;t a signal of it&#x27;s security but rather &lt;em&gt;bloat&lt;&#x2F;em&gt; and &lt;em&gt;complexity&lt;&#x2F;em&gt;. I have to think about everything the application does, its complexity, and consider if it&#x27;s just bloated for no reason or if there is good reason for having so many dependencies. This can impact my judgement on the application&#x27;s &lt;em&gt;quality&lt;&#x2F;em&gt; and how likely I am to use really use the tool.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;x.com&#x2F;Lucretiel&#x2F;status&#x2F;1791916569951375591&quot;&gt;@Lucretiel said something else recently on Twitter&lt;&#x2F;a&gt; said something that loosely fits into this topic:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;It’s a good thing we’re keeping our dependency count low, I think to myself, as I read about how my UI framework also provides threads, networking utilities, data structures, floating point math, D-Bus, cryptographic utilities, geographic utilities, and a Bluetooth implementation&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Bloat is everywhere. You just need to know how to look for it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;circle-of-trust&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#circle-of-trust&quot; aria-label=&quot;Anchor link for: circle-of-trust&quot;
    &gt;#&lt;&#x2F;a
&gt;
Circle of trust&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;Anyway, the more dependencies you have, the larger your circle of implicit trust is, the larger your attack surface is, and the more supply chain risk you’re taking.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;I&#x27;d rather assume an author of a crate that looks like it provides what I need has non-malicious intent than the other way around. Maybe that perspective will change if I ever get burned and my laptop gets ransomwared because I missed a &lt;code&gt;build.rs&lt;&#x2F;code&gt; file or a proc macro that does sketchy things.&lt;&#x2F;p&gt;
&lt;p&gt;But consider for a second: do you consider your OS as part of your circle of trust? It&#x27;s unlikely you&#x27;ll ever get backdoored by your OS, but bugs are certainly present and depending on your threat model a vulnerable OS means a problem for you.&lt;&#x2F;p&gt;
&lt;p&gt;Do you know how much attack surface there is with say image parsing on iOS&#x2F;macOS?&lt;&#x2F;p&gt;
&lt;p&gt;You can choose to not bring in libjpeg&#x2F;libpng&#x2F;libwebp and just use ImageIO (which is used by UIKit&#x2F;CoreGraphics). Easy! Except you now have at least 30 different image formats on your attack surface that you didn&#x27;t know about. And there&#x27;s no way to turn them off. And now you&#x27;re stuck ensuring that the image you&#x27;re parsing is a trusted image format.&lt;&#x2F;p&gt;
&lt;p&gt;You might be screaming, &quot;But Apple is trusted! And Apple publishes updates!&quot;&lt;&#x2F;p&gt;
&lt;p&gt;Ok? Did you validate how many of those updates are backported to major iOS versions used by your users? Did you audit Apple&#x27;s closed-source lib and discover this attack surface and then weigh the economic costs of not using it? I mean, ImageIO is mostly just a wrapper around libjpeg and libpng, so why not just use them directly?&lt;&#x2F;p&gt;
&lt;p&gt;Likely answer: &lt;em&gt;Because it&#x27;s convenient and you might not care about the problems I am describing because you aren&#x27;t some security nerd.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;closing-thoughts&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#closing-thoughts&quot; aria-label=&quot;Anchor link for: closing-thoughts&quot;
    &gt;#&lt;&#x2F;a
&gt;
Closing thoughts&lt;&#x2F;h2&gt;
&lt;p&gt;I would like to thank John for sharing his thoughts and perspective. I do outright agree with some his points:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Avoiding unnecessary dependencies may be better long-term for better compile times and less potential problems down the road. This is a tradeoff worth considering, but to me is a minor point.&lt;&#x2F;li&gt;
&lt;li&gt;The bigger your dependency graph, the bigger your single-points of failure. I see this as a tradeoff for rapid development.&lt;&#x2F;li&gt;
&lt;li&gt;Understand what makes sense for your team and your own threat model.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;But I disagree with some of the foundational arguments like:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;C’s advantage in terms of lack of dependencies (which can come with a lower attack surface in general) is large, but still doesn’t make it the right economic choice in the first place. It might still be wiser to choose Rust when all economic factors are considered, but the security argument is just not one I find compelling enough.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The security risk of dependency use is simply not one I find compelling enough to select C over Rust, and certainly is not scarier than a buffer overflow. C lacking first-class support for dependencies should be considered a strong disadvantage since you can&#x27;t even get good support for 1st-party dependencies.&lt;&#x2F;p&gt;
&lt;p&gt;The benefits Rust provides &lt;em&gt;as a language&lt;&#x2F;em&gt; are already enough for a lot of people to select it over C -- myself included. A stellar default package manager and build tool makes it all the better to use. In my opinion &quot;dependency usage&quot; should be a minor footnote (and John explicitly says to weigh these kinds of factors yourself).&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, I&#x27;d argue that a critical mem safety issue is statistically way more likely to happen and can have critical impact even with modern mitigations. Some of the memory safety bugs that we&#x27;re finding are old enough to drink in the US, showing that they can be very difficult to find. The &lt;code&gt;xz&lt;&#x2F;code&gt; backdoor required around 3 years worth of effort to attempt to sneak into the application and was discovered in less than a week after it went live.&lt;&#x2F;p&gt;
&lt;p&gt;Don&#x27;t live in fear of dependencies. Do what provides the least friction for you to accomplish the engineering you enjoy doing within your personal or team parameters.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Deobfuscating World of Warships&#x27; Python Scripts</title>
        <published>2023-11-08T00:00:00+00:00</published>
        <updated>2023-11-08T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://landaire.net/world-of-warships-deobfuscation/"/>
        <id>https://landaire.net/world-of-warships-deobfuscation/</id>
        
        <content type="html" xml:base="https://landaire.net/world-of-warships-deobfuscation/">&lt;h2 id=&quot;background&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#background&quot; aria-label=&quot;Anchor link for: background&quot;
    &gt;#&lt;&#x2F;a
&gt;
Background&lt;&#x2F;h2&gt;
&lt;p&gt;This blog post is something I&#x27;m writing 3 years after my initial research&#x2F;development, and about 2 years after I stopped actively working on the tool. Some of the details in this blog may not be fully accurate from time slippage and a lot of the initial research notes I made were lost or scattered in Discord conversations.&lt;&#x2F;p&gt;
&lt;p&gt;I am only now writing this as the game is somewhat dead and the development team chooses to continually release content that makes gameplay worse. Submarines, hybrid battleships, aircraft carriers, and HE-spamming battleships with cruiser concealment that overmatch everything have led to a less enjoyable gameplay experience.&lt;&#x2F;p&gt;
&lt;p&gt;The tool and techniques have been kept to a very tight circle so that data mining could continue without a potential cat-and-mouse game with the developer. I apologize to that community if that does occur.&lt;&#x2F;p&gt;
&lt;p&gt;Two years ago I open-sourced a tool I called &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;unfuck&quot;&gt;&lt;code&gt;unfuck&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; which I described as a &quot;Python 2.7 bytecode &lt;del&gt;deobfuscator&lt;&#x2F;del&gt; unfucker&quot;. That tool was the result of the work I had done for World of Warships, but isn&#x27;t capable of completely deobfuscating World of Warships files out-of-the-box. &lt;code&gt;unfuck&lt;&#x2F;code&gt; &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=28163546&quot;&gt;made the rounds on HN&lt;&#x2F;a&gt; where I got supportive responses such as:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Look, I get that edgy names are fun, but I&#x27;m happy that I will never have to use this tool for work, and I pity the fool who has to explain why &quot;unfuck&quot; was needed to solve a real problem.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;And:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Ooof, really bad name. Makes me think the project or maintainer are immature...&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;And someone respecting my licensing choices:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Interesting dual licensing&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;This project is dual-licensed under MIT and the ABSE (&quot;Anyone But Stefan Esser&quot;) license. Note that an additional exception to the license is added, forbidding use&#x2F;redistribution of said content to his trainees as well, but only when in a 5 mile radius from &quot;Stefan Esser&quot; or while holding any sort of (video)conference&#x2F;chat with him.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Note that this license will only be used as long as what would capstone decode &#x2F; that one other arm64 ida plugin thing by i0n1c (&quot;Stefan Esser&quot;) are not under the MIT license. afterwards, all exceptions are cleared and basically MIT license applies&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;what-is-world-of-warships&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-is-world-of-warships&quot; aria-label=&quot;Anchor link for: what-is-world-of-warships&quot;
    &gt;#&lt;&#x2F;a
&gt;
What is World of Warships?&lt;&#x2F;h2&gt;
&lt;p&gt;World of Warships (WoWs) is a free-to-play naval warfare multiplayer game released in 2015 by Wargaming and their Lesta Studio. It supports &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20230728140319&#x2F;https:&#x2F;&#x2F;forum.worldofwarships.com&#x2F;topic&#x2F;174161-modapi-documentation&#x2F;&quot;&gt;multiple forms of modifications&lt;&#x2F;a&gt; via Adobe Flash for UI mods, XML&#x2F;audio files for audio mods, custom ship textures, and Python for basically everything else. The Python APIs are somewhat limited, but can observe some in-game events that allow mod developers to surface information that the game doesn&#x27;t show you by default.&lt;&#x2F;p&gt;
&lt;p&gt;Unlike a lot of multiplayer games, WoWs uses an authoritative server model where each client is only receiving events that the server believes they &lt;em&gt;should&lt;&#x2F;em&gt; receive. For example, enemy ship locations and related information is only pushed down to clients when they are intended to be painted to your screen. There are no wall hacks and things like auto-aim are somewhat negated by player skill. That doesn&#x27;t mean there aren&#x27;t &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;v.youku.com&#x2F;v_show&#x2F;id_XNTgxNzIzNjAwNA==.html&quot;&gt;illegal mods&#x2F;cheats&lt;&#x2F;a&gt; that show you where to aim, where incoming artillery shells will land, etc.&lt;&#x2F;p&gt;
&lt;p&gt;With all of that said, there is very little incentive to cheat in this game. A top-tier player in World of Warships will have the game sense and skill that comes within a close margin to someone playing with cheats. Therefore deobfuscation of scripts doesn&#x27;t necessarily help with cheat development apart from illegal mods, but may help modders create better mods in general.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;game-scripts&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#game-scripts&quot; aria-label=&quot;Anchor link for: game-scripts&quot;
    &gt;#&lt;&#x2F;a
&gt;
Game Scripts&lt;&#x2F;h2&gt;
&lt;p&gt;Although the World of Warships developers are mostly transparent about how game mechanics work, there have still been some mysteries. For example, the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;WorldOfWarships&#x2F;comments&#x2F;l1dpzt&#x2F;reverse_engineered_dispersion_ellipse_including&#x2F;&quot;&gt;algorithm for how the dispersion ellipse of your shells is calculated&lt;&#x2F;a&gt; and the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;WorldOfWarships&#x2F;comments&#x2F;mesoun&#x2F;reverse_engineered_how_sigma_works_with_dispersion&#x2F;&quot;&gt;dispersion of the shells themselves&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The format of match replay files is also &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Monstrofil&#x2F;replays_unpack&quot;&gt;mostly documented&lt;&#x2F;a&gt; through reverse engineering work of a few researchers and from reviewing publicly available engine source code, but there are still unknown elements to the serialized format. For these reasons it&#x27;s highly desirable to review the implementation code to unmask these mysteries.&lt;&#x2F;p&gt;
&lt;p&gt;There has been at least one other individual who managed to deobfuscate and decompile the game scripts as far back as 2016. A World of Warships EU forum member by the name of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20230802004250&#x2F;https:&#x2F;&#x2F;forum.worldofwarships.eu&#x2F;topic&#x2F;55613-understanding-wgs-armor-penetration-curves&#x2F;?page=3&quot;&gt;&quot;TehRick&quot; &#x2F; &quot;ThiSpawn&quot; made multiple posts&lt;&#x2F;a&gt; showing they had reverse engineered some of the C++ and Python logic. In fact, they explicitly called out the &quot;Lesta anti-noob protection&quot; obfuscated Python module name in one of their forum posts:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;wows-obfuscation&#x2F;tehrick_1.png&quot; alt=&quot;TehRick forum post&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.reddit.com&#x2F;user&#x2F;ThiSpawn&quot;&gt;a Reddit post&lt;&#x2F;a&gt; by the same username they also linked to a decompiled Python source file: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;pastebin.com&#x2F;y3Yk43Nd&quot;&gt;https:&#x2F;&#x2F;pastebin.com&#x2F;y3Yk43Nd&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Although TehRick seems to have disappeared soon after these posts, their code was still being referenced 4 years later!&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;If you are TehRick &#x2F; ThiSpawn feel free to reach out to me -- I would love to talk about your deobfuscator!&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;python-vm-primer&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#python-vm-primer&quot; aria-label=&quot;Anchor link for: python-vm-primer&quot;
    &gt;#&lt;&#x2F;a
&gt;
Python VM Primer&lt;&#x2F;h2&gt;
&lt;p&gt;When Python source code is executed, you may notice that a &lt;code&gt;.pyc&lt;&#x2F;code&gt; file is created. The Python interpreter doesn&#x27;t interpret raw source code -- it first compiles that source code to an intermediate representation that can be fed to the VM as instructions.&lt;&#x2F;p&gt;
&lt;p&gt;The VM is stack-based with some &quot;registers&quot; which are used for runtime storage of variables in pre-defined variable (or unnamed) slots. Almost every VM operation with the exception of loads&#x2F;stores will directly modify values on the stack in some way. Variable registers cannot be modified in-place, and must first be put directly on the stack.&lt;&#x2F;p&gt;
&lt;p&gt;Each object on the stack or in a variable slot is a deserialized Python object representing one of the following types:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;None&lt;&#x2F;li&gt;
&lt;li&gt;StopIteration&lt;&#x2F;li&gt;
&lt;li&gt;Ellipsis&lt;&#x2F;li&gt;
&lt;li&gt;Bool&lt;&#x2F;li&gt;
&lt;li&gt;Long&lt;&#x2F;li&gt;
&lt;li&gt;Float&lt;&#x2F;li&gt;
&lt;li&gt;Complex&lt;&#x2F;li&gt;
&lt;li&gt;Bytes&lt;&#x2F;li&gt;
&lt;li&gt;String&lt;&#x2F;li&gt;
&lt;li&gt;Tuple&lt;&#x2F;li&gt;
&lt;li&gt;List&lt;&#x2F;li&gt;
&lt;li&gt;Dict&lt;&#x2F;li&gt;
&lt;li&gt;Set&lt;&#x2F;li&gt;
&lt;li&gt;FrozenSet&lt;&#x2F;li&gt;
&lt;li&gt;Code&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Basically the raw primitive types you&#x27;re probably used to when writing Python. All module definitions, functions, etc. are defined as &lt;code&gt;Code&lt;&#x2F;code&gt; objects that live in the &lt;code&gt;co_consts&lt;&#x2F;code&gt; section of their parent code object. Ditto with any lists, tuples, etc. that are hard coded in source code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;instructions&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#instructions&quot; aria-label=&quot;Anchor link for: instructions&quot;
    &gt;#&lt;&#x2F;a
&gt;
Instructions&lt;&#x2F;h3&gt;
&lt;p&gt;World of Warships uses Python 2.7 which has helpful documentation covering all instructions here: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.python.org&#x2F;2&#x2F;library&#x2F;dis.html&quot;&gt;https:&#x2F;&#x2F;docs.python.org&#x2F;2&#x2F;library&#x2F;dis.html&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;All instructions are at least 1 byte for the opcode and up to 3 bytes for instructions which have a 16-bit argument. For example, a &lt;code&gt;JUMP_ABSOLUTE 300&lt;&#x2F;code&gt; may be encoded as &lt;code&gt;0x71_012c&lt;&#x2F;code&gt; and a &lt;code&gt;POP_TOP&lt;&#x2F;code&gt; may be encoded as &lt;code&gt;0x01&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The WoWs developers did not do any opcode remapping, which is a fairly common obfuscation trick when an application has the flexibility of embedding the Python VM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;prior-work-on-deobfuscation&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#prior-work-on-deobfuscation&quot; aria-label=&quot;Anchor link for: prior-work-on-deobfuscation&quot;
    &gt;#&lt;&#x2F;a
&gt;
Prior Work on Deobfuscation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;lpcvoid-s-findings&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#lpcvoid-s-findings&quot; aria-label=&quot;Anchor link for: lpcvoid-s-findings&quot;
    &gt;#&lt;&#x2F;a
&gt;
lpcvoid&#x27;s Findings&lt;&#x2F;h3&gt;
&lt;p&gt;World of Warships&#x27; core game logic is contained within a &lt;code&gt;scripts.zip&lt;&#x2F;code&gt; file that is handled by a special loader. The loader reads compiled Python (files ending in &lt;code&gt;.pyc&lt;&#x2F;code&gt;) out of this zip archive and even uses a special technique of handling the serialized Python code object.&lt;&#x2F;p&gt;
&lt;p&gt;This logic and deobfuscating the &lt;em&gt;first stage&lt;&#x2F;em&gt; of the matryoshka doll has already been described by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;lpcvoid.com&#x2F;blog&#x2F;0007_wows_python_reversing&#x2F;index.html&quot;&gt;lpcvoid on his blog&lt;&#x2F;a&gt; and he even has a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;lpcvoid.com&#x2F;blog&#x2F;0008_python_bytecode_dejunking&#x2F;index.html&quot;&gt;part 2&lt;&#x2F;a&gt; going into some of the junk instructions. I highly recommend reading his blog posts before continuing, as I will not rehash his hard work.&lt;&#x2F;p&gt;
&lt;p&gt;To summarize his findings: the module loader deserializes the bytecode object and uses the bytecode as an encryption key for some ciphertext stored in const data. After decrypting the ciphertext, the plaintext is decompressed (zlib) and is executed as a code object.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rapid-analysis-of-bytecode-using-pyasm&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#rapid-analysis-of-bytecode-using-pyasm&quot; aria-label=&quot;Anchor link for: rapid-analysis-of-bytecode-using-pyasm&quot;
    &gt;#&lt;&#x2F;a
&gt;
Rapid Analysis of Bytecode Using pyasm&lt;&#x2F;h3&gt;
&lt;p&gt;I wanted to take a quick moment to call out that my friend @gabe_k wrote a tool for a CTF challenge he put together many years ago called &lt;code&gt;pyasm&lt;&#x2F;code&gt; that is specifically designed for this type of scenario. It can gracefully handle disassembling of bad instructions, and even supports recompiling a &lt;code&gt;.pyasm&lt;&#x2F;code&gt; file back to a serialized code object. I&#x27;ve forked the project and made some quality of life improvements&#x2F;bug fixes here: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;pyasm&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;pyasm&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an example of what one of these &lt;code&gt;.pyc&lt;&#x2F;code&gt; files look like when converted to a &lt;code&gt;.pyasm&lt;&#x2F;code&gt; file (redacted since it&#x27;s very long):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	stack_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	flags&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	consts&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		none&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		string&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;Wargaming.net | Lesta Studio&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		string&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;an error occurred while loading module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		string&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;\x9a\xb6\x85&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;A.^lPGO0Z&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;\xee&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;Y3o&lt;&#x2F;span&gt;&lt;span&gt;\x11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;$,FCPCi&amp;amp;:U&lt;&#x2F;span&gt;&lt;span&gt;\x04\t\x02&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;IS&lt;&#x2F;span&gt;&lt;span&gt;\x15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;5EJ&lt;&#x2F;span&gt;&lt;span&gt;\x1a&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;\x96\x1f&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;=*&lt;&#x2F;span&gt;&lt;span&gt;\xe2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;\xa9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;\xa5\t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;\x13&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;hl&lt;&#x2F;span&gt;&lt;span&gt;\x92&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt;\x12\x14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;\x06\xc8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;o:&lt;&#x2F;span&gt;&lt;span&gt;\x08\x16\xd4\xfd\xd0\x8c\xc1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;\xa0\x9b\xe5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;b&lt;&#x2F;span&gt;&lt;span&gt;\xc3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;\x0e&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;D&lt;&#x2F;span&gt;&lt;span&gt;\x8e\x85\xfb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;\x83\x9b\xff&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;\r&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;\r&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;uk&lt;&#x2F;span&gt;&lt;span&gt;\x14\xf2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;\xd7\x86\t\x13\x0b&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;k&lt;&#x2F;span&gt;&lt;span&gt;\x83&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;HL&lt;&#x2F;span&gt;&lt;span&gt;\t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;\xbf\x07&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;6IM&lt;&#x2F;span&gt;&lt;span&gt;\xa1\x0b&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;TP&lt;&#x2F;span&gt;&lt;span&gt;\xdc\xc7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;\n\x08\x8c\xdd\x05\&amp;#39;\x19\xf0\xa2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;FL&lt;&#x2F;span&gt;&lt;span&gt;\t\xbb\xd7\x15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;\xd8\xc3\xba&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;\x19\x0f&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;k&lt;&#x2F;span&gt;&lt;span&gt;\xd9\xe4\xf0\xbf\x9c&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;\n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;TJP&lt;&#x2F;span&gt;&lt;span&gt;\xc1\xcc\x17\xce\x04\x18\xfe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;98&lt;&#x2F;span&gt;&lt;span&gt;\x0e\x1d\x86\xdc\xab\x19\xe6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;)M,&lt;&#x2F;span&gt;&lt;span&gt;\x0e\xd4\xd8\xd4\x02\xb1\x0b&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;(&amp;amp;;(o_&lt;&#x2F;span&gt;&lt;span&gt;\x1c\x1b\x16\xd8\xe1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;!-&lt;&#x2F;span&gt;&lt;span&gt;\xad&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;\xda&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;\xd0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;\xa2\x1a\x08&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;*7&lt;&#x2F;span&gt;&lt;span&gt;\xc7\x9d\x10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;\x0f\xe4\xcc\x1c\x0c&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;)...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	names&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		string&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;locals&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	instructions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;		&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;255&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 65532&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		UNARY_INVERT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		SETUP_EXCEPT&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 15&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; # Wargaming.net | Lesta Studio&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		LOAD_NAME&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; # locals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		CALL_FUNCTION&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		DUP_TOP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		EXEC_STMT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		POP_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		JUMP_FORWARD&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;		3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; POP_TOP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; # an error occurred while loading module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		PRINT_ITEM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		PRINT_NEWLINE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		JUMP_FORWARD&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		END_FINALLY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; # None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		RETURN_VALUE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		DELETE_NAME&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 23519&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		UNARY_NOT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		DELETE_NAME&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 23438&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;		&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;216&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 64603&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		INPLACE_OR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		UNARY_NOT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		DELETE_NAME&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 23308&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Throughout my analysis of the obfuscation tricks I frequently leaned on pyasm for manually reordering&#x2F;deleting instructions in order to figure out which sections were causing hiccups for the decompiler.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;wows-generic-obfuscation-tricks&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#wows-generic-obfuscation-tricks&quot; aria-label=&quot;Anchor link for: wows-generic-obfuscation-tricks&quot;
    &gt;#&lt;&#x2F;a
&gt;
WoWs - Generic Obfuscation Tricks&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;1-bogus-instructions&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#1-bogus-instructions&quot; aria-label=&quot;Anchor link for: 1-bogus-instructions&quot;
    &gt;#&lt;&#x2F;a
&gt;
1: Bogus Instructions&lt;&#x2F;h3&gt;
&lt;p&gt;After decrypting and decompressing the 2nd stage code object, you&#x27;ll find that tools like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;uncompyle6&#x2F;&quot;&gt;uncompyle6&lt;&#x2F;a&gt; fail to decompile the bytecode to source with an error. In his 2nd blog post lpcvoid covered one of Lesta&#x27;s tricks of inserting bogus instructions that contain completely invalid opcodes which confuse these types of tools. One thing not mentioned is that these instructions can also be valid but really mess up the VM&#x27;s stack and cause static analysis to enter a bad state.&lt;&#x2F;p&gt;
&lt;p&gt;Unfortunately, tools like uncompyle are mostly intended to run on Python bytecode generated cleanly by a Python VM. Invalid opcodes are definitely not supported, and neither are invalid instruction operands. This trick is the most straightforward for causing a decompiler to choke.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2-stack-reordering&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#2-stack-reordering&quot; aria-label=&quot;Anchor link for: 2-stack-reordering&quot;
    &gt;#&lt;&#x2F;a
&gt;
2: Stack Reordering&lt;&#x2F;h3&gt;
&lt;p&gt;Different Python code patterns -- even if semantically the same -- have very slight nuance in the emitted instructions. Tools like uncompyle in some cases rely on fragile instruction patterns for mapping to source code and will easily encounter errors when a wonky pattern is encountered.&lt;&#x2F;p&gt;
&lt;p&gt;The following is a completely made-up example, but consider the following instruction sequence:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              224  LOAD_CONST            0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              227  MAKE_FUNCTION_0       0  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; L. 351       230  STORE_FAST            6  &amp;#39;f333&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This loads some code object from the const section, makes a function, and stores that function in &lt;code&gt;co_varnames[6]&lt;&#x2F;code&gt;. This would typically result in something like the following Python code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; f333&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;():&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now imagine that the instructions were rewritten to push and immediately pop a value to the stack randomly in the middle of creating the function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              224  LOAD_CONST            0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              227  MAKE_FUNCTION_0       0  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ...  LOAD_CONST            None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ...  POP_TOP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; L. 351       230  STORE_FAST            6  &amp;#39;f333&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;LOAD_CONST&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;MAKE_FUNCTION&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;STORE_FAST&lt;&#x2F;code&gt; pattern is broken by instructions that are effectively a no-op, and the signatures used by the decompilers are now broken.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-const-predicates&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#3-const-predicates&quot; aria-label=&quot;Anchor link for: 3-const-predicates&quot;
    &gt;#&lt;&#x2F;a
&gt;
3: Const Predicates&lt;&#x2F;h3&gt;
&lt;p&gt;Related to trick #2, instruction patterns may be broken by inserting conditions that evaluate to a constant value. One side of the branch may bring you to some garbage instructions (trick #1) and on the other side of the branch will be the next set of valid code to be executed.&lt;&#x2F;p&gt;
&lt;p&gt;Consider the following pseudocode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              224&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              227&lt;&#x2F;span&gt;&lt;span&gt;  MAKE_FUNCTION_0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;              if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;({&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;} &amp;amp; {&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}) &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; L&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; 351&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       230&lt;&#x2F;span&gt;&lt;span&gt;  STORE_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;f333&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;              else&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ...  POP_TOP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ...  POP_TOP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ...  POP_TOP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ...  RETURN_VALUE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the middle of defining a function we&#x27;ve inserted a check to see if two sets overlap, and if so we store the function in variable slot #6 (&lt;code&gt;STORE_FAST 6&lt;&#x2F;code&gt;). If the sets do not overlap, we go down the bogus code path that screws up stack state.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;4-variable-renaming&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#4-variable-renaming&quot; aria-label=&quot;Anchor link for: 4-variable-renaming&quot;
    &gt;#&lt;&#x2F;a
&gt;
4: Variable Renaming&lt;&#x2F;h3&gt;
&lt;p&gt;This one really doesn&#x27;t impact tools but definitely impacts any end user who manages to partially decompile anything: local variables and function names (in the serialized function object) are renamed to things that are illegal in Python source code such as keywords, operators, and a combination of these things with spaces. Function objects are typically renamed to be very large unique numbers. Here is a real example from when I first set on this project:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; f333&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;impf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; f222&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                continue&lt;&#x2F;span&gt;&lt;span&gt; r ; &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ] &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 87&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span&gt; } &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 538&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                l&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; else try&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 199&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                continue&lt;&#x2F;span&gt;&lt;span&gt; r ; &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ] &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 538&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span&gt; } &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 199&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; not&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; continue&lt;&#x2F;span&gt;&lt;span&gt; r ; &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ] &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; assert&lt;&#x2F;span&gt;&lt;span&gt; } &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ] &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; else try&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                    *&lt;&#x2F;span&gt;&lt;span&gt; k&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; try&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 113&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                *&lt;&#x2F;span&gt;&lt;span&gt; k&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; try&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;                2&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                v&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; lambda&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 433&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;                6&lt;&#x2F;span&gt;&lt;span&gt; p&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 147&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                *&lt;&#x2F;span&gt;&lt;span&gt; k&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; try&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 113&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;                2&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 433&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                v&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; lambda&lt;&#x2F;span&gt;&lt;span&gt; n &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;= 147&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; not *&lt;&#x2F;span&gt;&lt;span&gt; k&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; try&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; lambda&lt;&#x2F;span&gt;&lt;span&gt; n - 2 c + 6 &lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;                    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                (&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; in, % &#x2F;&lt;&#x2F;span&gt;&lt;span&gt;= p&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; { +,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; [, +&lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; r) = &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;5-implicit-returns&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#5-implicit-returns&quot; aria-label=&quot;Anchor link for: 5-implicit-returns&quot;
    &gt;#&lt;&#x2F;a
&gt;
5: Implicit Returns&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;RETURN_VALUE&lt;&#x2F;code&gt; instruction in Python returns the value located at the top of the VM&#x27;s stack. Python will, as far as I&#x27;m aware, always emit a &lt;code&gt;RETURN_VALUE&lt;&#x2F;code&gt; with the immediately preceding instruction setting up the value to be returned. For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LOAD_FAST 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RETURN_VALUE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This loads the value stored at &lt;code&gt;co_varnames[0]&lt;&#x2F;code&gt; to the top of stack and returns it. Splitting up these instructions will break the pattern decompilers use to transform this into &lt;code&gt;return varname&lt;&#x2F;code&gt;. Imagine if the in the following code &lt;code&gt;tos&lt;&#x2F;code&gt; literally represented the top of the stack (and not a variable slot):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; condition&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; get_return_value&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;else&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; other_return_value&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This would create the following control flow:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;wows-obfuscation&#x2F;implicit_return.svg&quot; alt=&quot;Implicit return control flow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In this scenario the instruction immediately preceding the &lt;code&gt;RETURN_VALUE&lt;&#x2F;code&gt; isn&#x27;t the instruction setting up the value -- it&#x27;s likely some type of &lt;code&gt;JUMP&lt;&#x2F;code&gt; instruction or quite possibly anything else!&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s not clear to me if this is more of a code optimization trick, or an obfuscation trick, but really what&#x27;s the difference?&lt;&#x2F;p&gt;
&lt;h3 id=&quot;6-weird-jumps&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#6-weird-jumps&quot; aria-label=&quot;Anchor link for: 6-weird-jumps&quot;
    &gt;#&lt;&#x2F;a
&gt;
6: Weird Jumps&lt;&#x2F;h3&gt;
&lt;p&gt;Something else I noticed was that some jumps were just... weird? There were randomish-looking &lt;code&gt;JUMP_FORWARD N&lt;&#x2F;code&gt; instructions that didn&#x27;t make sense (but usually were just jumping over garbage instructions), and were hard to disambiguate from those legitimately generated by the Python compiler. For example, the following Python code may insert a &lt;code&gt;JUMP_FORWARD 0&lt;&#x2F;code&gt; (jump to the next instruction):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; !foo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; # POP_JUMP_IF_FALSE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    # EMIT THIS CODE FIRST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; foo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;target&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;else&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# AFTER THE ABOVE BLOCK IS EMITTED, INSERT JUMP_FORWARD 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;else&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    # EMIT BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;main target&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This probably doesn&#x27;t make much sense, so let me show a real example of the control flow at an instruction level:&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;wows-obfuscation&amp;#x2F;unnecessary_jump.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;unnecessary_jump.390a96f8be78f4f2.png&quot;
        alt=&quot;&quot;
        width=&quot;455&quot;
        height=&quot;500&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;Do you notice the &lt;code&gt;JUMP_FORWARD 0&lt;&#x2F;code&gt; in the left-center node? It&#x27;s completely unnecessary! The layout of these instructions when serialized is: &lt;code&gt;POP_TOP&lt;&#x2F;code&gt;, &lt;code&gt;POP_TOP&lt;&#x2F;code&gt;, &lt;code&gt;POP_TOP&lt;&#x2F;code&gt;, &lt;code&gt;JUMP_FORWARD 0&lt;&#x2F;code&gt;, &lt;code&gt;LOAD_FAST 2&lt;&#x2F;code&gt;. The execution sequence of these instructions is exactly the same as well. You could remove the &lt;code&gt;JUMP_FORWARD 0&lt;&#x2F;code&gt; and nothing of value would be lost. So why is it there?&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s just a side effect of how the Python compiler does codegen:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; visitIf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;font-style: italic;&quot;&gt;self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; node&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    end&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;newBlock&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    numtests&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;node&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;tests&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; range&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;numtests&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; suite&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;tests&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; is_constant_false&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; XXX&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; will need to check generator stuff here&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            continue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;set_lineno&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;visit&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        nextTest&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;newBlock&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;emit&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;POP_JUMP_IF_FALSE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; nextTest&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;nextBlock&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;visit&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;suite&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;emit&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;JUMP_FORWARD&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; end&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; # &amp;lt;--- UNCONDITIONALLY ADD `JUMP_FORWARD`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;startBlock&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;nextTest&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;else_&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;visit&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;node&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;else_&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;nextBlock&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;end&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Sometimes that &lt;code&gt;JUMP_FORWARD&lt;&#x2F;code&gt; isn&#x27;t jumping 0 bytes and may be some value that jumps over garbage instructions (and was inserted by the obfuscator). Other times this &lt;code&gt;JUMP_FORWARD&lt;&#x2F;code&gt; comes immediately after some other unconditional control flow instruction and will never be executed by a Python VM (or picked up by my instruction decoder).&lt;&#x2F;p&gt;
&lt;p&gt;So why can&#x27;t it be removed if it&#x27;s usually unnecessary? Unfortunately uncompyle relies on the presence of the &lt;code&gt;JUMP_FORWARD&lt;&#x2F;code&gt; to determine what type of condition has occurred.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;7-generally-weird-control-flow&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#7-generally-weird-control-flow&quot; aria-label=&quot;Anchor link for: 7-generally-weird-control-flow&quot;
    &gt;#&lt;&#x2F;a
&gt;
7: Generally Weird Control Flow&lt;&#x2F;h3&gt;
&lt;p&gt;This one is hard to express without sounding psychotic, but let me just say: &lt;strong&gt;fuck loops, fuck exception handlers&lt;&#x2F;strong&gt;. If you combine the weird jumps and false predicates in loops, you may be able to generate some code that looks like a loop but is only ever executed for one iteration before just jumping to some other part of the code because of a const predicate.&lt;&#x2F;p&gt;
&lt;p&gt;And what about exception handlers that intentionally raise an exception that&#x27;s supposed to be caught to trigger the &quot;good&quot; code path?&lt;&#x2F;p&gt;
&lt;p&gt;And what about nesting exceptions inside of loops with const predicates?&lt;&#x2F;p&gt;
&lt;p&gt;After encountering such a scenario I was starting to feel like this:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;wows-obfuscation&#x2F;charlie.jpg&quot; alt=&quot;Meme of Charlie&amp;#39;s conspiracy theory board from It&amp;#39;s Always Sunny in Philadelphia&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;deobfuscation&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#deobfuscation&quot; aria-label=&quot;Anchor link for: deobfuscation&quot;
    &gt;#&lt;&#x2F;a
&gt;
Deobfuscation&lt;&#x2F;h2&gt;
&lt;p&gt;Deobfuscating everything together requires a solid framework that can achieve:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Parsing all instructions in a manner that doesn&#x27;t break on bogus opcodes&lt;&#x2F;li&gt;
&lt;li&gt;Evaluating conditions to determine used&#x2F;unused code&lt;&#x2F;li&gt;
&lt;li&gt;Restoring instruction ordering&lt;&#x2F;li&gt;
&lt;li&gt;Restoring variable names&lt;&#x2F;li&gt;
&lt;li&gt;Deoptimizing code (implicit returns)&lt;&#x2F;li&gt;
&lt;li&gt;Normalize weird control flow&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;...so yeah the natural path I took here was to rebuild the Python VM in Rust in 2 months and write somewhat spaghetti code that revisiting two years later has me thinking &quot;wtf was I smoking?&quot;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;avoiding-bad-instructions&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#avoiding-bad-instructions&quot; aria-label=&quot;Anchor link for: avoiding-bad-instructions&quot;
    &gt;#&lt;&#x2F;a
&gt;
Avoiding Bad Instructions&lt;&#x2F;h3&gt;
&lt;p&gt;Parsing instructions is fairly straightforward: an instruction with no arguments is 1 byte (opcode), and an instruction with an argument is 3 bytes (opcode + uint16). You start parsing instructions by reading from offset 0 in the &lt;code&gt;co_code&lt;&#x2F;code&gt; section of the code object and just continue this in a loop.&lt;&#x2F;p&gt;
&lt;p&gt;Decompilers and disassemblers tend to read instructions &lt;strong&gt;linearly&lt;&#x2F;strong&gt; -- i.e. if the first instruction is &lt;code&gt;JUMP_ABSOLUTE 200&lt;&#x2F;code&gt; it&#x27;s going to disassemble &lt;code&gt;JUMP_ABSOLUTE 200&lt;&#x2F;code&gt; from offset 0, then disassemble the next instruction from offset 3. This isn&#x27;t great because you will run into a bunch of bogus instructions that can be avoided by simply creating a decoder that understands control flow.&lt;&#x2F;p&gt;
&lt;p&gt;To mitigate this in my deobfuscator I instead add instruction offsets to a queue. A &lt;code&gt;JUMP_ABSOLUTE 200&lt;&#x2F;code&gt; will add offset 200 as next in the queue, and a &lt;code&gt;JUMP_IF_{TRUE,FALSE} &amp;lt;TARGET&amp;gt;&lt;&#x2F;code&gt; will add the offset for the target &lt;strong&gt;and&lt;&#x2F;strong&gt; the next instruction to the queue.&lt;&#x2F;p&gt;
&lt;p&gt;Along the way I also compile an instruction graph where each node represents a basic block with edges to other basic blocks:&lt;&#x2F;p&gt;

&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;wows-obfuscation&amp;#x2F;stage2_obfuscated.svg&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;wows-obfuscation&amp;#x2F;stage2_obfuscated.svg&quot;
        width=&quot;500&quot;
        height=&quot;500&quot;
        alt=&quot;&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;h3 id=&quot;removing-const-predicates&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#removing-const-predicates&quot; aria-label=&quot;Anchor link for: removing-const-predicates&quot;
    &gt;#&lt;&#x2F;a
&gt;
Removing const predicates&lt;&#x2F;h3&gt;
&lt;p&gt;Remember how I said I rebuilt the Python VM in Rust? &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;unfuck&#x2F;blob&#x2F;de4c631aa725ff8da5aed8e718117b607c009c3d&#x2F;src&#x2F;smallvm.rs#L130&quot;&gt;I was serious, and it was &lt;em&gt;just&lt;&#x2F;em&gt; to solve this problem.&lt;&#x2F;a&gt; I do what I&#x27;ve called &quot;partial execution&quot;. Certain builtin functions are handled, and an individual code object&#x27;s opcodes are executed to obtain a snapshot of the VM&#x27;s stack and perform taint tracking. The main function signature is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F; Executes an instruction, altering the input state and returning an error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F; when the instruction cannot be correctly emulated. For example, some complex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F;&#x2F; instructions are not currently supported at this time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;pub fn&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; execute_instruction&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;O&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Opcode&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Mnemonic&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; py27&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Mnemonic&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; F&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; T&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    instr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Instruction&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;O&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    code&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Arc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Code&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    stack&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; VmStack&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;T&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    vars&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; VmVars&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;T&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    names&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; VmNames&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;T&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    globals&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;: &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;mut&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; VmNames&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;T&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    names_loaded&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; LoadedNames&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    mut&lt;&#x2F;span&gt;&lt;span&gt; function_callback&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; F&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_tracking&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; T&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) -&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;(),&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;O&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&amp;gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Brief rundown of all inputs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;instr&lt;&#x2F;code&gt;: the instruction to be executed&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;code&lt;&#x2F;code&gt;: the deserialized Python code object for which the instruction belongs to&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;stack&lt;&#x2F;code&gt;: current snapshot of the VM stack&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;vars&lt;&#x2F;code&gt;: all variable slots and their current values&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;names&lt;&#x2F;code&gt;: map to a &lt;code&gt;vars&lt;&#x2F;code&gt; slot&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;globals&lt;&#x2F;code&gt;: similar to &lt;code&gt;vars&lt;&#x2F;code&gt; but on a global level&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;names_loaded&lt;&#x2F;code&gt;: modules imported&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;function_callback&lt;&#x2F;code&gt;: callback for &lt;code&gt;CALL_FUNCTION&lt;&#x2F;code&gt; instruction and can be used for handling builtins or calling other code objects if desired&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;access_tracking&lt;&#x2F;code&gt;: data to associate with a VM stack value&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When an instruction is executed and the stack is modified, the modified stack value will represent a tuple of &lt;code&gt;(Option&amp;lt;value&amp;gt;, [access_tracking])&lt;&#x2F;code&gt;. The first value in the tuple is the value that resulted from executing an instruction if it could be determined, otherwise &lt;code&gt;None&lt;&#x2F;code&gt;. The second value will represent some metadata for looking up instructions which contributed to generating&#x2F;modifying that stack value (a basic block index + instruction index).&lt;&#x2F;p&gt;
&lt;p&gt;The execution loop for a basic block looks something like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; instruction&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; basic_block&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; instruction&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;is_conditional_jump&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;():&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; tos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;].&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;is_some&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;():&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            # Determine the truthiness of top-of-stack.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            # Based off of the opcode (JUMP_IF_{TRUE,FALSE}), determine which&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            # branch is never taken and remove the edge from this BB to the BB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            # we will never branch to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            # We also iterate tos[1] and remove all of the instructions which&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            # contributed to tos[0].&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;        execute_instruction&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;instruction&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This will effectively &lt;strong&gt;remove&lt;&#x2F;strong&gt; instructions related to const conditions and (usually) the basic block not taken from the graph. These inserted, fake basic blocks are implicitly removed since they become orphaned from the main code graph.&lt;&#x2F;p&gt;
&lt;p&gt;There are some issues with this approach:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;I need to correctly implement almost all VM instructions&lt;&#x2F;li&gt;
&lt;li&gt;Large traces will balloon in computation complexity and memory&lt;&#x2F;li&gt;
&lt;li&gt;Complex arithmetic or unsupported instructions will immediately stop the VM, which leaves code only partially deobfuscated&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;restoring-variable-names&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#restoring-variable-names&quot; aria-label=&quot;Anchor link for: restoring-variable-names&quot;
    &gt;#&lt;&#x2F;a
&gt;
Restoring Variable Names&lt;&#x2F;h3&gt;
&lt;p&gt;Variable names are unfortunately always lost. Instead of &quot;restoring&quot;, I simply iterate and replace odd var names with the following script:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fix_varnames&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;varnames&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    global&lt;&#x2F;span&gt;&lt;span&gt; unknowns&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    newvars&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; var&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; varnames&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        var&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; var&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;strip&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        unallowed_chars&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;=!@#$%^&amp;amp;*()&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;\&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;&#x2F;, &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        banned_char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        banned_words&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = [&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;in&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;continue&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;else&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;from&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;global&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;import&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;is&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;lambda&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;not&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;or&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;pass&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;print&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;with&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; unallowed_chars&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; var&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                banned_char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; banned_char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; var&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; banned_words&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                banned_char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; banned_char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            newvars&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;append&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;{0}&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;format&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;unknowns&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unknowns&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            newvars&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;append&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;var&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; tuple&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;newvars&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Pretty simple replacement of illegal-looking variable name with &lt;code&gt;unknown_N&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;restoring-function-names&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#restoring-function-names&quot; aria-label=&quot;Anchor link for: restoring-function-names&quot;
    &gt;#&lt;&#x2F;a
&gt;
Restoring Function Names&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike var names, function names generally &lt;em&gt;can&lt;&#x2F;em&gt; be restored due to an oversight in the obfuscator. When a function is defined in a module, the bytecode for setting it up looks like the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LOAD_CONST &amp;lt;CONST_INDEX&amp;gt; # Load the code object&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MAKE_FUNCTION # Take the loaded code object and tell the interpreter to turn it into a function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;STORE_NAME &amp;lt;NAME_INDEX&amp;gt; # Store the created function at the specified named index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;NAME_INDEX&lt;&#x2F;code&gt; corresponds to a &lt;code&gt;name&lt;&#x2F;code&gt; string value located in the &lt;code&gt;co_names&lt;&#x2F;code&gt; array in the code object. The code object for the function also contains its name, which is generally what&#x27;s used by decompilers to label a function. I leveraged this in my instruction handler loop by checking:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; instruction&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; basic_block&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; instruction&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;is_store_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;():&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        accessed_instructions&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; accessed_instructions&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;].&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;is_make_function&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;():&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            # change the function name on the code object to match what this&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;            # scope sees as the function name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;            fix_function_name&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;tos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;],&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; co&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;co_names&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;instruction&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;argument&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    execute_instruction&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;instruction&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Strictly speaking these names aren&#x27;t even necessary for the VM to run the code since they&#x27;re really only present for debugging purposes. I suspect that this is either an oversight by Lesta or they deliberately left these in for debugging crashes on clients (although I&#x27;m not certain if they send back Python crash reports). Maybe there&#x27;s something I don&#x27;t know though.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deoptimizing-code&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#deoptimizing-code&quot; aria-label=&quot;Anchor link for: deoptimizing-code&quot;
    &gt;#&lt;&#x2F;a
&gt;
Deoptimizing Code&lt;&#x2F;h3&gt;
&lt;p&gt;I &lt;em&gt;think&lt;&#x2F;em&gt; that &lt;code&gt;RETURN_VALUE&lt;&#x2F;code&gt; is really the only case I had to correct, and it was a fairly simple fix.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Look for basic blocks that contain only a &lt;code&gt;RETURN_VALUE&lt;&#x2F;code&gt; instruction&lt;&#x2F;li&gt;
&lt;li&gt;For each incoming edge, replace the final instruction in the basic block to be &lt;code&gt;RETURN_VALUE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Remove the basic block from step 1&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The example control flow for return values then provided &lt;a href=&quot;https:&#x2F;&#x2F;landaire.net&#x2F;world-of-warships-deobfuscation&#x2F;#5-implicit-returns&quot;&gt;in the section about implicit returns&lt;&#x2F;a&gt; will now look like this:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;wows-obfuscation&#x2F;implicit_return_fix.svg&quot; alt=&quot;Implicit return fixups&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fixing-bad-instructions&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#fixing-bad-instructions&quot; aria-label=&quot;Anchor link for: fixing-bad-instructions&quot;
    &gt;#&lt;&#x2F;a
&gt;
Fixing Bad Instructions&lt;&#x2F;h3&gt;
&lt;p&gt;There are some scenarios where code paths containing bad instructions can&#x27;t be outright removed. Usually it&#x27;s because a condition couldn&#x27;t be proven to be a const predicate, or there was some other factor involved that led to it not being removed. Even though I &lt;em&gt;know&lt;&#x2F;em&gt; they&#x27;re bad, I&#x27;m hesitant to outright outright remove the nodes and conditions as gaps in the VM and data mixing may lead to incorrect instruction removal.&lt;&#x2F;p&gt;
&lt;p&gt;To correct these basic blocks I calculate the depth of the stack at the location of the bad instruction, insert enough &lt;code&gt;POP_TOP&lt;&#x2F;code&gt; instructions to clear out the stack, and finally put a &lt;code&gt;LOAD_CONST None&lt;&#x2F;code&gt; and &lt;code&gt;RETURN_VALUE&lt;&#x2F;code&gt; at the end of the basic block to force a &lt;code&gt;return None&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-rest-of-the-matryoshka-doll&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-rest-of-the-matryoshka-doll&quot; aria-label=&quot;Anchor link for: the-rest-of-the-matryoshka-doll&quot;
    &gt;#&lt;&#x2F;a
&gt;
The Rest of The Matryoshka Doll&lt;&#x2F;h2&gt;
&lt;p&gt;There are four distinct &quot;stages&quot; to loading the Python module, two of which we&#x27;ve already loosely discussed from lpcvoid&#x27;s blog (encrypted code, and the compressed code).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stage-2-decompressed-code&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#stage-2-decompressed-code&quot; aria-label=&quot;Anchor link for: stage-2-decompressed-code&quot;
    &gt;#&lt;&#x2F;a
&gt;
Stage 2 - Decompressed Code&lt;&#x2F;h3&gt;
&lt;p&gt;The following is an example stage 3 payload:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; marshal&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; copy_reg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;marshal&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;loads&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span&gt; copy_reg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;mmId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;_getframe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;().&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;f_back&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;f_code&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;co_code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;impf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;isinstance&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;__builtins__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; dict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) or&lt;&#x2F;span&gt;&lt;span&gt; __builtins__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;__import__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; __builtins__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;__import__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; not&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; hasattr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;impf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;func_code&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;) or&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;impf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;func_code&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;co_code&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1236377808&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; hasattr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;impf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;func_code&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;) and&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;impf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;func_globals&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;common&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;]) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;marshal&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;loads&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span&gt; f123--&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; This code section failed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; --&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;                0&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_GLOBAL&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;common&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;                3&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;arg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;                6&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;kw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;                9&lt;&#x2F;span&gt;&lt;span&gt;  CALL_FUNCTION_VAR_KW_0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;     0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               12&lt;&#x2F;span&gt;&lt;span&gt;  STORE_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               15&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_GLOBAL&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               18&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               21&lt;&#x2F;span&gt;&lt;span&gt;  CALL_FUNCTION_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               24&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_ATTR&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;__name__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               27&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;               &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;module&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               30&lt;&#x2F;span&gt;&lt;span&gt;  COMPARE_OP&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  ==&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               33&lt;&#x2F;span&gt;&lt;span&gt;  POP_JUMP_IF_FALSE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;   155&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;to 155&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               36&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_GLOBAL&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;hasattr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               39&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               42&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;               &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;__file__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               45&lt;&#x2F;span&gt;&lt;span&gt;  CALL_FUNCTION_2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               48&lt;&#x2F;span&gt;&lt;span&gt;  POP_JUMP_IF_FALSE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;   155&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;to 155&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               51&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_GLOBAL&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;hasattr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               54&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               57&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;               &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;gCPLBx86&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               60&lt;&#x2F;span&gt;&lt;span&gt;  CALL_FUNCTION_2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               63&lt;&#x2F;span&gt;&lt;span&gt;  UNARY_NOT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               64&lt;&#x2F;span&gt;&lt;span&gt;  POP_JUMP_IF_TRUE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;     82&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;to 82&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               67&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               70&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_ATTR&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;gCPLBx86&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               73&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;               &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;1663084375&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               76&lt;&#x2F;span&gt;&lt;span&gt;  COMPARE_OP&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  !=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             79_0&lt;&#x2F;span&gt;&lt;span&gt;  COME_FROM&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               79&lt;&#x2F;span&gt;&lt;span&gt;  POP_JUMP_IF_FALSE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;   155&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;to 155&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               82&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;arg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               85&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               88&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_SUBSCR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               89&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;               (&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;collections&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;utf8_test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;copy_reg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               92&lt;&#x2F;span&gt;&lt;span&gt;  COMPARE_OP&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  not-in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             95_0&lt;&#x2F;span&gt;&lt;span&gt;  COME_FROM&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            79&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;79&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             95_1&lt;&#x2F;span&gt;&lt;span&gt;  COME_FROM&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             95_2&lt;&#x2F;span&gt;&lt;span&gt;  COME_FROM&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            33&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;33&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               95&lt;&#x2F;span&gt;&lt;span&gt;  POP_JUMP_IF_FALSE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;   155&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;to 155&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               98&lt;&#x2F;span&gt;&lt;span&gt;  SETUP_EXCEPT&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;         48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;to 149&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              101&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_GLOBAL&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;loaded&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              104&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_ATTR&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;add&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              107&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_GLOBAL&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              110&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              113&lt;&#x2F;span&gt;&lt;span&gt;  CALL_FUNCTION_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              116&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;arg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              119&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              122&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_SUBSCR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              123&lt;&#x2F;span&gt;&lt;span&gt;  BUILD_TUPLE_2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;         2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              126&lt;&#x2F;span&gt;&lt;span&gt;  CALL_FUNCTION_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              129&lt;&#x2F;span&gt;&lt;span&gt;  POP_TOP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              130&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_GLOBAL&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              133&lt;&#x2F;span&gt;&lt;span&gt;  DUP_TOP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              134&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_ATTR&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;errCnt&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              137&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              140&lt;&#x2F;span&gt;&lt;span&gt;  INPLACE_ADD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              141&lt;&#x2F;span&gt;&lt;span&gt;  ROT_TWO&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              142&lt;&#x2F;span&gt;&lt;span&gt;  STORE_ATTR&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;errCnt&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              145&lt;&#x2F;span&gt;&lt;span&gt;  POP_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              146&lt;&#x2F;span&gt;&lt;span&gt;  JUMP_FORWARD&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;          6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;to 155&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            149_0&lt;&#x2F;span&gt;&lt;span&gt;  COME_FROM&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            98&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;98&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              149&lt;&#x2F;span&gt;&lt;span&gt;  POP_TOP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              150&lt;&#x2F;span&gt;&lt;span&gt;  POP_TOP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              151&lt;&#x2F;span&gt;&lt;span&gt;  POP_TOP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              152&lt;&#x2F;span&gt;&lt;span&gt;  JUMP_FORWARD&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;          0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;to 155&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            155_0&lt;&#x2F;span&gt;&lt;span&gt;  COME_FROM&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           152&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;152&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            155_1&lt;&#x2F;span&gt;&lt;span&gt;  COME_FROM&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           146&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;146&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              155&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;res&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              158&lt;&#x2F;span&gt;&lt;span&gt;  RETURN_VALUE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;               -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;  RETURN_LAST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Parse error at&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; near `&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;None&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; instruction at offset -1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; f123&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;impf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; f222&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        import&lt;&#x2F;span&gt;&lt;span&gt; sys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        f222&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;func_globals&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;loaded&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;] =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; set&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; not&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;__builtins__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; dict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            f222&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;func_globals&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;common&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;] =&lt;&#x2F;span&gt;&lt;span&gt; __builtins__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;__import__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; __builtins__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;__import__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            f222&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;func_globals&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;] =&lt;&#x2F;span&gt;&lt;span&gt; sys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;errCnt&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            __builtins__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;__import__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;__builtins__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; dict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) or&lt;&#x2F;span&gt;&lt;span&gt; f222&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            __builtins__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;__import__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;] =&lt;&#x2F;span&gt;&lt;span&gt; f222&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;settrace&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(None)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;settrace&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;getrefcount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;setprofile&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(None)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;setprofile&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;getrefcount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;gettrace&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;exit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;getprofile&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;exit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    f333&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;impf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; f222&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    impf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; f222&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; f123&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;marshaled&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swapMap&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = {&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 151&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 235&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 249&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 188&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 106&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 122&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 220&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 189&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 12&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 242&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 13&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 253&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 210&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 243&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 17&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 27&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 18&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 222&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 19&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 90&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 139&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 21&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 18&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 22&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 79&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 23&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 255&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 24&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 230&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 25&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 83&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 26&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 27&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 74&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 89&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 141&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 30&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 219&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 123&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 203&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 33&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 51&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 34&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 98&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 35&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 53&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 36&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 103&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 37&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 204&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 190&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 39&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 118&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 40&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 62&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 41&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 161&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 41&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 43&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 241&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 44&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 247&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 45&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 101&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 46&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 196&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 47&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 153&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 181&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 49&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 40&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 50&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 152&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 51&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 174&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 52&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 140&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 53&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 171&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 54&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 44&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 55&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 134&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 56&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 158&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 57&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 88&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 58&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 70&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 59&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 132&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 60&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 173&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 61&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 62&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 129&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 63&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 86&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 21&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 66&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 148&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 67&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 145&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 68&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 211&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 69&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 127&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 70&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 224&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 71&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 167&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 72&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 185&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 73&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 237&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 74&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 147&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 75&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 233&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 76&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 58&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 77&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 175&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 78&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 79&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 252&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 80&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 209&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 81&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 155&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 82&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 37&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 83&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 162&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 84&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 85&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 227&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 86&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 78&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 87&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 136&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 88&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 12&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 89&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 246&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 90&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 81&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 91&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 126&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 92&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 186&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 93&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 94&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 87&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 95&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 150&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 97&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 39&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 98&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 193&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 99&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 55&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 101&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 59&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 102&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 200&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 103&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 30&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 104&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 225&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 105&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 197&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 106&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 212&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 107&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 213&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 108&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 245&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 109&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 179&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 110&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 105&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 111&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 111&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 112&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 112&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 113&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 114&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 156&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 115&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 91&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 116&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 68&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 117&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 50&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 118&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 13&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 119&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 66&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 120&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 84&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 121&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 159&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 122&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 182&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 123&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 102&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 124&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 221&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 125&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 154&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 126&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 57&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 127&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 254&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 130&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 129&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 17&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 130&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 82&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 131&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 77&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 132&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 104&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 133&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 95&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 134&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 146&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 135&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 136&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 169&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 137&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 164&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 138&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 121&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 139&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 223&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 140&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 141&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 232&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 142&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 244&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 143&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 218&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 144&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 85&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 145&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 113&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 146&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 177&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 147&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 166&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 148&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 52&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 149&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 24&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 150&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 170&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 151&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 152&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 73&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 153&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 144&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 154&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 236&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 155&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 34&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 156&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 205&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 157&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 115&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 158&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 114&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 159&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 226&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 160&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 45&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 161&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 234&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 162&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 19&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 163&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 133&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 164&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 168&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 165&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 135&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 166&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 194&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 167&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 99&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 168&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 138&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 169&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 251&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 170&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 46&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 171&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 72&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 172&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 60&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 173&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 94&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 174&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 175&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 75&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 176&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 177&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 178&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 178&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 116&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 179&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 238&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 180&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 181&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 143&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 182&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 92&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 183&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 142&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 184&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 176&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 185&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 25&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 186&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 108&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 187&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 250&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 188&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 189&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 160&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 190&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 107&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 191&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 240&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 208&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 193&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 194&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 187&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 195&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 49&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 196&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 197&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 184&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 198&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 199&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 199&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 43&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 200&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 165&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 201&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 202&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 125&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 203&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 76&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 204&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 110&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 205&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 71&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 206&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 33&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 207&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 217&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 208&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 209&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 229&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 210&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 120&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 211&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 131&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 212&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 195&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 213&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 69&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 214&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 231&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 215&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 97&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 216&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 248&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 217&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 201&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 218&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 206&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 219&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 22&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 220&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 23&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 221&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 35&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 222&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 207&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 223&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 124&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 224&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 137&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 225&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 226&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 157&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 227&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 93&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 228&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 180&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 229&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 56&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 230&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 117&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 231&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 63&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 232&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 191&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 233&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 109&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 234&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 239&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 235&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 36&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 236&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 202&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 237&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 163&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 238&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 119&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 239&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 214&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 240&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 183&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 241&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 54&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 242&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 172&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 243&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 244&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 47&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 245&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 228&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 246&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 198&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 247&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 61&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 248&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 26&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 249&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 149&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 250&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 67&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 251&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 216&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 252&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 253&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 80&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 254&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 255&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 215&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    marshaled&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (&amp;#39;&amp;#39;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;join&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;map&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;chr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; swapMap&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ord&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)]&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; marshaled&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ]))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; marshaled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;co_code&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; chr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 126&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; | ((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 89&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; ord&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; f123&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;code&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ] ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;locDict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = {}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;locDict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;globs&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;] =&lt;&#x2F;span&gt;&lt;span&gt; sys&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;_getframe&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;().&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;f_back&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;f_globals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;locDict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;code&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;] =&lt;&#x2F;span&gt;&lt;span&gt; marshal&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;loads&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;((&amp;#39;&amp;#39;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;join&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;co_code&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[::-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;locDict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;marshal&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;] =&lt;&#x2F;span&gt;&lt;span&gt; marshal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;exec&lt;&#x2F;span&gt;&lt;span&gt; locDict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;code&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;] in&lt;&#x2F;span&gt;&lt;span&gt; locDict&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; f111&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;():&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;f111&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;del&lt;&#x2F;span&gt;&lt;span&gt; f111&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;There are some checks to ensure that certain state is set up, but in general this will:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Load the &lt;code&gt;co_code&lt;&#x2F;code&gt; from the original stage 1 file&lt;&#x2F;li&gt;
&lt;li&gt;Apply a substitution cipher over each byte&lt;&#x2F;li&gt;
&lt;li&gt;Do some bit arithmetic on each byte of the result from step 2&lt;&#x2F;li&gt;
&lt;li&gt;Execute the code that was just decoded&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In my deobfuscator I was able to leverage the custom Python VM to apply the swapmap for me by creating a state machine. Essentially I scan for certain instructions that look like they&#x27;re applying the swapmap, then execute that function with some fake VM stack set up. That code can be found here: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;wowsdeob&#x2F;blob&#x2F;ffeeedaea9390c1d1e9ba785360e75aaa1aa10d0&#x2F;src&#x2F;smallvm.rs&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;wowsdeob&#x2F;blob&#x2F;ffeeedaea9390c1d1e9ba785360e75aaa1aa10d0&#x2F;src&#x2F;smallvm.rs&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stage-3&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#stage-3&quot; aria-label=&quot;Anchor link for: stage-3&quot;
    &gt;#&lt;&#x2F;a
&gt;
Stage 3&lt;&#x2F;h3&gt;
&lt;p&gt;This stage is pretty boring all things considered. The Stage 3 code object is just another compressed code object that&#x27;s been base64 encoded and had the result reversed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;wows-obfuscation&#x2F;stage3_base64.png&quot; alt=&quot;Sample showing the base64-encoded data&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;No big tricks here. The deobfuscator logic can be found here: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;wowsdeob&#x2F;blob&#x2F;ffeeedaea9390c1d1e9ba785360e75aaa1aa10d0&#x2F;src&#x2F;main.rs#L290-L297&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;wowsdeob&#x2F;blob&#x2F;ffeeedaea9390c1d1e9ba785360e75aaa1aa10d0&#x2F;src&#x2F;main.rs#L290-L297&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Worth noting that this is the stage which references the Lestas &quot;Anti noobs protection&quot;!&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;wows-obfuscation&#x2F;stage3_anti_noobs_protection.png&quot; alt=&quot;Anti noobs protection&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stage-4&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#stage-4&quot; aria-label=&quot;Anchor link for: stage-4&quot;
    &gt;#&lt;&#x2F;a
&gt;
Stage 4&lt;&#x2F;h3&gt;
&lt;p&gt;We have the final module! This module now needs to have all generic deobfuscation tricks applied to get decompilation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;end-result&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#end-result&quot; aria-label=&quot;Anchor link for: end-result&quot;
    &gt;#&lt;&#x2F;a
&gt;
End Result&lt;&#x2F;h2&gt;
&lt;p&gt;The end result of this effort is going from a file that fails to decompile:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;❯&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; uncompyle6 .&#x2F;output&#x2F;AirplaneUtils_stage4.pyc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# uncompyle6 version 3.8.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Python bytecode 2.7 (62211)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Decompiled from: Python 2.7.18 (default, Sep 28 2022, 20:52:16)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# [GCC Apple LLVM 14.0.0 (clang-1400.0.29.102)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Warning: this version of Python has problems handling the Python 3 byte type in constants properly.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Embedded file name: 26977129990194521&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Compiled at: 2020-12-14 08:10:48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;Traceback&lt;&#x2F;span&gt;&lt;span&gt; (most&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; recent call last&lt;&#x2F;span&gt;&lt;span&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;  File&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;&#x2F;Users&#x2F;lander&#x2F;.pyenv&#x2F;versions&#x2F;2.7.18&#x2F;bin&#x2F;uncompyle6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, line 10, in&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;modul&lt;&#x2F;span&gt;&lt;span&gt;e&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    sys.exit(main_bin(&lt;&#x2F;span&gt;&lt;span&gt;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;  File&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;&#x2F;Users&#x2F;lander&#x2F;.pyenv&#x2F;versions&#x2F;2.7.18&#x2F;lib&#x2F;python2.7&#x2F;site-packages&#x2F;uncompyle6&#x2F;bin&#x2F;uncompile.py&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, line 194, in main_bin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    **options&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;  File&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;&#x2F;Users&#x2F;lander&#x2F;.pyenv&#x2F;versions&#x2F;2.7.18&#x2F;lib&#x2F;python2.7&#x2F;site-packages&#x2F;uncompyle6&#x2F;main.py&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, line 328, in main&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    do_fragments,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;  File&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;&#x2F;Users&#x2F;lander&#x2F;.pyenv&#x2F;versions&#x2F;2.7.18&#x2F;lib&#x2F;python2.7&#x2F;site-packages&#x2F;uncompyle6&#x2F;main.py&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, line 230, in decompile_file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    do_fragments&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;do_fragments,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;  File&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;&#x2F;Users&#x2F;lander&#x2F;.pyenv&#x2F;versions&#x2F;2.7.18&#x2F;lib&#x2F;python2.7&#x2F;site-packages&#x2F;uncompyle6&#x2F;main.py&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, line 149, in decompile&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    co,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; out, bytecode_version, debug_opts=debug_opts, is_pypy=is_pypy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;  File&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;&#x2F;Users&#x2F;lander&#x2F;.pyenv&#x2F;versions&#x2F;2.7.18&#x2F;lib&#x2F;python2.7&#x2F;site-packages&#x2F;uncompyle6&#x2F;semantics&#x2F;pysource.py&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, line 2578, in code_deparse&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    co,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; code_objects=code_objects, show_asm=debug_opts[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;asm&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;  File&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;&#x2F;Users&#x2F;lander&#x2F;.pyenv&#x2F;versions&#x2F;2.7.18&#x2F;lib&#x2F;python2.7&#x2F;site-packages&#x2F;uncompyle6&#x2F;scanners&#x2F;scanner2.py&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, line 350, in ingest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    pattr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; = names[oparg]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;IndexError:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; tuple index out of range&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;zsh:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; exit&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;     uncompyle6 .&#x2F;output&#x2F;AirplaneUtils_stage4.pyc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# uncompyle6 version 3.8.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Python bytecode 2.7 (62211)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Decompiled from: Python 2.7.18 (default, Sep 28 2022, 20:52:16)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# [GCC Apple LLVM 14.0.0 (clang-1400.0.29.102)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Warning: this version of Python has problems handling the Python 3 byte type in constants properly.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Embedded file name: 123823449462&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# Compiled at: 2020-12-14 08:10:48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; math&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; random&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; ConstantsUtils&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; idGenerator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; GameParams&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Junk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Lesta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; Math&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; Vector3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; AirPlanes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;AirplaneConstants&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; DeathReason&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; SquadronStateEnum&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Throttle&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; TurnDirection&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; PlaneTypeNames&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; AirplaneConstants&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; SQUADRON_DEPARTURE_BIT&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; SQUADRON_PURPOSE_BIT&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; SQUADRON_INDEX_BIT&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; PLANETYPE_2_PARAMSNAME&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; PLANE_TORPEDO_CONE_HALF_WIDTH&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; PlaneTypes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; PLANE_PROJECTILE_GRAVITY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; mc0f1198d&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; devMode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; md0ce06f9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; LOG_ERROR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; m79622f13&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; normaliseAngle&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; getDirectionFromYaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lerp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lerpAngles&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; getDirectionFromYawPitch&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; EPSILON&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; PlanesDEFConverter&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; PlanesDictConverter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; PyMagic&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; pTuple&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; mc062022a&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; ShipTypes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; shared_constants&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;m22c5a818&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; PLANE_AMMO_TYPES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;class&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; WayPoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    enum&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; idGenerator&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    GENERATED&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RESET&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    LAUNCHING_START_NODE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    LAUNCHING_END_NODE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    LANDING_START_NODE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    LANDING_END_NODE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; next&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    del&lt;&#x2F;span&gt;&lt;span&gt; enum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; __init__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;font-style: italic;&quot;&gt;self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; pitch&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; time&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; waypointType&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;GENERATED&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; yaw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pitch&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; pitch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;time&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;sent&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; waypointType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; __repr__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;font-style: italic;&quot;&gt;self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;&amp;lt;&amp;lt; Waypoint pos:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;{0}&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, time:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;{1}&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, type:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;{2}&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, yaw:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;{3}&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;, pitch: &lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;{4}&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;format&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;time&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pitch&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; toDict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;font-style: italic;&quot;&gt;self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;position&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; Vector3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;:&lt;&#x2F;span&gt;&lt;span&gt; self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;pitch&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;normaliseAngle&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pitch&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, False) *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 127&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; math&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pi&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;time&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;time&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1000&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;), &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;:&lt;&#x2F;span&gt;&lt;span&gt; self&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    @&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;staticmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; fromDict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;dict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; WayPoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;Vector3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;dict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;position&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;]),&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; dict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;],&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; dict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;pitch&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;] *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; math&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pi&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 127.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; dict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;time&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;] &#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1000.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; dict&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    @&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;staticmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; _splineReference&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;point1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; point2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        unknown_0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; point1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;flatDistTo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;point2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; unknown_0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unknown_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unknown_2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; unknown_0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; getDirectionFromYaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;point1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; unknown_0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; getDirectionFromYaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;point2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unknown_3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; unknown_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; unknown_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) *&lt;&#x2F;span&gt;&lt;span&gt; point1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; unknown_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) *&lt;&#x2F;span&gt;&lt;span&gt; point2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; unknown_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; unknown_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; unknown_2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; unknown_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unknown_4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; point1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;flatDistTo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;unknown_3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; unknown_0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unknown_3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;y&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; lerp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;point1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;y&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; point2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;y&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; unknown_4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unknown_5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; lerpAngles&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;point1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; point2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unknown_6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unknown_3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; lerp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;point1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; point2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unknown_5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; lerpAngles&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;point1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; point2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unknown_6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span&gt;unknown_3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; unknown_5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; unknown_6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; spline&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;point1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; point2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; Lesta&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;splineWayPoints&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;point1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; point1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; point1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pitch&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; point2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pos&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; point2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; point2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pitch&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    spline&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _splineOptimised&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; generateSquadronId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;shipId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; purpose&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; departureId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        Generates id of the squadron based on the given arguments.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        :param shipId: id of the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        :type shipId: int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        :param index: index of the squadron within the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        :type index: int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        :param purpose: the function that squadron is performing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        :type purpose: int (AirplaneConstants.SquadronPurpose)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        :param departureId: unique departure id of the squadron incremented with every subsequent id generation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        :type departureId: int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        :return id of the squadron&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        :rtype: int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unknown_7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; departureId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; SQUADRON_DEPARTURE_BIT&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; purpose&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; SQUADRON_PURPOSE_BIT&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; SQUADRON_INDEX_BIT&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; shipId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; retrieveOwnerID&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;unknown_7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ==&lt;&#x2F;span&gt;&lt;span&gt; shipId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; retrieveSquadronIndex&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;unknown_7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ==&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; retrieveSquadronPurpose&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;unknown_7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ==&lt;&#x2F;span&gt;&lt;span&gt; purpose&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; unknown_7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; retrieveSquadronIndex&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;squadronId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unknown_8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span&gt;squadronId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; SQUADRON_INDEX_BIT&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; unknown_8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; retrieveSquadronPurpose&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;squadronId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unknown_9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; squadronId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; SQUADRON_PURPOSE_BIT&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; unknown_9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; retrieveSquadronDeparture&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;squadronId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unknown_10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; squadronId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; SQUADRON_DEPARTURE_BIT&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; unknown_10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; parseSquadronId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;squadronId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;retrieveSquadronIndex&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;squadronId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;),&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; retrieveSquadronPurpose&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;squadronId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;),&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; retrieveSquadronDeparture&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;squadronId&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; retrieveOwnerID&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4294967295&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;L&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; getPlaneName&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;params&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; planeType&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unknown_11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; PLANETYPE_2_PARAMSNAME&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;get&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;planeType&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; planeType&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;__dict__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;unknown_11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;].&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;planeType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; planeType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span&gt; getTorpedoingArea--&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; This code section failed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; --&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;                0&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_GLOBAL&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;getDirectionFromYaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;                3&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;attackDir&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;                6&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_ATTR&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;yaw&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;                9&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_GLOBAL&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;math&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               12&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_ATTR&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;pi&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               15&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               18&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_DIVIDE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               19&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_ADD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               20&lt;&#x2F;span&gt;&lt;span&gt;  CALL_FUNCTION_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               23&lt;&#x2F;span&gt;&lt;span&gt;  STORE_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               26&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_GLOBAL&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;min&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               29&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CODE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;code_object&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 369464740902&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               32&lt;&#x2F;span&gt;&lt;span&gt;  MAKE_FUNCTION_0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               35&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;formation&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               38&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_ATTR&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;positions&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               41&lt;&#x2F;span&gt;&lt;span&gt;  GET_ITER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               42&lt;&#x2F;span&gt;&lt;span&gt;  CALL_FUNCTION_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               45&lt;&#x2F;span&gt;&lt;span&gt;  CALL_FUNCTION_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               48&lt;&#x2F;span&gt;&lt;span&gt;  STORE_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               51&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_GLOBAL&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;max&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               54&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CODE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;code_object&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 369537115186&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               57&lt;&#x2F;span&gt;&lt;span&gt;  MAKE_FUNCTION_0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               60&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;formation&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               63&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_ATTR&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;positions&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               66&lt;&#x2F;span&gt;&lt;span&gt;  GET_ITER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               67&lt;&#x2F;span&gt;&lt;span&gt;  CALL_FUNCTION_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               70&lt;&#x2F;span&gt;&lt;span&gt;  CALL_FUNCTION_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;       1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               73&lt;&#x2F;span&gt;&lt;span&gt;  STORE_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               76&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               79&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               82&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_SUBTRACT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               83&lt;&#x2F;span&gt;&lt;span&gt;  STORE_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_17&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               86&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_17&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               89&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;currentPlaneCount&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               92&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_MULTIPLY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               93&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;formation&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               96&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_ATTR&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;npositions&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               99&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_DIVIDE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              100&lt;&#x2F;span&gt;&lt;span&gt;  STORE_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_18&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              103&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;attackPoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              106&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_18&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              109&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              112&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_DIVIDE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              113&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_GLOBAL&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;PLANE_TORPEDO_CONE_HALF_WIDTH&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              116&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_SUBTRACT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              117&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              120&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_MULTIPLY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              121&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_SUBTRACT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              122&lt;&#x2F;span&gt;&lt;span&gt;  STORE_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_19&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              125&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;attackPoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              128&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_18&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              131&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              134&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_DIVIDE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              135&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_GLOBAL&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;PLANE_TORPEDO_CONE_HALF_WIDTH&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              138&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_ADD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              139&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              142&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_MULTIPLY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              143&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_ADD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              144&lt;&#x2F;span&gt;&lt;span&gt;  STORE_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           12&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              147&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_19&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              150&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            12&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              153&lt;&#x2F;span&gt;&lt;span&gt;  COMPARE_OP&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  ==&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              156&lt;&#x2F;span&gt;&lt;span&gt;  POP_JUMP_IF_FALSE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;   176&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;to 176&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              159&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            12&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              162&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              165&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               0.001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              168&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_MULTIPLY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              169&lt;&#x2F;span&gt;&lt;span&gt;  INPLACE_ADD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              170&lt;&#x2F;span&gt;&lt;span&gt;  STORE_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           12&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              173&lt;&#x2F;span&gt;&lt;span&gt;  JUMP_FORWARD&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;          0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;to 176&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            176_0&lt;&#x2F;span&gt;&lt;span&gt;  COME_FROM&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           173&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;173&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              176&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;attackPoint&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              179&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;attackDir&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              182&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;planeParams&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              185&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_ATTR&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;torpedoAimDist&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              188&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_MULTIPLY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              189&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_ADD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              190&lt;&#x2F;span&gt;&lt;span&gt;  STORE_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           13&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_21&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              193&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            13&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_21&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              196&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              199&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;spreading&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              202&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_MULTIPLY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              203&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               0.5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              206&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_MULTIPLY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              207&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_SUBTRACT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              208&lt;&#x2F;span&gt;&lt;span&gt;  STORE_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_22&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              211&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            13&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_21&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              214&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              217&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;             3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;spreading&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              220&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_MULTIPLY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              221&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_CONST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;               0.5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              224&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_MULTIPLY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              225&lt;&#x2F;span&gt;&lt;span&gt;  BINARY_ADD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              226&lt;&#x2F;span&gt;&lt;span&gt;  STORE_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;           15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_23&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              229&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_19&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              232&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            12&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              235&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_22&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              238&lt;&#x2F;span&gt;&lt;span&gt;  LOAD_FAST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;            15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;unknown_23&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              241&lt;&#x2F;span&gt;&lt;span&gt;  BUILD_TUPLE_4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;         4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;              244&lt;&#x2F;span&gt;&lt;span&gt;  RETURN_VALUE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;               -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;  RETURN_LAST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Parse error at&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; near `&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;None&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt; instruction at offset -1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; getBombingZone&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;planeParams&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; modifierParams&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; aimAccuracy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; attackerStrength&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unknown_24&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; planeParams&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;maxSpread&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unknown_25&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; planeParams&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;minSpread&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unknown_26&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; lerp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;unknown_24&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;],&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; unknown_25&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;],&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; aimAccuracy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) *&lt;&#x2F;span&gt;&lt;span&gt; modifierParams&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;planeSpreadMultiplier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unknown_27&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; lerp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;unknown_24&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;],&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; unknown_25&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;],&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; aimAccuracy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) *&lt;&#x2F;span&gt;&lt;span&gt; modifierParams&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;planeSpreadMultiplier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;    0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; planeParams&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;outerSalvoSize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] *&lt;&#x2F;span&gt;&lt;span&gt; unknown_26&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; attackerStrength&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unknown_28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; planeParams&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;outerSalvoSize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] *&lt;&#x2F;span&gt;&lt;span&gt; unknown_27&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unknown_29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; planeParams&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;innerSalvoSize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] *&lt;&#x2F;span&gt;&lt;span&gt; unknown_26&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; attackerStrength&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    unknown_30&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; planeParams&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;innerSalvoSize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] *&lt;&#x2F;span&gt;&lt;span&gt; unknown_27&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; unknown_28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; unknown_29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; unknown_30&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;# snip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Clearly some functions still fail to decompile, but it may be enough to just read the instructions at this point to understand the intent.&lt;&#x2F;p&gt;
&lt;p&gt;And code objects that go from this:&lt;&#x2F;p&gt;

&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;wows-obfuscation&amp;#x2F;simple_obfuscation_example.svg&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;wows-obfuscation&amp;#x2F;simple_obfuscation_example.svg&quot;
        width=&quot;500&quot;
        height=&quot;500&quot;
        alt=&quot;&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;To this:&lt;&#x2F;p&gt;

&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;wows-obfuscation&amp;#x2F;simple_deobfuscation_example.svg&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;wows-obfuscation&amp;#x2F;simple_deobfuscation_example.svg&quot;
        width=&quot;500&quot;
        height=&quot;500&quot;
        alt=&quot;&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;h2 id=&quot;closing-thoughts&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#closing-thoughts&quot; aria-label=&quot;Anchor link for: closing-thoughts&quot;
    &gt;#&lt;&#x2F;a
&gt;
Closing Thoughts&lt;&#x2F;h2&gt;
&lt;p&gt;There&#x27;s one common theme in this post that I hope some readers picked up on: we are constantly battling the &lt;em&gt;decompiler&#x27;s&lt;&#x2F;em&gt; ability to unravel code based off of heuristics instead of battling the obfuscator injecting garbage. The const predicates for example aren&#x27;t even that big of a deal -- they just insert false control flow that at a &lt;em&gt;source&lt;&#x2F;em&gt; level is fairly straightforward to see is garbage.&lt;&#x2F;p&gt;
&lt;p&gt;However, this false control flow is enough to throw off the decompiler&#x27;s ability to figure out a &lt;em&gt;single&lt;&#x2F;em&gt; source code pattern that results in the entire code object failing to decompile. This isn&#x27;t a jab at &lt;code&gt;uncompyle&lt;&#x2F;code&gt; either -- it&#x27;s a great tool that works fairly well considering there&#x27;s zero competition in this space. However, I think that if I were to solve this problem from scratch in 2023 I&#x27;d solve it very differently by working on a better decompiler that erodes away mapping of 1:1 source code to bytecode, and instead focuses on rebuilding source with the same functional semantics.&lt;&#x2F;p&gt;
&lt;p&gt;As reverse engineers we don&#x27;t really care about how the code was originally written, we just want to understand its intent at a higher level.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;thanks&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#thanks&quot; aria-label=&quot;Anchor link for: thanks&quot;
    &gt;#&lt;&#x2F;a
&gt;
Thanks&lt;&#x2F;h2&gt;
&lt;p&gt;Thank you, reader, for making it this far. I&#x27;d like to extend thanks to the following people for their support in this research&#x2F;providing deobfuscator feedback:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;lpcvoid (without his initial blog post I wouldn&#x27;t have been nearly as motivated to go down this endeavour)&lt;&#x2F;li&gt;
&lt;li&gt;Track&lt;&#x2F;li&gt;
&lt;li&gt;TTaro&lt;&#x2F;li&gt;
&lt;li&gt;901234&lt;&#x2F;li&gt;
&lt;li&gt;notyourfather&lt;&#x2F;li&gt;
&lt;li&gt;gabe_k&lt;&#x2F;li&gt;
&lt;li&gt;Scout1Treia&lt;&#x2F;li&gt;
&lt;li&gt;EdibleBug&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>One Weird Trick to Improve Bug Finding With ASAN</title>
        <published>2023-02-10T00:00:00+00:00</published>
        <updated>2023-02-10T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://landaire.net/one-weird-asan-trick/"/>
        <id>https://landaire.net/one-weird-asan-trick/</id>
        
        <content type="html" xml:base="https://landaire.net/one-weird-asan-trick/">&lt;h2 id=&quot;asan-primer&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#asan-primer&quot; aria-label=&quot;Anchor link for: asan-primer&quot;
    &gt;#&lt;&#x2F;a
&gt;
ASAN Primer&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;em&gt;If you&#x27;re already an ASAN expert, feel free to skip to the next section.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;clang.llvm.org&#x2F;docs&#x2F;AddressSanitizer.html&quot;&gt;AddressSanitizer&lt;&#x2F;a&gt; (ASAN) is an extremely useful tool in software testing, debugging, and security testing for finding memory safety issues in native applications. It&#x27;s extremely straightforward to use on most platforms -- all you need to do is pass &lt;code&gt;-fsanitize=address&lt;&#x2F;code&gt; to clang&#x2F;gcc and run the application.&lt;&#x2F;p&gt;
&lt;p&gt;As your application runs it builds metadata about its memory state into what&#x27;s called a &lt;em&gt;shadow memory&lt;&#x2F;em&gt;. The shadow memory is essentiallly a compressed representation of the application&#x27;s address space and is used to look up memory ranges that are considered addressable. Memory ranges that are not addressable will be referred to as &quot;poisoned memory&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;When ASAN detects a memory safety issue it will print a report to the console and stop the application. The first bit of the report is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;=================================================================&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;==1==ERROR: AddressSanitizer: container-overflow on address 0x602000000010 at pc 0x560696424930 bp 0x7ffce1e0f150 sp 0x7ffce1e0f148&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;WRITE of size 4 at 0x602000000010 thread T0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #0 0x56069642492f in main &#x2F;app&#x2F;example.cpp:14:15&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #1 0x7fecaaf9a082 in __libc_start_main (&#x2F;lib&#x2F;x86_64-linux-gnu&#x2F;libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #2 0x56069636335d in _start (&#x2F;app&#x2F;output.s+0x2135d)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x602000000010 is located 0 bytes inside of 12-byte region [0x602000000010,0x60200000001c)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;allocated by thread T0 here:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #0 0x56069642211d in operator new(unsigned long) &#x2F;root&#x2F;llvm-project&#x2F;compiler-rt&#x2F;lib&#x2F;asan&#x2F;asan_new_delete.cpp:95:3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #1 0x560696427824 in void* std::__1::__libcpp_operator_new[abi:v15000]&amp;lt;unsigned long&amp;gt;(unsigned long) &#x2F;opt&#x2F;compiler-explorer&#x2F;clang-15.0.0&#x2F;bin&#x2F;..&#x2F;include&#x2F;c++&#x2F;v1&#x2F;new:246:10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #2 0x560696427808 in std::__1::__libcpp_allocate[abi:v15000](unsigned long, unsigned long) &#x2F;opt&#x2F;compiler-explorer&#x2F;clang-15.0.0&#x2F;bin&#x2F;..&#x2F;include&#x2F;c++&#x2F;v1&#x2F;new:272:10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #3 0x5606964277a9 in std::__1::allocator&amp;lt;Foo&amp;gt;::allocate[abi:v15000](unsigned long) &#x2F;opt&#x2F;compiler-explorer&#x2F;clang-15.0.0&#x2F;bin&#x2F;..&#x2F;include&#x2F;c++&#x2F;v1&#x2F;__memory&#x2F;allocator.h:112:38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #4 0x5606964275e0 in std::__1::__allocation_result&amp;lt;std::__1::allocator_traits&amp;lt;std::__1::allocator&amp;lt;Foo&amp;gt;&amp;gt;::pointer&amp;gt; std::__1::__allocate_at_least[abi:v15000]&amp;lt;std::__1::allocator&amp;lt;Foo&amp;gt;&amp;gt;(std::__1::allocator&amp;lt;Foo&amp;gt;&amp;amp;, unsigned long) &#x2F;opt&#x2F;compiler-explorer&#x2F;clang-15.0.0&#x2F;bin&#x2F;..&#x2F;include&#x2F;c++&#x2F;v1&#x2F;__memory&#x2F;allocate_at_least.h:54:19&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #5 0x560696426479 in std::__1::__split_buffer&amp;lt;Foo, std::__1::allocator&amp;lt;Foo&amp;gt;&amp;amp;&amp;gt;::__split_buffer(unsigned long, unsigned long, std::__1::allocator&amp;lt;Foo&amp;gt;&amp;amp;) &#x2F;opt&#x2F;compiler-explorer&#x2F;clang-15.0.0&#x2F;bin&#x2F;..&#x2F;include&#x2F;c++&#x2F;v1&#x2F;__split_buffer:316:29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #6 0x560696425927 in void std::__1::vector&amp;lt;Foo, std::__1::allocator&amp;lt;Foo&amp;gt;&amp;gt;::__push_back_slow_path&amp;lt;Foo&amp;gt;(Foo&amp;amp;&amp;amp;) &#x2F;opt&#x2F;compiler-explorer&#x2F;clang-15.0.0&#x2F;bin&#x2F;..&#x2F;include&#x2F;c++&#x2F;v1&#x2F;vector:1535:49&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #7 0x560696424d3b in std::__1::vector&amp;lt;Foo, std::__1::allocator&amp;lt;Foo&amp;gt;&amp;gt;::push_back[abi:v15000](Foo&amp;amp;&amp;amp;) &#x2F;opt&#x2F;compiler-explorer&#x2F;clang-15.0.0&#x2F;bin&#x2F;..&#x2F;include&#x2F;c++&#x2F;v1&#x2F;vector:1567:9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #8 0x5606964248d1 in main &#x2F;app&#x2F;example.cpp:11:10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #9 0x7fecaaf9a082 in __libc_start_main (&#x2F;lib&#x2F;x86_64-linux-gnu&#x2F;libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It tells us there&#x27;s a &lt;em&gt;container-overflow&lt;&#x2F;em&gt;, what address the container overflow occurred at, the call stack of where the overflow occurred, and finally where the memory we&#x27;re faulting on was originally allocated.&lt;&#x2F;p&gt;
&lt;p&gt;The next bit of the report is the shadow memory that was mentioned above:&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;asan&amp;#x2F;asan_error_with_arrow.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;asan_error_with_arrow.0fcd0a245b2df335.png&quot;
        alt=&quot;&quot;
        width=&quot;500&quot;
        height=&quot;512&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;The big arrow here is pointing into the shadow memory at &lt;code&gt;[06]&lt;&#x2F;code&gt;, which according to the legend at the bottom of the screenshot tells us there are six addressable bytes followed by a &lt;em&gt;global redzone&lt;&#x2F;em&gt; (represented by the red 0xf9 in the shadow bytes).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;runtime-instrumentation&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#runtime-instrumentation&quot; aria-label=&quot;Anchor link for: runtime-instrumentation&quot;
    &gt;#&lt;&#x2F;a
&gt;
Runtime Instrumentation&lt;&#x2F;h3&gt;
&lt;p&gt;ASAN builds its shadow memory at runtime with the help of its runtime library, &lt;code&gt;libclang_rt.asan_{target_platform}_dynamic.dylib&lt;&#x2F;code&gt;. The runtime library provides some of the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Memory management hooks for &lt;code&gt;malloc()&lt;&#x2F;code&gt;, &lt;code&gt;free()&lt;&#x2F;code&gt;, &lt;code&gt;operator new()&lt;&#x2F;code&gt;, etc. Whenever a memory allocation&#x2F;free occurs ASAN will update its shadow memory&lt;&#x2F;li&gt;
&lt;li&gt;Functions for checking if memory is addressable or poisoned.&lt;&#x2F;li&gt;
&lt;li&gt;Hooks for some common memory manipulation functions (&lt;code&gt;strncpy&lt;&#x2F;code&gt;, &lt;code&gt;strcpy&lt;&#x2F;code&gt;, &lt;code&gt;memcpy&lt;&#x2F;code&gt;, &lt;code&gt;memcmp&lt;&#x2F;code&gt;, etc.).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For checking if memory is addressable, ASAN&#x27;s runtime provides some simple APIs that are used by its compiler instrumentation such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;__asan_load1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;__asan_store1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;__asan_load2&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;__asan_store2&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;__asan_load8&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;__asan_store8&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;...&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;__asan_loadN&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Note: This is certainly not a definitive list of APIs, but are relatively common&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;These all essentially do the same thing under the hood:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;extern&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;C&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; NOINLINE INTERFACE_ATTRIBUTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; __asan_exp_loadN&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;uptr &lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uptr &lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;u32 &lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;exp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;__asan_region_is_poisoned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        GET_CALLER_PC_BP_SP&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;        ReportGenericError&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; bp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; sp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, false,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; exp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, true, false);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;They take an address and size, check if memory in that range is poisoned, and reports a generic error if it is.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compiler-instrumentation&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#compiler-instrumentation&quot; aria-label=&quot;Anchor link for: compiler-instrumentation&quot;
    &gt;#&lt;&#x2F;a
&gt;
Compiler Instrumentation&lt;&#x2F;h3&gt;
&lt;p&gt;The compiler instrumentation is primarily used for poisoning stack memory and inserting calls into the runtime library for &quot;interesting&quot; loads&#x2F;stores. Of course, not &lt;em&gt;every&lt;&#x2F;em&gt; load&#x2F;store will be instrumented by ASAN as that&#x27;d be a bit too heavy weight and a lot of things can be determined to be &quot;safe&quot; statically in the compiler.&lt;&#x2F;p&gt;
&lt;p&gt;I&#x27;m not a compiler expert and truthfully don&#x27;t care to dive into the source code at this time to figure out how ASAN determines what an &quot;interesting&quot; load&#x2F;store is. With that said, when one is encountered ASAN&#x27;s compiler pass will insert calls to the &lt;code&gt;__asan_{load,store}{size}&lt;&#x2F;code&gt; runtime functions to check the operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;you-re-probably-missing-out-of-bounds-accesses&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#you-re-probably-missing-out-of-bounds-accesses&quot; aria-label=&quot;Anchor link for: you-re-probably-missing-out-of-bounds-accesses&quot;
    &gt;#&lt;&#x2F;a
&gt;
You&#x27;re Probably Missing Out-of-Bounds Accesses&lt;&#x2F;h2&gt;
&lt;p&gt;With the crash course on ASAN out of the way, we can dive in to the main point of this blog post: you&#x27;re probably missing OOBR&#x2F;W in your applications if you&#x27;re using C++&#x2F;Rust&#x2F;whatever language containers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-problem-with-vectors&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-problem-with-vectors&quot; aria-label=&quot;Anchor link for: the-problem-with-vectors&quot;
    &gt;#&lt;&#x2F;a
&gt;
The Problem With Vectors&lt;&#x2F;h3&gt;
&lt;p&gt;Here is some example code that should raise an out-of-bounds access violation:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#include&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;vector&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#include&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;stdio.h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#include&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;string.h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; main&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; Allocate a vector to store some data generated by our fuzzer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    std&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span&gt;vector&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; Fuzzer pushes 5 bytes to the vector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;push_back&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0x41&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;push_back&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0x42&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;push_back&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0x43&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;push_back&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0x44&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;push_back&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0x45&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; Copy 8 bytes from the vector to a test buffer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    char&lt;&#x2F;span&gt;&lt;span&gt; test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = {&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;};&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    memcpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(), sizeof(&lt;&#x2F;span&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;size_t&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt; sizeof(&lt;&#x2F;span&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;        printf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;%02X&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;,&lt;&#x2F;span&gt;&lt;span&gt; test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    printf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;\n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;size(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;%zu&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;), capacity(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;%zu&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;\n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;,&lt;&#x2F;span&gt;&lt;span&gt; fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(),&lt;&#x2F;span&gt;&lt;span&gt; fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;capacity&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;());&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We have a vector with 5 bytes that we then try to copy 8 bytes from. Pretty standard out-of-bounds read. When we run this with ASAN however...&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Program returned: 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Program stdout&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;4142434445FFFFFFBEFFFFFFBEFFFFFFBE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;size(5), capacity(8)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;godbolt.org&#x2F;z&#x2F;cecf6Pjz8&quot;&gt;https:&#x2F;&#x2F;godbolt.org&#x2F;z&#x2F;cecf6Pjz8&lt;&#x2F;a&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;No crash! You might notice something interesting in the last line of the output though: the size of the vector is 5, but its capacity is &lt;em&gt;8&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Some readers probably know that when you &lt;code&gt;push_back()&lt;&#x2F;code&gt; or insert data into a &lt;code&gt;vector&lt;&#x2F;code&gt; that&#x27;s at its capacity, it reallocates the buffer to be &lt;em&gt;double&lt;&#x2F;em&gt; its current size, copies the data to the new buffer, and frees the old one (or just does a &lt;code&gt;realloc()&lt;&#x2F;code&gt;). As a vector starts to grow from 0 elements up to N, its growth looks like the following:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;asan&#x2F;vector_growth.png&quot; alt=&quot;Vector growth strategy&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;i.stack.imgur.com&#x2F;w5VP7.png&quot;&gt;Source&lt;&#x2F;a&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This is very problematic for us. We&#x27;re not catching an out-of-bounds access because of some implementation detail. All ASAN knows is that the application requested a buffer with 8 bytes -- it doesn&#x27;t know that in our case 3 of those bytes are unused memory that aren&#x27;t safe for us to use yet.&lt;&#x2F;p&gt;
&lt;p&gt;In the general case, any memory accesses in the range from &lt;code&gt;[vector.data() + vector.size(), vector.data() + vector.capacity()]&lt;&#x2F;code&gt; won&#x27;t be detected as an out-of-bounds access!&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-problem-with-strings&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-problem-with-strings&quot; aria-label=&quot;Anchor link for: the-problem-with-strings&quot;
    &gt;#&lt;&#x2F;a
&gt;
The Problem With Strings&lt;&#x2F;h3&gt;
&lt;p&gt;Here&#x27;s an example that&#x27;s basically the same as the vector example above -- except, we&#x27;re now constructing an &lt;code&gt;std::string&lt;&#x2F;code&gt; with a static C string.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#include&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;stdio.h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#include&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;string&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#include&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;string.h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; main&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    std&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span&gt;string&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;four&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    char&lt;&#x2F;span&gt;&lt;span&gt; temp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = {&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;};&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    memcpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;temp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(), sizeof(&lt;&#x2F;span&gt;&lt;span&gt;temp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;size_t&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt; sizeof(&lt;&#x2F;span&gt;&lt;span&gt;temp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;        printf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;%02X&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;,&lt;&#x2F;span&gt;&lt;span&gt; temp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    printf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;\n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;size(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;%lu&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;), capacity(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;%lu&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;\n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;,&lt;&#x2F;span&gt;&lt;span&gt; test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(),&lt;&#x2F;span&gt;&lt;span&gt; test&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;capacity&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;());&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Again, this doesn&#x27;t trigger a crash:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Program returned: 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Program stdout&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;666F7572000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;size(4), capacity(15)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;godbolt.org&#x2F;z&#x2F;hdjK1WoKo&quot;&gt;https:&#x2F;&#x2F;godbolt.org&#x2F;z&#x2F;hdjK1WoKo&lt;&#x2F;a&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;So the four-character string actually has a total capacity of 15, i.e. the &lt;code&gt;std::string&lt;&#x2F;code&gt; has over-allocated memory. If you tried initializing an &lt;code&gt;std::vector&lt;&#x2F;code&gt; with an explicit initializer list it would allocate only the exact number of elements needed... why are strings different?&lt;&#x2F;p&gt;
&lt;p&gt;Let&#x27;s take a look at LLVM&#x27;s libc++ &lt;code&gt;string&lt;&#x2F;code&gt; code (simplified version will follow):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#ifdef&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; _LIBCPP_BIG_ENDIAN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    static const&lt;&#x2F;span&gt;&lt;span&gt; size_type __short_mask &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x01&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    static const&lt;&#x2F;span&gt;&lt;span&gt; size_type __long_mask  &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x1ul&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#else&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;  &#x2F;&#x2F; _LIBCPP_BIG_ENDIAN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    static const&lt;&#x2F;span&gt;&lt;span&gt; size_type __short_mask &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x80&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    static const&lt;&#x2F;span&gt;&lt;span&gt; size_type __long_mask  &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= ~(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size_type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(~&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#endif&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; _LIBCPP_BIG_ENDIAN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;span&gt;__min_cap&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (sizeof(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;__long&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&#x2F;sizeof(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;value_type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;                      (sizeof(__long) - 1)&#x2F;sizeof(value_type) : 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;};&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; __short&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        value_type &lt;&#x2F;span&gt;&lt;span&gt;__data_&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;__min_cap&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;            :&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; __padding&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;value_type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            unsigned char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __size_&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; __long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        size_type __cap_&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        size_type __size_&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        pointer   __data_&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#ifdef&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; _LIBCPP_BIG_ENDIAN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    static const&lt;&#x2F;span&gt;&lt;span&gt; size_type __short_mask &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x80&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    static const&lt;&#x2F;span&gt;&lt;span&gt; size_type __long_mask  &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= ~(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size_type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(~&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#else&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;  &#x2F;&#x2F; _LIBCPP_BIG_ENDIAN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    static const&lt;&#x2F;span&gt;&lt;span&gt; size_type __short_mask &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x01&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    static const&lt;&#x2F;span&gt;&lt;span&gt; size_type __long_mask  &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x1ul&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#endif&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; _LIBCPP_BIG_ENDIAN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;span&gt;__min_cap&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = (sizeof(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;__long&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&#x2F;sizeof(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;value_type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;                      (sizeof(__long) - 1)&#x2F;sizeof(value_type) : 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;};&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; __short&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        union&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            unsigned char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __size_&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;            value_type __lx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        value_type &lt;&#x2F;span&gt;&lt;span&gt;__data_&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;__min_cap&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#endif&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    union&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; __ulx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;__long __lx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __short __lxx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;};&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;span&gt;__n_words&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = sizeof(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;__ulx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) &#x2F; sizeof(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;size_type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)};&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; __raw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        size_type &lt;&#x2F;span&gt;&lt;span&gt;__words&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;__n_words&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; __rep&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        union&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;            __long  __l&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;            __short __s&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;            __raw   __r&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    __compressed_pair&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;__rep&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; allocator_type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; __r_&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;llvm-project&#x2F;blob&#x2F;f860d2e78cca40e2b8697a22a92efebfea409256&#x2F;libcxx&#x2F;include&#x2F;string#L731-L803&quot;&gt;GitHub link.&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Yuck&lt;&#x2F;em&gt;. This is not simple to understand, but we can see that there&#x27;s some interesting inline buffer stuff going on with the &lt;code&gt;__short&lt;&#x2F;code&gt; struct at least. I&#x27;ve rewritten this code to be &lt;em&gt;definitely not&lt;&#x2F;em&gt; the same layout as an &lt;code&gt;std::string&lt;&#x2F;code&gt; but shows what&#x27;s going on easier to understand:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;class&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; string&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;	char&lt;&#x2F;span&gt;&lt;span&gt; short_optimization&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;	size_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;	size_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; capacity&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;	char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;heap_longer_string&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;std::string&lt;&#x2F;code&gt; has an optimization for short strings that allows it to avoid a heap allocation. Unfortunately, this means that for small strings we won&#x27;t detect small out-of-bounds reads (OOBR) similar to the &lt;code&gt;std::vector&lt;&#x2F;code&gt; problem. And similar to the &lt;code&gt;std::vector&lt;&#x2F;code&gt; problem, heap-allocated strings grow in a way that over-allocates memory to reduce the number of allocations every time you push more data to it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;fixes&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#fixes&quot; aria-label=&quot;Anchor link for: fixes&quot;
    &gt;#&lt;&#x2F;a
&gt;
Fixes&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;the-one-weird-trick&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-one-weird-trick&quot; aria-label=&quot;Anchor link for: the-one-weird-trick&quot;
    &gt;#&lt;&#x2F;a
&gt;
The &quot;One Weird Trick&quot;&lt;&#x2F;h3&gt;
&lt;p&gt;This isn&#x27;t really documented anywhere, but &lt;code&gt;std::vector&lt;&#x2F;code&gt; actually does have ASAN enlightenment to detect this exact problem we&#x27;re talking about:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; The following functions are no-ops outside of AddressSanitizer mode.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; We call annotatations only for the default Allocator because other allocators&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; may not meet the AddressSanitizer alignment constraints.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; See the documentation for __sanitizer_annotate_contiguous_container for more details.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#ifndef&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; _LIBCPP_HAS_NO_ASAN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _LIBCPP_CONSTEXPR_SINCE_CXX20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; __annotate_contiguous_container&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const void *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;__beg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; const void *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;__end&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;                                         const void *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;__old_mid&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;                                         const void *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;__new_mid&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; const&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (!&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;__libcpp_is_constant_evaluated&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; __beg &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; is_same&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;allocator_type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; __default_allocator_type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;::&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;        __sanitizer_annotate_contiguous_container&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;__beg&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; __end&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; __old_mid&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; __new_mid&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; __annotate_contiguous_container&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const void*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; const void*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; const void*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;                                         const void*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; const&lt;&#x2F;span&gt;&lt;span&gt; _NOEXCEPT &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;{}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#endif&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;llvm&#x2F;llvm-project&#x2F;blob&#x2F;b7a2ff296352acacdc413d6f3f912e50f90ebb31&#x2F;libcxx&#x2F;include&#x2F;vector#L740-L750&quot;&gt;GitHub Link&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When the &lt;code&gt;_LIBCPP_HAS_NO_ASAN&lt;&#x2F;code&gt; preprocessor macro is not defined it has some logic for informing ASAN about the contiguous region of a vector as well as the contiguous region that&#x27;s allocated but yet-unused. The preprocessor macro is only defined when:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#    if !__has_feature(address_sanitizer)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#      define _LIBCPP_HAS_NO_ASAN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#    endif&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;llvm&#x2F;llvm-project&#x2F;blob&#x2F;7ca3444fba7344b375f147b77252adbf71f464e0&#x2F;libcxx&#x2F;include&#x2F;__config#LL479-L481C11&quot;&gt;GitHub Link&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;So why the hell aren&#x27;t we getting this enlightenment? We never defined it ourselves.&lt;&#x2F;p&gt;
&lt;p&gt;I don&#x27;t even remember why I tried this, but it seems you need to explicitly pass &lt;code&gt;-stdlib=libc++&lt;&#x2F;code&gt; and just like magic, it works. Our example for an &lt;code&gt;std::vector&lt;&#x2F;code&gt; will now detect the small OOBR with this flag:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;=================================================================&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;==1==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000075 at pc 0x5640917cd227 bp 0x7ffe3ad2ee30 sp 0x7ffe3ad2e600&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;READ of size 8 at 0x602000000075 thread T0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #0 0x5640917cd226 in __asan_memcpy &#x2F;root&#x2F;llvm-project&#x2F;compiler-rt&#x2F;lib&#x2F;asan&#x2F;asan_interceptors_memintrinsics.cpp:22:3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #1 0x56409180aa25 in main &#x2F;app&#x2F;example.cpp:17:5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #2 0x7f35ef2f1082 in __libc_start_main (&#x2F;lib&#x2F;x86_64-linux-gnu&#x2F;libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #3 0x56409174935d in _start (&#x2F;app&#x2F;output.s+0x2135d)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;godbolt.org&#x2F;z&#x2F;ao64GcT7f&quot;&gt;https:&#x2F;&#x2F;godbolt.org&#x2F;z&#x2F;ao64GcT7f&lt;&#x2F;a&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;There are some downsides to this:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;std::vector&lt;&#x2F;code&gt; is the only container with this enlightenment. But it does automatically update the poisoned region whenever we insert, remove, or clear the elements which is very nice.&lt;&#x2F;li&gt;
&lt;li&gt;Our &lt;code&gt;std::string&lt;&#x2F;code&gt; example still doesn&#x27;t detect the OOBR with this compiler flag: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;godbolt.org&#x2F;z&#x2F;3bj6nnGxG&quot;&gt;https:&#x2F;&#x2F;godbolt.org&#x2F;z&#x2F;3bj6nnGxG&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;You may not want to enable this if you have modules you cannot compile with this flag that may share an &lt;code&gt;std::vector&lt;&#x2F;code&gt;. The module that&#x27;s not enlightened would not poison memory correctly, leading to false-positives. There may be ABI compatability issues as well.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;code-level-fix&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#code-level-fix&quot; aria-label=&quot;Anchor link for: code-level-fix&quot;
    &gt;#&lt;&#x2F;a
&gt;
Code-Level Fix&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;sanitizers&#x2F;wiki&#x2F;AddressSanitizerManualPoisoning&quot;&gt;Google&#x27;s ASAN wiki&lt;&#x2F;a&gt; provides documentation for how to manually poison memory yourself using &lt;code&gt;ASAN_POISON_MEMORY_REGION(addr, size)&lt;&#x2F;code&gt; and &lt;code&gt;ASAN_UNPOISON_MEMORY_REGION(addr, size)&lt;&#x2F;code&gt;. We can use this as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; __has_feature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;address_sanitizer&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;||&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; defined&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;__SANITIZE_ADDRESS__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#include&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;sanitizer&#x2F;asan_interface.h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#endif&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;const uint8_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt;extra_start &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() +&lt;&#x2F;span&gt;&lt;span&gt; fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;size_t&lt;&#x2F;span&gt;&lt;span&gt; extra_len &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;capacity&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() -&lt;&#x2F;span&gt;&lt;span&gt; fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; __has_feature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;address_sanitizer&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;||&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt; defined&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;__SANITIZE_ADDRESS__&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;ASAN_POISON_MEMORY_REGION&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;extra_start&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; extra_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#endif&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Or if for some reason you don&#x27;t want to pull in the ASAN interface you could just copy data to a vector with the appropriate pre-allocated size:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;std&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span&gt;vector&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;uint8_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; copied&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;copied&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;reserve&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;());&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;std&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;copy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;begin&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fuzzed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;end&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;    std&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;::&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;back_inserter&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;copied&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;assert_eq&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;copied&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;capacity&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(),&lt;&#x2F;span&gt;&lt;span&gt; copied&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;())&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Copying data sucks, but do what works for you. &lt;em&gt;Note:&lt;&#x2F;em&gt; avoid using &lt;code&gt;std::vector::shrink_to_fit()&lt;&#x2F;code&gt;. Per &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.cppreference.com&#x2F;w&#x2F;cpp&#x2F;container&#x2F;vector&#x2F;shrink_to_fit&quot;&gt;cppreference&lt;&#x2F;a&gt;, &quot;It depends on the implementation whether the request is fulfilled.&quot;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;other-tricks&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#other-tricks&quot; aria-label=&quot;Anchor link for: other-tricks&quot;
    &gt;#&lt;&#x2F;a
&gt;
Other Tricks&lt;&#x2F;h2&gt;
&lt;p&gt;While I have your attention I wanted to call out some other things you can do to improve your ability to find bugs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;failfast&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#failfast&quot; aria-label=&quot;Anchor link for: failfast&quot;
    &gt;#&lt;&#x2F;a
&gt;
Failfast&lt;&#x2F;h3&gt;
&lt;p&gt;If you have an abstraction that&#x27;s intended to safely handle memory, why wait for your test or fuzzing harness to find the bug? For example, in my opinion a &lt;code&gt;span&lt;&#x2F;code&gt; implementation should never be given an invalid memory range. We can enforce this at its constructor by checking if the provided memory region is poisoned and trigger a controlled crash:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;#include&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;sanitizer&#x2F;asan_interface.h&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;template&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;typename&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; T&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;class&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; span&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;T&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    span&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;T&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; size_t&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; count&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;__asan_region_is_poisoned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(static_cast&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*&amp;gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;),&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; count &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;* sizeof(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;T&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;))) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;            assert&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(false);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;sanitizer-recovery&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#sanitizer-recovery&quot; aria-label=&quot;Anchor link for: sanitizer-recovery&quot;
    &gt;#&lt;&#x2F;a
&gt;
Sanitizer Recovery&lt;&#x2F;h3&gt;
&lt;p&gt;Whenever you repro a bug with ASAN, try to remember to compile with &lt;code&gt;-fsanitize-recover=address&lt;&#x2F;code&gt;. This will essentially allow the application to recover and continue running when ASAN triggers a violation.&lt;&#x2F;p&gt;
&lt;p&gt;It may seem like a strange choice, but let&#x27;s say you have a small out-of-bounds read that looks relatively boring. That bug may be hiding something much juicier that&#x27;s triggered &lt;em&gt;only&lt;&#x2F;em&gt; when the OOBR occurs! &lt;code&gt;-fsanitize-recover=address&lt;&#x2F;code&gt; will allow the application to run until either a hard fault occurs or the application exits, but will still print any ASAN violation that occurs along the way.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;closing-thoughts&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#closing-thoughts&quot; aria-label=&quot;Anchor link for: closing-thoughts&quot;
    &gt;#&lt;&#x2F;a
&gt;
Closing Thoughts&lt;&#x2F;h2&gt;
&lt;p&gt;ASAN is a very powerful tool, but has limitations on what it can provide you by default. When using abstractions that allocate memory for you, keep in mind that they may reduce ASAN&#x27;s effectiveness. The examples shown here were exclusively C++ examples, but can be easily applied to other languages as well.&lt;&#x2F;p&gt;
&lt;p&gt;Rust, for example, has zero ASAN englightenment at the time of this blog post. That means &lt;code&gt;unsafe { }&lt;&#x2F;code&gt; code manually reading from a &lt;code&gt;Vec&amp;lt;T&amp;gt;&lt;&#x2F;code&gt;&#x27;s data pointer or passing the pointer across an FFI boundary may run into similar false-negatives. Ditto for the &lt;code&gt;String&lt;&#x2F;code&gt; type, &lt;code&gt;OSString&lt;&#x2F;code&gt;, etc.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Reverse Engineering Yaesu FT-70D Firmware Encryption</title>
        <published>2021-12-27T00:00:00+00:00</published>
        <updated>2021-12-27T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://landaire.net/reversing-yaesu-firmware-encryption/"/>
        <id>https://landaire.net/reversing-yaesu-firmware-encryption/</id>
        
        <content type="html" xml:base="https://landaire.net/reversing-yaesu-firmware-encryption/">&lt;h2 id=&quot;background&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#background&quot; aria-label=&quot;Anchor link for: background&quot;
    &gt;#&lt;&#x2F;a
&gt;
Background&lt;&#x2F;h2&gt;
&lt;p&gt;Ham radios are a fun way of learning how the radio spectrum works, and more importantly: they&#x27;re embedded devices that may run weird chips&#x2F;firmware! I got curious how easy it&#x27;d be to hack my Yaesu FT-70D, so I started doing some research. The only existing resource I could find for Yaesu radios was &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;amateurradio&#x2F;comments&#x2F;cwoxvv&#x2F;yaesu_ft1dr_custom_firmware&#x2F;&quot;&gt;someone who posted about custom firmware for their Yaesu FT1DR&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The Reddit poster mentioned that if you go through the firmware update process via USB, the radio exposes its Renesas H8SX microcontroller and can have its flash modified using the Renesas SDK. This was a great start and looked promising, but the SDK wasn&#x27;t trivial to configure and I wasn&#x27;t sure if it could even dump the firmware... so I didn&#x27;t use it for very long.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;other-avenues&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#other-avenues&quot; aria-label=&quot;Anchor link for: other-avenues&quot;
    &gt;#&lt;&#x2F;a
&gt;
Other Avenues&lt;&#x2F;h2&gt;
&lt;p&gt;Yaesu provides a Windows application on their website that can be used to update a radio&#x27;s firmware over USB:&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;firmware_page.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;firmware_page.04f1c2d731a66b56.png&quot;
        alt=&quot;&quot;
        width=&quot;477&quot;
        height=&quot;500&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;The zip contains the following files:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1.2 MB  Wed Nov  8 14:34:38 2017  FT-70D_ver111(USA).exe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;682 KB  Tue Nov 14 00:00:00 2017  FT-70DR_DE_Firmware_Update_Information_ENG_1711-B.pdf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;8 MB  Mon Apr 23 00:00:00 2018  FT-70DR_DE_MAIN_Firmware_Ver_Up_Manual_ENG_1804-B.pdf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3.2 MB  Fri Jan  6 17:54:44 2012  HMSEUSBDRIVER.exe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;160 KB  Sat Sep 17 15:14:16 2011  RComms.dll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;61 KB  Tue Oct 23 17:02:08 2012  RFP_USB_VB.dll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1.7 MB  Fri Mar 29 11:54:02 2013  vcredist_x86.exe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;I&#x27;m going to assume that the file specific to the FT-70D, &quot;FT-70D_ver111(USA).exe&quot;, will likely contain our firmware image. A PE file (.exe) can contain binary resources in the &lt;code&gt;.rsrc&lt;&#x2F;code&gt; section -- let&#x27;s see what this file contains using &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;horsicq&#x2F;XPEViewer&quot;&gt;XPEViewer&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;exe_resources.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;exe_resources.eb5799636ce0b537.png&quot;
        alt=&quot;&quot;
        width=&quot;800&quot;
        height=&quot;538&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;Resources fit into one of many different &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;windows&#x2F;win32&#x2F;menurc&#x2F;resource-types&quot;&gt;resource types&lt;&#x2F;a&gt;, but a firmware image would likely be put into a custom type. What&#x27;s this last entry, &quot;23&quot;? Expanding that node we have a couple of interesting items:&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;start_update.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;start_update.fd44b49d8f5a99d8.png&quot;
        alt=&quot;&quot;
        width=&quot;800&quot;
        height=&quot;538&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;&lt;code&gt;RES_START_DIALOG&lt;&#x2F;code&gt; is a custom string the updater shows when preparing an update, so we&#x27;re in the right area!&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;res_update_info.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;res_update_info.800caa6b65c3a1dc.png&quot;
        alt=&quot;&quot;
        width=&quot;800&quot;
        height=&quot;538&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;&lt;code&gt;RES_UPDATE_INFO&lt;&#x2F;code&gt; looks like just binary data -- perhaps this is our firmware image? Unfortunately looking at the &quot;Strings&quot; tab in XPEViewer or running the &lt;code&gt;strings&lt;&#x2F;code&gt; utility over this data doesn&#x27;t yield anything legible. The firmware image is likely encrypted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reverse-engineering-the-binary&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#reverse-engineering-the-binary&quot; aria-label=&quot;Anchor link for: reverse-engineering-the-binary&quot;
    &gt;#&lt;&#x2F;a
&gt;
Reverse Engineering the Binary&lt;&#x2F;h2&gt;
&lt;p&gt;Let&#x27;s load the update utility into our disassembler of choice to figure out how the data is encrypted. I&#x27;ll be using IDA Pro, but Ghidra (free!), radare2 (free!), or Binary Ninja are all great alternatives. Where possible in this article I&#x27;ll try to show my rewritten code in C since it&#x27;ll be a closer match to the decompiler and machine code output.&lt;&#x2F;p&gt;
&lt;p&gt;A good starting point is the the string we saw above, &lt;code&gt;RES_UPDATE_INFO&lt;&#x2F;code&gt;. Windows applications load resources by calling one of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;windows&#x2F;win32&#x2F;api&#x2F;winbase&#x2F;nf-winbase-findresourcea&quot;&gt;&lt;code&gt;FindResource*&lt;&#x2F;code&gt; APIs&lt;&#x2F;a&gt;. &lt;code&gt;FindResourceA&lt;&#x2F;code&gt; has the following parameters:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;HMODULE&lt;&#x2F;code&gt;, a handle to the module to look for the resource in.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;lpName&lt;&#x2F;code&gt;, the resource name.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;lpType&lt;&#x2F;code&gt;, the resource type.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In our disassembler we can find references to the &lt;code&gt;RES_UPDATE_INFO&lt;&#x2F;code&gt; string and look for calls to &lt;code&gt;FindResourceA&lt;&#x2F;code&gt; with this string as an argument in the &lt;code&gt;lpName&lt;&#x2F;code&gt; position.&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;update_info_xrefs.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;update_info_xrefs.ad5bc7241aaf966e.png&quot;
        alt=&quot;&quot;
        width=&quot;800&quot;
        height=&quot;314&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;We find a match in a function which happens to find&#x2F;load &lt;em&gt;all&lt;&#x2F;em&gt; of these custom resources under type &lt;code&gt;23&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;load_resource_decompiler_output.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;load_resource_decompiler_output.ed358a98d7f4ab3b.png&quot;
        alt=&quot;&quot;
        width=&quot;800&quot;
        height=&quot;609&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;We know where the data is loaded by the application, so now we need to see how it&#x27;s used. Doing static analysis from this point may be more work than it&#x27;s worth if the data isn&#x27;t operated on immediately. To speed things up I&#x27;m going to use a debugger&#x27;s assistance. I used WinDbg&#x27;s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;windows-hardware&#x2F;drivers&#x2F;debugger&#x2F;time-travel-debugging-overview&quot;&gt;Time Travel Debugging&lt;&#x2F;a&gt; to record an execution trace of the updater while it updates my radio. TTD is an invaluable tool and I&#x27;d highly recommend using it when possible. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;rr-project.org&#x2F;&quot;&gt;rr&lt;&#x2F;a&gt; is an alternative for non-Windows platforms.&lt;&#x2F;p&gt;
&lt;p&gt;The decompiler output shows this function copies the &lt;code&gt;RES_UPDATE_INFO&lt;&#x2F;code&gt; resource to a dynamically allocated buffer. The &lt;code&gt;qmemcpy()&lt;&#x2F;code&gt; is inlined and represented by a &lt;code&gt;rep movsd&lt;&#x2F;code&gt; instruction in the disassembly, so we need to break at this instruction and examine the &lt;code&gt;edi&lt;&#x2F;code&gt; register&#x27;s (destination address) value. I set a breakpoint by typing &lt;code&gt;bp 0x406968&lt;&#x2F;code&gt; in the command window, allow the application to continue running, and when it breaks we can see the &lt;code&gt;edi&lt;&#x2F;code&gt; register value is &lt;code&gt;0x2be5020&lt;&#x2F;code&gt;. We can now set a memory access breakpoint at this address using &lt;code&gt;ba r4 0x2be5020&lt;&#x2F;code&gt; to break whenever this data is read.&lt;&#x2F;p&gt;
&lt;p&gt;Our breakpoint is hit at &lt;code&gt;0x4047DC&lt;&#x2F;code&gt; -- back to the disassembler. In IDA you can press &lt;code&gt;G&lt;&#x2F;code&gt; and enter this address to jump to it. We&#x27;re finally at what looks like the data processing function:&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;deobfuscate_function.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;deobfuscate_function.70d489a87307371e.png&quot;
        alt=&quot;&quot;
        width=&quot;800&quot;
        height=&quot;367&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;We broke when dereferencing &lt;code&gt;v2&lt;&#x2F;code&gt; and IDA has automatically named the variable it&#x27;s being assigned to as &lt;code&gt;Time&lt;&#x2F;code&gt;. The &lt;code&gt;Time&lt;&#x2F;code&gt; variable is passed to another function which formats it as a string with &lt;code&gt;%Y%m%d%H%M%S&lt;&#x2F;code&gt;. Let&#x27;s clean up the variables to reflect what we know:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; __thiscall &lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;sub_4047B0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;encrypted_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  BOOL v3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; ebx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;time_string&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+Ch] [ebp-320h] BYREF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+10h] [ebp-31Ch] BYREF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;  __time64_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; Time&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+14h] [ebp-318h] BYREF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;__thiscall &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;**&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+1Ch] [ebp-310h]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+328h] [ebp-4h]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;  &#x2F;&#x2F; rename v2 to encrypted_data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  encrypted_data &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; **)(*((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_DWORD &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;AfxGetModuleState&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;() +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 160&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  Time &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;encrypted_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;  &#x2F;&#x2F; rename this function and its 2nd parameter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;  format_timestamp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;Time&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;time_string&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;%Y%m&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;%d&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;%H%M&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;%S&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v10 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v7 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v9 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; off_4244A0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;  sub_4082C0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;time_string&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; sub_408350&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;encrypted_data &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x100000&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; this &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 92&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x100000&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v4 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; time_string &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v9 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; off_4244A0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v10 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; _InterlockedDecrement&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;volatile signed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;time_string &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) &amp;lt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    (*(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;__stdcall &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;**)(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *))(**(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_DWORD &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;**)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v4 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;))(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The timestamp string is passed to &lt;code&gt;sub_4082c0&lt;&#x2F;code&gt; on line 20 and the remainder of the update image is passed to &lt;code&gt;sub_408350&lt;&#x2F;code&gt; on line 21. I&#x27;m going to focus on &lt;code&gt;sub_408350&lt;&#x2F;code&gt; since I only care about the firmware data right now and based on how this function is called I&#x27;d wager its signature is something like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt;status_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; sub_408350&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;uint8_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;input&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; size_t&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; input_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; uint8_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;output&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; output_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; size_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;out_data_processed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Let&#x27;s see what it does:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; __stdcall &lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;sub_408350&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;a1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; a3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; a4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _DWORD &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;a5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; edx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; ebp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  unsigned int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; ecx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; al&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v13&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+10h] [ebp-54h]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span&gt; v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+20h] [ebp-44h] BYREF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v7 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;  memset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, sizeof(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; a2 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;LABEL_13:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;a5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;  else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v8 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v8 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v13 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x40&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v10 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;a1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;a1 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v10 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x40&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v10 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v10 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v10 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v10 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v10 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v10 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        ++&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;a1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;      sub_407980&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v8 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;LABEL_12:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v13 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        goto&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; LABEL_13&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v13&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    v11 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      --&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v7 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; a4 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;101&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;a3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;++) =&lt;&#x2F;span&gt;&lt;span&gt; v11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                      * (&lt;&#x2F;span&gt;&lt;span&gt;v11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                 * (&lt;&#x2F;span&gt;&lt;span&gt;v11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                            * (&lt;&#x2F;span&gt;&lt;span&gt;v11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                       * (&lt;&#x2F;span&gt;&lt;span&gt;v11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                  * (&lt;&#x2F;span&gt;&lt;span&gt;v11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                             * (*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v11 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;| (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v11 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;))))))))))))));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v11 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ( !&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v8 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        goto&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; LABEL_12&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;I think we&#x27;ve found our function that starts decrypting the firmware! To confirm, we want to see what the &lt;code&gt;output&lt;&#x2F;code&gt; parameter&#x27;s data looks like before and after this function is called. I set a breakpoint in the debugger at the address where it&#x27;s called (&lt;code&gt;bp 0x404842&lt;&#x2F;code&gt;) and put the value of the &lt;code&gt;edi&lt;&#x2F;code&gt; register (&lt;code&gt;0x2d7507c&lt;&#x2F;code&gt;) in WinDbg&#x27;s memory window.&lt;&#x2F;p&gt;
&lt;p&gt;Here&#x27;s the data before:&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;data_before.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;data_before.b3909a2025b89ba1.png&quot;
        alt=&quot;&quot;
        width=&quot;648&quot;
        height=&quot;789&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;After stepping over the function call:&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;data_after.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;data_after.7ab8bc7523fb6c44.png&quot;
        alt=&quot;&quot;
        width=&quot;646&quot;
        height=&quot;800&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;We can dump this data to a file using the following command:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.writemem C:\users\lander\documents\maybe_deobfuscated.bin 0x2d7507c L100000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;010 Editor has a built-in strings utility (Search &amp;gt; Find Strings...) and if we scroll down a bit in the results, we have real strings that appear in my radio!&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;hex_editor_strings.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;hex_editor_strings.21f4f024c6f70e82.png&quot;
        alt=&quot;&quot;
        width=&quot;800&quot;
        height=&quot;751&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;At this point if we were just interested in getting the plaintext firmware we could stop messing with the binary and &lt;a href=&quot;https:&#x2F;&#x2F;landaire.net&#x2F;reversing-yaesu-firmware-encryption&#x2F;#loading-the-firmware-in-ida-pro&quot;&gt;load the firmware into IDA Pro&lt;&#x2F;a&gt;... but I want to know how this encryption works.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;encryption-details&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#encryption-details&quot; aria-label=&quot;Anchor link for: encryption-details&quot;
    &gt;#&lt;&#x2F;a
&gt;
Encryption Details&lt;&#x2F;h2&gt;
&lt;p&gt;Just to recap from the last section:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;We&#x27;ve identified our data processing routine (let&#x27;s call this function &lt;code&gt;decrypt_update_info&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;We know that the first 4 bytes of the update data are a Unix timestamp that&#x27;s formatted as a string and used for an unknown purpose.&lt;&#x2F;li&gt;
&lt;li&gt;We know which function begins decrypting our firmware image.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;data-decryption&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#data-decryption&quot; aria-label=&quot;Anchor link for: data-decryption&quot;
    &gt;#&lt;&#x2F;a
&gt;
Data Decryption&lt;&#x2F;h3&gt;
&lt;p&gt;Let&#x27;s look at the firmware image decryption routine with some renamed variables:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; __thiscall &lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;decrypt_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;encrypted_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        int&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; encrypted_data_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;output_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        int&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; output_data_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _DWORD &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;bytes_written&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; data_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; edx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; output_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; ebp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; block_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; esi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  unsigned int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; ecx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; encrypted_byte&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; al&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;idata&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; remaining_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+10h] [ebp-54h]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span&gt; inflated_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+20h] [ebp-44h] BYREF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  data_len &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; encrypted_data_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  output_index &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;  memset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;inflated_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, sizeof(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;inflated_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; encrypted_data_len &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;LABEL_13:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;bytes_written &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; output_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;  else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      block_size &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; data_len&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; data_len &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        block_size &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      remaining_data &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; data_len &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; block_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; inflate 1 byte of input data to 8 bytes of its bit representation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x40&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        encrypted_byte &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;encrypted_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        inflated_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;encrypted_data &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        inflated_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;encrypted_byte &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x40&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        inflated_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;encrypted_byte &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        inflated_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;encrypted_byte &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        inflated_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;encrypted_byte &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        inflated_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;encrypted_byte &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        inflated_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;encrypted_byte &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) !=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        inflated_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; encrypted_byte &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        ++&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;encrypted_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; do something with the inflated data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;      sub_407980&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; inflated_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; block_size &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        break&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;LABEL_12:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; remaining_data &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        goto&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; LABEL_13&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      data_len &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; remaining_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; deflate the data back to bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    idata &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;inflated_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      --&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;block_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; output_index &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; output_data_len &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;101&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      output_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;output_index&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;++] =&lt;&#x2F;span&gt;&lt;span&gt; idata&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                              * (&lt;&#x2F;span&gt;&lt;span&gt;idata&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                           * (&lt;&#x2F;span&gt;&lt;span&gt;idata&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                        * (&lt;&#x2F;span&gt;&lt;span&gt;idata&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                     * (&lt;&#x2F;span&gt;&lt;span&gt;idata&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                                  * (&lt;&#x2F;span&gt;&lt;span&gt;idata&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;idata &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;| (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;idata &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;))))))))))))));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      idata &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ( !&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;block_size &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        goto&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; LABEL_12&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At a high level this routine:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Allocates a 64-byte scratch buffer&lt;&#x2F;li&gt;
&lt;li&gt;Checks if there&#x27;s any data to process. If not, set the output variable &lt;code&gt;out_data_processed&lt;&#x2F;code&gt; to the number of bytes processed and return 0x0 (&lt;code&gt;STATUS_SUCCESS&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Loop over the input data in 8-byte chunks and inflate each byte to its bit representation.&lt;&#x2F;li&gt;
&lt;li&gt;After the 8-byte chunk is inflated, call &lt;code&gt;sub_407980&lt;&#x2F;code&gt; with the scratch buffer and &lt;code&gt;0&lt;&#x2F;code&gt; as arguments.&lt;&#x2F;li&gt;
&lt;li&gt;Loop over the scratch buffer and reassemble 8 sequential bits as 1 byte, then set the byte at the appropriate index in the output buffer.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Lots going on here, but let&#x27;s take a look at step #3. If we take the bytes &lt;code&gt;0xAA&lt;&#x2F;code&gt; and &lt;code&gt;0x77&lt;&#x2F;code&gt; which have bit representations of &lt;code&gt;0b1010_1010&lt;&#x2F;code&gt; and &lt;code&gt;0b0111_1111&lt;&#x2F;code&gt; respectively and inflate them to a 16-byte array using the algorithm above, we end up with:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |    | 8 | 9 | A | B | C | D | E | F |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|---|---|---|---|---|---|---|---|----|---|---|---|---|---|---|---|---|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |    | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This routine does this process over 8 bytes at a time and completely fills the 64-byte scratch buffer with 1s and 0s just like the table above.&lt;&#x2F;p&gt;
&lt;p&gt;Now let&#x27;s look at step #4 and see what&#x27;s going on in &lt;code&gt;sub_407980&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;__thiscall &lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;sub_407980&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; int&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt; a3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;  &#x2F;&#x2F; long list of stack vars removed for clarity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v4 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; a3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  v32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v28 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v31 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;  do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;; *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v33 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v18 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v7 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ( !&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v7 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v8 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v7 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^&lt;&#x2F;span&gt;&lt;span&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E50&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v9 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      *(&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v34 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ( !&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v9 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v10 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v9 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^&lt;&#x2F;span&gt;&lt;span&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E51&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v11 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      *(&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v35 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ( !&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v11 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v12 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v11 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^&lt;&#x2F;span&gt;&lt;span&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E52&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v13 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      *(&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v36 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v12&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ( !&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v13 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v14 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v13 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^&lt;&#x2F;span&gt;&lt;span&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E53&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v15 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ( !&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v15 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v16 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v15 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^&lt;&#x2F;span&gt;&lt;span&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E54&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v17 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ( !&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v17 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v18 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v17 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^&lt;&#x2F;span&gt;&lt;span&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E55&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;dword_424E80&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                    + (((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v34 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v35 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v36 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v37 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;dword_424F80&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                    + (((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                           * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                           +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                                 * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                                 +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;dword_425080&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                    + (((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;12&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                            * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;13&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                            +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                                  +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;11&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;dword_425180&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                    + (((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;18&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                             * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;19&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                             +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;17&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;dword_425280&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                    + (((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;24&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                             * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;25&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                             +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;21&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;22&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;23&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;dword_425380&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                    + (((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;30&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;26&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                             * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                             +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;27&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;dword_425480&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                    + (((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;36&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                             * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;37&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                             +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;33&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;34&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;35&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    v19 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)(&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;unk_425681 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;- (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_UNKNOWN &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    v20 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;unk_425680 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;- (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_UNKNOWN &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    v33 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;dword_425580&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                 + (((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;42&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                          * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;43&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                          +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                                * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;39&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                                                                                                +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;40&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;41&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v4 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v30 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;^= *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] ^= *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v19&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_DWORD&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] ^= *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;unk_425682 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;- (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_UNKNOWN &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] ^= *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;byte_425683 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        --&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v30&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v30 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v29 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v24 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v22 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;^ *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v22&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v24&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v25 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^ *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_DWORD&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v19 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v25&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v26 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;30&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;30&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^ *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;unk_425682 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;- (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_UNKNOWN &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;a2 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v26&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v27 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^ *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;byte_425683 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; a2 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v27&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        --&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v29 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; a3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; v32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    v4 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v31 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    v23 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v31 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;lt;= -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    ++&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    --&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;  while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ( !&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v23 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Oof. This is substantially more complicated but looks like the meat of the decryption algorithm. We&#x27;ll refer to this function, &lt;code&gt;sub_407980&lt;&#x2F;code&gt;, as &lt;code&gt;decrypt_data&lt;&#x2F;code&gt; from here on out. We can see what may be an immediate roadblock: this function takes in a C++ &lt;code&gt;this&lt;&#x2F;code&gt; pointer (line 5) and performs bitwise operations on one of its members (line 18, 23, etc.). For now let&#x27;s call this class member &lt;code&gt;key&lt;&#x2F;code&gt; and come back to it later.&lt;&#x2F;p&gt;
&lt;p&gt;This function is the perfect example of decompilers emitting less than ideal code as a result of compiler optimizations&#x2F;code reordering. For me, TTD was essential for following how data flows through this function. It took a few hours of banging my head against IDA and WinDbg to understand, but this function can be broken up into 3 high-level phases:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Building a 48-byte buffer containing our key material XOR&#x27;d with data from a static table.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  int&lt;&#x2F;span&gt;&lt;span&gt; v33&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  unsigned&lt;&#x2F;span&gt;&lt;span&gt; __int8 v34&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+44h] [ebp-34h]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  unsigned&lt;&#x2F;span&gt;&lt;span&gt; __int8 v35&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+45h] [ebp-33h]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  unsigned&lt;&#x2F;span&gt;&lt;span&gt; __int8 v36&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+46h] [ebp-32h]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  unsigned&lt;&#x2F;span&gt;&lt;span&gt; __int8 v37&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+47h] [ebp-31h]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span&gt; v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;44&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+48h] [ebp-30h]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt; 7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;  v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;  v4 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;  v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; a3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;11&lt;&#x2F;span&gt;&lt;span&gt;  v32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;  v28 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;13&lt;&#x2F;span&gt;&lt;span&gt;  v31 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;14&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;  do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;15&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; The end statement of this loop is strange -- it&amp;#39;s writing a byte somewhere? come back&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;17&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; to this later&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;18&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;; *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v33 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v18 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;19&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; v28 Starts at 0 but is incremented by 1 during each iteration of the outer `while` loop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;21&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v7 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;22&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; v5 is our last argument which was 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;23&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ( !&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;24&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; overwrite v7 with v4, which begins at 15 but is decremented by 1 during each iteration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;25&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; of the outer `while` loop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;26&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v7 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;27&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; left-hand side of the xor, *(_BYTE *)(i + 48 * v7 + v3 + 4)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F;     v3 in this context is our `this` pointer + 4, giving us *(_BYTE *)(i + (48 * v7) + this-&amp;gt;maybe_key)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F;     so the left-hand side of the xor is likely indexing into our key material:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;30&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F;     this-&amp;gt;maybe_key[i + 48 * loop_multiplier]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; right-hand side of the xor, a2[(unsigned __int8)byte_424E50[i] + 31]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;33&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F;     a2 is our input encrypted data, and byte_424E50 is some static data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;34&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;35&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; this full statement can be rewritten as:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;36&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F;     v8 = this-&amp;gt;maybe_key[i + 48 * loop_multiplier] ^ encrypted_data[byte_424E50[i] + 31]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;37&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v8 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v7 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^&lt;&#x2F;span&gt;&lt;span&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E50&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;39&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v9 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;41&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; write the result of `key_data ^ input_data` to a scratch buffer (v34)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;42&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; v34 looks to be declared as the wrong type. v33 is actually a 52-byte buffer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;43&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      *(&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v34 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;44&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;45&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; repeat the above 5 more times&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;46&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ( !&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;47&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v9 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v10 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v9 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^&lt;&#x2F;span&gt;&lt;span&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E51&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;49&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v11 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;50&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      *(&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v35 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;51&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;52&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; snip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;53&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;54&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; v18 gets written to the scratch buffer at the end of the loop...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;55&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v18 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v17 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^&lt;&#x2F;span&gt;&lt;span&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E55&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;56&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;57&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; this was probably the *real* last statement of the for-loop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;58&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;      &#x2F;&#x2F; i.e. for (int i = 0; i &amp;lt; 48; i += 6)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;59&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;giallo-ln&quot; style=&quot;color: #3B3F5180;&quot;&gt;60&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Build a 32-byte buffer containing data from an 0x800-byte static table, with indexes into this table originating from indices built from the buffer in step #1. Combine this 32-byte buffer with the 48-byte buffer in step #1.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; dword_424E80 -- some static data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; (unsigned __int8)v38[0] + 2) -- the original decompiler output has this wrong.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F;     v33 should be a 52-byte buffer which consumes v38, so v38 is actually data set up in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F;     the loop above.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; (32 * v34 + 2) -- v34 should be some data from the above loop as well. This looks like&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F;     a binary shift optimization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; repeat with different multipliers...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; This can be simplified as:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F;     size_t index  = ((v34 &amp;lt;&amp;lt; 5) + 2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F;                     | ((v37[1] &amp;lt;&amp;lt; 4) + 2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F;                     | ((v35 &amp;lt;&amp;lt; 3) + 2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F;                     | ((v36 &amp;lt;&amp;lt; 2) + 2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F;                     | ((v37 &amp;lt;&amp;lt; 1) + 2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F;                     | v38[0]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F;     v32[1] = *(int*)(((char*)&amp;amp;dword_424e80)[index])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;dword_424E80&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;                    + (((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; v34 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; * (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v38&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; v35 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; v36 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) | (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; v37 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; repeat 7 times. each time the reference to dword_424e80 is shifted forward by 0x100.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; note: if you do the math, the next line uses dword_424e80[64]. We shift by 0x100 instead of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; 64 because is misleading because dword_424e80 is declared as an int array -- not a char array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Iterate over the next 8 bytes of the output buffer. For each byte index of the output buffer, index into yet &lt;em&gt;another&lt;&#x2F;em&gt; static 32-byte buffer and use that as the index into the table from step #2. XOR this value with the value at the current index of the output buffer.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F; Not really sure why this calculation works like this. It ends up just being `unk_425681`&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F; when it&amp;#39;s used.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v19 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *)(&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;unk_425681 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;- (&lt;&#x2F;span&gt;&lt;span&gt;_UNKNOWN &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span&gt;a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v20 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;unk_425680 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;- (&lt;&#x2F;span&gt;&lt;span&gt;_UNKNOWN &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span&gt;a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F; v4 is a number that&amp;#39;s decremented on every iteration -- possibly bytes remaining?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span&gt; v4 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; Loop over 8 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v30 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; Start XORing the output bytes with some of the data generated in step 2.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; Cheating here and doing the &amp;quot;draw the rest of the owl&amp;quot;, but if you observe that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; we use `unk_425680` (v20), `unk_425681` (v19), `unk_425682`, and byte_425683, the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; the decompiler generated suboptimal code. We can simplify to be relative to just&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; `unk_425680`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; *result ^= step2_bytes[unk_425680[output_index] - 1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;^= *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; result[1] ^= step2_bytes[unk_425680[output_index] + 1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] ^= *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;v19&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_DWORD&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; result[2] ^= step2_bytes[unk_425680[output_index] + 2]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] ^= *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;unk_425682 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;- (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_UNKNOWN &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; result[3] ^= step2_bytes[unk_425680[output_index] + 3]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] ^= *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;byte_425683 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; Move our our pointer to the output buffer forward by 4 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        --&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v30&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v30 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; loop over 8 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v29 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; grab the byte at 0x20, we&amp;#39;re swapping this later&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v24 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; v22 = *result ^ step2_bytes[unk_425680[output_index] - 1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v22 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;^ *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; I&amp;#39;m not sure why the output buffer pointer is incremented here, but&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; this really makes the code ugly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; Write the byte generated above to offset 0x1c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v22&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; Write the byte at 0x20 to offset 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v24&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;        &#x2F;&#x2F; rinse, repeat with slightly different offsets each time...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v25 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^ *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_DWORD&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v19 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v25&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v26 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;30&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;30&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^ *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;unk_425682 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;- (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_UNKNOWN &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;a2 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v26&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;        v27 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] = *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^ *((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v32 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;byte_425683 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; a2 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        *(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v27&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        --&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;      while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v29 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The inner loop in the &lt;code&gt;else&lt;&#x2F;code&gt; branch above I think is kind of nasty, so here it is reimplemented in Rust:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; in 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;..&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;    &#x2F;&#x2F; we swap the `first` index with the `second`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span&gt;first&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span&gt; second&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0x1c&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;..=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0x1f&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;).&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;zip&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;..&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; original_byte_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; first&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; output_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; original_byte&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; outbuf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;original_byte_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; constant&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; unk_425680&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;output_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; second&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; as&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; usize&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; new_byte&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; outbuf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;output_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; second&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] ^&lt;&#x2F;span&gt;&lt;span&gt; generated_bytes_from_step2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;constant&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; new_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; original_byte_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        outbuf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;new_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span&gt; new_byte&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        outbuf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;output_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; second&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span&gt; original_byte&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output_offset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;key-setup&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#key-setup&quot; aria-label=&quot;Anchor link for: key-setup&quot;
    &gt;#&lt;&#x2F;a
&gt;
Key Setup&lt;&#x2F;h3&gt;
&lt;p&gt;We now need to figure out how our key is set up for usage in the &lt;code&gt;decrypt_data&lt;&#x2F;code&gt; function above. My approach here is to set a breakpoint at the first instruction to use the key data in &lt;code&gt;decrypt_data&lt;&#x2F;code&gt;, which happens to be &lt;code&gt;xor bl, [ecx + esi + 4]&lt;&#x2F;code&gt; at &lt;code&gt;0x4079d3&lt;&#x2F;code&gt;. I know this is where we should break because in the decompiler output the left-hand side of the XOR operation, the key material, will be the &lt;em&gt;second&lt;&#x2F;em&gt; operand in the &lt;code&gt;xor&lt;&#x2F;code&gt; instruction. As a reminder, the decompiler shows the XOR as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;v8 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *(&lt;&#x2F;span&gt;&lt;span&gt;_BYTE &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)(&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; v7 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) ^&lt;&#x2F;span&gt;&lt;span&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E50&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The breakpoint is hit and the address we&#x27;re loading from is &lt;code&gt;0x19f5c4&lt;&#x2F;code&gt;. We can now lean on TTD to help us figure out where this data was last written. Set a 1-byte memory write breakpoint at this address using &lt;code&gt;ba w1 0x19f5c4&lt;&#x2F;code&gt; and press the &lt;code&gt;Go Back&lt;&#x2F;code&gt; button. If you&#x27;ve never used TTD before, this operates exactly as &lt;code&gt;Go&lt;&#x2F;code&gt; would except &lt;em&gt;backwards&lt;&#x2F;em&gt; in the program&#x27;s trace. In this case it will execute backward until either a breakpoint is hit, interrupt is generated, or we reach the start of the program.&lt;&#x2F;p&gt;
&lt;p&gt;Our memory write breakpoint gets triggered at &lt;code&gt;0x4078fb&lt;&#x2F;code&gt; -- a function we haven&#x27;t seen before. The callstack shows that it&#x27;s called not terribly far from the &lt;code&gt;decrypt_update_info&lt;&#x2F;code&gt; routine!&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;set_key&lt;&#x2F;code&gt; (we are here -- function is originally called &lt;code&gt;sub_407850&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sub_4082c0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;decrypt_update_info&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;What&#x27;s &lt;code&gt;sub_4082c0&lt;&#x2F;code&gt;?&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;timestamp_inflation.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;timestamp_inflation.5e46a11b487ec708.png&quot;
        alt=&quot;&quot;
        width=&quot;444&quot;
        height=&quot;248&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;Not a lot to see here except the same function called 4 times, initially with the timestamp string as an argument in position 0, a 64-byte buffer, and bunch of function calls using the return value of the last as its input. The function our debugger just broke into takes only 1 argument, which is the 64-byte buffer used across &lt;em&gt;all&lt;&#x2F;em&gt; of these function calls. So what&#x27;s going on in &lt;code&gt;sub_407e80&lt;&#x2F;code&gt;?&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;inflate_timestamp.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;inflate_timestamp.65ac73080c0654a8.png&quot;
        alt=&quot;&quot;
        width=&quot;712&quot;
        height=&quot;800&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;The bitwise operations that look supsiciously similar to the byte to bit inflation we saw above with the firmware data. After renaming things and performing some loop unrolling, things look like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F; sub_407850&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; inflate_timestamp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;timestamp_str&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;output&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; uint8_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;size_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; output_idx &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; output_idx &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; output_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        uint8_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; ts_byte &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;timestamp_str&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;ts_byte&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;            timestamp_str &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; bit_idx &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; bit_idx &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; bit_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            uint8_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; bit_value &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;ts_byte &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;gt;&amp;gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; bit_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)) &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            output&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;output_idx &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) +&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; bit_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] ^=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; bit_value&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    set_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    decrypt_data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; output&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; timestamp_str&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F; sub_4082c0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; set_key_to_timestamp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;timestamp_str&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    uint8_t&lt;&#x2F;span&gt;&lt;span&gt; key_buf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;64&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    memset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;key_buf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, sizeof(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;key_buf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;str_ptr &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; inflate_timestamp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; timestamp_str&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;key_buf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;static_key_1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    str_ptr &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; inflate_timestamp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; str_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;key_buf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;static_key_2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    str_ptr &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; inflate_timestamp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; str_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;key_buf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;static_key_3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    inflate_timestamp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; str_ptr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;key_buf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;static_key_4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    set_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;key_buf&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The only mystery now is the &lt;code&gt;set_key&lt;&#x2F;code&gt; routine:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; __thiscall &lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;set_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; const void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  _DWORD &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; ebp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; edx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; al&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; al&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; al&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; al&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; eax&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;  char&lt;&#x2F;span&gt;&lt;span&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;56&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt; &#x2F;&#x2F; [esp+Ch] [ebp-3Ch] BYREF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;  qmemcpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; a2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, sizeof(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v2 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;= &amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;unk_424DE0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;  v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; this &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;  do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    v4 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    qmemcpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;],&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x1Bu&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;27&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    v5 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    qmemcpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;], &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;],&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x1Bu&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;55&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ( *&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v2 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;==&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v6 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;      qmemcpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;],&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x1Bu&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;27&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;      v7 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;      qmemcpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;], &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;],&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x1Bu&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;55&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; v7&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      v3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E20&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      v3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E21&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      v3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E22&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      v3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E23&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      v3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E24&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      v3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span&gt; v10&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;unsigned&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; __int8&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span&gt;byte_424E25&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    ++&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;    v3 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;  while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ( (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;v2 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;byte_424E20 &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; result&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function is a bit more straightforward to reimplement:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; set_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;void&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; uint8_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; *&lt;&#x2F;span&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    uint8_t&lt;&#x2F;span&gt;&lt;span&gt; scrambled_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;56&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;    memcpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;scrambled_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, sizeof(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;scrambled_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;size_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        size_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; swap_rounds &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (((&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*)&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;GLOBAL_KEY_ROUNDS_CONFIG&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;            swap_rounds &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;int&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; swap_rounds&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; i&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            uint8_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; temp &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; scrambled_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;            memcpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;scrambled_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;scrambled_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;],&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 27&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            scrambled_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;27&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; temp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;            temp &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; scrambled_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;            memcpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;scrambled_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;28&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;], &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;scrambled_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;29&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;],&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 27&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            scrambled_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;55&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; temp&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;size_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; swap_idx &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; swap_idx &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; swap_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            size_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; scrambled_key_idx &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; GLOBAL_KEY_SWAP_TABLE&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;swap_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] -&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;            size_t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; persistent_key_idx &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt; swap_idx &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;+ (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;*&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            this&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;persistent_key_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;] =&lt;&#x2F;span&gt;&lt;span&gt; scrambled_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F07178;&quot;&gt;scrambled_key_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;putting-everything-together&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#putting-everything-together&quot; aria-label=&quot;Anchor link for: putting-everything-together&quot;
    &gt;#&lt;&#x2F;a
&gt;
Putting Everything Together&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Update data is read from resources&lt;&#x2F;li&gt;
&lt;li&gt;The first 4 bytes of the update data are a Unix timestamp&lt;&#x2F;li&gt;
&lt;li&gt;The timestamp is formatted as a string, has each byte inflated to its bit representation, and decrypted using some static key material as the key. This is repeated 4 times with the output of the previous run used as an input to the next.&lt;&#x2F;li&gt;
&lt;li&gt;The resulting data from step 3 is used as a key for decrypting data.&lt;&#x2F;li&gt;
&lt;li&gt;The remainder of the firmware update image is inflated to its bit representation 8 bytes at a time and uses the dynamic key and 3 other unique static lookup tables to transform the inflated input data.&lt;&#x2F;li&gt;
&lt;li&gt;The result from step 5 is deflated back into its &lt;em&gt;byte&lt;&#x2F;em&gt; representation.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;My decryption utility which completely reimplements this magic in Rust can be found at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;porkchop&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;porkchop&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;loading-the-firmware-in-ida-pro&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#loading-the-firmware-in-ida-pro&quot; aria-label=&quot;Anchor link for: loading-the-firmware-in-ida-pro&quot;
    &gt;#&lt;&#x2F;a
&gt;
Loading the Firmware in IDA Pro&lt;&#x2F;h2&gt;
&lt;p&gt;IDA thankfully supports disassembling the Hitachi&#x2F;Rensas H8SX architecture. If we load our firmware into IDA and select the &quot;Hitachi H8SX advanced&quot; processsor type, use the default options for the &quot;Disassembly memory organization&quot; dialog, then finally choose &quot;H8S&#x2F;2215R&quot; in the &quot;Choose the device name&quot; dialog...:&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;rom_initial_load.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;rom_initial_load.883b3f9fcc2c1b5d.png&quot;
        alt=&quot;&quot;
        width=&quot;800&quot;
        height=&quot;686&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;We don&#x27;t have shit. I&#x27;m not an embedded systems expert, but my friend suggested that the first few DWORDs look like they may belong to a vector table. If we right-click address 0 and select &quot;Double word 0x142A&quot;, we can click on the new variable &lt;code&gt;unk_142A&lt;&#x2F;code&gt; to go to its location. Press &lt;code&gt;C&lt;&#x2F;code&gt; at this location to define it as Code, then press &lt;code&gt;P&lt;&#x2F;code&gt; to create a function at this address:&lt;&#x2F;p&gt;


&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;img&amp;#x2F;yaesu&amp;#x2F;firmware_analyzed.png&quot; data-lightbox&gt;
    &lt;img
        src=&quot;https:&amp;#x2F;&amp;#x2F;landaire.net&amp;#x2F;processed_images&amp;#x2F;firmware_analyzed.7bd41c86909a3a9f.png&quot;
        alt=&quot;&quot;
        width=&quot;800&quot;
        height=&quot;686&quot;
        class=&quot;lightbox-img rounded-lg shadow-sm mx-auto block&quot;
    &#x2F;&gt;
&lt;&#x2F;a&gt;
&lt;p&gt;We can now reverse engineer our firmware :)&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Apple ImageIO Denial of Service</title>
        <published>2016-04-22T15:01:55-07:00</published>
        <updated>2016-04-22T15:01:55-07:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://landaire.net/apple-imageio-dos/"/>
        <id>https://landaire.net/apple-imageio-dos/</id>
        
        <content type="html" xml:base="https://landaire.net/apple-imageio-dos/">&lt;p&gt;Last Updated: April 5, 2017 to address some incompleteness and errors. You can view the revision history &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;landaire.net&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Application Services is a framework in iOS and OS X which provides what&#x27;s known as the Image I&#x2F;O framework. ImageIO itself is a collection of utilities and data types for parsing various image formats. It&#x27;s used in many OS X and iOS applications including:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Tweetbot&lt;&#x2F;li&gt;
&lt;li&gt;Safari&lt;&#x2F;li&gt;
&lt;li&gt;Messages&lt;&#x2F;li&gt;
&lt;li&gt;Mail&lt;&#x2F;li&gt;
&lt;li&gt;Preview&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Some popular applications that &lt;em&gt;do not&lt;&#x2F;em&gt; use ImageIO include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Chrome&lt;&#x2F;li&gt;
&lt;li&gt;Firefox&lt;&#x2F;li&gt;
&lt;li&gt;Telegram&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Given the impact of media processing bugs such as Stagefright I decided that this would be a good target for fuzzing. I created a simple application that uses some various features of ImageIO, grabbed a small PNG I had on my desktop which happened to be a screenshot, and let afl run.&lt;&#x2F;p&gt;
&lt;p&gt;I checked on my fuzzer after 30 minutes and already a crash!&lt;&#x2F;p&gt;
&lt;p&gt;Here&#x27;s the code used: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;landaire&#x2F;63e9a94f197c345335d165a16cea6a64&quot;&gt;Gist&lt;&#x2F;a&gt; (this is almost verbatim Apple&#x27;s ImageIO sample).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note: a tl;dr is available at the bottom&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h1 id=&quot;png-structure&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#png-structure&quot; aria-label=&quot;Anchor link for: png-structure&quot;
    &gt;#&lt;&#x2F;a
&gt;
PNG Structure&lt;&#x2F;h1&gt;
&lt;p&gt;Before I dive into the vulnerability I&#x27;ll talk a little bit about the structure of PNG files. PNGs are comprised of the header and chunks with chunks starting at offset 0x8 in the file. Each chunk contains the chunk type (a 4-character ASCII string), some data, and a CRC32 of that data.&lt;&#x2F;p&gt;
&lt;p&gt;The chunk structure can be represented as the following Go struct:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #FFCB6B;&quot;&gt; Chunk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; struct {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	Length&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; uint32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	Type&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;   [&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt;4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	Data&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;   []&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	CRC&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    uint32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The PNG specification defines 4 &quot;critical&quot; chunk types and 14 &quot;ancillary&quot; chunk types for a total of 18 formally defined types &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;PNG&#x2F;#4Concepts.FormatTypes&quot;&gt;which you can find here&lt;&#x2F;a&gt;. Any chunks not specified here are considered unknown chunks that can be handled by the decoder.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;the-vulnerability&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-vulnerability&quot; aria-label=&quot;Anchor link for: the-vulnerability&quot;
    &gt;#&lt;&#x2F;a
&gt;
The vulnerability&lt;&#x2F;h1&gt;
&lt;p&gt;Inspecting the crash log of the application makes it pretty obvious that we have a null pointer dereference:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Exception Type:  EXC_BAD_ACCESS (SIGSEGV)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Triggered by Thread:  0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The stack trace tells us a little more though:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Thread 0 name:  Dispatch queue: com.apple.main-thread&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Thread 0 Crashed:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0       ImageIO                       	0x18699a618 0x186994000 + 0x6618	&#x2F;&#x2F; read_user_chunk_callback + 0x13c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1       ImageIO                       	0x18699a610 0x186994000 + 0x6610	&#x2F;&#x2F; read_user_chunk_callback + 0x134&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2       ImageIO                       	0x18699a328 0x186994000 + 0x6328	&#x2F;&#x2F; png_handle_unknown + 0x44&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3       ImageIO                       	0x18699961c 0x186994000 + 0x561c	&#x2F;&#x2F; _cg_png_read_info + 0x11c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;4       ImageIO                       	0x186997b38 0x186994000 + 0x3b38	&#x2F;&#x2F; initImagePng + 0x654&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;5       ImageIO                       	0x186996c98 0x186994000 + 0x2c98	&#x2F;&#x2F; makeImagePlus + 0x4e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;6       ImageIO                       	0x186996240 0x186994000 + 0x2240	&#x2F;&#x2F; CGImageSourceCreateImageAtIndex + 0xb8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;7       UIKit                         	0x18ad473d8 0x18abe0000 + 0x1673d8	&#x2F;&#x2F; _UIImageRefFromData + 0x1a8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;8       UIKit                         	0x18aed2ff8 0x18abe0000 + 0x2f2ff8	&#x2F;&#x2F; -[UIImage(UIImagePrivate) _initWithData:preserveScale:cache:] + 0x78&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;9       UIKit                         	0x18ad471fc 0x18abe0000 + 0x1671fc	&#x2F;&#x2F; +[UIImage imageWithData:] + 0x48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;read_user_chunk_callback&lt;&#x2F;code&gt; is where the crash occurs. A quick Google search for this and &lt;code&gt;png_handle_unknown&lt;&#x2F;code&gt; yields some results in libpng. Some more digging around the source code lead me to conclude that Apple uses libpng under the hood for the PNG files and the crashing image has an unknown (non-standard) chunk that&#x27;s related to the crash. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;glennrp&#x2F;libpng&#x2F;blob&#x2F;e744ee13382d810246e94256c488bb7ebc000789&#x2F;pngrutil.c#L2826&quot;&gt;&lt;code&gt;png_handle_unknown&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; will, if &lt;code&gt;PNG_READ_UNKNOWN_CHUNKS_SUPPORTED&lt;&#x2F;code&gt; is enabled, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;glennrp&#x2F;libpng&#x2F;blob&#x2F;e744ee13382d810246e94256c488bb7ebc000789&#x2F;pngrutil.c#L2859-L2865&quot;&gt;call a user function callback&lt;&#x2F;a&gt; for the application to handle the chunk. So &lt;code&gt;read_user_chunk_callback&lt;&#x2F;code&gt; is the name of Apple&#x27;s custom chunk handler.&lt;&#x2F;p&gt;
&lt;p&gt;A quick diff between the input file and crasher revealed that the input file had a chunk with data size of 0. What&#x27;s happening here is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;libpng which is compiled to read unknow chunks hits an unknown chunk&lt;&#x2F;li&gt;
&lt;li&gt;ImageIO has an unknown chunk callback setup&lt;&#x2F;li&gt;
&lt;li&gt;Since the size of the chunk data is 0, libpng gives the callback a null data chunk pointer&lt;&#x2F;li&gt;
&lt;li&gt;The data section is used without first checking the size of the value of the pointer&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Earlier I mentioned that the image I grabbed was some random screenshot I had sitting on my desktop. It turns out that screenshots taken on OS X include a custom &lt;code&gt;iDOT&lt;&#x2F;code&gt; chunk which contain some additional 28 bytes of data. The structure for the
screenshots I took were of form:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;num_entries&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt; uint32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span&gt;usually&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x00000002&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;unk1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span&gt;usually&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x00000000&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;width&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;       uint32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;unk2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span&gt;usually&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0x00000028&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;width&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;       uint32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;width&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;       uint32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;unk3&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(Yes, the width appears to be repeated 3 times)&lt;&#x2F;p&gt;
&lt;p&gt;I couldn&#x27;t figure out what the unknown data is and wasn&#x27;t too motivated to reverse engineer the rest of the function so if anyone reading this has any ideas, please ping me on Twitter (@landaire).&lt;&#x2F;p&gt;
&lt;p&gt;This was the offending chunk which is handled by this callback. Taking any screenshot and setting the size of the &lt;code&gt;iDOT&lt;&#x2F;code&gt; chunk to 0 is enough to trigger the bug.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;impact&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#impact&quot; aria-label=&quot;Anchor link for: impact&quot;
    &gt;#&lt;&#x2F;a
&gt;
Impact&lt;&#x2F;h1&gt;
&lt;p&gt;This bug can be triggered any time a PNG file is being processed. So really, anything that processes the image can be caused to crash. Some examples:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Receiving the malicious image via text message with message previews turned on will crash SpringBoard on iOS&lt;&#x2F;li&gt;
&lt;li&gt;Entering a message thread containing the image will crash the messages app&lt;&#x2F;li&gt;
&lt;li&gt;Opening an email containing the image will crash the mail client&lt;&#x2F;li&gt;
&lt;li&gt;Posting a link to the image will crash some third-party Twitter clients which try to load the image (Tweetbot for example)&lt;&#x2F;li&gt;
&lt;li&gt;Visiting a page containing the image will crash Safari&#x27;s content renderer&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;affected-versions&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#affected-versions&quot; aria-label=&quot;Anchor link for: affected-versions&quot;
    &gt;#&lt;&#x2F;a
&gt;
Affected versions&lt;&#x2F;h1&gt;
&lt;p&gt;The only devices I had available at the time were an iPad on iOS 7.1, my iPhone on iOS 9.0.2, and my Mac on OS X 10.11.2. All of these devices were vulnerable. It&#x27;s reasonable to assume that this bug goes back quite far.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;iOS&lt;&#x2F;th&gt;&lt;th&gt;OS X&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Minimum tested version&lt;&#x2F;td&gt;&lt;td&gt;7.1&lt;&#x2F;td&gt;&lt;td&gt;10.11.1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Fixed version&lt;&#x2F;td&gt;&lt;td&gt;9.3.2&lt;&#x2F;td&gt;&lt;td&gt;10.11.5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h1 id=&quot;other-findings&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#other-findings&quot; aria-label=&quot;Anchor link for: other-findings&quot;
    &gt;#&lt;&#x2F;a
&gt;
Other findings&lt;&#x2F;h1&gt;
&lt;p&gt;In exploring this bug I thought it was useful to test out various applications to see how they would handle this type of invalid image. Since the chunks all contain a CRC32 of the data, you cannot modify the image outright and then upload it to
almost any service. Twitter and imgur were two hosts I tried and they both would not accept the image because of the invalid CRC32. I wrote a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;landaire&#x2F;png-crc-fix&quot;&gt;simple Go utility&lt;&#x2F;a&gt; that iterates the chunks and fixes any
invalid CRCs.&lt;&#x2F;p&gt;
&lt;p&gt;After fixing the chunk both hosts accepted the image just fine. imgur (and likely most other hosts) do not bother to strip unknown chunks so uploading the image to imgur puts those users at risk. Twitter and Facebook on the other hand will re-encode any image as
a JPEG which will obviously remove the malicious chunk.&lt;&#x2F;p&gt;
&lt;p&gt;I think that this is interesting and really important for privacy-concerned people. Before investigating this bug I had not considered additional chunks &lt;em&gt;not&lt;&#x2F;em&gt; being stripped when uploading an image to services. It makes sense, but it seems like this
would be an easy way for vendors to hide additional info about the device which took the image outside of the EXIF-related chunks and have them survive re-encoding.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;timeline&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#timeline&quot; aria-label=&quot;Anchor link for: timeline&quot;
    &gt;#&lt;&#x2F;a
&gt;
Timeline&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;Dec 16, 2015: Reported vulnerability to vendor&lt;&#x2F;li&gt;
&lt;li&gt;Dec 17, 2015: Vendor acknowledged vulnerability&lt;&#x2F;li&gt;
&lt;li&gt;Dec 27, 2015: Posted pic to Twitter to see what would happen&lt;&#x2F;li&gt;
&lt;li&gt;Dec 27, 2015: Vendor said the bug was undergoing triage&lt;&#x2F;li&gt;
&lt;li&gt;Mar 21, 2016 (91 days since disclosure): iOS 9.3 released and bug still not fixed, status update requested&lt;&#x2F;li&gt;
&lt;li&gt;Mar 22, 2016: Vendor notified me that a fix is &quot;in progress&quot;&lt;&#x2F;li&gt;
&lt;li&gt;April 22, 2016: Public disclosure&lt;&#x2F;li&gt;
&lt;li&gt;May 16, 2016: iOS 9.3.2 and macOS 10.11.5 were released, giving this vulnerability CVE-2016-1811&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If you&#x27;d like to have a sample image, you can find it &lt;a href=&quot;&#x2F;img&#x2F;crasher.png&quot;&gt;here&lt;&#x2F;a&gt;. &lt;strong&gt;NOTE&lt;&#x2F;strong&gt; if you are using Safari, your browser&#x27;s renderer process will crash. If you aren&#x27;t, you will see a screenshot of a Kanye tweet.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;tl;dr&lt;&#x2F;strong&gt; a custom PNG chunk with a 0-length data field will trigger null pointer dereference causing the application to crash similar to the
&lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;arstechnica.com&#x2F;apple&#x2F;2013&#x2F;08&#x2F;rendering-bug-crashes-os-x-and-ios-apps-with-string-of-arabic-characters&#x2F;&quot;&gt;CoreText&lt;&#x2F;a&gt; crash from 2013.&lt;&#x2F;p&gt;
&lt;p&gt;shoutouts to my boys ed snowden and james comey&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Finding a CSRF vulnerability in phpBB</title>
        <published>2016-01-25T22:05:08-08:00</published>
        <updated>2016-01-25T22:05:08-08:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://landaire.net/phpbb-3-1-7-security-update/"/>
        <id>https://landaire.net/phpbb-3-1-7-security-update/</id>
        
        <content type="html" xml:base="https://landaire.net/phpbb-3-1-7-security-update/">&lt;p&gt;The phpBB team released phpBB version &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.phpbb.com&#x2F;support&#x2F;documents.php?mode=changelog#v317&quot;&gt;3.1.7-PL1&lt;&#x2F;a&gt;
on Jan 11, 2016 which fixed a CSRF issue I found in the admin control panel BBCode
creation form. Since BBCode is basically whitelisted HTML created by admins this
CSRF vulnerability could allow an attacker to inject arbitrary HTML or JavaScript
into forum posts.&lt;&#x2F;p&gt;
&lt;p&gt;This was my first time looking at phpBB and I was very happy with actually being
able to find something with significant impact within a few hours.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;finding-a-target&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#finding-a-target&quot; aria-label=&quot;Anchor link for: finding-a-target&quot;
    &gt;#&lt;&#x2F;a
&gt;
Finding a target&lt;&#x2F;h2&gt;
&lt;p&gt;A good starting point for understanding the features and flow of phpBB controllers
would be to look at something users would have access to with complex operations
going on. &lt;code&gt;.&#x2F;phpbb&#x2F;phpBB&#x2F;posting.php&lt;&#x2F;code&gt; is a decent starting point since this is the page
users hit when creating topics&#x2F;posts. This controller should have permission checks,
record creation, form submission, and maybe some HTML escaping. At the top of
the file we can see something interesting:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;php&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #464B5D;font-style: italic;&quot;&gt;&#x2F;&#x2F; Grab only parameters needed here&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt;post_id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; request_var&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt;topic_id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;   =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; request_var&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;t&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt;forum_id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;   =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; request_var&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt;draft_id&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;   =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; request_var&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;d&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt;lastclick&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;  =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; request_var&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;lastclick&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt;preview&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;isset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;($&lt;&#x2F;span&gt;&lt;span&gt;_POST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;preview&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;])) ? true : false;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt;save&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;       = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;isset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;($&lt;&#x2F;span&gt;&lt;span&gt;_POST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;save&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;])) ? true : false;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt;load&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;       = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;isset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;($&lt;&#x2F;span&gt;&lt;span&gt;_POST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;load&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;])) ? true : false;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt;confirm&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    = $&lt;&#x2F;span&gt;&lt;span&gt;request&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;is_set_post&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;confirm&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt;cancel&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;     = (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;isset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;($&lt;&#x2F;span&gt;&lt;span&gt;_POST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;cancel&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;]) &amp;amp;&amp;amp; !&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;isset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;($&lt;&#x2F;span&gt;&lt;span&gt;_POST&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;[&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;save&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;])) ? true : false;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Mostly all of the request variables used in this controller are defined a the top
of the file, some of which are taken from this weird &lt;code&gt;request_var()&lt;&#x2F;code&gt; function
which IntelliJ tells me is deprecated. This function is basically a wrapper for
&lt;code&gt;\phpbb\request\request_interface::variable()&lt;&#x2F;code&gt;. Looking at &lt;code&gt;\phpbb\request\request::variable()&lt;&#x2F;code&gt;
it can be seen that this method returns the requested var from some associative array.
The array is the concatenation of the &lt;code&gt;$_POST&lt;&#x2F;code&gt; and &lt;code&gt;$_GET&lt;&#x2F;code&gt; global variables. For those of you
not familiar with PHP these are globals which contain the POST request
and query vars (respectively). All of these variables are also &lt;code&gt;trim()&lt;&#x2F;code&gt;&#x27;d and
type casted to match the type of whatever the default value is.&lt;&#x2F;p&gt;
&lt;p&gt;This is a key bit of information: if we can find some place in a form where a
POST request is made we should also be able to make the request with a GET. Maybe
we should start looking for CSRF bugs?&lt;&#x2F;p&gt;
&lt;h2 id=&quot;how-csrf-tokens-work-in-phpbb&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#how-csrf-tokens-work-in-phpbb&quot; aria-label=&quot;Anchor link for: how-csrf-tokens-work-in-phpbb&quot;
    &gt;#&lt;&#x2F;a
&gt;
How CSRF tokens work in phpBB&lt;&#x2F;h2&gt;
&lt;p&gt;Doing a simple find in file for &quot;form&quot; in IDEA I came across this line:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;php&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;if&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; ($&lt;&#x2F;span&gt;&lt;span&gt;submit&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; check_form_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;posting&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Looking into the &lt;code&gt;check_form_key()&lt;&#x2F;code&gt; function it&#x27;s clear that this is the function
to check the CSRF token (using &lt;code&gt;===&lt;&#x2F;code&gt; mind you)... but it&#x27;s done manually. And
further &lt;em&gt;down&lt;&#x2F;em&gt; the file:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;php&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;add_form_key&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;posting&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;So adding and checking the CSRF token is done manually. This smells like something
that can lead to errors!&lt;&#x2F;p&gt;
&lt;h2 id=&quot;finding-csrf-bugs&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#finding-csrf-bugs&quot; aria-label=&quot;Anchor link for: finding-csrf-bugs&quot;
    &gt;#&lt;&#x2F;a
&gt;
Finding CSRF bugs!&lt;&#x2F;h2&gt;
&lt;p&gt;Let&#x27;s search the project for &lt;code&gt;add_form_key()&lt;&#x2F;code&gt; and &lt;code&gt;check_form_key()&lt;&#x2F;code&gt;. What we&#x27;re
looking for is files that show up in the result for &lt;code&gt;add_form_key()&lt;&#x2F;code&gt; but not for
&lt;code&gt;check_form_key()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The following image is the result of the search for &lt;code&gt;add_form_key()&lt;&#x2F;code&gt; and &lt;code&gt;check_form_key()&lt;&#x2F;code&gt;
respectively, with the admin control panel includes folder expanded:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;img&#x2F;csrf_diff.png&quot; alt=&quot;add_form_key(left) vs check_form_key(right)&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The greater number of &lt;code&gt;check_form_key()&lt;&#x2F;code&gt; calls to &lt;code&gt;add_form_key()&lt;&#x2F;code&gt; calls isn&#x27;t
really concerning since you can check the form key as many times as you&#x27;d like.
What we&#x27;re looking for is places where a form key is added but not checked.
We can see there are two places where calls to &lt;code&gt;check_form_key()&lt;&#x2F;code&gt; are definitely missing:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;acp_bbcode.php&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;acp_extensions.php&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;acp_extensions.php&lt;&#x2F;code&gt; isn&#x27;t too interesting since that just lets admins toggle
showing unstable versions when checking extensions for updates, so the worse a
CSRF vuln here does is allow an attacker to make an admin think their extensions
are outdated.&lt;&#x2F;p&gt;
&lt;p&gt;The check in &lt;code&gt;acp_bbcode.php&lt;&#x2F;code&gt; is of interest though since, although the form
is submitted via POST, the &lt;code&gt;request_var()&lt;&#x2F;code&gt; method is used to retrieve all form
variables. We should be able to create BBCode over GET with a CSRF token omitted!&lt;&#x2F;p&gt;
&lt;p&gt;Here&#x27;s a demonstration of this vulnerability:&lt;&#x2F;p&gt;
&lt;p&gt;{{&amp;lt; youtube 7NsUoE32cyQ &amp;gt;}}&lt;&#x2F;p&gt;
&lt;h2 id=&quot;notes&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#notes&quot; aria-label=&quot;Anchor link for: notes&quot;
    &gt;#&lt;&#x2F;a
&gt;
Notes&lt;&#x2F;h2&gt;
&lt;p&gt;Although this vulnerability can lead to XSS, it&#x27;s really not practical. By default
phpBB enforces re-authentication when admins go to the ACP and gives the admin
a different admin CP session ID. The SID also needs to be present in both the cookie
and query string by default.&lt;&#x2F;p&gt;
&lt;p&gt;In theory a timing attack is possible since session IDs are checked with the equals
operator (&lt;code&gt;$this-&amp;gt;session_id !== $session_id&lt;&#x2F;code&gt;) but this is also not very practical
since sessions are tied to IP, browser, and some other information but most importantly
doing it over the network isn&#x27;t exactly easy.&lt;&#x2F;p&gt;
&lt;p&gt;The only way I see this being practical is if there&#x27;s also an XSS vulnerability
on some admin page that would allow you to inject a script to get the
admin SID from &lt;code&gt;document.location&lt;&#x2F;code&gt; then perform the exploit.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;timeline&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#timeline&quot; aria-label=&quot;Anchor link for: timeline&quot;
    &gt;#&lt;&#x2F;a
&gt;
Timeline&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;July 11, 2015: Reported vulnerability&lt;&#x2F;li&gt;
&lt;li&gt;August 4, 2015: Received response from two different project members requesting
more information&lt;&#x2F;li&gt;
&lt;li&gt;December 23, 2015: Followed-up with project members (never received notification
of response and I sort of forgot about this bug)&lt;&#x2F;li&gt;
&lt;li&gt;December 23, 2015: Vendor confirmed bug&lt;&#x2F;li&gt;
&lt;li&gt;January 11, 2016: Fix released&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>CVE-2016-1902: Symfony SecureRandom</title>
        <published>2016-01-24T15:48:01-08:00</published>
        <updated>2016-01-24T15:48:01-08:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://landaire.net/cve-2016-1902/"/>
        <id>https://landaire.net/cve-2016-1902/</id>
        
        <content type="html" xml:base="https://landaire.net/cve-2016-1902/">&lt;h2 id=&quot;overview&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#overview&quot; aria-label=&quot;Anchor link for: overview&quot;
    &gt;#&lt;&#x2F;a
&gt;
Overview&lt;&#x2F;h2&gt;
&lt;p&gt;Recently the Symfony project published a &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;symfony.com&#x2F;blog&#x2F;cve-2016-1902-securerandom-s-fallback-not-secure-when-openssl-fails&quot;&gt;security advisory&lt;&#x2F;a&gt;
to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;symfony&#x2F;symfony&#x2F;blob&#x2F;v2.7.8&#x2F;src&#x2F;Symfony&#x2F;Component&#x2F;Security&#x2F;Core&#x2F;Util&#x2F;SecureRandom.php&quot;&gt;SecureRandom&lt;&#x2F;a&gt;
class in their Security component that affects Symfony versions 2.3.0-2.3.36,
2.6.0-2.6.12, 2.7.0-2.7.8. On most sane systems there is no problem, but
in the event that something goes wrong the &lt;code&gt;SecureRandom::nextBytes()&lt;&#x2F;code&gt; falls
back to a custom random number generator which creates insecure random numbers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;details&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#details&quot; aria-label=&quot;Anchor link for: details&quot;
    &gt;#&lt;&#x2F;a
&gt;
Details&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;nextBytes()&lt;&#x2F;code&gt; function has three methods of RNG:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If the PHP 7 &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;php.net&#x2F;manual&#x2F;en&#x2F;function.random-bytes.php&quot;&gt;&lt;code&gt;random_bytes()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
function exists, that is used.&lt;&#x2F;li&gt;
&lt;li&gt;If OpenSSL is installed on the system then &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;symfony&#x2F;symfony&#x2F;blob&#x2F;ad264021e44a5aaa132f16aef69f92e56795683e&#x2F;src&#x2F;Symfony&#x2F;Component&#x2F;Security&#x2F;Core&#x2F;Util&#x2F;SecureRandom.php#L66-L76&quot;&gt;&lt;code&gt;openssl_random_pseudo_bytes()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
is used and the result is checked to ensure RNG succeeded.&lt;&#x2F;li&gt;
&lt;li&gt;If all of the above fail, a custom scheme is used. This is where the problem
lies.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The custom scheme can take in a seed file which doesn&#x27;t necessarily need to exist.
If the file does exist then the inital RNG seed is read from that file, otherwise
the seed is initialized with &lt;code&gt;uniqid(mt_rand(), true)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;symfony&#x2F;symfony&#x2F;blob&#x2F;ad264021e44a5aaa132f16aef69f92e56795683e&#x2F;src&#x2F;Symfony&#x2F;Component&#x2F;Security&#x2F;Core&#x2F;Util&#x2F;SecureRandom.php#L92-L100&quot;&gt;Here is where the random number is generated&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;php&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt;bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; = &amp;#39;&amp;#39;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;while&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;strlen&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;($&lt;&#x2F;span&gt;&lt;span&gt;bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) &amp;lt; $&lt;&#x2F;span&gt;&lt;span&gt;nbBytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;    static&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; $&lt;&#x2F;span&gt;&lt;span&gt;incr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    $&lt;&#x2F;span&gt;&lt;span&gt;bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; .=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;sha512&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, $&lt;&#x2F;span&gt;&lt;span&gt;incr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;++.$this-&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;seed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;uniqid&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;mt_rand&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(), true).$&lt;&#x2F;span&gt;&lt;span&gt;nbBytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, true);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    $this-&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;seed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; base64_encode&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C3E88D;&quot;&gt;sha512&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;&amp;#39;, $this-&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;seed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.$&lt;&#x2F;span&gt;&lt;span&gt;bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;.$&lt;&#x2F;span&gt;&lt;span&gt;nbBytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, true));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;    $this-&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;updateSeed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; substr&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;($&lt;&#x2F;span&gt;&lt;span&gt;bytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #F78C6C;&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;, $&lt;&#x2F;span&gt;&lt;span&gt;nbBytes&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Upon inspection we can see the bytes that are eventually returned to the user
are generated from a SHA-512 hash. This is probably done to make the output look uniform.
A red flag is raised that maybe whatever is being fed to &lt;code&gt;hash()&lt;&#x2F;code&gt; &lt;em&gt;isn&#x27;t&lt;&#x2F;em&gt; uniformly
random. What&#x27;s actually being fed to the core of this algorithm is the concatenation
of some counter, seed, and a &lt;code&gt;uniqid()&lt;&#x2F;code&gt;. Let&#x27;s take a look at each of these individually:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The counter starts out at 1 and is declared static. Since PHP is stateless,
the counter is predictable if you know how many times the function has been
called for your request.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;mt_rand()&lt;&#x2F;code&gt; is used as the &lt;code&gt;$prefix&lt;&#x2F;code&gt; to &lt;code&gt;uniqid()&lt;&#x2F;code&gt;. The PHP documentation
for both of these functions explicitly state that they should not be used for
cryptographic purposes. &lt;code&gt;uniqid()&lt;&#x2F;code&gt; inparticular isn&#x27;t meant to even be random -- just unique.
At its core it&#x27;s just &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;php&#x2F;php-src&#x2F;blob&#x2F;71c19800258ee3a9548af9a5e64ab0a62d1b1d8e&#x2F;ext&#x2F;standard&#x2F;uniqid.c#L79-L83&quot;&gt;a concatenation of prefix, seconds, microseconds, and &lt;code&gt;php_combined_lgc()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; (the latter explained &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;seclists.org&#x2F;fulldisclosure&#x2F;2010&#x2F;Mar&#x2F;519&quot;&gt;here&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The seed &lt;em&gt;can&lt;&#x2F;em&gt; be something we don&#x27;t know &lt;em&gt;if the file already exists&lt;&#x2F;em&gt;. There
are two cases where we can predict the seed though:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1. If the user provides a path that doesn&amp;#39;t exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2. If the user provides a path to a file that the application does not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;have permission to read or write.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;(Sidenote: Hugo&#x27;s markdown generator doesn&#x27;t support ordered vs unordered lists... what?)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Point #2 is kind of interesting here because both failure to read &lt;em&gt;or&lt;&#x2F;em&gt; write the
file fail silently and because PHP isn&#x27;t exactly a type-safe language, nothing explodes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;symfony&#x2F;symfony&#x2F;blob&#x2F;ad264021e44a5aaa132f16aef69f92e56795683e&#x2F;src&#x2F;Symfony&#x2F;Component&#x2F;Security&#x2F;Core&#x2F;Util&#x2F;SecureRandom.php#L103-L106&quot;&gt;&lt;code&gt;readSeed()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #BABED8; background-color: #0F111A;&quot;&gt;&lt;code data-lang=&quot;php&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C792EA;&quot;&gt;private function&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; readSeed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;font-style: italic;&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt; json_decode&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #82AAFF;&quot;&gt;file_get_contents&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;($this-&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;seedFile&lt;&#x2F;span&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89DDFF;&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If &lt;code&gt;file_get_contents()&lt;&#x2F;code&gt; fails it returns &lt;code&gt;FALSE&lt;&#x2F;code&gt; and is passed to &lt;code&gt;json_decode()&lt;&#x2F;code&gt;.
If &lt;code&gt;json_decode()&lt;&#x2F;code&gt; fails, it simply returns NULL and you have to manually check
&lt;code&gt;json_last_error()&lt;&#x2F;code&gt; to see why it failed. So if the file can&#x27;t be read, your
seed is &lt;code&gt;null&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;symfony&#x2F;symfony&#x2F;blob&#x2F;ad264021e44a5aaa132f16aef69f92e56795683e&#x2F;src&#x2F;Symfony&#x2F;Component&#x2F;Security&#x2F;Core&#x2F;Util&#x2F;SecureRandom.php#L108-L115&quot;&gt;&lt;code&gt;updateSeed()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; fails very similarly. The result of &lt;code&gt;file_put_contents()&lt;&#x2F;code&gt;
is never checked and will fail silently.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;tl-dr&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#tl-dr&quot; aria-label=&quot;Anchor link for: tl-dr&quot;
    &gt;#&lt;&#x2F;a
&gt;
tl;dr&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;SecureRandom::nextBytes()&lt;&#x2F;code&gt; will generate insecure random numbers if you&#x27;re not
using PHP 7, don&#x27;t have random_compat, and OpenSSL fails for some reason.&lt;&#x2F;p&gt;
&lt;p&gt;Even if this isn&#x27;t a very practical or exploitable bug, it shows how a weakness
at the core of a framework can go indiscovered for so long (this one almost 3 years!).
I also mainly did this writeup to note that this is my first of hopefully many
more CVEs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;timeline&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#timeline&quot; aria-label=&quot;Anchor link for: timeline&quot;
    &gt;#&lt;&#x2F;a
&gt;
Timeline:&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Dec 14, 2015: Vulnerability identified and reported&lt;&#x2F;li&gt;
&lt;li&gt;Dec 30, 2015: No response, requested follow-up&lt;&#x2F;li&gt;
&lt;li&gt;Jan 14, 2016: Patch released for 2.3, 2.6, 2.7&lt;&#x2F;li&gt;
&lt;li&gt;Jan 18, 2016: Security advisory published&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
</feed>
