Microsoft Edge

Microsoft Edge

Postby negg » 17.09.2020, 13:26

Hi Microsoft edge can now be installed as a KB article in windows 8.1 and 10 (probably Windows 7 as well) sorry, not sure on the number. Therefore is it possible to add this into the CE version of wsus?
negg
 
Posts: 193
Joined: 26.03.2014, 11:46

Re: Microsoft Edge

Postby aker » 20.09.2020, 13:27

For the KB-numbers there is no official download link, just a few inofficial ones.
Currently I do not know any way to determine the links in a stable way.
The files I have have old versions and I don't want to inlcude old versions.

If you know a way to get the most recent files, please let me know.
The I would integrate it for 20H2/19042 and newer an think about integrating it for 1903/18362 - 2004/19041.
I'll open an internal ticket, so I won't forget it, but currently other tasks (fixing broken links for the ESR-version, reworking the Servicing Stack algorithm, integrating 2020-09 updates) have higher priority.
Wer Rechtschreibfehler findet, darf sie behalten oder an den Meistbietenden versteigern. / Everybody finding a misspelling is allowed to keep or sell it.
aker


WSUS Offline Update „Community Edition“ 12.4 / 11.9.7esr
https://gitlab.com/wsusoffline
aker
 
Posts: 3839
Joined: 02.03.2011, 15:32

Re: Microsoft Edge

Postby aker » 20.09.2020, 20:22

I found the following:

Code: Select all
https://www.microsoft.com/de-de/edge/business/download

http://dl.delivery.mp.microsoft.com/filestreamingservice/files/5350dcd0-a1ff-4756-b717-43971fca682b/MicrosoftEdgeEnterpriseX86.msi
http://dl.delivery.mp.microsoft.com/filestreamingservice/files/63c21fa1-e10e-40ef-a9ac-b51f877c7cfb/MicrosoftEdgeEnterpriseX64.msi
Wer Rechtschreibfehler findet, darf sie behalten oder an den Meistbietenden versteigern. / Everybody finding a misspelling is allowed to keep or sell it.
aker


WSUS Offline Update „Community Edition“ 12.4 / 11.9.7esr
https://gitlab.com/wsusoffline
aker
 
Posts: 3839
Joined: 02.03.2011, 15:32

Re: Microsoft Edge

Postby negg » 21.09.2020, 20:57

Hi, I've managed to find this that shows you what prerequisites are needed but not the location to download edge.

https://support.microsoft.com/en-us/help/4559309/update-for-the-new-microsoft-edge-for-windows-10-version-1803-to-2004

I'm still going to have a look to see if I can find it but it looks like it can only be downloaded via Microsoft's main edge page
negg
 
Posts: 193
Joined: 26.03.2014, 11:46

Re: Microsoft Edge

Postby aker » 13.11.2020, 02:25

As I already said before, the request is accepted, but I currently don't know, how to solve it.
I created an "issue" in the public bugtracker and will document the progress (as soon as I have some) there.

https://gitlab.com/wsusoffline/bugtracker/-/issues/7
Wer Rechtschreibfehler findet, darf sie behalten oder an den Meistbietenden versteigern. / Everybody finding a misspelling is allowed to keep or sell it.
aker


WSUS Offline Update „Community Edition“ 12.4 / 11.9.7esr
https://gitlab.com/wsusoffline
aker
 
Posts: 3839
Joined: 02.03.2011, 15:32

Re: Microsoft Edge

Postby aker » 22.03.2021, 10:24

Some progress has been made. I think, this feature request will get even more progress the next days.
Wer Rechtschreibfehler findet, darf sie behalten oder an den Meistbietenden versteigern. / Everybody finding a misspelling is allowed to keep or sell it.
aker


WSUS Offline Update „Community Edition“ 12.4 / 11.9.7esr
https://gitlab.com/wsusoffline
aker
 
Posts: 3839
Joined: 02.03.2011, 15:32

Re: Microsoft Edge

Postby aker » 22.03.2021, 11:08

Ich habe ein Test-Skript in VBS gebaut, welches bei MS den aktuellen Link für Edge Chromium anfordert und den Dateinamen, die URL, die Dateigröße sowie SHA1- und SHA256-Hashes der Datei aus der Antwort extrahiert.
Würde jemand Implementierungsvorschläge schicken? Ich fände es praktisch, die Informationen zu Dateigröße sowie Dateihashes zu nutzen, wenn MS sie sowieso liefert.

Viele Grüße

--------------------------------------------------

I created a test script in VBS, which requests the filename, URL, file size and SHA1- and SHA256-hash for the most recent Edge Chromium from MS.
I'd suggest to use the additional information (file size, SHA1, SHA256) to verify the download. Does anyone have an idea on how to implement that?

--------------------------------------------------

MSEdgeExtractor.vbs
Code: Select all
Dim strRequest, strResponse, strNamespace, strName, strVersion, strFileName, strURL, strSizeInBytes, strHashesSha1, strHashesSha256
Dim WebRequest
Dim oJSON
Dim i

Const TargetNameSpace = "Default"
Const TargetName = "msedge-stable-win-x64"

Set fso = CreateObject("Scripting.FileSystemObject")

' --- STEP 1: determine target version ---

Set oJSON = New aspJSON
oJSON.data.Add "targetingAttributes", oJSON.Collection
'oJSON.data("targetingAttributes").Add "AppAp", ""
'oJSON.data("targetingAttributes").Add "AppBrandCode", ""
'oJSON.data("targetingAttributes").Add "AppCohort", ""
'oJSON.data("targetingAttributes").Add "AppCohortHint", ""
'oJSON.data("targetingAttributes").Add "AppCohortName", ""
'oJSON.data("targetingAttributes").Add "AppLang", "de"
'oJSON.data("targetingAttributes").Add "AppVersionMajor", ""
'oJSON.data("targetingAttributes").Add "AppRollout", "0.15999999642372131"
'oJSON.data("targetingAttributes").Add "AppTargetVersionPrefix", ""
'oJSON.data("targetingAttributes").Add "AppVersion", ""
'oJSON.data("targetingAttributes").Add "HardwareDiskType", "0"
'oJSON.data("targetingAttributes").Add "IsInternalUser", "False"
'oJSON.data("targetingAttributes").Add "IsMachine", "True"
'oJSON.data("targetingAttributes").Add "IsOOBEComplete", "True"
'oJSON.data("targetingAttributes").Add "OemProductManufacturer", "innotek GmbH"
'oJSON.data("targetingAttributes").Add "OemProductName", "VirtualBox"
'oJSON.data("targetingAttributes").Add "OsArch", "x64"
'oJSON.data("targetingAttributes").Add "OsPlatform", "win"
'oJSON.data("targetingAttributes").Add "OsVersion", "6.1.7601.0"
'oJSON.data("targetingAttributes").Add "Priority", "10"
'oJSON.data("targetingAttributes").Add "Updater", "MicrosoftEdgeUpdate"
'oJSON.data("targetingAttributes").Add "UpdaterVersion", "1.3.137.99"
oJSON.data("targetingAttributes").Add "", ""
strRequest = oJSON.JSONoutput

'WScript.Echo(strRequest)

' Send first request
Set WebRequest = CreateObject("Msxml2.XMLHTTP")
WebRequest.open "POST", "https://msedge.api.cdp.microsoft.com/api/v1.1/contents/Browser/namespaces/" & TargetNameSpace & "/names/" & TargetName & "/versions/latest?action=select", False
'WebRequest.setRequestHeader "User-Agent", "Microsoft Edge Update/1.3.137.99;winhttp"
WebRequest.setRequestHeader "Content-Length", Len(strRequest)
WebRequest.setRequestHeader "Content-Type", "application/json"
WebRequest.send(strRequest)
strResponse = WebRequest.responseText

'WScript.Echo(WebRequest.statusText)
'WScript.Echo(WebRequest.responseText)

' parse result
Set oJSON = New aspJSON
oJSON.loadJSON(strResponse)

'WScript.Echo(oJSON.JSONoutput)

