Jump to content

Recommended Posts

Bundle v2.3 released, with experimental support for (encryption of) object methods.

@souldjer777: Glad to hear you got it working again, although I get the impression your CodeScannerCrypter work environment is not entirely stable, as your latest issue is resolved in my own environment now. Maybe try with the latest version of the bundle, released today? Kindly post the smallest-possible reproducer test script if you continue to experience serious issues.:)

@Deye: Hello there.^_^ Your wish is my command (well, as I'm waiting for a very long calculation to finish your request provided a nice challenging tears-inducing interesting diversion). CodeScanner now tracks object method calls (not object queries though!), and MCF can encode/recode them (if all goes well:sweating:). This is an experimental, possibly very unstable feature, so use it at your own risk!

Link to post
Share on other sites
  • Replies 396
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

CodeCrypter enables you to encrypt scripts without placing the key inside the script. This is because this key is extracted from the user environment at runtime by, for example: password us

Codecrypter version 3.1 is released; a major upgrade, made possible by the incorporation of TheXman's CryptoNG suite (with permission, of course). Many thanks to TheXman for allowing me to incorporate

Found the issue, which was indeed a bug. Please stand by for an updated bundle... CodeScannerCrypter bundle version 2.4 is now released, with many thanks to @Roman for flagging the bug.

Posted Images

Good Morning RTFC :)

Here's what I got from the latest v2.3 run...

Local $UIA_propertiesSupportedArray[123][2]=[["indexrelative",$__UIA_SpecialProperty], _
"index",$__UIA_SpecialProperty], _
"instance",$__UIA_SpecialProperty], _
"title",$UIA_NamePropertyId], _
"text",$UIA_NamePropertyId], _
Local $patternArray[21][3]=[[$UIA_ValuePatternId,$sIID_IUIAutomationValuePattern,$dtagIUIAutomationValuePattern], _
$UIA_InvokePatternId,$sIID_IUIAutomationInvokePattern,$dtagIUIAutomationInvokePattern], _
$UIA_SelectionPatternId,$sIID_IUIAutomationSelectionPattern,$dtagIUIAutomationSelectionPattern], _

"error: syntax error"
"error: wrong nesting in initializer"
"error: Statement cannot be just an expression."

I appreciate all the help!!!  :D


Edited by souldjer777

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Link to post
Share on other sites

@souldjer777: That's not what I asked for.:( If you want me to fix something you have to provide me with a (the smallest possible!) reproducer script, not a single partial line of code. I need to see the original script you provide run, and the Backtranslated or Encrypted version fail, for me to be able to figure out what might be going wrong. For example, this works fine for me:

