Skip to content

Instantly share code, notes, and snippets.

@ikhlestov
Created January 4, 2017 14:57
Show Gist options
  • Save ikhlestov/098c3b1e30a6df9974334b75295b137c to your computer and use it in GitHub Desktop.
Save ikhlestov/098c3b1e30a6df9974334b75295b137c to your computer and use it in GitHub Desktop.
import hashlib
import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument('--md5', type=str, required=True)
args = parser.parse_args()
script_to_run = 'some.py'
user_md5 = args.md5
while True:
hash_md5 = hashlib.md5()
with open(script_to_run, 'rb') as f:
hash_md5.update(f.read())
counter_md5 = hash_md5.hexdigest()
if counter_md5 == user_md5:
print("Start running scipt")
subprocess.run('python3.5 %s' % (script_to_run), shell=True)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment