Kilhian Posted February 26, 2008 Posted February 26, 2008 (edited) Hi,DefinitionI have discobvered autoit middle of december... please be indulgent Big thanks to JPam and Nordwind (Prospeed Team) This my first open-source script the aim of this script is to embed a file in a bitmap filetab Encrypt:input1:select the file you want to hide (*.doc, pdf, zip... what you want)input2:select the *.bmp file who will host the future hidden filethen launchtab decryptinput1:select the file you want to decryptprospeed.au3 need prospeed.dllthey can be found herebmp.au3 is no more neededif you don't have prospeed.dll in prospeed.au3 dir you will get error type aVectorexpandcollapse popup#include <String.au3> #include <Array.au3> #include <Prospeed.au3> #include <GUIConstants.au3> HotKeySet("{ESC}", "Terminate") Opt("GUIOnEventMode", 1) $X_Gui = 193 $Y_Gui = 125 $Gui_Width = 208 $Gui_Heigth = 224 $Main_Form = GUICreate("Stégano-Crypt", $Gui_Width, $Gui_Heigth, $X_Gui, $Y_Gui) $tab = GUICtrlCreateTab(0, 0, $Gui_Width, $Gui_Heigth) ;Onglet 1 $tab0 = GUICtrlCreateTabItem("Encrypt") GUICtrlCreateLabel("File to Crypt", 4, 28, 79, 17) GUICtrlCreateLabel("Decoy File", 4, 76, 75, 17) GUICtrlCreateLabel("Save as...", 4, 124, 79, 17) $File2encrypt = GUICtrlCreateInput("", 4, 48, 121, 21) $File_Mask = GUICtrlCreateInput("", 4, 96, 121, 21) $File2save = GUICtrlCreateInput("", 4, 144, 121, 21) $Browse1 = GUICtrlCreateButton("Browse...", 128, 48, 75, 25, 0) $Browse2 = GUICtrlCreateButton("Browse...", 128, 96, 75, 25, 0) $Browse3 = GUICtrlCreateButton("Browse...", 128, 144, 75, 25, 0) $Launch_encrypt = GUICtrlCreateButton("Launch", 68, 188, 75, 25, 0) ;Onglet 2 $tab1 = GUICtrlCreateTabItem("Decrypt") $File2decrypt = GUICtrlCreateInput("", 4, 48, 121, 21) $Browse4 = GUICtrlCreateButton("Browse...", 128, 48, 75, 25, 0) $Launch_decrypt = GUICtrlCreateButton("Launch", 68, 188, 75, 25, 0) GUICtrlCreateTabItem(""); end tabitem definition GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate") GUICtrlSetOnEvent($Browse1, "Browse") GUICtrlSetOnEvent($Browse2, "Browse") GUICtrlSetOnEvent($Browse3, "Browse") GUICtrlSetOnEvent($Browse4, "Browse") GUICtrlSetOnEvent($Launch_encrypt, "Launch_encrypt") GUICtrlSetOnEvent($Launch_decrypt, "Launch_decrypt") While 1 Sleep(100) WEnd Func Browse() ;MsgBox(0, "", @GUI_CtrlHandle & @CRLF & @GUI_CtrlId) $message = "Choisissez un fichier..." If @error <> 1 Then Switch @GUI_CtrlId Case 11 $Filename = FileOpenDialog($message, '', 'All files (*.*)', 8) GUICtrlSetData($File2encrypt, $Filename) $name = StringSplit($Filename, ".") If GUICtrlRead($File_Mask) = "" Then GUICtrlSetData($File2save, $name[1] & "-crypted") Else $ext = StringSplit(GUICtrlRead($File_Mask), ".") GUICtrlSetData($File2save, $name[1] & "-crypted" & "." & $ext[2]) EndIf Case 12 $Filename = FileOpenDialog($message, '', 'Bitmap (*.bmp)|(*.jpg)|All files (*.*)', 8) GUICtrlSetData($File_Mask, $Filename) $name = StringSplit($Filename, ".") If GUICtrlRead($File2encrypt) = "" Then GUICtrlSetData($File2save, "." & $name[2]) Else GUICtrlSetData($File2save, GUICtrlRead($File2save) & "." & $name[2]) EndIf Case 13 $Filename = FileOpenDialog($message, '', 'Bitmap (*.bmp)|(*.jpg)|All files (*.*)', 8) GUICtrlSetData($File2save, $Filename) Case 17 $Filename = FileOpenDialog($message, '', 'Bitmap (*.bmp)|(*.jpg)|All files (*.*)', 8) GUICtrlSetData($File2decrypt, $Filename) EndSwitch EndIf EndFunc ;==>Browse Func Launch_encrypt() $File_name_path = GUICtrlRead($File2encrypt) $File_name_path_array = StringSplit($File_name_path, "\") ;_ArrayDelete($File_name_path_array,"0") $File_name_string = $File_name_path_array[$File_name_path_array[0]] ;MsgBox(0,"$File_name_string ",$File_name_string) $File_content = FileRead($File_name_path) $File_content &= "#^0" & $File_name_string & "#^1" $File_lengh = StringLen($File_content) $File_char = StringSplit($File_content, "");store each char of the file in an array _ArrayDelete($File_content, 0) ;MsgBox(0, "", $File_lengh & @CRLF & UBound($File_char)) $bmp_hnd = LoadExtImage(GUICtrlRead($File_Mask)); picture use as mask $bmp_width = GetBmpWidth($bmp_hnd) $bmp_height = GetBmpHeight($bmp_hnd) $array = InitExtFX($bmp_hnd) $arrayInfos = DllStructCreate("long;long;long;dword;dword;long;long;long;long;long;long;long", $array) $biSizeImage = DllStructGetData($arrayInfos, 6) $Pointer = DllStructGetData($arrayInfos, 11) $a = $biSizeImage / 4 $z = $Pointer $Offset = 0 popup($bmp_width, $bmp_height) GetHDC() CopyArray($hdc, 10, 30, $array) $Form2_pos = WinGetPos("Preview") $Form2_size = WinGetClientSize("Preview") ; Byte Arrays contain 3 bytes (BGR) ProgressOn("Progress Meter", "", "0 percent", $Form2_pos[0], $Form2_pos[0], $Form2_pos[0] + $Form2_size[1]+40) For $i = 0 To (UBound($File_char) - 1);$a $getByte = GetAByte($z + $Offset) $color = Encrypt_Color(Hex($getByte, 6), $File_char[$i]) SetAByte($z + $Offset, Dec(StringMid($color, 1, 2))) ; 1 byte Blue SetAByte($z + $Offset + 1, Dec(StringMid($color, 3, 2))) ; 1 byte Green SetAByte($z + $Offset + 2, Dec(StringMid($color, 5, 2))) ; 1 byte Red $Offset = $Offset + 3 ; offset +3 for next Byte arrays ProgressSet(Int($i * 100 / UBound($File_char)), Int($i * 100 / UBound($File_char)) & " percent") Next ProgressSet(100, "Done", "Complete") ProgressOff() $bitmap2 = CreateExtBmp($bmp_width, $bmp_height) CopyArray($hdc, $bmp_width + 20, 30, $array) CopyArray($bitmap2, 0, 0, $array) MsgBox(0, "", "done!") SaveExtImage($bitmap2, GUICtrlRead($File2save), 0, 10) EndFunc ;==>Launch_encrypt Func Launch_decrypt() $File_name_path = GUICtrlRead($File2decrypt) $File_name_path_array = StringSplit($File_name_path, "\") $File_Path="" _ArrayDelete($File_name_path_array, "0") For $i = 0 To (UBound($File_name_path_array) - 2) If $File_Path="" Then $File_Path &= $File_name_path_array[$i] Else $File_Path &= "\"&$File_name_path_array[$i] EndIf Next $bmp_hnd = LoadExtImage($File_name_path); picture use as mask $bmp_width = GetBmpWidth($bmp_hnd) $bmp_height = GetBmpHeight($bmp_hnd) $array = InitExtFX($bmp_hnd) $arrayInfos = DllStructCreate("long;long;long;dword;dword;long;long;long;long;long;long;long", $array) $biSizeImage = DllStructGetData($arrayInfos, 6) $Pointer = DllStructGetData($arrayInfos, 11) $a = $biSizeImage / 4 $z = $Pointer $Offset = 0 $Decrypt_Char = "" ProgressOn("Progress Meter", "", "0 percent") While StringInStr($Decrypt_Char,"#^1")="" $getByte = GetAByte($z + $Offset) $Decrypt_Char &= Decrypt_Color(Hex($getByte, 6)) $Offset = $Offset + 3 ; offset +3 for next Byte arrays ProgressSet(Int($i * 100 / $a), Int($i * 100 / $a) & " percent") WEnd ProgressSet(100, "Done", "Complete") ProgressOff() $Decrypt_Char = StringTrimLeft($Decrypt_Char,1) $File = StringSplit($Decrypt_Char, "#^0",1) _ArrayDelete($File,"0") ;_ArrayDisplay($File) $File_Name = StringReplace($File[1], "#^1", "") $File_Name_array = StringSplit($File_Name, ".") _ArrayDelete($File_Name_array ,"0") $save_path=$File_Path & "\" & $File_Name_array[0] & "-decrypted." & $File_Name_array[1] $File2save=FileOpen($save_path,9) FileWrite($File2save, $File[0]) FileClose($File2save) MsgBox(0, "", "done!") EndFunc ;==>Launch_decrypt Func Encrypt_Color($color, $Char) $Char = AscW($Char) $Rcolor = Dec(StringMid($color, 1, 2)) $Vcolor = Dec(StringMid($color, 3, 2)) $Bcolor = Dec(StringMid($color, 5, 2)) $r = 248 $v = 248 $b = 252 $rc = 7 $vc = 56 $bc = 192 $En_R = BitOR(BitAND($Rcolor, $r), BitAND($Char, $rc)) $En_V = BitOR(BitAND($Vcolor, $v), _Dec("000" & StringTrimRight(_bin(BitAND($Char, $vc)), 3))) $En_B = BitOR(BitAND($Bcolor, $B), _Dec("000000" & StringTrimRight(_bin(BitAND($Char, $bc)), 6))) $En_Color = Hex($En_B, 2) & Hex($En_V, 2) & Hex($En_R, 2) Return $En_Color EndFunc ;==>Encrypt_Color Func Decrypt_Color($En_Color) $En_Rcolor = Dec(StringMid($En_Color, 1, 2)) $En_Vcolor = Dec(StringMid($En_Color, 3, 2)) $En_Bcolor = Dec(StringMid($En_Color, 5, 2)) $er = 7 $ev = 7 $eb = 3 $De_R = BitAND($En_Rcolor, $er) $De_V = _Dec(StringTrimLeft(_bin(BitAND($En_Vcolor, $ev)), 3) & "000") $De_B = _Dec(StringTrimLeft(_bin(BitAND($En_Bcolor, $eb)), 6) & "000000") $De_Char = ChrW(BitOR($De_B, $De_V, $De_R)) Return $De_Char EndFunc ;==>Decrypt_Color Func _bin($decimal) Local $retVal, $startVal = String($decimal), $work, $work2 For $i = 7 To 0 Step -1 $retVal &= Int(Mod($decimal, 2)) $decimal = $decimal / 2 Next Return _StringReverse($retVal) EndFunc ;==>_bin Func _Dec($bin) Local $retVal, $startVal = StringSplit($bin, "") _ArrayDelete($startVal, 0) _ArrayReverse($startVal) For $i = 7 To 0 Step -1 $retVal += $startVal[$i] * (2 ^ $i) Next Return ($retVal) EndFunc ;==>_Dec Func popup($bmp_width, $bmp_height) $Form2 = GUICreate("Preview", $bmp_width * 2 + 30, $bmp_height + 40, $X_Gui + $Gui_Width + 10, $Y_Gui) ; Créé la fenetre générale $Label_titre1 = GUICtrlCreateLabel("Original picture", 10, 10, $bmp_width, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Label_titre2 = GUICtrlCreateLabel("Crypted picture", $bmp_width + 20, 10, $bmp_width, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUISetOnEvent($GUI_EVENT_CLOSE, "Close") GUISetState(@SW_SHOW) EndFunc ;==>popup Func close() $hnd2close = WinGetHandle("[active]", "") GUIDelete($hnd2close) EndFunc ;==>close Func Terminate() Exit 0 EndFunc ;==>TerminateComing soon:- Data source encryption- Multi picture format fileKilhian Edited February 29, 2008 by Kilhian
gseller Posted February 26, 2008 Posted February 26, 2008 Ok, so after gathering prospeed.au3 and bmp.au3 and commenting out the [Global Const $WM_PAINT=0x000F] I am getting some AVector errors and not even sure what this is supposed to do or if it is something I want to keep fixing errors.. LOL Can you elaborate on what it is for me?
XxXFaNtA Posted February 26, 2008 Posted February 26, 2008 That's exactly what I was making one year ago at least what I tried! lol...since now i didn't know that actually had a name! damn it But I got some Errors like missing Functions (GetAByte on line 133). Do I need the newest Beta? Or is this just something left of the Bitmap.au3? /[center][/center]
Kilhian Posted February 26, 2008 Author Posted February 26, 2008 Func GetABit is declared in the latest prospeedl.au3 and so dll
Linux Posted February 26, 2008 Posted February 26, 2008 hmm, jex already done something similar.http://www.autoitscript.com/forum/index.ph...c=55774&hl= You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!"
Kilhian Posted February 27, 2008 Author Posted February 27, 2008 hmm, jex already done something similar.http://www.autoitscript.com/forum/index.ph...c=55774&hl=Yes... but it's a simple Dos copy /b concatenation... and no way to deconcatenate it...
BrettF Posted February 27, 2008 Posted February 27, 2008 And how in heaven's name are we meant to be able to help you, if you don't tell us what the hell it is? Woah. Heaven and hell in the same sentance... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Info Posted February 27, 2008 Posted February 27, 2008 Pressing F5 and >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\אלון\שולחן העבודה\AutoIt v3 Script חדש (4).au3" C:\Documents and Settings\????\????? ??????\AutoIt v3 Script ??? (4).au3 (3) : ==> Error opening the file.: #include <Prospeed.au3> >Exit code: 1 Time: 0.328
Kilhian Posted February 27, 2008 Author Posted February 27, 2008 the easiest way, put prospeed.au3 and prospeed.dll in your include folder
Stevo Posted February 3, 2010 Posted February 3, 2010 Hi Kilhian, Really nice script. However when I run decoder on a 16 Bit color desktop I get the following -console debug- output $Decrypt_Char = ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ $En_Rcolor = 255 $En_Vcolor = 255 $En_Bcolor = 255 On 32bit color desktop its ok. Could you please let me what I might be doing wrong. Regards, Steven
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