Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The assignment should be a single program written in C or C++ that creates 10 .c

ID: 3701027 • Letter: T

Question

The assignment should be a single program written in C or C++ that creates 10 .com files. (Using something such as the Visual Studio .com file creator will NOT satisfy the assignment.) See here for more about .com files: https://en.wikipedia.org/wiki/COM_file
It is a really simple file that has the binary compiled form of assembly code. Here is a tutorial that you can use to get started on creating a .com file in its assembled form. http://eli.thegreenplace.net/2009/12/21/creating-a-tiny-hello-world-executable-in-assembly/

You are creating a program to create 10 .com files. Each .com file should be different in appearance when compiled but yield the same result of printing "Hello World" to the screen. Some hints of techniques to consider are encryption/obfuscation, modifying the assembly code to accomplish the same function through another approach, and/or inserting assembly code that causes no actions.

Repeating the same basic code 10 times and naming the 10 .com files to be something different will not meet the polymorphism goal of this assignment. Each file should look different at the assembly level. How you choose that difference should be the goal of this assignment. Remember the basic idea: "Can you make a set of .com files where there are no easy hex strings that can be used to identify your program?" The goal of polymorphism is to evade string based detection by an anti-virus type program.

To help illustrate the basic assignment, here is (sloppy) c code that will create a single .com file that prints "Hello World!" based on the above example. I compiled on gcc on Linux and moved over to a Windows machine running DosBox to verify that it works. Feel free to build off of this code and add your own polymorphism to it.

#include (less than sign) stdio.h (greater than sign)

int main(void)
{
FILE *myfile = fopen("hello.com", "wb");
putc(0x0E, myfile);
putc(0x1f, myfile);
putc(0xba, myfile);
putc(0x0E, myfile);
putc(0x01, myfile);
putc(0xb4, myfile);
putc(0x09, myfile);
putc(0xcd, myfile);
putc(0x21, myfile);
putc(0xb8, myfile);
putc(0x01, myfile);
putc(0x4c, myfile);
putc(0xcd, myfile);
putc(0x21, myfile);
putc(0x48, myfile);
putc(0x65, myfile);
putc(0x6c, myfile);
putc(0x6c, myfile);
putc(0x6f, myfile);
putc(0x20, myfile);
putc(0x57, myfile);
putc(0x6f, myfile);
putc(0x72, myfile);
putc(0x6c, myfile);
putc(0x64, myfile);
putc(0x21, myfile);
putc(0x24, myfile);
fclose(myfile);
return 0;
}

Please feel free to use Java as a substitute for C/C++.

Thanks!

Explanation / Answer


#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include<time.h>
using namespace std;
int main()
{
srand(time(0)); // Use current time as seed for random generator
int val;
string s1="hello.com",s2,res;
for(int i=0;i<10;i++)
{
s2='0'+i;
res=s2+s1;
val=rand();
FILE *myfile = fopen(res.c_str(), "wb");
putc(val, myfile); //you can put as many as you want to make a differentiation in files
putc(0x0E, myfile);
putc(0x1f, myfile);
putc(0xba, myfile);
val=rand();
putc(val, myfile); //you can put as many as you want to make a differentiation in files
putc(0x0E, myfile);
putc(0x01, myfile);
putc(0xb4, myfile);
putc(0x09, myfile);
val=rand();
putc(val, myfile); //you can put as many as you want to make a differentiation in files
putc(val, myfile);
putc(0xcd, myfile);
putc(0x21, myfile);
putc(0xb8, myfile);
val=rand();
putc(val, myfile); //you can put as many as you want to make a differentiation in files
putc(val, myfile);
putc(0x01, myfile);
putc(0x4c, myfile);
putc(0xcd, myfile);
putc(0x21, myfile);
putc(0x48, myfile);
putc(0x65, myfile);
putc(0x6c, myfile);
putc(0x6c, myfile);
putc(0x6f, myfile);
putc(0x20, myfile);
putc(0x57, myfile);
putc(0x6f, myfile);
putc(0x72, myfile);
putc(0x6c, myfile);
putc(0x64, myfile);
val=rand();
putc(val, myfile); //you can put as many as you want to make a differentiation in files
putc(0x21, myfile);
putc(0x24, myfile);
val=rand();
putc(val, myfile); //you can put as many as you want to make a differentiation in files
fclose(myfile);
}
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote