Jump to content

File Encryption


dnsi
 Share

Recommended Posts

  • Replies 42
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

I do the compile from sci editor so...

It automatically gives decompilible and no passfrase. blink.gif blink.gif blink.gif blink.gif blink.gif blush.gif blush.gif

Hmm, I get a kick out of people that say things without checking themselves.

Try to decompile it, and see what it tells you... Then reply.

@dnsi

He didn't use the normal decompiler.

Which version of AutoIt did you use to make this script?

Run('autoitscript.exe /AutoIt3ExecuteLine "MsgBox(0, Default, @AutoItVersion)"') Or just check the file version.

#include <guiconstants.au3>
$FILE1 = FileOpenDialog("Choose Input Path", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "All Files(*.*)", 3)
$FILE2 = FileSaveDialog("Choose Output Path", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "All Files(*.*)", 18)
$INTERFACE = GUICreate("Electric Shield", 307, 170)
$out1 = GUICtrlCreateInput("", 104, 80, 193, 21)
GUICtrlSetData($out1,$FILE2)
GUICtrlCreateLabel("InputFile:", 16, 8)
$Decrypt1 = GUICtrlCreateButton("Decrypt", 232, 40, 65, 33, 0)
$Encrypt1 = GUICtrlCreateButton("Encrypt", 8, 40, 65, 33, 0)
$in1 = GUICtrlCreateInput("", 104, 8, 193, 21)
GUICtrlSetData($in1,$FILE1)
GUICtrlCreateLabel("Output File:", 8, 88)
$now=GUICtrlCreateLabel("0", 10, 145, 163, 17)
$outof=GUICtrlCreateLabel("0", 105, 145, 163, 17)
GUICtrlCreateLabel("/", 90, 145)
GUICtrlCreateLabel("Bytes Done", 180, 145)
GUICtrlCreateLabel("OFFSET:", 104, 32)
$offset = GUICtrlCreateInput("", 104, 48, 105, 21)
$message = GUICtrlCreateInput("", 8, 120, 209, 21)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    $textmsg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE then
        ExitLoop
    EndIf

    If $textmsg=$Encrypt1 Then
        $curcount=0
        $current111="neg"
        GUICtrlSetData($now,"0")
        GUICtrlSetData($outof,"0")
        GUISetState(@SW_DISABLE)
        doencrypt(GUICtrlRead($in1))
    EndIf
    If $textmsg=$Decrypt1 Then
        $current111="neg"
        $curcount=0
        GUICtrlSetData($now,"0")
        GUICtrlSetData($outof,"0")
        GUISetState(@SW_DISABLE)
        dodecrypt(GUICtrlRead($in1))
    EndIf
WEnd
func doencrypt($file)
    if FileExists($file) Then
        $open1=FileOpen(GUICtrlRead($out1),9)
        if $open1=-1 Then
            GUICtrlSetData($message,"Incorrect path")
            SetError(1)
        EndIf
        GUICtrlSetData($message,"Encrypting...")
        $totalrnd=""
        $lasttotalrnd=""
        $loadfile=fileopen($file,0)
        $reads=FileRead($loadfile)
        GUICtrlSetData($outof,StringLen($reads))
        fileclose($loadfile)
        $opened1=fileopen($file,0)
        $totaltext=""
        While $curcount <> StringLen($reads)
            $read=FileRead($opened1,3000)
            For $i=1 to StringLen($read)
            If $i=1 Then
                $current=StringMid($read,1,1)
            Else
                $current=StringMid($read,$i,1)
            EndIf
                        if $current111="neg" Then
            $encode=asc($current)
            $encode=$encode+GUICtrlRead($offset)
            $text=chr($encode)
            $totaltext=$totaltext & $text
            $curcount=GUICtrlRead($now)
            GUICtrlSetData($now,$curcount+1)
            $curcount=$curcount+1
        Else
                        $encode=asc($current)
            $encode=$encode-GUICtrlRead($offset)
            $text=chr($encode)
            $totaltext=$totaltext & $text
            $curcount=GUICtrlRead($now)
            GUICtrlSetData($now,$curcount+1)
            $curcount=$curcount+1
        EndIf
                    if $current111="neg" Then
                $current111="pos"
            Else
                $current111="neg"
            EndIf
        Next
        FileWrite($open1,$totaltext)
        $totaltext=""
    WEnd
    FileClose($open1)
        FileClose($opened1)
    FileClose($loadfile)
        GUICtrlSetData($message,"Encryption Complete!")
beep(500,200)
$totaltext=""
    Else
        GUICtrlSetData($message,"Incorrect path")
    SetError(1)
    $totaltext=""
EndIf
GUISetState(@SW_ENABLE)
EndFunc

