mirror of
https://github.com/jonbranan/globalscape.git
synced 2024-10-20 13:57:57 -05:00
29 lines
945 B
PowerShell
29 lines
945 B
PowerShell
$hostname = "localhost"
|
|
$port = 4450
|
|
$username = "admin"
|
|
$password = "Super2003"
|
|
$AuthenticationUrl = "http://$($hostname):$port/admin/v1/authentication"
|
|
$ServerUrl = "http://$($hostname):$port/admin/v1/server"
|
|
$response = ""
|
|
|
|
try {
|
|
$response = Invoke-WebRequest -Method POST -Uri $AuthenticationUrl -Body "{""userName"": ""$($username)"", ""password"": ""$($password)"", ""authType"": ""EFT""}"
|
|
}
|
|
catch {
|
|
Write-Error "[!!!] Connection to $($AuthenticationUrl) Failed! $($_.Exception.Message)"
|
|
Exit
|
|
}
|
|
|
|
$AuthContent = $response.Content | ConvertFrom-Json
|
|
|
|
Write-Host "Auth Token: $($AuthContent.AuthToken)"
|
|
|
|
try {
|
|
$response = Invoke-WebRequest -Method GET -Uri $ServerUrl -Headers @{"Authorization" = "EFTAdminAuthToken $($AuthContent.AuthToken)"}
|
|
}
|
|
catch {
|
|
Write-Error "[!!!] Connection to $($ServerUrl) Failed! $($_.Exception.Message)"
|
|
Exit
|
|
}
|
|
Write-Host "Response "
|
|
Write-Host "$($response.Content)" |