Added tip of the day

pull/1038/head
Hubert Bryłkowski 3 years ago committed by Disconnect3d
parent 34f6cb2800
commit 1027ff2055

@ -6,6 +6,7 @@ import pwndbg.gdbutils
import pwndbg.memoize
from pwndbg.color import disable_colors
from pwndbg.color import message
from pwndbg.tips import get_tip_of_the_day
funcs_list_str = ', '.join(message.notice('$' + f.name) for f in pwndbg.gdbutils.functions.functions)
@ -17,6 +18,9 @@ hint_lines = (
for line in hint_lines:
print(message.prompt('pwndbg: ') + message.system(line))
print(message.prompt('pwndbg: tip of the day: ') + get_tip_of_the_day())
cur = None

@ -0,0 +1,15 @@
from datetime import datetime
from hashlib import md5
TIPS = [
"Don't eat yellow snow",
"With medium power comes medium responsibility"
]
def get_tip_of_the_day() -> str:
day_since_epoch = (datetime.utcnow() - datetime(1970, 1, 1)).days
hash_of_the_day = md5(day_since_epoch.to_bytes(8, 'big', )).hexdigest()
tip_chosen = int(hash_of_the_day, 16) % len(TIPS)
return TIPS[tip_chosen]
Loading…
Cancel
Save