giving nsa/gchq a helping hand (re microsoft online immutableid guessing/calculation)


1 param([string[]]$args) 2 3 4 $msolcred = Get-Credential -UserName admin@netmagic.onmicrosoft.com ` 5 -Message "password for netmagic is Fred!" 6 Connect-MsolService -Credential $msolcred -ErrorAction Stop 7 8 $setfed = Get-MsolDomainFederationSettings -DomainName "rapmlsqa.com" 9 $alog = $setfed.ActiveLogOnUri 10 11 $strarr = $alog.Split('/') 12 $len = $strarr.Length 13 14 #colc/8/BARS 15 #appid/linkid/mlsid 16 17 18 $mlsid = $strarr[$len - 1] 19 $linkid = $strarr[$len - 2] 20 $appid = $strarr[$len - 3] 21 22 23 Get-MsolDomainFederationSettings -DomainName "rapmlsqa.com" -Verbose 24 25 26 echo $mlsid 27 echo $linkid 28 echo $appid 29 30 foreach ($name in $args) { 31 32 $upn = $name + "@rapmlsqa.com" 33 34 $displayname = $name + "_at_Rapattoni" 35 36 $someString = $name + $appID + $mlsID 37 $bytes = [System.Text.Encoding]::Default.GetBytes($somestring) 38 $md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider 39 $hashbytes = $md5.ComputeHash($bytes) 40 $result = [GUID]($hashbytes) 41 $resultstring = $result.ToString(); 42 $resultstringbytes = [System.Text.Encoding]::Default.GetBytes($resultstring) 43 44 $base64 = [System.Convert]::ToBase64String($resultstringbytes) 45 46 echo "new-msolUser –userprincipalname $upn -immutableID $base64 -lastname At_Rapattoni –firstname $name –Displayname $displayname -BlockCredential $false" 47 } 48 49

Advertisements

About home_pw@msn.com

Computer Programmer who often does network administration with focus on security servers. Very strong in Microsoft Azure cloud!
This entry was posted in crypto. Bookmark the permalink.