<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ahmed Alharbi on Medium]]></title>
        <description><![CDATA[Stories by Ahmed Alharbi on Medium]]></description>
        <link>https://medium.com/@Ahmedwrote?source=rss-2b98aa5e0586------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Md5Ziem6X43jQzby</url>
            <title>Stories by Ahmed Alharbi on Medium</title>
            <link>https://medium.com/@Ahmedwrote?source=rss-2b98aa5e0586------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 12:42:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Ahmedwrote/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Welcome to Robot Hell. Enjoy Your Stay.]]></title>
            <link>https://medium.com/@Ahmedwrote/i-built-a-maze-that-traps-bots-trying-to-steal-my-env-9c7e364a2127?source=rss-2b98aa5e0586------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c7e364a2127</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Ahmed Alharbi]]></dc:creator>
            <pubDate>Sun, 22 Nov 2026 18:01:01 GMT</pubDate>
            <atom:updated>2026-11-22T18:02:36.217Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A war against bots, and a maze they can’t leave.</em></p><h4>I built a maze that traps bots trying to steal my .env.</h4><p>My blog is three days old. Nobody knows it exists.</p><p>The bots found it anyway.</p><p>They weren’t there to read. They were looking for my .env file, the one with my passwords and private stuff. I could have blocked them. But blocking is boring, and a blocked bot just comes back with a new trick.</p><p>So I built something worse for them. I call it <strong>robot hell</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*S_mTpRahJh_pusox227STQ.png" /><figcaption><em>My bot report. Every number is a request, not a person.</em></figcaption></figure><h3>How robot hell works</h3><p>Bots hunting for .env and other secret files get sent to a decoy. A real person has no reason to open it. A bot opens everything.</p><p>Once it’s in, there’s no wall and no error. It gets a private room it never leaves: fake page after fake page, all leading nowhere. The bot keeps walking, thinking it’s getting closer. It isn’t.</p><h3>Three days of numbers</h3><p>I count everything. I don’t store IP addresses, only anonymous hashes that expire, and every number is a request, not a person.</p><ul><li><strong>696</strong> bad-bot requests caught</li><li><strong>26</strong> different bad bots</li><li><strong>76</strong> fell for a decoy</li><li><strong>617</strong> pages of robot hell served</li><li><strong>3</strong> blocked at the door</li><li><strong>0</strong> slowed down by the rate limit</li><li><strong>186</strong> human page views</li></ul><p>Compare the bad-bot requests to the human page views. Bad bots visited my site almost 4 times as much as real people.</p><h3>What I learned</h3><p>The rate limiter did nothing. These bots weren’t fast, just patient. Robot hell did all the work. Blocking caught <strong>3</strong> requests, and the maze kept hundreds busy.</p><p>I let the good ones in, too: <strong>28</strong> search and preview bots, and <strong>138</strong> scripted clients. Not every script is evil, and I don’t want to punish them for existing.</p><h3>Why I’m doing this</h3><p>I want to be a backend developer. I’d rather build real things that fight back than another notes app. This is the first time something I built has real enemies, and I love it.</p><p>Every bot stuck in robot hell is a bot that isn’t hurting anyone else.</p><p>I’ll keep counting. If you run a site, check who’s actually visiting it. You might not like the answer.</p><p>Robot hell is open. Bots are always welcome.</p><p><em>Counting since 2026–11–19. No IP stored.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c7e364a2127" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What happens when you type gcc main.c]]></title>
            <link>https://medium.com/@Ahmedwrote/what-happens-when-you-type-gcc-main-c-a972e02e154d?source=rss-2b98aa5e0586------2</link>
            <guid isPermaLink="false">https://medium.com/p/a972e02e154d</guid>
            <category><![CDATA[compilers]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[c-programming]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[holberton-school]]></category>
            <dc:creator><![CDATA[Ahmed Alharbi]]></dc:creator>
            <pubDate>Sat, 07 Nov 2026 18:24:04 GMT</pubDate>
            <atom:updated>2026-11-07T18:24:04.119Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k4ylLT0MO5uGtkmd-0COKw.png" /><figcaption>The four stages behind gcc main.c</figcaption></figure><p>You write a C file, type gcc main.c, press Enter, and a moment later a file called a.out appears. Run it, and your program works. It feels simple, like just one step, but gcc just ran four separate stages without you knowing.</p><p>In this article, we will analyze each stage gcc goes through to turn your code into a program.</p><h3>The full picture</h3><p>gcc is not one program but a manager. When you type gcc main.c, it runs four tools in sequence and deletes all the in-between files, leaving only a.out.</p><p>Here is the file we will follow through the whole journey. Look at it closely:</p><pre>#include &lt;stdio.h&gt;<br>#define GREETING &quot;Hello, Holberton!&quot;</pre><pre>/* Print a greeting */<br>int main(void)<br>{<br>	printf(&quot;%s\n&quot;, GREETING);<br>	return (0);<br>}</pre><p>To see every intermediate file instead of losing it, ask gcc to keep them:</p><pre>$ gcc -save-temps main.c<br>$ ls<br>a.out  main.c  main.i  main.o  main.s</pre><p>Each new file is the output of one stage:</p><ol><li><strong>Preprocessing</strong> turns main.c into main.i (pure C, no directives).</li><li><strong>Compilation</strong> turns main.i into main.s (assembly).</li><li><strong>Assembly</strong> turns main.s into main.o (machine code).</li><li><strong>Linking</strong> turns main.o plus the C library into a.out (a runnable program).</li></ol><h3>Stage 1: Preprocessing</h3><p>The preprocessor handles every line that starts with #, before any actual compiling happens. It does three main jobs:</p><ul><li><strong>Removes comments</strong>, so /* Print a greeting */ disappears.</li><li><strong>Expands macros</strong>, so every GREETING becomes &quot;Hello, Holberton!&quot;.</li><li><strong>Includes headers</strong>, so #include &lt;stdio.h&gt; is replaced by the full contents of stdio.h.</li></ul><p>Stop gcc right after this stage with -E:</p><pre>$ gcc -E main.c -o main.i<br>$ wc -l main.i</pre><p>That tiny 9-line file now runs to several hundred lines, almost all of it from stdio.h. Look at the end of it:</p><pre>$ tail -n 6 main.i</pre><pre># 5 &quot;main.c&quot;<br>int main(void)<br>{<br> printf(&quot;%s\n&quot;, &quot;Hello, Holberton!&quot;);<br> return (0);<br>}</pre><p>The comment is gone and the macro has been replaced by its value. The # 5 &quot;main.c&quot; lines are line markers, which let the compiler report errors against your original line numbers.</p><h3>Stage 2: Compilation</h3><p>The compiler proper (cc1) checks your syntax and types, then translates the preprocessed C into assembly language for your CPU. Assembly is the human-readable form of the instructions your machine runs. This is where most compiler errors and warnings come from.</p><p>Stop after this stage with -S:</p><pre>$ gcc -S main.c<br>$ cat main.s</pre><p>Two things are worth noticing. Our string is stored as a label, .LC0. And printf has become puts: GCC noticed that printf(&quot;%s\n&quot;, s) does exactly what puts(s) does, and picked the simpler call.</p><p>This is AT&amp;T syntax, GCC’s default. For Intel syntax, add -masm=intel:</p><pre>$ gcc -S -masm=intel main.c</pre><h3>Stage 3: Assembly</h3><p>The assembler (as) converts each assembly instruction into binary machine code that your CPU executes. The result is an object file: real machine code, but not a program yet.</p><p>Stop after this stage with -c:</p><pre>$ gcc -c main.c<br>$ file main.o<br>main.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped</pre><p>The key word is <strong>relocatable</strong>. The code inside has no final addresses, and it still calls functions it does not contain. You can see that with nm, which lists an object file&#39;s symbols:</p><pre>$ nm main.o<br>0000000000000000 T main<br>                 U puts</pre><p>T means main is defined here, in the text (code) section. U means puts is <strong>undefined</strong>: our file uses it, but its code lives somewhere else. Filling that gap is the job of the last stage.</p><p>To see the raw bytes next to the instructions they encode, disassemble the object file:</p><pre>$ objdump -d main.o</pre><h3>Stage 4: Linking</h3><p>The linker (ld, called through collect2) combines your object file with everything else a program needs, and writes the final executable. It does three things:</p><ul><li><strong>Resolves symbols</strong>: it finds where puts actually lives (the C standard library, libc) and connects our call to it.</li><li><strong>Adds startup code</strong>: files like crt1.o contain _start, the real entry point, which sets things up and then calls your main.</li><li><strong>Assigns addresses</strong> and lays everything out as an executable file.</li></ul><p>Link the object file from the previous stage:</p><pre>$ gcc main.o<br>$ file a.out<br>a.out: ELF 64-bit LSB pie executable, x86-64, dynamically linked, ...<br>$ ./a.out<br>Hello, Holberton!</pre><p>And why a.out? It is the historical default name, short for &quot;assembler output&quot;. Choose your own with -o:</p><pre>$ gcc main.c -o hello<br>$ ./hello<br>Hello, Holberton!</pre><h3>Conclusion</h3><p>One short command hides four separate programs, each turning your code into something closer to what the machine understands.</p><p>The file goes from main.c through four stages and comes out as a.out, a program you can run.</p><p>Try it yourself: run gcc -save-temps main.c on your own program and open every file it leaves behind.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a972e02e154d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>