Jump to content

Recommended Posts

Impressive to say the least, RTFC :D but one question, please.

I can see that Codecrypter will make my script virtually unbreakable but I cannot see (yet) how to be able to install remotely, i.e., in the past I would write C code and compile it so, (yes it can be decompiled but not easily), then installed on the end machine. Installation would produce a unique machine key from which I would provide an unlock PIN so the program would run correctly.

Your link :thumbsup: to _WinAPI_UniqueHardwareID() would allow me to do this but can I combine with Codecrypter and my script 'compiled' in my office?

The most powerful number in the Universe.  Zero.

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


Serendipitous question.:D The next Codecrypter version (to be released within a few weeks from now) will come with a new utility that you can run from a USB stick to obtain the full CCkey array as returned by a target machine, saved in an encrypted profile on the stick. Once transferred to your CodeCrypter environment, the Decryptor submenu then allows you to press a new button that will upload that profile for the encryption. This will allow multiple keys (key cycling) to be used on remote machines. Still testing this at the moment.

In the meantime, the existing "Decryptor" option under the Encrypt Tab should already be able to serve your needs if you're using a single hardware ID (which itself can be a composite of multiple hardware specs, as you know). Just open MCFinclude and replace one of the key definitions in CCkey by a call to _WinAPI_UniqueHardwareID, e.g.:

$CCkey[2]=@ComputerName ; some simple examples...
    $CCkey[3]=@UserName     ; case-sensitive!
    $CCkey[4]=_WinAPI_UniqueHardwareID($UHID_MB)    ; motherboard specs
    $CCkey[5]=_WinAPI_UniqueHardwareID($UHID_CPU)   ; CPU specs
    $CCkey[7]=@IPaddress1   ; ensure your IP is fixed (no DHCP) on the machine that will run your target!

Of course, at the top of MCFinclude you'll also need to add:

#include <APIDiagConstants.au3>
#include <WinAPIDiag.au3>

Then (in the absence of my USB stick utility to be released later) you'll just have to obtain whatever those hardwaredID calls return on your target machine(s), and paste that in manually after pressing the Decryptor button and defining key 4 or 5 as your (single) decryptor. Of course, nothing prevents you from calling your own function instead that produces some compound string involving numerous IDs or other specs. Just be aware that you'll be unable to test the encrypted script on your own machine, so you'd do well to run a BackTranslated version first to ensure the MCF encoding works as expected.;)

Edited by RTFC
Link to post
Share on other sites

@fopetesl I'm going to be offline for a bit. Given your timeframe, this might help, but using it is entirely at your own risk.o:) First update MCFinclude.au3, then compile profiler. Running at target machine stores file profile.mcf on stick; transfer this to you CodeCrypter directory on your own machine. Prior to encryption, press Decryptor button, then press "Profile" button. No guarantees, no warranties, as usual. Hope it helps.:)


EDIT: see first post in this thread for the updated bundle (v2.2).


Edited by RTFC
Link to post
Share on other sites

