Sign in to follow this  
Followers 0
Skitty

Why can't you run a decrypted script?

3 posts in this topic

#1 ·  Posted (edited)

What the script does is reads working script (can be any script that currently works) and encrypts the file line by line individually and then stores the data to a text file and then decrypts it back into an au3 file and launches it with "AutoIt3.exe" which all files should be at the script directory.

This isn't very important but I was just messing around with encryption and discovered that nearly everything (but images and executables I think) encrypted with Autoit won't work correctly afterwards.

#include<string.au3>
#include <file.au3>
_FileCreate(@ScriptDir & "\Unencrypted.au3")
$SCript = "\Code.au3"
$handle_read = FileOpen(@ScriptDir&$SCript,0)
If $handle_read = -1 Then
    MsgBox(0, @ScriptName, 'failed to open handle to read the file')
    Exit 1
EndIf

$file_to_write = @ScriptDir & "\Ecryptedcode.txt"
$handle_write = FileOpen($file_to_write, 2)
If $handle_write = -1 Then
    FileClose($handle_read)
    MsgBox(0, @ScriptName, 'failed to open handle to read the file')
    Exit 2
EndIf

While 1
    $line_read = FileReadLine($handle_read)
    If @error Then ExitLoop
    $1 = _StringEncrypt(1,$line_read,"10",1)
    FileWriteLine($handle_write, $1)
WEnd
FileClose($handle_read)
FileClose($handle_write)
;/////////////////////////////////////////////////////////////////////////////
;///////////////////////////////////NEXT//////////////////////////////////////
;/////////////////////////////////////////////////////////////////////////////
$hndle2read = FileOpen(@ScriptDir & "\Ecryptedcode.txt",0)
If $hndle2read = -1 Then
    MsgBox(0, @ScriptName, 'failed to open handle to read the file')
    Exit 1
EndIf

$fil2write2 = @ScriptDir & "\Unencrypted.au3"
$Htowrite = FileOpen($fil2write2, 2)
If $Htowrite = -1 Then
    FileClose($hndle2read)
    MsgBox(0, @ScriptName, 'failed to open handle to read the file')
    Exit 2
EndIf

While 1
    $line2read = FileReadLine($hndle2read)
    If @error Then ExitLoop
    $2 = _StringEncrypt(0,$line2read,"10",1)
    FileWriteLine($Htowrite, $2)
WEnd
FileClose($hndle2read)
FileClose($Htowrite)

Run(@ScriptDir & "\AutoIt3.exe" & " " & @ScriptDir & "\Unencrypted.au3")
Edited by xJSLRx

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites



When you try to encrypt an empty string, _StringEncrypt() is returning a 1 in @error. You need to skip encryption/decryption for blank lines if you are going to use this function.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

When you try to encrypt an empty string, _StringEncrypt() is returning a 1 in @error. You need to skip encryption/decryption for blank lines if you are going to use this function.

Going to test next day... update later and thank you!

Edited by xJSLRx

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

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