Command line arguments
Required Libraries
import sys
# or
import argparse
Sys.argv example
import sys
if len(sys.argv) < 2:
print("Provide at least one argument")
print(sys.argv[1])
Argparse Example
import argparse
parser = argparse.ArgumentParser(description='Tool for ViewState encryption / decryption')
parser.add_argument('value', type=str, help='ViewState value that you want to decode / Payload that you want to encode (depends on a used switch)')
parser.add_argument('-d', '--decode', action='store_true', help='ViewState decoding mode.')
parser.add_argument('-e', '--encode', action='store_true', help='Payload encoding mode.')
args = parser.parse_args()
print(args.value)
print(args.decode)
print(args.encode)
# Usage example
kamil@mbp-kamil StateCoder % python3 statecoder.py -d abcd
abcd
True
False
Last updated