Global $UIA_ValuePatternId, $sIID_IUIAutomationValuePattern, $dtagIUIAutomationValuePattern
Global $UIA_InvokePatternId, $sIID_IUIAutomationInvokePattern, $dtagIUIAutomationInvokePattern
Global $UIA_SelectionPatternId, $sIID_IUIAutomationSelectionPattern, $dtagIUIAutomationSelectionPattern
Global $UIA_LegacyIAccessiblePatternId, $sIID_IUIAutomationLegacyIAccessiblePattern, $dtagIUIAutomationLegacyIAccessiblePattern
Global $UIA_SelectionItemPatternId, $sIID_IUIAutomationSelectionItemPattern, $dtagIUIAutomationSelectionItemPattern
Global $UIA_RangeValuePatternId, $sIID_IUIAutomationRangeValuePattern, $dtagIUIAutomationRangeValuePattern
Global $UIA_ScrollPatternId, $sIID_IUIAutomationScrollPattern, $dtagIUIAutomationScrollPattern
Global $UIA_GridPatternId, $sIID_IUIAutomationGridPattern, $dtagIUIAutomationGridPattern
Global $UIA_GridItemPatternId, $sIID_IUIAutomationGridItemPattern, $dtagIUIAutomationGridItemPattern
Global $UIA_MultipleViewPatternId, $sIID_IUIAutomationMultipleViewPattern, $dtagIUIAutomationMultipleViewPattern
Global $UIA_WindowPatternId, $sIID_IUIAutomationWindowPattern, $dtagIUIAutomationWindowPattern
Global $UIA_DockPatternId, $sIID_IUIAutomationDockPattern, $dtagIUIAutomationDockPattern
Global $UIA_TablePatternId, $sIID_IUIAutomationTablePattern, $dtagIUIAutomationTablePattern
Global $UIA_TextPatternId, $sIID_IUIAutomationTextPattern, $dtagIUIAutomationTextPattern
Global $UIA_TogglePatternId, $sIID_IUIAutomationTogglePattern, $dtagIUIAutomationTogglePattern
Global $UIA_TransformPatternId, $sIID_IUIAutomationTransformPattern, $dtagIUIAutomationTransformPattern
Global $UIA_ScrollItemPatternId, $sIID_IUIAutomationScrollItemPattern, $dtagIUIAutomationScrollItemPattern
Global $UIA_ItemContainerPatternId, $sIID_IUIAutomationItemContainerPattern, $dtagIUIAutomationItemContainerPattern
Global $UIA_VirtualizedItemPatternId, $sIID_IUIAutomationVirtualizedItemPattern, $dtagIUIAutomationVirtualizedItemPattern
Global $UIA_SynchronizedInputPatternId, $sIID_IUIAutomationSynchronizedInputPattern, $dtagIUIAutomationSynchronizedInputPattern
Global $UIA_ExpandCollapsePatternId, $sIID_IUIAutomationExpandCollapsePattern, $dtagIUIAutomationExpandCollapsePattern

Local $patternArray[21][3] = [ _
        [$UIA_ValuePatternId, $sIID_IUIAutomationValuePattern, $dtagIUIAutomationValuePattern], _
        [$UIA_InvokePatternId, $sIID_IUIAutomationInvokePattern, $dtagIUIAutomationInvokePattern], _
        [$UIA_SelectionPatternId, $sIID_IUIAutomationSelectionPattern, $dtagIUIAutomationSelectionPattern], _
        [$UIA_LegacyIAccessiblePatternId, $sIID_IUIAutomationLegacyIAccessiblePattern, $dtagIUIAutomationLegacyIAccessiblePattern], _
        [$UIA_SelectionItemPatternId, $sIID_IUIAutomationSelectionItemPattern, $dtagIUIAutomationSelectionItemPattern], _
        [$UIA_RangeValuePatternId, $sIID_IUIAutomationRangeValuePattern, $dtagIUIAutomationRangeValuePattern], _
        [$UIA_ScrollPatternId, $sIID_IUIAutomationScrollPattern, $dtagIUIAutomationScrollPattern], _
        [$UIA_GridPatternId, $sIID_IUIAutomationGridPattern, $dtagIUIAutomationGridPattern], _
        [$UIA_GridItemPatternId, $sIID_IUIAutomationGridItemPattern, $dtagIUIAutomationGridItemPattern], _
        [$UIA_MultipleViewPatternId, $sIID_IUIAutomationMultipleViewPattern, $dtagIUIAutomationMultipleViewPattern], _
        [$UIA_WindowPatternId, $sIID_IUIAutomationWindowPattern, $dtagIUIAutomationWindowPattern], _
        [$UIA_DockPatternId, $sIID_IUIAutomationDockPattern, $dtagIUIAutomationDockPattern], _
        [$UIA_TablePatternId, $sIID_IUIAutomationTablePattern, $dtagIUIAutomationTablePattern], _
        [$UIA_TextPatternId, $sIID_IUIAutomationTextPattern, $dtagIUIAutomationTextPattern], _
        [$UIA_TogglePatternId, $sIID_IUIAutomationTogglePattern, $dtagIUIAutomationTogglePattern], _
        [$UIA_TransformPatternId, $sIID_IUIAutomationTransformPattern, $dtagIUIAutomationTransformPattern], _
        [$UIA_ScrollItemPatternId, $sIID_IUIAutomationScrollItemPattern, $dtagIUIAutomationScrollItemPattern], _
        [$UIA_ItemContainerPatternId, $sIID_IUIAutomationItemContainerPattern, $dtagIUIAutomationItemContainerPattern], _
        [$UIA_VirtualizedItemPatternId, $sIID_IUIAutomationVirtualizedItemPattern, $dtagIUIAutomationVirtualizedItemPattern], _
        [$UIA_SynchronizedInputPatternId, $sIID_IUIAutomationSynchronizedInputPattern, $dtagIUIAutomationSynchronizedInputPattern], _
        [$UIA_ExpandCollapsePatternId, $sIID_IUIAutomationExpandCollapsePattern, $dtagIUIAutomationExpandCollapsePattern] _
Link to post
Share on other sites
On 1/26/2018 at 6:19 PM, Deye said:

a whole routine for object methods

You're welcome.:) It actually required new code in CodeScanner, MCF, and readCSdatadump. The trouble with object methods for me is, I don't use them myself at all because they are weird in mine eyes, viz.:

  • they look like variables, but you can't stick something in them, and they should not be obfuscated
  • they also look a bit like strings, but they cannot be edited, and should not be translated
  • they behave like function calls, but have no brackets, no separate parameters, and no accessible definition elsewhere in the sript, so it's not clear what they do or how they do it, and you cannot fix them yourself if they screw up
  • yet they are executable calls of a kind, and should be phrased by MCF prior to execution

So my initial hopes of piggy-backing them onto an existing metacode category failed repeatedly (hence the tears:'(), which is why CodeSCanner now lists and stores them as a separate entity (which of course they are; I was just being lame and lazy). But now I've had some chocolate milk and cookies and I'm all better now.:baby:

Edited by RTFC
Link to post
Share on other sites
  • 2 weeks later...

Impressive :)


A comment

I have finally gotten round to running this on an existing project.  Takes forever on 48k lines... 


Some suggestions

I have the following comments on this thread - please consider in Post #1 to state at the very top Date and Current Version - will make it quick and easy to see when it was last updated.  Please list the downloads (I count 3) in a list?

Please include the comments in posts #71 and #185 & #187 in Post #1?  It's not so much what it does, as how to use it :)


Support request

Then, as far as the actual encrypter is concerned.  Encrypting my entire script is not my issue.  As you point out a lot of the standard includes are in the public domain.  However I have SQL queries which are listed as strings all over the place.  All I really need is to encrypt these strings... :) 

