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.corbacteria_X.s, whereXis 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
Xis greater than or equal to 0. - The integer, initially set to 50, is decremented with each execution, controlling how many iterations the program performs.
You can set your own values for the following variables by changing the assigned values directly on the source file:
#define FNAME "bacteria"#define EXT ".ext"int i = 50;cd ASM/
make
./bacteriacd C/
make
./bacteria
# Produce a given quantity of quines of different file extensions
cd C/
make collection i=<QUANTITY> ext=<EXTENSION,...>
Example:
make collection i=10 ext="txt pdf vob"To test if all generated files are quines (i.e., they produce the same code with only the variable value differing), run:
make testin 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.
To generate a collection of quines that have different extensions:
./test.sh- Before Execution:
- After Execution:


