0

I'm performing some CTF challenge online and I need to generate time-stamps for bruteforcing.

What I want to know is how to generate time stamps in hh:mm format and with all numbers possible, for example 00:00 - 00:01 ... 12:23 and so on.

I wrote this code from someone but I don't get it much:

for h in range(24):
print(f"{h:02d}")

Output:

00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257

2 Answers2

0

If you can't install pandas library then use two iteration:

for h in range(24):
    for m in range(60):
        print(f"{h:02d}" + ":" + f"{m:02d}")

Thank You

Massi FD
  • 360
  • 4
  • 8
0

The minute should increase by 1. You can use fix base datetime object and add a timedelta of 1 minute for this:

from datetime import datetime, timedelta

base_time = datetime.strptime('2022-07-03 00:00', "%Y-%m-%d %H:%M")
minute = timedelta(minute=1)
t1 = base_time + minute
print(t1)

# use a loop or list-comprehension to iteratively add minute to form a sequence

See also

hc_dev
  • 8,389
  • 1
  • 26
  • 38