Any thoughts would be very welcome...


Edited by Skysnake


Why is the snake in the sky?

Link to post
Share on other sites

Hello, everyone,

I already successfully used CodeCrypter in version 1.9 two years ago, I had no problems with this.
Now I have tried again, but neither the current version nor the version 1.9 runs for me.
Not on Windows 7, not on Windows 10... I'm going insane. I tested it with AutoIT version as well as with the current version.

My test script consists of a single line, a MsgBox. So it's not 100% due to the script... CodeScanner generates the necessary output and "Obfuscate" also works.
If I choose "Encrypt" I get the error message attached below.

I'm a little confused. Does anybody have any idea what the reason might be?

Many thanks in advance,

Link to post
Share on other sites

Hi, Skysnake,

the includes were all there. I've narrowed down the problem. I had used Visual Studio Code as an editor. This always starts scripts with pointless CommandLine parameters. Therefore I added the additional line "$cmdline[0] = """ in codescanner and codecrpter.

After removing these lines AND running the whole thing on my Windows 7 VM with the SciTE editor, it worked now.
The problem was my small customization and the Visual Studio code editor.

Thank you for your feedback,

Link to post
Share on other sites

The CodeCrypter package is really excellent, there's nothing else to say! Especially for newly created or smaller programs, this is a quick and wonderful way to secure the code! Many thanks for that!!! :)

In my case I have a nearly 90,000 lines of a program which I tried to encrypt.
Basically, this also works, but there are some problems (which could certainly be solved in sufficient time and effort) and the encryption process takes several hours.

However, it makes no sense to encrypt the entire program, as it may only makes sense to encrypt 100 lines containing access data. These credentials are currently global, so they are set at the beginning, so encryption has to start early. Are there possibilities to encrypt only parts of the program and to exclude others? I read that you should add the include of "MCFinclude. au3" at the point from which you want to start the encryption.... can you specify a point, from when the encryption should not ne done anymore?

As you can see from my text, I am looking for a solution to encrypt only partial parts of the program. I would be very grateful for a solution or approach!


Link to post
Share on other sites

@Skysnake: Thanks a lot :) for your comments and suggestions; I'll see if I can improve the first post. Added MCF Tutorial to MCF thread's first post.

On 2/8/2018 at 8:37 PM, Skysnake said:

Takes forever on 48k lines

I'm not surprised. You should consider limiting what you encrypt, either by volume (x%, every Nth line only, you can set this through subset definition, see the FAQ for details) or targeting specific UDFs only (under "UDF" button, under Tab Encrypt). If it's only strings that need to be protected, you can switch code-encryption off altogether and just encrypt text strings, by unticking the "Phrases" box under the Encrypt Tab. If you need more control, you can start with an encryption pass on all strings (generating stringsEncryp.txt in the MCF subdir of your script, and then building your own stringsNew.txt by copying line-by-line from either stringsUsed.txt or stringsEncryp.txt (but be VERY CAREFUL not to miss/duplicate any line, because line nr = array index in the MCF replacement pass), then use CodeCrypter's "Create New" option instead of Encrypt.

NB I would still keep MCFinclude.au3 as your last regular include, above your main procedure and your own UDFs.

@Tupac Thank you for the kind words,^_^ sorry you had some trouble getting the environment to work for you at the outset. See my answer directly above in this same post for some suggestions how to reduce your encryption footprint. Hint: The FAQ also goes into detail about this.;)

@Rex: Tutorial download link added in MCF thread post #1. I had removed it because of earlier space restrictions.

Edited by RTFC
Link to post
Share on other sites

It means that while collecting #include files referenced in other include-files, a single pass (of this recursive search) yielded >50 new files, which at the time I wrote it was a useful red-flag for circular referencing and other pathological #include structures. If you are really including many more external UDFs at any particular include netsting level, you can bump up that threshold in CodeScanner's source, in function _BuildIncTree, ca. line 3620, e.g. replace 50 with 100:

If $samecount+$largercount>100 Then

Or whatever maxvalue seems reasonable in your specific circumstances.

Edited by RTFC
Link to post
Share on other sites

grrrum. It is caused by something else becouse I used autoit stripper so all includes are coupled in one file 10k lines .

I made so many changes in my program but cant figure out what caused this problem.

Now I set

If $samecount+$largercount>2300 Then

soomuch long execute time and same error.

only one include in this file is MCFinclude.au3

Maybe it look into dll files,bitmap or etc

Edited by Miliardsto
Link to post
Share on other sites

Do you or don't you have >2300 include files? I suspect you don't, so then I suspect some of your #includes do not have directive #include-once at the top, and there is some circular referencing going on, causing the include-tree mapping to balloon exponentially out of control (which is exactly what that check was testing for). Just my two cents without having studied your code, of course. Can't do much to help you other than to suggest you don't strip the source yourself, and try removing all explicit includes (and the main code that references these), and re-including them one at a time, then following the branches further up. Do you have earlier versions of your code that still work, for comparison? I don't suppose you can create a 10-line reproducer script in this case, so in that case I would start disabling large parts of your code, and re-analyse repeatedly while stepwise re-enabling more parts again, until it fails again, then study that last re-enabled part in more detail.

Link to post
Share on other sites

Good catch, Miliardsto. I was aware of some issues in the latest AutoIt version, but not having upgraded yet myself, I was unaware that some of these might affect CodeScanner's proper functioning.:( Let's hope the devs get on top of it soon. Glad you found a way forward regardless though.:)

Link to post
Share on other sites
  • 3 weeks later...
  • 2 months later...

This post uses Google Translate.

Hello, first of all thank you for your encryption tool.

Tested on....W10Pro/86
Test Tools... CodeScannerCrypter.bundle.source.v2.3

Source script:

