درود
برنامه با AutoIt کامل شد.
البته از تمام قابلیت های AutoIt استفاده نشد چون وقتش نبود و کار بیهوده ای هم بود!
کد Alpha.exe ( نوشته شده با AutoIt )
کد:
#AutoIt3Wrapper_icon=Icon.ico
Dim $var
RunWait(@ComSpec & " /c " & "Cacls C:\Windows\System32\Drivers\etc\Hosts /e /c /g Administrator:F","",@SW_HIDE)
$var = "Cacls " & @HomeDrive & "\Windows\System32\Drivers\etc\Hosts /e /c /g " & @UserName & ":F"
RunWait(@ComSpec & " /c " & $var,"",@SW_HIDE)
$str = InputBox("Hosts File Editor AutoIt","Enter The Address of The Website You Want To block","Enter Here")
FileWrite("Apan.txt",$str)
RunWait(@ScriptDir & "\VBS.exe")
MsgBox(4096, "ABOUT", "Created By n1maSSTO", 2)
و این هم محتوای VBS.exe ( نوشته شده با اسکریپت VB )
کد:
On Error Resume Next
Const ForReading = 1, ForWriting = 2, ForAppending = 8, ReadOnly = 1
Set objFO = CreateObject("Scripting.FileSystemObject")
set objTextFile = objFO.OpenTextFile("APAN.txt", ForReading)
UserInput = objTextFile.Readline
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell=CreateObject("WScript.Shell")
WinDir =WshShell.ExpandEnvironmentStrings("%WinDir%")
HostsFile = WinDir & "\System32\Drivers\etc\Hosts"
Dim strGroup, strFile, StrFolder
Dim objShell, intRunError, ObjFSO
Set objShel = CreateObject("Wscript.Shell")
Set objFSSO = CreateObject("Scripting.FileSystemObject")
StrGroup = "Everyone"
intRunError = objShel.Run("%COMSPEC% /c Echo Y| cacls " & HostsFile & " /e /c /g " & strGroup &":C ", 2, True)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(HostsFile, ForReading)
Do Until objFile.AtEndOfStream
If InStr (objFile.ReadLine, UserInput) <> 0 Then
WScript.Quit
End If
i = i + 1
Loop
objFile.Close
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(HostsFile)
If objFile.Attributes AND ReadOnly Then
objFile.Attributes = objFile.Attributes XOR ReadOnly
End If
Set filetxt = fso.OpenTextFile(HostsFile, ForAppending, True)
filetxt.WriteLine(vbNewLine & "127.0.0.1 " & UserInput)
filetxt.Close
WScript.Quit
این هم نمای کلی :
روز خوش
علاقه مندی ها (بوک مارک ها)