this might be trivial but I'm writing a VBScript template and I wanted to add the possibility to inject VBScript code from the internet inside VBScript and run it.
The code originally was:
Sub WebImport(URL)
' Import the VBS code at a given URL.
' and run it globally pushing the functions into the Main
Dim Request
Set Request = createobject ("MSXML2.ServerXMLHTTP")
Request.Open "GET", URL, false
Request.Send
ExecuteGlobal Request.ResponseText
Set Request = Nothing
End Sub
I already wrote a function to import code, just like Python, and the principle is the same. It works flawlessly.
If the WebImport
works as it should, I'll create a basic import that handles them in the same way.
I import the raw code from my own repository here.
It does everything correctly except executing the file globally in the Main scope, I tried with/without deleting the file, the result doesn't change at all, unfortunately...
Edit
This is the full script, it imports WebImport
from scr/Functions
and runs the code to inject the code from a given repo until it has to write a file, then 800a0046 vbscript at row 0, line 1
kicks in... I'm admin on the machine.
Option Explicit
' VBScript Main File Model
' Author:
' Fabio Craig Wimmer Florey (fabioflorey@hackermail.com)
'
' Reviewed By: Last Review:
' Fabio Craig Wimmer Florey (fabioflorey@hackermail.com) 2022-03-29
'
' Description:
' Main Subroutine
Import "src/Functions"
WebImport "https://raw.githubusercontent.com/nmoosaJHB/Docker-compose-SuiteCRM/714bada98abbb2ab497258c8ea9a726f234aaba3/public_html/vendor/gymadarasz/ace/demo/kitchen-sink/docs/vbscript.vbs"
Sub Main()
' Main Subroutine
MakeHelloWorldFile "Hello.txt"
End Sub
Sub Import(Filename)
' Import Code from VBS File, DO NOT DELETE
Dim Lib, Code, FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Lib = FSO.OpenTextFile(Filename & ".vbs")
Code = Lib.ReadAll
Lib.Close
ExecuteGlobal Code
Set Lib = Nothing
Set FSO = Nothing
End Sub
Call Main