It is currently Sat Dec 07, 2019 10:35 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 46 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: LSB File Embedding
PostPosted: Tue Nov 17, 2015 6:33 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
-----------------------------------------------------------------------------------

Download LSB File Embedding from My PureBasic Stuff

-----------------------------------------------------------------------------------

Tricks 'n' Tips
PureBasic Interface to OpenCV
PureBasic Interface to WinDivert
PureBasic Interface to WinRAR
PureBasic Interface to 7-Zip
PureBasic Interface to ImDisk
Windows Services & Other Stuff
Invading Space Aliens
Death Star vs Asteroids
GIF Toolkit
LSB File Embedding
Spider Web Drawing
Deform Image: MLS
Video Snipping Tool
Stitch Images: SIFT
Image Waves: LUT
YouTube Player & Downloader
MP4 Player & Downloader
Barcode Generator
Embed JS into PureBasic
Geolocation: Google Maps
Book & Viewer & Magnify
Video for Windows: VfW
Alternate Console
Network Share Management

-----------------------------------------------------------------------------------

Based on work I started in PureBasic Interface to OpenCV.

LSB (Least Significant Bit) File Embedding:
- set a Header password and Bit password
- load an image of the following type: jpg, png, or bmp
- embed folders or files of any type into an image (restricted by size / name truncated to 32 characters)
- save the image as a PNG (Portable Network Graphics) with lossless image compression
- load the LSB image to extract the embedded files
- embedded image files can be overwritten at anytime

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Fri Oct 11, 2019 1:10 am, edited 62 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Tue Nov 17, 2015 8:27 pm 
Online
Enthusiast
Enthusiast

Joined: Mon Jul 09, 2007 4:47 pm
Posts: 219
Location: Courthouse
Nice.

Another fine share :D


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Tue Nov 17, 2015 8:52 pm 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1709
Location: Uttoxeter, UK
Very interesting and instructive.
Thank you for sharing.

_________________
DE AA EB


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Tue Nov 17, 2015 10:39 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jun 11, 2006 12:07 am
Posts: 502
Location: Germany / one of the fishheads
Cool JHPJHP!

This looks like my abadoned project "ImageStega".
I tried to write a tolerant LSB encoding and encryption system using last the 1 to 4 bits and a encryption key which will survive a JPG compression. But unfortunately I lost the motivation.

Nice to see a working pendant. :D

Image

_________________
PB 5.71 x64, OS: Windows 7 Pro x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age: 51y
"Happiness is a pet." | "Never run a changing system!"


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Wed Nov 18, 2015 12:52 am 
Offline
Addict
Addict

Joined: Sat Mar 02, 2013 9:17 am
Posts: 931
Very nice,
But, it is not so simple 8)

Looking the picture analyse.
Typical is the moire and the defined location.


Image

_________________
http://www.nachtoptik.de


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Wed Nov 18, 2015 3:33 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
Hi juror, davido,

Thank you for posting your comments, they are very much appreciated.

-------------------------------------------------------

Hi kurzer,

ImageStega looks very good with some nicely added features.

All my posted projects were done for the fun of programming, maybe someday you'll return to ImageStega for the same reason.

Thank you for your comments.

-------------------------------------------------------

Hi walbus,

Looking at the image you posted, I think the problem was embedding to an 8 or 16 bit image, where the minimal requirement is 24 bits.

Please download and test the updated version, posting your results.

Thank you.


-------------------------------------------------------

Updated:
- added code to test for bit-depth
-- minimum requirement: 64 x 64 x 24 (width x height x depth)

NB*: Some additional improvements have been made, but nothing worth documenting.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Wed Nov 18, 2015 10:17 am 
Offline
Addict
Addict

Joined: Sat Mar 02, 2013 9:17 am
Posts: 931
Yep, the results are equal.

You musst fill the picture complete, and you must mixed the bits with random about patterns or moire.
And encrypt the data before you hidden these.

So, nobody can extract a content from a picture in my quick-aes-256 tool, it is absolutely impossible.
You see only a noise, but nobody can define what this is.

_________________
http://www.nachtoptik.de


Last edited by walbus on Sun Nov 29, 2015 6:05 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Thu Nov 19, 2015 7:03 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
Hi walbus,

Sorry I'm not sure I fully understand what you're reporting...

Is the application not working with some images?
- if so please post a link to the images in question

Was it an observation that hidden data using this method of steganography is less secure without encryption?
- adding encryption and a wider method of embedding (encompassing the entire image) would be fairly simple

There are many steganalysis tools that indicate an image may contain hidden data in the LSB (Least Significant Bit), but my intention was to demonstrate a basic version of security through obscurity. To be honest I was watching an episode of Blindspot where steganography was mentioned and decided to try it myself.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Sat Nov 21, 2015 11:38 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Thu Nov 19, 2015 7:03 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
Updated: added the option of embedding multiple files into a single image.
- display image is now updated to match changes to the imbedded image (useful for noticing distortions)

