public
anonymous / highlyInsecure.cpp
Last active

How (NOT!) to lock a folder with password without software

  • Download Gist
highlyInsecure.cpp
C++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
//source from http://ansblog.com/2009/12/how-to-lock-a-folder-with-password-without-software/
//Indentation mistakes may have occurred during transcription, as the original was not indented
//Empty lines, likewise, were inserted haphazardly, as the original did not have any
 
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
#include<stdlib.h>
 
int main()
{
int ch;
char pass[4]=aaa,passcon[20],passw[20],pass1[20],conpass[20],dn[20]=md x:\\locker,dr;
char com1[100]=ren x:\\locker explorer.{20D04FE0-3AEA-1069-A2D8-08002B30309D},com2[100]=attrib +r +h +s x:\\explorer.{20D04FE0-3AEA-1069-A2D8-08002B30309D};
char com3[100]=attrib -r -h -s x:\\explorer.{20D04FE0-3AEA-1069-A2D8-08002B30309D},com4[100]=ren x:\\explorer.{20D04FE0-3AEA-1069-A2D8-08002B30309D} locker;
char tet[50]=c:\\windows\\inf\\pass.txt,tet1[50]=c:\\windows\\inf\\dr.txt;
 
do
{
cout<<”\n\t\t1.Make Locker\n;
cout<<”\n\t\t2.Lock\n;
cout<<”\n\t\t3.Unlock\n;
cout<<”\n\t\t4.Reset Password\n;
cout<<”\n\t\t5.Exit\n;
cout<<”\n\t\tEnter Choice : ;
cin>>ch;
 
if(ch==1)
{
cout<<Enter a valid drive letter to create locker (ex. c)\t:;
cin>>dn[3];
system(dn);
ofstream finp;
finp.open(tet);
finp<<pass;
ofstream finr;
finr.open(tet1);
finr<<dn[3];
finp.close();
finr.close();
cout<<LOCKER CREATED SUCCESSFULLY;
cout<<”\nPress any key to return to menu…”;
getch();
system(cls);
}
else if(ch==2)
{ifstream finp;
ifstream finr;
finp.open(tet);
finr.open(tet1);
finp>>pass1;
finr>>dr;
finp.close();
finr.close();
 
if(strcmp(pass1,aaa)==0)
{ do
{
cout<<”\nEnter password\t:;
cin>>pass;
cout<<”\nConfirm password\t:;
cin>>passcon;}
while(strcmp(pass,passcon)!=0);
 
ofstream fout;
fout.open(tet);
fout<<pass;
fout.close();
cout<<”\nPASSWORD SET;
com1[4]=dr;
com2[16]=dr;
system(com1);
system(com2);
cout<<”\nLOCKER LOCKED SUCCESSFULLY;
cout<<”\nPress any key to return to menu…\n;
getch();
system(cls);
}
else
{cout<<”\nEnter password\t:;
cin>>passw;
ifstream finp;
ifstream finr;
finp.open(tet);
finr.open(tet1);
finp>>pass1;
finr>>dr;
finr.close();
finp.close();
 
if(strcmp(passw,pass1)==0)
{com1[4]=dr;
com2[16]=dr;
system(com1);
system(com2);
cout<<”\nLOCKER LOCKED SUCCESSFULLY;
cout<<”\nPress any key to return to menu…\n;
getch();
system(cls);}
 
else
{cout<<”\nWRONG PASSWORD;
cout<<”\nPress any key to return to menu…\n;
getch();}
system(cls);
} }
else if(ch==3)
{cout<<”\nEnter password\t:;
cin>>conpass;
ifstream finp;
ifstream finr;
finp.open(tet);
finr.open(tet1);
finp>>pass1;
finr>>dr;
finr.close();
finp.close();
if(strcmp(conpass,pass1)==0)
{com4[4]=dr;
com3[16]=dr;
system(com3);
system(com4);
cout<<”\nLOCKER UNLOCKED SUCCESSFULLY;
cout<<”\nPress any key to return to menu…\n;
getch();}
else
{cout<<”\nWRONG PASSWORD!!!;
cout<<”\nPress any key to return to menu…\n;
getch();}
system(cls);
}
else if(ch==4)
{cout<<”\nEnter old password\t:;
cin>>passw;
ifstream finp;
ifstream finr;
finp.open(tet);
finr.open(tet1);
finp>>pass1;
finr>>dr;
finr.close();
finp.close();
if(strcmp(pass1,passw)==0)
{cout<<”\nEnter new password;
cin>>pass1;
ofstream finp;
finp.open(tet);
finp<<pass1;
finp.close(); }
else
{cout<<WRONG PASSWORD!!!;}
cout<<”\nPress any key to return to menu…”;
getch();
system(cls);
}
else
{cout<<”\n\t\tWrong Choice\n;system(cls);}
}while(ch!=5);
return 0;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.