clearguy Posted August 21, 2006 Share Posted August 21, 2006 Hi all, first sorry for my wrong english,I'm german. I've not make a script that I mean is better than others or is the best,I'm a newbie,I just made it for pleasure . It's called SOW(Secret Of Walhall),it's a encrypter/encoder ,and encrypts all files(exe,jpg,wma...all! :"> ). How it works:first it makes a HexSource file,that means he put all characters of the input file in an HS (HexaSource file) at each line,converted in hexa. No it's not a joke,don't carry,it's not encrypted yet lol- Then it put these correct hex's in another file,the coded file(SOW file),spreading these in a marsh of randomly generated hex's...and that in a order the password gives ! For the moment:the password must be lowercase characters,and the order is given in alphabetical order(a=1,b=2,c=3 ecaetera...till 26). Negative = it takes alot of time!!! I don't know why Maybe because it reads and writes alot?? really? Positive = I think so an encrypted file is uncrackable,because if you havn't the password,you can delete your marsh of hexs Use = really,you know or let your hands off this No, at first time it's by fun that I made that,and to gather your comments about my script,if it's good or not(in your opinion) ,your ideas(if you have some )... Thanx to try it,and the most important for me: COmMeNNTSsss expandcollapse popup;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;~ ;~~ ;~ ;~ ;~ AutoIt Version: 3.2.0.1 ;~~ ;~ ;~ ;~ Author:clearguy ;~~ ;~~~~~~~~~~~~~~~~~~~~; ;~~ ;~~~~~~~~~~~~~~~~~~~~~~~~~~; ;~ ;~~ Script Function: ;~~ ;~ ;~~ Secret Of Walhall:encrypt/decrypt a file with password. ;~~ ;~ ;~~ Micro-encryption ;~~ ;~ ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;~~ ;~Script Start #include <GUIConstants.au3> ;~~ #include <File.au3> ;~~ #include <String.au3> ;~~ Global $converted,$filepath,$CryptKeyLen,$ChrVal = 0,$ChrPeriodDiv ;~~ Global $PosInPeri = 0,$add = 0 ,$linetoread = 0,$termination ;~~ Global $counter = 0,$status = "Ready" ;~~ ;~ GUI Opt("GUIOnEventMode",1) ;~~ GUICreate("SOW Encrypt",250,220) ;~~ GUISetState(@SW_SHOW) ;~~ ;~ Menu $filemenu = GUICtrlCreateMenu ("&File") ;~~ $fileitem = GUICtrlCreateMenuitem ("Open",$filemenu) ;~~ GUICtrlSetState(-1,$GUI_DEFBUTTON) $helpmenu = GUICtrlCreateMenu ("?") ;~~ $helpitem = GUICtrlCreateMenuitem ("About SOW...",$helpmenu) ;~~ ;~ Progress $progressbar = GUICtrlCreateProgress (2,170,245,10) ;~~ ;~ Inputs $inputfile = GUICtrlCreateInput("",5,26,190,20) ;~~ $outputfile = GUICtrlCreateInput("",5,80,190,20) ;~~ $input = GUICtrlCreateInput("",50,129,150,20) ;~~ ;~ Buttons to bottom $search = GUICtrlCreateButton("Search",200,26,40,19) ;~~ $search2 = GUICtrlCreateButton("Search",200,80,40,19) ;~~ $button = GUICtrlCreateButton("Encrypt",204,130,46,19) ;~~ $buttondecrypt = GUICtrlCreateButton("Decrypt",1,130,46,19) ;~~ ;~ Lables $stat = GUICtrlCreateLabel ($status,0,185,300,16,BitOr($SS_SIMPLE,$SS_SUNKEN)) ;~~ $percentage = GUICtrlCreateLabel("0%",120,149) ;~~ GUICtrlCreateLabel("File to encrypt/decrypt(full path)",10,5) ;~~ GUICtrlCreateLabel("File output(full path)",10,58) ;~~ GUICtrlCreateLabel("Crypt key(in lowercase):",10,108) ;~~ ;~ OnEvents GUISetOnEvent($GUI_EVENT_CLOSE,"close") ;~~ GUIctrlSetOnEvent($button,"encrypt") ;~~ GUIctrlSetOnEvent($buttondecrypt,"decrypt") ;~~ GUIctrlSetOnEvent($search,"choosefile") ;~~ GUIctrlSetOnEvent($search2,"choosefile2") ;~~ GUIctrlSetOnEvent($fileitem,"choosefile") ;~~ GUIctrlSetOnEvent($helpitem,"helpfile") ;~~ While 1 ;~~ Sleep(1000);~ idle around WEnd ;~~ Func close() ;~~ Exit ;~~ EndFunc ;~~ Func encrypt() If FileExists(GUICtrlRead($outputfile)) Then ;~~ delete if file already exists FileDelete(GUICtrlRead($outputfile)) ;~~ EndIf ;~~ $word = GUICtrlRead($input);reads the crypt key If $word = "" Then;~~ verification if crypt key is present MsgBox(64,"SOW Encrypt","No crypt key");~~ Exit;~~ EndIf;~~ $verif = StringIsLower ( $word ) ;~~ verification if crypt key is only lowercase If $verif = 0 Then ;~~ MsgBox(64,"SOW Encrypt","Only lowercase characters!");~~ Exit ;~~ EndIf ;~~ $filepath = GUICtrlRead($inputfile) ;~~ $CryptKeyLen = StringLen ( GUICtrlRead($input) ) ;~~ For $start = 1 To $CryptKeyLen;~~ conversion of the crypt key in numbers(alphabetical order) $toconvert = StringMid($word,$start,1) ;~~ For $start2 = 97 To 122 ;~~ lowercase If $toconvert = Chr($start2) Then ;~~ $converted = $converted &$start2 - 96 ;~~ $converted = $converted&"," ;~~ EndIf ;~~ Next ;~~ Next ;~~ $converted = StringSplit($converted,",");~~ conversion end GenHexSource();~~ generates a file with the characters converted in hexa,at each line GenSOW() FileDelete(@WorkingDir&"\generated.hs");~~ deleting temp file GUICtrlSetData($stat,"Ready");~~ update progress $converted = 0 ;to avoid system errors GUICtrlSetData($progressbar,0);~~ update progress GUICtrlSetData($percentage,"0%");~~ update progress MsgBox(64,"SOW Encrypt","Encryption finished!") ;~~ tells that encryption is finished EndFunc Func decrypt() If FileExists(GUICtrlRead($outputfile)) Then ;~~deletes file if already exists FileDelete(GUICtrlRead($outputfile)) ;~~ EndIf ;~~ end $word = GUICtrlRead($input);~~ reads the crypt key If $word = "" Then ;~~ tells if no key is typed MsgBox(64,"SOW Encrypt","No crypt key") ;~~ Exit ;~~ EndIf ;~~ $filepath = GUICtrlRead($inputfile) ;~~ path to file to encrypt $CryptKeyLen = StringLen ( GUICtrlRead($input) );~~ length of the crypt key For $start = 1 To $CryptKeyLen ;~~ conversion of the crypt key in numbers(alphabetical order) $toconvert = StringMid($word,$start,1) ;~~ For $start2 = 97 To 122 ;~~ If $toconvert = Chr($start2) Then ;~~ $converted = $converted &$start2 - 96;~~ $ChrVal = $ChrVal + ($start2 - 96) ;~~ $converted = $converted&"," ;~~ EndIf ;~~ Next ;~~ Next ;~~ $converted = StringSplit($converted,",");~~conversion end $ChrPeriodDiv = $ChrVal + $CryptKeyLen;~~ calculates the CharPeriod divisor,used to divide the number of lines of en encrypted SOW file - UngenSOW() ;~~ writes a HexSource file with the right data from a password encrypted SOW file ;~~ - to know how much periods of password are in a file... UngenHexSource() ;~~ writes the decrypted file with the HexSource GUICtrlSetData($stat,"Ready") ;~~ progreass update FileDelete(@WorkingDir&"\HexSource.hs") ;~~ deleting temp file $converted = 0 ;~~ to avoid system errors GUICtrlSetData($progressbar,0) ;~~ progress update GUICtrlSetData($percentage,"0%") ;~~ progress update MsgBox(64,"SOW Encrypt","File decrypted") ;~~ tells that decryption is finished EndFunc ;~~ Func UngenHexSource();~~ writes the decrypted file with the HexSource GUICtrlSetData($stat,"Generating requested "& $termination &" file") ;~~ progress update $path = @WorkingDir&"\HexSource.hs" ;~~ $outputpath = GUICtrlRead($outputfile) ;~~ $lines = _FileCountLines($path) ;~~ For $i = 1 To $lines ;~~ converts the hex's of the HexSource(HS) to a string ,then put it the decrypted file FileWrite($outputpath,_HexToString(FileReadLine($path,$i))) ;~~ GUICtrlSetData($percentage,($i*100)/$lines&"%") ;~~ progress update GUICtrlSetData($progressbar,($i*100)/$lines) ;~~ progress update Next ;~~ end of conversion EndFunc ;~~ Func UngenSOW();~~ writes a HexSource file with the right data from a password encrypted SOW file GUICtrlSetData($stat,"Generating HexSource") ;~~ progress update $lines = _FileCountLines($filepath) ;~~ $outputpath = @WorkingDir&"\HexSource.hs" ;~~ $periods = $lines / $ChrPeriodDiv ;~~ calculates the amount of periods in an encrypted file $periods = Floor($periods) ;~~ $remainder = Mod( $lines,$ChrPeriodDiv) ;~~ If $remainder <> 0 Then ;~~ if there is a remainder,calculates the remainder rate of the las period For $i = 1 To $CryptKeyLen ;~~ $add = $converted[$i] + $add + 1 ;~~ If $remainder = $add Then ;~~ $PosInPeri = $i ;~~ ExitLoop ;~~ EndIf ;~~ Next ;~~ EndIf ;~~ end calculate For $i = 1 To $periods ;~~ writes a HexSource file (HS) with the right data of the SOW file(encrypted file) For $i2 = 1 To $CryptKeyLen ;~~ $linetoread = $converted[$i2] + $linetoread + 1 ;~~ FileWriteLine($outputpath,FileReadLine($filepath,$linetoread)) ;~~ Next ;~~ GUICtrlSetData($percentage,($i*100)/$periods&"%") ;~~ progress update GUICtrlSetData($progressbar,($i*100)/$periods) ;~~ progress update Next ;~~ If $PosInPeri <> 0 Then ;~~ if there is a non-complete period For $i = 1 To $PosInPeri ;~~ write the last right data $linetoread = $converted[$i] + $linetoread + 1 ;~~ FileWriteLine($outputpath,FileReadLine($filepath,$linetoread)) ;~~ Next ;~~ EndIf ;~~ EndFunc ;~~ Func GenSOW() ;~~ generates an encrypted file (SOW) with the HexSource GUICtrlSetData($stat,"Generating SOW file") ;~~ updates progress $lines = _FileCountLines(@WorkingDir&"\generated.hs") ;~~ $outputpath = GUICtrlRead($outputfile) ;~~ path to output file,encrypted file (SOW) For $i=1 To $lines ;~~ starts generation of SOW file $gold = FileReadLine(@WorkingDir&"\generated.hs",$i) ;~~ $counter = $counter + 1 ;~~ If $counter > $CryptKeyLen Then ;~~ $counter = 1 ;~~ EndIf ;~~ For $i2 = 1 To $converted[$counter] ;~~ FileWriteLine($outputpath,_StringToHex(Chr(Random(0,255))) ) ;~~ wrong hex data Next ;~~ FileWriteLine($outputpath,$gold) ;~~ the "gold" data,it's the data of the file to encrypt $percent = (100*$i)/$lines ;~~progress update GUICtrlSetData($percentage,$percent&"%") ;~~progress update GUICtrlSetData($progressbar,$percent) ;~~progress update Next ;~~ EndFunc ;~~ Func GenHexSource();~~ generates a file with the characters converted in hexa,at each line GUICtrlSetData($stat,"Generating HexSource") ;~~ updates data in status bar $code = FileRead($filepath) ;~~ reads the file to encrypt $length = StringLen(FileRead($filepath)) ;~~ length of the string of the file to encrypt For $start = 1 To $length ;~~ starts to making the HexSource file(HS) $string = StringMid($code,$start,1) ;~~ $string = _StringToHex($string) ;~~ FileWriteLine(@WorkingDir&"\generated.hs",$string) ;~~ a temp file $percent = (100*$start)/$length ;~~ GUICtrlSetData($percentage,$percent&"%") ;~~updates progress GUICtrlSetData($progressbar,$percent) ;~~updates progress Next ;~~ end of HexSource generation GUICtrlSetData($progressbar,0) ;~~ EndFunc ;~~ Func choosefile() ;~~ choose input file $file = FileOpenDialog("Choose file...",@WorkingDir,"All (*.*)") ;~~ GUICtrlSetData($inputfile,$file) ;~~ $verif = StringInStr($file,".sow") ;~~ If $verif = 0 Then ;~~ GUICtrlSetData($outputfile,@WorkingDir&"\encrypted.sow") ;~~ Else ;~~ $termination = InputBox("SOW Encrypt","What is the termination of the file you want to decrypt(not sow!,example:exe,jpg,txt,wma):") ;~~ GUICtrlSetData($outputfile,@WorkingDir&"\decrypted." & $termination) ;~~ EndIf ;~~ If FileExists(GUICtrlRead($outputfile)) Then ;~~ $response = MsgBox(4,"SOW Encrypt",(GUICtrlRead($outputfile)) &" exists already! Delete it?") ;~~ If $response = 6 Then ;~~ FileDelete((GUICtrlRead($outputfile))) ;~~ EndIf ;~~ If $response = 7 Then ;~~ MsgBox(0,"SOW Encrypt","Please change the name of the output file before starting encryption/decryption") ;~~ EndIf ;~~ EndIf ;~~ EndFunc ;~~ Func choosefile2() ;~~ chose output file $file = FileOpenDialog("Choose file...",@WorkingDir,"All (*.*)") ;~~ GUICtrlSetData($outputfile,$file) ;~~ EndFunc ;~~ Func helpfile() ;~~ MsgBox(0,"SOW Encrypt -Secret Of Walhall","SOW Encrypt is a little script made by my own,it can encode all possible files:txt,images,exe,all!First it generates a HexSource,with each character at each line converted in hex than spread each HS character in a marsh of randomly generated hex's and that in the order the password gives. ~~Clearguy~~") ;~~ EndFunc ;~~ I spend two days and all my nights to do this,so sorry if they're errors,even if I've tested. Use first very little file,a word on a text file So long, Clearguy SOW_Encrypt.au3 I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
clearguy Posted August 21, 2006 Author Share Posted August 21, 2006 The problem is that all is slow,I started a topic in support forum,and I read that it is the filewriteline() that make it slow,that's better to write on memory and then the whole data... ok but I've tryed it,using filehandle,using variable AND no change(perhaps 2 or 3 milliseconds of gain :s)... here is the topic in supportI don't understand why it takes so much time,is it the AutoIt script that makes it that slow?? I need a brain to explain what to do,please help me with my project,it could be useful for all I think that's why I put it on the forum,so that people can modify it... I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
Vivvic Posted August 21, 2006 Share Posted August 21, 2006 Its a great file, Im sure Ill use it eventually, havnt tested yet do you have to run the program to 'un-encrypt' the program or does it filewrite to the file its encrypting makeing you have to enter a password to open it? [quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote] Link to comment Share on other sites More sharing options...
clearguy Posted August 21, 2006 Author Share Posted August 21, 2006 No it's not selfextracting ,you need the program to decrypt an encrypted file,with the password. The program is not that big,and no person can crack an encrypted file if he hasn't the right password,and know what the encrypted file is(jpg,exe or wma...). If someone trys with a wrong password,well,they get a file,but that file is a random combination of ASCII and ANSI symbols no worth^^. I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
Vivvic Posted August 22, 2006 Share Posted August 22, 2006 Not sure, but wondering if its possible to make it self extracting maby with use of FileWrite ( filehandle or "filename", "line" ) ? [quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote] Link to comment Share on other sites More sharing options...
clearguy Posted August 22, 2006 Author Share Posted August 22, 2006 For self-extracting,we need to make the output file be an .EXE(in that case I don't know how to extract the encripted information....it will be possible if we make the output file an autoit3 script,in that case we put the encoded data in comments (cs and ce),and to selfextract we put the whole decoding program in this script,which will read itselfs,starting at the line the comment with the coded data beginns...but I'm still searching a way to put down the CPU usage and to make all faster,but I think it' impossible with loops beacause of the AU3 language... I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
CoderDunn Posted August 22, 2006 Share Posted August 22, 2006 For self-extracting,we need to make the output file be an .EXE(in that case I don't know how to extract the encripted information....it will be possible if we make the output file an autoit3 script,in that case we put the encoded data in comments (cs and ce),and to selfextract we put the whole decoding program in this script,which will read itselfs,starting at the line the comment with the coded data beginns...but I'm still searching a way to put down the CPU usage and to make all faster,but I think it' impossible with loops beacause of the AU3 language...Well you could make it self extract easy with FileInstall(). Just compile a modified version of your decripter and the encripted file using file install. Link to comment Share on other sites More sharing options...
Vivvic Posted August 22, 2006 Share Posted August 22, 2006 Im sure I would use and recomend to a few people if it was self extracting. [quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote] Link to comment Share on other sites More sharing options...
clearguy Posted August 24, 2006 Author Share Posted August 24, 2006 I'm rewriting it,I changed the encryption strategy,which allows a two times faster encryption,and I'll look about the SFX;) I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
clearguy Posted August 25, 2006 Author Share Posted August 25, 2006 Okay,one good news and one bad. First SFX is possible,BUT it is like you said:using FileInstall(),and this include that we need the au2exe to compile each time the encrypted file...I search a way to make it independant,so to include the compiling,beacause you have not automatically AU3 installed on all pc's. I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
clearguy Posted August 31, 2006 Author Share Posted August 31, 2006 (edited) EDIT development stopped. Edited November 8, 2006 by clearguy I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now