This repository was archived by the owner on Oct 26, 2021. It is now read-only.
forked from bamos/python-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphonetic_password.py
More file actions
executable file
·67 lines (59 loc) · 2.32 KB
/
Copy pathphonetic_password.py
File metadata and controls
executable file
·67 lines (59 loc) · 2.32 KB
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
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python3
__author__ = ['[Brandon Amos](http://bamos.github.io)', '[Chase Thompson-Baugh](https://amoreopensource.wordpress.com)']
__date__ = '2014.02.14'
"""
Obtain the NATO phonetic alphabet representation from short phrases or passwords
```
$ phonetic.py Github/1
G - Golf
i - india
t - tango
h - hotel
u - uniform
b - bravo
/ - Forward Slash
1 - One
```
"""
import sys
phonetic_table = {
'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': 'x-ray',
'y': 'yankee', 'z': 'zulu',
}
# Contains ASCII characters found in passwords
symbol_table = {
'~': 'Tilde', '`': 'Back tick', '!': 'Exclamation Mark', '@': 'At Symbol',
'#': 'Hash', '$': 'Dollar sign', '%': 'Percent', '^': 'Caret', '*': 'Star',
'(': 'Open Parenthesis', ')': 'Close Parenthesis', '-': 'Hyphen', '_': 'Underscore',
'+': 'Plus', '=': 'Equal', '{': 'Open Brace', '}': 'Close Brace', '[': 'Open Bracket',
']': 'Close Bracket', '|': 'Pipe', '\\': 'Backslash', '/': 'Forward Slash', ':': 'Colon',
';': 'Semicolon', '"': 'Double Quote', '\'': 'Single Quote', '<': 'Less Than',
'>': 'Greater Than', ',': 'Comma', '.': 'Period', '?': 'Question Mark', '&': 'Ampersand'
}
number_table = {
'1': 'One', '2': 'Two', '3': 'Three', '4': 'Four', '5': 'Five',
'6': 'Six', '7': 'Seven', '8': 'Eight', '9': 'Nine', '0': 'Zero'
}
for word in sys.argv[1:]:
for char in word:
title = False
if char.istitle():
title = True
char = char.lower()
if char not in phonetic_table:
if char not in symbol_table:
if char not in number_table:
print('Please define: {}'.format(char))
else:
print("{0} - {1}".format(char, number_table[char]))
else:
print("{0} - {1}".format(char, symbol_table[char]))
else:
if title:
print("{0} - {1}".format(char.upper(), phonetic_table[char].title()))
else:
print("{0} - {1}".format(char, phonetic_table[char]))