AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PicHid

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
mandiom



Joined: 03 Mar 2008
Posts: 34

PostPosted: Mon Apr 14, 2008 2:41 pm    Post subject: PicHid Reply with quote

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 Very Happy

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
Back to top
View user's profile Send private message
mandiom



Joined: 03 Mar 2008
Posts: 34

PostPosted: Thu Apr 17, 2008 3:14 pm    Post subject: Reply with quote

No comments or anything? Sad
Back to top
View user's profile Send private message
Rhys



Joined: 17 Apr 2007
Posts: 736
Location: Florida

PostPosted: Thu Apr 17, 2008 4:00 pm    Post subject: Reply with quote

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 Cool
_________________
[Join IRC!]

http://www.codeforcure.org/
Back to top
View user's profile Send private message
mandiom



Joined: 03 Mar 2008
Posts: 34

PostPosted: Thu Apr 17, 2008 4:21 pm    Post subject: Reply with quote

So, I should deduce from what you're saying that it works, right? Very Happy

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 Very Happy Waiting for more Wink
Back to top
View user's profile Send private message
Rhys



Joined: 17 Apr 2007
Posts: 736
Location: Florida

PostPosted: Thu Apr 17, 2008 5:50 pm    Post subject: Reply with quote

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!]

http://www.codeforcure.org/
Back to top
View user's profile Send private message
mandiom



Joined: 03 Mar 2008
Posts: 34

PostPosted: Sat Apr 19, 2008 7:00 pm    Post subject: Reply with quote

Haha, yeah, that might be cool but it would also be redundantly complicated. I see no reason to get into binary file structure Very Happy And I think that one file in the image is more than enough (since you can zip anything you want and then hide it).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group