I have a simple program that is supposed to either do its thing or, given the correct arguments, return a flag so that the parent process (a much, much more complex and advanced program...) can decide whether this process (called a cell) is safe to run, or if it's been flagged as unsafe because a proprietary virus (part of this complex process) has infected this cell and marked it with the flag 0xBADF. Btw, I say virus because precisely what it does is act as a lytic or lysogenic process which either infects a "cell," giving it the flag that says the cell could be harmful/shouldn't be loaded or executed, or injects a copy of itself into a cell process so that the cell process could itself become one of these cell checker viruses. It's confusing, but I assure you that it does not even work without this framework I've developed. Anyway, my test cell file that I want to try to change the flag on won't even correctly work anyway.
The source is:
Code:
C
/*
* cf1.c
* cell flag to test labeling for use in VAIS and other NOXIS classes
*/
#include<stdio.h>
int main(int argc, char** argv){
if(argv[1] == "?"){
if(argv[2] == "CELL_FLAG"){
return 0x5afe; // 5AFE is safe
}
}else{
printf("The default CELL_FLAG for this cell is 0x5AFE.\n");
return 0;
}
}
The command line is:
Code:
$ gcc -o cf1 cf1.c
$ ./cf1 ? CELL_FLAG
The process should return 0x5AFE, as denoted by the mac os x (I don't know if other unix systems use $?).
But instead, it ignores the input and does it's thing.
What's goin' on here?
EDIT: Just to clarify and ease your mind, I say "virus" but it's only a modified version of Jingle Bell, from this article:
http://www.kernelthread.com/publications/security/vunix.html