AutoHotkey Community

It is currently May 27th, 2012, 1:06 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: PicHid
PostPosted: April 14th, 2008, 3:41 pm 
Offline

Joined: March 3rd, 2008, 11:09 pm
Posts: 34
Hey guys. This is my first program in AHK. It isn't really completely done yet, but I would like you to test it.
Thanks to everyone who helped and will help :D

What it does is it uses a native Windows (DOS) command to "hide" any file in a picture. (It's best if you try zip / rar files). The new image created is recognized as a perfect jpeg from Windows. However, if you try to "Open with" with Winrar / Winzip, you will see the rar / zip file you hid inside.

Please tell me if it works on your pc's.

Thanks in advance!

Code:
#SingleInstance force
#NoTrayIcon
#NoEnv
SetBatchLines, -1
DetectHiddenWindows, On
SetTitleMatchMode, 2
Gui, +AlwaysOnTop +LastFound
Gui, Add, Edit, w400 cGray vPath1, Drag and drop the file to be hidden.
Gui, Add, Edit, w400 cGray vPath2, Drag and drop the 'hidding place' image.
Gui, Add, Button, w50 gGuiSubmit, OK
Gui, Add, Button, w50 gGuiClose x+10, Cancel
Gui, Font, Bold
Gui, Add, Text, w150 x+10 y65, Ready
Gui, Font, Norm
Gui, Show, xCenter yCenter, PicHid
GuiControl, Focus, OK
WinGet, WinID, ID
Return
GuiClose:
ExitApp
GuiDropFiles:
If A_EventInfo > 2
{
 Gui, +OwnDialogs
 MsgBox,48, PicHid, You need to drop two files.
 Return
}
If A_EventInfo = 2
 Loop,Parse,A_GuiEvent,`n,`r
 {
  GuiControl,Font,Path%A_Index%
  GuiControl,,Path%A_Index%,%A_LoopField%
 }
Else If (A_GuiControl="path1") OR (A_GuiControl="path2")
{
 GuiControl,Font, %A_GuiControl%
 GuiControl,,%A_GuiControl%,%A_GuiEvent%
}
Return

GuiSubmit:
GuiControlGet, path1
GuiControlGet, path2
GuiControl, Text, Ready, Working...
GuiControl, Disable, OK
GuiControl, Disable, Cancel
Command1 = COPY /B "%path2%" + "%path1%" "%A_ScriptDir%\newimage.jpg"
Sleep 100
Run, %comspec% /c %Command1%, , Hide ;see nothing
;Run, cmd, , ;Hide
;ControlSend, , COPY /B{Space}"%path2%", cmd
;ControlSend, , {Space}, cmd
;ControlSendRaw, , +, cmd
;ControlSend, , {Space}, cmd
;ControlSend, , "%path1%"{Space}"%A_ScriptDir%\newimage.jpg"{Enter}, cmd
Sleep 100
WinClose, cmd.exe
GuiControl, Enable, OK
GuiControl, Enable, Cancel
GuiControl, Text, Working..., Ready
MsgBox, , PicHid, The file was hidden successfully!
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 17th, 2008, 4:14 pm 
Offline

Joined: March 3rd, 2008, 11:09 pm
Posts: 34
No comments or anything? :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 17th, 2008, 5:00 pm 
Offline

Joined: April 17th, 2007, 1:37 pm
Posts: 761
Location: Florida
I like it - It seems kind of buggy, though - For example:

You hide file1.zip into picture.jpg, file1.zip's contents appear if you open it with winzip.
However, if you attempt to hide another zip file in newimage.jpg (after renaming it), you will still only see file1.zip's contents.

It's still a cool way to use an obscure (?) ability of the copy command 8)

_________________
[Join IRC!]
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 17th, 2008, 5:21 pm 
Offline

Joined: March 3rd, 2008, 11:09 pm
Posts: 34
So, I should deduce from what you're saying that it works, right? :D

This is why I said it isn't finished: I want to make it check for "newimage.jpg", ask the user, delete it, and overwrite it with the new file.

However, what you mentioned about trying to hide another zip file in an image that already serves as the "hiding place" of a file, has to do with the COPY command. I cannot change that because it has nothing to do with the script.

Thanks a lot for you comments :D Waiting for more :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 17th, 2008, 6:50 pm 
Offline

Joined: April 17th, 2007, 1:37 pm
Posts: 761
Location: Florida
Well, I had this idea - Your script works (once) with a zip file because WinZip (or whatever) ignores the jpg information in the header of the file and looks for the first zip file header that it finds (PK?). Appending a .txt file, for example, just appends the plaintext to the end of the .jpg, so Notepad wouldn't read it correctly... You also lose the filename of the file you're hiding, because only the raw data is appended to the 'combo' file.

It's been a long time since I played with this stuff, but how about this:
-It seems like the .jpg can survive multiple files being appended after the end of the actual .jpg.
-So, select any file to append (let's say test.txt) or multiple files
-Couldn't we, then, append something like this:
Code:
[Jpg Header]
JpgData...
JpgData...
JpgData...
[Jpg Footer]
[HiddenFile Name]
test.txt
[HiddenFile Data]
test.txt data...
test.txt data...
test.txt data...
[HiddenFile2 Name]
test2.txt
[HiddenFile2 Data]
test2.txt data...
test2.txt data...
test2.txt data...
OK, now we've got a file that should behave the same as yours since it contains the entire binary file contents in the data... sections so WinZip can ignore everything until that, but if we created a helper application to 'decode' the .jpg and split the binary file into separate files named based upon the data given in the Name sections.

That would be cool.

_________________
[Join IRC!]
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 19th, 2008, 8:00 pm 
Offline

Joined: March 3rd, 2008, 11:09 pm
Posts: 34
Haha, yeah, that might be cool but it would also be redundantly complicated. I see no reason to get into binary file structure :D And I think that one file in the image is more than enough (since you can zip anything you want and then hide it).


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bon, sks, Yahoo [Bot] and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group