Closed stephenoneal closed 7 years ago
I believe you are correct.
It will not authenticate with %d, as it will have a leading zero. @stephenoneal what python version and OS do you use?
http://stackoverflow.com/questions/904928/python-strftime-date-without-leading-0
python 3.4, Windows
oddly i changed it to datetime.datetime.utcnow().strftime("%a %b %d %H:%M:%S UTC %Y") locally and it's passing the PASSWORD_VERIFIER challenge
oddly i changed it to datetime.datetime.utcnow().strftime("%a %b %d %H:%M:%S UTC %Y") locally and it's passing the PASSWORD_VERIFIER challenge
It will fail on May 1.
p.s. To fix this issue the code should be compatible with Windows and Linux both.
Oh yeah, that happened at the beginning of this month.
my attention on this is not great right now. need more coffee..
import platform windows_os = any(platform.win32_ver())
timestamp = test_timestamp or \
( datetime.datetime.utcnow().strftime("%a %b %#d %H:%M:%S UTC %Y") if windows_os \
else datetime.datetime.utcnow().strftime("%a %b %-d %H:%M:%S UTC %Y") )
@armicron I think @stephenoneal is proposing a way to detect the OS and format the string accordingly.
I can't test it on windows.
import sys
if sys.platform.startswith('win32'):
format_string = "%a %b %#d %H:%M:%S UTC %Y"
else:
format_string = "%a %b %-d %H:%M:%S UTC %Y"
timestamp = test_timestamp or datetime.datetime.utcnow().strftime(format_string)
Fixed in #28
https://github.com/capless/warrant/blob/master/warrant/aws_srp.py#L158
I think you want "%a %b %d %H:%M:%S UTC %Y" for the strftime %-d is invalid.