{"id":1128,"date":"2013-02-24T19:06:33","date_gmt":"2013-02-24T17:06:33","guid":{"rendered":"http:\/\/saisa.eu\/blogs\/Guidance\/?p=1128"},"modified":"2013-02-24T19:25:20","modified_gmt":"2013-02-24T17:25:20","slug":"using-imagemagick-to-reveal-existence-of-hidden-steganographic-messages-with-diy-im-simplegui-tool","status":"publish","type":"post","link":"https:\/\/saisa.eu\/blogs\/Guidance\/?p=1128","title":{"rendered":"Using ImageMagick to reveal existence of hidden steganographic messages with DIY IM-simpleGUI tool"},"content":{"rendered":"<p><strong>Tools used<\/strong><\/p>\n<p><a href=\"http:\/\/www.imagemagick.org\/script\/index.php\">ImageMagick<\/a> is a powerfull CLI tool for image processing. For different <a href=\"http:\/\/www.imagemagick.org\/script\/command-line-tools.php\">commands<\/a>, see their www pages. The following commands are used in this blog:<\/p>\n<ul>\n<li>\n<div>compare<\/div>\n<\/li>\n<li>\n<div>convert<\/div>\n<\/li>\n<li>\n<div>montage<\/div>\n<\/li>\n<\/ul>\n<p>In addition ImageMagick contains image filters like Laplacian (<a href=\"http:\/\/www.imagemagick.org\/Usage\/convolve\/#laplacian\">IM<\/a>, <a href=\"http:\/\/en.wikipedia.org\/wiki\/Laplace_operator\">wikipedia<\/a>), Sobel (<a href=\"http:\/\/www.imagemagick.org\/Usage\/convolve\/#sobel\">IM<\/a>, <a href=\"http:\/\/en.wikipedia.org\/wiki\/Sobel_operator\">wikipedia<\/a>) and Prewitt (<a href=\"http:\/\/www.imagemagick.org\/Usage\/convolve\/#prewitt\">IM<\/a>, <a href=\"http:\/\/en.wikipedia.org\/wiki\/Prewitt_operator\">wikipedia<\/a>). These filters are also used in <a href=\"http:\/\/en.wikipedia.org\/wiki\/Steganography\">steganography<\/a>.<\/p>\n<p>The hidden, secret, messages are embedded into the original PNG image by using some selected <a href=\"http:\/\/en.wikipedia.org\/wiki\/Steganography_tools\">steganographic tools<\/a>:<\/p>\n<ul>\n<li>\n<div><a href=\"http:\/\/diit.sourceforge.net\/\">Digital Invisible Ink Toolkit<\/a><\/div>\n<\/li>\n<li>\n<div><a href=\"http:\/\/sourceforge.net\/projects\/openstego\">OpenStego<\/a><\/div>\n<\/li>\n<li>\n<div><a href=\"http:\/\/stegj.sourceforge.net\/\">StegJ<\/a><\/div>\n<\/li>\n<\/ul>\n<p>ImageMagick contains features to detect edges and to compare images, so it could be used to visualize how the secrect data is distributed over the image. (Naturally <a title=\"FileVerifier++ and Karen\u2019s Hasher, GUI Tools for fingerprinting your files with SHA-512\" href=\"http:\/\/saisa.eu\/blogs\/Guidance\/?p=1088\">hash comparisons<\/a> would indicated differences, but without showing where they are located)<\/p>\n<p>Command line interface is practical for batch processing. However, for casual interactive testing, a GUI alternative can be comfortable. A simple GUI for ImageMagick can be done by <a title=\"Autoit, Tool for automating GUI tasks\" href=\"http:\/\/saisa.eu\/blogs\/Guidance\/?p=33\">AutoIt<\/a>. The screenshot below shows the GUI made for this particular purpose.<\/p>\n<blockquote>\n<p><img loading=\"lazy\" alt=\"IM-simpleGUI\" src=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2013\/02\/im-simplegui-12.png\" width=\"366\" height=\"328\" \/><\/p>\n<\/blockquote>\n<p>&nbsp;<\/p>\n<p><strong>Input Files<\/strong><\/p>\n<p>Original image is the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Lenna\">Lenna<\/a> 512*512 photo. The photo is widely used test image for processing algorithms.<\/p>\n<p>Files hidden inside the lenna picture:<\/p>\n<ul>\n<li>\n<div>short.txt<\/div>\n<\/li>\n<li style=\"LIST-STYLE-TYPE: none\">\n<ul>\n<li>\n<div>862 bytes<\/div>\n<\/li>\n<li>\n<div>text extract from <a href=\"http:\/\/en.wikipedia.org\/wiki\/Lenna\">Lenna<\/a> at wikipedia<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<div>Lenna in Wikipedia.pdf<\/div>\n<\/li>\n<li style=\"LIST-STYLE-TYPE: none\">\n<ul>\n<li>\n<div>62 482 bytes<\/div>\n<\/li>\n<li>\n<div>pdf printout from <a href=\"http:\/\/en.wikipedia.org\/wiki\/Lenna\">Lenna<\/a> at wikipedia<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<div>sparky2012.png<\/div>\n<\/li>\n<li style=\"LIST-STYLE-TYPE: none\">\n<ul>\n<li>\n<div>183 125 bytes<\/div>\n<\/li>\n<li>\n<div>photo used in earlier <a title=\"Protecting your work by timestamping your file fingerprints\" href=\"http:\/\/saisa.eu\/blogs\/Guidance\/?p=1097\">blog<\/a><\/div>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>Result examples<\/strong><\/p>\n<p>Case 1 Applying filter for edge detection.<\/p>\n<blockquote>\n<p>The images are: original and the applied Laplacian filter.<\/p>\n<\/blockquote>\n<blockquote>\n<p><a href=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2013\/02\/lenna-laplace-concatenated1.png\"><img loading=\"lazy\" alt=\"Lenna-laplace-concatenated\" src=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2013\/02\/lenna-laplace-concatenated-small2.png\" width=\"258\" height=\"516\" \/><\/a><\/p>\n<\/blockquote>\n<p>Case 2 Hidden Message<\/p>\n<blockquote>\n<p>File short.txt is encrypted and hidden in original image, starting from the top. The images are: original, modified and the differences. In the differences image, it is visible that only the top part if affected, and the rest of the image is unchanged.<\/p>\n<p><a href=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2013\/02\/lenna-short-diit-blindhide-concatenated1.png\"><img loading=\"lazy\" alt=\"Lenna-short-DIIT-BlindHide-concatenated\" src=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2013\/02\/lenna-short-diit-blindhide-concatenated-small2.png\" width=\"258\" height=\"774\" \/><\/a><\/p>\n<\/blockquote>\n<p>&nbsp;<\/p>\n<p>Case 3 Hidden Message<\/p>\n<blockquote>\n<p>File &#8220;Lenna in Wikipedia.pdf&#8221; is encrypted and hidden in original image using the Sobel filter. The images are: original, modified and the differences. In the differences image, it is visible that the changed pixels (white) are concentrated at the edges.<\/p>\n<p><a href=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2013\/02\/lenna-wikipedia-diit-sobel1.png\"><img loading=\"lazy\" alt=\"Lenna-wikipedia-DIIT-sobel\" src=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2013\/02\/lenna-wikipedia-diit-sobel-small2.png\" width=\"258\" height=\"774\" \/><\/a><\/p>\n<\/p>\n<\/blockquote>\n<p><strong>IM-simpleGUI tool<\/strong><\/p>\n<p>The source code is included in the <a href=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2013\/02\/im-simplegui2.zip\">IM-simpleGUI.zip<\/a> package (<a href=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2013\/02\/im-simplegui.sha5121.txt\">hash<\/a> by <a href=\"http:\/\/saisa.eu\/blogs\/Guidance\/?p=1088\">FileVerifier++<\/a>):<\/p>\n<ul>\n<li>favicon.ico: icon for the GUI<\/li>\n<li>IM-simpleGUI.au3: the AutoIt based source code<\/li>\n<li>IM-simpleGUI.exe: the executable compiled by AutoIt tools<\/li>\n<li>IM-simpleGUI.ini: the main configuration file for the GUI<\/li>\n<\/ul>\n<p>The tool is provided for learning purposes. It is kind of minimal example on how to develop a GUI for CLI tool.<\/p>\n<p><a href=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2013\/02\/im-simplegui-ineditor.png\"><img loading=\"lazy\" alt=\"IM-simpleGUI-ineditor\" src=\"http:\/\/saisa.eu\/blogs\/Guidance\/wp-content\/uploads\/2013\/02\/im-simplegui-ineditor-small2.png\" width=\"450\" height=\"389\" \/><\/a><\/p>\n<p>The source code contains example on howto:<\/p>\n<ul>\n<li>use ini configuration file<\/li>\n<li>define tooltip for controls<\/li>\n<li>define menu structure<\/li>\n<li>select file<\/li>\n<li>define tool icon for the GUI<\/li>\n<li>execute command and capture command output<\/li>\n<li>use a function<\/li>\n<li>use console printout for debugging<\/li>\n<\/ul>\n<p>Example of the Imagemagick commands used in the tool are: (for details, please see source code)<\/p>\n<div style=\"WIDTH: 650px; HEIGHT: 100px; OVERFLOW: auto\">\n<pre>\n<br \/>compare -verbose -metric ae -compose Src -highlight-color White -lowlight-color Black C:\\lenna\\Lenna-orig-wikipedia.png C:\\lenna\\Lenna-sparky-openstego-random.png C:\\lenna\\Lenna-sparky-openstego-differences.png\n<br \/>C:\\Windows\\system32\\cmd.exe \/c convert C:\\lenna\\Lenna-orig-wikipedia.png -define convolve:scale='!' -bias 50% -morphology Convolve Laplacian:1 C:\\lenna\\Lenna-sparky-openstego-differences.png\n<br \/>C:\\Windows\\system32\\cmd.exe \/c convert C:\\lenna\\Lenna-orig-wikipedia.png -define convolve:scale='50%!' -bias 50% -morphology Convolve Sobel C:\\lenna\\Lenna-sparky-openstego-differences.png\n<br \/>C:\\Windows\\system32\\cmd.exe \/c convert C:\\lenna\\Lenna-orig-wikipedia.png -define convolve:scale='!' -bias 50% -morphology Convolve Prewitt C:\\lenna\\Lenna-sparky-openstego-differences.png\n<\/pre>\n<\/div>\n<p>Note, The tool is provided in order for any modifications and learning. As it is, no support&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tools used ImageMagick is a powerfull CLI tool for image processing. For different commands, see their www pages. The following commands are used in this blog: compare convert montage In addition ImageMagick contains image filters like Laplacian (IM, wikipedia), Sobel &hellip; <a href=\"https:\/\/saisa.eu\/blogs\/Guidance\/?p=1128\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17,18,68,6,44,51,10],"tags":[],"_links":{"self":[{"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=\/wp\/v2\/posts\/1128"}],"collection":[{"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1128"}],"version-history":[{"count":2,"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=\/wp\/v2\/posts\/1128\/revisions"}],"predecessor-version":[{"id":1132,"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=\/wp\/v2\/posts\/1128\/revisions\/1132"}],"wp:attachment":[{"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/saisa.eu\/blogs\/Guidance\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}