0
我正在写一个简单的模糊器,用于Windows应用程序,基于来自照顾一群猴子谈话的Charlie Miller代码。但我不断收到错误在Python 2.7中编写文件而不被Windows阻止?
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()
我有一种感觉,你需要运行它作为管理员访问程序文件。 – 2012-08-09 16:19:18
当你运行这个目录时,你的当前目录是什么目录?请记住,写入Program Files下的目录与尝试写入UNIX机器上的/ usr/bin或类似的系统目录有点相似。 – 2012-08-09 16:21:57
您的文件名无效,您需要完整路径才能执行可执行文件,而不仅仅是目录才能启动进程。 – 2012-08-09 16:27:36