strNamespace = oJSON.data("ContentId").item("Namespace")
strName = oJSON.data("ContentId").item("Name")
strVersion = oJSON.data("ContentId").item("Version")

'WScript.Echo(strNamespace)
'WScript.Echo(strName)
'WScript.Echo(strVersion)

' --- STEP 2: get URLs ---

Set oJSON = New aspJSON
strRequest = oJSON.JSONoutput
'WScript.Echo(strRequest)

' Send first request
Set WebRequest = CreateObject("MSXML2.XMLHTTP")
WebRequest.open "POST", "https://msedge.api.cdp.microsoft.com/api/v1.1/internal/contents/Browser/namespaces/" & strNamespace & "/names/" & strName & "/versions/" & strVersion & "/files?action=GenerateDownloadInfo&foregroundPriority=true", False
'WebRequest.setRequestHeader "User-Agent", "Microsoft Edge Update/1.3.137.99;winhttp"
WebRequest.setRequestHeader "Content-Length", Len(strRequest)
WebRequest.setRequestHeader "Content-Type", "application/json"
WebRequest.send(strRequest)
strResponse = WebRequest.responseText

'WScript.Echo(WebRequest.statusText)
'WScript.Echo(WebRequest.responseText)

' parse result
Set oJSON = New aspJSON
oJSON.loadJSON(strResponse)

'WScript.Echo(oJSON.JSONoutput)

strFileName = ""
strURL = ""
strSizeInBytes = ""
strHashesSha1 = ""
strHashesSha256 = ""

For Each i In oJSON.data
  If oJSON.data(i).item("FileId") = "MicrosoftEdge_X64_" & strVersion & ".exe" Then
    strFileName = oJSON.data(i).item("FileId")
    strURL = oJSON.data(i).item("Url")
    strSizeInBytes = oJSON.data(i).item("SizeInBytes")
    strHashesSha1 = oJSON.data(i).item("Hashes").item("Sha1")
    strHashesSha256 = oJSON.data(i).item("Hashes").item("Sha256")
  End If
Next

WScript.Echo "strFileName=" & strFileName
WScript.Echo "strURL=" & strURL
WScript.Echo "strSizeInBytes=" & strSizeInBytes
WScript.Echo "strHashesSha1=" & strHashesSha1
WScript.Echo "strHashesSha256=" & strHashesSha256


' --- STEP 3: download Installer ---


 ' User-Agent: Microsoft BITS/7.5






' Quelle: https://github.com/gerritvankuipers/aspjson
' VBScript-adjustments by aker
'January 2021 - Version 1.1 by Gerrit van Kuipers
Class aspJSON
   Public data
   Private p_JSONstring
   Private aj_in_string, aj_in_escape, aj_i_tmp, aj_char_tmp, aj_s_tmp, aj_line_tmp, aj_line, aj_lines, aj_currentlevel, aj_currentkey, aj_currentvalue, aj_newlabel, aj_XmlHttp, aj_RegExp, aj_colonfound

   Private Sub Class_Initialize()
      Set data = Collection()

       Set aj_RegExp = New regexp
       aj_RegExp.Pattern = "\s{0,}(\S{1}[\s,\S]*\S{1})\s{0,}"
       aj_RegExp.Global = False
       aj_RegExp.IgnoreCase = True
       aj_RegExp.Multiline = True
   End Sub

   Private Sub Class_Terminate()
      Set data = Nothing
       Set aj_RegExp = Nothing
   End Sub

   Public Sub loadJSON(inputsource)
      inputsource = aj_MultilineTrim(inputsource)
      If Len(inputsource) = 0 Then Err.Raise 1, "loadJSON Error", "No data to load."
      
      Select Case Left(inputsource, 1)
         Case "{", "["
         Case Else
'            Set aj_XmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
            Set aj_XmlHttp = CreateObject("Msxml2.XMLHTTP") ' VBScript-adjustment by aker
            aj_XmlHttp.open "POST", inputsource, False
            aj_XmlHttp.setRequestHeader "Content-Type", "text/json"
            aj_XmlHttp.setRequestHeader "CharSet", "UTF-8"
            aj_XmlHttp.Send
            inputsource = aj_XmlHttp.responseText
            Set aj_XmlHttp = Nothing
      End Select

      p_JSONstring = CleanUpJSONstring(inputsource)
      aj_lines = Split(p_JSONstring, Chr(13) & Chr(10))

      Dim level(99)
      aj_currentlevel = 1
      Set level(aj_currentlevel) = data
      For Each aj_line In aj_lines
         aj_currentkey = ""
         aj_currentvalue = ""
         If Instr(aj_line, ":") > 0 Then
            aj_in_string = False
            aj_in_escape = False
            aj_colonfound = False
            For aj_i_tmp = 1 To Len(aj_line)
               If aj_in_escape Then
                  aj_in_escape = False
               Else
                  Select Case Mid(aj_line, aj_i_tmp, 1)
                     Case """"
                        aj_in_string = Not aj_in_string
                     Case ":"
                        If Not aj_in_escape And Not aj_in_string Then
                           aj_currentkey = Left(aj_line, aj_i_tmp - 1)
                           aj_currentvalue = Mid(aj_line, aj_i_tmp + 1)
                           aj_colonfound = True
                           Exit For
                        End If
                     Case "\"
                        aj_in_escape = True
                  End Select
               End If
            Next
            if aj_colonfound then
               aj_currentkey = aj_Strip(aj_JSONDecode(aj_currentkey), """")
               If Not level(aj_currentlevel).exists(aj_currentkey) Then level(aj_currentlevel).Add aj_currentkey, ""
            end if
         End If
         If right(aj_line,1) = "{" Or right(aj_line,1) = "[" Then
            If Len(aj_currentkey) = 0 Then aj_currentkey = level(aj_currentlevel).Count
            Set level(aj_currentlevel).Item(aj_currentkey) = Collection()
            Set level(aj_currentlevel + 1) = level(aj_currentlevel).Item(aj_currentkey)
            aj_currentlevel = aj_currentlevel + 1
            aj_currentkey = ""
         ElseIf right(aj_line,1) = "}" Or right(aj_line,1) = "]" or right(aj_line,2) = "}," Or right(aj_line,2) = "]," Then
            aj_currentlevel = aj_currentlevel - 1
         ElseIf Len(Trim(aj_line)) > 0 Then
            If Len(aj_currentvalue) = 0 Then aj_currentvalue = aj_line
            aj_currentvalue = getJSONValue(aj_currentvalue)

            If Len(aj_currentkey) = 0 Then aj_currentkey = level(aj_currentlevel).Count
            level(aj_currentlevel).Item(aj_currentkey) = aj_currentvalue
         End If
      Next
   End Sub

   Public Function Collection()
