Skip to content

Instantly share code, notes, and snippets.

@HawaiiRyan
HawaiiRyan / moresecure.ps1
Created March 24, 2020 20:41
example-MoreSecure
###Force commuincation to only occur with TLS 1.2
Write-Verbose -Message "Forcing TLS 1.2 Cipher...."
[Net.ServicePointManager]::SecurityProtocol =
[Net.SecurityProtocolType]::Tls12
Write-Verbose -Message "TLS 1.2 Ciper Successfully Enforced"
$filepath = Get-Location
$WS1Env = Get-Content -Path $filepath\tools\config.ini | Select -Skip 1 | ConvertFrom-StringData
$logPath = $WS1Env.logpath
@HawaiiRyan
HawaiiRyan / insecurescript.ps1
Last active March 24, 2020 20:44
example-BadSecurity
$logpath = "C:\Hawaii\Kauai\workspaceone\tools\logs"
If(!(test-path $logpath))
{
New-Item -ItemType Directory -Force -Path $logpath
}
$applog = "$logpath\HouseBought$((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss')).csv"
$addy = "https://kauai.ryanpringnitz.com"
$apiKey = "z/Model337ltuYugOcE2snK/ModelYnot?d4vHlN4hd="
$b64 = "SWNhbmhhelRlc2xhP1RoaXNQYXNzd29yZGlzSm9rZWJ1dFJlYWxseSxJd2FudEFUZXNsYQ=="
@HawaiiRyan
HawaiiRyan / GoogleChrome-AndroidUpdate.ps1
Last active April 1, 2020 22:13
Google Chrome App Update Tool - Android
######Howto use script
# 1. Create config.ini file
# 1a. Config.ini file example at following URL: https://gist.github.com/HawaiiRyan/b610f6d5427afa9609cee145affed912
# 2. Update -path location in the line where variable/object $WS1Env is declared
# 3. Ensure $addy, $b64, $apikey are referencing the correct environment.
# 3a. UAT environment is used in this example
#Set Verbosity Preference
$VerbosePreference = "Continue"
@HawaiiRyan
HawaiiRyan / MoreSecureAtRuntime.ps1
Last active May 2, 2020 19:39
Get-credentials and base64 encode credentials at runtime to access Workspace ONE UEM API's
$VerbosePreference = "Continue"
$script:config = "config.ini"
Write-Verbose -Message "The username is in the format domain\samAccountName"
function Test-APICred {
[CmdletBinding()]
[OutputType([String])]
Param (
[Parameter(
Mandatory = $true,
ValueFromPipeLine = $true,
$VerbosePreference = "Continue"
$script:Credentials = Get-Credential
Try {
$script:Username = $credentials.username
$script:Password = $credentials.GetNetworkCredential().password
}
Catch {
$_.Exception.Message
Continue
}
@HawaiiRyan
HawaiiRyan / gist:a8c34e6da7c2aee5ed0112ab5f0c303f
Created March 2, 2021 13:44
Get - Profile - cURL Example
curl --location --request GET 'https://ws1.ryanpringnitz.com/API/mdm/profiles/86' \
--header 'Accept: application/json;version=2' \
--header 'Authorization: Basic SGF3YWlpNG1l' \
--header 'aw-tenant-code: a/D3ariE08ltuYjgecv2jnW/mi41in3lYUd9vHlK0hk=' \
{
"AndroidForWorkWifiList": [
{
"ServiceSetIdentifier": "devtest",
"SecurityType": "WPA",
"Password": "*****",
"SetAsActiveNetwork": true,
"HiddenNetwork": false,
"EnterprisePassword": "*****"
}
{
"AndroidForWorkWifiList": [
{
"ServiceSetIdentifier": "devtest",
"SecurityType": "WPA",
"Password": "12345678",
"SetAsActiveNetwork": true,
"HiddenNetwork": false,
"EnterprisePassword": "12345678"
}
curl -X POST
--header 'Content-Type: application/json' \
--header 'Accept: application/json;version=2' \
--header 'Authorization: Basic SGF3YWlpNG1l' \
--header 'aw-tenant-code: a/D3ariE08ltuYjgecv2jnW/mi41in3lYUd9vHlK0hk=' \
-d '{ \
"AndroidForWorkWifiList": [ \
{ \
"ServiceSetIdentifier": "devtest", \
"SecurityType": "WPA", \
public static void main(String[] args) {
}