This C/ASM project explores the principle of self-reproduction through the implementation of a quine, a program that produces a copy of its own source code as output.
It delves into the challenges associated with self-replicating code and serves as an excellent introduction to more complex topics, including malware development, providing insights into the mechanisms and implications of self-replicating programs.
The project includes both C and ASM versions of the self-replicating program, named bacteria.
When executed, the program performs the following actions:
- It creates a file named
bacteria_X.c
orbacteria_X.s
, whereX
is an integer defined in the source code. - After creating the file, it compiles and runs the newly created program.
- The program stops based on the file name: it executes only if the integer
X
is greater than or equal to 0. - The integer, initially set to 50, is decremented with each execution, controlling how many iterations the program performs.
- Build the project using
make
:cd ASM/ # Or cd C/ make ./bacteria
To test if all generated files are quines (i.e., they produce the same code with only the variable value differing), run:
make test
in the ASM/C directory.
This command will execute the test suite to verify that each generated program correctly replicates its source code, differing only in the index variable.
- Before Execution:
2. **After Execution**: This shows the replicated files created by the program.