Jump to content

CodeCrypter - Encrypt your Script


RTFC
 Share

Recommended Posts

Thank you for alerting me to this potential issue;:) a more general fix than your patch will be included in the next release.

BTW: 1) please do not press "Quote" for anything more than a single line of text (at least not in my threads); 2) please do not quote me back in translation. Thank you.

Edited by RTFC
Link to comment
Share on other sites

  • Moderators

wyf,

I agree with RTFC's comment above. When you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - and certainly do not quote translated posts!

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

@wyf: 1. CodeCrypter does not officially support Objects, as mentioned in various places (see CodeCrypter Remarks section, for example). If it works, great; if it doesn't, too bad. I do not use objects myself, and I'm not going to start using them to fix your issue.

2. If you ever write any more posts in (what looks to me like) Chinese, I will just ignore them.:mad:

Edited by RTFC
Link to comment
Share on other sites

Temporary resolution:
Modify MCFinclude.au3 UDF _MCFCC_Init():
custom $CCkey[4] and $CCkey[5] . Deprecated _WinAPI_UniqueHardwareID() to solve the object parameter problem. Now the test is all normal, for reference only...
Thank you....

Edited by wyf
Link to comment
Share on other sites

Glad you got it working.:)

3 hours ago, wyf said:

Modify MCFinclude.au3 UDF _MCFCC_Init():
custom $CCkey[4] and $CCkey[5] .

That's exactly what you should be doing. The provided inputs are merely simple examples, to be replaced by your own, more sophisticated function calls, to cater for your own work environment(s).

Link to comment
Share on other sites

Even if  modify the $CCkey definition yourself, crypto obfuscation of larger scripts still fails... look forward to your next revision.
Edited by wyf
Link to comment
Share on other sites

On 5/16/2018 at 12:04 AM, RTFC said:

Glad you got it working.:)

That's exactly what you should be doing. The provided inputs are merely simple examples, to be replaced by your own, more sophisticated function calls, to cater for your own work environment(s).

I thought the provided inputs are the ones i need lol.

Link to comment
Share on other sites

You're welcome, Rhovanion.^_^ Feel free to stick with the provided key definitions if that floats your boat.

Link to comment
Share on other sites

  • 4 months later...

Sure, just write a little function or direct call that does this (e.g., FileRead(" %TEMP%\password-inside.txt")) and stick this into the CCkey definition (in MCFinclude.au3) for the desired keyID. However, storing a password on file is a terrible, terrible idea.

Link to comment
Share on other sites

  • 9 months later...

May I add a question here?

The whole process of encrypting works flawless. But if I compile the encrypted output file to an *.exe and copy that to another computer, it runs as well - even the environment (username, hd serial number or wahtever...) has changend on the other computer?

Do I understand something wrong? I thought I can protect the script from beeing executet on a "wrong" environment (where username, hd serial number or whatever does not match)? Or is the key only to protect the file from beeing decrypted?

When I open the the MCF0test.au3 file I can see my plain code above and below the #include <MCFinclude.au3> directive, but between about 800 lines of new code.

13-33-10-CodeCrypter.png

Edited by roman
Link to comment
Share on other sites

Questions are always welcome.:)

Your understanding of Codecrypter's purpose is totally correct; outside the sanctioned environment (as defined by you, through selection/definition of the $CCkey array contents and specified key ID(s)) the encrypted version of your script should not run. However, from your description it sounds to me that either 1. no encryption is actually performed (which would explain why MCF0test still runs on other machines), or 2. you are compiling a different/earlier non-encrypted version of MCF0test.au3 that was generated without encryption.

There's no point compiling until you're sure the encrypted version is produced correctly and performs exactly as the original script. So just take/write a one-line helloworld.au3 test script, add MCFinclude.au3 at the top, run CodeScanner, then let Codecrypter produce an encrypted version. When you open this in Scite, you should see the MsgBox line (at the bottom of the new script) having been replaced by an Execute(_MCFCC(...)) call. If the original MsgBox line is still present, then I have no idea what could be wrong, provided that in CodeCrypter you did tick:

  • "Create MCFO" in Main->File I/O
  • "Encrypt" in Main->CodeCrypter
  • "Phrases" in Encrypt->Content
  • "Strings" in Encrypt->Content

before pressing "Run."

Link to comment
Share on other sites

