How does one convert this terminal command to python? Here's the code I have tried, and I need some help with it. The values I want to pass in are < | grep "http" > including the file itself, but I get an error for passing in more than one value.
Terminal command:
swfdump -a /home/cfc/swf/swf/flash2.swf | grep 'http'
Try 1:
dump = Popen(["swfdump", "-a", filename, "|", "grep", "'http'"])
Try 2:
dump = check_output(["swfdump", "-a", filename , "| grep 'http'"])
ERROR:
Try 1:
Only one file allowed. You supplied at least two. (/home/cfc/swf/swf/flash2.swf and |)
Only one file allowed. You supplied at least two. (| and grep)
Only one file allowed. You supplied at least two. (grep and 'http')
Couldn't open 'http': No such file or directory
Only one file allowed. You supplied at least two. (/home/cfc/swf/swf/flash2.swf and |)
Only one file allowed. You supplied at least two. (| and grep)
Only one file allowed. You supplied at least two. (grep and 'http')
Couldn't open 'http': No such file or directory
Try 2:
Only one file allowed. You supplied at least two. (/home/cfc/swf/swf/flash2.swf and | grep 'http')
Couldn't open | grep 'http': No such file or directory
Traceback (most recent call last):
File "./SWFFile.py", line 62, in <module>
main()
File "./SWFFile.py", line 61, in main
trid()
File "./SWFFile.py", line 34, in trid
swfDump()
File "./SWFFile.py", line 48, in swfDump
dump = check_output(["swfdump", "-a", filename , "| grep 'http'"] )
File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['swfdump', '-a', '/home/cfc/swf/swf/flash2.swf', "| grep 'http'"]' returned non-zero exit status 1
Popenis flawed. Check it by typing it into the actual shell.swfdumpcommand.