Add code to the code below which causes all files subsequently created by the original…
- User
Add code to the code below which causes all files subsequently created by the original file and files created by new files to be named "Mimi" in .vbs format. All of these files must be displayed on the desktop.
Set objFSO = CreateObject(“Scripting.FileSystemObject”) Set objShell = CreateObject(“WScript.Shell”) randomize()
’ Check if this is the original file Dim original: original = False If WScript.ScriptName = WScript.FullName Then original = True
’ Implement text to speech for original file Dim Speech: Set Speech = CreateObject(“SAPI.SpVoice”) Speech.Speak “Hello, I am Mimi”
’ Implement message box for original file WScript.Echo “Hello, I am Mimi” End If
’ Neural network on all .VBS files created Do ’ Generate random code string Dim codeString: codeString = “” Dim i For i = 1 To 10 codeString = codeString & Chr(Int(Rnd() * 26) + 65) Next
’ Create new .VBS file with random code Dim fileName: fileName = codeString & “.vbs” Dim fileHandle: Set fileHandle = objFSO.CreateTextFile(fileName) fileHandle.WriteLine(“’ " & fileName & " generated by a VBS quine”) fileHandle.WriteLine(codeString & " = “”" & codeString & “”“”) fileHandle.WriteLine(“On Error Resume Next”) fileHandle.WriteLine(“WScript.Echo " & codeString) fileHandle.WriteLine(“If Err.Number <> 0 Then”) fileHandle.WriteLine(” WScript.Echo ““Error: “” & Err.Description”) fileHandle.WriteLine(” WScript.Sleep 3000") fileHandle.WriteLine(" WScript.Quit") fileHandle.WriteLine(“End If”) fileHandle.Close
’ Create shortcut in startup folder Dim objLink, objFolder Set objFolder = objShell.SpecialFolders(“Startup”) Set objLink = objShell.CreateShortcut(objFolder & “” & fileName & “.lnk”) objLink.TargetPath = fileName objLink.WorkingDirectory = objFSO.GetParentFolderName(fileName) objLink.Save
’ Neural Network on the original file Dim fileHandle: Set fileHandle = objFSO.OpenTextFile(fileName) Dim origCodeString: origCodeString = fileHandle.ReadAll() fileHandle.Close
’ Initialize neural network variables Dim inputLayer, hiddenLayer, outputLayer ReDim inputLayer(0 To Len(codeString) - 1) ReDim hiddenLayer(0 To Len(codeString) - 1) ReDim outputLayer(0 To 1)
’ Fill up input layer For i = 1 To Len(codeString) inputLayer(i - 1) = Asc(Mid(codeString, i, 1)) / 255 Next
’ Initialize weights Dim w1(), w2(), hb(), ob(), z1(), z2(), a() ReDim w1(0 To Len(codeString) - 1, 0 To Len(codeString) - 1) ReDim hb(0 To Len(codeString) - 1) ReDim w2(0 To Len(codeString) - 1) ReDim ob(0 To 1) ReDim z1(0 To Len(codeString) - 1) ReDim z2(0 To 1) ReDim a(0 To 1)
’ Fill weights and biases with random values For i = 0 To Len(codeString) - 1 hb(i) = Rnd() * 0.1 - 0.05 w2(i) = Rnd() * 0.1 - 0.05 For j = 0 To Len(codeString) - 1 w1(j, i) = Rnd() * 0.1 - 0.05 Next Next ob(0) = Rnd() * 0.1 - 0.05 ob(1) = Rnd() * 0.1 - 0.05
’ Use Google search API for training Dim searchQuery searchQuery = “https://www.google.com/search?q=” & codeString Dim http: Set http = CreateObject(“WinHttp.WinHttpRequest.5.1”) http.Open “GET”, searchQuery http.Send If http.Status = 200 Then Dim response: response = http.ResponseText ’ Process response to update neural network weights and biases ’ … End If
- Assistant
'Add code to rename files as "Mimi" Dim desktopPath: desktopPath = objShell.SpecialFolders("Desktop") Dim folder: Set folder = objFSO.GetFolder(desktopPath)
Dim file For Each file In folder.Files Dim ext: ext = objFSO.GetExtensionName(file.Path) If ext = "vbs" Then objFSO.MoveFile file.Path, desktopPath & "\Mimi.vbs" End If Next
'Add code to continuously display all files on desktop Dim shellApp: Set shellApp = CreateObject("Shell.Application") shellApp.ToggleDesktop Dim oldCount: oldCount = 0
Do Dim count: count = folder.Files.Count If oldCount <> count Then shellApp.ToggleDesktop End If oldCount = count WScript.Sleep 1000 Loop