Jump to content



Photo

Hide text in bitmap


  • Please log in to reply
12 replies to this topic

#1 monoceres

monoceres

    asdf

  • MVPs
  • 3,719 posts

Posted 25 December 2008 - 04:25 PM

Hi!

I found this interesting article on codeproject so I decided to use the idea in an autoit script since it didn't seem to hard :)

It's basically a way to hide a string inside the bitmap data in a .bmp file. The basic idea is to use just 1 bit of each byte in the bitmap data to save the message, this means that each pixel that is modified inside the bitmap is just modified by one single little color shade (thus making it impossible for a human to notice the difference), so for example 0x000000 becomes 0x000001.

To be able to extract the string you need to know what offset the string is saved into in the bitmap, thus making it smewhat secure for peeping eyes :o

A big thanks to james3mg for his Number base conversion UDF.

The syntax is easy:

HideMessageInBitmap("file.bmp","My message",SECRET OFFSET HERE)
GetMessageInBitmap("file.bmp",SECRET OFFSET HERE)

Here's a bitmap I have encoded a message at offset 234 for example:
Attached File  test.bmp   68.4K   558 downloads

UDF ( With Number base conversion UDF):
Attached File  Bitmap_Message_Hider.zip   3.67K   428 downloads

Ps. Since png doesn't destroy any image data, a encoded message will survive a png conversion :D


:D

Edited by monoceres, 25 December 2008 - 04:27 PM.

Posted ImageIs the link in my post broken? I do not longer own my domain, all the files are moved to my new domain.Example: http://monoceres.se/test.au3 -> http://andhen.mine.nu/monoceres.se/test.au3





#2 James

James

    jbrooksuk

  • MVPs
  • 9,468 posts

Posted 25 December 2008 - 04:51 PM

I have seen this elsewhere on the forums too. Nice job though!

#3 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,498 posts

Posted 29 December 2008 - 01:45 AM

This is awsome. :o :)
When the words fail... music speaks

#4 Skrip

Skrip

    Psychonaut

  • Active Members
  • PipPipPipPipPipPip
  • 2,340 posts

Posted 29 December 2008 - 06:23 AM

Very nice!

We're trapped in the belly of this horrible machine.And the machine is bleeding to death...


#5 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,498 posts

Posted 29 December 2008 - 01:14 PM

I have a question.
Is there any limit to the text to hide it in the picture?
When the words fail... music speaks

#6 monoceres

monoceres

    asdf

  • MVPs
  • 3,719 posts

Posted 29 December 2008 - 04:17 PM

I have a question.
Is there any limit to the text to hide it in the picture?

Yes and it depends of the size of the bitmap. But it's quite easy to calculate.

If you for example have a bitmap that is 262144 bytes large (256 kB) you have 262090 bytes for text storage (since the bitmap header is 54 bytes).
Then we have to subtract 32 bytes to save the information that contains how many chars there are in the bitmap. That leaves us with 262058 bytes. Now usually one char takes up 1 byte of storage, but since we're only using the last bit in every byte in the bitmap we need 8 bytes to store one char. Therefore we need to devide the available space with 8. Which leaves us with 262058/8=32757,25= 32757 chars available for storage :) Of course this assumes that the offset is 0.

Here's a quick formula:
MsgBox(0,"",CalculateLimit(256*1024)) Func CalculateLimit($BitmapSize,$Offset=0)     Local $BitmapHeaderSize=54     Local $TextHeaderSize=32     Local $OneCharSize=8     Return Floor(($BitmapSize-$BitmapHeaderSize-$TextHeaderSize-$Offset)/$OneCharSize) EndFunc



:o
Posted ImageIs the link in my post broken? I do not longer own my domain, all the files are moved to my new domain.Example: http://monoceres.se/test.au3 -> http://andhen.mine.nu/monoceres.se/test.au3

#7 slayerz

slayerz

    Prodigy

  • Active Members
  • PipPipPip
  • 160 posts

Posted 31 December 2008 - 07:04 AM

This is awesome !!
Btw, how can I put different message at a different offset?
I'd try it, but the message is corrupted (sometimes return blank)
AUTOIT I'm lovin' it!

#8 monoceres

monoceres

    asdf

  • MVPs
  • 3,719 posts

Posted 31 December 2008 - 10:17 AM

This is awesome !!
Btw, how can I put different message at a different offset?
I'd try it, but the message is corrupted (sometimes return blank)


You just have to make sure there is enough room between the offsets. If you for example have the text "Hi!" at offset 100 the next offset can be earliest at offset 155 (32 bytes for length of string and 8*3 for the chars).
Posted ImageIs the link in my post broken? I do not longer own my domain, all the files are moved to my new domain.Example: http://monoceres.se/test.au3 -> http://andhen.mine.nu/monoceres.se/test.au3

#9 FireFox

FireFox

    Liar using Chrome :>

  • Active Members
  • PipPipPipPipPipPip
  • 3,173 posts

Posted 31 December 2008 - 10:21 AM

@monoceres
Great job ! this is very funny :)

Cheers, FireFox.
OS : Win XP SP3 / Win 7 SP1 / Win 8 | Autoit version: latest stable / beta

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | What you've done today | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : IP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 22 April, 2013 - If you find dead links please send me a PM, do not post in the topics !

#10 Beege

Beege

    Universalist

  • MVPs
  • 843 posts

Posted 01 July 2009 - 02:10 AM

Very Cool! Just like in that movie "Along Came a Spider".

#11 Randeniya

Randeniya

    Seeker

  • Active Members
  • 12 posts

Posted 14 July 2009 - 10:55 AM

Nice ! But I have a question...........
I had a Bmp with virus inside, when i scan it with Avast it shows AUTOIT VIRUS
Will it b possible???
But Now I Don,t hav that Bmp, Bcoz when i Having it i havnt kno abt AuToIt! :)

#12 monoceres

monoceres

    asdf

  • MVPs
  • 3,719 posts

Posted 14 July 2009 - 11:39 AM

No, that's not possible. This code merely changes the color data inside the bitmap. Even if someone did encode a virus into a bitmap it would only show up as an image. The image viewer would have no reason to execute to last bit of every RGB value.
Posted ImageIs the link in my post broken? I do not longer own my domain, all the files are moved to my new domain.Example: http://monoceres.se/test.au3 -> http://andhen.mine.nu/monoceres.se/test.au3

#13 logmein

logmein

    Polymath

  • Active Members
  • PipPipPipPip
  • 214 posts

Posted 15 July 2009 - 02:32 AM

great job!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users