Bundle version 2.2 released, with @Deye's highly useful UDF filtering mod incorporated (many thanks once again for that, Deye! :)), plus the (still somewhat experimental) storeCCprofile utility, with which one can extract all key definition responses on a target machine (encrypted) on a USB stick, to be uploaded on your own machine for CodeCrypter to generate an encrypted script that'll run only on that target machine (provided you're using hardware-specific keys, of course). Still with me?:wacko:

Not only does this facilitate the process for single keys (which you no longer have to type in twice in the dialog under the Decryptor Button), but also enables multi-key cycling for machines other than the one Codecrypter is running on, as the entire CCkey array from the target machine is now available after pressing the new "Profile" button, which uploads the (decrypted) contents of the profile.mcf file on your USB stick. Note that if you change the key definitions in MCFinclude.au3, you'll need to re-compile storeCCkey.au3 (which #includes MCFinclude.au3) as well.

Edited by RTFC
Link to post
Share on other sites
  • 2 months later...
51 minutes ago, Miliardsto said:

better to use stripper or obfuscator or crypt?

If you have to choose, CodeCrypter's encryption provides much stronger protection than obfuscation, because only encryption prevents running or analysing an encrypted script outside of its targeted environment.

Link to post
Share on other sites
  • Developers
59 minutes ago, Miliardsto said:

If I use crypt evrything is ok but crypt + obfuscate = errors

better to use stripper or obfuscator or crypt? xd

For the record: Obfuscator & Au3Stripper do  not give you ANY protection and merely makes the script much harder to read as stated in the Helpfile!
As to the Errors: Guess my last answer didn't solve your issues.


Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
Live for the present,
Dream of the future,
Learn from the past.

Link to post
Share on other sites

I see with my code options "translate" and "obfuscate" used with crypt provide so much errors. I read it may be normal thats getting lost when code is too confusing or it does not support some functions etc, im right? I dont want to change so much things so skip this and use encrypt only.

So we have here so much options in crypter, even the description does not sound familiar to me.

Encrypt content 3 things, more secure if 3 checked?

There are options single key, multiple keys, subset def. What values would give more security? or keep it default.

Change structure - enable indirection, enable phrasing; which check better?



As to errors: security matter is so immense and additionally little known by me. Stay hungry stay foolish

Link to post
Share on other sites

CodeCrypter is a front-end for my MCF library. It can perform a variety of functions, which is why it supports many different options. But a number of "presets" is provided that enable-1-click settings for ease of use.

More specifically regarding your questions:

If you wish to protect your script, translation is irrelevant, as this is for translating your GUI strings, user messages, and labels into different languages. So do not tick any checkboxes under "Translate."

Obfuscation is similar to translation, in that it replaces variable- and/or function names with long hexadecimal strings that are difficult to read for humans. As Jos already pointed out, obfuscation does not protect your script, it just makes understanding what goes on a bit harder for people trying to analyse the code. So you can leave those checkboxes unticked as well.

Under the Tab "Encrypt" I would suggest you tick "Phrases" and "Strings" only; you can also leave "Strings" unticked, then your code will execute faster (fewer decryption calls), but all text strings will then be legible (unchanged) in the encrypted version of your script.

Forget about subsets (encrypting only parts of your script) and indirection (more slowdown, but makes it harder for hackers to analyse) for now. Do not Shuffle multiple keys either, start by using a single key.

Under Tab "Structure" activate only "Enable Phrasing."


IMPORTANT: before you start CodeCrypter, you first have to:

  • study the $CCkey definitions in function _MCFCC_Init() in MCFinclude.au3 (ca. line 200) to decide which key your script will be using for en/decryption. The $CCkey array index = numeric key ID in CodeCrypter (under Tab "Encrypt"). For example, by default, key 2 = whatever macro @computername returns, key 3 = whatever macro @username returns, key 4 = whatever your motherboard hardware returns as ID, etcetera. You can replace these with your own definitions as you see fit.
  • #include MCFinclude.au3 in your script (below your other includes, but above your own code)
  • run CodeScanner to produce the MCF files for your script (so CodeCrypter knows what is what)

The underlying idea is that anyone can copy your encrypted script, but it will use whatever the environment returns locally as decryption key, producing garbage unless it matches whatever the script was encrypted with.

Link to post
Share on other sites
  • 2 weeks later...
Func _MCFCC(Const $hexstring,$Index=0)
    Return BinaryToString(_AesDecrypt($CCkey[$Index],$hexstring))

(5110) : ==> Variable used without being declared.:
Return BinaryToString(_AesDecrypt($CCkey[$Index],$hexstring))
Return BinaryToString(_AesDecrypt(^ ERROR

All includes good, script at least run, but this error appears when I run function in my program

Why it returns this error?


Using Other method this same


Edited by Miliardsto
Link to post
Share on other sites

Without a (minimum-sized!) reproducer script, there's no way anyone except you could possibly figure out what is wrong in your set-up.

Link to post
Share on other sites

Ok how it looks I put MCFinclude on the end of script to crypt only one func

all settings in MCF are default

#include "MCFinclude.au3"

Func caster($1, $2, $3, $4)
EndFunc   ;==>caster


how looks end of MCF0test.a3

Func _MCFCC(Const $hexstring,$Index=0)
    Return BinaryToString(_AesDecrypt($CCkey[$Index],$hexstring))

Func _dummyCalls()
    Local $a=0,$b=1
    Local $c[1]

Func _MCFCC_Init($Type=0,$query=True)
    ReDim $CCkey[8]
    If Execute(_MCFCC("0x75F41993928F753C434519681FDB64F1168A465CCAAB33E0B58EC3981ABDDBFA2225C54E3EE23DF2672B4BE7EB705FBD")) Then
    $CCkey[ 4 ]=Execute(_MCFCC("0x48850CA6C26902FE4E90FCC98E4A922659F9D09448028B1535280FE33250D2923269BC5268161F85D4A7FDE5D309317984D08F270012DDA6A3720B85E38A9A4D"))
    $CCkey[ 5 ]=Execute(_MCFCC("0x02C6570003E0D84831C8E9A4401AF24096D32CE9E05FB37DE201424F9A681F3CA6E479D84F53D22253A7D7EC6FACF85A2A43AD47D19C636CC2A328C73DC8AFE4"))
    $CCkey[ 6 ]=Execute(_MCFCC("0x02D417ED586A7A1CA7C31A85086D97F6F98D65323AA4D5991515DC00F90783A569E63C1A6D530C1E73B92E2132677C3B"))
    If Execute(_MCFCC("0x3D3368FAA710867DCFAFBCD8561CE2882861D368B5DF6AA100D637F51A75C9C2")) Then $Type=1
    If Execute(_MCFCC("0xF2C4AF44E1CAAEDD567C90EB30B44DF9429FDC0D76EB209E1FF0AC1B6186E70942D61416B12F37C8029901D3FD37D126EC03B2AC6F663EF5B90B98850AFD1156")) Then
    If Execute(_MCFCC("0x184FEFA3C8327BC7D0FC39A44E7203D337DE735B6B9BCE010516A9921B13912D242DB49F48A069D66AA73670909AA4007A46310AEF113BBD2C3362911EE38BB1")) Then $CCkey[$Type]=Execute(_MCFCC("0x8349506C262827D9A8C15198DF67C2CD9DF59C2CD0AE26106338F7AFD9607E7A28BAC5E08C0F24028FCDF3AF97861FF469F8C8A2576AB626B28719161B74CB7FF546B519DB2B1CFA7B863898597BB27F3798CB28E7F5081A21A9625CCB71689EAFAFC53ABAF5415307BAAF94630EEA97"))

Func caster($1,$2,$3,$4)




so only msg box is encrypted and it returns

 Variable used without being declared.:
Return BinaryToString(_AesDecrypt($CCkey[$Index],$hexstring)

If I change Execute(_MCFCC("0xA91E7F996E0D20BC0BF281DD95E968710E98EC46748EC7DA1EB6B59C361A3989A152C6485BBBA790F1881BF219F06F1C",3))

to msgbox("","","bleble") then it works


any thoughts?


Link to post
Share on other sites

Obviously you need to include the $CCkey definition (in MCFinclude.au3) before you call your encrypted function, not just before the function definition itself (assuming the call precedes the definition). How do you expect your script to be aware of globals if their definition is not encountered before it starts using them?;) Add if you wish to encrypt only particular parts of your scripts, please study the FAQ (see button "UDFs" under Tab Encrypt).

Edited by RTFC
Link to post
Share on other sites

ojoj xd. it brought me closer to the desired effect. Thanks again.

  • Is there other option to exclude functions to crypt than option Subset only - UDF. There are no listed functions I want to disable
  • Almost done but functions have original names and code not look messy, obfuscator give some many errors
  • Maybe make obfuscation before crypt with autoit stripper?
Link to post
Share on other sites
5 hours ago, Miliardsto said:

Is there other option to exclude functions to crypt than option Subset only - UDF.

Yes; if you tick the checkbox SubSet Only, then you can enter a value in the input box next to it. If this value is between 0 and 1, CodeCrypter will encrypt that random proportion of lines within the script. If the value is an integer N > 1, CodeCrypter will encrypt every Nth line only. Use this for scripts that cannot be slowed down much.

5 hours ago, Miliardsto said:

obfuscator give some many errors

I've never had any errors with obfuscating function names (when called directly), like, ever. It shouldn't affect functionality at all. Please produce a tiny reproducer script if you wish me to have a look at it, and possibly fix it.

5 hours ago, Miliardsto said:

obfuscation before crypt with autoit stripper

That would be a possible alternative. Why don't you just try it?:)

Link to post
Share on other sites

Minor Bug Fix, pending the next CodeCrypter release:

In MCF.au3, function _EncryptArrays(), please replace line 1604 (or thereabouts, depending on your version):

If $index>0 And $index<UBound($selectedUDFstatus) Then

with this one (containing ">=" instead of ">"):

If $index>=0 And $index<UBound($selectedUDFstatus) Then

This prevented the "Main Script" section from remaining unencrypted despite being user-deselected in the list of encryptable UDFs (under CodeCrypter Tab "Encrypt") . This fix will be included in the next update, but that might take a while yet, as I'm about to start my annual hibernation.:yawn: It's the winter solstice today (in about two hours and 16 minutes), you know...

Edited by RTFC
Link to post
Share on other sites

grrrrrrrrrr. If i understand correctly If i want to run crypted script in other computer I have to type password in decryptor single key?

If I set password in decryptor after crypt it gives me errors Grahh - Subscript used on non-accessible variable, if I not enter password in decryptor it works great

I got so much problems cause I got this metro udf, there are functions cannot be even obfuscated(striped). Encryption makes like 100 errors

#include "MetroGUI_UDF.au3"
#include "GUIDisable.au3" ; For dim effects when msgbox is displayed
#include "noStripFuncs.au3"

#include "MCFinclude.au3"

; for web protocol
#include "BinaryCall.au3"
#include "JSON.au3"
#include "http.au3"


before no problems with these vars


    Global $Control_Buttons[16]
    Global $Button_Close_Array[16]
    Global $Button_Minimize_Array[16]
    Global $Button_Maximize_Array[16]
    Global $Button_Restore_Array[16]
    Global $Button_Menu_Array[16]
    Global $Button_FullScreen_Array[16]
    Global $Button_FSRestore_Array[16]

I made them globals also nothing changed

probably becouse these metro udf is above #include "MCFinclude.au3" thats why errors appears? but like I said If i dont use decryptor password it works.




I put all vars calls to them above mcfinclude and what happen, program starts first gui works and second gui not appear. No error displayed


tried other small script encrypted with password in decryptor and nothing happens too


see other ppl got similar problem. I used normal <crypt> and program not appears too. I tested on win 10 64bit and 8.1

Edited by Miliardsto
Link to post
Share on other sites

No minimum-sized reproducer script = no fix on my part.:evil:

You can try to uncheck all checkboxes under CodeCrypter's Tab "Single-Build," that way all redundant parts of the script are kept in. Other than that, I would suggest you follow the troublshooting guidelines in the FAQ, and work the problem systematically. Place an unencrypted and an encrypted version of the script side by side (in two copies of SCite for example) and start gradually replacing unencrypted parts by encrypted ones, adm rerun until it start breaking, then repeat at finer scale until you've identified the issue. Or you start with a hello world script, and add your Metro UDF, and see if the problem lies there. You should also do a Backtranslation pass to check that CodeCrypter is able to reconstruct the script from its MCF constituent parts. If you then come back to me with a specific issue (e.g., command X with these parameters fails after encryption, as shown in this 50-line reproducer), then I can have a look. If the password query doesn't work, then use a different encrpytion key, or write your own password query function that is called to fill a $CCkey item. And maybe it turns out that the Metro UDF is incompatible with CodeCrypter, or it may be something  trivial. Either way, I'm not going to keep guessing; winter is coming...

Edited by RTFC
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...