Jump to content
RTFC

CodeCrypter - Encrypt your Script

Recommended Posts

I posted this video to make you see crypter works but If I put password in Decryptor (to make program works on other computers) even smallest code doesnt execute

 

#include "MCFinclude.au3"

#include-once
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>

#include <MsgBoxConstants.au3>




Global $b = "b"





    Global $hGUI = GUICreate("Test", 500, 500, -1, -1)


    $seCguiLoad = GUICtrlCreateButton("Load Sec GUI", 10, 10, 80, 30)



    MsgBox("","","eee")
    GUISetState(@SW_SHOW, $hGUI)

    While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch

 

Edited by Miliardsto

Share this post


Link to post
Share on other sites

@Jos: Thanks for the nudge; appreciated.:)

@Miliardsto: Okay, are you comfortable? Cause this will take a while.

First off, thanks a lot for the video.^_^ No really. Usually I hope people don't post screenshots and videos because they do not allow me to test anything myself, and I can generate my own error messages, I don't need to see other people's too. But in your exceptional case, it is crystal clear how and why your attempt to encrypt is failing (basically, you simply misunderstand the CC interface and the way the $CCkey array works). I'll try and explain. Please follow these steps:

  • open CodeCrypter (since you've already got the MCF# outputs from CodeScanner)
  • navigate to Tab Encrypt
  • move your cursor to hover over the inputbox directly below the label: "Enter Key ID" until this tooltip appears: "Index to array $CCkey[] in MCFinclude to identify which (single) key definition to use." Notice that throughout your video, the (default) value inside the box remains unchanged, defining ID 3 (three).
  • Let's open up MCFinclude.au3 to check what key definition that ID actually contains, in function _MCFCC_Init():
    Func _MCFCC_Init($type=0,$query=True)
    ; NOTE: edit/add your keytype definitions here
    ; this UDF itself will be fixed-key encrypted
    
        ReDim $CCkey[8]
        If $cmdline[0]>0 Then
            $CCkey[1]=$cmdline[1]   ; option to parse decryption key at commandline
        Else
            $CCkey[1]=""    ; an empty string triggers decryption key (password) query at startup
        EndIf
        $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[6]=DriveGetSerial("C:")
        $CCkey[7]=@IPaddress1   ; ensure your IP is fixed (no DHCP) on the machine that will run your target!
        ; ...
        ; ...
        ; add your own definitions here...

    Note that ID 3 = @username. These are the default definitions; you may have edited your version so they might look different. However, if you wish to use the built-in password query function then the following line should have remained unchanged:

    $CCkey[1]=""    ; an empty string triggers decryption key (password) query at startup

    Note the array index being 1 (one, for password query), not 3 (for macro @username)

  • If you wish to use the password query, you need to A. define the expected response by pressing the "Decryptor" button, as you do in your video, and B. define your key ID as 1, for password (not 3, for @username).

  • So in all your attempts you've been working with the @username macro (ID=3), which of course extracts this information from its environment at runtime, and won't match your password definition ("ala" or "ala33"). So the fact that it's not running for you actually shows your encrypted script is working perfectly in denying access, because it has encrypted your script with "ala" and decrypts it at runtime with your @username, which of course returns total garbage (unless of course your @username happens to be "ala"). Voila.:D
  • Obviously, CodeCrypter cannot smell that you mean a password query merely from typing in an expected response in the Decryptor UI, as this is a generic feature; a user may instead be entering some other @username than the current one, so the script will work for that user only. See the CodeCrypter Remarks section for examples.

Finally:

  • your usage of #include-once is wrong. This directive is to be placed inside an include file, not above the #include directives in the main script. And generic AutoIt include files (such as your various constants files) will likely already have that directive anyway.
  • It makes no sense to do this:
    #include "MCFinclude.au3"
    
    #include <GUIConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <MsgBoxConstants.au3>
    
    <main script>
    <your own UDFs>

    As this means that CC will encrypt/decrypt all listed (publicly available) AutoIt include files, wasting both file/memory space and processing time. Instead, do this:

    #include <GUIConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <MsgBoxConstants.au3>
    
    #include "MCFinclude.au3"
    
    <main script>
    <your own UDFs>

    Additional control over which parts below the MCFinclude line are to be encrypted is accessed through the checkbox list under button "UDFs," also under Tab "Encrypt" (as mentioned earlier).

Hope it's all clear now. Needless to say, your reproducer encrypts/decrypts perfectly with a password query in my environment, provided key ID = 1.;)

Edited by RTFC
clarification

Share this post


Link to post
Share on other sites

Thanks for clear explanation. Ok I done encryption without most UDFs and it works. So If I want to use crypted program on other few computers there would be CCkey 1 for password query. 

 

And if someone got this password can encrypt this program? If yes how easily

Share this post


Link to post
Share on other sites

You're welcome. Glad to hear you got it working.:)

2 hours ago, Miliardsto said:

And if someone got this password can encrypt this program?

I presume you mean "decrypt." Yes, obviously, if you use a password query to protect your script and an attacker gets hold of that password, obviously they can decrypt your script to reveal the plain text code. How easily? Very (I'm not going to go into details, for obvious reasons). That's why I never use password queries myself, but generate a separate machine-specific version of the encryption for each target machine, using environment-specific technical details, for example. Passwords are generally unsafe because humans are involved, and they tend to choose easy-to-guess passwords, tell other people their password, and write passwords down so as not to forget them, then discover they lost their secret note (or forgot where they put it) when they cannot remember their password anymore. My advice: take humans out of the decryption loop if you can; they are nearly always the weakest link in the chain.:shifty:

Edited by RTFC

Share this post


Link to post
Share on other sites

so the query is completely utterly useless. Hmm... So safer thing would be If I provide CCkey for something from user environment. I need crypted program works on many computers so this CCkey must be common for every pc (environment). Like procesor bits = 64 for example or directory windows on disk C path = C:\windows etc.

Is my reasoning correct? It would be safe

Edited by Miliardsto

Share this post


Link to post
Share on other sites
6 hours ago, Miliardsto said:

so the query is completely utterly useless

No, I did not say that.:mellow: If the people involved can keep their password secure, then it may be fine. But if you give the same password to a whole bunch of people, it only takes one of them being careless for your code to become exposed to the risk of decryption. Instead, if these many target machines are on a LAN or on the internet, you could consider using a key based upon (some permutation of) a server response. But beware that packet sniffers will be able to see all network traffic so that may require extra safeguards. Or maybe these users are all part of a single admin-domain you can query? Alternatively, CodeCrypter also works with commandline arguments (no GUI), so you can batch process hundreds of machines to automatically generate and distribute machine-specific encrypted versions of your script, based upon a precompiled lists of extracted hardware specs, for example. Remember that CCkey items can contain any function call (or macro), including your own functions. So anything you design that returns something unique based upon where it runs and/or who is running it will work. Best of luck.

Share this post


Link to post
Share on other sites

Good Evening RTFC :bye:

First, long time no talk to. How have you been? Missed doing Autoit myself :graduated: Thank you for the script and support in the past. I'm getting back into Autoit and would like to encrypt my latest application. :) However, I've run into a snag trying to encrypt and for that matter, BackTranslate. What should I be looking at to determine where the problem lies?  On second look - it may be #include <UIAWrappers.au3> UIA_V0_63... May need to update - crap - and everything works fine in ver 0-63 now - good times. :blink:

MCF: Unable to Proceed
Error in function_EncodeMCF(),
related to: line too long (no markers found):
6
C:\temp\GCAutomation.au3.CS_DATA\MCF0.au3
Error code: -4
Call Stack: codecrypter.au3
    calling _BackTranslate()
    calling _EncodeMCF()

2018/01/22 19:00:43: Line too long:
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]]         ; {file:6}{line:354}
$dtagIUIAutomationExpandCollapsePattern