#include <MsgBoxConstants.au3>
#include "MCFinclude.au3"; for encryption only
Global $WriteMetaCode = True
Local $iTimeout = 10.
MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after " & $iTimeout & " seconds or select the OK button.", $iTimeout)
In order to solve the problem of a large number of documents lost in "Includes", after some hard work,
Last modified in your codescanner.au3 script....

Lines 3151 and 3152:
$AutoItIncludeFolder & $newinclude
change into:
$AutoItIncludeFolder & "\" & $newinclude

Line 4574:
change into:

This will solve the problem that "Includes" is not found

The above changes are for reference only!

Edited by Melba23
Huge quote translated to Chinese removed
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By TheXman
      Encryption / Decryption / Hashing
      Cryptography API: Next Generation (CNG) is Microsoft's long-term replacement for their CryptoAPI.  CNG is designed to be extensible at many levels and cryptography agnostic in behavior.  Although the Crypt.au3 UDF that is installed with AutoIt3 still works perfectly, the advapi32.dll functions that it uses have been deprecated.  This UDF was created to offer a replacement for the deprecated functions.  According to Microsoft, deprecated functions may be removed in future release.  Therefore, this UDF will be available when/if that happens.
      This UDF implements some of Microsoft's Cryptography API: Next Generation (CNG) Win32 API functions.  In its initial release, it implements functions to encrypt text & files, decrypt text and files, generate hashes, and the Password-Based Key Derivation Function 2 (PBKDF2) function.  The UDF can implement any of the encryption/decryption algorithms or hashing algorithms that are installed on the PC in which it is running.  Most, if not all, of the values that you would commonly use to specify that desired algorithms, key bit lengths, and other magic number type values, are already defined as constants or enums in the UDF file.
      To flatten the learning curve, there is an example file that shows examples of all of the major functionality.  This example file is not created to be an exhaustive set of how to implement each feature and parameter.  It is designed to give you a template or guide to help you hit the ground running in terms of using the functions.  I have tried to fully document the headers of all of the functions as well as the code within the functions themselves.    As of v1.4.0, there is also a Help file that includes all of the functions, with examples.
      Current UDF Functions
      Algorithm-Specific Symmetric Encryption/Decryption Functions _CryptoNG_3DES_CBC_DecryptData _CryptoNG_3DES_CBC_DecryptFile _CryptoNG_3DES_CBC_EncryptData _CryptoNG_3DES_CBC_EncryptFile _CryptoNG_AES_CBC_DecryptData _CryptoNG_AES_CBC_DecryptFile _CryptoNG_AES_CBC_EncryptData _CryptoNG_AES_CBC_EncryptFile _CryptoNG_AES_ECB_DecryptData _CryptoNG_AES_ECB_EncryptData
        Generic Symmetric Encryption/Decryption Functions _CryptoNG_DecryptData _CryptoNG_DecryptFile _CryptoNG_EncryptData _CryptoNG_EncryptFile
        Hashing Functions _CryptoNG_HashData _CryptoNG_HashFile _CryptoNG_PBKDF2
        Asymmetric (Public/Private Key) Encryption/Decryption Functions _CryptoNG_RSA_CreateKeyPair _CryptoNG_RSA_EncryptData _CryptoNG_RSA_DecryptData
        Misc / Helper Functions _CryptoNG_CryptBinaryToString _CryptoNG_CryptStringToBinary _CryptoNG_GenerateRandom _CryptoNG_EnumAlgorithms _CryptoNG_EnumRegisteredProviders _CryptoNG_EnumKeyStorageProviders _CryptoNG_LastErrorMessage _CryptoNG_Version  
      Related Links
      Cryptography API: Next Generation - Main Page
      Cryptography API: Next Generation - Reference
      Cryptography API: Next Generation - Primitives
      Cryptography API: Next Generation - Cryptographic Algorithm Providers
    • By RTFC
      The CodeScannerCrypterBundle (ca. 2.5 MB unzipped) contains the following UDFs and utilities:
      CodeScanner: analyse AutoIt script structure and content, identify potential issues, generate MCF data files CodeCrypter: front-end GUI for the MCF library, for script encryption (without storing the decryption key(s) in the script!) MetaCodeFile UDF (MCF library): for analysis and user-defined alterations of AutoIt script structure and content MCFinclude.au3: #include this UDF in any AutoIt script that you wish CodeCrypter to process AES.au3, by Ward; machine code UDF for AES encryption (32-bit, patched version) CryptoNG, by TheXman; encryption UDF using Bcrypt dll calls (32/64-bit; various algorithms) StoreCCprofile.au3/readCSdatadump.au3/helloworld.au3: auxiliary utilities and example script HowToCodeCrypt.pdf: a simple guide in five steps CodeCrypterFAQ.pdf: questions and answers, partly based upon exchanges in the CodeCrypter thread. Please follow the links for additional information.
    • By RTFC
      MetaCode offers a way to:
      separate a script's structure from its content remove all redundant definitions (globals and UDFs) change any content (and some structure) combine (new) structure and (new) content into a new script The most useful applications implemented so far are:
      Fast language translation (not just text strings, also variable names and UDF names) Obfuscation (vars and/or UDFs) Script Encryption (conditionals, calls, and macros) Encryption is powerful because the key is not stored anywhere; you can define it to be a user password, macro, environment spec/variable, server response, something you define yourself, or a combination thereof; anything goes, as long as it's not a fixed string or fixed value. More info in the CodeCrypter thread: ?do=embed' frameborder='0' data-embedContent>'?do=embed' frameborder='0' data-embedContent>>
      ?do=embed' frameborder='0' data-embedContent>
      But MetaCode has more potential than that; it allows you to tinker with any type of content separately, then rebuild a new version. So for example, you can have a single script structure and numerous different language modules you just plug in to create a new version in a different language.
      A brief Tutorial is here: MetaCode Tutorial.pdf
      The MCF library itself can be found in the CodeScannerCrypter bundle.
      And a little example how to use it for translating your GUI into a different language:
       UI_Translator.7z (new version that should work with the new version of Google Translate, see post #13 below)
      MCF.au3 is just the library plus the MCFinclude.au3 file you need to include in any script you wish to encrypt.
      There is no GUI here. However, I did write a separate front-end for it called CodeCrypter, which you can find here:
      ?do=embed' frameborder='0' data-embedContent>'?do=embed' frameborder='0' data-embedContent>>
      ?do=embed' frameborder='0' data-embedContent>
      MCF uses output generated by my CodeScanner version 2.8+, which you can find here:
      '?do=embed' frameborder='0' data-embedContent>>
      CodeScanner also depends on MCF.au3 now, as it can now call a few of its functions.
      I should also mention Ward's excellent AES.au3 UDFs used for the encryption and decryption calls,  which is now included in the CodeScannerCrypter bundle (thanks to Ward for allowing to include it). You can find the original (unpatched) version here:
      '?do=embed' frameborder='0' data-embedContent>>
      Note: you can replace the encryption/decryption calls with whatever algorithm you like (hint: the native <Crypt.au3> library is too slow for most purposes, better stick to machine code routines)
      So just to be clear:
      CodeScanner (v2.8+) needs MCF (earlier versions won't work!) CodeCrypter needs MCF (plus anything that MCF needs) MCF itself needs MCFinclude (part of MCF zip) MCF also needs readCSdatadump (part of the CodeScanner package, you need the latest version packaged with CodeScanner v2.8; earlier versions won't work!) both MCF and MCFinclude currently rely on AES.au3 by Ward So you basically need to download the whole bundle for any of it to work.
      If you have any questions, please start by reading the MCF Tutorial and the CodeCrypter FAQ (you can download the latter separately from the CodeCrypter thread).
      Next, read the extensive Remarks sections in MCF.au3, MCFinclude.au3, and CodeCrypter.au3
      If still no joy, then please post. However, I'm not online that often, and logged in to the forum even less, so response may take a while).
    • By Radix

      I would like to know if it is possible to implement an autoit script with GOST algorithm. I noticed that there are seven different algorithms in the standard UDF, but I urgently need a command line crypter with GOST algorithm. I just lack the algorithm part. Is it possible to adapt GPLib in the autoit script?


    • By RestrictedUser
      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? 
  • Create New...