func dodecrypt($file)
    $open1=FileOpen(GUICtrlRead($out1),9)
        if $open1=-1 Then
            GUICtrlSetData($message,"Error with output file!")
            SetError(1)
            $totaltext=""
            Return ""
        EndIf
    if FileExists($file) Then
        GUICtrlSetData($message,"Decrypting...")
        $loadfile=fileopen($file,0)
        $reads=FileRead($loadfile)
        GUICtrlSetData($outof,StringLen($reads))
        fileclose($loadfile)
        $opened1=fileopen($file,0)
        $totaltext=""
        While $curcount <> StringLen($reads)
            $read=FileRead($opened1,3000)
            For $i=1 to StringLen($read)
            If $i=1 Then
                $current=StringMid($read,1,1)
            Else
                $current=StringMid($read,$i,1)
            EndIf
            if $current111="neg" Then
            $encode=asc($current)
            $encode=$encode-GUICtrlRead($offset)
            $text=chr($encode)
            $totaltext=$totaltext & $text
            $curcount=GUICtrlRead($now)
            GUICtrlSetData($now,$curcount+1)
            $curcount=$curcount+1
        Else
                        $encode=asc($current)
            $encode=$encode+GUICtrlRead($offset)
            $text=chr($encode)
            $totaltext=$totaltext & $text
            $curcount=GUICtrlRead($now)
            GUICtrlSetData($now,$curcount+1)
            $curcount=$curcount+1
        EndIf

            if $current111="neg" Then
                $current111="pos"
            Else
                $current111="neg"
            EndIf
        Next
        FileWrite($open1,$totaltext)
        $totaltext=""
    WEnd
    FileClose($open1)
    FileClose($opened1)
    FileClose($loadfile)

        GUICtrlSetData($message,"Decryption Complete!")
beep(500,200)
$totaltext=""
    Else
        GUICtrlSetData($message,"Incorrect path")
    SetError(1)
EndIf
GUISetState(@SW_ENABLE)
EndFunc
Suggestions:

For one, there is no reason to put code into it's own function unless it's able to be exported to other scripts without being changed too much, or if that section of code gets carried out a lot.

There is no reason an If statement needs to go accross a large section of code(in this case):

instead of

If FileExists() Then
;;;
;;;
;;;
Else
Return "No file:
EndIf

You could just:

If Not FileExists() Then Return "No file"
To make it easier to read.

You could use variables more instead of functions to get things to go faster.:

$e = GuiCtrlRead($x)

GuiCtrlSetData($x, $e+1)

--

$e += 1

GuiCtrlSetData($x, $e)

2 different GUIGetMsg()s are causing some of the messages to be "forgotten".

Also you need may need to test your programs more. I used ElectricSheild.exe on itself. One encrypt and decrypt later I had a bad file :\.

Edit: Also I havn't tried the newer version as I fear most .exe files(that I don't know about) and think it might add more stuff I don't need to my registery. :whistle:

Edited by gamerman2360
Link to comment
Share on other sites

  • Moderators

@dnsi

He didn't use the normal decompiler.

@gamerman2360 ... I assume your speaking of me, if so... "he/I" didn't use a "decompiler".

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

@gamerman2360 ... I assume your speaking of me, if so... "he/I" didn't use a "decompiler".

Assume you say? I ment what I said, you didn't decompile the script by the normal means. As much as I want to know how that is done, it will have to wait until I know at least a little about C++, or just, spicifically, how to make a DllCall() compatible dll...
Link to comment
Share on other sites

  • Moderators

Assume you say? I ment what I said, you didn't decompile the script by the normal means. As much as I want to know how that is done, it will have to wait until I know at least a little about C++, or just, spicifically, how to make a DllCall() compatible dll...

My comment assume was meant to say, I "suppose" you are talking about me in the post you made.

Wrong language to know a "little" about, and I have no idea what you mean by DllCall() "compatible dll..."

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Wrong language to know a "little" about, and I have no idea what you mean by DllCall() "compatible dll..."

Heh, ya, I know. Just havn't really started on it yet. DllCall() "compatible dll...": What I ment was just basically how to make a dll in general. All I know is how to make an .exe write text to a cmd window. :whistle: You know, the whole "Hello World" thing.
Link to comment
Share on other sites

There are hacked decompilers out there that will decompile AutoIt .exe's no matter if passphrase or "Disable Decompile" is selected. I'm not going to say where becuase first of all I have no clue, second that is irrelevant.

Edited by dandymcgee

- Dan [Website]

Link to comment
Share on other sites

  • Moderators

The last 4 posts have been yours bumping for ideas. I would say this is a dead subject, unless someone voluntarily asks question or offers a suggestion. There is no need to bump your own thread in the Scripts and Scraps forum, that's just bad taste.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...