Data Execution Protection

DEP wir duch ändern einer einzelnen Zeile permanent aktiviert.

Die BOOT.INI wird zunächst komplett in ein Array eingelesen. Danach wird zeilenweise nacheinander nach zwei Strings gesucht und diese dann geändert.

Zum Schluss dann abspeichern unter neuem Namen und das Kopieren/Umbenennen der BOOT.INI

 

option explicit
on error resume next

Dim fso, filein, fileout, i, return, str

Set fso = CreateObject("Scripting.FileSystemObject")
Set filein = fso.GetFile("C:\BOOT.INI")
Set fileout = fso.createtextfile("C:\BOOT_ORG.INI")

function edit_ini ()
filein.attributes = 32

set filein=fso.opentextfile ("C:\BOOT.INI",1)
i=0
redim preserve zeile(i)

do while not (filein.AtEndOfStream)

zeile(i) = lcase(filein.readline)

if instr (zeile(i), "/noexecute=") then
if instr (zeile(i), "/noexecute=alwaysoff") then

wscript.quit

else

if instr (zeile(i), "/noexecute=optin") then
zeile(i)=replace (zeile(i),"/noexecute=optin", "/noexecute=alwaysoff")

return = true
end if
end if
end if
fileout.writeline (zeile(i))
loop
fileout.close
filein.close

if return then
fso.copyfile "C:\BOOT.INI", "C:\BOOT_ORIGINAL.INI"
fso.copyfile "C:\BOOT_ORG.INI", "C:\BOOT.INI", true
fso.deletefile "C:\BOOT_ORG.INI"
Set filein = fso.GetFile("C:\BOOT.INI")
Set fileout = fso.GetFile("C:\BOOT_ORIGINAL.INI")
filein.attributes = 39
fileout.attributes = 39
end if
end function

function restore_orig

if fso.FileExists("C:\BOOT_ORIGINAL.INI") then

Set filein = fso.GetFile("C:\BOOT.INI")
Set fileout = fso.GetFile("C:\BOOT_ORIGINAL.INI")
filein.attributes = 32
fileout.attributes = 32

fso.copyfile "C:\BOOT_ORIGINAL.INI","C:\BOOT.INI"
fso.deletefile "C:\BOOT_ORIGINAL.INI"
if fso.FileExists("C:\BOOT_ORG.INI") then
fso.DeleteFile "C:\BOOT_ORG.INI"
end if

filein.attributes = 39

end if

end function

 

  • Mittwoch, 14 März 2018

Leave a comment

You are commenting as guest.