Sep 5, 2013

Hide Text in Image Files



Description:


Sometimes when you want to send secret messages to your friends you would be looking for the most unsuspicious way. Here is a great trick to send text in an image file. Using a simple HTML application to hide the text into the image file according to the password you provide you can send secret messages to your friends. Both you and your friend should have the program and must know the password.

To make the HTML application file paste the following code into notepad and save with a .hta extension.


<html>
<head>
<title>ByteConceal</title>
<HTA:APPLICATION
APPLICATIONNAME="ByteConceal"
ID="ByteConceal"
VERSION="1.0"
MAXIMIZEBUTTON="no"
SCROLL="no"/>
</head>
<script language="VBScript">
Sub Window_OnLoad
Dim width,height
width=500
height=510
self.ResizeTo width,height
End Sub
Function Validate()
If Not (IsNumeric(key.value)) Then
X = MsgBox("The password must be a number between 1000 and 9999!", 48, "ERROR!")
Else If (key.value < 1000 Or key.value > 9999) Then
X = MsgBox("The password must be a number between 1000 and 9999!", 48, "ERROR!")
Else If (box.value = "") Then
X = MsgBox("Enter the text to hide!", 48, "ERROR!")
Else If (xbox.value = "") Then
X = MsgBox("Enter the image file path!", 48, "ERROR!")
Else
FileMng()
End If
End If
End If
End If
End Function
Function FileMng()
Set fs = CreateObject("Scripting.FileSystemObject")
path = xbox.value
If Not (fs.FileExists(path)) Then
X = MsgBox("The specified file does not exist!", 48, "ERROR!")
Else
WriteFile()
End If
End Function
Function WriteFile()
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("XBText.txt")
a.WriteBlankLines(2)
a.WriteLine("--- XBYTE ---")
a.WriteLine(key.value)
a.WriteLine(box.value)
a.Close
WriteBatch()
End Function
Function WriteBatch()
Set fs = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
Set a = fs.CreateTextFile("XBBatch.bat")
a.WriteLine("copy /b " & Chr(34) & xbox.value & Chr(34) & " + XBText.txt XBSecret.jpg")
a.Close
DeleteFiles()
End Function
Function DeleteFiles()
Set fs = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
X = WshShell.Run("XBBatch.bat",, True)
X = fs.DeleteFile("XBBatch.bat", True)
X = fs.DeleteFile("XBText.txt", True)
X = MsgBox("The text has been embedded into XBSecret.jpg!", 64, "Success!")
End Function
Function AValidate()
If Not (IsNumeric(akey.value)) Then
X = MsgBox("The password must be an integer between 1000 and 9999!", 48, "ERROR!")
Else If (akey.value < 1000 Or akey.value > 9999) Then
X = MsgBox("The password must be an integer between 1000 and 9999!", 48, "ERROR!")
Else If (abox.value = "") Then
X = MsgBox("Enter the path for the image file!", 48, "ERROR!")
Else
AFileMng()
End If
End If
End If
End Function
Function AFileMng()
Set fs = CreateObject("Scripting.FileSystemObject")
If Not (fs.FileExists(abox.value)) Then
X = MsgBox("The specified file does not exist!", 48, "ERROR!")
Else
FindHeader()
End If
End Function
Function FindHeader()
On Error Resume Next
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile(abox.value)
Do Until (text = "--- XBYTE ---" Or Err.Number <> 0)
text = a.ReadLine()
Loop
If (text = "--- XBYTE ---") Then
pass = a.ReadLine
CheckPass(pass)
Else
X = MsgBox("The file does not contain hidden data!", 48, "ERROR!")
End If
End Function
Function CheckPass(pswd)
If (akey.value = pswd) Then
Retrieve()
Else
X = MsgBox("Incorrect password!", 48, "ERROR!")
End If
End Function
Function Retrieve()
On Error Resume Next
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile(abox.value)
Do Until (text = "--- XBYTE ---" Or Err.Number <> 0)
text = a.ReadLine()
Loop
text = a.SkipLine()
Set x = fs.CreateTextFile("XBText.txt")
Do Until (Err.Number = 62)
text = a.ReadLine
If Err.Number = 0 Then x.WriteLine(text)
Loop
X = MsgBox("The retrieved text has been saved to XBText.txt!", 64, "Success!")
End Function
</script>
<body bgcolor="white">
<table align="center" width="450">
<caption><hr><b>ByteConceal</b><hr></caption>
<tr>
<td align="center">Password: <input type="text" id="key" size="4" maxlength="4"></td>
</tr>
<tr>
<td align="center"><textarea style="width: 450; height: 150;" id="box"></textarea></td>
</tr>
<tr>
<td align="center">Image path: <input type="file" id="xbox" size="40"></td>
</tr>
<tr>
<td align="center"><input type="button" value="Hide" onclick="Validate()" style="width: 450; height: 40;"></td>
</tr>
<tr>
<td align="center"><hr><br>Password: <input type="text" id="akey" size="4" maxlength="4"></td>
</tr>
<tr>
<td align="center">Image path: <input type="file" id="abox" size="40"></td>
</tr>
<tr>
<td align="center"><input type="button" value="Retrieve" onclick="AValidate()" style="width: 450; height: 40;"></td>
</tr>
</table>
</body>
</html>

Also you can download the executeable version of the program here: Download
Open the program and you will see a text box for password, a text area for the text, a text box for entering the path for the image file and a button labeled Hide. Fill in the fields. The password should be an integer between 1000 and 9999, the text area contain the text you want to hide. Enter the path for the image file you want to hide the text into. Eg:C:\Users\XByte\Documents.Secret.jpg. After that press the hide button. Now a new jpg file namedXBSecret.jpg will appear in the directory of the program. This file will containing the stored text. Send it your friends!

Now to retrieve the text from an image, open the program. You will see a password field and a text box for the image path as well as a Retrieve button in the lower part of the window. Enter the password and the image path. The program will tell you if the image does not contain hidden data or whether the password is incorrect. If you filled in all the fields correctly a new text file namedXBText.txt will be created in the same directory as the program and will contain the recovered data.

WARNING: The data in the image file will be lost if you edit it with any picture editing program!

Remember to like and share this post. Subscribe to the blog for more great stuff.


Previous Post
Next Post

0 comments: