Skip to content

Commit a1e6acc

Browse files
committed
Secure Source of Randomness
1 parent d7aa917 commit a1e6acc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

python3/hangover.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# !/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
import random
54
import os
65
import subprocess
76
from twilio.base.exceptions import TwilioRestException
87
from twilio.rest import Client
8+
import secrets
99

1010

1111
def get_dotenv():
@@ -70,7 +70,7 @@ def main():
7070
client.messages.create(
7171
to=number_of_boss,
7272
from_=my_number,
73-
body='Gonna work from home. ' + random.choice(excuses),
73+
body='Gonna work from home. ' + secrets.SystemRandom().choice(excuses),
7474
)
7575
except TwilioRestException as e:
7676
# Log errors.

python3/smack_my_bitch_up.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
#!/usr/bin/env python
33

44
import os
5-
import random
65
from twilio.rest import Client # Updated import for newer Twilio versions
76
import subprocess
87
import sys
98
from time import strftime
9+
import secrets
1010

1111
# Exit if no sessions with my username are found
1212
output = subprocess.check_output('who')
@@ -34,7 +34,7 @@
3434
client.messages.create(
3535
to=her_number,
3636
from_=my_number,
37-
body="Late at work. " + random.choice(reasons)
37+
body="Late at work. " + secrets.SystemRandom().choice(reasons)
3838
)
3939

4040
# Print confirmation message

0 commit comments

Comments
 (0)