The meeting will be on Steganography (held over from last month) and some other coding such as modifying dates on Windows files that is not a facility normally available to users.
There may also be some discussion and analysis of SBS's Myth Busters TV show on Monday nights at 7:30pm. Lots of good technology stuff done there.
We also have some very novel uses for wireless bridges that Rick is writing up for a magazine. We may have a look at wireless networks generally from a more practical point of view than we have done in the past.
Some source code to be talked about in the meeting follows;
alpha.c
//-------------------------------------------------------------------
//ALPHA.C reads a file byte-wise and writes it out to another file
//with all non-printing chars removed.
//-------------------------------------------------------------------
#include
#include
char c;
FILE *fi;
FILE *fo;
int main(int argc, char *argv[])
{
if(argc<3)
{ printf("Remove all non-printing characters\n");
printf("\nUsage is:- ALPHA inputfile.ext outputfile.ext\n");
exit(1);
}
if((fi = fopen(argv[1],"rb")) == NULL)
{ printf("\nNo input file %s\n",argv[1]);
exit(1);
}
if((fo = fopen(argv[2],"wb")) == NULL)
{ printf("\nCan't open output file %s\n",argv[2]);
exit(1);
}
while(feof(fi) == 0)
{ c=fgetc(fi);
//...insert a "filter" at this point
if((c == 0xd) || (c == 0xa))
{ fputc(c,fo);
continue;
}
if((c < 0x20) || (c > 0x7d))
continue;
else
fputc(c,fo);
}
fclose(fi);
fclose(fo);
printf("\a"); /* ring bell */
exit(0);
datechg1.c
#include
#include
#include
#include
#include
#include
#include
main(int argc, char *argv[])
{ unsigned date;
unsigned time;
int fh;
if(_dos_open(argv[1],O_RDONLY,&fh) != 0)
perror("open error");
else
printf("open succeeded\n");
_dos_getftime(fh,&date,&time);
date = 16 + (8*32) + ((2005-1980)*512); //change date to 16/8/2005
_dos_setftime(fh,date,time);
printf("date changed\n");
if(_dos_close(fh) != 0)
perror("close error");
else
printf("file closed OK\n");
}
time2.c
//append time and date to a file.
#include
#include
FILE *fa;
int main()
{ char datebuf[20], timebuf[20];
if((fa=fopen("time.lst","at")) == NULL)
exit(1);
_strtime(timebuf);
_strdate(datebuf);
fprintf(fa,"%s %s\n",timebuf,datebuf);
fclose(fa);
return 0;
}
steg-x.c
// ------------------------------------------------------------------
//STEG-x.C extracts hidden text from a steganography file.
//-------------------------------------------------------------------
#include
#include
int buff[4096];
FILE *fi;
FILE *ft;
FILE *fo;
int bitnum;
char ch;
char id[]="Rick was here";
//--------------- main ----------------
int main(int argc, char *argv[])
{ int n, num;
if(argc != 3)
{ printf("\nUsage is:- STEG-R inputfile.ext message.txt\n");
exit(1);
}
if((fi = fopen(argv[1],"rb")) == NULL) //inputfile.ext
{ printf("\nNo input file %s\n",argv[1]);
exit(1);
}
if((fo = fopen(argv[2],"wt")) == NULL) //message.txt
{ printf("\nCan't open output file %s\n",argv[2]);
exit(1);
}
//skip 1st 1024 words
if(fread(buff,sizeof(int),1024,fi) != 1024)
{ printf("ERROR reading input file\n");
exit(1);
}
while((num=fread(buff,sizeof(int),1024,fi)) > 0)
{
bitnum=0; ch='\0';
for(n=0; n 7)
{
if((ch & 0xff) == 0xff)
goto alldone;
fprintf(fo,"%c",ch);
bitnum=0; ch='\0';
}
else
ch = (ch & 0xff) >> 1;
}
}
alldone:
fclose(fi);
fclose(fo);
printf("\a"); /* ring bell */
exit(0);
}
steg-h.c
//---------------------------------------------------------------------
//STEG-H.C uses steganography to HIDE a text file inside a picture file
//---------------------------------------------------------------------
#include
#include
int buff[4096];
char tbuff[4096];
FILE *fi;
FILE *ft;
FILE *fo;
int bitnum, bitval, endbits;
char ch;
char id[]="Rick was here!";
//------------ subroutines ------------
int getbit()
{
if(bitnum == 0)
ch=fgetc(ft);
bitval = 1 & (ch >> bitnum);
bitnum++;
if(bitnum > 7)
bitnum = 0;
return bitval;
}
//--------------- main ----------------
int main(int argc, char *argv[])
{ int n, num;
if(argc != 4)
{ printf("\nUsage is:- STEG-H inputpicture.ext message.txt outputpicture.ext\n");
exit(1);
}
if((fi = fopen(argv[1],"rb")) == NULL) //inputpicture.ext
{ printf("\nNo input file %s\n",argv[1]);
exit(1);
}
if((ft = fopen(argv[2],"rt")) == NULL) //message.txt
{ printf("\nNo input file %s\n",argv[2]);
exit(1);
}
if((fo = fopen(argv[3],"wb")) == NULL) //outputpicture.ext
{ printf("\nCan't open output file %s\n",argv[3]);
exit(1);
}
//skip 1st 1024 words
if((num=fread(buff,sizeof(int),1024,fi)) != 1024)
{ printf("error reading input %s\n",argv[1]);
exit(1);
}
fwrite(buff,sizeof(int),1024,fo);
bitnum=0; endbits=8;
while((num=fread(buff,sizeof(int),1024,fi)) > 0)
{
for(n=0; n 0)
{ buff[n] = buff[n] | 1;
endbits--;
}
}
fwrite(buff,sizeof(int),1024,fo);
}
fclose(fi);
fclose(ft);
fclose(fo);
printf("\a"); /* ring bell */
exit(0);
}