added StegoSaurus plugin,

Stegosaurus 1.0 is a tool to perform steganography on 24-bit BMP files.
Use this to hide and recover any type of file to and from a selected BMP image, without altering the original size of the image

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1291 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2009-06-08 12:46:41 +00:00
parent 3d6697e28b
commit 6001db3188
19 changed files with 2834 additions and 0 deletions

View File

@ -0,0 +1,110 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource1.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) (unknown sub-lang: 0x10) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENN)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, 0x10
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource1.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "stegosaurus.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "400904b0"
BEGIN
VALUE "FileDescription", "StegoSaurus Exe"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "StegoSaurus"
VALUE "LegalCopyright", "Copyright (C) 2009"
VALUE "OriginalFilename", "StegoSaurus.exe"
VALUE "ProductName", "StegoSaurus"
VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x4009, 1200
END
END
#endif // English (U.S.) (unknown sub-lang: 0x10) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,469 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="StegoSaurus"
ProjectGUID="{D796CCD0-452E-4BB6-BA1B-CD24C40AB361}"
RootNamespace="StegoSaurus"
Keyword="Qt4VSv1.0"
TargetFrameworkVersion="0"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui"
PreprocessorDefinitions="UNICODE,WIN32,QT_THREAD_SUPPORT,QT_NO_DEBUG,NDEBUG,QT_CORE_LIB,QT_GUI_LIB"
RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="false"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies=" qtmain.lib QtCore4.lib QtGui4.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalLibraryDirectories="$(QTDIR)\lib"
GenerateDebugInformation="false"
SubSystem="2"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui"
PreprocessorDefinitions="UNICODE,WIN32,QT_THREAD_SUPPORT,QT_CORE_LIB,QT_GUI_LIB"
RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies=" qtmaind.lib QtCored4.lib QtGuid4.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalLibraryDirectories="$(QTDIR)\lib"
GenerateDebugInformation="true"
SubSystem="2"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;cxx;c;def"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath=".\stegosaurus.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\resource.h"
>
</File>
<File
RelativePath=".\resource1.h"
>
</File>
<File
RelativePath=".\stegosaurus.h"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Moc&apos;ing stegosaurus.h..."
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -DUNICODE -DWIN32 -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -I&quot;.\GeneratedFiles\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;.\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; &quot;.\stegosaurus.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_stegosaurus.cpp&quot;&#x0D;&#x0A;"
AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;.\stegosaurus.h"
Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_stegosaurus.cpp&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Moc&apos;ing stegosaurus.h..."
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -DUNICODE -DWIN32 -DQT_THREAD_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB -I&quot;.\GeneratedFiles\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;.\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; &quot;.\stegosaurus.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_stegosaurus.cpp&quot;&#x0D;&#x0A;"
AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;.\stegosaurus.h"
Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_stegosaurus.cpp&quot;"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Form Files"
Filter="ui"
UniqueIdentifier="{99349809-55BA-4b9d-BF79-8FDBB0286EB3}"
>
<File
RelativePath=".\stegosaurus.ui"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Uic&apos;ing $(InputPath)..."
CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_stegosaurus.h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="$(QTDIR)\bin\uic.exe"
Outputs="&quot;.\GeneratedFiles\ui_stegosaurus.h&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Uic&apos;ing $(InputPath)..."
CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_stegosaurus.h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="$(QTDIR)\bin\uic.exe"
Outputs="&quot;.\GeneratedFiles\ui_stegosaurus.h&quot;"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="qrc;*"
UniqueIdentifier="{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}"
ParseFiles="false"
>
<File
RelativePath=".\images\stegosaurus-128x128.png"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\images\stegosaurus-16x16.png"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\images\stegosaurus-256x256.png"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\Icons\stegosaurus-256x256.png"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\images\stegosaurus-32x32.png"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\images\stegosaurus-48x48.png"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\stegosaurus.qrc"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Rcc&apos;ing stegosaurus.qrc..."
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -name &quot;stegosaurus&quot; -no-compress &quot;.\stegosaurus.qrc&quot; -o .\GeneratedFiles\qrc_stegosaurus.cpp&#x0D;&#x0A;"
AdditionalDependencies=".\stegosaurus.qrc;.\images\stegosaurus-128x128.png;.\images\stegosaurus-16x16.png;.\images\stegosaurus-256x256.png;.\images\stegosaurus-32x32.png;.\images\stegosaurus-48x48.png"
Outputs=".\GeneratedFiles\qrc_stegosaurus.cpp"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Rcc&apos;ing stegosaurus.qrc..."
CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -name &quot;stegosaurus&quot; -no-compress &quot;.\stegosaurus.qrc&quot; -o .\GeneratedFiles\qrc_stegosaurus.cpp&#x0D;&#x0A;"
AdditionalDependencies=".\stegosaurus.qrc;.\images\stegosaurus-128x128.png;.\images\stegosaurus-16x16.png;.\images\stegosaurus-256x256.png;.\images\stegosaurus-32x32.png;.\images\stegosaurus-48x48.png"
Outputs=".\GeneratedFiles\qrc_stegosaurus.cpp"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Generated Files"
Filter="moc;h;cpp"
UniqueIdentifier="{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}"
SourceControlFiles="false"
>
<File
RelativePath=".\GeneratedFiles\Debug\moc_stegosaurus.cpp"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\GeneratedFiles\Release\moc_stegosaurus.cpp"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\GeneratedFiles\qrc_stegosaurus.cpp"
>
</File>
<File
RelativePath=".\GeneratedFiles\ui_stegosaurus.h"
>
</File>
</Filter>
<File
RelativePath=".\icon2.ico"
>
</File>
<File
RelativePath=".\stegosaurus.ico"
>
</File>
<File
RelativePath=".\StegoSaurus.rc"
>
</File>
</Files>
<Globals>
<Global
Name="MocDir"
Value=".\GeneratedFiles\$(ConfigurationName)"
/>
<Global
Name="QtVersion"
Value="4.4.3"
/>
<Global
Name="RccDir"
Value=".\GeneratedFiles"
/>
<Global
Name="UicDir"
Value=".\GeneratedFiles"
/>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,32 @@
//#include <QApplication>
//#include <QString>
//#include <QPushButton>
#include "StegoSaurusPlugin.h"
#include "stegosaurus.h"
QString
StegoSaurusPlugin::pluginDescription() const
{
QString res;
res = "a StegoSaurus plugin" ;
return res;
}
QString
StegoSaurusPlugin::pluginName() const
{
return "StegoSaurus" ;
}
QWidget*
StegoSaurusPlugin::pluginWidget(QWidget * parent )
{
StegoSaurus* window = new StegoSaurus(parent);
return window;
}
Q_EXPORT_PLUGIN2(stegosaurus_plugin, StegoSaurusPlugin)

