Re-compose image from incomplete bytes OR "rebuild" a transmission
in
Contributed Library Questions
•
1 year ago
First post! I'm going to try to keep this simple.
Using the Carnivore library, I'm listening to all traffic in my network. Now, I want to take the bytes I receive and re-compose them into an image, either complete or corrupt. The important thing is that I can visualise the data, if it's an image.
Now, I thought this was going to be easier (I always do). Apparently, and logically, the image doesn't come through in one pass. It loads in several, creating multiple requests etc. Basically, I can't get the image out in one piece. So it seems I have two options:
1 – Take whatever bytes I receive and try to create an image out of them. But this doesn't seem te be working. Even though I've got the headers, the ImageIO can't make something out of it. I've searched far and wide, but neither one works. For example:
- try {
- BufferedImage abdf = ImageIO.read(new ByteArrayInputStream(packet.data));
- System.out.println(abdf);
- } catch(IOException e) {
- e.printStackTrace();
- }
2 – Store all data unique to a single transmission and, when finished, re-compose it. But it doesn't seem the library has any properties that define a single transmission, just the packets. And even then, what if a user loads a website? I can't reconstruct those images if it's one big blob of various items.
So, where to go from here? My deadline is approaching and I've only begun :D Cheers!
EDIT See http://www.creativeapplications.net/linux/fohnseher-linux/ for an example.
1