Thanks again RTFC !

(UPDATE) Trying "UIA_V0_64" - Wish me luck...
UIA_V0_64 Notes:
edit 09 sep 2017
- Chrome examples again working on latest version and on Windows 10, Chrome has improved on iuiautomation
* lots of updates and cleanup of code
* Strict compile options
* some defect fixes

(UPDATE) Nope, roughly same error...
MCF: Unable to Proceed
Error in function_EncodeMCF(),
related to: line too long (no markers found):
8
C:\temp\GCAutomation.au3.CS_DATA\MCF0.au3
Error code: -4
Call Stack: codecrypter.au3
    calling _RebuildScript()
    calling _EncodeMCF()

2018/01/22 19:52:49: Line too long:
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]]
$dtagIUIAutomationExpandCollapsePattern

 

 

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

Share this post


Link to post
Share on other sites

Hi souldjer777, nice to hear from you again.:) That's another fine mess you've gotten me into...:D

Now pray withe me: Save us from immediate-assigned multi-dimensional arrays, for they are evil in mine eyes, and nigh illegible...

My first impulse would to move this #include above "#include MCFinclude.au3", so it doesn't get encrypted. I mean, you did not write this part yourself, did you? So if it's in the public domain anyway, why encrypt it?

If it absolutely has to be encrypted, you could try (quick fix) to replace  "],[" with "], _ "<newline>"[...". And if that fails, you could break this multi-dim assignment down into individual cell assignments, so $patternarray[0][0]= $UIA_ValuePatternId <newline> $patternarray[0][1]= $sIID_IUIAutomationValuePattern, and so on. You could probably write a small script for automating that...