View File

@ -0,0 +1,27 @@
#ifndef _STEGOSAURUS_PLUGIN_H_
#define _STEGOSAURUS_PLUGIN_H_
#include <QObject>
#include <QString>
#include <QWidget>
#include <PluginInterface.h>
#include <QDebug>
class StegoSaurusPlugin: public QObject, public PluginInterface
{
Q_OBJECT
Q_INTERFACES(PluginInterface)
public slots:
virtual QString pluginDescription() const ;
virtual QString pluginName() const ;
virtual QWidget* pluginWidget(QWidget * parent = 0) ;
};
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -0,0 +1,15 @@
/****************************************************************************
***************************Author: Agnit Sarkar******************************
**************************CopyRight: April 2009******************************
********************* Email: agnitsarkar@yahoo.co.uk*************************
****************************************************************************/
#include <QtGui/QApplication>
#include "stegosaurus.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
StegoSaurus w;
w.show();
return a.exec();
}

View File

@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by StegoSaurus.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -0,0 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by StegoSaurus.rc
//
#define IDI_ICON1 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -0,0 +1,453 @@
/****************************************************************************
***************************Author: Agnit Sarkar******************************
**************************CopyRight: April 2009******************************
********************* Email: agnitsarkar@yahoo.co.uk*************************
****************************************************************************/
#include "stegosaurus.h"
StegoSaurus::StegoSaurus(QWidget *parent, Qt::WFlags flags)
: QDialog(parent, flags)
{
ui.setupUi(this);
setWindowOpacity(0.5);
bitsAvailable=0;
sizeofData=0;
inputFileSize=0;
}
StegoSaurus::~StegoSaurus()
{
}
void StegoSaurus::on_btnDryImg_clicked()
{
static QString srcImgFileName="/home/";
srcImgFileName= QFileDialog::getOpenFileName(this, "Open Bitmap", srcImgFileName, "Bitmap Files(*.bmp)");
if(srcImgFileName.isEmpty()){
ui.lblDryImgDisplay->setText("<h2>Drag Image Here<br><br>OR<br><br>Select it by browsing<br><br>(BMP Images only)</h2>");
ui.lblDryImgDisplay->setPixmap(QPixmap(":/StegoSaurus/images/stegosaurus-256x256.png"));
bitsAvailable=0;
ui.txtDryImg->setText("");
ui.lblDryImgInfo->setText("No image Loaded");
return;
}
setDryImage(srcImgFileName);
}
void StegoSaurus::on_btnFiletoHide_clicked()
{
static QString srcFileName="/home/";
srcFileName= QFileDialog::getOpenFileName(this, "Open file to hide", srcFileName);
if(srcFileName.isEmpty()){
inputFileSize=0;
ui.txtFiletoHide->setText("");
ui.lblFiletoHideinfo->setText("No file loaded");
return;
}
//Get File information
QFileInfo fi= QFileInfo(srcFileName);
inputFileSize= fi.size();
ui.txtFiletoHide->setText(srcFileName);
ui.lblFiletoHideinfo->setText(QString("Size=%L1 bytes").arg(inputFileSize));
}
void StegoSaurus::resizeEvent(QResizeEvent * event)
{
//Set the label image
if(ui.txtDryImg->text().isEmpty())
return;
QPixmap pixmap(ui.txtDryImg->text());
pixmap= pixmap.scaledToHeight(ui.lblDryImgDisplay->height());
ui.lblDryImgDisplay->setPixmap(pixmap);
QPixmap pixmap2(ui.txtWetImg->text());
pixmap2= pixmap2.scaledToHeight(ui.lblWetImgDisplay->height());
ui.lblWetImgDisplay->setPixmap(pixmap2);
}
void StegoSaurus::on_btnWetImg_clicked()
{
static QString srcImgFileName="/home/";
srcImgFileName= QFileDialog::getOpenFileName(this, "Open Bitmap", srcImgFileName, "Bitmap Files(*.bmp)");
if(srcImgFileName.isEmpty()){
ui.lblWetImgDisplay->setText("<h2>Drag Image Here<br><br>OR<br><br>Select it by browsing<br><br>(BMP Images only)</h2>");
ui.lblWetImgDisplay->setPixmap(QPixmap(":/StegoSaurus/images/stegosaurus-256x256.png"));
ui.lblWetImgInfo->setText("No image loaded");
ui.txtWetImg->setText("");
sizeofData=0;
return;
}
setWetImage(srcImgFileName);
}
void StegoSaurus::setDryImage(const QString &srcImgFileName)
{
//Get file info
dryImage= new QImage(srcImgFileName);
unsigned int height= dryImage->height();
unsigned int width= dryImage->width();
int depth= dryImage->depth();
//Check the depth, and return if it is not 24-bit
if(depth<24){
QMessageBox::information(this, "StegoSaurus", "Must be 24-bit bitmap.");
ui.txtDryImg->setText("");
ui.lblDryImgInfo->setText("No image Loaded");
return;
}
//Set the label image
QPixmap pixmap(srcImgFileName);
pixmap= pixmap.scaledToHeight(ui.lblDryImgDisplay->height());
ui.lblDryImgDisplay->setPixmap(pixmap);
bitsAvailable= height*width*3;
ui.txtDryImg->setText(srcImgFileName);
if(bitsAvailable){
ui.lblDryImgInfo->setText(QString("Height= %L1 Width=%L2 Free Space=%L3 bytes").arg(height)
.arg(width).arg(bitsAvailable/8));
}else{
ui.lblDryImgInfo->setText("No room for data");
qApp->beep();
}
}
void StegoSaurus::setWetImage(const QString &srcImgFileName)
{
//Get file info
wetImage= new QImage(srcImgFileName);
unsigned int height= wetImage->height();
unsigned int width= wetImage->width();
int depth= wetImage->depth();
//Check the depth, and return if it is not 24-bit
if(depth<24){
QMessageBox::information(this, "StegoSaurus", "Must be 24-bit bitmap.");
ui.txtWetImg->setText("");
ui.lblWetImgInfo->setText("No image Loaded");
return;
}
//Set the label image
QPixmap pixmap(srcImgFileName);
pixmap= pixmap.scaledToHeight(ui.lblWetImgDisplay->height());
ui.lblWetImgDisplay->setPixmap(pixmap);
//Read the size of the embeded data
QFile imgFile(srcImgFileName);
if (!imgFile.open(QIODevice::ReadOnly)){
QMessageBox::warning(this, "StegoSaurus", "Unable to open bitmap file.");
return;
}
if(imgFile.seek(6)){
imgFile.read((char *)&sizeofData, 4);
}else{
QMessageBox::warning(this, "StegoSaurus", "Unable to read bitmap file.");
return;
}
ui.txtWetImg->setText(srcImgFileName);
if(sizeofData){
ui.lblWetImgInfo->setText(QString("Height= %L1 Width=%L2 Probable Size of Data=%L3 bytes").arg(height)
.arg(width).arg(sizeofData));
}else{
ui.lblWetImgInfo->setText("No data in image.");
qApp->beep();
}
}
//The drag and drop methods
void StegoSaurus::dragEnterEvent(QDragEnterEvent *event)
{
if(ui.tabWidget->currentIndex()==2)return;
if (event->mimeData()->hasFormat("text/uri-list")){
QList<QUrl> urls = event->mimeData()->urls();
if (urls.isEmpty())
return;
QString fileName = urls.first().toLocalFile();
//Check the extension
if (fileName.isEmpty()||!fileName.endsWith(".bmp", Qt::CaseInsensitive))
return;
event->acceptProposedAction();
}
}
void StegoSaurus::dropEvent(QDropEvent *event)
{
QList<QUrl> urls = event->mimeData()->urls();
if (urls.isEmpty())
return;
QString fileName = urls.first().toLocalFile();
if (fileName.isEmpty())
return;
switch(ui.tabWidget->currentIndex()){
case 0:
setDryImage(fileName);
break;
case 1:
setWetImage(fileName);
break;
default:
break;
}
}
//The hide methods
void StegoSaurus::on_btnHide_clicked()
{
//Get the filenames
QString imgFileName= ui.txtDryImg->text();
QString inputFileName= ui.txtFiletoHide->text();
//Check if both image file and data file has been selected
if(imgFileName.isEmpty()||inputFileName.isEmpty()){
QMessageBox::information(this, "StegoSaurus", "Please select a bitmap image and a data file.");
return;
}
//Now check if size of the data file is less than that of the space available
if(inputFileSize*8>bitsAvailable){
QMessageBox::information(this, "StegoSaurus", "Not enough space available in image to hide the data.");
return;
}
static QString targetImgName="/home/";
targetImgName= QFileDialog::getSaveFileName(this, "Save bitmap with data to", targetImgName, "Bitmap Files(*.bmp)");
if(targetImgName.isEmpty())return;
//If an image file with the same name exists delete it and then copy, unless source and target are same
if(imgFileName!=inputFileName){
QFile::remove(targetImgName);
QFile::copy(imgFileName, targetImgName);
}
//Calculate the no. of padding bytes
unsigned int width= dryImage->width();
unsigned int padding=0;
if((width*3)%4==0)
padding=0;
unsigned int quotient= (width*3)/4;
padding= 4*(quotient+1)- width*3;
/////////////////////////////////Hide the data////////////////////////////////////////////
QFile inputFile(inputFileName);
if (!inputFile.open(QIODevice::ReadOnly)){
QMessageBox::warning(this, "StegoSaurus", "Unable to open data file for reading.");
return;
}
//Stamp the size of the data file to the reserved bytes of the image file
QFile imgOutputFile(targetImgName);
if (!imgOutputFile.open(QIODevice::ReadWrite)){
QMessageBox::warning(this, "StegoSaurus", "Unable to open bitmap file.");
return;
}
if(imgOutputFile.seek(6)){
imgOutputFile.write((char *)&inputFileSize, 4);
}else{
QMessageBox::warning(this, "StegoSaurus", "Unable to write to bitmap file.");
return;
}
//Read the dataoffset of the bitmap
unsigned int dataoffset=0;
if(imgOutputFile.seek(10)){
imgOutputFile.read((char *)&dataoffset, 4);
}else{
QMessageBox::warning(this, "StegoSaurus", "Unable to read bitmap file.");
return;
}
//Move by dataoffset bytes
if(!imgOutputFile.seek(dataoffset)){
QMessageBox::warning(this, "StegoSaurus", "Unable to read bitmap file.");
return;
}
QProgressDialog progress("Embedding Data", "Cancel", 0, inputFileSize, this);
progress.show();
unsigned int progresscount=0;
unsigned int countBytes=0;
while (!inputFile.atEnd()){
//Read a byte
unsigned char dataByte=0;
inputFile.getChar((char *)&dataByte);
//Store each bit of the data byte in 1 byte of the image pixel
//starting with the MSB
for(int i=7; i>=0; i--){
//Get the bit at position i in the data byte
unsigned char checkByte= 0x01;
checkByte= checkByte<<i;
unsigned char dataBit=(dataByte & checkByte)>>i;
unsigned char imageByte=0;
//To ignore the padding bytes
if(countBytes>=width*3){
countBytes= 0;
//Advance the read pointer
for(int j=0; j<padding; j++){
imgOutputFile.getChar((char *)&imageByte);
}
}
//Get a pixel byte from the bitmap
imgOutputFile.getChar((char *)&imageByte);
//Get the LSB
checkByte= imageByte & 0x01;
//Check if the databit and the LSB is different
if(dataBit!=checkByte){
//Alter the LSB to the databit
if(dataBit){
//If 1 set the LSB
imageByte= imageByte | 0x01;
}else{
//Reset the LSB
imageByte= imageByte & 0xFE;
}
//Get the current pointer position
int pos= imgOutputFile.pos();
//Put it back by 1 byte to write the current byte
if(!imgOutputFile.seek(pos-1)){
QMessageBox::warning(this, "StegoSaurus", "Unable to read bitmap file.");
return;
}
//Write the byte
imgOutputFile.putChar(imageByte);
}
countBytes++;
}
progresscount++;
progress.setValue(progresscount);
if (progress.wasCanceled()){
QMessageBox::warning(this, "StegoSaurus", "Operation Aborted.");
imgOutputFile.close();
inputFile.close();
return;
}
}
progress.hide();
//Close the files
imgOutputFile.close();
inputFile.close();
QMessageBox::information(this, "StegoSaurus", "Data Embedded Successfully.");
}
//The recover methods
void StegoSaurus::on_btnRecover_clicked()
{
//Get the filename
QString imgFileName= ui.txtWetImg->text();
//Check image file has been selected
if(imgFileName.isEmpty()){
QMessageBox::information(this, "StegoSaurus", "Please select a bitmap image.");
return;
}
static QString targetFileName="/home/";
targetFileName= QFileDialog::getSaveFileName(this, "Save recovered data to", targetFileName, "All Files(*.*)");
if(targetFileName.isEmpty())return;
//If a file with the same name exists delete it
QFile::remove(targetFileName);
//Calculate the no. of padding bytes
unsigned int width= wetImage->width();
unsigned int padding=0;
if((width*3)%4==0)
padding=0;
unsigned int quotient= (width*3)/4;
padding= 4*(quotient+1)- width*3;
/////////////////////////////////Recover the data////////////////////////////////////////////
QFile targetFile(targetFileName);
if (!targetFile.open(QIODevice::WriteOnly)){
QMessageBox::warning(this, "StegoSaurus", "Unable to open data file.");
return;
}
QFile imgInputFile(imgFileName);
if (!imgInputFile.open(QIODevice::ReadOnly)){
QMessageBox::warning(this, "StegoSaurus", "Unable to open bitmap file.");
return;
}
//Read the dataoffset of the bitmap
unsigned int dataoffset=0;
if(imgInputFile.seek(10)){
imgInputFile.read((char *)&dataoffset, 4);
}else{
QMessageBox::warning(this, "StegoSaurus", "Unable to read bitmap file.");
return;
}
//Move by dataoffset bytes
if(!imgInputFile.seek(dataoffset)){
QMessageBox::warning(this, "StegoSaurus", "Unable to read bitmap file.");
return;
}
QProgressDialog progress("Recovering Data", "Cancel", 0, sizeofData, this);
progress.show();
unsigned int progresscount=0;
unsigned int countBytes=0;
//Iterate to recover targetFileSize bytes
for(unsigned int byteNo= 0; byteNo< sizeofData; byteNo++){
//construct each byte
unsigned char dataByte= 0x00;
for(int bitNo=7; bitNo>=0; bitNo--){
unsigned char imageByte=0xFF;
//To ignore the padding bytes
if(countBytes>=width*3){
countBytes= 0;
//Advance the read pointer
for(int j=0; j<padding; j++){
imgInputFile.getChar((char *)&imageByte);
}
}
//Read a byte from the bitmap file
imgInputFile.getChar((char *)&imageByte);
countBytes++;
//Get the LSB
unsigned char dataBit= imageByte & 0x01;
//Set the bit in data byte at bitNo position if databit is set
if(dataBit){
unsigned char tempByte= 0x01;
dataByte= dataByte | (tempByte<<bitNo);
}
}
//Write the byte
targetFile.putChar(dataByte);
//Update the progressbar
progresscount++;
progress.setValue(progresscount);
if (progress.wasCanceled()){
QMessageBox::warning(this, "StegoSaurus", "Operation Aborted.");
imgInputFile.close();
targetFile.close();
return;
}
}
progress.hide();
//Close the files
targetFile.close();
imgInputFile.close();
QMessageBox::information(this, "StegoSaurus", "Data Recovery Successful.");
}

