Created
January 4, 2017 14:57
-
-
Save ikhlestov/098c3b1e30a6df9974334b75295b137c to your computer and use it in GitHub Desktop.
This file contains 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
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