is it possible to brute force a date?

135 views Asked by At

I want to know whether it is possible to brute force a date format, and if it could be done once or if it should be done for each element (day, month, year).

I tried burp suite but I'm still a beginner, although I know the correct date for the project but I'm struggling to actually brute force.

1

There are 1 answers

0
Dilophosaurus8 On
import datetime
# Imports the 'datetime' module . . .
# It is a built-in module so no need to do extra downloading and stuff

d = datetime.date(2016, 2, 26)
# Creates the 'date' object

print([d.year, d.month, d.day])
# Outputs the 'list' object instead of the 'date' object

for i in range(5):
    # Repeats the following code five times
    
    d += datetime.timedelta(days=1)
    # Make one day pass in the 'datetime' object . . .
    # The 'date' object will automatically adjust the month and year
    # It also works for leap years!
    
    print([d.year, d.month, d.day])
    # Output the updated 'date' object as a 'list' object
    # The function list() wouldn't work because it would say that a 'date' object is not iterable

It outputs:

[2016, 2, 26]
[2016, 2, 27]
[2016, 2, 28]
[2016, 2, 29]
[2016, 3, 1]
[2016, 3, 2]

This code utilizes the 'datetime' built-in module to easily brute-force through dates without having to consider many complex things such as leap years.