<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 0p4n1k</title>
    <description>The latest articles on DEV Community by 0p4n1k (@0p4n1k).</description>
    <link>https://dev.to/0p4n1k</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3854040%2Fd462102c-457f-4bda-85af-4f84547aaa69.gif</url>
      <title>DEV Community: 0p4n1k</title>
      <link>https://dev.to/0p4n1k</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/0p4n1k"/>
    <language>en</language>
    <item>
      <title>I built a Python deobfuscator using AST transformers - Noctyra</title>
      <dc:creator>0p4n1k</dc:creator>
      <pubDate>Tue, 31 Mar 2026 18:47:23 +0000</pubDate>
      <link>https://dev.to/0p4n1k/i-built-a-python-deobfuscator-using-ast-transformers-noctyra-24g3</link>
      <guid>https://dev.to/0p4n1k/i-built-a-python-deobfuscator-using-ast-transformers-noctyra-24g3</guid>
      <description>&lt;p&gt;Hey everyone! I just released &lt;strong&gt;Noctyra&lt;/strong&gt;, a tool i built to handle Python deobfuscation using AST transformers. It's been a fun side project and I figured it was time to share it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why AST and not regex?
&lt;/h2&gt;

&lt;p&gt;Most quick deobfuscation scripts you'll find online rely on regex replacements or target specific obfuscators. That works for simple cases, but fall apart easily when the obfuscation is layered or unknown.&lt;/p&gt;

&lt;p&gt;Noctyra works directly on the &lt;strong&gt;Abstract Syntax Tree&lt;/strong&gt; (AST). Instead of treating the code as text, it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Parses the source into an AST&lt;/li&gt;
&lt;li&gt;Applies a sequence of transformers on the nodes&lt;/li&gt;
&lt;li&gt;Unparses the result back into clean, readable and formated Python&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This means it can handle things like constant folding, resolving encoded strings, junk code without ever caring about formatting or unreadable code.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the pipeline works
&lt;/h2&gt;

&lt;p&gt;The pipeline runs transformers in &lt;strong&gt;iterations&lt;/strong&gt; until the AST stops changing between passes. This is what makes it effective against layered obfuscation.&lt;/p&gt;

&lt;p&gt;For example, something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base64&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;b64decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="mh"&gt;0x42&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rot13_encoded&lt;/span&gt;&lt;span class="p"&gt;])))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;gets unwrapped step by step: ROT13 first, then XOR, then base64  until you're left with the original code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Current state
&lt;/h2&gt;

&lt;p&gt;It's still early and there are plenty of obfuscation patterns i haven't covered yet, but it handles a decent chunk of what you'd encounter in the wild. The architecture is modular, so adding new transformers is straightforward.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Repo:&lt;/strong&gt; &lt;a href="https://github.com/0p4n1k/Noctyra" rel="noopener noreferrer"&gt;https://github.com/0p4n1k/Noctyra&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>security</category>
      <category>reverseengineering</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
