mirror of
https://github.com/jonbranan/globalscape.git
synced 2024-10-20 13:57:57 -05:00
30 lines
1.1 KiB
PowerShell
30 lines
1.1 KiB
PowerShell
|
$baseURL = "http://192.168.4.14:4450/admin"
|
||
|
$AdminUser = "a"
|
||
|
$password = "QjIlmT4H!"
|
||
|
|
||
|
# Only to ignore certificates errors
|
||
|
add-type @"
|
||
|
using System.Net;
|
||
|
using System.Security.Cryptography.X509Certificates;
|
||
|
|
||
|
public class IDontCarePolicy : ICertificatePolicy {
|
||
|
public IDontCarePolicy() {}
|
||
|
public bool CheckValidationResult(
|
||
|
ServicePoint sPoint, X509Certificate cert,
|
||
|
WebRequest wRequest, int certProb) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
"@
|
||
|
[System.Net.ServicePointManager]::CertificatePolicy = new-object IDontCarePolicy
|
||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||
|
|
||
|
|
||
|
# authentication
|
||
|
$authBody = "{""userName"": ""$AdminUser"", ""password"": ""$password"", ""authType"": ""EFT""}"
|
||
|
$auth = Invoke-RestMethod -Uri "$baseURL/v1/authentication" -Method 'POST' -Body $authBody
|
||
|
|
||
|
$authToken = $auth.authToken
|
||
|
$authHeader = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
|
||
|
$authHeader.Add("Authorization", "EFTAdminAuthToken $authToken")
|