Ok, I did exactly what you wrote, but I have the same failure.
 

  1. Created a simple "Hello World" script with file name Test.au3
    #include <MCFinclude.au3>
    MsgBox(0, "", "Hello World")

     

  2. Let run codescanner.au3 over it; on the end I got a window "Code Scanner Main Menu" which I closed.
  3. Started codecrypter.au3, choosed my "Hello World" script with Source button and verified that the 4 checkboxes you mentioned are ticked.
  4. Let run codecrypter by pressing the Run button
  5. Get a new file "MCF0test.au3" the same directory as my "Hello World" script, which shows my MsgBox call in plain text in the last line:
    [...]
    B836F9EDE2C630FE16EF0E51B9C805376FF193B9BEF5E3CA26DB92D3944D3C142E723DFD3095BA3498B92C19C285B313D98B7117BB1CF44AB15719BF5907A54000723B3F3126F636BEA1887169F35B649C88DB0004621D2"))
        $CCkeytype=$type
    EndFunc
    
    MsgBox( 0 ,"","Hello World")

 

 

What the hell do I wrong?  😟

How gets codescanners "output" to codycrypters "input"? Do I have to set something after ending codescanner and before starting codecrypter? I could make a short screen capture video about what I exactly do and provide the link to you? Would this help?

 

PS. I have it tested on another PC, only to be sure it's not a permission issue. But without success.

Edited by roman
Link to comment
Share on other sites

6 hours ago, roman said:

Let run codescanner.au3 over it

Did you enable CodeScanner's option writeMetaCode in its settings? Is a subdirectory test.au3.CS_DATA produced by codescanner? What does the MCFencoding.log therein contain after running codecrypter? Does the file stringEncrypt.txt contain encryption calls after running codecrypter? Does the file MCF0.txt (not .au3, but .txt extension!) contain metacode such as this (near the end):

{funcA307}( 0 ,{string1},{string2})     ; {file:1}{line:4}
6 hours ago, roman said:

I could make a short screen capture video

That usually doesn't help me. AFAICT, you're doing everything right.

6 hours ago, roman said:

How gets codescanners "output" to codycrypters "input"?

Codecrypter uses the source filename you provide to identify the ...CS_DATA subdirectory from which it reads the files it needs. I don't think the problem lies there.

6 hours ago, roman said:

What the hell do I wrong? 

I have no idea; nothing that I can see at this end.

6 hours ago, roman said:

Do I have to set something after ending codescanner and before starting codecrypter?

Nope. As long as Codescanner writes out the MCF files beforehand, codecrypter only needs the source filename.

Link to comment
Share on other sites

17 hours ago, RTFC said:

Did you enable CodeScanner's option writeMetaCode in its settings?

Yes. It is/was already enabled per default:

[...]
Global $ExtractMacros=True            ; create a list of all @macros used
Global $WriteMetaCode=True            ; translate script into symbolic metacode for post-processing
Global $showprogress=True            ; True = show progressbars
[...]

 

17 hours ago, RTFC said:

Is a subdirectory test.au3.CS_DATA produced by codescanner?

Absolutely YES.

 

17 hours ago, RTFC said:

What does the MCFencoding.log therein contain after running codecrypter?

This is the whole content of MCFencoding.log:

2019/07/09 08:39:18: MCF Encoding Logging initiated.

Encoding Settings:
MCF_REPLACE_AUFUNCS = True
MCF_REPLACE_UDFS = True
MCF_REPLACE_VARS = True
MCF_REPLACE_STRINGS = True
MCF_REPLACE_MACROS = True
MCF_REPLACE_OBJECTS = True
MCF_REPLACE_PHRASES = True
MCF_ENCRYPT_SUBSET = False
MCF_WRITE_COMMENTS = False

2019/07/09 08:39:18: 
No problems found.

2019/07/09 08:39:18: MCF Encoding completed.


 

17 hours ago, RTFC said:

Does the file stringEncrypt.txt contain encryption calls after running codecrypter?

It seams so, yes. This file has 7164 lines, here an extract of the first and last 10 lines:

