0

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?

elhi
  • 21
  • 2

1 Answers1

0

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 than None in the result tuple, you need to give stdout=PIPE and/or stderr=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.
Community
  • 1
  • 1
Nick T
  • 25,754
  • 12
  • 83
  • 121
  • euh okay I think i get it but by using that how can I know if my fuzzer worked well? – elhi Jan 09 '20 at 17:33
  • No idea, I don't know who/what "Charlie Miller" is, or "fuze"ing PDFs, you didn't mention if you're using a separate program as a fuzzer or just controlling one via Python, etc. etc. – Nick T Jan 09 '20 at 17:38
  • yeah just ahaha i'll read more about the subprocess to try to figure it out – elhi Jan 09 '20 at 17:41