Created
December 19, 2017 17:39
-
-
Save clayball/b3267a4eddd6f59871b8a76c02a96665 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import sys | |
| # @_clayball | |
| # A quick helper script for encoding and decoding hex. | |
| # Use positional arguments | |
| try: | |
| action = sys.argv[1] | |
| except: | |
| print 'The first argument must be encode or decode' | |
| exit() | |
| try: | |
| string = sys.argv[2] | |
| except: | |
| print 'The second argument must be the string to encode|decode' | |
| exit() | |
| if action == 'encode': | |
| result = str(string).encode("hex") | |
| if action == 'decode': | |
| result = str(string).decode("hex") | |
| print 'The ' + action + 'd string is below' | |
| print '' | |
| print result | |
| print '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment