I'm trying to write a simple script that takes a list of words I've created in a text file on linux and runs it through a program that checks the word against a steganography extractor.
The program (steghide) uses the following syntax in the command:
steghide --extract -p {password here} -sf {filename here}
I've been able to call the file and set up a for loop for the words in the list, but can not find a way to input the word from that iteration into each command.
Here's how I've been trying to work it.
import os
import sys
script, filename = argv
filename2 = sys.open(filename)
for word in filename2:
os.system('steghide --extract -p [want to put something here] -sf stegfilename')
I'm on a controlled box and can't download anything beyond what I already have. Any help is appreciated.
Update:
I got it to work. But now I'm trying to get it to exit out if it finds the correct answer. I am just having a hard time getting Python to read the output. Here's what I have so far.
`import subprocess from sys import argv
script, filename = argv passes = filename
with open(passes) as f: for line in f: proc = subprocess.popen(['steghide', '--extract', '-p' line.strip(), '-sf', 'stegged file name'],stdout = subprocess.PIPE) stdout = proc.communicate()[0] output = proc.stdout.readline()
if 'wrote' in output:
print 'YOU FOUND IT!'
break
else:
print line`