'      Set Collection = Server.CreateObject("Scripting.Dictionary")
      Set Collection = CreateObject("Scripting.Dictionary") ' VBScript-adjustment by aker
   End Function

   Public Function AddToCollection(dictobj)
      If TypeName(dictobj) <> "Dictionary" Then Err.Raise 1, "AddToCollection Error", "Not a collection."
      aj_newlabel = dictobj.Count
      dictobj.Add aj_newlabel, Collection()
      Set AddToCollection = dictobj.item(aj_newlabel)
   end function

   Private Function CleanUpJSONstring(aj_originalstring)
      aj_originalstring = Replace(aj_originalstring, Chr(13) & Chr(10), "")
      aj_originalstring = Mid(aj_originalstring, 2, Len(aj_originalstring) - 2)
      aj_in_string = False : aj_in_escape = False : aj_s_tmp = ""
      For aj_i_tmp = 1 To Len(aj_originalstring)
         aj_char_tmp = Mid(aj_originalstring, aj_i_tmp, 1)
         If aj_in_escape Then
            aj_in_escape = False
            aj_s_tmp = aj_s_tmp & aj_char_tmp
         Else
            Select Case aj_char_tmp
               Case "\" : aj_s_tmp = aj_s_tmp & aj_char_tmp : aj_in_escape = True
               Case """" : aj_s_tmp = aj_s_tmp & aj_char_tmp : aj_in_string = Not aj_in_string
               Case "{", "["
                  aj_s_tmp = aj_s_tmp & aj_char_tmp & aj_InlineIf(aj_in_string, "", Chr(13) & Chr(10))
               Case "}", "]"
                  aj_s_tmp = aj_s_tmp & aj_InlineIf(aj_in_string, "", Chr(13) & Chr(10)) & aj_char_tmp
               Case "," : aj_s_tmp = aj_s_tmp & aj_char_tmp & aj_InlineIf(aj_in_string, "", Chr(13) & Chr(10))
               Case Else : aj_s_tmp = aj_s_tmp & aj_char_tmp
            End Select
         End If
      Next

      CleanUpJSONstring = ""
      aj_s_tmp = Split(aj_s_tmp, Chr(13) & Chr(10))
      For Each aj_line_tmp In aj_s_tmp
         aj_line_tmp = Replace(Replace(aj_line_tmp, Chr(10), ""), Chr(13), "")
         CleanUpJSONstring = CleanUpJSONstring & aj_Trim(aj_line_tmp) & Chr(13) & Chr(10)
      Next
   End Function

   Private Function getJSONValue(ByVal val)
      val = Trim(val)
      If Left(val,1) = ":"  Then val = Mid(val, 2)
      If Right(val,1) = "," Then val = Left(val, Len(val) - 1)
      val = Trim(val)

      Select Case val
         Case "true"  : getJSONValue = True
         Case "false" : getJSONValue = False
         Case "null" : getJSONValue = Null
         Case Else
            If (Instr(val, """") = 0) Then
               If IsNumeric(val) Then
                  getJSONValue = aj_ReadNumericValue(val)
               Else
                  getJSONValue = val
               End If
            Else
               If Left(val,1) = """" Then val = Mid(val, 2)
               If Right(val,1) = """" Then val = Left(val, Len(val) - 1)
               getJSONValue = aj_JSONDecode(Trim(val))
            End If
      End Select
   End Function

   Private JSONoutput_level
   Public Function JSONoutput()
      Dim wrap_dicttype, aj_label
      JSONoutput_level = 1
      wrap_dicttype = "[]"
      For Each aj_label In data
         If Not aj_IsInt(aj_label) Then wrap_dicttype = "{}"
      Next
      JSONoutput = Left(wrap_dicttype, 1) & Chr(13) & Chr(10) & GetDict(data) & Right(wrap_dicttype, 1)
   End Function

   Private Function GetDict(objDict)
      Dim aj_item, aj_keyvals, aj_label, aj_dicttype
      For Each aj_item In objDict
         Select Case TypeName(objDict.Item(aj_item))
            Case "Dictionary"
               GetDict = GetDict & Space(JSONoutput_level * 4)
               
               aj_dicttype = "[]"
               For Each aj_label In objDict.Item(aj_item).Keys
                   If Not aj_IsInt(aj_label) Then aj_dicttype = "{}"
               Next
               If aj_IsInt(aj_item) Then
                  GetDict = GetDict & (Left(aj_dicttype,1) & Chr(13) & Chr(10))
               Else
                  GetDict = GetDict & ("""" & aj_JSONEncode(aj_item) & """" & ": " & Left(aj_dicttype,1) & Chr(13) & Chr(10))
               End If
               JSONoutput_level = JSONoutput_level + 1
               
               aj_keyvals = objDict.Keys
               GetDict = GetDict & (GetSubDict(objDict.Item(aj_item)) & Space(JSONoutput_level * 4) & Right(aj_dicttype,1) & aj_InlineIf(aj_item = aj_keyvals(objDict.Count - 1),"" , ",") & Chr(13) & Chr(10))
            Case Else
               aj_keyvals =  objDict.Keys
               GetDict = GetDict & (Space(JSONoutput_level * 4) & aj_InlineIf(aj_IsInt(aj_item), "", """" & aj_JSONEncode(aj_item) & """: ") & WriteValue(objDict.Item(aj_item)) & aj_InlineIf(aj_item = aj_keyvals(objDict.Count - 1),"" , ",") & Chr(13) & Chr(10))
         End Select
      Next
   End Function

   Private Function aj_IsInt(val)
      aj_IsInt = (TypeName(val) = "Integer" Or TypeName(val) = "Long")
   End Function

   Private Function GetSubDict(objSubDict)
      GetSubDict = GetDict(objSubDict)
      JSONoutput_level= JSONoutput_level -1
   End Function

   Private Function WriteValue(ByVal val)
      Select Case TypeName(val)
         Case "Double", "Integer", "Long": WriteValue = replace(val, ",", ".")
         Case "Null"                  : WriteValue = "null"
         Case "Boolean"               : WriteValue = aj_InlineIf(val, "true", "false")
         Case Else                  : WriteValue = """" & aj_JSONEncode(val) & """"
      End Select
   End Function

   Private Function aj_JSONEncode(ByVal val)
      val = Replace(val, "\", "\\")
      val = Replace(val, """", "\""")
      'val = Replace(val, "/", "\/")
      val = Replace(val, Chr(8), "\b")
      val = Replace(val, Chr(12), "\f")
      val = Replace(val, Chr(10), "\n")
      val = Replace(val, Chr(13), "\r")
      val = Replace(val, Chr(9), "\t")
      aj_JSONEncode = Trim(val)
   End Function

   Private Function aj_JSONDecode(ByVal val)
      val = Replace(val, "\""", """")
      val = Replace(val, "\\", "\")
      val = Replace(val, "\/", "/")
      val = Replace(val, "\b", Chr(8))
      val = Replace(val, "\f", Chr(12))
      val = Replace(val, "\n", Chr(10))
      val = Replace(val, "\r", Chr(13))
      val = Replace(val, "\t", Chr(9))
      aj_JSONDecode = Trim(val)
   End Function

   Private Function aj_InlineIf(condition, returntrue, returnfalse)
      If condition Then aj_InlineIf = returntrue Else aj_InlineIf = returnfalse
   End Function

   Private Function aj_Strip(ByVal val, stripper)
      If Left(val, 1) = stripper Then val = Mid(val, 2)
      If Right(val, 1) = stripper Then val = Left(val, Len(val) - 1)
      aj_Strip = val
   End Function

   Private Function aj_MultilineTrim(TextData)
      aj_MultilineTrim = aj_RegExp.Replace(TextData, "$1")
   End Function

   Private Function aj_Trim(val)
      aj_Trim = Trim(val)
      Do While Left(aj_Trim, 1) = Chr(9) : aj_Trim = Mid(aj_Trim, 2) : Loop
      Do While Right(aj_Trim, 1) = Chr(9) : aj_Trim = Left(aj_Trim, Len(aj_Trim) - 1) : Loop
      aj_Trim = Trim(aj_Trim)
   End Function

   Private Function aj_ReadNumericValue(ByVal val)
      If Instr(val, ".") > 0 Then
         numdecimals = Len(val) - Instr(val, ".")
         val = Clng(Replace(val, ".", ""))
         val = val / (10 ^ numdecimals)
         aj_ReadNumericValue = val
      Else
         aj_ReadNumericValue = Clng(val)
      End If
   End Function
End Class


Beispielausgabe / example output:
Code: Select all
strFileName=MicrosoftEdge_X64_89.0.774.57.exe
strURL=http://msedge.f.tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/96638cc3-933a-4b1e-9e28-17adaf8919b0?P1=1617011796&P2=404&P3=2&P4=UGxJQHNz7vJBbAhWZpxAq2f6x5uSWOa48A2bq5N9Dg%2f4I65%2b7NdUNlBBLFwIeIobbz2%2bXTVeZ%2b0%2fPLuxDOeTDA%3d%3d
strSizeInBytes=94928792
strHashesSha1=TX/jnyy60pDEGGF+c4X1U7NmAsU=
strHashesSha256=OqxzjPmMg4JvxBOxnyJRHYbVMVYd2wzHVfUCQ+JQiug=
Wer Rechtschreibfehler findet, darf sie behalten oder an den Meistbietenden versteigern. / Everybody finding a misspelling is allowed to keep or sell it.
aker


WSUS Offline Update „Community Edition“ 12.4 / 11.9.7esr
https://gitlab.com/wsusoffline
aker
 
Posts: 3839
Joined: 02.03.2011, 15:32

Re: Microsoft Edge

Postby aker » 22.03.2021, 15:32

Weiter verbessert: / More improvements:

MSEdgeExtractor.vbs
Code: Select all
' ***     Author: aker      ***
' *** - Community Edition - ***

Dim strVersion, strFileName, strURL, strSizeInBytes, strHashesSha1Base64, strHashesSha256Base64
Dim strVersionX86, strFileNameX86, strURLX86, strSizeInBytesX86, strHashesSha1Base64X86, strHashesSha256Base64X86, strHashesSha1HexX86, strHashesSha256HexX86
Dim strVersionX64, strFileNameX64, strURLX64, strSizeInBytesX64, strHashesSha1Base64X64, strHashesSha256Base64X64, strHashesSha1HexX64, strHashesSha256HexX64

' --- STEP A: get URLs and date from MS ---

GetEdgeDL "Default", "msedge-stable-win-x86"
strVersionX86 = strVersion
strFileNameX86 = strFileName
strURLX86 = strURL
strSizeInBytesX86 = strSizeInBytes
strHashesSha1Base64X86 = strHashesSha1Base64
strHashesSha256Base64X86 = strHashesSha256Base64
WScript.Echo("strVersionX86=" & strVersionX86)
WScript.Echo("strFileNameX86=" & strFileNameX86)
WScript.Echo("strURLX86=" & strURLX86)
WScript.Echo("strSizeInBytesX86=" & strSizeInBytesX86)
WScript.Echo("strHashesSha1Base64X86=" & strHashesSha1Base64X86)
WScript.Echo("strHashesSha256Base64X86=" & strHashesSha256Base64X86)
WScript.Echo("------------------------------------------------------------")
WScript.Echo("")

GetEdgeDL "Default", "msedge-stable-win-x64"
strVersionX64 = strVersion
strFileNameX64 = strFileName
strURLX64 = strURL
strSizeInBytesX64 = strSizeInBytes
strHashesSha1Base64X64 = strHashesSha1Base64
strHashesSha256Base64X64 = strHashesSha256Base64
WScript.Echo("strVersionX64=" & strVersionX64)
WScript.Echo("strFileNameX64=" & strFileNameX64)
WScript.Echo("strURLX64=" & strURLX64)
WScript.Echo("strSizeInBytesX64=" & strSizeInBytesX64)
WScript.Echo("strHashesSha1Base64X64=" & strHashesSha1Base64X64)
WScript.Echo("strHashesSha256Base64X64=" & strHashesSha256Base64X64)
WScript.Echo("------------------------------------------------------------")
WScript.Echo("")


' --- STEP B: parse/convert hashes ---

If ValidateBase64(strHashesSha1Base64X86) = True Then
  'WScript.Echo("strHashesSha1Base64X86 validated")
  strHashesSha1HexX86 = Base64ToHex(strHashesSha1Base64X86)
Else
  'WScript.Echo("strHashesSha1Base64X86 failed to validate")
  strHashesSha1HexX86 = ""
End If
If ValidateBase64(strHashesSha256Base64X86) = True Then
  'WScript.Echo("strHashesSha256Base64X86 validated")
  strHashesSha256HexX86 = Base64ToHex(strHashesSha256Base64X86)
Else
  'WScript.Echo("strHashesSha256Base64X86 failed to validate")
  strHashesSha256HexX86 = ""
End If

WScript.Echo("strHashesSha1HexX86=" & strHashesSha1HexX86)
WScript.Echo("strHashesSha256HexX86=" & strHashesSha256HexX86)
WScript.Echo("")

WScript.Echo("------------------------------------------------------------")
WScript.Echo("")

If ValidateBase64(strHashesSha1Base64X64) = True Then
  'WScript.Echo("strHashesSha1Base64X64 validated")
  strHashesSha1HexX64 = Base64ToHex(strHashesSha1Base64X64)
Else
  'WScript.Echo("strHashesSha1Base64X64 failed to validate")
  strHashesSha1HexX64 = ""
End If
If ValidateBase64(strHashesSha256Base64X64) = True Then
  'WScript.Echo("strHashesSha256Base64X64 validated")
  strHashesSha256HexX64 = Base64ToHex(strHashesSha256Base64X64)
Else
  'WScript.Echo("strHashesSha256Base64X64 failed to validate")
  strHashesSha256HexX64 = ""
End If

WScript.Echo("strHashesSha1HexX64=" & strHashesSha1HexX64)
WScript.Echo("strHashesSha256HexX64=" & strHashesSha256HexX64)
WScript.Echo("")

WScript.Echo("------------------------------------------------------------")
WScript.Echo("")

' --- STEP C: download Installer ---

' User-Agent: Microsoft BITS/7.5
 
 
 
 

Sub GetEdgeDL(TargetNameSpace, TargetName)
  Dim strRequest, strResponse, strNamespaceBuf, strNameBuf, strVersionBuf, strFileNameBuf, strURLBuf, strSizeInBytesBuf, strHashesSha1Base64Buf, strHashesSha256Base64Buf
  Dim WebRequest
  Dim oJSON
  Dim i
 
  ' --- STEP 0: prepare output ---
 
  strVersion = ""
  strFileName = ""
  strURL = ""
  strSizeInBytes = ""
  strHashesSha1Base64 = ""
  strHashesSha256Base64 = ""
 
  ' --- STEP 1: determine target version ---
 
  strRequest = ""
  Set oJSON = New aspJSON
  oJSON.data.Add "targetingAttributes", oJSON.Collection
  'oJSON.data("targetingAttributes").Add "AppAp", ""
  'oJSON.data("targetingAttributes").Add "AppBrandCode", ""
  'oJSON.data("targetingAttributes").Add "AppCohort", ""
  'oJSON.data("targetingAttributes").Add "AppCohortHint", ""
  'oJSON.data("targetingAttributes").Add "AppCohortName", ""
  'oJSON.data("targetingAttributes").Add "AppLang", "de"
  'oJSON.data("targetingAttributes").Add "AppVersionMajor", ""
  'oJSON.data("targetingAttributes").Add "AppRollout", "0.15999999642372131"
  'oJSON.data("targetingAttributes").Add "AppTargetVersionPrefix", ""
  'oJSON.data("targetingAttributes").Add "AppVersion", ""
  'oJSON.data("targetingAttributes").Add "HardwareDiskType", "0"
  'oJSON.data("targetingAttributes").Add "IsInternalUser", "False"
  'oJSON.data("targetingAttributes").Add "IsMachine", "True"
  'oJSON.data("targetingAttributes").Add "IsOOBEComplete", "True"
  'oJSON.data("targetingAttributes").Add "OemProductManufacturer", "innotek GmbH"
  'oJSON.data("targetingAttributes").Add "OemProductName", "VirtualBox"
  'oJSON.data("targetingAttributes").Add "OsArch", "x64"
  'oJSON.data("targetingAttributes").Add "OsPlatform", "win"
  'oJSON.data("targetingAttributes").Add "OsVersion", "6.1.7601.0"
  'oJSON.data("targetingAttributes").Add "Priority", "10"
  'oJSON.data("targetingAttributes").Add "Updater", "MicrosoftEdgeUpdate"
  'oJSON.data("targetingAttributes").Add "UpdaterVersion", "1.3.137.99"
  oJSON.data("targetingAttributes").Add "", ""
  strRequest = oJSON.JSONoutput
 
  'WScript.Echo(strRequest)
  'WScript.Echo("")
 
  ' Send first request
  strResponse = ""
  Set WebRequest = CreateObject("Msxml2.XMLHTTP")
  WebRequest.open "POST", "https://msedge.api.cdp.microsoft.com/api/v1.1/contents/Browser/namespaces/" & TargetNameSpace & "/names/" & TargetName & "/versions/latest?action=select", False
  'WebRequest.setRequestHeader "User-Agent", "Microsoft Edge Update/1.3.137.99;winhttp"
  WebRequest.setRequestHeader "Content-Length", Len(strRequest)
  WebRequest.setRequestHeader "Content-Type", "application/json"
  WebRequest.send(strRequest)
  strResponse = WebRequest.responseText
 
  'WScript.Echo(WebRequest.statusText)
  'WScript.Echo(WebRequest.responseText)
  'WScript.Echo("")
 
  If strResponse = "" Then
    Exit Sub
  End If
 
  ' parse result
  strNamespaceBuf = ""
  strNameBuf = ""
  strVersionBuf = ""
  Set oJSON = New aspJSON
  oJSON.loadJSON(strResponse)
  strResponse = ""
 
  'WScript.Echo(oJSON.JSONoutput)
  'WScript.Echo("")
 
  strNamespaceBuf = oJSON.data("ContentId").item("Namespace")
  strNameBuf = oJSON.data("ContentId").item("Name")
  strVersionBuf = oJSON.data("ContentId").item("Version")
 
  WScript.Echo("strNamespaceBuf=" & strNamespaceBuf)
  WScript.Echo("strNameBuf=" & strNameBuf)
  WScript.Echo("strVersionBuf=" & strVersionBuf)
  WScript.Echo("")
 
  If strNamespaceBuf = "" Then
    Exit Sub
  End If
  If strNameBuf = "" Then
    Exit Sub
  End If
  If strVersionBuf = "" Then
    Exit Sub
  End If
 
  ' --- STEP 2: get URLs ---
 
  strRequest = ""
  Set oJSON = New aspJSON
  strRequest = oJSON.JSONoutput
 
  'WScript.Echo(strRequest)
  'WScript.Echo("")
 
  ' Send first request
  Set WebRequest = CreateObject("MSXML2.XMLHTTP")
  WebRequest.open "POST", "https://msedge.api.cdp.microsoft.com/api/v1.1/internal/contents/Browser/namespaces/" & strNamespaceBuf & "/names/" & strNameBuf & "/versions/" & strVersionBuf & "/files?action=GenerateDownloadInfo&foregroundPriority=true", False
  'WebRequest.setRequestHeader "User-Agent", "Microsoft Edge Update/1.3.137.99;winhttp"
  WebRequest.setRequestHeader "Content-Length", Len(strRequest)
  WebRequest.setRequestHeader "Content-Type", "application/json"
  WebRequest.send(strRequest)
  strResponse = WebRequest.responseText
 
  'WScript.Echo(WebRequest.statusText)
  'WScript.Echo(WebRequest.responseText)
  'WScript.Echo("")
 
  If strResponse = "" Then
    Exit Sub
  End If
 
  ' parse result
  Set oJSON = New aspJSON
  oJSON.loadJSON(strResponse)
  strResponse = ""
 
  'WScript.Echo(oJSON.JSONoutput)
  'WScript.Echo("")
 
  strFileNameBuf = ""
  strURLBuf = ""
  strSizeInBytesBuf = ""
  strHashesSha1Base64Buf = ""
  strHashesSha256Base64Buf = ""
 
  For Each i In oJSON.data
    If ((oJSON.data(i).item("FileId") = "MicrosoftEdge_X86_" & strVersionBuf & ".exe") Or (oJSON.data(i).item("FileId") = "MicrosoftEdge_X64_" & strVersionBuf & ".exe")) Then
      strFileNameBuf = oJSON.data(i).item("FileId")
      strURLBuf = oJSON.data(i).item("Url")
      strSizeInBytesBuf = oJSON.data(i).item("SizeInBytes")
      strHashesSha1Base64Buf = oJSON.data(i).item("Hashes").item("Sha1")
      strHashesSha256Base64Buf = oJSON.data(i).item("Hashes").item("Sha256")
    End If
  Next
 
  'WScript.Echo "strFileNameBuf=" & strFileNameBuf
  'WScript.Echo "strURLBuf=" & strURLBuf
  'WScript.Echo "strSizeInBytesBuf=" & strSizeInBytesBuf
  'WScript.Echo "strHashesSha1Base64Buf=" & strHashesSha1Base64Buf
  'WScript.Echo "strHashesSha256Base64Buf=" & strHashesSha256Base64Buf
  'WScript.Echo("")
 
  If strFileNameBuf = "" Then
    'WScript.Echo("strFileNameBuf == NULL")
    Exit Sub
  End If
  If strURLBuf = "" Then
    'WScript.Echo("strURLBuf == NULL")
    Exit Sub
  End If
  If strSizeInBytesBuf = "" Then
    'WScript.Echo("strSizeInBytesBuf == NULL")
    Exit Sub
  End If
  If strHashesSha1Base64Buf = "" Then
    'WScript.Echo("strHashesSha1Base64Buf == NULL")
    Exit Sub
  End If
  If strHashesSha256Base64Buf = "" Then
    'WScript.Echo("strHashesSha256Base64Buf == NULL")
    Exit Sub
  End If

  ' --- STEP 3: return result ---
 
  strVersion = strVersionBuf
  strFileName = strFileNameBuf
  strURL = strURLBuf
  strSizeInBytes = strSizeInBytesBuf
  strHashesSha1Base64 = strHashesSha1Base64Buf
  strHashesSha256Base64 = strHashesSha256Base64Buf
 
  'WScript.Echo "strVersion=" & strVersion
  'WScript.Echo "strFileName=" & strFileName
  'WScript.Echo "strURL=" & strURL
  'WScript.Echo "strSizeInBytes=" & strSizeInBytes
  'WScript.Echo "strHashesSha1Base64=" & strHashesSha1Base64
  'WScript.Echo "strHashesSha256Base64=" & strHashesSha256Base64
  'WScript.Echo("")
End Sub

' ----------------------------------------------------------------------------------------------------

' Quelle: http://www.rlmueller.net/Programs/Base64ToHex.txt
' modifiziert durch aker

' Base64ToHex.vbs
' VBScript program to convert a base64 encoded string into a hex string.
'
' ----------------------------------------------------------------------
' Copyright (c) 2010 Richard L. Mueller
' Hilltop Lab web site - http://www.rlmueller.net
' Version 1.0 - January 7, 2010
'
' Syntax:
'     cscript //nologo Base64ToHex.vbs <Base64 string>
' where:
'     <Base64 string> is a Base64 encoded string.
' If no parameter is supplied, the program will prompt.
'
' You have a royalty-free right to use, modify, reproduce, and
' distribute this script file in any way you find useful, provided that
' you agree that the copyright owner above has no warranty, obligations,
' or liability for such use.

Function ValidateBase64(strValue)
    ' Validate string.
    Dim objRE : Set objRE = New RegExp
    objRE.Pattern = "[A-Za-z0-9\+/]+[=]?[=]?"
    objRE.Global = True
    Dim objMatches : Set objMatches = objRE.Execute(strValue)
    If (objMatches.Count <> 1) Then
        ValidateBase64 = False
        Exit Function
    End If
   Dim objMatch
    For Each objMatch In objMatches
        If (objMatch.Length <> Len(strValue)) Then
            ValidateBase64 = False
         Exit Function
        End If
    Next
   
    If (Len(strValue) Mod 4 <> 0) Then
        ValidateBase64 = False
        Exit Function
    End If
   
    ValidateBase64 = True
End Function

Function Base64ToHex(strValue)
    ' Function to convert a base64 encoded string into a hex string.
    Dim lngValue, lngTemp, lngChar, k, j, intTerm, strHex

    ' Setup dictionary object used to convert Base64 characters into
    ' base 64 index integers.
    Dim objChars: Set objChars = CreateObject("Scripting.Dictionary")
    objChars.CompareMode = vbBinaryCompare

    objChars.Add "A", 0
    objChars.Add "B", 1
    objChars.Add "C", 2
    objChars.Add "D", 3
    objChars.Add "E", 4
    objChars.Add "F", 5
    objChars.Add "G", 6
    objChars.Add "H", 7
    objChars.Add "I", 8
    objChars.Add "J", 9
    objChars.Add "K", 10
    objChars.Add "L", 11
    objChars.Add "M", 12
    objChars.Add "N", 13
    objChars.Add "O", 14
    objChars.Add "P", 15
    objChars.Add "Q", 16
    objChars.Add "R", 17
    objChars.Add "S", 18
    objChars.Add "T", 19
    objChars.Add "U", 20
    objChars.Add "V", 21
    objChars.Add "W", 22
    objChars.Add "X", 23
    objChars.Add "Y", 24
    objChars.Add "Z", 25
    objChars.Add "a", 26
    objChars.Add "b", 27
    objChars.Add "c", 28
    objChars.Add "d", 29
    objChars.Add "e", 30
    objChars.Add "f", 31
    objChars.Add "g", 32
    objChars.Add "h", 33
    objChars.Add "i", 34
    objChars.Add "j", 35
    objChars.Add "k", 36
    objChars.Add "l", 37
    objChars.Add "m", 38
    objChars.Add "n", 39
    objChars.Add "o", 40
    objChars.Add "p", 41
    objChars.Add "q", 42
    objChars.Add "r", 43
    objChars.Add "s", 44
    objChars.Add "t", 45
    objChars.Add "u", 46
    objChars.Add "v", 47
    objChars.Add "w", 48
    objChars.Add "x", 49
    objChars.Add "y", 50
    objChars.Add "z", 51
    objChars.Add "0", 52
    objChars.Add "1", 53
    objChars.Add "2", 54
    objChars.Add "3", 55
    objChars.Add "4", 56
    objChars.Add "5", 57
    objChars.Add "6", 58
    objChars.Add "7", 59
    objChars.Add "8", 60
    objChars.Add "9", 61
    objChars.Add "+", 62
    objChars.Add "/", 63

    ' Check padding.
    intTerm = 0
    If (Right(strValue, 1) = "=") Then
        intTerm = 1
    End If
    If (Right(strValue, 2) = "==") Then
        intTerm = 2
    End If

    ' Parse into groups of 4 6-bit characters.
    j = 0
    lngValue = 0
    Base64ToHex = ""
    For k = 1 To Len(strValue)
        j = j + 1
        ' Calculate 24-bit integer.
        lngValue = (lngValue * 64) + objChars(Mid(strValue, k, 1))
        If (j = 4) Then
            ' Convert 24-bit integer into 3 8-bit bytes.
            lngTemp = Fix(lngValue / 256)
            lngChar = lngValue - (256 * lngTemp)
            strHex = Right("00" & Hex(lngChar), 2)
            lngValue = lngTemp

            lngTemp = Fix(lngValue / 256)
            lngChar = lngValue - (256 * lngTemp)
            strHex = Right("00" & Hex(lngChar), 2) & strHex
            lngValue = lngTemp

            lngTemp = Fix(lngValue / 256)
            lngChar = lngValue - (256 * lngTemp)
            strHex = Right("00" & Hex(lngChar), 2) & strHex

            Base64ToHex = Base64ToHex & strHex
            j = 0
            lngValue = 0
        End If
    Next
    ' Account for padding.
    Base64ToHex = Left(Base64ToHex, Len(Base64ToHex) - (intTerm * 2))

End Function

' ----------------------------------------------------------------------------------------------------

' Quelle: https://github.com/gerritvankuipers/aspjson
' VBScript-adjustments by aker
' January 2021 - Version 1.19 by Gerrit van Kuipers
Class aspJSON
   Public data
   Private p_JSONstring
   Private aj_in_string, aj_in_escape, aj_i_tmp, aj_char_tmp, aj_s_tmp, aj_line_tmp, aj_line, aj_lines, aj_currentlevel, aj_currentkey, aj_currentvalue, aj_newlabel, aj_XmlHttp, aj_RegExp, aj_colonfound

   Private Sub Class_Initialize()
      Set data = Collection()

       Set aj_RegExp = New regexp
       aj_RegExp.Pattern = "\s{0,}(\S{1}[\s,\S]*\S{1})\s{0,}"
       aj_RegExp.Global = False
       aj_RegExp.IgnoreCase = True
       aj_RegExp.Multiline = True
   End Sub

   Private Sub Class_Terminate()
      Set data = Nothing
       Set aj_RegExp = Nothing
   End Sub

   Public Sub loadJSON(inputsource)
      inputsource = aj_MultilineTrim(inputsource)
      If Len(inputsource) = 0 Then Err.Raise 1, "loadJSON Error", "No data to load."
      
      Select Case Left(inputsource, 1)
         Case "{", "["
         Case Else
'            Set aj_XmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
            Set aj_XmlHttp = CreateObject("Msxml2.XMLHTTP") ' VBScript-adjustment by aker
            aj_XmlHttp.open "POST", inputsource, False
            aj_XmlHttp.setRequestHeader "Content-Type", "text/json"
            aj_XmlHttp.setRequestHeader "CharSet", "UTF-8"
            aj_XmlHttp.Send
            inputsource = aj_XmlHttp.responseText
            Set aj_XmlHttp = Nothing
      End Select

      p_JSONstring = CleanUpJSONstring(inputsource)
      aj_lines = Split(p_JSONstring, Chr(13) & Chr(10))

      Dim level(99)
      aj_currentlevel = 1
      Set level(aj_currentlevel) = data
      For Each aj_line In aj_lines
         aj_currentkey = ""
         aj_currentvalue = ""
         If Instr(aj_line, ":") > 0 Then
            aj_in_string = False
            aj_in_escape = False
            aj_colonfound = False
            For aj_i_tmp = 1 To Len(aj_line)
               If aj_in_escape Then
                  aj_in_escape = False
               Else
                  Select Case Mid(aj_line, aj_i_tmp, 1)
                     Case """"
                        aj_in_string = Not aj_in_string
                     Case ":"
                        If Not aj_in_escape And Not aj_in_string Then
                           aj_currentkey = Left(aj_line, aj_i_tmp - 1)
                           aj_currentvalue = Mid(aj_line, aj_i_tmp + 1)
                           aj_colonfound = True
                           Exit For
                        End If
                     Case "\"
                        aj_in_escape = True
                  End Select
               End If
            Next
            if aj_colonfound then
               aj_currentkey = aj_Strip(aj_JSONDecode(aj_currentkey), """")
               If Not level(aj_currentlevel).exists(aj_currentkey) Then level(aj_currentlevel).Add aj_currentkey, ""
            end if
         End If
         If right(aj_line,1) = "{" Or right(aj_line,1) = "[" Then
            If Len(aj_currentkey) = 0 Then aj_currentkey = level(aj_currentlevel).Count
            Set level(aj_currentlevel).Item(aj_currentkey) = Collection()
            Set level(aj_currentlevel + 1) = level(aj_currentlevel).Item(aj_currentkey)
            aj_currentlevel = aj_currentlevel + 1
            aj_currentkey = ""
         ElseIf right(aj_line,1) = "}" Or right(aj_line,1) = "]" or right(aj_line,2) = "}," Or right(aj_line,2) = "]," Then
            aj_currentlevel = aj_currentlevel - 1
         ElseIf Len(Trim(aj_line)) > 0 Then
            If Len(aj_currentvalue) = 0 Then aj_currentvalue = aj_line
            aj_currentvalue = getJSONValue(aj_currentvalue)

            If Len(aj_currentkey) = 0 Then aj_currentkey = level(aj_currentlevel).Count
            level(aj_currentlevel).Item(aj_currentkey) = aj_currentvalue
         End If
      Next
   End Sub

   Public Function Collection()
'      Set Collection = Server.CreateObject("Scripting.Dictionary")
      Set Collection = CreateObject("Scripting.Dictionary") ' VBScript-adjustment by aker
   End Function

   Public Function AddToCollection(dictobj)
      If TypeName(dictobj) <> "Dictionary" Then Err.Raise 1, "AddToCollection Error", "Not a collection."
      aj_newlabel = dictobj.Count
      dictobj.Add aj_newlabel, Collection()
      Set AddToCollection = dictobj.item(aj_newlabel)
   end function

   Private Function CleanUpJSONstring(aj_originalstring)
      aj_originalstring = Replace(aj_originalstring, Chr(13) & Chr(10), "")
      aj_originalstring = Mid(aj_originalstring, 2, Len(aj_originalstring) - 2)
      aj_in_string = False : aj_in_escape = False : aj_s_tmp = ""
      For aj_i_tmp = 1 To Len(aj_originalstring)
         aj_char_tmp = Mid(aj_originalstring, aj_i_tmp, 1)
         If aj_in_escape Then
            aj_in_escape = False
            aj_s_tmp = aj_s_tmp & aj_char_tmp
         Else
            Select Case aj_char_tmp
               Case "\" : aj_s_tmp = aj_s_tmp & aj_char_tmp : aj_in_escape = True
               Case """" : aj_s_tmp = aj_s_tmp & aj_char_tmp : aj_in_string = Not aj_in_string
               Case "{", "["
                  aj_s_tmp = aj_s_tmp & aj_char_tmp & aj_InlineIf(aj_in_string, "", Chr(13) & Chr(10))
               Case "}", "]"
                  aj_s_tmp = aj_s_tmp & aj_InlineIf(aj_in_string, "", Chr(13) & Chr(10)) & aj_char_tmp
               Case "," : aj_s_tmp = aj_s_tmp & aj_char_tmp & aj_InlineIf(aj_in_string, "", Chr(13) & Chr(10))
               Case Else : aj_s_tmp = aj_s_tmp & aj_char_tmp
            End Select
         End If
      Next

      CleanUpJSONstring = ""
      aj_s_tmp = Split(aj_s_tmp, Chr(13) & Chr(10))
      For Each aj_line_tmp In aj_s_tmp
         aj_line_tmp = Replace(Replace(aj_line_tmp, Chr(10), ""), Chr(13), "")
         CleanUpJSONstring = CleanUpJSONstring & aj_Trim(aj_line_tmp) & Chr(13) & Chr(10)
      Next
   End Function

   Private Function getJSONValue(ByVal val)
      val = Trim(val)
      If Left(val,1) = ":"  Then val = Mid(val, 2)
      If Right(val,1) = "," Then val = Left(val, Len(val) - 1)
      val = Trim(val)

      Select Case val
         Case "true"  : getJSONValue = True
         Case "false" : getJSONValue = False
         Case "null" : getJSONValue = Null
         Case Else
            If (Instr(val, """") = 0) Then
               If IsNumeric(val) Then
                  getJSONValue = aj_ReadNumericValue(val)
               Else
                  getJSONValue = val
               End If
            Else
               If Left(val,1) = """" Then val = Mid(val, 2)
               If Right(val,1) = """" Then val = Left(val, Len(val) - 1)
               getJSONValue = aj_JSONDecode(Trim(val))
            End If
      End Select
   End Function

   Private JSONoutput_level
   Public Function JSONoutput()
      Dim wrap_dicttype, aj_label
      JSONoutput_level = 1
      wrap_dicttype = "[]"
      For Each aj_label In data
         If Not aj_IsInt(aj_label) Then wrap_dicttype = "{}"
      Next
      JSONoutput = Left(wrap_dicttype, 1) & Chr(13) & Chr(10) & GetDict(data) & Right(wrap_dicttype, 1)
   End Function

   Private Function GetDict(objDict)
      Dim aj_item, aj_keyvals, aj_label, aj_dicttype
      For Each aj_item In objDict
         Select Case TypeName(objDict.Item(aj_item))
            Case "Dictionary"
               GetDict = GetDict & Space(JSONoutput_level * 4)
               
               aj_dicttype = "[]"
               For Each aj_label In objDict.Item(aj_item).Keys
                   If Not aj_IsInt(aj_label) Then aj_dicttype = "{}"
               Next
               If aj_IsInt(aj_item) Then
                  GetDict = GetDict & (Left(aj_dicttype,1) & Chr(13) & Chr(10))
               Else
                  GetDict = GetDict & ("""" & aj_JSONEncode(aj_item) & """" & ": " & Left(aj_dicttype,1) & Chr(13) & Chr(10))
               End If
               JSONoutput_level = JSONoutput_level + 1
               
               aj_keyvals = objDict.Keys
               GetDict = GetDict & (GetSubDict(objDict.Item(aj_item)) & Space(JSONoutput_level * 4) & Right(aj_dicttype,1) & aj_InlineIf(aj_item = aj_keyvals(objDict.Count - 1),"" , ",") & Chr(13) & Chr(10))
            Case Else
               aj_keyvals =  objDict.Keys
               GetDict = GetDict & (Space(JSONoutput_level * 4) & aj_InlineIf(aj_IsInt(aj_item), "", """" & aj_JSONEncode(aj_item) & """: ") & WriteValue(objDict.Item(aj_item)) & aj_InlineIf(aj_item = aj_keyvals(objDict.Count - 1),"" , ",") & Chr(13) & Chr(10))
         End Select
      Next
   End Function

   Private Function aj_IsInt(val)
      aj_IsInt = (TypeName(val) = "Integer" Or TypeName(val) = "Long")
   End Function

   Private Function GetSubDict(objSubDict)
      GetSubDict = GetDict(objSubDict)
      JSONoutput_level= JSONoutput_level -1
   End Function

   Private Function WriteValue(ByVal val)
      Select Case TypeName(val)
         Case "Double", "Integer", "Long": WriteValue = replace(val, ",", ".")
         Case "Null"                  : WriteValue = "null"
         Case "Boolean"               : WriteValue = aj_InlineIf(val, "true", "false")
         Case Else                  : WriteValue = """" & aj_JSONEncode(val) & """"
      End Select
   End Function

   Private Function aj_JSONEncode(ByVal val)
      val = Replace(val, "\", "\\")
      val = Replace(val, """", "\""")
      'val = Replace(val, "/", "\/")
      val = Replace(val, Chr(8), "\b")
      val = Replace(val, Chr(12), "\f")
      val = Replace(val, Chr(10), "\n")
      val = Replace(val, Chr(13), "\r")
      val = Replace(val, Chr(9), "\t")
      aj_JSONEncode = Trim(val)
   End Function

   Private Function aj_JSONDecode(ByVal val)
      val = Replace(val, "\""", """")
      val = Replace(val, "\\", "\")
      val = Replace(val, "\/", "/")
      val = Replace(val, "\b", Chr(8))
      val = Replace(val, "\f", Chr(12))
      val = Replace(val, "\n", Chr(10))
      val = Replace(val, "\r", Chr(13))
      val = Replace(val, "\t", Chr(9))
      aj_JSONDecode = Trim(val)
   End Function

   Private Function aj_InlineIf(condition, returntrue, returnfalse)
      If condition Then aj_InlineIf = returntrue Else aj_InlineIf = returnfalse
   End Function

   Private Function aj_Strip(ByVal val, stripper)
      If Left(val, 1) = stripper Then val = Mid(val, 2)
      If Right(val, 1) = stripper Then val = Left(val, Len(val) - 1)
      aj_Strip = val
   End Function

   Private Function aj_MultilineTrim(TextData)
      aj_MultilineTrim = aj_RegExp.Replace(TextData, "$1")
   End Function

   Private Function aj_Trim(val)
      aj_Trim = Trim(val)
      Do While Left(aj_Trim, 1) = Chr(9) : aj_Trim = Mid(aj_Trim, 2) : Loop
      Do While Right(aj_Trim, 1) = Chr(9) : aj_Trim = Left(aj_Trim, Len(aj_Trim) - 1) : Loop
      aj_Trim = Trim(aj_Trim)
   End Function

   Private Function aj_ReadNumericValue(ByVal val)
      If Instr(val, ".") > 0 Then
         numdecimals = Len(val) - Instr(val, ".")
         val = Clng(Replace(val, ".", ""))
         val = val / (10 ^ numdecimals)
         aj_ReadNumericValue = val
      Else
         aj_ReadNumericValue = Clng(val)
      End If
   End Function
End Class


Ausgabe: / Output:
Code: Select all
strNamespaceBuf=Default
strNameBuf=msedge-stable-win-x86
strVersionBuf=89.0.774.57

strVersionX86=89.0.774.57
strFileNameX86=MicrosoftEdge_X86_89.0.774.57.exe
strURLX86=http://msedge.f.tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/19e48d85-6134-44e7-98e1-047b3feaf4a9?P1=1617028444&P2=404&P3=2&P4=nfrwHU0m%2f2iq3I27hlmLHAn0sZ7arZmFrMf0FXpMh18DiNHERMGmCy1IufLj8SYzg%2bKBFWibUYAwYxiFDKYS0A%3d%3d
strSizeInBytesX86=86108048
strHashesSha1Base64X86=XpGOLBKLxLN/U/70523neeLkWEI=
strHashesSha256Base64X86=6XBGO2jtMJelBK7DKaFzBdoUDq6Sp/uRi3hxS5is4yw=
------------------------------------------------------------

strNamespaceBuf=Default
strNameBuf=msedge-stable-win-x64
strVersionBuf=89.0.774.57

strVersionX64=89.0.774.57
strFileNameX64=MicrosoftEdge_X64_89.0.774.57.exe
strURLX64=http://msedge.f.tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/96638cc3-933a-4b1e-9e28-17adaf8919b0?P1=1617028444&P2=404&P3=2&P4=i0yMM8k8M3ywM%2fy%2bwT7isOS8oPUEQbY9vmWCRCW0yLczF71ZgLbNOjSjV0wzKMkpsgX7B%2ftjVxbRusjVS8B7PA%3d%3d
strSizeInBytesX64=94928792
strHashesSha1Base64X64=TX/jnyy60pDEGGF+c4X1U7NmAsU=
strHashesSha256Base64X64=OqxzjPmMg4JvxBOxnyJRHYbVMVYd2wzHVfUCQ+JQiug=
------------------------------------------------------------

strHashesSha1HexX86=5E918E2C128BC4B37F53FEF4E76DE779E2E45842
strHashesSha256HexX86=E970463B68ED3097A504AEC329A17305DA140EAE92A7FB918B78714B98ACE32C

------------------------------------------------------------

strHashesSha1HexX64=4D7FE39F2CBAD290C418617E7385F553B36602C5
strHashesSha256HexX64=3AAC738CF98C83826FC413B19F22511D86D531561DDB0CC755F50243E2508AE8

------------------------------------------------------------
Wer Rechtschreibfehler findet, darf sie behalten oder an den Meistbietenden versteigern. / Everybody finding a misspelling is allowed to keep or sell it.
aker


WSUS Offline Update „Community Edition“ 12.4 / 11.9.7esr
https://gitlab.com/wsusoffline
aker
 
Posts: 3839
Joined: 02.03.2011, 15:32

Re: Microsoft Edge

Postby aker » 22.03.2021, 16:24

Ich bräuchte beim Download eine weitere Hilfe.
Die URLs sehen wie folgt aus:
Code: Select all
http://msedge.f.tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/19e48d85-6134-44e7-98e1-047b3feaf4a9?P1=1617028444&P2=404&P3=2&P4=nfrwHU0m%2f2iq3I27hlmLHAn0sZ7arZmFrMf0FXpMh18DiNHERMGmCy1IufLj8SYzg%2bKBFWibUYAwYxiFDKYS0A%3d%3d
http://msedge.f.tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/96638cc3-933a-4b1e-9e28-17adaf8919b0?P1=1617028444&P2=404&P3=2&P4=i0yMM8k8M3ywM%2fy%2bwT7isOS8oPUEQbY9vmWCRCW0yLczF71ZgLbNOjSjV0wzKMkpsgX7B%2ftjVxbRusjVS8B7PA%3d%3d


Als Dateinamen ergeben sich daraus:
Code: Select all
19e48d85-6134-44e7-98e1-047b3feaf4a9?P1=1617028444&P2=404&P3=2&P4=nfrwHU0m%2f2iq3I27hlmLHAn0sZ7arZmFrMf0FXpMh18DiNHERMGmCy1IufLj8SYzg%2bKBFWibUYAwYxiFDKYS0A%3d%3d
96638cc3-933a-4b1e-9e28-17adaf8919b0?P1=1617028444&P2=404&P3=2&P4=i0yMM8k8M3ywM%2fy%2bwT7isOS8oPUEQbY9vmWCRCW0yLczF71ZgLbNOjSjV0wzKMkpsgX7B%2ftjVxbRusjVS8B7PA%3d%3d


Lade ich die Dateien mittels wget herunter, ändert sich die Dateinamen auf folgende:
Code: Select all
19e48d85-6134-44e7-98e1-047b3feaf4a9@P1=1617028444&P2=404&P3=2&P4=nfrwHU0m%2F2iq3I27hlmLHAn0sZ7arZmFrMf0FXpMh18DiNHERMGmCy1IufLj8SYzg+KBFWibUYAwYxiFDKYS0A==
96638cc3-933a-4b1e-9e28-17adaf8919b0@P1=1617028444&P2=404&P3=2&P4=i0yMM8k8M3ywM%2Fy+wT7isOS8oPUEQbY9vmWCRCW0yLczF71ZgLbNOjSjV0wzKMkpsgX7B%2FtjVxbRusjVS8B7PA==

Bedeutet, die escapeten Zeichen "%2b" für "+", ... wurden durch ihre Zeichen zurückersetzt sowie das "?" durch ein "@" ersetzt. Damit kommt der wsusou-Algorithmus aber nicht klar.
Ich könnte die Situation mittels "wget -O" umgehen, würde das aber gerne aus bekannten Gründen vermeiden.
Hat jemand vorschläge?

Viele Grüße
Wer Rechtschreibfehler findet, darf sie behalten oder an den Meistbietenden versteigern. / Everybody finding a misspelling is allowed to keep or sell it.
aker


WSUS Offline Update „Community Edition“ 12.4 / 11.9.7esr
https://gitlab.com/wsusoffline
aker
 
Posts: 3839
Joined: 02.03.2011, 15:32

Re: Microsoft Edge

Postby Dalai » 22.03.2021, 17:29

Hat wget einen Schalter, um den vom Server in den Headern übergebenen Dateinamen zu benutzen? Dort steht:
Code: Select all
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Date: Mon, 22 Mar 2021 16:11:04 GMT
  Connection: Keep-Alive
  Cache-Control: public, max-age=17279979
  Content-Length: 86108048
  Content-Type: application/octet-stream
  Last-Modified: Thu, 18 Mar 2021 19:54:42 GMT
  Accept-Ranges: bytes
  Content-Disposition: attachment; filename="19e48d85-6134-44e7-98e1-047b3feaf4a9"
  X-HW: 1616429464.dop218.fr8.t,1616429464.cds142.fr8.c
  X-CID: 9
  X-CCC: DE
Length: 86108048 (82M) [application/octet-stream]
Der Dateiname ist also nur eine GUID.

Der wget-Schalter --content-disposition in Verbindung mit --timestamping erreichen, dass der Download in die nach der GUID benannte Datei erfolgt. Aber Vorsicht: ob das wirklich funktioniert, scheint stark von diversen Faktoren abzuhängen, vor allem von der Server-Response! Liefert einer der Server keine Content-Disposition in den Headern, ist es Essig mit kurzen Dateinamen. Ich liebe, wie konsistent die von den MS-Servern gelieferten Antworten sind *kotz* :evil:.

Was in jedem Fall funktionieren würde, alle nachfolgenden Zeichen wegzuschneiden, also alles nach dem ersten @.

Grüße
Dalai
Dalai
 
Posts: 1032
Joined: 12.07.2016, 21:00

Next

Return to Anregungen / Suggestions

Who is online

Users browsing this forum: No registered users and 5 guests