This pull request is meant to make it easier for other python applications to import and call pcodedmp functions directly (instead of running it as a separate process). I needed it to integrate pcodedmp with olevba.
The issue is that several functions use print() a lot for display within the parsing code, so it is not possible to call pcodedmp as a library without capturing the output of all the print() calls.
Changes:
A new parameter output_file has been added to each function that calls print(). Its default value is sys.stdout, so that normal behaviour is not changed.
all print() calls are redirected to output_file (except when it was already directed to sys.stderr for error display)
the main function uses output_file when the -o option is used, instead of changing sys.stdout
This pull request is meant to make it easier for other python applications to import and call pcodedmp functions directly (instead of running it as a separate process). I needed it to integrate pcodedmp with olevba. The issue is that several functions use print() a lot for display within the parsing code, so it is not possible to call pcodedmp as a library without capturing the output of all the print() calls.
Changes: