90s Kids
Challenge:
According to conversations found in Ghost Town, r34p3r despises 90s kids and tends to target them in his attacks. How many users in the Shallow Grave SQL dump were born in October in the 1990s?
Submit the flag as
flag{#}
.
Use the file from Address Book.
Max attempts:10
Solution:
This challenge uses the database I created during the Address Book challenge and I begin by identifying where a user's DOB is stored. From the previous challenges in this series I know a users table exists so I double check for a DOB field:
mysql> SHOW COLUMNS IN users;
+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| user_id | int | NO | PRI | NULL | auto_increment |
| username | varchar(52) | NO | UNI | NULL | |
| first | varchar(52) | NO | | NULL | |
| last | varchar(52) | NO | | NULL | |
| middle | varchar(24) | YES | | NULL | |
| email | varchar(52) | NO | UNI | NULL | |
| street | varchar(52) | NO | | NULL | |
| city | varchar(52) | NO | | NULL | |
| state_id | int | NO | MUL | NULL | |
| zip | varchar(10) | NO | | NULL | |
| gender | varchar(8) | NO | | NULL | |
| dob | date | NO | | NULL | |
+----------+-------------+------+-----+---------+----------------+
There is a dob field with a datatype of date
so the SQL query is fairly easy:
mysql> SELECT COUNT(*) FROM users WHERE YEAR(dob) >= 1990 AND YEAR(dob) < 2000 AND MONTH(dob) = 10;
+----------+
| COUNT(*) |
+----------+
| 32 |
+----------+
The completed flag is flag{32}
.
Leave a comment