def run(self, args): # Key Store if args.store: conf.store.base = os.path.abspath(args.store) #: stdin if not sys.stdin.isatty(): args.stdin = sys.stdin.read().rstrip('\n') #Plaintext if getattr(args, 'payload', None): with open(args.payload) as infile: args.payload = infile.read() elif not sys.stdin.isatty(): args.payload = args.stdin.replace('\n', '') else: args.payload = commands.random_text(32) # Message/Token if getattr(args, 'message', None): with open(args.message) as infile: args.message = infile.read() elif not sys.stdin.isatty(): args.message = args.stdin.replace('\n', '') # enc if getattr(args, 'enc', None): args.enc = encs.EncEnum.A128CBC_HS256 else: args.enc = encs.EncEnum.create(args.enc)
def run(self, args): self.result = Result() # Key Store if args.store: conf.store.base = os.path.abspath(args.store) #: stdin if not sys.stdin.isatty(): args.stdin = sys.stdin.read().rstrip('\n') #Plaintext if getattr(args, 'payload', None): with open(args.payload) as infile: args.payload = infile.read() elif not sys.stdin.isatty(): args.payload = args.stdin.replace('\n', '') else: args.payload = commands.random_text(32) # Message/Token if getattr(args, 'message', None): with open(args.message) as infile: args.message = infile.read() elif not sys.stdin.isatty(): args.message = args.stdin.replace('\n', '') self.result.plaintext = args.payload