CompletedNetcat¶
- class pync.CompletedNetcat(args, returncode, stdout=None, stderr=None)[source]¶
A Netcat instance that has finished running. This is returned by the
pync.run()function.- Parameters:
args (str) – The args string given to run the Netcat instance.
returncode (int) – The exit code of the Netcat instance.
stdout (file, optional) – The standard output (None if not captured).
stderr (file, optional) – The standard error (None if not captured).
- Examples:
Capture the response from a server as a byte string.¶import pync result = pync.run('localhost 8000', capture_output=True) print(result.stdout.decode())
Run pync and return the exit code.¶import sys import pync result = pync.run(...) sys.exit(result.returncode)