Jump to content
Sign in to follow this  
RTFC

MCF - MetaCode File UDF

Recommended Posts

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:

  1. Fast language translation (not just text strings, also variable names and UDF names)
  2. Obfuscation (vars and/or UDFs)
  3. 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

Edited by RTFC

Share this post


Link to post
Share on other sites

Beta version 0.9 released, added support for CodeCrypter's new UDF filtering feature. This allows the user to apply encryption per individual UDF. For more info, see the updated FAQ (MCFQA.pdf) in the Codecrypter thread.

Share this post


Link to post
Share on other sites

Version 1.1 released (3.3.12 compliant)

One tiny bug squashed. :pirate:

No other cruelties committed.

Edited by RTFC

Share this post


Link to post
Share on other sites

Is it there an overall frontend?

p.s.
(tried MCF.au3, got 32 errors)

"

:unsure:

...AutoItMCFMCF.au3"(360,54) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($FuncEqualsString, $curstring, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(364,55) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($functionsCalled, $curstring, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(387,54) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($functionsCalled, $curfunc, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(388,55) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($FuncEqualsString, $curfunc, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(472,49) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($variablesUsed, $curvar, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(490,100) : error: _ArrayAdd() called with wrong number of args.
If _ArraySearch($macrosUsed, $curmacro, 1) < 1 Then _ArrayAdd($macrosUsed, $curmacro, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(518,56) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($functionsUsed, $previousword, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(525,78) : error: _ArrayAdd() called with wrong number of args.
If $index < 1 Then _ArrayAdd($functionsCalled, $previousword, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(618,46) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($varonce, $curvar, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(620,93) : error: _ArrayAdd() called with wrong number of args.
If _ArraySearch($vartwice, $index, 1) < 1 Then _ArrayAdd($vartwice, $index, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(633,108) : error: _ArrayAdd() called with wrong number of args.
If _ArraySearch($funcalled, $curfuncindex, 1) < 1 Then _ArrayAdd($funcalled, $curfuncindex, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(661,82) : error: _ArrayAdd() called with wrong number of args.
If $index > 0 Then _ArrayAdd($funcorphans, "{funcU" & $index & "}", 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(776,60) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($already_included, $original_filename, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(892,52) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($globalsOrphaned, $MCtag, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(894,92) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($globalsOrphaned, StringStripWS(StringLeft($MCtag, $pos - 1), 2), 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(1283,48) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($strings1, $curstring, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(1285,48) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($strings2, $curstring, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(1332,46) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($phrases, $curphrase, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(1333,47) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($phrasesUDF, $curfunc, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(1344,46) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($phrases, $curphrase, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(1345,47) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($phrasesUDF, $curfunc, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(1372,46) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($phrases, $curphrase, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(1373,47) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($phrasesUDF, $curfunc, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(1388,45) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($phrases, $curphrase, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(1389,46) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($phrasesUDF, $curfunc, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(1787,44) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($namesUsed, $newname, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(2250,39) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($markers, 1, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(2251,43) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($locations, $cc, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(2254,39) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($markers, 2, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(2255,43) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($locations, $cc, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"...AutoItMCFMCF.au3"(2429,44) : error: _ArrayAdd() called with wrong number of args.
_ArrayAdd($Callstack, $procname, 0, Chr(0))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Program Files (x86)\AutoIt3\Include\Array.au3"(53,40) : REF: definition of _ArrayAdd().
Func _ArrayAdd(ByRef $avArray, $vValue)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
...AutoItMCFMCF.au3 - 31 error(s), 0 warning(s)


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

Hi Chimp,

The only available front-end at the moment is CodeCrypter, with which you can:

  • translate
  • obfuscate
  • encrypt
  • replace any specific content with any other content you define

I've been toying with the idea of a more general code editing front-end, for example to automate the implementation of script-breaking changes (see below :)), but at the moment I'm too busy with other projects. :unsure:

Regarding the errors you get, it looks like you are mixing AutoIt versions, that is, the current version of MCF (1.1) implements the script-breaking changes Melba23 implemented in <Array.au3> for AutoIt 3.3.12.1. However, you seem to be running the new version of MCF in an older version of AutoIt (please check the MCF header against your AutoIt version). So my advice is to download the current version of AutoIt and try again. ;)

There are several hundred changes implemented in all parts of this environment (older versions of CodeScanner and CodeCrypter won't work anymore either under 3.3.12.1, and the new versions won't work when running older versions of AutoIt. So please check the headers of these scripts, where the AutoIt version under which they should run/compile is always listed.

Upgrading environment is always a nuisance, but it can  be even more work to update all scripts to function in the new environment, I can assure you. :(

 

Edit: To accommodate users unwilling or unable to upgrade to AutoIt version 3.3.12 or higher, I'll make the last 3.3.8.1-compliant bundle available from here. However, none of these outdated versions will be maintained or upgraded, and I won't be fixing any bugs in them anymore. This is a temporary fix; when I run out of storage space it may disappear without advance notice, so get it while you can (but only if you really, really don't wish to upgrade your AutoIt version).

CodeScannerCrypter.bundle.old.zip

Edited by RTFC

Share this post


Link to post
Share on other sites

There is no v3.3.12.1. I have look through the code and though you have put a ton of effort into, I am still having trouble to understand how to "simply" use this. I would prefer to test something in which I can select the script and voila it spits out whatever it is it's meant to spit out.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites

Hi guinness,

Thanks for the clarification.

Funny thing, serendipity. :o  A few days ago somebody else just PM'ed me with a similar request, to produce a cmdline utility of CodeCrypter (the main front-end for this library) to just spit out an obfuscated and/or encrypted version of any input script. When I have a spare moment, I'll probably be able to rustle something up...

As far as engaging directly with the MCF library (and presuming you studied the Tutorial), CodeCrypter's source is admittedly a complicated example (although it does more or less exactly what you request, see the presets Tab). The problem is that the process is intrinsically multi-step; you have to run CodeScanner first to produce the MCF relevant arrays, which you can then engage with, through CodeCrypter, your own script, or both.

The basic idea is however, really simple:

  1. split the contents of your script up in topical arrays, turning the original script into a collection of placeholder array pointers
  2. duplicate the arrays you wish to change the content of, and make whatever changes you like there
  3. rebuild the script using the metacode pointers, but referring to the new arrays

Codescanner does step 1 for you, whereas CodeCrypter provides examples of steps 2 and 3. Alternatively you can write your own script to change the *New content arrays, and then simply use CodeCrypter's "Create New" option to rebuild.

It's potentially very powerful, because you can also make structural changes in the metacode file itself prior to step 3. In encryption, for example, I replace every function call, macro and conditional with an Execute(<decrypt><string>) wrapper. It's like the ultimate search-and-replace engine for both content and structure, but separately.

But you're right, :( it probably looks forbidding, but it is surprisingly difficult to produce a simple in/out example. I'll have to think about how I might be able to make this library more accessible. :huh2: Beng the designer is a handicap in this case, because I have to place myself in the shoes of somebody who sees the MCF UDFs for the first time, and it's hard to wipe once's subconscious mindset.

Anyway,  your input is much appreciated. ;)

Edited by RTFC

Share this post


Link to post
Share on other sites

Version 1.2 uploaded, plus a small example: UI_translator.

This is basically two MCF calls: CreateSingleBuild, and _RebuildScript. Inbetween it performs the desired script change; in this case, it identifies most GUI-related  AU3 calls and translates all strings parsed directly to these functions, using Google Translate (thanks to akurakkauaaa, see '?do=embed' frameborder='0' data-embedContent>>, post #16). I've added a little helloworld.au3 example for illustration. You may have to patch Google's result manually in your own (translated scripts), because it still makes many mistakes.

It's just a demo to show how to interact with the MCF library, it's not meant to be a robust universal translator.

Hope it helps.

RT

Edited by RTFC

Share this post


Link to post
Share on other sites

Version 1.3 uploaded. Not:e: this concerns only MCF itself; the complete bundle is not yet updated, as I'm still tinkering with the next CodeScanner update.

RegExp pattern strings are now excluded from string processing in certain procedures to avoid various issues.

Edited by RTFC

Share this post


Link to post
Share on other sites

HI RTFC,

I tried out the UI_Translator but  always receive returns of = 0
I run codescanner on helloworld.au3 
in settings I select "write meta code" and rescan
internet connection = on
then I run UI_Translator.au3 selecting helloworld.au3
I get returns of = 0

have I missed something in how its done ?
thanks

 

Share this post


Link to post
Share on other sites

Hi Deye,

Thanks a lot for spotting this. There's nothing wrong with your approach, but my UI_Translator.au3 farms out the actual call to googleTranslate to akurakkauaaa's googletranslate.au3 (see post #16 in that thread), and apparently GoogleTranslate has changed its interface so the UDF in that script no longer works properly. When I have a spare moment I'll see if I can figure out what's wrong, or perhaps dig up an alternative somewhere (suggestions, anyone?) In the meantime, should you have access to some other translation UDF yourself, it may be doable to just replace the two calls to _googleTranslate() ca. line 375 in UI_Translator with your own.

Sorry for the inconvenience; I'll report back either way (but it may take me a few days...)

 

Edited by RTFC

Share this post


Link to post
Share on other sites

Okay, as far as I can tell none of the various Example scripts for querying Google Translate posted on the forum works anymore, because they've moved to a business subscription service model where you have to pay $20 per 1M words, which sucks. In my opinion (and in the spirit of the free, fully accessible internet for all), this kind of service should be free. So while we wait for such a free alternative service to emerge, here's an example of how one could still access Google's new service:

#include <Array.au3>
#include <IE.au3>

Local $tag="* # * # *"
Local $oIE=_IECreate("https://translate.google.com/#auto/es")
Local $oForm=_IEFormGetCollection($oIE,0)
Local $oQuery=_IEGetObjByName($oForm,"text")

_IEFormElementSetValue($oQuery, $tag & @CR & "Hello World" & @CR & "This is a test" & @CR & $tag)
_IEFormSubmit($oForm)
_IELoadWait($oIE)

Local $oText=_IEGetObjById($oIE,"gt-res-data")
$lines=StringSplit(_IEPropertyGet($oText,"innerText"),@CRLF,1)
_IEQuit($oIE)

_ArrayDelete($lines,_ArraySearch($lines,$tag,1,0,0,1,0) & "-" & $lines[0])
_ArrayDelete($lines,"1-" & _ArraySearch($lines,$tag,1,0,0,1,1))
$lines[0]=UBound($lines)-1
_ArrayDisplay($lines)

Doubtless this will change again at some point and no longer work. I'm consciously not providing a fully-fledged UDF, just a simple example to illustrate how this could be done, if one were so inclined. And moderators, please let me know if this contravenes forum rules, then I'll remove it again (I'm not sure...).

@Deye, I still have to implement this in my UI_Translator when I have some more time, maybe this weekend.

 

Edited by RTFC
minor bug fix

Share this post


Link to post
Share on other sites

@Deye (and all others wishing to translate their GUI text strings into 90 different languages), I've uploaded the new version of UI_Translator in the first post of this thread, based upon the example code in my previous post (immediately above).

No guarantees how long this will work, ask Google.:lol:

Share this post


Link to post
Share on other sites

Hello,

 

I have big problem when i try encrypt  """data""". After encyrpt the code is ""data"" instate of "data".

 

Have some one the same problem

Share this post


Link to post
Share on other sites

@sprzetok: I can encrypt the following test script with triple double-quotes without a problem:

#include <GUIConstantsEx.au3>
#include <MCFinclude.au3>

MsgBox (0, "Test","""Hello, World!""")

Example()

Func Example()  ; adapted from Help file, first example for GuiCreate
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("This is an Example")
    Local $idOK = GUICtrlCreateButton("Press to Quit", 140, 200, 120, 30)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $idOK
                ExitLoop

        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)
EndFunc   ;==>Example

Moreover, a backtranslation shows that the triple quotes have been retained.

Please post a reproducer script (one that re-creates the error) adapted from the above template, if possible. And technically, you should have reported this in the CodeCrypter thread (see my signature), not here.:(

Hint: you can always edit the appropriate stringsNew.txt list with your own manually edited version to force a particular string to be output the way you want it. Please consult the documentation.

PS: Welcome to the AutoIt Forums!:)

Edited by RTFC

Share this post


Link to post
Share on other sites
Spoiler
Spoiler

test

pls delete me, cant find delete btn

 

On 1.11.2013 at 0:29 PM, RTFC said:

Beta version 0.8 released, minor bug fixes.

 

Edited by Busti

My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • 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
      The CodeScannerCrypterBundle (ca. 2.5 MB) 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
      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 user query any macro (e.g., @username) any AutoIt function call any UDF call some permanent environment variable on a specific machine (and not created by your script) a server response a device response anything else you can think of, as long as it's not stored in the script any combination of the above You need several scripts to get this to work, and they are scattered over several threads, so here's a single bundle that contains them all (including a patched version of Ward's AES.au3; with many thanks to Ward for allowing me to include this script here):
      Latest version: 3.1, (27 Feb 2020): please follow this link.
      Note: if you experience issues under Win8/8.1 (as some users have reported), please upgrade to Win10 (or use Win7) if you can; as far as I can tell, the scripts in the bundle all work under Win7 & Win10 (and XP). Moreover, I have no access to a Win8 box, so these issues will not be fixed, at least not by yours truly.
       
      How the bits and pieces fit together:
      CodeCrypter is a front-end for the MCF UDF library (you need version 1.3 or later). Its thread is here:
      '?do=embed' frameborder='0' data-embedContent>>
      The MCF package (also contained in the CodeScannerCrypter bundle) contains MCF.au3 (the library itself) plus a little include file called MCFinclude.au3. The latter you have to include in any script you wish to encrypt. Any code preceding it will not be encrypted, any code following it will be encrypted. You define the dynamic key inside MCFinclude.au3, in the UDF: _MCFCC_Init().
      From the same post you can download an MCF Tutorial which I heartily recommend, because encrypting a script requires a number of steps in the right order, namely:
      In MCFinclude.au3, define and/or choose your dynamic key(s) (skip this step = use default setting) include MCFinclude.au3 in your target script Run CodeScanner (version 2.3+) on your target script, with setting WriteMetaCode=True (see '?do=embed' frameborder='0' data-embedContent>>), then close CodeScanner. Start CodeCrypter press the Source button to load your target file enable Write MCF0 (tick the first option in Main Settings) Enable "Encrypt" (last option in the Main Settings) Go to the Tab Encrypt and set up the encryption the way you want (skip this = use default settings) Return to Main Tab and press "Run" if all goes well, a new script called MCF0test.au3 is created in the same directory as your target. It has no includes and no redundant parts. Please check that it works as normal. (see Remarks if not) It all sounds far more complicated than it is, really.
      Not convinced? Check out:
      a simple HowTo Guide: HowToCodeCrypt.pdf an updated and extended Q & A pdf (FAQ, also included in the bundle) to help you get started:CodeCrypterFAQ.pdf For additional explanations/examples in response to specific questions by forum members (how it works, what it can/cannot do), see elsewhere in this thread, notably:
      Simple analogy of how it works: post #53, second part General Explanation and HowTo: post #9, 51, 75, 185/187, 196, 207, 270, 280 (this gets a bit repetitive) BackTranslation: post #179 Obfuscation: post #36 (general), 49 (selective obfuscation) Specific features and fixes: post #3 (security), 84 (redefining the expected runtime response), 169 (Curl Enum fix), 185/187 (using license keys), 194 (replacing Ward's AES UDF with different encryption/decryption calls), 251 (AV detection issue), 262 (extract key contents to USB on different target machine prior to encryption) Limitations: post #26 (@error/@extended), 149 (FileInstall), 191 (AES.au3 on x64) Not recommended: post #46/249 (static encryption), 102 (programme logic error), 237 (parsing password via cmdline)  
      Technical notes:
      BackTranslation is a test to check that the MetaCode translation worked. Skip it at your peril. It also turns your multi-include composite script into a single portable file without redundant parts (you can opt to leave the redundant parts in, if you want).
      CodeCrypter can also obfuscate (vars and UDF names) and replace strings, variable names and UDF names with anything else you provide, for  example, for language translation). After CodeScanner separates your target's structure from its contents, CodeCrypter (actually MCF, under the hood) can change any part, and then generate a new script from whichever pieces you define. See the MCF Tutorial for more explanation and examples.
      Encryption currently relies on Ward's excellent AES UDF and TheXman's sophisticated CryptoNG bundle. You can replace these with any other algorithm you like (but this is not trivial to do: edit MCFinclude.au3 UDF _MCFCC(), and MCF.au3 UDF _EncryptEntry(), see post #194 in this thread). AES by Ward, and CryptoNG by TheXman are also included in the bundle (with many thanks to Ward and TheXman for graciously allowing me to republish their outstanding work).
      Going to lie down now...
      RT
       
×
×
  • Create New...