• C

prog explaintion

can any one explain this program

//ENRICO X
//THE SECURITY
#include <fstream.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <io.h>
main()
{
_setcursortype(_NOCURSOR);
clrscr();
FILE *filesec;
char cho, opt, pass[100], pass2[100], passfile[100];
int colorpass;

if(access("c:\\SECURE.exe", 0)==-1)
  {
  textcolor(8);
  gotoxy(1,1);cprintf(" ut this file in c: and access it again");
  textcolor(15);
  gotoxy(1,1);cprintf("P");
  gotoxy(40,1);cprintf(".");
  goto end;
  }

if(access("c:\\BPASS.enx", 0)==0)
  colorpass=0;
else
  colorpass=15;

if(access("c:\\SECURE.enx", 0)==0)
  {
  clrscr();
  sleep(2);
  textcolor(15);
  gotoxy(44,13);cprintf("X");
  delay(100);
  textcolor(0);
  gotoxy(44,13);cprintf(" ");
  textcolor(15);
  gotoxy(42,13);cprintf("O");
  delay(100);
  textcolor(0);
  gotoxy(42,13);cprintf(" ");
  textcolor(15);
  gotoxy(41,13);cprintf("C");
  delay(100);
  textcolor(0);
  gotoxy(41,13);cprintf(" ");
  textcolor(15);
  gotoxy(40,13);cprintf("I");
  delay(100);
  textcolor(0);
  gotoxy(40,13);cprintf(" ");
  textcolor(15);
  gotoxy(39,13);cprintf("R");
  delay(100);
  textcolor(0);
  gotoxy(39,13);cprintf(" ");
  textcolor(15);
  gotoxy(38,13);cprintf("N");
  delay(100);
  textcolor(0);
  gotoxy(38,13);cprintf(" ");
  textcolor(15);
  gotoxy(37,13);cprintf("E");
  delay(100);
  textcolor(0);
  gotoxy(37,13);cprintf(" ");
  delay(100);
  textcolor(15);
  gotoxy(37,13);cprintf("E");
  delay(100);
  textcolor(8);
  gotoxy(37,13);cprintf("E");
  textcolor(15);
  gotoxy(38,13);cprintf("N");
  delay(100);
  textcolor(8);
  gotoxy(38,13);cprintf("N");
  textcolor(15);
  gotoxy(39,13);cprintf("R");
  delay(100);
  textcolor(8);
  gotoxy(39,13);cprintf("R");
  textcolor(15);
  gotoxy(40,13);cprintf("I");
  delay(100);
  textcolor(8);
  gotoxy(40,13);cprintf("I");
  textcolor(15);
  gotoxy(41,13);cprintf("C");
  delay(100);
  textcolor(8);
  gotoxy(41,13);cprintf("C");
  textcolor(15);
  gotoxy(42,13);cprintf("O");
  delay(100);
  textcolor(8);
  gotoxy(42,13);cprintf("O");
  textcolor(15);
  gotoxy(44,13);cprintf("X");
  delay(100);
  textcolor(8);
  gotoxy(44,13);cprintf("X");
  sleep(2);
  clrscr();
  choback:
  textcolor(8);
  gotoxy(1,1);cprintf(" og");
  gotoxy(1,3);cprintf(" ptions");
  gotoxy(1,5);cprintf(" redits");
  gotoxy(68,25);cprintf("THE SECURITY");
  textcolor(15);
  gotoxy(1,1);cprintf("L");
  gotoxy(1,3);cprintf("O");
  gotoxy(1,5);cprintf("C");
  textcolor(0);
  gotoxy(1,25);cscanf("%c", &cho);
  if(cho=='L' || cho=='l')
    {
    clrscr();
    textcolor(8);
    gotoxy(1,1);cprintf(" nter password");
    textcolor(15);
    gotoxy(1,1);cprintf("E");
    gotoxy(15,1);cprintf(": ");
    textcolor(colorpass);
    cscanf("%s", pass);
    ifstream file("c:\\SECURE.enx");
    file.getline(passfile, 100);
    if(strcoll(pass, passfile)==0)
      {
      clrscr();
      textcolor(8);
      gotoxy(1,1);cprintf(" assword accepted");
      textcolor(15);
      gotoxy(1,1);cprintf("P");
      gotoxy(18,1);cprintf("!");
      sleep(2);
      textcolor(8);
      gotoxy(1,3);cprintf(" oading to windows");
      textcolor(15);
      gotoxy(1,3);cprintf("L");
      gotoxy(19,3);cprintf("...");
      }
    else
      {
      clrscr();
      nevend:
      textcolor(8);
      gotoxy(1,1);cprintf(" nvalid password");
      gotoxy(1,25);cprintf(" lease reboot your computer");
      textcolor(15);
      gotoxy(1,1);cprintf("I");
      gotoxy(17,1);cprintf("!");
      gotoxy(1,25);cprintf("P");
      gotoxy(28,25);cprintf(".");
      goto nevend;
      }
    }
  else if(cho=='O' || cho=='o')
    {
    clrscr();
    optback:
    textcolor(8);
    gotoxy(1,1);cprintf(" hange password");
    gotoxy(1,5);cprintf(" lind password");
    gotoxy(1,7);cprintf(" how password");
    gotoxy(1,11);cprintf(" ninstall");
    gotoxy(1,25);cprintf("E it");
    if(access("c:\\BPASS.enx", 0)==0)
      {
      textcolor(14);
      gotoxy(1,5);cprintf("B");
      textcolor(15);
      gotoxy(1,7);cprintf("S");
      }
    else
      {
      textcolor(15);
      gotoxy(1,5);cprintf("B");
      textcolor(14);
      gotoxy(1,7);cprintf("S");
      }
    textcolor(15);
    gotoxy(1,1);cprintf("C");
    gotoxy(1,11);cprintf("U");
    gotoxy(2,25);cprintf("x");
    textcolor(0);
    gotoxy(1,25);cscanf("%c", &opt);
    if(opt=='C' || opt=='c')
      {
      clrscr();
      textcolor(8);
      gotoxy(1,1);cprintf(" nter old password");
      textcolor(15);
      gotoxy(1,1);cprintf("E");
      gotoxy(19,1);cprintf(": ");
      textcolor(colorpass);
      cscanf("%s", pass);
      ifstream file("c:\\SECURE.enx");
      file.getline(passfile, 100);
      if(strcoll(pass, passfile)==0)
      {
      textcolor(8);
      gotoxy(1,3);cprintf(" nter new password");
      textcolor(15);
      gotoxy(1,3);cprintf("E");
      gotoxy(19,3);cprintf(": ");
      textcolor(colorpass);
      cscanf("%s", pass);
      conpass:
      textcolor(8);
      gotoxy(1,5);cprintf(" onfirm password");
      textcolor(15);
      gotoxy(1,5);cprintf("C");
      gotoxy(17,5);cprintf(":                                            ");
      textcolor(colorpass);
      gotoxy(19,5);cscanf("%s", pass2);
      if(strcoll(pass, pass2)==0)
        {
        filesec=fopen("c:\\SECURE.enx", "w");
        fprintf(filesec, pass);
        textcolor(8);
        fclose(filesec);
        gotoxy(1,7);cprintf(" assword confirmed");
        textcolor(15);
        gotoxy(1,7);cprintf("P");
        gotoxy(19,7);cprintf("!");
        sleep(2);
        clrscr();
        goto choback;
        }
      else
        goto conpass;
      }
      else
      {
      textcolor(8);
      gotoxy(1,3);cprintf(" nvalid password");
      textcolor(15);
      gotoxy(1,3);cprintf("I");
      gotoxy(17,3);cprintf("!");
      sleep(2);
      clrscr();
      goto optback;
      }
      }
    else if(opt=='U' || opt=='u')
      {
      clrscr();
      textcolor(8);
      gotoxy(1,1);cprintf(" nter password");
      textcolor(15);
      gotoxy(1,1);cprintf("E");
      gotoxy(15,1);cprintf(": ");
      textcolor(colorpass);
      cscanf("%s", pass);
      ifstream file("c:\\SECURE.enx");
      file.getline(passfile, 100);
      if(strcoll(pass, passfile)==0)
      {
      textcolor(8);
      gotoxy(1,1);cprintf("Uninstall complete.");
      remove("c:\\SECURE.enx");
      remove("c:\\autoexec.bat");
      remove("c:\\BPASS.enx");
      remove("SECURE.exe");
      }
      else
      {
      textcolor(8);
      gotoxy(1,3);cprintf(" nvalid password");
      textcolor(15);
      gotoxy(1,3);cprintf("I");
      gotoxy(17,3);cprintf("!");
      sleep(2);
      clrscr();
      goto optback;
      }
      }
    else if(opt=='B' || opt=='b')
      {
      _creat("c:\\BPASS.enx", FA_HIDDEN);
      colorpass=0;
      goto optback;
      }
    else if(opt=='S' || opt=='s')
      {
      remove("c:\\BPASS.enx");
      colorpass=15;
      goto optback;
      }
    else if(opt=='X' || opt=='x')
      {
      clrscr();
      goto choback;
      }
    else
      goto optback;
    }
  else if(cho=='C' || cho=='c')
    {
    clrscr();
    textcolor(8);
    gotoxy(1,1);cprintf(" rogrammer:  nrico  orenzo");
    gotoxy(1,3);cprintf(" pecial thanks to:  ade  uliano");
    gotoxy(1,25);cprintf(" ress any key to exit");
    textcolor(15);
    gotoxy(1,1);cprintf("P");
    gotoxy(13,1);cprintf("E");
    gotoxy(20,1);cprintf("L");
    gotoxy(1,3);cprintf("S");
    gotoxy(20,3);cprintf("J");
    gotoxy(25,3);cprintf("J");
    gotoxy(1,25);cprintf("P");
    gotoxy(22,25);cprintf("...");
    getch();
    clrscr();
    goto choback;
    }
  else
    goto choback;
  }
else
  {
  clrscr();
  textcolor(8);
  gotoxy(1,1);cprintf(" reate a password");
  textcolor(15);
  gotoxy(1,1);cprintf("C");
  gotoxy(18,1);cprintf(": ");
  cscanf("%s", pass);
  passback:
  textcolor(8);
  gotoxy(1,3);cprintf(" onfirm password");
  textcolor(15);
  gotoxy(1,3);cprintf("C");
  gotoxy(17,3);cprintf(":                                                  ");
  gotoxy(19,3);cscanf("%s", pass2);
  if(strcoll(pass, pass2)==0)
    {
    fprintf(fopen("c:\\autoexec.bat", "w"), "@echo off\nc:\\SECURE.exe");
    fprintf(fopen("c:\\SECURE.enx", "w"), pass);
    textcolor(8);
    gotoxy(1,5);cprintf(" assword confirmed");
    gotoxy(1,25);cprintf(" his program will run everytime you boot your system");
    textcolor(15);
    gotoxy(1,5);cprintf("P");
    gotoxy(19,5);cprintf("!");
    gotoxy(1,25);cprintf("T");
    gotoxy(53,25);cprintf(".");
    }
  else
    goto passback;
  }
end:
return 0;
}
mdamjadAsked:
Who is Participating?
 