_MCFCC("0xFBA4F8056294DED0FA6D66304CAEE52B38A3B5EBC590C24432927D986996CE6A",3)
_MCFCC("0xC640F880BBCCAB5DECC9BD91F472D88FA1EDDFAF5ED3DC2AED560C0AD0E71633",3)
_MCFCC("0xE48E26D45FC94FCEA643A23E1A55E0B8A05133E2405F6F890CEE7CFBA33E450C",3)
_MCFCC("0x7BEB9A4D99D07F327A017197A7BC865B92C75DEED2EC5C2BC5672A4AEA5FEE7A",3)
"0x3CA86772DB0B25CBD8AC911792C2217A9DD04C218DAE0F4261BD76EF512838FBDE2BDA417829E56D62EDE396B376E2CC"
_MCFCC("0x606952466976C86495F7F0E2CD3BC9CD0EBE89BF75D22AF9824F87D27EDAD70C")
_MCFCC("0xC7E16C8C2EF6C6006F4AAE0FFE4D7A61700BEAA70D9D5C5522E11AC84E27B7C3")
_MCFCC("0x7BC8180C95F46ED51DF7BE9BFFE9670178E98BB1077A30C0BD701F634CD9A542")
_MCFCC("0xD7C848AF17ADD636D34E5657091A9F10D13F0FD21CAE2BFB0216EA11AEAF87C9")
_MCFCC("0x45BFB2586EF67237B327317AF620A3BD818A4ACE4F0EE1AA793047150A0B14B5")
[...]
[...]
[...]
_MCFCC("0x4A05DC62544429DE676645239F5373F877D6C4CF382FE75BAC89CA0FBBB07B94",3)
_MCFCC("0xC25F775F3CAA147C648CEC4C7764C66933D30D3B181A06B13EDED3BD2FFA03CC",3)
_MCFCC("0x0B210913B8F83D48B1AB1C134FCDE1EAAB9450FA2A3D463C5EA4DCE02171E70B",3)
_MCFCC("0xD69884DE6066A1AD8B5A3524EE00B93E4DEBFE1C518717EC79C1048323C3169F",3)
_MCFCC("0xBAC5CEFB4ECC5D4424C59E0EFC2C994A1D70895673DDC6B34C82DF27A12554FB",3)
_MCFCC("0x2CA7447CF1708E3A46A764C723EE006E65A92657B7E5C3234B4F3A0848DA63AC",3)
_MCFCC("0x22A30DDD1D5A92F50CE741FE6CDC2FF49091BC422E2B9FEA001EB64F5034D703",3)
_MCFCC("0xAD549B978F0639B5EAF2ED1B382F7EA7F774FC71FE8DC1E0F1CDC0A5FF5A04EF",3)
_MCFCC("0x55A1F5390529710F269E2C532FAABBCA0166286071B72FC7DDC72BFAACE190FA",3)
_MCFCC("0x99C83E23478C44F955ACD1C8B7CAA11FB1893A430AFE66B97625B2004B536914",3)
_MCFCC("0xA8D1F75E4ADEA48DAA72E9C8C185834F7936C6E15EB842D60C6A64503FBD0734",3)

I attached the whole file.

 

17 hours ago, RTFC said:

Does the file MCF0.txt (not .au3, but .txt extension!) contain metacode such as this (near the end):

{funcA307}( 0 ,{string1},{string2})     ; {file:1}{line:4}

 

Yes, it seams so. Here the last 10 lines of this file:

[...]
If {var9}={string9} Then {var9}=1       ; {file:2}{line:200}
If {var9}<= 0 Or {var9}>{funcA457}({var6})- 1 Then        ; {file:2}{line:201}
{var14}=1       ; {file:2}{line:202}
{var6}[{var14}]={funcA394}({var9})       ; {file:2}{line:203}
Return       ; {file:2}{line:204}
EndIf       ; {file:2}{line:205}
If {var6}[{var9}]={string10} And {var10}= True Then {var6}[{var9}]={funcA279}({string11},{string12},{string13},{string14}, 250 , 140 )       ; {file:2}{line:207}
{var14}={var9}       ; {file:2}{line:208}
EndFunc       ; {file:2}{line:210}

{funcA307}( 0 ,{string1},{string2})       ; {file:1}{line:2}

 

I've attached the final script file as well.
Thank you very much for your support. I'm courious what will come out finally...!  🤔

stringsEncryp.txt

MCF0test.au3

Edited by roman
Link to comment
Share on other sites

Thanks for the feedback. More questions then.

In Codecrypter's Structure Tab, did you tick "Enable Phrasing"?

In your helloworld CS_DATA subdir, does the last line of phrases.txt look something like this:

{funcA307}( 0 ,{string1},{string2})

And does the tail end of your phrasesNew.txt contain MCFCC decryption calls?

Link to comment
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
 Share

×
×
  • Create New...