Skip to content

Instantly share code, notes, and snippets.

@thistehneisen
Created November 17, 2020 10:35
Show Gist options
  • Save thistehneisen/1a0ac035d9d9c4a53a4d891f7f046ee9 to your computer and use it in GitHub Desktop.
Save thistehneisen/1a0ac035d9d9c4a53a4d891f7f046ee9 to your computer and use it in GitHub Desktop.
Generating wordlist for probable backup file names
<?php
$startYear = 2019;
$endYear = 2020;
for ($year = $startYear; $year <= $endYear; $year++) {
$startMonth = 1;
$endMonth = 12;
for ($month = $startMonth; $month <= $endMonth; $month++) {
$paddedMonth = sprintf("%02d", $month);
$startDay = 1;
$endDay = 31;
for ($day = $startDay; $day <= $endDay; $day++) {
$paddedDay = sprintf("%02d", $day);
$startHour = 0;
$endHour = 23;
for ($hour = $startHour; $hour <= $endHour; $hour++) {
$paddedHour = sprintf("%02d", $hour);
$startMinute = 0;
$endMinute = 59;
for ($minute = $startMinute; $minute <= $endMinute; $minute++) {
$paddedMinute = sprintf("%02d", $minute);
$startSecond = 0;
$endSecond = 59;
for ($second = $startSecond; $second <= $endSecond; $second++) {
$paddedSecond = sprintf("%02d", $second);
$startRandom = 0;
$endRandom = 9999;
for ($random = $startRandom; $random <= $endRandom; $random++) {
$paddedRandom = sprintf("%04d", $random);
print("backup_{$year}_{$paddedMonth}_{$paddedDay}_{$paddedHour}_{$paddedMinute}_{$paddedSecond}-{$paddedRandom}-db.sql.gz").PHP_EOL;
}
}
}
}
}
}
}
// backup_2019_06_25_08_48_37-1570-db.sql.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment