Click here to Skip to main content
Licence CPOL
First Posted 18 Dec 2007
Views 12,574
Downloads 259
Bookmarked 33 times

HackPro: All About about network

By | 18 Dec 2007 | Article
HackPro is a utility developed for System Administrators and Software developers for the purpose of monitoring analyzing and maintaining their network

Introduction

This article is about the tool written by me named HackPro.

Background

HackPro is a utility developed for System Administrators and Software developers for the purpose of monitoring analyzing and maintaining their network. It consists of manyfunctionalities that is necessary for the administrators to monitor and maintain their network.

It is developed upon concepts that have been used by hackers previously to monitor and attack the network.

HackPro ScreenShot

Using the code

HackPro has multiple functionality you can use its code for writing.

  • Dll Injector
  • Understand Socket APIs
  • Understand CSocket details.
  • Implement Raw Packet Sender
  • Understand ARP Process

Here is an example of DLL Injection

void InjectDll(HANDLE hProc)
{
 DWORD dwFuncSize=0;
    DWORD dwBytesToAlloc=0;
    LPVOID pRemoteAlloc = NULL;
    REMOTE_INFO remInfo;
    HINSTANCE hKernel32=0;
    CHAR szDllName[MAX_PATH];
    DWORD dwBytesWritten;
    HANDLE hRemoteThread = 0;
    DWORD dwIgnored;
  //
    // Prepare the info to send across
    //
 //HANDLE hProc=OpenProcess(PROCESS_ALL_ACCESS,FALSE,Pid);
    hKernel32 = LoadLibrary ("Kernel32");
    remInfo.pLoadLibrary = (pLoadLib_t) GetProcAddress (hKernel32, "LoadLibraryA");
    remInfo.pGetProcAddress = (pGetProcAddr_t) GetProcAddress (hKernel32, "GetProcAddress");
    remInfo.pFreeLibrary = (pFreeLib_t) GetProcAddress (hKernel32, "FreeLibrary");
    strncpy (remInfo.szDllName, DllPath, sizeof (remInfo.szDllName));
    strncpy (remInfo.szProcName, "OnLoad", sizeof (remInfo.szProcName));
    
    //
    // Determine amount of memory to allocate
    //
 dwFuncSize = (DWORD)DummyFunc - (DWORD)RemoteFunction;
    dwBytesToAlloc = dwFuncSize + sizeof (REMOTE_INFO) + 4;
    //
    // Allocate memory in remote proc
    //
    pRemoteAlloc = VirtualAllocEx (hProc, NULL, dwBytesToAlloc,MEM_COMMIT, PAGE_READWRITE);
    if (pRemoteAlloc == NULL)
    {
        CString str;
  str.Format("VirtualAllocEx Error code (GetLastError)=%d",GetLastError());
  MessageBox(NULL,str,"Error",0);
        return ;
    }
     //
    // Write data to the proc
    //
    if(!WriteProcessMemory (hProc, pRemoteAlloc, &remInfo, sizeof (remInfo),&dwBytesWritten))
    {
        CString str;
  str.Format("WriteProcessMemory1 Error code (GetLastError)=%d",GetLastError());
  MessageBox(NULL,str,"Error",0);
        goto exit;
    }
    //
    // Write code to the proc
    //
 if (!WriteProcessMemory (hProc,(PBYTE)pRemoteAlloc + sizeof (REMOTE_INFO) + 4,(LPVOID)(DWORD)RemoteFunction, dwFuncSize, &dwBytesWritten))
 {
        
  CString str;
  str.Format("WriteProcessMemory2 Error code (GetLastError)=%d",GetLastError());
  MessageBox(NULL,str,"Error",0);
        goto exit;
    }
    //
    // Create the remote thread
    //
 //hRemoteThread = CreateRemoteThread (hProc, NULL, 0,(LPTHREAD_START_ROUTINE)remInfo.pLoadLibrary,DllPath, 0,&dwIgnored);
    hRemoteThread = CreateRemoteThread (hProc, NULL, 0,(LPTHREAD_START_ROUTINE)((PBYTE) pRemoteAlloc + sizeof (REMOTE_INFO) + 4),pRemoteAlloc, 0, &dwIgnored);
    if (!hRemoteThread)
    {
        MessageBox(NULL,"CreateRemoteThread Error","Dll Injection Failed",NULL);
        goto exit;
    }
 //WaitForSingleObject (hRemoteThread, INFINITE);
  
exit:
 if (hRemoteThread)
        CloseHandle (hRemoteThread);
   // VirtualFreeEx (hProc, pRemoteAlloc, 0, MEM_RELEASE);
   return ;
}        

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

markandeysingh

Software Developer

India India

Member

(Computer) Engineer, (Life)Hacker, (Tech)Blogger

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Layout  Per page   
  Refresh
QuestionOH RLY? Pinmember aphazel 死神4:02 12 Jan '10  
AnswerRe: OH RLY? PinmemberPrafullaVedante19:16 13 Nov '11  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 18 Dec 2007
Article Copyright 2007 by markandeysingh
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid