Fravia's Anonymity Academy
Fravia's
STEGANOGRAPHY
SANITY1.HTM
...here's a couple programs i wrote that help crack contrab stegged
texts. please feel free to distribute them in their complete forms.
i hope you like them :)
-sanity_sync
/* crack.c by sanity_sync__
NOTE: This code is mostly based on contrab.c found
in the src_code subdir of Contraband(c), a great
steganography program for windows. Credit due
to Immortalware JTHZ.
Author's note: this code is pretty complete, but
you will need to xor the output yourself. This compiles
fine under most versions of Linux with gcc, or maybe
even DJGPP.
*/
#include
#include
#define BLOCKSIZE 9
#define OFFSET 9
#define DATA_OFFSET 0x36
void usage (void);
char readbyte(void);
int forbidden, readguide;
FILE *fptr, *fptr2;
int main( int argc, char *argv[])
{
int i, n; // counters
char ch; // output char
char block[BLOCKSIZE]; // block being read
char szbuffer[32]; // for getting embedded file length...
long length, height, width; // duh...
unsigned char header[32];
fptr = f0/*n("androm.bmp", "r*/;
fptr2 = f0/*n("Bytes.txt", "w*/;
fread(header, 32, 1, fptr); // read header data
width = header[18] + 256*header[19];
height = header[22] + 256*header[23];
if((width*3)%4) forbidden = (int)width*3;
else forbidden = -1;
rewind(fptr);
/* change 0x36 to the data offset */
for(i=DATA_OFFSET; i > 0; i--)
getc(fptr);
readguide = 0;
/* grabbing byte offset */
for(i=0; i32; i++ )
szbuffer[i] = readbyte();
/* calculate file size */
length = 0;
for( i=31; i>=0; i-- )
{
length += (szbuffer[i] & 1);
if(i)
length <<= 1;
}
printf("File length found was %ld\n", length);
for(n=length; n>0; n--)
{
for (i=0; i < BLOCKSIZE; i++) block[i] = readbyte();
ch = 0;
for(i=7;i>=0;i--)
{
ch += (block[i] & 1);
if(i) ch <<= 1;
}
putc(ch, fptr2);
}
return(0);
}
char readbyte(void)
{
if(readguide == forbidden)
{
while(readguide % 4)
{
readguide++;
getc(fptr);
}
readguide = 0;
}
if(forbidden>0) readguide++;
return(getc(fptr));
}
//-------------------------------------
/* xor.c by sanity_sync__
extremely simple xor program.
i find it quite useful :)
*/
#include
int main( int argc, char *argv[])
{
int xor;
char ch;
FILE *fptr, *fptr2;
int i;
fptr = f0/*n("Bytes.txt", "r*/;
fptr2 = f0/*n("xor.txt", "w*/;
xor = 1;
while(xor != 256)
{
fprintf(fptr2, "XOR val: %x\n", xor);
while((ch = getc(fptr)) != EOF)
{
putc((ch^xor), fptr2);
}
for(i=0; i<3; i++)
{
ch = 0x0d;
putc(ch, fptr2);
ch = 0x0a;
putc(ch, fptr2);
}
xor++;
rewind(fptr);
}
return(0);
}
_ _ _ _ _ _ _ _ _ _
Back to Fravia's Anonymity Academy ___Back to the Stego 'normal' page
homepage
links
+ORC
students' essays
counter measures
antismut CGI tricks
academy database
tools
javascript tricks
cocktails
search_forms
mail_Fravia
Is software reverse engineering illegal?