Advertisement
2002C Security #16454

No Control C Password

This is a password script. Every charachter the user input it displays a star. the password is kcTHEgreat. Catches Control c (Taught to me by a friend :)) so the only way out is to enter the correct password. If you like and think it's secure put it in your autoexec.bat

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
#include <signal.h>
#include <string>
#include <dos.h>
void restart();
void loop(int signal)
{
 return;
}
int main()
{
 system ("cls");
 char key;
 char password[] ="kcTHEgreat";// your password goes here
 int counter=0;
 char kcpassword[counter];
 cout << "Password: ";
 cout << flush;
 for (;;)
 {
 if (signal(SIGINT, loop)) {};
 cout << flush;
 key=getch();
 if (key=='\r')
 {
 break;
 }
 else
 {
 cout << flush;
 kcpassword[counter]=key;
 counter++;
 cout << "*";
 }
 }
 int flag=1;
 for (int x=0;x<counter;x++)
 {
 if (kcpassword[x]!=password[x] || strlen(password)!=counter)
 {
 flag=0;
 break;
 }
 }
 system ("cls");
 if (counter==0)
 restart();
 if (flag==0)
 {
 gotoxy(35,10);textcolor(12);cprintf("!!DENIED!!");
 delay(1000);
 restart();
 }
 else
 {
 gotoxy(30,10);textcolor(12);cprintf("!!ACCESS GRANTED!!");
 for (int x=0;x<3000;x++);
 delay(1000);
 }
 return 0;
}
void restart()
{
 main();
}
Original Comments (3)
Recovered from Wayback Machine