I'm working on a CTF challenge that is find a secret password.This secret password base on the username and password that i input and the hash value had print out after hash calculation and i want to capture this hash value at a parameter to my script to calculate the secret pass Can someone tell me how can i do it or another solution to solve my problem Thanks

  • Please add more info. Your answer is too generic for people to give meaningful answers.
    – tmr232
    Dec 15, 2020 at 20:52

1 Answer 1


It sounds like you want your python script to read from stdin.

import sys
if not sys.stdin.isatty():
    param = sys.stdin.read()

To use it: echo 'param value' | python3 script.py

  • tks but i want it read from stdout of program because the program will print one value that i need for calculating
    – y_man
    Dec 3, 2020 at 9:32
  • If you're not familiar with linux, the | command redirects the output (stdout) of one program to the input (stdin) of another. So somecommand | python3 script.py will do what you've asked. Dec 3, 2020 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.