Hack Forums
[.NET] [Vb.Net]Storing Data as Image[src] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [Vb.Net]Storing Data as Image[src] (/showthread.php?tid=656728)

Pages: Pages 1 2 3


[Vb.Net]Storing Data as Image[src] - kobac - Sep 3, 2010

Simple way to store data as real image :D

[img]http://img818.imageshack.us/img818/9107/imagecrypt.gif[/img]
[img]http://img130.imageshack.us/img130/5156/imagesha.png[/img]
Crypt:
Code
Function pixelator(ByVal a As String) As Image
  a = Convert.ToBase64String(New System.Text.UTF8Encoding().GetBytes(CompressString(a)))
  Dim imageholder As Bitmap
  Dim autosize As Integer = System.Math.Sqrt(a.Count) + 2
  imageholder = New Bitmap(autosize, autosize)
  Dim G As Graphics = Graphics.FromImage(imageholder)
  Dim fff As Integer = 0
  While fff <= a.Count - 1
    For Y = 1 To imageholder.Height - 1
    For X = 1 To imageholder.Width - 1
    If fff <= a.Count - 1 Then
    imageholder.SetPixel(X, Y, Color.FromArgb(Convert.ToInt32(a.Chars(fff)), 0, 0))
    fff = fff + 1
    End If
    Next X
    Next Y
  End While
  Return imageholder
DeCrypt:
Code
Function depixelator(ByVal a As Image) As String
  Dim retrievestr As String = ""
  Dim xmax As Integer
  Dim ymax As Integer
  xmax = a.Width - 1
  ymax = a.Height - 1
  For y = 1 To ymax
    For x = 1 To xmax
    With CType(a, Bitmap).GetPixel(x, y)
    retrievestr = retrievestr & Convert.ToChar(.R)
    End With
    Next x
  Next y
  retrievestr = New System.Text.UTF8Encoding().GetString(Convert.FromBase64String(retrievestr.Replace(Convert.ToChar(0), "")))
  retrievestr = DecompressString(retrievestr)
  Return retrievestr
    End Function
Needed Functions:
Code
Public Shared Function CompressString(ByVal text As String) As String
  Dim buffer__1 As Byte() = Encoding.UTF8.GetBytes(text)
  Dim memoryStream = New IO.MemoryStream()
  Using gZipStream = New IO.Compression.GZipStream(memoryStream, CompressionMode.Compress, True)
    gZipStream.Write(buffer__1, 0, buffer__1.Length)
  End Using
  memoryStream.Position = 0
  Dim compressedData = New Byte(memoryStream.Length - 1) {}
  memoryStream.Read(compressedData, 0, compressedData.Length)
  Dim gZipBuffer = New Byte(compressedData.Length + 3) {}
  Buffer.BlockCopy(compressedData, 0, gZipBuffer, 4, compressedData.Length)
  Buffer.BlockCopy(BitConverter.GetBytes(buffer__1.Length), 0, gZipBuffer, 0, 4)
  Return Convert.ToBase64String(gZipBuffer)
    End Function
    Public Shared Function DecompressString(ByVal compressedText As String) As String
  Dim gZipBuffer As Byte() = Convert.FromBase64String(compressedText)
  Using memoryStream = New IO.MemoryStream()
    Dim dataLength As Integer = BitConverter.ToInt32(gZipBuffer, 0)
    memoryStream.Write(gZipBuffer, 4, gZipBuffer.Length - 4)
    Dim buffer = New Byte(dataLength - 1) {}
    memoryStream.Position = 0
    Using gZipStream = New GZipStream(memoryStream, CompressionMode.Decompress)
    gZipStream.Read(buffer, 0, buffer.Length)
    End Using
    Return Encoding.UTF8.GetString(buffer)
  End Using
    End Function
Simple Usage:
Code
Crypt:  PictureBox1.Image = pixelator(RichTextBox1.Text)
DeCrypt:  RichTextBox1.Text = depixelator(PictureBox1.Image)
Source: http://www.mediafire.com/download.php?4bwdc49ib98nz59
Update: (using png image format, file can be uploaded to imageshack)
code(png):
Spoiler (Click to View)


* - H3x0S - Sep 3, 2010

Stenography. Cool program. I like it.


* - Mike Ross - Sep 3, 2010

That is amazing. Thanks for this.


* - FamousMassacre - Sep 3, 2010

I honestly jizzed. This has been one of the coolest things I have seen in a while.


* - Coder - Sep 3, 2010

Awesome share, I would +rep if I could. :)


* - Romeo. - Sep 3, 2010

Well, thanks for share, i might use it some day !


* - Mario - Sep 3, 2010

Its awesome. I dont really see why you would use it. But its skill kinda cool :)


* - sumit8510 - Sep 4, 2010

This is the best, I have seen.
Thanks for posting here bro.


* - Modesty - Sep 4, 2010

woah, sexy shit!

thanks ^^


* - µnKn0wn_H4CK3r - Sep 4, 2010

Hi!

Haha, thanks man, very cool program and very great source!
You deserve some green apples 😁 !


* - M4xIm - Sep 4, 2010

Wow that's great! Can I also use it with crypters?


* - SumSumBee - Sep 4, 2010

would be cool to know how to use in crypters...


* - JIMP - Sep 4, 2010

Mondo cool mate.Thank you for this.


* - KingCobraXD - Sep 4, 2010

(Sep 4, 2010 02:49 AM)M4xIm Wrote:  Wow that's great! Can I also use it with crypters?

All you do is use fileget to get the string of the "Going to be crypted file" and encrypt it using this function and then using fileput to put it into the stub. Now in the stub, it will use fileget to get the crypted file and then unencrypt it! Simple as that!


* - pr3fix - Sep 4, 2010

This is really good, good job if you made this!