Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

very simple security Console | C++

Hello HF community .. I'm Sharing with you my very simple
security console source code .
the idea is the console starts up when windows starts
[put the console in startup folder manually]
Once started it will kill explorer.exe process.
the PC will look like nothing but black screen with the console on it [desktop background may appear sometimes too]
it will ask you to Enter you password , And if it was correct it will start explorer.exe else will shut down the PC.
hope u like the idea.
I'd love to hear ur feedback about this .

Code
#include<iostream>
#include<stdlib.h>
#include<fstream>
#include<string>

using namespace std;

static string password;
ofstream savaData;
ifstream getData;
string userPass;
void line();void header();void taskKiller();void taskStarter();
void passwordSetter(string);bool passwordChecker(string);
void dash();bool passStatus();

//Section of Main //
void main (){
    header();
    if(passStatus()){
        cout<<"\tEnter The Password inorder to Gain Access To the system : \n\t";
        cin >> userPass;
        if (passwordChecker(userPass)){
         cout<<"\tPassword Matched successfully !\n\t";
         taskStarter();
        }else{
            system("color 0c");
            cout<<"\n\tWrong Information , Security Console Will now shutdown your system...";
            system("shutdown /s -t 05 /f");
        }
    }else{
        cout<<"\tPassword Has not been set yet , Set your New Password Here :\n\t";
        cin >> userPass;    
        passwordSetter(userPass);
        taskStarter();
    }
    system("pause");
}
//<header Functions>..

void dash(char x){
cout<<"\n\t#";
   for(int i=0;i<=62;i++)
       cout<<x;
   cout<<"#";
}

void line(){
for(int i=0;i<=20;i++)
    cout<<"#";
}

void header(){
    taskKiller();
    system("title Security Console");
    system("color 0a");
    cout<<"\t \n"<<endl;
  system("cls");
  cout<<"\t";
  line();
   cout<<" Security Console 18.1 ";
   line();
   dash(' ');
   cout<<"\n\t#\t Written By : #Kali ### Shadow |HFC| # First Version \t#";
   dash(' ');
   dash('#');
   cout<<endl<<endl;
}

//</header Functions>..

void passwordSetter(string pass){
    savaData.open("setting.dat");
    savaData << pass;
    savaData.close();
}

bool passStatus()
{ bool res = false;
    getData.open("setting.dat");
    getData >> password;
    getData.close();
    if (password.compare("") == 0){
        res = false;
    }else{
        res = true;
    }
    return res;
}

bool passwordChecker(string x){
    bool res = false;
    if (password.compare(x) == 0){
    res = true;
    }else{
    res = false;
    }
    return res;
}

void taskKiller()
{
    system("taskkill /IM explorer.exe /f");
}

void taskStarter()
{
    system("start explorer.exe");
}
(Jun 25, 2018 04:03 PM)Kali_Shadow Wrote:  Hello HF community .. I'm Sharing with you my very simple
security console source code .
the idea is the console starts up when windows starts
[put the console in startup folder manually]
Once started it will kill explorer.exe process.
the PC will look like nothing but black screen with the console on it [desktop background may appear sometimes too]
it will ask you to Enter you password , And if it was correct it will start explorer.exe  else will shut down the PC.
hope u like the idea.
I'd love to hear ur feedback about this .

Code
#include<iostream>
#include<stdlib.h>
#include<fstream>
#include<string>

using namespace std;

static string password;
ofstream savaData;
ifstream getData;
string userPass;
void line();void header();void taskKiller();void taskStarter();
void passwordSetter(string);bool passwordChecker(string);
void dash();bool passStatus();

//Section of Main //
void main (){
header();
if(passStatus()){
cout<<"\tEnter The Password inorder to Gain Access To the system : \n\t";
cin >> userPass;
if (passwordChecker(userPass)){
cout<<"\tPassword Matched successfully !\n\t";
taskStarter();
}else{
system("color 0c");
cout<<"\n\tWrong Information , Security Console Will now shutdown your system...";
   system("shutdown /s -t 05 /f");
}
}else{
cout<<"\tPassword Has not been set yet , Set your New Password Here :\n\t";
cin >> userPass;
passwordSetter(userPass);
taskStarter();
}
system("pause");
}
//<header Functions>..

void dash(char x){
cout<<"\n\t#";
  for(int i=0;i<=62;i++)
  cout<<x;
  cout<<"#";
}

void line(){
for(int i=0;i<=20;i++)
cout<<"#";
}

void header(){
taskKiller();
system("title Security Console");
system("color 0a");
cout<<"\t \n"<<endl;
 system("cls");
 cout<<"\t";
 line();
  cout<<" Security Console 18.1 ";
  line();
  dash(' ');
  cout<<"\n\t#\t Written By : #Kali ### Shadow |HFC| # First Version \t#";
  dash(' ');
  dash('#');
  cout<<endl<<endl;
}

//</header Functions>..

void passwordSetter(string pass){
savaData.open("setting.dat");
savaData << pass;
savaData.close();
}

bool passStatus()
{ bool res = false;
getData.open("setting.dat");
getData >> password;
getData.close();
if (password.compare("") == 0){
res = false;
}else{
res = true;
}
return res;
}

bool passwordChecker(string x){
bool res = false;
if (password.compare(x) == 0){
res = true;
}else{
res = false;
}
return res;
}

void taskKiller()
{
system("taskkill /IM explorer.exe /f");
}

void taskStarter()
{
system("start explorer.exe");
}

