Steganography in image

南笙酒味 提交于 2019-12-13 09:50:07

问题


So far, I have opened the image in a hex editor and looked at the bytes. However, for the life of me I cannot identify the sound. I have spent days over this. I even tried opening the file (as 'Raw Data') in Audacity and playing it. Nothing but 'noise'. Tried to create a histogram/frequency analysis but nothing.

Any help would be appreciated.


回答1:


Steganography usually works by hiding a second image or some data in the lower bits of another image. These values becomes very insignificant over-all and have little impact on the visual look of the image.

To reveal this second data, you mask off the top bits, then usually scale up remaining values.

However, you need to know in advance:

  • How many of the lower bits are used (two are very common for secondary images)
  • How is the remaining data organized (if not an image):
    • Is it (bit) scaled, how much
    • what order (scan-lines horizontally, vertically...).
    • Are all color components in use? Which one and how is the data split over the components...
    • Is it an audio file or audio data
    • Is the resulting data compressed, encrypted, ...
    • Audio requires signed values, are the values signed in the data, are they shifted... (this steals one bit which means the bytes must probably be packed to produce something audible)

etc.

Without this information it is pretty useless (you can try likely guesses but they will be guesses, and you can do this for a very long time).

In any case, I provided a basis below showing the process, but what remains, and if it is extracted correctly, is virtually "impossible" to determine without knowing how the original data is organized:

Here is the result of this process using an image which is known in advance to hide another image (the cat) in the lower 2 bits:

var img = new Image;
img.onload = unstegano;
img.crossOrigin = "";
img.src = "//i.imgur.com/DkCZMJN.png";  // contains a hidden image

document.body.appendChild(img);

function unstegano() {
  var canvas = document.createElement("canvas"),
      ctx = canvas.getContext("2d");
  
  canvas.width = this.naturalWidth;
  canvas.height = this.naturalHeight;
  ctx.drawImage(this, 0, 0);
  
  // get pixels
  var idata = ctx.getImageData(0, 0, canvas.width, canvas.height),
      data = idata.data, i = 0, len = data.length;
  
  while(i < len) {
      data[i] = (data[i++] & 3)<<6;  // masks two first bits, shifts it to scale it
      data[i] = (data[i++] & 3)<<6;
      data[i] = (data[i++] & 3)<<6;
      i++
  }
  ctx.putImageData(idata, 0 ,0);
  document.body.appendChild(canvas);
}

With the supplied image you will get something that looks like noise, but that doesn't matter so much as audio data would produce a noise image in any case - your challenge now is to make anything out of this noise (or "noise"):

var img = new Image;
img.onload = unstegano;
img.crossOrigin = "";
img.src = "//i.imgur.com/IpaDzB4.png";
document.body.appendChild(img);

function unstegano() {
  var canvas = document.createElement("canvas"),
      ctx = canvas.getContext("2d");
  
  canvas.width = this.naturalWidth;
  canvas.height = this.naturalHeight;
  ctx.drawImage(this, 0, 0);
  
  // get pixels
  var idata = ctx.getImageData(0, 0, canvas.width, canvas.height),
      data = idata.data, i = 0, len = data.length;
  
  while(i < len) {
      data[i] = (data[i++] & 1)<<7;  // masks first bit, shifts it to scale it
      data[i] = (data[i++] & 1)<<7;
      data[i] = (data[i++] & 1)<<7;
      i++
  }
  ctx.putImageData(idata, 0 ,0);
  document.body.appendChild(canvas);
}


来源:https://stackoverflow.com/questions/29322395/steganography-in-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!