Included is a TrackBar Gadget that allows you to change the bit-section you want to store the file into.
- also used to select the file you want to extract

You'll notice the deeper you move up the bit-latter the more noticeable the embedding.
- try adding an embedded file to bit position 7 to see the full (distortion) effect

NB*: Update also includes numerous changes and improvements.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Sat Nov 21, 2015 1:17 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
Updated:
- added compression to the embedded file (both original and compressed file sizes are displayed)
- spread out the embedded pixels to the entire image
- added a context menu (right-mouse-click image to open)
- added a "Reset Image" button to remove recently embedded information
- added a bit indicator showing used and current bits
- optimized and improved the main algorithms

* Previously an embedded file name was truncated to 48 characters, but has been reduced to 24 characters.

One of the biggest changes to the code from the previous version is a fix to the amount of space available to embed information.
- previously only 20% of an images space was available, restricting the allowed size of an embedded file
- the addition of compression allows for larger embedded files and better security against steganalysis tools

Using the context menu or double-clicking the image opens it in the default viewer allowing for closer examination.
- the image is saved to the temp folder as a JPEG to destroy any embedded information

To better view the spread of pixels embed a file into bit-position 7, then either double-click the image or use the context menu to open it in the default viewer.
- the context menu also includes the functionality of the various buttons

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Sun Jan 03, 2016 3:30 am, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Sat Nov 21, 2015 9:59 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
Updated:
- added an additional button / context menu item: Extract All
-- duplicate files will be overridden without warning (does not apply to Extract File)

NB*: Update also includes a fix to the context menu and a few cosmetic changes.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Sun Nov 22, 2015 6:38 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Sun Nov 22, 2015 9:27 am 
Offline
Addict
Addict

Joined: Sat Mar 02, 2013 9:17 am
Posts: 931
It looking now very good.
Except for two things.
The pictures have a start sequence and now a typical moire all over.

_________________
http://www.nachtoptik.de


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Sun Nov 22, 2015 5:40 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
Hi walbus,

Thank you for your comments and for taking the time to post them.

I see your point about the start sequence, but I believe the amount security is enhanced by a random spread of pixels compared to a uniform spread of pixels is insignificant against a professional steganalysis tool; used largely to determine by percentage if a file contains hidden data, but not what is hidden.
wikipedia.org wrote:
...
many simple steganographic systems simply modify the least-significant bit (LSB) of a sample; this causes the modified samples to have not only different noise profiles than unmodified samples, but also for their LSBs to have different noise profiles than could be expected from analysis of their higher-order bits, which will still show some amount of noise.

NB*: My intention is not to create a complete steganography tool, but to provide the forum a method for creating their own.

--------------------------------------------------------------

Updated:
- added encryption to the header information (algorthiums taken from my post: Services, Stuff, and Shellhook)
- fixed some minor issues including various cosmetic changes
- embedded filenames are now truncated to 32 characters

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Tue Feb 27, 2018 5:18 am, edited 4 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Sun Nov 22, 2015 6:59 pm 
Offline
Addict
Addict

Joined: Sat Mar 02, 2013 9:17 am
Posts: 931
Many thanks JHPJHP,
you have maked a very good thing.

You want see patterns or moires, use a simple way.

Make a white picture, now increase the contrast and change the brightness.
Repeat this often.

This is very helpfull for debugging and optimization.

My way is, i make a container.
To time i include one hidden file.
But is it simple for making automatic a ZIP container for including in the picture,
or i use my File Merge function automatic before.

My way is :
I make a empty space, fits of maximum hidding size in the image.
But important, the space for the content with a padding divisible by 16 , minus 16.
I fill the rest with randoms.
Now you always know how big your container is.
Now copy all content in this container.
You can or must now (very simple) including in the container all what you want - Size of content, a hash from the content for a automatic authentication.
Now encrypt this divisible by 16 container with AES.
The litle rest are randoms, it looking same as the container.
Now you have a exactly in your image matching container, consisting only of white noise.
All patterns and moires, headers or extenders are gone.
For decrypt all, now extract simple your container from the picture and make a AES decrypting from it.
Extract then your content from the container (ZIP file or/and all other)
This size is now simple, also the content, including paths and all over.

Best regards Werner

_________________
http://www.nachtoptik.de


Top
 Profile  
Reply with quote  
 Post subject: Re: LSB (Least Significant Bit) File Embedding
PostPosted: Sun Nov 22, 2015 10:57 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1595
Hi walbus,

Thank you for the information, your methods are very smart.

-------------------------------------------------------

Updated:
- fixed a couple calculations
-- minimum image size is no longer restricted by width / height
-- embedded file spread is more accurately calculated to fill the entire image
-- text area information better represents the available file sizes

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 46 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


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

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye