Skip to content

Commit cd47948

Browse files
authored
Merge pull request #1 from BKLockly/release-v1.0.0
Release v1.0.0
2 parents 0b9ed07 + c2f54c7 commit cd47948

40 files changed

+928
-0
lines changed
Binary file not shown.
Binary file not shown.

.vs/Timestamp/v17/.suo

32 KB
Binary file not shown.

.vs/Timestamp/v17/Browse.VC.db

30.9 MB
Binary file not shown.
48.6 MB
Binary file not shown.
48.8 MB
Binary file not shown.
46.6 MB
Binary file not shown.
46.6 MB
Binary file not shown.

Timestamp.sln

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34330.188
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Timestamp", "Timestamp\Timestamp.vcxproj", "{EC92988C-4BEC-4CA5-98F0-243B88E0F029}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
BOF|x64 = BOF|x64
11+
BOF|x86 = BOF|x86
12+
Debug|x64 = Debug|x64
13+
Debug|x86 = Debug|x86
14+
Release|x64 = Release|x64
15+
Release|x86 = Release|x86
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{EC92988C-4BEC-4CA5-98F0-243B88E0F029}.BOF|x64.ActiveCfg = BOF|x64
19+
{EC92988C-4BEC-4CA5-98F0-243B88E0F029}.BOF|x64.Build.0 = BOF|x64
20+
{EC92988C-4BEC-4CA5-98F0-243B88E0F029}.BOF|x86.ActiveCfg = BOF|Win32
21+
{EC92988C-4BEC-4CA5-98F0-243B88E0F029}.BOF|x86.Build.0 = BOF|Win32
22+
{EC92988C-4BEC-4CA5-98F0-243B88E0F029}.Debug|x64.ActiveCfg = Debug|x64
23+
{EC92988C-4BEC-4CA5-98F0-243B88E0F029}.Debug|x64.Build.0 = Debug|x64
24+
{EC92988C-4BEC-4CA5-98F0-243B88E0F029}.Debug|x86.ActiveCfg = Debug|Win32
25+
{EC92988C-4BEC-4CA5-98F0-243B88E0F029}.Debug|x86.Build.0 = Debug|Win32
26+
{EC92988C-4BEC-4CA5-98F0-243B88E0F029}.Release|x64.ActiveCfg = Release|x64
27+
{EC92988C-4BEC-4CA5-98F0-243B88E0F029}.Release|x64.Build.0 = Release|x64
28+
{EC92988C-4BEC-4CA5-98F0-243B88E0F029}.Release|x86.ActiveCfg = Release|Win32
29+
{EC92988C-4BEC-4CA5-98F0-243B88E0F029}.Release|x86.Build.0 = Release|Win32
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) = preSolution
32+
HideSolutionNode = FALSE
33+
EndGlobalSection
34+
GlobalSection(ExtensibilityGlobals) = postSolution
35+
SolutionGuid = {C0E24622-9AFE-4A0C-9B21-9CA349027359}
36+
EndGlobalSection
37+
EndGlobal

Timestamp/Source.c

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#include <stdio.h>
2+
#include <Windows.h>
3+
#include "beacon.h"
4+
5+
DECLSPEC_IMPORT BOOL WINAPI KERNEL32$SetFileTime(HANDLE, const FILETIME*, const FILETIME*, const FILETIME*);
6+
DECLSPEC_IMPORT HANDLE WINAPI KERNEL32$CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
7+
DECLSPEC_IMPORT BOOL WINAPI KERNEL32$CloseHandle(HANDLE);
8+
DECLSPEC_IMPORT BOOL WINAPI KERNEL32$GetFileTime(HANDLE, LPFILETIME, LPFILETIME, LPFILETIME);
9+
DECLSPEC_IMPORT DWORD WINAPI KERNEL32$GetLastError();
10+
11+
void go(char* buff, int len) {
12+
datap parser;
13+
char* sourceFile;
14+
char* targetFile;
15+
16+
BeaconDataParse(&parser, buff, len);
17+
sourceFile = BeaconDataExtract(&parser, NULL);
18+
targetFile = BeaconDataExtract(&parser, NULL);
19+
20+
if (!sourceFile || !targetFile) {
21+
BeaconPrintf(CALLBACK_ERROR, "[!] Error: Two file paths required\n");
22+
BeaconPrintf(CALLBACK_ERROR, "[-] Usage: inline-execute timestamp.o \"source_file\" \"target_file\"\n");
23+
return;
24+
}
25+
26+
BeaconPrintf(CALLBACK_OUTPUT, "[-] Source: %s\n", sourceFile);
27+
BeaconPrintf(CALLBACK_OUTPUT, "[-] Target: %s\n", targetFile);
28+
29+
HANDLE hSourceFile = KERNEL32$CreateFileA(
30+
sourceFile,
31+
GENERIC_READ,
32+
FILE_SHARE_READ,
33+
NULL,
34+
OPEN_EXISTING,
35+
FILE_ATTRIBUTE_NORMAL,
36+
NULL
37+
);
38+
39+
if (hSourceFile == INVALID_HANDLE_VALUE) {
40+
BeaconPrintf(CALLBACK_ERROR, "[!] Failed to open source file (Error: %d)\n", KERNEL32$GetLastError());
41+
return;
42+
}
43+
44+
FILETIME ftCreation, ftLastAccess, ftLastWrite;
45+
if (!KERNEL32$GetFileTime(hSourceFile, &ftCreation, &ftLastAccess, &ftLastWrite)) {
46+
BeaconPrintf(CALLBACK_ERROR, "[!] Failed to get source timestamps (Error: %d)\n", KERNEL32$GetLastError());
47+
KERNEL32$CloseHandle(hSourceFile);
48+
return;
49+
}
50+
51+
KERNEL32$CloseHandle(hSourceFile);
52+
53+
HANDLE hTargetFile = KERNEL32$CreateFileA(
54+
targetFile,
55+
FILE_WRITE_ATTRIBUTES,
56+
FILE_SHARE_READ | FILE_SHARE_WRITE,
57+
NULL,
58+
OPEN_EXISTING,
59+
FILE_ATTRIBUTE_NORMAL,
60+
NULL
61+
);
62+
63+
if (hTargetFile == INVALID_HANDLE_VALUE) {
64+
BeaconPrintf(CALLBACK_ERROR, "[!] Failed to open target file (Error: %d)\n", KERNEL32$GetLastError());
65+
return;
66+
}
67+
68+
if (!KERNEL32$SetFileTime(hTargetFile, &ftCreation, &ftLastAccess, &ftLastWrite)) {
69+
BeaconPrintf(CALLBACK_ERROR, "[!] Failed to modify timestamps (Error: %d)\n", KERNEL32$GetLastError());
70+
}
71+
else {
72+
BeaconPrintf(CALLBACK_OUTPUT, "[+] Successfully modified timestamps\n");
73+
}
74+
75+
KERNEL32$CloseHandle(hTargetFile);
76+
}

0 commit comments

Comments
 (0)