ankuratvbConnect With a Mentor Commented:
To terminate the secure.exe.
Then,autoexec.bat will continue to execute any other commands it may have in it.

Ctrl-Alt-Del or Alt-F4 wont do because at that time,you're in DOS so pressing ctr-alt-del will restart the computer.

Better still,put it in the registry,that way it aint listed in the startup folder as well.

0
 
Avik DasguptaCommented:
Probably modifying the autoexec.bat, but u need the secure.exe file...Do u have it ? ...... the creator of this program should know about it....the intension of the programmer is probably to log on to ur windows by his program protected by his password... the password in stored in the file secure.ENX and UNENCRYPTED ! ..... a wierd idea .... but u have to get hold of the secure.exe file

Avik.
0
 
ankuratvbCommented:
It modifes the autoexec.bat so that the exe,secure.exe runs everytime your system boots.
secure.exe is the executable for this program only.

It does nothing except check a password from the secure.enx file and then allows loading to continue if accepted otherwise keeps loopin inside the program itself.

Oh and dont use the uninstall option.It will remove your autoexec.bat file.
0
The Lifecycle Approach to Managing Security Policy

Managing application connectivity and security policies can be achieved more effectively when following a framework that automates repeatable processes and ensures that the right activities are performed in the right order.

 
Avik DasguptaCommented:
This was precisely what I wanted to say....only that person will log into Windows or DOS if he/she knows the password stored in the secure.enx file. The thing that actually is wondering me is that the password is unencrypted in the file....if somebody is having a problem he may start windows by choosing not to execute the autoexec.bat file and then logging to Windows and deleting the following lines in the autoexec.bat file :
@echo off
c:\\SECURE.exe
However the actual location of autoexec.bat is generally
c:\windows\command\
and the autoexec.bat here is created in c:\
so after the uninstall the file c:\autoexec.bat will be removed, hope no problems...as the actual one will not be affected.

Avik.
0
 
ankuratvbCommented:
Hi avik,

In dos,the autoexec.bat is in c:\
Also,you can terminate the execution of this secure.exe program by simply pressing Ctrl-C.
Thats it.
0
 
ankuratvbCommented:
Hi avik,

AFAIK,Till WIN98 atleast,the location of autoexec.bat is in c:\
0
 
Avik DasguptaCommented:
Thanks ankuratvb,
             I started my computer sc. academic career using Win 98, so little do I know about the Win 95 or DOS
>>Also,you can terminate the execution of this secure.exe program by simply pressing Ctrl-C.
to terminate the autoexec.bat ??? As secure.exe will be executed by the script....will
Ctrl-Alt-Del or Alt-F4 do....of course I am still in Windows....However the programmer could have put this secure.exe in Windows startup folder....better way....I suppose...
In a nut shell this program is nothing but playing a prank with a novice :-)

Avik.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.