0

I am working with this python script: https://github.com/sarchar/addressgen/blob/master/genaddress.py

Currently it works via command line like so:

python3 genaddress.py -p passphrase

How would I alter the script to accept a text file of passphrases?

4
  • Please provide an MVCE -- not your entire script! Commented Nov 6, 2018 at 15:09
  • 1
    I feel like your question is too broad for SO. However, you could try to contact the author by filing an issue directly on GitHub, requesting the new feature. Commented Nov 6, 2018 at 15:09
  • 3
    Implement another command line argument like -f filepath in additon to -p passphrase. Then read that argument, check whether file/filepath exists and read its contents. Depending on your further passphase handling, you might want to iterate through all phrases read from the file and pass each phrase to the handler function. Commented Nov 6, 2018 at 15:10
  • 2
    As an alternative, if you don't want to modify the script, you can mess around with pipes to redirect the input from a file into the script. Commented Nov 6, 2018 at 15:11

1 Answer 1

4

I know this might not directly answer the question (How would I alter the script), but it should achieve a similar result on bash with the following command, assuming each passphrase has its own unique output:

cat passphrases.txt | xargs -I phrase python3 genaddress.py -p phrase

This iterates through each line in passphrases.txt and then subsequently passes it to your script, one line at a time.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.