you should never use system() function. try another method.
[Image: 5Iq5rDJ.gif]

winapi, and winsock programmer

(Jun 25, 2018 05:08 PM)aeiro Wrote:  you should never use system() function. try another method.

Hey aeiro thanks for ur advice , may I know why ?
and if you know another function to replace I would like to know .
(Jun 25, 2018 05:11 PM)Kali_Shadow Wrote:  Hey aeiro thanks for ur advice , may I know why ?
and if you know another function to replace I would like to know .

i've always thought that it'd be easy to hook. but if you google it you may find different results but theyre always negative.
Its also not about a single function. Look into terminating an application from another.

ps.. sorry for all the edits. trying to play WWII
[Image: 5Iq5rDJ.gif]

winapi, and winsock programmer

interesting, thanks for the source.
An abstract idea, however, it's flawed.

I can simply start Task Manager with the keyboard shortcut and then run explorer.exe from there, thus eliminating any protection this has.

Also why would a user need this? Windows provides the ability to add a password to an account, what makes this a better alternative?

My suggestion is don't limit yourself to user-mode non-administrative programs, If you want to provide security for a user (like an anti-virus for instance) you should look into elevated processes, this will give your program more control over the system thus granting you the ability to do more then simply killing a process, such as loading a kernel driver. A kernel driver will grant you more or less full control over a system, this is what most modern-day anti-viruses use, from there to possibilities are endless. Just a suggestion, what you have here is good but just not secure enough to be considered a security based program. Good luck!  ✌
(Jun 26, 2018 11:04 AM)hunter24957 Wrote:  An abstract idea, however, it's flawed.

I can simply start Task Manager with the keyboard shortcut and then run explorer.exe from there, thus eliminating any protection this has.

Also why would a user need this? Windows provides the ability to add a password to an account, what makes this a better alternative?

My suggestion is don't limit yourself to user-mode non-administrative programs, If you want to provide security for a user (like an anti-virus for instance) you should look into elevated processes, this will give your program more control over the system thus granting you the ability to do more then simply killing a process, such as loading a kernel driver. A kernel driver will grant you more or less full control over a system, this is what most modern-day anti-viruses use, from there to possibilities are endless. Just a suggestion, what you have here is good but just not secure enough to be considered a security based program. Good luck!  ✌
thanks a lot for your feedback bro , that meant a lot to me
(Jun 26, 2018 11:25 AM)Kali_Shadow Wrote:  thanks a lot for your feedback bro , that meant a lot to me

No problem man, C++ is a great language to use for this stuff, keep at it!  👍
I could just enter few hundred characters for buffer overflow causing your program to shutdown and give me access to explorer.exe ;)
I +3 rep4rep <3
For website hacking, custom malware, private RAT source code, dumps etc contact me on TG: @yealink2
(Jun 28, 2018 01:47 AM)stdio Wrote:  I could just enter few hundred characters for buffer overflow causing your program to shutdown and give me access to explorer.exe ;)

that will cause the program to shutdown without running the line where explorer.exe start .. you will have a blank screen , And you would have to restart ur pc

but the hole of Ctrl + alt + Del is true problem..
(Jun 28, 2018 06:29 AM)Kali_Shadow Wrote:  that will cause the program to shutdown without running the line where explorer.exe start .. you will have a blank screen , And you would have to restart ur pc

but the hole of Ctrl + alt + Del is true problem..

how is this a problem?
Hook into the keyboard and catch this combination and all other possible shortcuts.
[Image: 5Iq5rDJ.gif]

winapi, and winsock programmer

(Jun 28, 2018 06:29 AM)Kali_Shadow Wrote:  that will cause the program to shutdown without running the line where explorer.exe start .. you will have a blank screen , And you would have to restart ur pc

but the hole of Ctrl + alt + Del is true problem..

you can always start explorer.exe, what is stopping after app is closed?
I +3 rep4rep <3
For website hacking, custom malware, private RAT source code, dumps etc contact me on TG: @yealink2
(Jun 28, 2018 12:00 PM)stdio Wrote:  you can always start explorer.exe, what is stopping after app is closed?

isnt there a warning saying something about explorer.exe has stopped. restart the process?
[Image: 5Iq5rDJ.gif]

winapi, and winsock programmer

(Jun 28, 2018 11:59 AM)aeiro Wrote:  how is this a problem?
Hook into the keyboard and catch this combination and all other possible shortcuts.

If you don't mind me asking, how would he achieve this?

From the way I see it, Ctrl+Alt+Del generates a Window's interrupt, it's handled by the CPU on Kernel level.

How would a simple User-mode non-privileged program stop this from happening?
(Jun 28, 2018 12:17 PM)hunter24957 Wrote:  If you don't mind me asking, how would he achieve this?

From the way I see it, Ctrl+Alt+Del generates a Window's interrupt, it's handled by the CPU on Kernel level.

How would a simple User-mode non-privileged program stop this from happening?

Didn't think about that one.Yeah now we're damn near talking about driver dev here.
[Image: 5Iq5rDJ.gif]

winapi, and winsock programmer



Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by LaTortueSep 1, 2018 09:00 PM 2 200 Sep 1, 2018 09:00 PM
Last Post: vagabond
[C#] by LaTortueJul 30, 2016 09:07 AM 11 540 Jul 30, 2016 09:07 AM
Last Post: Silence Root
[Java] by FoShizzleMyNizzleApr 23, 2016 07:43 AM 1 117 Apr 23, 2016 07:43 AM
Last Post: Sogomn