Meanwhile, I'll have a look under the hood to see if I can make CodeCrypter detect this kind of edge case in a future release (no promises though).

Edited by RTFC

Share this post


Link to post
Share on other sites

I believe I already have the include above MCFinclude.au3... I will try the newline fix and see what happens :) Thanks!

#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <Date.au3>
#include <UIAWrappers.au3>
#include <WindowsConstants.au3>
#include <MCFinclude.au3>

And this is odd - it looks as though it's already new line separated...

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] _
        ]

Playing with array now :) Yeehaw, we'll see!

UPDATE: I will separate the array.

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

Share this post


Link to post
Share on other sites

Don't. Here's a patch to fix this, pending the next release.

Open MCF.au3, find Func _EncodeMCF, then find and replace

$newline=$curline

with:

$newline=StringReplace($curline,"],[","], _" & @CRLF)
Local $linebreaks=@extended

Further down in same func, replace:

; write single line or multiline
If StringLen($newline)<2048 Then

with:

; write single line or multiline
If StringLen($newline)<2048 or $linebreaks>0 Then

That should do it for now. We apologise for the inconvenience caused.;)

Share this post


Link to post
Share on other sites

FYI - If this doesn't do it LOL... nothing will.

Local $patternArray[21][3]
$patternarray[0][0]= $UIA_ValuePatternId
$patternarray[0][1]= $sIID_IUIAutomationValuePattern
$patternarray[0][2]= $dtagIUIAutomationValuePattern
$patternarray[1][0]= $UIA_InvokePatternId
$patternarray[1][1]= $sIID_IUIAutomationInvokePattern
$patternarray[1][2]= $dtagIUIAutomationInvokePattern
$patternarray[2][0]= $UIA_SelectionPatternId
$patternarray[2][1]= $sIID_IUIAutomationSelectionPattern
$patternarray[2][2]= $dtagIUIAutomationSelectionPattern
$patternarray[3][0]= $UIA_LegacyIAccessiblePatternId
$patternarray[3][1]= $sIID_IUIAutomationLegacyIAccessiblePattern
$patternarray[3][2]= $dtagIUIAutomationLegacyIAccessiblePattern
$patternarray[4][0]= $UIA_SelectionItemPatternId
$patternarray[4][1]= $sIID_IUIAutomationSelectionItemPattern
$patternarray[4][2]= $dtagIUIAutomationSelectionItemPattern
$patternarray[5][0]= $UIA_RangeValuePatternId
$patternarray[5][1]= $sIID_IUIAutomationRangeValuePattern
$patternarray[5][2]= $dtagIUIAutomationRangeValuePattern
$patternarray[6][0]= $UIA_ScrollPatternId
$patternarray[6][1]= $sIID_IUIAutomationScrollPattern
$patternarray[6][2]= $dtagIUIAutomationScrollPattern
$patternarray[7][0]= $UIA_GridPatternId
$patternarray[7][1]= $sIID_IUIAutomationGridPattern
$patternarray[7][2]= $dtagIUIAutomationGridPattern
$patternarray[8][0]= $UIA_GridItemPatternId
$patternarray[8][1]= $sIID_IUIAutomationGridItemPattern
$patternarray[8][2]= $dtagIUIAutomationGridItemPattern
$patternarray[9][0]= $UIA_MultipleViewPatternId
$patternarray[9][1]= $sIID_IUIAutomationMultipleViewPattern
$patternarray[9][2]= $dtagIUIAutomationMultipleViewPattern
$patternarray[10][0]= $UIA_WindowPatternId
$patternarray[10][1]= $sIID_IUIAutomationWindowPattern
$patternarray[10][2]= $dtagIUIAutomationWindowPattern
$patternarray[11][0]= $UIA_DockPatternId
$patternarray[11][1]= $sIID_IUIAutomationDockPattern
$patternarray[11][2]= $dtagIUIAutomationDockPattern
$patternarray[12][0]= $UIA_TablePatternId
$patternarray[12][1]= $sIID_IUIAutomationTablePattern
$patternarray[12][2]= $dtagIUIAutomationTablePattern
$patternarray[13][0]= $UIA_TextPatternId
$patternarray[13][1]= $sIID_IUIAutomationTextPattern
$patternarray[13][2]= $dtagIUIAutomationTextPattern
$patternarray[14][0]= $UIA_TogglePatternId
$patternarray[14][1]= $sIID_IUIAutomationTogglePattern
$patternarray[14][2]= $dtagIUIAutomationTogglePattern
$patternarray[15][0]= $UIA_TransformPatternId
$patternarray[15][1]= $sIID_IUIAutomationTransformPattern
$patternarray[15][2]= $dtagIUIAutomationTransformPattern
$patternarray[16][0]= $UIA_ScrollItemPatternId
$patternarray[16][1]= $sIID_IUIAutomationScrollItemPattern
$patternarray[16][2]= $dtagIUIAutomationScrollItemPattern
$patternarray[17][0]= $UIA_ItemContainerPatternId
$patternarray[17][1]= $sIID_IUIAutomationItemContainerPattern
$patternarray[17][2]= $dtagIUIAutomationItemContainerPattern
$patternarray[18][0]= $UIA_VirtualizedItemPatternId
$patternarray[18][1]= $sIID_IUIAutomationVirtualizedItemPattern
$patternarray[18][2]= $dtagIUIAutomationVirtualizedItemPattern
$patternarray[19][0]= $UIA_SynchronizedInputPatternId
$patternarray[19][1]= $sIID_IUIAutomationSynchronizedInputPattern
$patternarray[19][2]= $dtagIUIAutomationSynchronizedInputPattern
$patternarray[20][0]= $UIA_ExpandCollapsePatternId
$patternarray[20][1]= $sIID_IUIAutomationExpandCollapsePattern
$patternarray[20][2]= $dtagIUIAutomationExpandCollapsePattern

