I'm attempting to read in a file and produce a hash of said file. For the most part, this has gone smoothly. However, there are a few files that I am unable to get a handle to. For instance:
file("c:\\windows\\system32\\nvvsvc.exe")
Produces the error: IOError: [Errno 2] No such file or directory: 'c:\\windows\\system32\\nvvsvc.exe
Similarly, the command:
subprocess.check_output(r"dir c:\windows\system32\nvvsvc.exe", shell = True)
Produces the error:
File Not Found
Traceback (most recent call last):
File "< stdin >", line 1, in < module >
File "C:\Python27\lib\subprocess.py", line 544, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command 'dir c:\windows\system32\nvvsvc.exe' returned non-zero exit status 1
I tried many variations thereof, including trying to even get cacls.exe to admit there's a file there. However, when I back out of the python instance (exit()) and perform a dir c:\windows\system32\nvvsvc.exe, it returns that there is indeed a file there.
A similar test using calc.exe instead allows me to view it and hash it both just fine from inside python.
I'm running Python 2.7. I've attempted kicking off python with administrative privs (run as administrator for the command prompt), but that doesn't change anything. There appears to be some change in privileges when running from inside python to the extent that the file system is essentially pretending that file doesn't exist to python.
For reference, the owner of the file in question (there are others that are similar), is system, and the cacls on the file allow reading of it from user, admin and system.