View File

@ -0,0 +1,45 @@
/****************************************************************************
***************************Author: Agnit Sarkar******************************
**************************CopyRight: April 2009******************************
********************* Email: agnitsarkar@yahoo.co.uk*************************
****************************************************************************/
#ifndef STEGOSAURUS_H
#define STEGOSAURUS_H
#include <QtGui>
#include "ui_stegosaurus.h"
class StegoSaurus : public QDialog
{
Q_OBJECT
public:
StegoSaurus(QWidget *parent = 0, Qt::WFlags flags = 0);
~StegoSaurus();
protected:
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
private:
void resizeEvent ( QResizeEvent *);
Ui::StegoSaurusClass ui;
QImage *dryImage, *wetImage;
unsigned int bitsAvailable, inputFileSize, sizeofData;
void setDryImage(const QString &);
void setWetImage(const QString &);
private slots:
void on_btnWetImg_clicked();
void on_btnFiletoHide_clicked();
void on_btnDryImg_clicked();
//The hide method
void on_btnHide_clicked();
//The recover method
void on_btnRecover_clicked();
};
#endif // STEGOSAURUS_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -0,0 +1,9 @@
<RCC>
<qresource prefix="/StegoSaurus" >
<file>images/stegosaurus-128x128.png</file>
<file>images/stegosaurus-16x16.png</file>
<file>images/stegosaurus-256x256.png</file>
<file>images/stegosaurus-32x32.png</file>
<file>images/stegosaurus-48x48.png</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
#=== this part is common (similar) for all plugin projects =====================
TEMPLATE = lib
CONFIG += plugin release
# this is directory, where PluginInterface.h is located
INCLUDEPATH += ../
# and, the result (*.so or *.dll) should appear in this directory
DESTDIR = ../bin
OBJECTS_DIR = temp/obj
RCC_DIR = temp/qrc
UI_DIR = temp/ui
MOC_DIR = temp/moc
# the name of the result file;
TARGET = $$qtLibraryTarget(stegosaurus_plugin)
HEADERS += ../PluginInterface.h \
StegoSaurusPlugin.h
SOURCES += StegoSaurusPlugin.cpp
#===============================================================================
# Input
HEADERS += resource.h resource1.h stegosaurus.h
FORMS += stegosaurus.ui
SOURCES += main.cpp stegosaurus.cpp
RESOURCES += stegosaurus.qrc