Sign in to follow this  
Followers 0
continyu

Recognizing File Type

7 posts in this topic

I'm working on my little script which is dedicated to crypt/decrytp files. (i know there are other but i just want to improve myself with challenges...)

So i've handled other things so far i got one problem,

When i crypted a file with my script (using crytp.au3 functions- thx for that!) also i'm changing its extension to -lets say- ".crypt"

so when i wantto decrypt this file i would like to change it's extension to what it was before...

Is there anyway to recognize files' extension with autoit,

or can i add some data to my new ".crypt" extensioned file it's original extension. and then read it when i'm decrypting it...

Waiting for your answers.. thank you..

(my english is bad i know, and i'm sory.)

Share this post


Link to post
Share on other sites



Just add the .crypt extension after the original extension. For example:

document.doc.crypt.

Strip the .crypt of when decrypting and your done.

Share this post


Link to post
Share on other sites

#Include <Crypt.au3>  
$sPassword = "DarkAngel"  
$sSourceFile = "Filename.Ext" 
$sCryptFile = $sSourceFile & ".drk" 
$sDecryptFile = StringReplace($sCryptFile, ".drk", "")  
_Crypt_EncryptFile($sSourceFile, $sCryptFile, $sPassword, $CALG_DES)  
FileDelete($sSourceFile)  
MsgBox(0, "Check", "See if source has gone")  
_Crypt_DecryptFile($sCryptFile, $sDecryptFile, $sPassword, $CALG_DES)  
MsgBox(0, "Check", "See if the source is back again!")

;)

Hope this helps .. :)

Share this post


Link to post
Share on other sites

Thank both of you for your answers. Example and idea should work.

BUT

i don't know if i'm asking for too much but in this way file's original extension is obvious and script will create disturbing filenames like filename.avi.crypt etc.

So is there anyone know do that hidden. Or i will just use replace method...

Share this post


Link to post
Share on other sites

change windows setting to hide known file types .. In this case use ur extension as the hidden one . The original extension is considered as a part of the file name . ;)

Share this post


Link to post
Share on other sites

still wont work with all computers.

I'm thinking of adding resources as text in those files but don't have any idea to do that ...

Share this post


Link to post
Share on other sites

still wont work with all computers.

I'm thinking of adding resources as text in those files but don't have any idea to do that ...

Say you have a file called hello.txt containing text "Hello world". You can put the extension before the text "Hello World" and encrypt it like that. So you get ".txt|Hello World" and encrypt it into "asjkd896ad58asd" (random). You store the encrypted file as hello.crypt, once you decrypt and see the result ".txt|Hello World" you can remove the ".txt|" part and rename the file back to hello.txt.

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