Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-20 07:59:01

0001 import os
0002 import sys
0003 
0004 from pandaharvester.harvesterconfig import harvester_config
0005 from pandaharvester.harvestercore import core_utils
0006 
0007 if not hasattr(harvester_config.watcher, "passphraseEnv"):
0008     print("ERROR: passphraseEnv is not defined in the watcher section of etc/panda/panda_harvester.cfg")
0009     sys.exit(1)
0010 
0011 envName = harvester_config.watcher.passphraseEnv
0012 
0013 if envName not in os.environ:
0014     print(f"ERROR: env variable {envName} is undefined in etc/sysconfig/panda_harvester")
0015     sys.exit(1)
0016 
0017 key = os.environ[envName]
0018 secret = sys.argv[1]
0019 
0020 cipher_text = core_utils.encrypt_string(key, secret)
0021 
0022 print(f"original: {secret}")
0023 print(f"encrypted: {cipher_text}")
0024 
0025 plain_text = core_utils.decrypt_string(key, cipher_text)
0026 print(f"decrypted: {plain_text}")
0027 
0028 if secret != plain_text:
0029     print("ERROR: the encrypted string cannot be correctly decrypted")