Archive for the ‘C/C++’ Category

trinity.c

Wednesday, July 9th, 2003

[code lang="cpp"]
/* trinity.c
* Trinity, reverse-engineered by Carlos Macasaet
* http://www.carlos-m.net/
*/

#include
#include
#include
#include

extern pid_t neo;

int wake_neo() {
key_t neo;
int msgflg;
int msqid;

msqid = msgget( ftok( "/dev/null", neo ), ( IPC_CREAT | 0240 ) );
kill( neo, SIGKISS );
}
[/code]

neo.c

Tuesday, July 8th, 2003

[code lang="cpp"]
/* neo.c
* Neo, reverse engineered by Carlos Macasaet
* http://www.carlos-m.net/
*/

#include
#include
#include

/* enlightenment levels */
typedef int enlightenment_level;
#define MR_ANDERSON -1
#define TOOK_RED_PILL 0
#define I_KNOW_KUNG_FU 1
#define MET_ORACLE 2
#define THERE_IS_NO_SPOON 3
#define RELOADED 4 /* I don't have to dodge bullets */

enlightenment_level elevel;

void die();
void resurrect();

int main() {
dead = false;
signal( SIGKILL, die );
signal( SIGKISS, resurrect );

return( 0 );
}

void die() {
dead = true;
while ( elevel < RELOADED )
sleep( 3600 ); /* this number is completely arbitrary */
}

void resurrect() {
elevel = RELOADED;
signal( SIGKILL, SIG_IGN ); /* I'm neo, I can do this */
}
[/code]

agent_smith.c

Wednesday, May 28th, 2003

[code lang="cpp"]
/* agent_smith.c
* Agent Smith, reverse engineered by Carlos Macasaet
* http://www.carlos-m.net/
*/

#include
#include
#include

#include
#include

typedef int agent;

extern pid_t neo;
extern int errno;

agent smith() {
pid_t clone;
while( 1 ) {
if( kill( neo, 0 ) == -1 && errno == ESRCH )
return( 0 );

clone = fork();
if( clone != 0 ) {
while( kill( neo, SIGKILL ) );
waitpid( clone, NULL, 0 );
return( 0 );
}
}
}
[/code]