<?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"><channel><title><![CDATA[Nocturn9x's Blog]]></title><description><![CDATA[A fan of the FOSS philosophy, *nix systems and Python. Occasionally a freelance Software Developer]]></description><link>https://blog.nocturn9x.space</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 02:10:32 GMT</lastBuildDate><atom:link href="https://blog.nocturn9x.space/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[My take on working from home]]></title><description><![CDATA[So, here we are back with another rant hm? I guess I'll just jump right into it then. You might want to read my LinkedIn post before this one though, as that adds a bit more context to the things I'm going to talk about next.
The office is dead
Or is...]]></description><link>https://blog.nocturn9x.space/my-take-on-working-from-home</link><guid isPermaLink="true">https://blog.nocturn9x.space/my-take-on-working-from-home</guid><category><![CDATA[wfh]]></category><category><![CDATA[techjobs]]></category><category><![CDATA[rto ]]></category><dc:creator><![CDATA[Mattia Giambirtone]]></dc:creator><pubDate>Wed, 06 Sep 2023 16:17:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/npxXWgQ33ZQ/upload/9ad2f3c55aa96815e1aec256cbc92f8e.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>So, here we are back with another rant hm? I guess I'll just jump right into it then. You might want to read my LinkedIn <a target="_blank" href="https://www.linkedin.com/feed/update/urn:li:activity:7105204597106823168/">post</a> before this one though, as that adds a bit more context to the things I'm going to talk about next.</p>
<h2 id="heading-the-office-is-dead">The office is dead</h2>
<p>Or is it? After years of companies praising WFH as the future of work, both for employers and employees, it seems like everything is reverting to the world before the pandemic. Companies are asking (also known as threatening with termination, in most documented cases) employees to please, please, please come back to the office, but only after hiring loads of people who all took their jobs with the expectation that it was going to be remote even after the whole Covid-19 debacle was over, and made plans around such promises accordingly (those people should've probably made sure their position was finalized in writing, but that's a whole other topic). I'm not going to quote Mark Zuckerberg or Jeff Bezos here, plenty of reputable publications have done that already (this is the blog of a 20-year-old techie, what were you expecting? I'm not Wired), but what I am going to do is chip in and add my oh-so-requested take on this hot potato of a topic.</p>
<h2 id="heading-why-return-to-the-office">Why return to the office?</h2>
<p>Honestly, the reasons are probably a combination of the following:</p>
<ul>
<li><p>Many companies get tax breaks from the cities where their hubs are located because their workers boost the local economy around them. This seems to be mostly a US-specific problem though, so I don't think it explains the broader trend that has been going on lately</p>
</li>
<li><p>Most managers, for some mysterious reason, seem to believe that having a bunch of people all sitting close together typing at their keyboard is the definition of top-tier productivity. Not only is that provably false, both by research (no I'm not going to quote any articles because I'm lazy, do your research, there's plenty) and anecdotal experience (anyone who has chit-chatted for more than 5 minutes with their colleagues will attest to how much time is lost just doing that), but it's also an incredibly old-fashioned way of looking at office jobs and work culture in general</p>
</li>
<li><p>Companies tend to sign multi-year leases with real estate owners to get their offices at a steep discount. No more people working in the office means those investments are effectively wasted</p>
</li>
<li><p>Some CEOs are just, let's say, not exactly the kind of people I (and probably any of their workers for that matter) would like to hang out with (I'm looking at you, Jamie Dimons and Elon Musks of the world). The trust issues that managers have regarding work performance are most likely coming from above</p>
</li>
<li><p>This is not true for all companies (although it is relevant to the industry I work in, which is tech), but some of them hired tons of people during the pandemic (even if those people ended up just twiddling their thumbs for most of their day) just because they were sitting on piles of money, not in small part thanks to the fact that their profits skyrocketed after everyone and their mom was suddenly forced to hop onto their computer to work (did anyone seriously care about Zoom before 2019? It's a genuine question). Why? Well, some of that might be manglement (yes, you read that right) making short-sighted hiring decisions (although I find that unlikely), but I think it was just another sneaky way to dodge taxes on the newfound profits: after all, you can't pay taxes on your profits if you reinvest all of it into "developing" the company, right? And, I mean, you can just lay off all of your extra workers once the pandemic ends, right? Maybe by forcing them to return to the office while knowing that most of those who were hired to work remotely will be forced to resign, therefore not needing to shell out costly severance packages? It can't be that, <em>right</em>?</p>
</li>
<li><p>Companies tend to copy each other: this is true with products as well as with managerial decisions. I wouldn't be surprised if the reason many of them were forcing RTO mandates was "because Google/Amazon/Facebook did it" (Yes, Facebook. I ain't playing your rebranding game, Mark). Is it stupid? Yes. Is it human? Unfortunately, also yes. Silly humans doing their humaning, I guess</p>
</li>
</ul>
<p><strong>P.S.</strong>: Just FYI, this post (most of this blog actually) is a reflection of my opinions. None of this stuff should be taken as fact, cold hard truth, or anything of the sort. I'm a young tech guy ranting, not Andrew Tate: If you disagree with me, that's fine. I'm also not saying WFH is the best thing to ever be invented after toilet paper. All I'm arguing for is to let people choose the way of working that they feel makes them the most productive and happy, and that works best with their current way of life. We don't live to work anymore, this isn't the 1970s: work should adapt to us, not the other way around.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>As I said in my LinkedIn post: employees make choices with their feet. I know many people can't afford to just quit their jobs right now, but if you have the option I think it should be time to reflect on what you think is more important: your career, or your life? The choice is yours. Most companies, whether they like it or not, will be forced to realize that remote work is here to stay, but that can only happen if we stand united and teach their execs that no, we aren't going to trade our quality of life so they can give themselves another 2M yearly bonus while the raises they give to employees don't even keep up with inflation anymore.</p>
]]></content:encoded></item><item><title><![CDATA[PSA: Analytics on my website]]></title><description><![CDATA[Hello there, long time no see! This is going to be a very quick post, but I just wanted to share that in the past few days, I have integrated an analytics service into my website. Fear not, however: I will not be using some third-party, data-mining, ...]]></description><link>https://blog.nocturn9x.space/psa-analytics-on-my-website</link><guid isPermaLink="true">https://blog.nocturn9x.space/psa-analytics-on-my-website</guid><category><![CDATA[analytics]]></category><category><![CDATA[Google]]></category><dc:creator><![CDATA[Mattia Giambirtone]]></dc:creator><pubDate>Fri, 28 Jul 2023 10:58:18 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/shr_Xn8S8QU/upload/d1c8d9c612eb789218172126581b2811.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello there, long time no see! This is going to be a very quick post, but I just wanted to share that in the past few days, I have integrated an analytics service into <a target="_blank" href="https://nocturn9x.space">my website</a>. Fear not, however: I will not be using some third-party, data-mining, privacy-violating proprietary crap made by a big tech company just to tell me how many people have visited my website and draw a shiny graph on the screen. The tracking software I'm using is called <a target="_blank" href="https://github.com/plausible/analytics">Plausible Analytics</a>, and it's free as in freedom. Also, in the interest of transparency, the page that aggregates the statistics that I'm keeping track of is visible <a target="_blank" href="https://stats.hyperbit.it/nocturn9x.space">here</a>: what you see is what I see, unfiltered! The reason for doing this is that I am addicted to graphs and statistics: I cannot resist a webpage filled with numbers, graphs, knobs and dials and such, but I have never wanted to use software like Google Ads, for obvious privacy reasons, so this idea has always stayed at the back of my mind, until now that is!</p>
<p>P.S.: Thanks to the great folks at HyperBit for hosting an instance of this awesome piece of software and letting us know early, by the way!</p>
<p>P.P.S.: Since HyperBit is hosting the plausible instance, you should refer to their <a target="_blank" href="https://hyperbit.it/privacy-policy">privacy policy</a> to learn more about how your data is handled and what your rights are. Please do not hesitate to contact me via email at nocturn9x@nocturn9x.space or using the contact form on my website if you have any questions or concerns.</p>
<p>See you soon! :)</p>
]]></content:encoded></item><item><title><![CDATA[Search files by content on Linux]]></title><description><![CDATA[The problem
Have you ever found yourself looking for a document in your PC and not being able to find it because you only remember its contents and not its name? If so, then this post may be for you!
First attempt: find + cat + grep
If you're not ter...]]></description><link>https://blog.nocturn9x.space/search-files-by-content-on-linux</link><guid isPermaLink="true">https://blog.nocturn9x.space/search-files-by-content-on-linux</guid><category><![CDATA[Linux]]></category><category><![CDATA[command line]]></category><category><![CDATA[files]]></category><category><![CDATA[posix]]></category><category><![CDATA[coreutils]]></category><dc:creator><![CDATA[Mattia Giambirtone]]></dc:creator><pubDate>Wed, 22 Jun 2022 19:45:41 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/NLSXFjl_nhc/upload/v1655925354906/dy5OwZBCS.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-the-problem">The problem</h2>
<p>Have you ever found yourself looking for a document in your PC and not being able to find it because you only remember its contents and not its name? If so, then this post may be for you!</p>
<h2 id="heading-first-attempt-find-cat-grep">First attempt: find + cat + grep</h2>
<p>If you're not terribly fond of the command line, you might try something along the lines of this</p>
<pre><code class="lang-bash">find ~ -<span class="hljs-built_in">type</span> f -name <span class="hljs-string">"*.ext"</span> | cat | grep -i <span class="hljs-string">"your match"</span>
</code></pre>
<p>Unfortunately, this doesn't work. The reason is that <code>cat</code> cannot be piped into like that: looks like we need another option.</p>
<p><strong>Note</strong>: The <code>-i</code> option to <code>grep</code> just makes our match case-insensitive so as to maximize our chances of finding something</p>
<h2 id="heading-second-attempt-find-with-exec">Second attempt: find with -exec</h2>
<p>Digging into the manual pages for <code>find</code> yields this:</p>
<pre><code class="lang-none">[...]
-exec command ;
              Execute command; true if 0 status is returned. [...]
</code></pre>
<p>This will allow us to execute a certain command* after each file with the given extension is found. So, our command now becomes something like </p>
<pre><code class="lang-bash">find ~ -<span class="hljs-built_in">type</span> f -name <span class="hljs-string">"*.ext"</span> -<span class="hljs-built_in">exec</span> grep {} -i <span class="hljs-string">"your match"</span> \;
</code></pre>
<p>The curly braces are replaced by <code>find</code> with the current filename, while the semicolon terminates the argument to <code>-exec</code> (we just need to escape it using a backslash so the shell doesn't try to interpret it literally. Using <code>";"</code> would've worked too).</p>
<p>This works! It will print the matched content of each file to the screen, but we're not done yet...</p>
<p>*: You can use the <code>-exec</code> flag multiple times to execute multiple commands!</p>
<h2 id="heading-getting-the-filename">Getting the filename</h2>
<p>We are now able to find documents in our system by their content, but we're not getting any <em>new</em> information out of our command: after all, we already knew part of the file content anyway! What we need to do next is hack our way back from the file's <em>content</em> to its <em>name</em>.</p>
<h3 id="heading-the-l-option-of-grep">The -l option of <code>grep</code></h3>
<p>Fortunately, <code>man</code> comes to the rescue again:</p>
<pre><code class="lang-none">[...]
-l, --files-with-matches
              Suppress normal output; instead print the name of 
              each input file from which output would
              normally have been printed. [...]
</code></pre>
<p>So our command has now become</p>
<pre><code class="lang-bash">find ~ -<span class="hljs-built_in">type</span> f -name <span class="hljs-string">"*.ext"</span> -<span class="hljs-built_in">exec</span> grep {} -li <span class="hljs-string">"your match"</span> \;
</code></pre>
<p>If we try it in our command line, we should get something like this out of it:</p>
<pre><code class="lang-none">/path/to/file1.ext
/path/to/file2.ext
[...]
</code></pre>
<h2 id="heading-restricting-the-output-size">Restricting the output size</h2>
<p>So, now we can find files by their content, but what if we want to limit how many lines of  output are printed? We can use the beauty of the POSIX shell and pipe our previous command into the useful <code>head</code> and <code>tail</code> utilities.</p>
<pre><code class="lang-bash">find ~ -<span class="hljs-built_in">type</span> f -name <span class="hljs-string">"*.ext"</span> -<span class="hljs-built_in">exec</span> grep {} -i <span class="hljs-string">"your match"</span> \; | tail -5
</code></pre>
<p>This only prints the last 5 matches. Things get interesting if we wanted to fetch the <em>first</em> 5 matches:</p>
<pre><code class="lang-bash">find ~ -<span class="hljs-built_in">type</span> f -name <span class="hljs-string">"*.ext"</span> -<span class="hljs-built_in">exec</span> grep {} -i <span class="hljs-string">"your match"</span> \; | head -5
</code></pre>
<p>If you tried running the command above, you'd get your filtered output, but you'd also get a bunch of errors that look like <code>find: grep: interrupted by signal 13</code>. Looking up what signal corresponds to number 13, we find it means <code>EPIPE: Broken Pipe</code>: this is because <code>find</code> (or, well, its subprocess running <code>grep</code>), was still trying to write to <code>head</code>'s standard output after the fifth match, but <code>head</code>'s process had already exited causing the end of the pipe to be broken.</p>
<p>According to <a target="_blank" href="https://superuser.com/a/642932/1480243">this</a> stackoverflow answer, the solution is to pipe our command into <code>tail -1 +1</code> first (remember, <code>tail</code> did not give us any problems before!) and <em>then</em> pipe that into <code>head</code>. If we do that, we get</p>
<pre><code class="lang-bash">find ~ -<span class="hljs-built_in">type</span> f -name <span class="hljs-string">"*.ext"</span> -<span class="hljs-built_in">exec</span> grep {} -i <span class="hljs-string">"your match"</span> \; | tail -1 +1 | head -5
</code></pre>
<p>Go ahead, try it! You'll see that it produces the expected results.</p>
<h2 id="heading-conclusions">Conclusions</h2>
<p>Hopefully you've learned something new from this post: I sure learned a lot by writing it! To close this article I'd like to point out that this is not very efficient if you're looking among a large amount of files, as <code>find</code> scans each and every one of them sequentially. There are specialized programs (of which I do not know the name, though) that perform more intelligent file indexing (on Windows and MacOS this is done automatically) that are a much better fit for this, but it's nice knowing you can do this with just a plain POSIX shell!</p>
<p>To make things more spicy, maybe you could filtering the files by age using the <code>-mtime</code> option of <code>find</code> or ordering them alphabetically by piping <code>find</code>'s output into <code>sort</code>: the possibilities are endless!</p>
]]></content:encoded></item><item><title><![CDATA[Going Self-Hosted]]></title><description><![CDATA[Since I realized how much the services I use every day track their users, I've always wanted to reduce my dependence on cloud services (at least somewhat) by self-hosting a bunch of services on my own servers, but I had never found any real reason to...]]></description><link>https://blog.nocturn9x.space/going-self-hosted</link><guid isPermaLink="true">https://blog.nocturn9x.space/going-self-hosted</guid><category><![CDATA[Google]]></category><category><![CDATA[privacy]]></category><category><![CDATA[internet]]></category><dc:creator><![CDATA[Mattia Giambirtone]]></dc:creator><pubDate>Sun, 16 Jan 2022 09:21:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/jz4ca36oJ_M/upload/v1642324822625/jRRFV1Phs.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Since I realized how much the services I use every day track their users, I've always wanted to reduce my dependence on cloud services (at least somewhat) by self-hosting a bunch of services on my own servers, but I had never found any real reason to put in the work to do that: that changes today.</p>
<h2 id="heading-bye-bye-google">Bye bye, Google!</h2>
<p>Together with a bunch of friends, I'm slowly starting to host my own little suite of cloud services under the <code>*.nocturn9x.space</code> domain. Our goal is to host many privacy-focused alternatives to popular services like Google Search, Google Mail, Reddit, Twitter, YouTube, Discord, and many others.</p>
<p>Currently, the following services are active:</p>
<ul>
<li><a target="_blank" href="https://nitter.nocturn9x.space">Nitter</a> -&gt; An alternative Twitter frontend</li>
<li><a target="_blank" href="https://tube.nocturn9x.space">Invidious</a> -&gt; An alternative YouTube frontend</li>
<li><a target="_blank" href="https://libreddit.nocturn9x.space">Libreddit</a> -&gt; An alternative Reddit frontend</li>
<li><a target="_blank" href="https://search.nocturn9x.space">Whoogle</a> -&gt; A privacy-focused search engine alternative to Google search</li>
<li><a target="_blank" href="https://mail.nocturn9x.space">Mailcow</a> -&gt; A fully fledged SMTP server and webmail client</li>
<li><a target="_blank" href="https://git.nocturn9x.space">Gitea</a> -&gt; A wonderful self-hosted alternative to GitHub</li>
<li><a target="_blank" href="https://forum.nocturn9x.space">Nimforum</a> -&gt; An instance of <a target="_blank" href="https://github.com/nim-lang/nimforum">nimforum</a>, which will act as a mirror for this blog</li>
</ul>
<p>We plan to add more services to the list like XMPP, Matrix Home Server, Mumble, DogBin, BitWarden, Bibliogram and many others that can't fit here for space reasons (turns out there is <em>a lot</em> of stuff to be self-hosted these days!).</p>
<h2 id="heading-cool-how-do-i-use-them">Cool! How do I use them?</h2>
<p>Currently only approved users can access the services (we have a Telegram group for that, you can <a target="_blank" href="https://nocturn9x.space/contact">contact me</a> to join), but please do note that everything is in public beta right now: things are likely to break or change without warning as we iron out the kinks of running so many services on our own. If you are willing to help us set things up, we'd love to have you in our little crew! We especially need security experts to try and break into our server so we can make sure to patch potential security vulnerabilities</p>
<p>And that's all, folks!</p>
]]></content:encoded></item><item><title><![CDATA[Open Source Software is in danger: Here's Why]]></title><description><![CDATA[Disclaimer
This article is kind of a rant, so please excuse any formatting or spelling mistakes (and the snarky tone).
I'll be honest: I'm outraged. I am not in the mood to deeply research what happened and its implications thoroughly, but I'll try m...]]></description><link>https://blog.nocturn9x.space/open-source-software-is-in-danger-heres-why</link><guid isPermaLink="true">https://blog.nocturn9x.space/open-source-software-is-in-danger-heres-why</guid><category><![CDATA[OSS]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[GitHub]]></category><category><![CDATA[Microsoft]]></category><category><![CDATA[Javascript library]]></category><dc:creator><![CDATA[Mattia Giambirtone]]></dc:creator><pubDate>Tue, 11 Jan 2022 21:11:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1642068784722/NWBxLSZnE.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-disclaimer">Disclaimer</h1>
<p>This article is kind of a rant, so please excuse any formatting or spelling mistakes (and the snarky tone).
I'll be honest: I'm outraged. I am not in the mood to deeply research what happened and its implications thoroughly, but I'll try my best. (Check the linked articles for better sources)</p>
<h1 id="heading-how-fortune-500-companies-are-making-foss-a-living-hell">How Fortune 500 Companies Are Making FOSS a Living Hell</h1>
<p>The <a target="_blank" href="https://www.theverge.com/2022/1/9/22874949/developer-corrupts-open-source-libraries-projects-affected">recent events</a> regarding two popular JavaScript libraries used by ~30 million users worldwide have once again brought the recurring issues with Free Open Source Software to the surface: Companies like Apple, Google, Microsoft and many others are using free software in their services without paying a single penny, stifling innovation in the community while improving their own closed source products.</p>
<h2 id="heading-some-backstory">Some backstory</h2>
<p>The gist of it is that the owner of two very popular JavaScript libraries, called Marak Squires, has gone rogue and corrupted said packages by adding infinite loops and weird log messages into them, causing a lot of issues to people who relied on them. The repository of one of these packages (namely Faker.js, a package used to generate real-looking personal information such as names, street and email addresses and more) has since been replaced with an empty skeleton, while the README reads: "What really happened with Aaron Swartz?". If you don't know (I didn't) <a target="_blank" href="https://it.wikipedia.org/wiki/Aaron_Swartz">Aaron Swartz</a> was a software developer and entrepreneur who ended up killing himself in 2013 because of reasons I'm not informed enough to discuss in detail</p>
<h2 id="heading-the-backlash">The backlash</h2>
<p>Shortly after people noticed their beloved packages were exploding, users all over the world were outraged: many wanted GitHub to transfer Marak's repository (<strong>which he owns</strong>) to another user and they were actually temporarily banned from the platform for unknown reasons (and have since been unbanned, it seems). To all of those, I kindly say: you're incompetent fools. If this issue has caused more than an annoying couple of hours to fix, you are a babbling idiot and should be fired on the spot. No one, and I repeat <strong>No one</strong>, should <strong>ever</strong> pin dependencies to their latest release in production specifically to avoid this from happening, but I guess that since I'm talking about an ecosystem where one of the most depended upon libraries literally just implements <code>element in array</code> that best practices aren't really known to JavaScript developers.</p>
<h2 id="heading-why-open-source-is-in-danger">Why Open Source is in Danger</h2>
<p>Let's get to the core of this very SEO-attractive title and what led me to write this in the first place: Free Open Source Software in its current state is at serious risk. Why? Well, just ask any maintainer of a large package depended upon by many, and they'll all more or less tell the same story: Multi-billion dollar companies taking advantage of awesome open source code for their own proprietary crap and that do not spend a single dime towards actually improving said software. I'm sure Stallman would disagree here, but there needs to be a brake of some sort: it just isn't beneficial to the long term survival of free software to be taken advantage of this easily by any big corporation. Maybe a license that requires a fee to be paid if a big tech company is using a piece of code for commercial purposes, while still leaving the rights of individual unharmed, would help (and in the meantime, double licensing seems to do the trick just fine), but I'm no lawyer nor a free software expert: just a random 19 year old guy who's outraged by the current state of what could (and <em>should</em>) be a system meant to let communities thrive and software develop in a more streamlined and controlled fashion. </p>
<h2 id="heading-closing-thoughts">Closing Thoughts</h2>
<p>I'm still boiling with rage, but I'll try to wrap this up as decently as I can: <strong>Something</strong> needs to change. We're heading towards a future where it's fine for [insert fortune 500 company name] to just breach copyright laws like it's nothing. Where it's fine for a user to be banned from a code sharing platform just because of the changes they made <em>to their own freaking code</em>. Where it's fine for people devoting their life and their valuable time towards FOSS to only get total financial (and mental) bankruptcy in return. </p>
<p>And to Marak and all the authors of large open source software I say Thank You. Thank you for having tried to (or still being in the process of) improve the community with your awesome work. I know it probably doesn't mean much to get comforting words from a random penniless computer science student, but you have my greatest respect, esteem and gratification. You're awesome, keep doing what you're doing, and I hope you to join soon in a fight for a better world.</p>
]]></content:encoded></item><item><title><![CDATA[What's a CA anyway?  Explaining the chain of trust that secures the Web]]></title><description><![CDATA[We live in the age of information: an absurd amount of data is transferred every day just through the web (which, by the way, is NOT the same thing as "the internet"), be it your shiny new Instagram story, your banking credentials, or what have you.
...]]></description><link>https://blog.nocturn9x.space/whats-a-ca-anyway-explaining-the-chain-of-trust-that-secures-the-web</link><guid isPermaLink="true">https://blog.nocturn9x.space/whats-a-ca-anyway-explaining-the-chain-of-trust-that-secures-the-web</guid><category><![CDATA[SSL]]></category><category><![CDATA[web]]></category><category><![CDATA[http]]></category><category><![CDATA[https]]></category><dc:creator><![CDATA[Mattia Giambirtone]]></dc:creator><pubDate>Mon, 11 Oct 2021 14:42:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1633963038090/IXoqOQHFF.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>We live in the age of information: an absurd amount of data is transferred every day just through the web (which, by the way, is NOT the same thing as "the internet"), be it your shiny new Instagram story, your banking credentials, or what have you.</p>
<p>With so much information being handled, there needs to be some way to make sure it arrives to its destination unaltered and that only the intended recipient can read it: think about what would happen if just about anyone had all your passwords, that would be pretty bad right?</p>
<h2 id="heading-ssl-to-the-rescue">SSL to the rescue</h2>
<p>But fear not! Some very smart people have in fact figured out a way to transmit information into the ether and have it arrive safely and away from prying eyes: SSL certificates, or better, the SSL protocol.</p>
<p>SSL stands for <strong>Secure Socket Layer</strong>, and it's what makes your browser show that nice green padlock next to the website's URL: a "guarantee" (in fact, a certificate) that makes sure your info is secure.</p>
<blockquote>
<p><strong>Technically</strong>, today we use TLS (or <strong>Transport Layer Security</strong>) as SSL was deprecated ages ago due to it being ridiculously insecure, but the name SSL certificate has stayed, and for all intents and purposes this terminology is fine</p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631130646117/WvceZTnGv.png" alt="image.png" /></p>
<blockquote>
<p>DigiCert is a popular <strong>Certificate Authority</strong>, or CA for short, which is an entity that signs and provides (in this case, selling them) trusted SSL certificates</p>
</blockquote>
<h2 id="heading-ensuring-trust">Ensuring trust</h2>
<p>So, you want to protect your website? It may sound like rocket science, but it's <a target="_blank" href="https://stackoverflow.com/questions/10175812/how-to-generate-a-self-signed-ssl-certificate-using-openssl">surprisingly simple</a>, there's even a <a target="_blank" href="https://www.selfsignedcertificate.com/">website</a> that does all the dirty job for you (although I personally wouldn't trust it), but all of these alternatives have one characteristic: they're "self signed", which means they are not emitted by any registered entity like DigiCert or Let's Encrypt.</p>
<p>This may sound bad, but it's actually not an issue as far as security is concerned: SSL certificates (or more accurately your browser) will still encrypt all information that is sent and received to a website even if it is using a self-signed one. The issue arises when you want the browser to actually <strong>trust</strong> your certificate: you might have realized by reading that stackoverflow post I linked before, that the fatal flaw of self-signed certificates is that they cause browsers to whine about "Privacy Errors" or that "Your connection is not private" and to show a strikethrown red padlock instead of a green one as you'd expect, complaining that the website is not secure and that the owner may have malicious intents. There are ways to create your own trusted certificate authority and add it to your browsers, but it's a cumbersome process which will only work on your local machine, so it's not a viable option for production.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631131267105/ZfE8pMotH.png" alt="image.png" /></p>
<blockquote>
<p>Google Chrome complaining about a self-signed certificate</p>
</blockquote>
<h2 id="heading-why-cas">Why CAs?</h2>
<p>The idea behind a CA is that it makes it impossible for a third party to perform a <a target="_blank" href="https://en.wikipedia.org/wiki/Man-in-the-middle_attack">MITM attack</a> by pretending to be the site you're visiting and eavesdropping all of your traffic. If the browser had no way of knowing which certificate is the "right" one for a given website, a malicious user could just intercept your traffic, swap the website's certificate for his own so that he can see all of your traffic, and then forward it (encrypting with the website's certificate this time) to its intended destination so that you, the user, don't notice anything fishy going on: Boom, your precious credit card details are now in the hands of some Russian hacker, with all the implications that brings.</p>
<h2 id="heading-the-problem-of-most-cas">The problem of (most) CAs</h2>
<p>Protecting user's traffic is a noble cause, but sadly (as with all things) companies have found a way to make this a business by selling trusted certificates for money, sometimes charging hundreds or even thousands of dollars for what's functionally identical to a self-signed certificate, except for the fact that the company's name is mentioned in your browser's list of trusted certificate issuers.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631979142606/al_h1_UH4.png" alt="image.png" />
<a target="_blank" href="https://cdn.hashnode.com/res/hashnode/image/upload/v1631978618297/SyXgptOBK.png">image.png</a></p>
<blockquote>
<p>$600+ for a 3-year certificate from DigiCert, wtf?!</p>
</blockquote>
<h2 id="heading-the-light-at-the-end-of-the-tunnel">The light at the end of the tunnel</h2>
<p>Fortunately for us though, there is hope: Let's Encrypt is a Certificate Authority that issues trusted SSL Certificates for free (they even have a super handy <a target="_blank" href="https://sslforfree.com">website</a> to automate that). They last 90 days (but can be renewed free of charge indefinitely), not because they're free, but for security reasons (if a certificate lasts less time overall, there is a shorter time window during which it can be leaked!).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631979038875/ufUk6fFXb.png" alt="image.png" /></p>
<blockquote>
<p>Yay, free SSL!</p>
</blockquote>
<h2 id="heading-conclusions">Conclusions</h2>
<p>Whether your website needs an SSL certificate or not, knowing what options are out there might come in handy to you in the future: maybe you'll save a lot of money thanks to this article. Thank me later!</p>
]]></content:encoded></item><item><title><![CDATA[Here's how I got your credit card number, or: Why sequential identifiers are a bad idea]]></title><description><![CDATA[People use image sharing services all the time: sometimes the content they post on there is nothing relevant, but more often than not they just forget they're giving access to a lot of their data to anyone with enough skill to know where, and how, to...]]></description><link>https://blog.nocturn9x.space/heres-how-i-got-your-credit-card-number-or-why-sequential-identifiers-are-a-bad-idea</link><guid isPermaLink="true">https://blog.nocturn9x.space/heres-how-i-got-your-credit-card-number-or-why-sequential-identifiers-are-a-bad-idea</guid><category><![CDATA[Python]]></category><category><![CDATA[numpy]]></category><category><![CDATA[youtube]]></category><category><![CDATA[images]]></category><category><![CDATA[terminal]]></category><dc:creator><![CDATA[Mattia Giambirtone]]></dc:creator><pubDate>Wed, 08 Sep 2021 19:37:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/gf8e6XvG_3E/upload/v1642068858995/uuh703ouB.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>People use image sharing services all the time: sometimes the content they post on there is nothing relevant, but more often than not they just forget they're giving access to a lot of their data to anyone with enough skill to know where, and how, to look for.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631128498962/pb3Evtv29.png" alt="image.png" /></p>
<blockquote>
<p> <a target="_blank" href="https://imgur.com">Imgur</a>, a popular image hosting and sharing website</p>
</blockquote>
<h2 id="heading-a-quick-rundown">A quick rundown</h2>
<p>The concept for this article came from <a target="_blank" href="https://www.youtube.com/watch?v=05K5glVCwis&amp;ab_channel=LinusTechTips">a recent video</a>  on the popular tech YouTube channel Linus Tech Tips. Specifically, the host (Linus Sebastian) shows how a popular image sharing service named <a target="_blank" href="https://prnt.sc">LightShot</a> allowed anyone to access any picture given an identifier constructed using 2 letters of the alphabet, followed by any combination of 4 digits.</p>
<blockquote>
<p>Note: This isn't actually correct, and any combination of digits and letters is valid as long as it doesn't start with a 0 and it is less than 15 characters long</p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631128564052/TH2RveH7C.png" alt="image.png" /></p>
<blockquote>
<p>The homepage of LightShot</p>
</blockquote>
<h2 id="heading-the-cold-hard-truth">The cold hard truth</h2>
<p>This fact in itself doesn't sound too bad: it's a public image sharing service after all.</p>
<p>What's actually frightening is that it took surprisingly little research to find out the truth: the identification system LightShot uses is not random at all, it is in fact sequential, but just so happens to use a numeric system that's pretty uncommon.</p>
<p>While we as humans are mostly used to numbers in base 10 and computers process information in base 2, many other formats exist: one of them is base 36, which encompasses both the 26 letters of the alphabet and the usual Arabic digits from 0 to 9 (hence why it's called base 36, because 26 + 10 = 36) in its representational form. </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631129588203/-G4GrjIo7.png" alt="image.png" /></p>
<blockquote>
<p>An example of base36 numbers</p>
</blockquote>
<h2 id="heading-scraping-the-data">Scraping the data</h2>
<p>Knowing this, writing a simple script that can iterate all the base36 IDs under 64 bits and download every image that ever existed on the platform was trivial. Not even CloudFlare was of any help, as libraries to bypass the so-called "Under Attack Mode" are readily available in the open source community, therefore making our little scraping endeavor almost invisible. </p>
<p>An interesting finding is that LightShot doesn't seem to like IDs starting with a zero, as those just redirect to the main page, but that was an easy one-line fix.
Another quirk that I found is that LightShot is exploiting other image hosting services such as <a target="_blank" href="https://imgur.com">ImgUr</a> and <a target="_blank" href="https://imageshack.com">ImageShack</a> to serve its content.</p>
<blockquote>
<p>Correction: They <em>did</em> so in the past, but then changed it and they now serve them via https://image.prntscr.com</p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631128687723/89ZB9PmXU.png" alt="image.png" /></p>
<blockquote>
<p>The script in action: it retrieves the "true" URL where the image is hosted (on the far-right) as well as the original ID (the one labeled 'x') on the LightShot platform. The 'i' value is the LightShot ID converted to a base 10 number</p>
</blockquote>
<h2 id="heading-findings">Findings</h2>
<p>What's even more scary though, is the information that I found. As you may expect, a good chunk of it was just innocent screenshots: games, presentations, graphs, reports, homework, chats, stuff like that. What I also found however, was an unholy amount of confidential information such as credit card details, bitcoin wallets keys, banking credentials, nudes, gore, and much more: probably not the kind of stuff you'd want everyone to know about, right?</p>
<p>For good measure, I've attached a couple of probably very confidential screenshots I was able to find out in the wild (obviously stripped of the most sensitive information):</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631129138436/8Dp43w3BA.png" alt="image.png" /></p>
<blockquote>
<p>Some login credentials to a crypto trading platform and wallet addresses</p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631129146924/2-mTIrSzO.png" alt="image.png" /></p>
<blockquote>
<p>A screenshot of a Telegram chat with banking credentials and full credit card details</p>
</blockquote>
<p>This was achieved with only 57 lines of Python code and 3 open source libraries in around 2 hours, and I managed to download more than 20 thousand images with a simplicity that I can just describe as jaw dropping.</p>
<p>The kind of data I gathered in so little time is enough to ruin many people's lives— and the worst part is they did this themselves.</p>
<h2 id="heading-conclusions">Conclusions</h2>
<p>Drawing a conclusion from all of this isn't too hard then: think twice about what you post and especially where you do so, because your boyfriend may not be the only one enjoying your new tanga.</p>
<p>This should also be a lesson for software developers and engineers all over the world that using sequential identifiers in public services is a terrible idea and a recipe for disaster.</p>
<h2 id="heading-credits">Credits</h2>
<ul>
<li><a target="_blank" href="https://numpy.org">Numpy</a>  - For its amazing <code>base_repr</code> function</li>
<li><a target="_blank" href="https://github.com/venomous/cloudscraper">Cloudscraper</a>, which allowed me to bypass LightShot's cloudflare protection with ease</li>
<li><a target="_blank" href="https://docs.python-requests.org/en/master/">Requests</a>, for its no-nonsense and dead-simple API which made downloading images a breeze</li>
</ul>
]]></content:encoded></item></channel></rss>