Does Open Method in Python Executes an EXE

Viewed 54

I wonder if open(file_name, "rb") as binary_file: pass does actually executes a file if it's exe? I am asking because I am reading some malicious files and viruses using Python stored as ".exe" files.

1 Answers

No it doesn't AND the flags 'rb' in your open statement stand for read binary. So it's only reading the file and putting it in a byte like object. So not only is it not executing (because that's not a function of open) it's only going to be opened in read mode.

You can read about the open function in the documentation.

Related