Thursday, May 13, 2010

Steganography .net source code download

Steganography project developed in .net language and this project will help you hide you personal data inside an image like an encryption with password protected and also you can view the personal data when you decrypt the image along with your sender password.

To download this project click here

Public Class Form1

Dim PicBuffer As System.IO.FileInfo

Private Sub openPic_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles openPic.FileOk

PictureBox1.Image = Image.FromFile(openPic.FileName)

PicBuffer = New System.IO.FileInfo(openPic.FileName)

ResizeFileName(openPic.FileName, PicBuffer.Name)

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Dim Ready As Boolean = True

Dim PicFileStream As System.IO.FileStream

Try

PicFileStream = PicBuffer.OpenRead

Catch ex As Exception

Ready = False

MsgBox("Please Load A Picture Before Clicking This Button", MsgBoxStyle.Critical, "Error")

End Try

If Ready = True Then

Dim pass As String

Dim PicBytes As Long = PicFileStream.Length

Dim PicExt As String = PicBuffer.Extension

Dim PicByteArray(PicBytes) As Byte

PicFileStream.Read(PicByteArray, 0, PicBytes)

Dim SentinelString() As Byte = {73, 116, 83, 116, 97, 114, 116, 115, 72, 101, 114, 101}

If RadioButton1.Checked = True Then

pass = InputBox("Enter Password To Be More Secure", "Password Prompt")

If (pass = "welcome") Then

Dim PlainText As String = TextBox1.Text

Dim PlainTextByteArray(PlainText.Length) As Byte

For i As Integer = 0 To (PlainText.Length - 1)

PlainTextByteArray(i) = CByte(AscW(PlainText.Chars(i)))

Application.DoEvents()

Next

Dim PicAndText(PicBytes + PlainText.Length + SentinelString.Length) As Byte

For t As Long = 0 To (PicBytes - 1)

PicAndText(t) = PicByteArray(t)

Next

Dim count As Integer = 0

For r As Long = PicBytes To (PicBytes + (SentinelString.Length) - 1)

PicAndText(r) = SentinelString(count)

count += 1

Next

count = 0

For q As Long = (PicBytes + SentinelString.Length) To (PicBytes + SentinelString.Length + PlainText.Length - 1)

PicAndText(q) = PlainTextByteArray(count)

count += 1

Next

buildPic.ShowDialog()

Dim NewFileName As String = buildPic.FileName

My.Computer.FileSystem.WriteAllBytes(NewFileName, PicAndText, False)

Else

MsgBox("Wrong Password")

End If

ElseIf RadioButton2.Checked Then

pass = InputBox("Enter Password To Be More Secure", "Password Prompt")

If (pass = "welcome") Then

TextBox3.Clear()

Dim OutterSearch, InnerSearch, StopSearch As Boolean

OutterSearch = True

InnerSearch = True

StopSearch = False

Dim count As Long = 0

Dim leftCounter As Long

Dim rightCounter As Integer

leftCounter = 0

rightCounter = 0

Do While (count < (PicBytes - SentinelString.Length) And StopSearch = False)

If (PicByteArray(count) = SentinelString(0)) Then

leftCounter = count + 1

rightCounter = 1

InnerSearch = True

Do While (InnerSearch = True) And (rightCounter <>

And (leftCounter <>

If (PicByteArray(leftCounter) = SentinelString(rightCounter)) Then

rightCounter += 1

leftCounter += 1

If (rightCounter = (SentinelString.Length - 1)) Then

StopSearch = True

End If

Else

InnerSearch = False

count += 1

End If

Loop

Else

count += 1

End If

Loop

If StopSearch = True Then

'leftCounter contains the starting string that is being retrieved

Do While (leftCounter <>

'Bytes need to be converted to an integer

'then to an unicode character which will be the plaintext

TextBox3.AppendText(ChrW(CInt(PicByteArray(leftCounter))))

leftCounter += 1

Loop

Else

TextBox3.Text = "The Picture does not contain any text"

End If

Else

MsgBox("Wrong Password")

End If

End If

End If

End Sub

Sub ResizeFileName(ByVal LongFileName As String, ByVal ShortFileName As String)

If LongFileName.Length > 71 Then

Dim LongFileNameSize As Integer = LongFileName.Length

Dim ShortFileNameSize As Integer = ShortFileName.Length

Dim Cut As Integer = 71 - (5 + ShortFileNameSize)

Dim i As Integer

TextBox2.Clear()

For i = 0 To (Cut) - 1

TextBox2.AppendText(LongFileName.Chars(i))

Next

For i = 0 To 4

TextBox2.AppendText(".")

Next

For i = 0 To (ShortFileNameSize - 1)

TextBox2.AppendText(ShortFileName(i))

Next

Else

TextBox2.Text = LongFileName

End If

End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged

TextBox1.Enabled = False

End Sub

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged

TextBox1.Enabled = True

End Sub

Private Sub AboutUsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutUsToolStripMenuItem.Click

MsgBox("Project Developed By DTS", MsgBoxStyle.Information, "STEGANOGRAPHY")

End Sub

Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click

TextBox1.Cut()

End Sub

Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click

TextBox1.Copy()

End Sub

Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click

TextBox1.Paste()

End Sub

Private Sub LoadImageToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadImageToolStripMenuItem.Click

openPic.Title = "Open Picture Files"

openPic.ShowDialog()

End Sub

Private Sub LoadDataToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadDataToolStripMenuItem.Click

OpenFileDialog1.Filter = "Text Files(.txt)|*.txt"

OpenFileDialog1.FilterIndex = 1

OpenFileDialog1.InitialDirectory = "c:temp"

If (OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK) Then

TextBox1.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)

TextBox2.Text = OpenFileDialog1.FileName

End If

End Sub

Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click

openPic.Title = "Open Picture Files"

openPic.ShowDialog()

End Sub

Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click

TextBox1.Cut()

End Sub

Private Sub PictureBox6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub PictureBox4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox4.Click

TextBox1.Copy()

End Sub

Private Sub PictureBox5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox5.Click

TextBox1.Paste()

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub MenuStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles MenuStrip1.ItemClicked

End Sub

Private Sub AboutUsToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutUsToolStripMenuItem1.Click

MsgBox("Project Developed By DTS", MsgBoxStyle.Information, "STEGANOGRAPHY")

End Sub

Private Sub CutCtrlXToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutCtrlXToolStripMenuItem.Click

TextBox1.Cut()

End Sub

Private Sub CpyCtrlToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CpyCtrlToolStripMenuItem.Click

TextBox1.Copy()

End Sub

Private Sub PasteCtrlVToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteCtrlVToolStripMenuItem.Click

TextBox1.Paste()

End Sub

Private Sub LoadImageToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadImageToolStripMenuItem1.Click

openPic.Title = "Open Picture Files"

openPic.ShowDialog()

End Sub

Private Sub LoadTextToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadTextToolStripMenuItem.Click

OpenFileDialog1.Filter = "Text Files(.txt)|*.txt"

OpenFileDialog1.FilterIndex = 1

OpenFileDialog1.InitialDirectory = "c:temp"

If (OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK) Then

TextBox1.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)

TextBox2.Text = OpenFileDialog1.FileName

End If

End Sub

Private Sub ExitToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem1.Click

Me.Close()

End Sub

Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

End Class



For Further Reading,
Steganography Image, VB .NET

1 comments:

Ajinkya on May 12, 2011 at 10:18 AM said...

I can't Download File.
Can you Mail me.

Post a Comment