Skip to content

Instantly share code, notes, and snippets.

@jamcut
Created April 21, 2015 14:50
Show Gist options
  • Save jamcut/34022c3919b782fb52b2 to your computer and use it in GitHub Desktop.
Save jamcut/34022c3919b782fb52b2 to your computer and use it in GitHub Desktop.
Simple base Python script template
#!/usr/bin/env python
import argparse
import sys
# uncomment to make use of colorprint
#try:
# from colorprint import *
#except:
# print("[-] Could not import colorprint. Install it by running 'git clone https://gist.github.com/2d61c414870b75168d56.git'")
# sys.exit(0)
def main():
# setup arguments
parser = argparse.ArgumentParser(description='Put description here')
parser.add_argument('-f', '--file', help='input file for script to process')
parser.add_argument('-o', '--output', help='file to write output')
parser.add_argument('-v', '--verbose', help='show verbose output', action='store_true')
# add additional arguments here
# parse arguments
args = parser.parse_args()
# do some other stuff here
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment