Jump to content
colombeen

[SOLVED] WMI: Retrieve out params from method

Recommended Posts

Hi guys,

I'm trying to get some information using WMI, from the Win32_EncryptableVolume class.

I exec my query, filter out the C-drive, but when I need more info using the objects methods, I only get 1 value back and I can't seem to retrieve the other out params that should be there.

A very minimal version of what I'm trying to do (no error checking etc, very basic). You need to start SciTE as admin or you won't see any results in the console!

#RequireAdmin
$strComputer = @ComputerName

$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\CIMV2\Security\MicrosoftVolumeEncryption")
$objWMIQuery = $objWMIService.ExecQuery("SELECT * FROM Win32_EncryptableVolume WHERE DriveLetter='C:'", "WQL", 0)

For $objDrive In $objWMIQuery
    ConsoleWrite("> " & $objDrive.GetConversionStatus() & @CRLF)
    ConsoleWrite("> " & $objDrive.GetConversionStatus().ConversionStatus & @CRLF)
    ConsoleWrite("> " & $objDrive.GetConversionStatus().EncryptionPercentage & @CRLF)
Next

The result from the console is : 

> 0
> 
>

What I'm expecting to get back is : 

> 0
> 0
> 0

When using powershell I get this (run as admin is required!!!) : 

PS C:\WINDOWS\system32> (Get-WmiObject -namespace "Root\cimv2\security\MicrosoftVolumeEncryption" -ClassName "Win32_Encryptablevolume" -Filter "DriveLetter='C:'").GetConversionStatus()
...
ConversionStatus     : 0
EncryptionFlags      : 0
EncryptionPercentage : 0
ReturnValue          : 0
...

All I seem to be getting is the ReturnValue when I use the method.

I've tried this on multiple methods, always ending up with the same result

Anyone here who has experience with this type of thing?

 

Greetz

colombeen

Edited by colombeen

Share this post


Link to post
Share on other sites

Try this:

global $a,$b,$c

$strComputer = @ComputerName
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\CIMV2\Security\MicrosoftVolumeEncryption")
$objWMIQuery = $objWMIService.ExecQuery("SELECT * FROM Win32_EncryptableVolume WHERE DriveLetter='C:'", "WQL", 0)

For $objDrive In $objWMIQuery
    $res = $objDrive.GetConversionStatus($a,$b,$c)
    ConsoleWrite("> " & $res & @CRLF)
    ConsoleWrite("> " & $a & @CRLF)
    ConsoleWrite("> " & $b & @CRLF)
    ConsoleWrite("> " & $c & @CRLF)
Next
Exit

And here is the documentation:

uint32 GetConversionStatus(
  [out] uint32 ConversionStatus,
  [out] uint32 EncryptionPercentage,
  [out] uint32 EncryptionFlags,
  [out] uint32 WipingStatus,
  [out] uint32 WipingPercentage,
  [in]  uint32 PrecisionFactor
);

 

Share this post


Link to post
Share on other sites
On 17-8-2018 at 11:14 AM, Juvigy said:

Try this:

global $a,$b,$c

$strComputer = @ComputerName
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\CIMV2\Security\MicrosoftVolumeEncryption")
$objWMIQuery = $objWMIService.ExecQuery("SELECT * FROM Win32_EncryptableVolume WHERE DriveLetter='C:'", "WQL", 0)

For $objDrive In $objWMIQuery
    $res = $objDrive.GetConversionStatus($a,$b,$c)
    ConsoleWrite("> " & $res & @CRLF)
    ConsoleWrite("> " & $a & @CRLF)
    ConsoleWrite("> " & $b & @CRLF)
    ConsoleWrite("> " & $c & @CRLF)
Next
Exit

 

I'll definitely try that out!

Edited by colombeen

Share this post


Link to post
Share on other sites

Mhhmmnn... Some of the values that I get back aren't what I'm expecting.

I'll just show you guys what I'm working on (FYI: it's far from ready, but the end result will be shared) : 

; newer version in latest post

When I run this the $intWipingStatus contains "-1", but in powershell I get this value "4294967295", while the documentation shows that it could only be an int between 0 and 3

https://docs.microsoft.com/en-us/windows/desktop/secprov/getconversionstatus-win32-encryptablevolume

 

Any idea?

Edited by colombeen

Share this post


Link to post
Share on other sites

Guessing it's not a very popular subject.

Another thing that frustrates me is the return value of the "IsAutoUnlockKeyStored"-method (I'm not talking about the out param, just the return value).

The documentation shows

uint32 IsAutoUnlockKeyStored(
  [out] boolean IsAutoUnlockKeyStored
);

And the return values should be 

Return code/value           Description
---------------------------------------------------
S_OK                        The method was successful.
0 (0x0)

FVE_E_NOT_ACTIVATED         BitLocker is not enabled on the volume. Add a key protector to enable BitLocker.
2150694920 (0x80310008)

FVE_E_NOT_OS_VOLUME         The method can only be run for the currently running operating system volume.
2150694952 (0x80310028)

But then why do I keep getting "-2144272376"

Is there some kind of conversion I'm forgetting or is MS just screwing me over? :D

Edited by colombeen

Share this post


Link to post
Share on other sites
3 minutes ago, ripdad said:

-2144272376 converts to 0x80310008 (FVE_E_NOT_ACTIVATED)

MsgBox(0, '', '0x' & Hex(-2144272376))

 

YOU
ARE
A
LIFE
SAVER

 

But I'm still not sure what to do with the -1 I'm getting from the $intWipingStatus :-s

Edited by colombeen

Share this post


Link to post
Share on other sites

-1 in WMI usually means: UNKNOWN

In powershell...

4294967295 converts to 0xFFFFFFFF which usually means allow or enabled and 0x00000000 usualy means disabled.

Not 100% sure this is the case for your issue though.

 


"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Share this post


Link to post
Share on other sites
23 hours ago, ripdad said:

-1 in WMI usually means: UNKNOWN

In powershell...

4294967295 converts to 0xFFFFFFFF which usually means allow or enabled and 0x00000000 usualy means disabled.

Not 100% sure this is the case for your issue though.

 

I was coming to the same conclusion as well on the -1 being UNKNOWN in most cases.

I've added it to my array as the first item and just +1 the result I get for now :)

; newer version in latest post

If anyone who is using bitlocker could test this out (and post back the results), it would be greatly appreciated!

Edited by colombeen

Share this post


Link to post
Share on other sites

I've made some more changes. I'm hoping it will work (can't test it here, I'm not allowed to encrypt my system just yet).

If anyone is willing to test my script (doens't matter if your system is or isn't using bitlocker, you just need WinVista or newer), please let me know what the result was so that I can fix bugs etc before I implement it (and also share it here ofcourse)

Please run SciTE as admin, otherwise you won't see the errors etc in the console

; newer version in latest post

Also, I'm not sure if it's possible to read this information remotely because of safety precautions by MS.

This is my result : 

BitlockerDriveInfo.thumb.png.1b638669df3f6fd3afb7fbd8f9a80067.png

My console output :

!> GetConversionStatus      0x00000000
!> GetEncryptionMethod      0x00000000
!> GetKeyProtectors         0x00000000
!> GetLockStatus            0x00000000
!> GetProtectionStatus      0x00000000
!> IsAutoUnlockEnabled      0x80310008
!> IsAutoUnlockKeyStored    0x80310008

EDIT:

I had a little issue that the secondary pop-up didn't show because I forgot to change $test[0][11] to $test[0][12] when I added another item to the array.

Edited by colombeen
bugfix

Share this post


Link to post
Share on other sites

This is the output of your script:

!> GetConversionStatus        0x00000000
!> GetEncryptionMethod        0x00000000
!> GetKeyProtectors       0x00000000
!> GetLockStatus      0x00000000
!> GetProtectionStatus        0x00000000
!> IsAutoUnlockEnabled        0x80310019
!> IsAutoUnlockKeyStored  0x00000000
"C:\Documents and Settings\delchevs\Desktop\COM fixes\BitLocker.au3" (58) : ==> The requested action with this object has failed.:
$aResult[$iRow][1]  =   $aVolumeTypeMsg[$objDrive.VolumeType]
$aResult[$iRow][1]  =   $aVolumeTypeMsg[$objDrive^ ERROR

And if i run the example script from my first post i get:

> 0
> 1
> 100
>

I am using win7 and have bitlocker.

Share this post


Link to post
Share on other sites
; newer version in latest post

This is an attempt to fix the missing properties in Win7

Edited by colombeen

Share this post


Link to post
Share on other sites

Now it works.

C:|Operating System Volume|Unkown|Protected|Unlocked|False|False|Fully Encrypted|AES_256|100|Free Space Not Wiped||{Array}
{CF607D86-743D-4E29-8FF2-A49D0D7AB820}|Numerical password
{B1AA7EF7-AC39-4D21-A278-B12EA6AA5F2B}|Trusted Platform Module (TPM)
!> GetConversionStatus        0x00000000
!> GetEncryptionMethod        0x00000000
!> GetKeyProtectors       0x00000000
!> GetLockStatus      0x00000000
!> GetProtectionStatus        0x00000000
!> IsAutoUnlockEnabled        0x80310019
!> IsAutoUnlockKeyStored  0x00000000

 

Share this post


Link to post
Share on other sites

Awesome!

I'll still need to fix some things but I'm getting there :) 

EDIT:

I've added a few checks to make sure everything works fine, I'm not noticing alot of performance loss.

; newer version in latest post

 

Edited by colombeen

Share this post


Link to post
Share on other sites

I'm just having one last issue before I can post the "final" version in the example scripts

I need to add

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7

But the changes I need to make so that my script will still work is what I can't figure out.

This is the part that will show errors : 

If IsArray($aVolumeKeyProtectorID) And UBound($aVolumeKeyProtectorID) > 0 Then
    Local $aVolumeKeyProtectors[UBound($aVolumeKeyProtectorID)][2], $iKeyProtectorType

    For $i = 0 To UBound($aVolumeKeyProtectorID) - 1
        $aVolumeKeyProtectors[$i][0]        =   $aVolumeKeyProtectorID[$i]
        If _WMIMethodExists($objDrive, "GetKeyProtectorType") Then
            If $objDrive.GetKeyProtectorType($aVolumeKeyProtectorID[$i], $iKeyProtectorType) = 0 Then
                $aVolumeKeyProtectors[$i][1]=   $aKeyProtectorTypeMsg[$iKeyProtectorType]
            Else
                $aVolumeKeyProtectors[$i][1]=   "Unknown"
            EndIf
        Else
            $aVolumeKeyProtectors[$i][1]    =   "Unknown"
        EndIf
    Next
Else
    Local $aVolumeKeyProtectors             =   "None"
EndIf

I declare the $aVolumeKeyProtectors 2 times, which I know is wrong, even more so when you put it inside of a loop.

Any suggestions? I can't seem to figure it out

Share this post


Link to post
Share on other sites

It's easy if you know how to do it:

Local $aVolumeKeyProtectors
If IsArray($aVolumeKeyProtectorID) And UBound($aVolumeKeyProtectorID) > 0 Then
    Dim $aVolumeKeyProtectors[UBound($aVolumeKeyProtectorID)][2]
    Local $iKeyProtectorType
    ; ...
Else
    $aVolumeKeyProtectors             =   "None"
EndIf

 

Share this post


Link to post
Share on other sites
3 hours ago, LarsJ said:

It's easy if you know how to do it:

Local $aVolumeKeyProtectors
If IsArray($aVolumeKeyProtectorID) And UBound($aVolumeKeyProtectorID) > 0 Then
    Dim $aVolumeKeyProtectors[UBound($aVolumeKeyProtectorID)][2]
    Local $iKeyProtectorType
    ; ...
Else
    $aVolumeKeyProtectors             =   "None"
EndIf

 

Is it that simple? I'll try that out! Thx!

EDIT:

Just tried it, WORKS LIKE A CHARM! :D

 

I moved the script to the examples : 

 

Edited by colombeen

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By Colduction
      I had created login form and this form first goes to de-crypting file that encrypted then read the saved credentials by de-cryptied file, but doesn't work properly!
      I want just read encrypted data without saving de-crypted file, just read! 
      #NoTrayIcon #include <Crypt.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ;==================================Variables=================================== ;Encryption settings _Crypt_Startup() $PEK = _Crypt_DeriveKey("BS#Password", $CALG_AES_256, $CALG_SHA_512) $DefaultCredFile = "[Credentials]" & @CRLF & "BUsername=NoAdmin" & @CRLF & "BPassword=NoAdmin" & @CRLF & "[Process]" & @CRLF & "ProcessKillingTimeout=3600" $EncryptDefaultCred = _Crypt_EncryptData($DefaultCredFile, $PEK, $CALG_AES_256) $IniReadCredPassword = IniRead(@WindowsDir & "\Config\GUIDecCred.dat", "Credentials", "BPassword", "") $IniReadCredUsername = IniRead(@WindowsDir & "\Config\GUIDecCred.dat", "Credentials", "BUsername", "") ;==================================Variables=================================== AuthForm() Func AuthForm() Global $LoginForm = GUICreate("Login", 201, 161, -1, -1) Global $CloseBTN = GUICtrlCreateButton("Close", 23, 126, 75, 25) Global $SignInBTN = GUICtrlCreateButton("Sign-in", 103, 126, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $PasswordInput = GUICtrlCreateInput("admin", 8, 88, 185, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$ES_PASSWORD)) Global $UsernameInput = GUICtrlCreateInput("admin", 8, 40, 185, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) Global $UsernameLBL = GUICtrlCreateLabel("Username:", 8, 21, 55, 17) Global $PasswordLBL = GUICtrlCreateLabel("Password:", 8, 68, 53, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $SignInBTN AuthProcess() EndSwitch WEnd EndFunc AuthProcess() Func AuthProcess() $ReadEnteredUsername = GUICtrlRead($UsernameInput) $ReadEnteredPassword = GUICtrlRead($PasswordInput) If Not FileExists(@WindowsDir & "\Config\GUIEncCred.dat") Then FileDelete(@WindowsDir & "\Config\GUIDecCred.dat") ;Delete previous de-crypted credentials FileWrite(@WindowsDir & "\Config\GUIEncCred.dat", $EncryptDefaultCred) ;Write en-crypted credentials as "*.dat" file FileClose(@WindowsDir & "\Config\GUIEncCred.dat") ;Close en-crypted credentials file _Crypt_DecryptFile(@WindowsDir & "\Config\GUIEncCred.dat", @WindowsDir & "\Config\GUIDecCred.dat", $PEK, $CALG_AES_256) ;Write de-crypted file from an en-crypted file as "*.dat" file Else _Crypt_DecryptFile(@WindowsDir & "\Config\GUIEncCred.dat", @WindowsDir & "\Config\GUIDecCred.dat", $PEK, $CALG_AES_256) ;Write de-crypted file from an en-crypted file as "*.dat" file EndIf Sleep(25) If $ReadEnteredUsername == $IniReadCredUsername And $ReadEnteredPassword == $IniReadCredPassword Then ;Username and Password verify stage MsgBox(64, "", "Welcome!") FileDelete(@WindowsDir & "\Config\GUIDecCred.dat") Exit Else MsgBox(14, "", "Incorrect!") FileDelete(@WindowsDir & "\Config\GUIDecCred.dat") Sleep(25) EndIf EndFunc How Can i? 
    • By Dwalfware
      HI
      Another head scratched
      Anyone solve how to get the IPV6 from WMI?
      I followed the usual SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionID='" & GUICtrlRead($cboAdapters) & "'
      get the index 
      port it to 
      Local $query = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE Index = " & _GetSelectedNIC(), "WQL", 0x30 )
      All i can see is IPv4 addresses
      My question is is there another place the IPv6 information is hiding? I configured my LAN with IPV6 and my wireless with IPv4 so I can see what shows.
      Thanks in Advance.
      PS. I did try google
       
    • By Dwalfware
      Hi Folks
      Can not get my head around this one.
      This function gets the DNS object s
      If you have two DNS entries fine. but if you have only one! Trouble
      $objItem.DNSServerSearchOrder[0] = Primary DNS
      $objItem.DNSServerSearchOrder[1] = Secondry DNS not always there. I need a way to return 0 if not there or the IP if its there.
      Or is there a way to tell how many objects there are in the "[?]"
      I'm terrible at WMI errors, thanks for help in advance.
      Func _GETcurrentNICinfo2() $oErrors = ObjEvent("AutoIt.Error", "Error_Handle") Local $DnsSecondry Local $objWMIService = ObjGet( "winmgmts:\\" & @ComputerName & "\root\CIMV2" ) Local $query = $objWMIService.ExecQuery("SELECT DNSServerSearchOrder FROM Win32_NetworkAdapterConfiguration WHERE Index = " & _GetSelectedNIC(), "WQL", 0x30 ) If @error Then Return 0 If NOT IsObj($query) Then Return 0 Else For $objItem In $query Return $objItem.DNSServerSearchOrder[1] next Endif EndFunc  
    • By Beege
      I found this article and enjoyed it so much I had play with some code since the numbers are small enough. 
      https://thatsmaths.com/2016/08/11/a-toy-example-of-rsa-encryption/
       
      Standard Encryption's vs RSA Encryption (Public Key Encryption) Fundamental Differences
      If you read that and couldn't immediately clarify the difference then let me blow your mind because its simple:
      STANDARD ENCRYPTION'S:
      ORIGINAL_DATA + Password(or KEY) = Encrypted DATA
          Then to decrypt -> 
              Encrypted DATA + (SAME Password(or SAME KEY)) = ORIGINAL_DATA
              
      RSA:
              ORIGINAL_DATA + Password(or PUBLIC_KEY) = Encrypted DATA
          Then to decrypt -> 
              Encrypted DATA + (DIFFERENT Password(or PRIVATE_KEY)) = ORIGINAL_DATA
      Are we all caught up? Did the colors help? I think they did
      That's crazy right? Don't answer. It is. And crazier its used EVERY TIME we make a secure connection to a server over the internet. But here's the craziest part to me that I recently got clarity on from the toy example and that is the simplicity of this very very very very important algorithm that has yet to be cracked (fingers crossed):
                 Mod($vData ^ $key, $n)
          
      So ya. That's it. That's the magic algorithm. 3 values. Oh and $n is also a shared known value that will be in the certificate with the public key that your browser reads when it makes a connection:

      That's just mind blowing to me so couldn't resist getting something going in AUT. After playing with this code, I got a much better understanding of how its not just that algorithm that makes this whole thing possible. The numbers that we pick to form the public key and n are just as important and also how important it is to be random! 
      Let me know if you have any problems. Enjoy!
      #include <array.au3> _Toy_RSA_Example() ;https://thatsmaths.com/2016/08/11/a-toy-example-of-rsa-encryption/ Func _Toy_RSA_Example() Local $p, $q, $n, $nT, $e, $d Local $aPublicKeys, $aCrypt, $sDecrypt, $sMsg ;Pick two random primes (they will be between 1000-10000) $p = _GetRandomPrime() $q = _GetRandomPrime() $sMsg = 'p= %i \t\t| Prime 1 - [NOT SHARED!]\nq= %i \t\t| Prime 2 - [NOT SHARED!]\n' ;Calculate lowest common multiple $nT = _LCM($p - 1, $q - 1) $sMsg &= 'nT= %i \t| _LCM(p - 1,q - 1) - [NOT SHARED!]\n' ;Calculate n. This is a shared number $n = $p * $q $sMsg &= 'n= %i \t| p * q - [Shared]\n' ;Get a small random list of possible public keys to pick from. Only searching for 100ms $aPublicKeys = _GetPublicKeys($nT) _ArrayDisplay($aPublicKeys, "Possible Public Keys Found") ;Pick a random public (encryption) key from array $e = $aPublicKeys[Random(1, $aPublicKeys[0], 1)] $sMsg &= 'e= %i \t| Public (Encryption) Key - [Shared]\n' ;Generate our private (decryption) key $d = _GetPrivateKey($e, $nT) $sMsg &= 'd= %i \t| Private (Decryption) Key - [NOT SHARED!]\n' ;format our msg (rsa details) to encrypt $sMsg = StringFormat($sMsg, $p, $q, $nT, $n, $e, $d) ;encrypt message $aCrypt = _RSA($sMsg, $e, $n) _ArrayDisplay($aCrypt, 'Encrypted RSA messsage') ;Decrypt array back $sDecrypt = _RSA($aCrypt, $d, $n) MsgBox(0, 'Decrypted RSA messsage', $sDecrypt) EndFunc ;==>_Toy_RSA_Example ;Function will perfrom Mod($v ^ $key, $n) on each char/element. ;Excepts Arrays or Strings. If input is array a string is returned and vice versa. Func _RSA($vDat, $key, $n) Local $bIsStr = IsString($vDat) If $bIsStr Then $vDat = StringToASCIIArray($vDat) For $i = 0 To UBound($vDat) - 1 $vDat[$i] = _Modular($vDat[$i], $key, $n) Next Return $bIsStr ? $vDat : StringFromASCIIArray($vDat) EndFunc ;==>_RSA ;algorithm is from the book "Discrete Mathematics and Its Applications 5th Edition" by Kenneth H. Rosen. Func _Modular($iBase, $iExp, $iMod) ; Mod($v ^ $key, $n) Local $iPower = Mod($iBase, $iMod) Local $x = 1 For $i = 0 To (4 * 8) - 1 If BitAND(0x00000001, BitShift($iExp, $i)) Then $x = Mod(($x * $iPower), $iMod) EndIf $iPower = Mod(($iPower * $iPower), $iMod) Next Return $x EndFunc ;==>_Modular ;Generate a "random" list of possible valid public keys to choose from based on $nT Func _GetPublicKeys($nT, $iMs = 100) Do Local $aKeys[10000] = [0], $iTime = TimerInit() Local $i = (Mod(@SEC, 2) ? Int($nT / 2) : Int($nT / 4)) ; randomize where we start Do If _IsPrime($i) And _IsCoPrime($i, $nT) Then $aKeys[0] += 1 $aKeys[$aKeys[0]] = $i EndIf $i += (Mod(@MSEC, 2) ? 1 : 100) ; randomize step size Until ($i >= ($nT - 1)) Or (TimerDiff($iTime) > $iMs) ReDim $aKeys[$aKeys[0] + 1] Until $aKeys[0] > 5 ; Ive seen 200+ returned sometimes and 0 on others. Make sure we have at least a few choices Return $aKeys EndFunc ;==>_GetPublicKeys ;https://www.geeksforgeeks.org/multiplicative-inverse-under-modulo-m/ - _ModInverse(a,m) Func _GetPrivateKey($a, $m) If ($m = 1) Then Return 0 ; Local $t, $q, $y = 0, $x = 1, $m0 = $m While ($a > 1) $q = Int($a / $m) ;q is quotient $t = $m ; $m = Mod($a, $m) ;m is remainder now, process same as Euclid's algo $a = $t ; $t = $y ; $y = $x - $q * $y ;Update y and x $x = $t ; WEnd Return $x < 0 ? $x + $m0 : $x EndFunc ;==>_GetPrivateKey ;Pick the next nearest prime from a random number (or number you cho0se) Func _GetRandomPrime($iStart = Default) Local $iPrime = ($iStart = Default ? Random(1000, 10000, 1) : $iStart) Do $iPrime += 1 Until _IsPrime($iPrime) Return $iPrime EndFunc ;==>_GetRandomPrime #Region Math Functions Func _IsPrime($n) For $i = 2 To (Int($n ^ 0.5) + 1) If Mod($n, $i) = 0 Then Return False Next Return True EndFunc ;==>_IsPrime Func _IsCoPrime($a, $b) Return _GCD($a, $b) = 1 EndFunc ;==>_IsCoPrime Func _GCD($iX, $iY) Local $iM While 1 $iM = Mod($iX, $iY) If $iM = 0 Then Return $iY $iX = $iY $iY = $iM WEnd EndFunc ;==>_GCD Func _LCM($iX, $iY) Return ($iX * $iY) / _GCD($iX, $iY) EndFunc ;==>_LCM #EndRegion Math Functions  
      You should get a message box displaying the decrypted message with details of the values used:

       
      rsa.au3
    • By SolemnStrike
      Hey, 
      I know the title sounds weird, but i couldn't find better words for it...
      I finally managed to have a working image search (yes yes i know image search is evil :p).
      I noticed that even if the script is compiled, the images have to be in my script folder.
      But i don't want that the images i'm searching for on the screen can be viewed, edited etc by every user.
      Is there a way to... uhm... put them in a file like .rar, but one that can't be easily opened? 🤔
       
      Edit: Now that i think of .rar, maybe using a .rar which is protected by a password... Can autoit search, open, extract, use and delete that? (I guess so, I didn't search for this yet, going to google that asap)
×
×
  • Create New...