voyagerPath = "" params = "/NOLOGO" password = "" encryptPass = "" autoRunSuggest = True autoRunStartDelay = 7000 ' 7 sec OSmark = "" Dim searchText,replaceText, OSLang If Wscript.Arguments.Count Then params = params + " " + Wscript.Arguments(0) If Wscript.Arguments.Count Then Wscript.Sleep(autoRunStartDelay) Set WshShell = WScript.CreateObject("WScript.Shell") Set FSO = CreateObject("Scripting.FileSystemObject") cFingerprint = Fingerprint() cOSmark = Right(cFingerprint, 3) If (encryptPass = "" And password = "" Or cOSmark <> OSmark) Then Do password = InputBox(Lng(0), Lng(1)) If IsEmpty(password) Then WScript.Quit ElseIf (password = "") Then MsgBox Lng(2), vbExclamation, Lng(1) Else encPass = Crypt(Fingerprint(), password) If (encPass <> "") Then Call ReplaceLineInScript("encryptPass =", "encryptPass = """ & Replace(Crypt(Fingerprint(), password), """", """""") & """") Call ReplaceLineInScript("OSmark =", "OSmark = """ & Replace(cOSmark, """", """""") & """") Exit Do Else res = MsgBox(Lng(7), vbYesNo+vbExclamation, "") If (res = vbYes) Then Call ReplaceLineInScript("password =", "password = """ & Replace(password, """", """""") & """") Call ReplaceLineInScript("OSmark =", "OSmark = """ & Replace(cOSmark, """", """""") & """") Exit Do End If End If End If Loop End If If (voyagerPath = "") Then voyagerPath = "voyager.exe" If Not FSO.FileExists(voyagerPath) Then result = MsgBox(Lng(3), 36, voyagerPath & Lng(4)) If (result = vbYes) Then Do Set oExec=WshShell.Exec("mshta.exe ""about:<input type=file id=FILE><script>FILE.click();new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>""") voyagerPath = oExec.StdOut.ReadLine If (Right(voyagerPath, 12) = "\voyager.exe") Then Exit Do Else result = MsgBox (Lng(5), vbOKCancel + vbExclamation, "") If (result = vbCancel) Then WScript.Quit End If Loop Call ReplaceLineInScript("voyagerPath =", "voyagerPath = """ & voyagerPath & """") Else WScript.Quit End If End If startUpLink = WshShell.SpecialFolders("Startup") & "\voyagerLauncher.lnk" Set oShortCut = WshShell.CreateShortcut(startUpLink) If ((autoRunSuggest Or OSmark <> cOSmark) And (oShortCut.TargetPath <> Wscript.ScriptFullName)) Then result = MsgBox (Lng(6), vbYesNo+vbQuestion, "") If (result = vbYes) Then oShortCut.TargetPath = Wscript.ScriptFullName oShortCut.Arguments = "/minimized" oShortCut.WorkingDirectory = FSO.GetParentFolderName(FSO.GetFile(Wscript.ScriptFullName)) oShortCut.IconLocation = voyagerPath If (voyagerPath = "voyager.exe") Then oShortCut.IconLocation = oShortCut.WorkingDirectory & "\voyager.exe" oShortCut.Save If Not autoRunSuggest Then Call ReplaceLineInScript("autoRunSuggest = False", "autoRunSuggest = True") ElseIf (result = vbNo) Then Call ReplaceLineInScript("autoRunSuggest = True", "autoRunSuggest = False") End If End If If (encryptPass <> "") Then password = Crypt(cFingerprint, encryptPass) VoyProcAlreadyExist = CreateObject("WbemScripting.SWbemLocator").ConnectServer(".", "Root\CIMV2").ExecQuery("SELECT * FROM Win32_Process WHERE Name='voyager.exe'").Count > 0 If VoyProcAlreadyExist Then MsgBox "voyager.exe" & Chr(10) & Lng(8), vbExclamation, "\(0_o)/" If VoyProcAlreadyExist Then WScript.Quit theVoyProcID = WshShell.Exec(voyagerPath & " " & params).ProcessID clipbrd = WScript.CreateObject("HTMLFile").parentWindow.clipboardData.getData("text") Wscript.Sleep(100) WSHShell.Run "cmd.exe /C <nul set /p ""=" & password & """ | CLIP", 0, True Wscript.Sleep(100) WshShell.AppActivate(theVoyProcID) Wscript.Sleep(10) WshShell.SendKeys("^v~") WSHShell.Run "cmd.exe /C <nul set /p ""=" & clipbrd &""" | CLIP", 0, True WScript.Quit Sub ReplaceLineInScript(searchText,replaceLine) Set objFile = FSO.OpenTextFile(Wscript.ScriptFullName) Set objTemp = FSO.OpenTextFile(Wscript.ScriptFullName & "Temp", 2, True) i = 0 Do Until objFile.AtEndOfStream wrLine = objFile.ReadLine If (i < 7 And InStr(1, wrLine, searchText, vbTextCompare) > 0) Then wrLine = replaceLine objTemp.WriteLine wrLine i = i + 1 Loop objFile.Close objTemp.Close FSO.CopyFile Wscript.ScriptFullName & "Temp", Wscript.ScriptFullName, True FSO.GetFile(Wscript.ScriptFullName & "Temp").Delete End Sub Function Fingerprint For Each os in GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2").ExecQuery("Select * from Win32_OperatingSystem") key = os.RegisteredUser & Replace(Replace(Replace(os.SerialNumber,"0","",1,-1,0),"OEM","",1,-1,0),"-","",1,-1,0) key2 = Right(os.Caption, Len(os.Caption) - 18) key3 = os.BuildNumber & os.TotalVisibleMemorySize Fingerprint = Crypt(key3, StrReverse(Crypt(key, key2))) OSLang = os.OSLanguage Next End Function Function Crypt(key, str) ' str, key - strings, containing chars from 32 to 126 ASCII code table ' return encrypt/decrypt string; if input strings containe chars not in allowed limits, empty string return For x = 1 To (Len(str) + Len(key) - Abs(Len(str) - Len(key)))/2 keyCharNum = Asc( Mid (key, (x-1) Mod Len(key) + 1, 1)) strCharNum = Asc( Mid (str, (x-1) Mod Len(str) + 1, 1)) If (keyCharNum > 126 Or keyCharNum < 32 Or strCharNum > 126 Or strCharNum < 32) Then Crypt = "" Exit For End If diffCharNum = keyCharNum - strCharNum If (diffCharNum < 0) Then diffCharNum = diffCharNum + 126 - 32 + 1 diffChar = chr(diffCharNum + 32) Crypt = Crypt & diffChar Next End Function Function Lng(str) Dim MessEn(9), MessRu(9) MessEn(0) = "It will be stored in the script," & Chr(10) & "encrypted by your OS fingerprint." & Chr(10) & "On other computer (or account) stored password will not work" MessEn(1) = "Enter Voyager password" MessEn(2) = "Password can't be empty." MessEn(3) = "If you want the script to remember path to voyager.exe," & Chr(10) & "press Yes and specify the path to voyager.exe;" & Chr(10) & Chr(10) & "If you want to put script in Voyager directory," & Chr(10) & "press No and move it there." MessEn(4) = " — file not found." MessEn(5) = "Choose ""voyager.exe""," & Chr(10) & "please." MessEn(6) = "Add to autorun?" MessEn(7) = "Script can't encrypt pass with national characters." & Chr(10) & "Save your password as plain text?" MessEn(8) = "already run." MessRu(0) = "Он будет сохранен в скрипте" & Chr(10) & "в зашифрованном отпечатком ОС виде." & Chr(10) & "На другом компьютере (или под другим пользователем)" & Chr(10) & "сохраненный пароль не сработает." MessRu(1) = "Введите пароль Voyager'a" MessRu(2) = "Пароль не может быть пустым." MessRu(3) = "Если вы хотите, чтобы скрипт запомнил путь к voyager.exe," & Chr(10) & "нажмите Да и укажите путь;" & Chr(10) & Chr(10) & "Если вы хотите положить скрипт в папку Voyager'а," & Chr(10) & "нажмите Нет и переместите его туда." MessRu(4) = " — файл не найден." MessRu(5) = "Выберите ""voyager.exe""," & Chr(10) & "пожалуйста." MessRu(6) = "Добавить в автозагрузку?" MessRu(7) = "Скрипт не поддерживает шифровку пароля с национальными буквами." & Chr(10) & "Сохранить пароль открытым текстом?" MessRu(8) = "уже запущен." Select Case OSLang Case 1049 Lng = MessRu(str) Case Else Lng = MessEn(str) End Select End Function |