我正在编写一个简单的 fuzzer,用于 Windows 应用程序,它基于 Charlie Miller 的代码,来自一群猴子的保姆谈话。但是我一直收到错误
Traceback (most recent call last):
File "D:/Python27/fuzzer.py", line 29, in <module>
process=subprocess.Popen([app_choice,fuzz_output])
File "D:\Python27\lib\subprocess.py", line 679, in __init__
errread, errwrite)
File "D:\Python27\lib\subprocess.py", line 896, in _execute_child
startupinfo)
WindowsError: [Error 5] Access is denied
有谁知道如何绕过这个?我真的很难过,因为老实说,我对 Windows 7 权限或 Python 2.7 不太熟悉。完整代码如下
#List of file names (all located in the python folder)
fuzz_files=[ "slides_algo-guiding.pdf", "slides_algo-intro-annotated- final.pdf","slides_algo-merge1.pdf"]
apps=["C:\Program Files (x86)\Adobe\Reader 9.0\Reader"
]
#Creates an output file in the Python folder
fuzz_output="fuzz.pdf"
FuzzFactor=50
num_tests=1000
import math
import string
import random
import subprocess
import time
for i in range(num_tests):
file_choice=random.choice(fuzz_files)
app_choice=random.choice(apps)
buf=bytearray(open(file_choice,'rb').read())
#Charlie Miller code
numwrites=random.randrange(math.ceil((float(len(buf))/FuzzFactor)))+1
for j in range(numwrites):
rbyte=random.randrange(256)
rn=random.randrange(len(buf))
buf[rn]="%c"%(rbyte)
#End Charlie miller code
#Write code
open(fuzz_output,'wb').write(buf)
process=subprocess.Popen([app_choice,fuzz_output])
time.sleep(1)
crashed=process.poll()
if not crashed:
process.terminate()