For school I have to make a fuzzer, I use Charle Miller to fuze pdf files. I want to check to amount of failure of an app. When I do
result = process.communicate()
print(result)
it print (None,None) several times what does that mean?
For school I have to make a fuzzer, I use Charle Miller to fuze pdf files. I want to check to amount of failure of an app. When I do
result = process.communicate()
print(result)
it print (None,None) several times what does that mean?
It means that when you created the subprocess.Popen
object, you did not specify stdout=PIPE
or stderr=PIPE
.
Popen.
communicate
(input=None, timeout=None)Interact with process: Send data to stdin. Read data from stdout and stderr [...]
communicate()
returns a tuple (stdout_data, stderr_data). [...]Note that if you want to send data to the process’s stdin, you need to create the Popen object with
stdin=PIPE
. Similarly, to get anything other thanNone
in the result tuple, you need to givestdout=PIPE
and/orstderr=PIPE
[emph. added] too.— subprocess - Subprocess Management - Python 3 Documentation
For example:
import subprocess
apples_only = subprocess.Popen(
["grep", "apple"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
)
out, err = apples_only.communicate(b"pear\napple\nbanana\n")
print((out, err))
# (b'apple\n', None) # did not say stderr=PIPE so it's None.