-
Notifications
You must be signed in to change notification settings - Fork 0
/
reddit_encode_plaintext.py
56 lines (46 loc) · 1.68 KB
/
reddit_encode_plaintext.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""
CSEC 791 MS Project
Grace Lombardi
Reddit Covert Channel
Encode Plaintext
"""
import praw
import reddit_config
def authenticate():
"""
This function authenticates to the reddit api.
"""
reddit = praw.Reddit(client_id=reddit_config.client_id,
client_secret=reddit_config.client_secret,
user_agent=reddit_config.user_agent,
redirect_uri=reddit_config.redirect_uri,
refresh_token=reddit_config.refresh_token)
return reddit
def get_message_input():
"""
This function prompts the user for a message to encode and then returns a list of all characters
in the message.
"""
message = input("Enter the message to encode: ")
message = message.replace(" ", "")
chars = list(message)
return chars
def main():
"""
This is the main encoding function.
"""
mil_alphabet = {'a': 'alpha', 'b': 'bravo', 'c': 'charlie', 'd': 'delta', 'e': 'echo',
'f': 'foxtrot', 'g': 'golf', 'h': 'hotel', 'i': 'india', 'j': 'juliet',
'k': 'kilo', 'l': 'lima', 'm': 'mike', 'n': 'november', 'o': 'oscar',
'p': 'papa', 'q': 'quebec', 'r': 'romeo', 's': 'sierra', 't': 'tango',
'u': 'uniform', 'v': 'victor', 'w': 'whiskey', 'x': 'xray', 'y': 'yankee',
'z': 'zulu'}
message = get_message_input()
reddit = authenticate()
for letter in message:
comment = mil_alphabet[letter]
submission = reddit.submission("dgx575")
submission.reply(body=comment)
print("Finished Adding Comments to Hide Message")
if __name__ == '__main__':
main()