#include<fstrea m.h>
#include<proces s.h>
#include<stdlib .h>
#include<conio. h>
#include<string .h>
#include<dos.h>
#include<ctype. h>
#include<stdio. h>
void setup()
void help();
void main(int argc, char *argv[])
char color[80];
ifstream clrs;
clrs.open("grap h.dsp");
if(!clrs)
{
cout<<"Importan t data file missing,will terminate";
getch();
exit(1);
}
for( int col=1;col<=11;c ol++)
{
clrs.getline(co lor,80);
textcolor(col);
for(int no=0;no<strlen( color);no++)
{
putch(color[no]);
delay(7.5);
}
cout<<"\n";
}
clrs.close();
textcolor(seven );
cprintf("");
cout<<"EnDe(enc ryptor-decryptor) version 3.0 for MS-DOS\n";
cout<<"<c2001 -R.G INFOTECH Ltd-project release";
unsigned long enc=5;
if(argc!=4&&arg c!=2)
{
help:
cout<<"\n Encryptor-Decryptor useage help:\n";
cout<<"syntax:\ n";
cout<<"\tEnDe <option<sourc e path and file<target path and
file>";
cout<<"\n\nOpti ons:\n";
cout<<"E :Encryption Mode\n";
cout<<"D :Decryption Mode\n";
cout<<"S :Delete Source file after Encryption\n";
cout<<"T :Delete Encrypted file after Decryption\n";
exit(0);
}
*argv[1]=tolower(*argv[1]);
if(argc==2)
{
if(!strcmp(argv[1],"setup")||!str cmp(argv[1],"setup")
||!strcmp(argv[1],"SETUP"))
{
char *p_set;
char set_check[8],setcheck[8],checkpass;
int length;
ifstream setup_pass;
setup_pass.open ("pass.end") ;
if(!setup_pass)
{
ofstream ofile;
ofile.open("pas s.end");
ofile<<"OE";
ofile.close();
ofile.open("end e.log",ios::tru nc);
ofile.close();
setup_pass.open ("pass.end") ;
}
setup_pass.get( checkpass);
setup_pass.getl ine(set_check,8 );
setup_pass.clos e();
setup_pass.open ("pass.end") ;
setup_pass.getl ine(setcheck,8) ;
setup_pass.clos e();
p_set=getpass(" enter your setup password: ");
int passlen=strlen( p_set);
length=atoi(set check);
if(passlen==len gth)
{
for(int pc=0;pc<=passle n;pc++)
set_check[pc]=set_check[pc]-69;
if(!strcmp(p_se t,set_check))
setup();
else
cout<<"incorrec t password";
exit(0);
}
else
if(passlen!=len gth)
{
cout<<"incorrec t password";
exit(0);
}
}
}
if(*argv[1]!='e'&&argv[1]!='d'&&*argv[1]!='s'&&*argv[1]+'t')
{
help();
}
char line,logout;
char *passw;
char *passc;
char pass1[8],pass2[8];
long =-1;
double size=1.0;
double per=1.0;
char ch;
int flag=0;
float fin;
int fin_i;
ifstream check;
ifstream ifile;
ifstream inlog;
ofstream pas;
ofstream ofile;
ofstream logfile;
logfile.open("t emp.log");
ifile.open(argv[2]);
if(!ifile)
{
cout<<"Error opening Source File,will terminate";
exit(0);
}
check.open(argv[2],ios::in);
ofile.open(argv[3],ios::nonreplac e);
if (!ofile)
{
cout<<"Error opening Target File,will terminate";
exit(0);
}
while(check)
{
check.get(h);
size++;
}
check.close();
if(*argv[1]=='e')
{
cout<<"Mode: Encryption\n";
error_e;
passw=getpass(" Enter Password: ");
pas.open("temp. pas");
pas<<passw<<"\n ";
passc=getpass(" Verify Password: ");
pas<<passc;
pas.close();
check.open("tem p.pas");
check.getline(p ass1,8);
check.getline(p ass2,8);
check.close();
system("del temp.pas");
if(!strcmp(pass 1,pass2));
{
logfile<<"\n\nE ncrypted "argv[2]<<"to"<<argv[3];
logfile<<"\nwit h password"<<pass w;
logfile.close() ;
logfile.open("e nde.log",ios::a pp);
inlog.open("tem p.log");
while(!inlog.eo f())
{
inlog.get(logou t);
logout=logout+5 00;
logfile<<logout ;
}
logfile.close() ;
inlog.close();
system("del temp.log");
i=strlen(passw) ;
for(long k=0;k<=i;k++)
{
passw[k]=passw[k]+500;
ofile<<passw[k];
}
while(!ifile.eo f())
{
ifile.get(line) ;
line=line+enc;
ofile<<line;
if(size<10000)
enc++;
fin=(per/size)*100;
fin_i=(int)fin;
cout<<"\r"<<fin _i<<"% Complete ";
per++;
if(size>10000)
delay(0.001);
else
delay(per);
}
cout<<"\r"<<"Fi le Encrypted";
ifile.close();
ofile.close();
}
else
if(pass2!=pass1 )
{
cout<<"Password Mismatch, Re Enter Password\n";
goto error_e;
}
}
if(*argv[1]=='s')
{
cout<<"Mode: Deletion of Soyrce Fleafter Encryption\n";
error_s:
passw=getpass(" Enter Password: ");
pas.open("temp. pas");
pas<<passw<<"\n ";
passc=getpass(" Verify Password: ");
pas<<passc;
pas.close();
check.open("tem p.pas");
check.getline(p ass1,8);
check.getline(p ass2,8);
check.close();
system("del temp.pas");
if(!strcmp(pass 1,pass2))
{
logfile<<"Encry pted"<<argv[2]<<" to"<<argv[3];
logfile<<"\nwit h password"<<pasw ;
logfile.close() ;
logfile.open("e nde.log",ios::a pp);
inlog.open("tem p.log");
while(!inlog.eo f())
{
inlog.get(logou t);
logout=logout+5 00;
logfile<<logout ;
}
logfile.close() ;
inlog.close();
system<"del temp.log");
i=strlen(passw) ;
for(long k=0;k,=i;k++)
{
passw[k]=passw[k]+500;
ofile<<passw[k];
}
while(!ifile.eo f())
{
ifile.get(line) ;
line=line+enc;
ofile<<line;
if(size<10000)
enc++;
fin=(per/size)*100;
fin_i=(int)fin;
cout<<"\r"<<fin _i<<"% Complete";
per++;
if(size>10000)
delay(0.001);
else
delay(per);
}
cout<<"\r"<<"fi le Encrypted";
ifile.close();
ofile.close();
char del[80]="";
strcat(del,"del ");
strcat(del,argv[2]);
system(del);
cout<<"\nFile Deleted";
}
else
if(flag!=0)
{
cout<<"Password Mismatch,Re Enter password\n";
goto error_s;
}
}
else
if(*argv[1]=='d')
{
cout<<"Mode:Dec ryption \n";
char *passw;
passw=getpass(" Enter Password:m ");
i=strlen(passw) ;
for(long k=0;k<=i;k++)
{
passw[k]=passw[k]+500;
ifile.get(line) ;
if(passw[k]!=line)
{
cout<<"Password Incorrect";
exit(0);
}
}
logfile<<"\n\nD ecrypted"<<argv[2]<<"to"<<argv[3];
logfile.close() ;
logfile.open("E nDe.log",ios::a pp);
inlog.open("tem p.log");
while(!inlog.eo f())
{
inlog.get(logou t);
logout=logout+5 00;
logfile<<logout ;
}
logfile.close() ;
inlog.close();
system("del temp.log");
while(!file.eof ())
{
ifile.get(line) ;
line=line-enc;
ofile<<line;
if(size<10000)
enc++;
fin=(per/size)*100;
fin_i=(int)fin;
cout<<"\r"<<fin _i<<"% Complete";
per++;
if(size>10000)
delay(0.001);
else
delay(per);
}
cout<<"\r"<<"Fi le decrypted";
ifile.close();
ofile.close();
}
if(*argv[1]=='t')
{
cout<<"Mode:del etion of encrypted file after decryption\n";
passw=getpass(" enter password: ");
i=strlen(passw) ;
for(long k=0;k<=i;k++)
{
passw[k]=passw[k]+500;
ifile.get(line) ;
if(passw[k]!=line)
{
cout<<"password incorrect";
exit(0);
}
}
logfile<<"\n\nD ecrypted"<<argv[2]<<"to"<<argv[3];
logfile.close() ;
logfile.open("E nDe.log",ios::a pp);
inlog.open("tem p.log");
while(!inlog.eo f())
{
inlog.get(logou t);
logout=logout+5 00;
logfile<<logout ;
}
logfile.close() ;
inlog.close();
system("del temp.log");
while(!ifile.eo f());
{
ifile.get(line) ;
line=line-enc;
ofile<<line;
if(size<10000)
enc++;
fin=(per/size)*100;
fin_i=(int)fin;
cout<<"\r"<<fin _i<<"% Complete";
per++;
if(size>10000)
delay(0.001);
else
delay(per);
}
cout<<"\r"<<"fi le Decrypted";
ifile.close();
ofile.close();
char del[80]="";
strcat(del,{:"d el ");
strcat(del,argv[2]);
system(del);
cout<<"\nFile Deleted";
}
}
//menu.cpp
#include<iostre am.h>
#include<conio. h>
#include<dos.h>
#include<stdio. h>
#include<proces s.h>
void view();
void log();
void set_chan();
void file();
void help();
void about();
void pass();
void setup();
{
int flag=0;
int time;
one:
flag=0;
textcolor(15);
textbackground( 0);
clrscr();
union regs in,out;
cout<<"\n\n\n\n \n\n\t\t\tEnDe setup\n";
textcolor(0);
textbackground( 15);
cout<<"\t\t\t";
cprintf("1.View Logfile");
cout<<"\n\t\t\t 2.Clear logfile");
cout<<"\n\t\t\t 3.Change Setup Password";
cout<<"\n\t\t\t 4.Change Encrypted File's Password";
cout<<"\n\t\t\t 5.Help On Using EnDe";
cout<<"\n\t\t\t 6.About";
cout<<"\n\t\t\t 7.Quit";
swone:
for(time=0;time <3000;time++)
{
delay(10);
if(kbhit())
{
flag=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&o ut);
switch(out.h.ah )
{
case72:
goto seven;
case 28:
textbackground( 0);
textcolor(15);
clrscr();
view();
getch();
goto one;
case 80:
goto two;
default:
goto swone;
}
}
else
{
textbackground( 0);textcolor(7) ;
pass();
}
two:
flag=0;
textbackground( 0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n \n\n\n\t\t\tEnD e Setup";
textcolor(0);
textbackground( 15);
cout<<"\n\t\t\t 1.View logfile";
cout<<"\n\t\t\t ";
cprintf("2.Clea r LogFile");
cout<<"\n\t\t\t 3.Change Setup Password";
cout<<"\n\t\t\t 4.Change Encrypted File's Password";
cout<<"\n\t\t\t 5.Help on using EnDe";
cout<<"\n\t\t\t 6.About";
cout<<"\n\t\t\t 7.Quit";
swtwo:
for(time=0;time <3000:time++)
{
delay(10);
if(kbhit())
{
flag=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&o ut);
switch(out.h.ah )
{
case 72:
goto one;
case 28:
textbackground( 0);
textcolor(15);
clrscr();
log();
goto one;
case 80:
goto three;
default:
goto swtwo;
}
}
else
{
textcolor(7);
textbackground( 0);
pass();
}
three;
falg=0;
textbackground( 0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n \n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground( 15);
cout<<"\n\t\t\t 1.View Logfile";
cout<<"\n\t\t\t 2.Clear Logfile";
cout<<"\n\t\t\t ";
cprintf("3.Chan ge Setup Password");
cout<<"\n\t\t\t 4.Change Encrypted File's Password";
cout<<"\n\t\t\t 5.Help on using EnDe";
cout<<"\n\t\t\t 6.About";
cout<<"\n\t\t\t 7.Quit";
swthree:
for(time=0;time <3000;time++)
{
delay(10);
if(kbhit())
{
flag=1;
break;
}
}
if (flag==1)
{
in.h.ah=0;
int86(22,&in,ou t);
switch(out.h.ah )
{
case 72:
goto two;
case 28:
textbackground( 0);
textcolor(15);
clrscr();
set_chan();
goto one;
case 80:
goto four;
default:
goto swthree;
}
}
else
{
textcolor(7)
textbackground( 0)
pass();
}
four:
flag=0;
textbackground( 0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n \n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground( 15);
cout<<"\n\t\t\t 1.View Logfile";
cout<<"\n\t\t\t 2.Clear Logfile";
cout<<"\n\t\t\t 3.Change Setup Password";
cout<<"\n\t\t\t ";
cprintf("4.Chan ge Encrypted File's Password");
cout<<"\n\t\t\t 5.Help on using EnDe";
cout<<"\n\t\t\t 6.About";
cout<<"\n\t\t\t 7.Quit";
swfour:
for(time=0;time <3000;time++)
{
delay(10);
if(kbhit())
{
falg=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&o ut);
switch(out.h.ah )
{
case72:
goto three;
case 28:
textbackground( 0);
textcolor(15);
clrscr();
file();
goto one;
case 80:
goto five;
default;
goto swfour;
}
}
else
{
textcolor(7);
textbackground( 0);
pass();
}
five:
flag=0;
textbackground( 0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n \n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground( 15);
cout<<"\n\t\t\t 1.View Logfile";
cout<<"\n\t\t\t 2.Clear Logfile";
cout<<"\n\t\t\t 3.Change Setup Password";
cout<<"4.Change Encrypted File's Password";
cout<<"\n\t\t\t ";
cprintf("5.Help on using EnDe");
cout<<"\n\t\t\t 6.About";
cout<<"\n\t\t\t 7.Quit";
swfive:
for(time=0;time <3000;time++)
{
delay(10);
if(kbhit())
{
falg=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&o ut);
switch(out.h.ah )
{
case72:
goto four;
case 28:
textbackground( 0);
textcolor(15);
clrscr();
help();
getch();
goto one;
case 80:
goto six;
default:
goto swfive;
}
}
else
{
textcolor(7);
textbackground( 0);
pass();
}
six:
flag=0;
textbackground( 0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n \n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground( 15);
cout<<"\n\t\t\t 1.View Logfile";
cout<<"\n\t\t\t 2.Clear Logfile";
cout<<"\n\t\t\t 3.Change Setup Password";
cout<<"4.Change Encrypted File's Password";
cout<<"\n\t\t\t 5.Help on using EnDe";
cout<<"\n\t\t\t ";
cprintf("6.Abou t");
cout<<"\n\t\t\t 7.Quit";
swsix:
for(time=0;time <3000;time++)
{
delay(10);
if(kbhit())
{
falg=1;
break;
}
}
if(flag==1)
{
in.h.ah=0;
int86(22,&in,&o ut);
switch(out.h.ah )
{
case72:
goto five;
case 28:
textbackground( 0);
textcolor(15);
clrscr();
about();
getch();
goto one;
case 80:
goto seven;
default:
goto swsix;
}
}
else
{
textcolor(7);
textbackground( 0);
pass();
}
seven:
flag=0;
textbackground( 0);
textcolor(15);
clrscr();
cout<<"\n\n\n\n \n\n\t\t\tEnDe Setup";
textcolor(0);
textbackground( 15);
cout<<"\n\t\t\t 1.View Logfile";
cout<<"\n\t\t\t 2.Clear Logfile";
cout<<"3.Change Setup password";
cout<<"\n\t\t\t 4.Change Encrypted File's Password";
cout<<"5.Help on using EnDe";
cout<<"\n\t\t\t 6.About";
cout<<"\n\t\t\t ";
cprintf("7.Quit ");
swseven:
for(time=0;time <3000;time++)
{
delay(10);
if (kbhit())
{
flag=1;
break;
}
}
if (flag==1)
{
in.h.ah=0;
int86(22,&in,&o ut);
switch(out.h.ah )
{
case72:
soto six;
case 28:
tetbackground(0 );
textcolor(15);
clrscr();
exit(0);
getch();
goto one;
case 80:
goto one;
default:
goto swseven;
}
}
else{
textcolor(7);
textbackground( 0);
pass();
}
}
}
#include<fstrea m.h>
#include<conio. h>
void view()
{
clrscr();
ifstream ifile;
char line;
while(ifile)
{
ifile.open("end e.log");
line=line-500;
cout<<line;
}
}
#include<fstrea m.h>
#include<conio. h>
#include<dos.h>
void log()
{
cout<<"Are you sure you want to clear the log fike?(y/n)";
char ch;
cin>>ch;
if(ch=='y'||ch= ='Y')
{
ofstream clear;
clear.open("end e.log",ios::tru nc);
clear.close();
cout<<"Log file clearde";
getch();
}
}
#include<fstrea m.h>
#include<conio. h>
#include<string .h>
#include<stdio. h>
#include<proces s.h>
void file()
{
int=-1;
ifstream ifile;
char *fname;
char line;
char *passw,*passc;
char pass[8],pass2[8];
cout<<"Enter the name and path of the file:";
cout<<"\nNote:T O the password of a file you must be in the
directory holding the file";
cout<<"\nEnDe:\ >";
gets(fname);
ifile.open(fnam e);
if(!ifile)
{
cout<<"Could not open file";
exit(1);
}
passw=getpass(" Enter current Password:");
i=strlen(passw) ;
for(ini k=0;k<=1;k++)
{
passw[k]=passw[k]+500;
ifile.get(line) ;
if(passw[k]!=line)
{
cout<<"Password Incorrect";
exit(0);
}
}
ofstream ofile;
ifstream check;
ofile.open("tem p.pad");
passw=getpass(" Enter new password:");
ofile<<passw<<" \n";
passc=getpass(" Verify Password");
ofile<<passc;
ofile.close();
check.open("tem p.pas");
check.getline(p ass1,8);
check.getline(p ass2,8);
check.close();
system("del temp.pas");
if(!strcmp(pass 1,pass2))
{
ofile.open("tem p.tem");
i=strlen(pass1) ;
for(k=0;k<=i;k+ +)
{
pass1[k]=pass1[k]+500;
ofile<<pass1[k];
}
while(!ifile.eo f())
{
ifile.get(line) ;
ofile<<line;
}
cout<<"Password changed successfully";
}
char source[50]="",dest[50]="";
strcat(source," del ");
strcat(source,f name);
strcat(dest,"re n");
strcat(dest,"te mp.tem");
ofile.close();
ifile.close();
strcat(dest,fna me);
system(source);
system(dest);
}
#include<fstrea m.h>
#include<conio. h>
#include<string .h>
#include<stdlib .h>
void set_chan()
{
ofstream setup;
ifstream check;
char *pass,*passc;
char pass1[8],pass2[8];
setup.open("tem p.pas");
pass=getpass("N ew Password:");
int passlen=strlen( pass);
setup<<pass<<"\ n";
passc=getpass<" Verify Password:");
setup<<pasc;
setup.close();
check.open("tem p.pas");
check.getline(p ass1,8);
check.getline(p ass2,8);
check.close();
system("del temp.pas");
setup.open(:"pa ss.end");
if(!strcmp(pass 1,pass2))
{
setup<<passlen;
for(int i=0;i<=passlen; i++)
{
pass1[i]=pass1[i]+69;
setup<<pass1[i];
}
cout<<"The password has been changed successfully";
}
else
cout<<"The Passwords do not match";
getch();
setup.close();
}
#include<iostre am.h>
#include<conio. h>
void help()
{
clrscr();
cout<"\nEncrypt or-Decryptor ver 3.0 usage help:\n";
cout<<"Syntax:\ n";
cout<<"\tEnDe<o ption><source path and file><target path and file>
\n";
cout<<"\n\nOpti ons:\n";
cout<<"E :Encryption Mode\n";
cout<<"D :Decryption Mode\n";
cout<<"S :Delete Source file after Encryption\n";
cout<<"T :Delete Encrypted file afte decryptionn\n";
cout<<"\n\nOr when in EnDe Setup mode,there are five options:\n";
cout<<"1.Clear log File:\n";
cout<<"\tLog File is a file which keeps the history of all the
operations\n";
cout<<"\tcarrie d out through EnDe,in an encrypted format\n";
cout<<"\t This fynction clears the log file so no one can retrieve
the password\n";
cout<<"\tof any of your encrypted files if he knows your setup
password\n";
cout<<"\n\n\n\n ||more||";
getch();
clrscr();
cout<<"2.Change the setup password:\n";
cout<<"\tThis function changes the setup password through which you
can\n";
cout<<"\tagain access to the Setup Menu\n";
cout<<"3.Change the password of an encrypted file:\n";
cout<<"\tThis function changes the password of an already encrypted
file\n";
cout<<"\n4.Help \n";
cout<<"\nAbout: \n";
cout<<"\tGives version information and the names of the developers(s)
\n";
cout<<"\n6.Quit :\n";
cout<<"\tQuit EnDe Setup Menu\n";
}
#include<iostre am.h>
#include<conio. h>
void about()
{
clrscr();
cout<<"(Encrypt or-Decryptor)versi on3.0 for MS-DOS\n";
cout<<"<c>2001- R.G.Infotech Ltd.-Project Release\n";
}
#include<fstrea m.h>
#include<stdlib .h>
#include<string .h>
#include<dos.h>
#include<conio. h>
void setup();
void pass()
{
char *p_set;
char set_check[8],setcheck[8],checkpass;
int length;
ifstream setup_pass;
setup_pass.open ("pass.end") ;
setup_pass.get( checkpass);
setup_pass.getl ine(set_check,8 );
setup_pass.clos e();
setup_pass.open ("pass.end") ;
setup_pass.getl ine(setcheck,8) ;
setup_pass.clos e();
clrscr();
char color[80];
ifstream clrs;
clrs.open("grap h.dsp");
for(int col=1;col<=11;c ol++)
{
clrs.getline(co lor,80);
textcolor(col);
for(int no=0;no<strlen( color);no++)
{
putch(color[no]);
delay(7.5);
}
cout<<"\n";
}
clrs.close();
textcolor(10);
int pc;
pcheck:
p_set=getpass(" Enter your setup password:");
int passlen=strlen( p_set);
length=atoi(set check);
if(passlen==len gth)
{
for(pc=0;pc<=pa sslen;pc++)
p_set[pc]=p_set[pc]+69;
if(!strcmp(p_se t,set_check))
setup();
else
goto pcheck;
}
else
goto pcheck;
}
Comment