![]() |
| | #16 |
| Registered User Join Date: Jun 2009
Posts: 14
| I tried to do that print u made and i got this weird result: for pic->imageinfo[0] = 2 and pic->imageinfo[1]=1 for pic->picture[0]=0 and pic->picture[2]=0 and pic->picture[3]=0 :S |
| TranT is offline | |
| | #17 |
| Registered User Join Date: Jun 2009
Posts: 14
| JPEG 2000 payload header As i saw i must get that 32bit offset. How am i suposed to copy data from the picture buffer starting on that offset? |
| TranT is offline | |
| | #18 | |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Quote:
I'll check and see if these are prone to repeat inside of the image; if not, you could just scan the whole thing to find the start of the jpeg. Part of the reason why I asked if you are "hacking" (in the good sense) is because if you don't have an API which explicitly says these structs will deliver a jpeg encoded image, you might have made a conceptual leap. It may be true that "the picture is compressed in JPEG/JPEG2000", but that does not mean that the struct delivered by PTEID_GetPic() keeps it that way.
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS | |
| MK27 is online now | |
| | #19 | |
| Jaxom's & Imriel's Dad Join Date: Aug 2006 Location: Alabama
Posts: 801
| Quote:
Code: img = fopen("teste.jpeg","wb");
fwrite(pic.picture,1,pic.piclength,img);
| |
| Kennedy is offline | |
| | #20 | |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Quote:
Code: struct jpeg2000 {
unsigned char type;
unsigned char type-specific;
unsigned char priority;
int X_id:5; /* :5 is the bit length */
int offset;
}
Anyway, those things are part of the header which your image viewer program needs to interpret the image correctly. You want to include, not exclude the header, so you don't have to worry about separating it.
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS Last edited by MK27; 06-30-2009 at 08:21 AM. | |
| MK27 is online now | |
| | #21 |
| Registered User Join Date: Jun 2009
Posts: 14
| OK then .. I got both imageinfo and picture into separate buffers.. now how can i merge them as in array.copy in JAVA : )? |
| TranT is offline | |
| | #22 |
| Registered User Join Date: Jun 2009
Posts: 14
| nvm the question lol i did it manually : pastebin - collaborative debugging tool but still not working :x |
| TranT is offline | |
| | #23 | |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Quote:
Code: #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int size, i=0;
unsigned char image[1000000] = {0};
FILE *in = fopen(argv[1],"r");
size = fread(image,1,1000000,in);
fclose(in);
while (i<size-1) {
if ((image[i]==255) && (image[i+1]==216))
printf("byte %d\n",i);
i++;
}
return 0;
}
So adapt that while loop and try it. As for concatenating char arrays, just make one big buffer and then use memcpy(). You cannot use strcpy() or strcat() because the image data will have '\0' bytes in it. For the second memcpy, you want the destination to be an offset into the big buffer, eg. Code: memcpy(&buffer[666], from, size); [edit] looks like you already did this last part, or something sufficiently similar. So look for those two bytes...
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS Last edited by MK27; 06-30-2009 at 08:46 AM. | |
| MK27 is online now | |
| | #24 |
| Registered User Join Date: Jun 2009
Posts: 14
| i made prints for all the PTEID_PIC data: pastebin - collaborative debugging tool I scanned the whole picture data and didn't found any 0xFFD8 from JPEG :X but this has to be some kind of image :/ lol |
| TranT is offline | |
| | #25 | |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Quote:
If it is software that came with hardware, you probably won't get an answer because manufacturers aren't programmers and they are usually not interested in your problems. Otherwise you probably will get some advice, since evidently the source is open.
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS Last edited by MK27; 06-30-2009 at 09:10 AM. | |
| MK27 is online now | |
| | #26 |
| Registered User Join Date: Jun 2009
Posts: 14
| The stupid thing about this is that this is the Portuguese Citizen Smartcard so this was "done" by the government lol will try to contact the developers then Thanks for all the help : ) |
| TranT is offline | |
| | #27 | |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Quote:
ps. @ TranT -- you need to get a new cboard id and start a different thread.
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS | |
| MK27 is online now | |
| | #28 |
| Registered User Join Date: Sep 2008 Location: Toronto, Canada
Posts: 507
| You should open the file with Code: fopen(argv[1],"rb") |
| nonoob is offline | |
| | #29 |
| Registered User Join Date: Jun 2009
Posts: 14
| MK27 I am not exploiting in any way the smartcard i am just trying to get the image of it and thats legal so you don't have to be worrying about anything lol cheers |
| TranT is offline | |
| | #30 |
| Guest Join Date: Aug 2001
Posts: 4,923
| >> MK27 I am not exploiting in any way the smartcard i am just trying to get the image of it and thats legal so you don't have to be worrying about anything I'm afraid you're too late. He's already changed his name and moved to Yonkers, holed up in a little cabin by the river. But no worries, I'm sure he's much happier there. |
| Sebastiani is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Another syntax error | caldeira | C Programming | 31 | 09-05-2008 01:01 AM |
| C++ ini file reader problems | guitarist809 | C++ Programming | 7 | 09-04-2008 06:02 AM |
| Game Pointer Trouble? | Drahcir | C Programming | 8 | 02-04-2006 02:53 AM |
| Need help understanding info in a header file | hicpics | C Programming | 8 | 12-02-2005 12:36 PM |
| File Input / Output Help? | Unregistered | C Programming | 3 | 05-18-2002 10:20 AM |