mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-07-07 04:58:00 +02:00
112 lines
4.5 KiB
XML
112 lines
4.5 KiB
XML
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
|
<style>
|
|
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
|
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
|
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
|
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
|
.dim{font:20px 'Courier New',monospace;fill:#888}
|
|
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
|
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
|
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
|
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
|
.badge{stroke:#00ff41;rx:14}
|
|
</style>
|
|
<rect class="bg" width="1200" height="800"/>
|
|
|
|
<!-- Title -->
|
|
<text x="600" y="52" text-anchor="middle" class="title">Static Vars & GPIO Input</text>
|
|
<text x="600" y="88" text-anchor="middle" class="dim">Static variables, GPIO input, hacking</text>
|
|
|
|
<!-- Static vs Auto Table -->
|
|
<rect x="40" y="110" width="540" height="300" rx="8" class="pnl"/>
|
|
<text x="310" y="148" text-anchor="middle" class="sub">Static vs Auto</text>
|
|
|
|
<text x="60" y="188" class="cyn">Aspect</text>
|
|
<text x="260" y="188" class="red">Auto</text>
|
|
<text x="420" y="188" class="grn">Static</text>
|
|
|
|
<line x1="60" y1="198" x2="560" y2="198" stroke="#1a1a2e" stroke-width="1"/>
|
|
|
|
<text x="60" y="228" class="txt">Where</text>
|
|
<text x="260" y="228" class="red">Stack</text>
|
|
<text x="420" y="228" class="grn">.data</text>
|
|
|
|
<text x="60" y="258" class="txt">Life</text>
|
|
<text x="260" y="258" class="red">Scope</text>
|
|
<text x="420" y="258" class="grn">Forever</text>
|
|
|
|
<text x="60" y="288" class="txt">Init</text>
|
|
<text x="260" y="288" class="red">Every</text>
|
|
<text x="420" y="288" class="grn">Once</text>
|
|
|
|
<text x="60" y="318" class="txt">Keeps?</text>
|
|
<text x="260" y="318" class="red">No</text>
|
|
<text x="420" y="318" class="grn">Yes</text>
|
|
|
|
<text x="60" y="348" class="txt">Optimized?</text>
|
|
<text x="260" y="348" class="red">Often</text>
|
|
<text x="420" y="348" class="grn">In RAM</text>
|
|
|
|
<text x="60" y="388" class="dim">Compiler may remove auto vars</text>
|
|
|
|
<!-- GPIO Input -->
|
|
<rect x="620" y="110" width="540" height="300" rx="8" class="pnl"/>
|
|
<text x="890" y="148" text-anchor="middle" class="sub">GPIO Input Setup</text>
|
|
|
|
<text x="640" y="188" class="grn">1.</text>
|
|
<text x="680" y="188" class="txt">gpio_init(pin)</text>
|
|
|
|
<text x="640" y="223" class="grn">2.</text>
|
|
<text x="680" y="223" class="txt">gpio_set_dir(pin, GPIO_IN)</text>
|
|
|
|
<text x="640" y="258" class="grn">3.</text>
|
|
<text x="680" y="258" class="txt">gpio_pull_up(pin)</text>
|
|
|
|
<text x="640" y="293" class="grn">4.</text>
|
|
<text x="680" y="293" class="txt">gpio_get(pin)</text>
|
|
|
|
<text x="640" y="338" class="dim">Pull-up: released=HIGH</text>
|
|
<text x="640" y="363" class="dim">pressed=LOW (inverted!)</text>
|
|
<text x="640" y="388" class="dim">Internal R, no hardware</text>
|
|
|
|
<!-- Key Assembly -->
|
|
<rect x="40" y="430" width="540" height="200" rx="8" class="pnl"/>
|
|
<text x="310" y="468" text-anchor="middle" class="sub">Key Instructions</text>
|
|
|
|
<text x="60" y="508" class="amb">ubfx r3,r3,#15,#1</text>
|
|
<text x="60" y="533" class="dim">Extract single GPIO bit</text>
|
|
|
|
<text x="60" y="568" class="red">eor.w r3,r3,#1</text>
|
|
<text x="60" y="593" class="dim">XOR to invert logic</text>
|
|
|
|
<text x="60" y="618" class="cyn">b.n 0x10000264</text>
|
|
|
|
<!-- Hacking Workflow -->
|
|
<rect x="620" y="430" width="540" height="200" rx="8" class="pnl"/>
|
|
<text x="890" y="468" text-anchor="middle" class="sub">Hacking Workflow</text>
|
|
|
|
<text x="640" y="508" class="grn">1.</text>
|
|
<text x="680" y="508" class="txt">Analyze in GDB</text>
|
|
|
|
<text x="640" y="538" class="grn">2.</text>
|
|
<text x="680" y="538" class="txt">Calculate offset</text>
|
|
|
|
<text x="640" y="568" class="grn">3.</text>
|
|
<text x="680" y="568" class="txt">Patch .bin in HxD</text>
|
|
|
|
<text x="640" y="598" class="grn">4.</text>
|
|
<text x="680" y="598" class="txt">uf2conv.py + flash</text>
|
|
|
|
<!-- Key Takeaways -->
|
|
<rect x="40" y="650" width="1120" height="130" rx="8" class="pnl"/>
|
|
<text x="600" y="688" text-anchor="middle" class="sub">Takeaways</text>
|
|
|
|
<rect x="60" y="708" width="340" height="50" rx="4" fill="#0a0a0f" stroke="#ff0040" stroke-width="1"/>
|
|
<text x="230" y="740" text-anchor="middle" class="red">42 -> 43 (1 byte)</text>
|
|
|
|
<rect x="420" y="708" width="340" height="50" rx="4" fill="#0a0a0f" stroke="#00ff41" stroke-width="1"/>
|
|
<text x="590" y="740" text-anchor="middle" class="grn">XOR 1->0 (invert)</text>
|
|
|
|
<rect x="780" y="708" width="360" height="50" rx="4" fill="#0a0a0f" stroke="#ffaa00" stroke-width="1"/>
|
|
<text x="960" y="740" text-anchor="middle" class="amb">offset = addr - base</text>
|
|
</svg> |