DOH! - Got your reply a little late - sry!

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

Share this post


Link to post
Share on other sites

Hi RTFC - Got "warning: $linebreaks: possibly used before declaration." "error. $linebreaks: undeclared global variable"

Should I change it from Local to Global???

Thanks again!


"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

Share this post


Link to post
Share on other sites

Sorry RTFC,

Can't get it to work. Changed what I thought might work and still getting nowhere... doh! This is even after the variable was declared as Global?!

        ; clip comment tail
        $newline=StringReplace($curline,"],[","], _" & @CRLF)
        Global $ilinebreaks01 = @extended

        ; write single line or multiline
        If StringLen($newline)<2048 or $ilinebreaks01>0 Then

>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Program Files (x86)\AutoIt3\Include\codecrypter.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
"C:\Program Files (x86)\AutoIt3\Include\MCF.au3" (2299) : ==> Variable used without being declared.:
If StringLen($newline)<2048 or $ilinebreaks01>0 Then
If StringLen($newline)<2048 or ^ ERROR

-  Don't know what to do... Please help lol!

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

Share this post


Link to post
Share on other sites

Darn, ran old version okay but got multiple errors on compiling... will get back later.

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

Share this post


Link to post
Share on other sites

I found an old version CodeScannerCrypter.bundle.v1.7 and it ran no problem :graduated:

Local $UIA_propertiesSupportedArray[123][2]=[["indexrelative",$__UIA_SpecialProperty],["index",$__UIA_SpecialProperty],["instance",$__UIA_SpecialProperty],["title",$UIA_NamePropertyId]..........,["IsEnabled",$UIA_IsEnabledPro"
ternAvailablePropertyId],["ValueValue",$UIA_Valu"

CodeScannerCrypter.bundle.v1.7
CodeCrypter    Release.........: 1.5
CodeScanner    Release........: 3.2

These versions completed fine but I was left with line errors on a very long array string.

The array was fixable - After fixing array MFC0test.au3 compiled just fine.

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

Share this post


Link to post
Share on other sites

Hi RTFC,

just wanted to stop by and say hello again :) and ask you this: 
as I didn't yet find where if you mentioned anything about some limitation as to why not - if its possible to have the lines with $sHw &= $oProperty.* get encrypted as well

Thanks

#include "MCFinclude.au3"

$hwid = _s()

Func _s()
    Local $oService = ObjGet('winmgmts:\\.\root\cimv2')
    If Not IsObj($oService) Then Return SetError(1, 0, '')
    Local $oItems = $oService.ExecQuery('SELECT * FROM Win32_ComputerSystemProduct')
    If Not IsObj($oItems) Then Return SetError(2, 0, '')
    Local $sHw = ''
    For $oProperty In $oItems
        $sHw &= $oProperty.IdentifyingNumber
        $sHw &= $oProperty.Name
        $sHw &= $oProperty.SKUNumber
        $sHw &= $oProperty.UUID
        $sHw &= $oProperty.Vendor
        $sHw &= $oProperty.Version
    Next
    $sHw = StringStripWS($sHw, $STR_STRIPALL)
    Return $sHw
EndFunc

 

Edited by Deye

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • 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 TheXman
      Encryption / Decryption / Hashing
      Purpose
      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.
      Description
      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
      _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_CreateRSAKeyPair _CryptoNG_DecryptData _CryptoNG_DecryptFile _CryptoNG_EncryptData _CryptoNG_EncryptFile _CryptoNG_EnumAlgorithms _CryptoNG_EnumRegisteredProviders _CryptoNG_GenerateRandom _CryptoNG_HashData _CryptoNG_HashFile _CryptoNG_LastErrorMessage _CryptoNG_PBKDF2 _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
      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).
      RT
×
×
  • Create New...