Sign in to follow this  
Followers 0
t0nZ

New _Crypt functions VS old _StringEncrypt functions

13 posts in this topic

#1 ·  Posted (edited)

Is there a way to mantain "compatibility"  between the old and the new (last versions of Autoit) encryption methods ?

I have a client - server system in autoit and I want to encrypt a string with the new functions, and to decrypt with the old functions (in old exe's).

I made some tests with various crypt  algoritms of the new functions VS the old StringDecrypt but with no luck.

Any help appreciated.

Edited by t0nZ

Share this post


Link to post
Share on other sites



You can only choose one or the other. _StringEncrypt() is quite outdated.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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: 04/09/2015

Share this post


Link to post
Share on other sites

Of course from now I'll use only the new crypt functions, but for now I want to manage the transition.

I have over an hundred of remote clients and those scripts rely the autoupdate on the exchange of crypted data .

So i was searching how to crypt a string with new functions, in a way decryptable by the old functions.

So you tell me there is no way to obtain compatible encription ? OK.

Btw I can manage this situation with a slighty more complex update....

Thank you.

1 person likes this

Share this post


Link to post
Share on other sites

Care to share what you decided to do?


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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: 04/09/2015

Share this post


Link to post
Share on other sites

I decided to convert all my scripts to the new encryption method.

The situation: I have developed a standard (for me) function named Selfupdate()

Selfupdate() dowloads from a site an encrypted txt file with directives on updates and other commands for  various different scripts running on remote clients.

I run into this problem recompiling the new version of a script destined to run remotely.

First issue... the script wan't compile with old crypt instructions ... OK, so I go to change it with the new instructions.

But after this the script  will download an encripted file (encripted with old method) now not decriptable, dead end.

Ok I have to change first of all the script on the server that do the encription... but then the remote clients don't update.. dead end.

So I have to make a first remote update with old encription methods, (updating decrypt system on clients)  and I cannot make errors...

I can make it.

Share this post


Link to post
Share on other sites

Ok my quick and dirty solution and replacement to old _StringEncrypt functions in  my scripts is this function:

Func Ncrypt($operation, $string, $Key);  string crypt/decrypt function

    ; operation = crypt/decrypt, string= string to operate, key = the password

    Local $iAlgorithm = $CALG_AES_256

    If StringStripWS($string, $STR_STRIPALL) <> "" Then ; Check there is text available to encrypt.
        If $operation = "crypt" Then
            $string = _Crypt_EncryptData($string, $Key, $iAlgorithm); ENcrypt the text 
        Else
            $string = BinaryToString(_Crypt_DecryptData($string, $Key, $iAlgorithm)) ; DEcrypt the text 
        EndIf
    Else
        $string = ""
    EndIf

    Return $string

EndFunc   ;==>Ncrypt

For writing a file with an encripted string I have to :

FileWrite($hFileOpen, StringToBinary($string))

and to decript the same file I download it with Inetread and then I have to:

$string = BinaryToString($string)

    $string = Ncrypt("decrypt", $string, "password")

Now it work well in my old scripts... you think I can improve it ?

Share this post


Link to post
Share on other sites

Did anyone notice the StringEncrypt() function I included in the examples for the Crypt functions?


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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: 04/09/2015

Share this post


Link to post
Share on other sites

You are absolutely right.. 

Btw my real problem was to figure out the correct use of binarytostring and stringtobinary when writing to disk and dowload encrypted files.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

#include <string.au3>
MsgBox(64, "", _HWID())

Func _HWID()
$osdrive = StringLeft(@SystemDir, 3)
$original = "0"&@CPUArch & @KBLayout & DriveGetSerial("C:\") & StringUpper(DriveGetType($osdrive)) & DriveSpaceTotal ($osdrive)
;$string2 = StringMid($original, Round(StringLen($original)/2), Round(StringLen($original)/2))
;$string2_mod = _StringToHex(_StringReverse($string2))
;$original = _StringEncrypt(1, $original, $string2_mod, 4)
$original = _StringEncrypt(1, $original, 4)
Return $original
EndFunc

Did anyone notice the StringEncrypt() function I included in the examples for the Crypt functions?

I did and having a lot of issues figuring out how to use the new one

So i made changes per what I thought would work I took your code

; Encrypt text using a generic password.     Local $sEncrypted = StringEncrypt(True, 'Encrypt this data.', 'securepassword')

and used it to replace the old crypt

#include <string.au3>
#include <Crypt.au3>
#include <MsgBoxConstants.au3>
MsgBox(64, "", _HWID())

Func _HWID()
$osdrive = StringLeft(@SystemDir, 3)
$original = "0"&@CPUArch & @KBLayout & DriveGetSerial("C:\") & StringUpper(DriveGetType($osdrive)) & DriveSpaceTotal ($osdrive)
;$string2 = StringMid($original, Round(StringLen($original)/2), Round(StringLen($original)/2))
;$string2_mod = _StringToHex(_StringReverse($string2))
;$original = _StringEncrypt(1, $original, $string2_mod, 4)
;$original = _StringEncrypt(1, $original, 4)
Local $sEncrypted = StringEncrypt(True, $original)
Return $original
EndFunc

all i got was what I had before a error I don't understand

"C:Program FilesAutoIt3SonoMiniIndie5driveGetserial.au3"(13,50) : error: StringEncrypt(): undefined function. It works great in the sample but not for me.. Kinda like my car, it stutters and shakes and makes funny sounds until my husband comes to check it and it runs great for him..

Edited by meows

Share this post


Link to post
Share on other sites

The signature of the new one is exactly the same as the old one, so you need to be a little more vigilant.

StringEncrypt(True, $sOriginalData, 'PASSWORD') ; True means encrypt it.

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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: 04/09/2015

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Thank you I will try, Old brain,,  I ended up using old crypt, until I can figure this one out. Project I am working on not allowing me time to research out how to use new crypt in old code.  Many thanks. *hugs*

Very messy but that is what happens when trying to figure things out. In the end I always end up with something I can use.. Not what I really wanted but what I could make that got the essentials done. this is one of 5  number 3 in the list.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=cps250.ico
#AutoIt3Wrapper_Outfile=EvalYES.exe
#AutoIt3Wrapper_Res_Description=placeholder
#AutoIt3Wrapper_Res_Fileversion=12.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=placeholder
#AutoIt3Wrapper_Res_Language=1033
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; *** Start added by AutoIt3Wrapper ***
#include <FontConstants.au3>
; *** End added by AutoIt3Wrapper ***
#include  "ExtMsgBox.au3"

#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
#include<string.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <placeholderdowsConstants.au3>
#include <GuiTab.au3>
#include <Misc.au3>
#include <ColorConstants.au3>
#include <GuiButton.au3>
#include <ExtMsgBox.au3>
#include <constants.au3>
#include <placeholderAPI.au3>
$Regit1 = GUICreate("reg1", 621, 442, 192, 114)
$back1 = GUICtrlCreatePic("C:\Program Files\AutoIt3\placeholder\bd.jpg", 0, 0, 608, 440)

;Opt("GUIOnEventMode", 1)
Local Const $1Font = "Tahoma"
$hButton1 = GUICtrlCreateButton("Register ", 20, 20, 1, 1, GUISetState(@SW_HIDE))

$hButton6 = GUICtrlCreateButton("Read Me", 20, 20, 1, 1, GUISetState(@SW_HIDE))
$hButton7 = GUICtrlCreateButton("Exit", 20, 20, 1, 1, GUISetState(@SW_HIDE))
GUICtrlSetState($hButton1, @SW_HIDE)

;GUISetBkColor(0xC96A00) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT).


;$hTest_GUI = GUICreate("Beat the placeholder",200, 460, 240, 100)
$Label1 = GUICtrlCreateLabel("placeholder", 120, 64, 364, 55, $WS_BORDER)
GUICtrlSetFont($Label1, 24, 400, 0, "SF Gushing Meadow")
GUICtrlSetBkColor($Label1, 0xFF8E77)
GUICtrlSetTip($Label1, "Want to go for the placeholder placeholder?")
$Label2 = GUICtrlCreateLabel(" Get Sono placeholder placeholder.", 144, 120, 290, 31)
GUICtrlSetFont($Label2, 12, 400, 0, "SF Gushing Meadow")
GUICtrlSetBkColor($Label2, 0xD3892E)
$Label3 = GUICtrlCreateLabel(" 1. placeholder Sono placeholderFree version ", 120, 168, 268, 17)
GUICtrlSetBkColor($Label3, 0xFFFBF0)
$Label4 = GUICtrlCreateLabel(" 2. placeholder the placeholder and send in the placeholder code with your full name. ", 120, 192, 366, 17)
GUICtrlSetBkColor($Label4, 0xFFFBF0)
$Label5 = GUICtrlCreateLabel(" 3. Have all placeholder send in their codes ", 120, 216, 196, 17)
GUICtrlSetBkColor($Label5, 0xFFFBF0)
$Label6 = GUICtrlCreateLabel(" 4. downloaded version of Sono placeholder  Full Verson.", 120, 240, 305, 17)
GUICtrlSetBkColor($Label6, 0xFFFBF0)
$Label7 = GUICtrlCreateLabel(" Enter your Full Name for Code to placeholder placeholder placeholder", 152, 272, 246, 17)
GUICtrlSetBkColor($Label7, 0xFFFFFF)
;GUICtrlCreateLabel($sMsg, 10, 160, 180, 240, GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT))
;
GUISetState(@SW_SHOW,$Regit1)
;GUISetState()
Button1Click()
Button6Click()
Button7Click()
While 1
$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

   Case $hButton1
 Button1Click()


 Case $hButton6
 Button6Click()


 Case $hButton7
     Exit
 Button7Click()


   EndSwitch
WEnd
Func Button6Click()

;Register ()
;Yes your totally right I don't have a clue but I do get things done it just takes a week or 4 to make each line work and placeholder with all the others.
;over three fourth of the comments are deleted as they didnt work.
;This is my wanabee key generator. it is only used for a temp (free) piece of software easier than putting in all the code for full key generator.
;Thank goodness for the examples, Docs, Wiki, and Tutorials.
;Func Register()
Local $securityCodeEncryptionKey = "placeholder" ;this must match the applications key
;Local $securityCodeEncryptionKey = "placeholder" ;this must match the applications key
$str = InputBox ("placeholder Registration","Register to placeholder for placeholder Full version Download for Free & @crlf & @crlf & @crlf & @crlf Input first and last name")
If @error = 1 then exit

$Generate = StringUpper (StringRight ($str,5))
$restore = StringUpper(_StringEncrypt (1, $Generate, $securityCodeEncryptionKey , 1 ))

ClipPut ($restore)

Msgbox (0,"ISS Drive Check","The registration code is: " & $restore & "Your code has been placed on the DESKTOP placeholder.TXT and clipboard You can paste it into a text file to save it")
Local $sEvalString1 = Eval("$restore")
    #forceref $restore
IniWrite (@DesktopCommonDir & "\placeholder.TXT", "General", "registration", $restore)

;    MsgBox($MB_SYSTEMMODAL, "", $restore  )
    ; Initialize the variale $sString with data
    Local $sString = DriveGetSerial(@HomeDrive & "\") ; Find the serial number of the home drive, generally this is the C:\ drive.

    ;Local $sString = "This is a string"

#forceref $sString
    ; Find the value of the variable string sString and assign to the variable $sEvalString.
    ;Local $sEvalString = Eval("sString")

    ; Displaceholder the value of $sEvalString. This should be the same value as $sString.
;    MsgBox($MB_SYSTEMMODAL, "", $sEvalString  )
    ;IniWrite (@ScriptDir & "\known.ini", "General", "RootDrive", $sEvalString)
; FileMove(@TempDir & "\*.au3", @TempDir & "\Au3Files\", $FC_OVERWRITE + $FC_CREATEPATH)
RegWrite ("HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications","placeholder", "REG_MULTI_SZ", "SOFTWARE\placeholder\placeholder\placeholderAttempt\ControlCenter\Capabilities\" & $sString )
RegWrite ("HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications","placeholderVersion", "REG_MULTI_SZ",  "SOFTWARE\placeholder\placeholder\"& $restore)
FileCopy(@DesktopCommonDir & "placeholder.TXT", @AppDataCommonDir & "\placeholder.TXT", $FC_OVERWRITE + $FC_CREATEPATH)
;MsgBox($MB_SYSTEMMODAL, "", @AppDataCommonDir  )
EndFunc   ;==>Example
Func Button1Click()
    GUICtrlSetState($hButton1, $GUI_ENABLE)

$answer =     MsgBox(4,"Get Sono placeholder "," placeholder version and placeholder the placeholder. ")
     If $answer = 7 Then
    MsgBox(0, "", "OK.  Bye!")
    Exit
EndIf
;Local $hWnd = placeholderGetHandle("[ACTIVE]")
;placeholderSetOnTop($hWnd, "", 0)
;

;If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
            ;    $iMsgBoxAnswer = MsgBox(292, "Sono", " placeholder ?")
                ;Select
                ;    Case $iMsgBoxAnswer = 6 ;Yes
                    ;    Call Button1Click()
                    ;        Case $iMsgBoxAnswer = 7 ;No
                    ;    Exit
                ;EndSelect
EndFunc
Func Button7Click()
    Exit
EndFunc
Edited by meows

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

My "policy" is to adapt old scripts to the ultimate version of Autoit, if I have to modify these scripts.

I think in the long run it's a good move, because I have to know only the peculiarities of the last version.

Exception: yesterday I have to modify a script on an ancient win2000 server (yes... :ermm: ) and I keep the  last version of Autoit capable of compiling exes for win2000 (3.3.8.1) in a virtual machine.

Edited by t0nZ

Share this post


Link to post
Share on other sites

This is certainly not making my life easy.  This is such a great product and I am sure for all hard core encrypters this new change is really inspiring, but it is unfortunately not contributing to my user experience.

this must be one of the worst improvements I have ever seen.

I have over 3000 files locked with the old _StringEncrypt

I am struggling. Even the examples do not work for me.  I can see my encrypted string in the console... but, FileWrite writes garbage to my txt file

Is there ANY WAY I can get the old StringEncrypt back at least until I figure out this mess?  


Skysnake

Why is the snake in the sky?

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  
Followers 0

  • Similar Content

    • FMS
      By FMS
      Hello,

      I'm having trouble whit a scipt what I'm building where this is a snippit from, and hope somebody can help me whit.
      The problem lies in when i push the "add" button i want to check if the "user" already exists.
      But the search code i build founds 2 hits when i know there is only 1 hit.
      does somebody knows what I'm doing wrong?
      thanks in advance.

      Ps. if somebody knows " if i found the right user how can i rewrite the password for him/her? " an answer to that will be most appriciated
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <Array.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <File.au3> #Include <Timers.au3> #include <Crypt.au3> #include <GuiEdit.au3> $Form1 = GUICreate("Pie", 170, 235, 190, 200) local $usernames[0] local $passwords[0] global $selectuser = GUICtrlCreateCombo("", 21, 95, 130, 20) $addusername = GUICtrlCreateButton("Add", 21, 170, 130, 30) $usernamefield = GUICtrlCreateInput("", 21, 120, 130, 20) $passwordfield = GUICtrlCreateInput("", 21, 145, 130, 20, 0x0020) func encrypt() Local $hFileOpen = FileOpen("data.srmt", $FO_APPEND) if guictrlread($usernamefield) <> "" then ;~ local $encryptedusername = string(guictrlread($usernamefield)) ;~ local $encryptedpassword = string(guictrlread($passwordfield)) local $encryptedusername = string(_Crypt_EncryptData(guictrlread($usernamefield), "P14h735536jk3fvvbg", $CALG_AES_128)) local $encryptedpassword = string(_Crypt_EncryptData(guictrlread($passwordfield ), "P14h735536jk3fvvbg", $CALG_AES_128)) Local $iCheck_hit = False ConsoleWrite (@CRLF & "##############################################"& @CRLF) if ubound($usernames)> 0 then for $i = 0 to ubound($usernames)-1 If guictrlread($usernamefield) = $usernames[$i] Then $iCheck_hit = True ConsoleWrite ( "Found! "& @CRLF & $usernames[$i] & " = " & guictrlread($usernamefield) & @CRLF & "i = " & $i & @CRLF & @CRLF) ;~ Else ;~ ConsoleWrite ( "No! "& @CRLF & $usernames[$i] & " = " & guictrlread($usernamefield) & @CRLF & "i = " & $i & @CRLF & @CRLF) EndIf next EndIf ConsoleWrite ( "##############################################"& @CRLF) If $iCheck_hit = False Then FileWrite($hFileOpen, $encryptedusername & @CRLF) FileWrite($hFileOpen, $encryptedpassword & @CRLF) EndIf EndIf FileClose($hFileOpen) EndFunc func decrypt() Local $hFileOpen = FileOpen("data.srmt", $FO_READ) ;~ consolewrite(_FileCountLines("data.srmt") & " lines in the file" & @CRLF) for $i = 1 to _FileCountLines("data.srmt")/2 local $encryptedusername = FileReadLine($hFileOpen) local $encryptedpassword = FileReadLine($hFileOpen) ;~ consolewrite($encryptedusername & @CRLF) ;~ consolewrite($encryptedpassword & @CRLF) ;~ _ArrayAdd($usernames, FileReadLine($hFileOpen)) ;~ _ArrayAdd($passwords, FileReadLine($hFileOpen)) _ArrayAdd($usernames, binarytostring(_Crypt_DecryptData(binary($encryptedusername), "P14h735536jk3fvvbg", $CALG_AES_128))) _ArrayAdd($passwords, binarytostring(_Crypt_DecryptData(binary($encryptedpassword), "P14h735536jk3fvvbg", $CALG_AES_128))) Next FileClose($hFileOpen) ;~ consolewrite(ubound($usernames) & " entries in array") ;~ _arraydisplay($usernames) if ubound($userNames)> 0 then for $i = 0 to ubound($usernames)-1 GUICtrlSetData($selectuser, $usernames[$i]) next EndIf endfunc func updatecomboandinfo() if not GUICtrlRead($usernamefield) = "" Then _ArrayAdd($usernames, GUICtrlRead($usernamefield)) _ArrayAdd($passwords, GUICtrlRead($passwordfield)) GUICtrlSetData($selectuser, $usernames[UBound($usernames)-1]) EndIf EndFunc decrypt() GUISetState(@SW_SHOW) While True $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $addusername updatecomboandinfo() encrypt() GUICtrlSetData($usernamefield, "") GUICtrlSetData($passwordfield, "") Case $selectuser if ubound($usernames)> 0 then for $i = 0 to ubound($usernames)-1 ;~ msg( "error",$array_decrypted_usernames[$i]) If $usernames[$i] = GUICtrlRead($selectuser) Then GUICtrlSetData($usernamefield, $usernames[$i]) GUICtrlSetData($passwordfield, $passwords[$i]) consolewrite("YES " & $i & " = " & $usernames[$i] & " | ctr = " & GUICtrlRead($selectuser) & @CRLF) Else ;~ msg( "error",$array_decrypted_usernames[$i]) consolewrite("NO " & $i & " = " & $usernames[$i] & " | ctr = " & GUICtrlRead($selectuser) & @CRLF) EndIf next EndIf EndSwitch WEnd  
    • rc1986
      By rc1986
      Good morning,
      I currently have a little application that I have used the Crypt.au3 include to provide a basic form of encryption.  I have a little GUI which prompts the user to enter their passwords, this is then encrypted and written to a text file in its encrypted form.  When this user/password is required the code decrypts it and uses it on the fly.
      The way I am currently doing this is by using a passkey or master key withing the script itself to decrypt/encrypt.  This is the bit that concerns me as of course this isn't very secure.  Initially this didn't matter to me as what I'd created was much better than previous plain sight passwords in batch files etc however now I'd like to find a way of improving the security.
      Would anyone be able to offer any insight or other techniques/3rd party app integration etc to assist with my problem?
    • 09stephenb
      By 09stephenb
      How secure is:

      _Crypt_EncryptFile _Crypt_DecryptFile I understand the strength of encryption is mainly down to the algorithm and password, but I’m not referring to either of these, I am looking to find out how strong the code behind crypt it.

      I have noticed when encrypting a file, it uses a “.tmp” file while encrypting. In my experience a “.tmp” file is temporary and is deleted after use. But does this file contain any data that is related to the file being encrypted, or worse the password itself. Even though the file is deleted, it could possibly be recovered with a tool like: https://www.piriform.com/recuva.

      I'm not quite sure if this is a potential security threat, and if anyone could say if it is or not then that would be much appreciated.

    • BinaryBrother
      By BinaryBrother
      You're going to need Beege's Base64 UDF and Ward's AES UDF.

      Beege's Base64 UDF - Base64.au3
      Original Thread: https://goo.gl/H1QqEG
       
      Ward's AES UDF - AES.au3
      Original Thread: https://goo.gl/zQdASR

      Ward's UDF is amazing, but I felt the need to make a few "Helper" functions to make things easier. _Encrypt() and _Decrypt(), accepting 1 parameter and using a randomly generated IV for encryption, making the end encryption string dynamic and never the same. It pulls the IV from the first 16 characters of an encrypted string for the _Decrypt() routine.
      EncryptionExample.au3
      Now for the PHP goodies! First, we have a required include Encryption.php which was compiled by me.
      And, finally, an example of the PHP side of things. EncryptionExample.php

      /EncryptionExample.php?Action=Decrypt&Text=W4NAKRzuuTOfl9pAE8kSUgMYcuosvbUy58GR9w46U8w=
      Should output something like this: