From 4040fbbe48554be56b811d7cfe0279545875b254 Mon Sep 17 00:00:00 2001
From: Pavel Tsakalidis
Date: Sat, 21 Jan 2023 07:35:43 +0000
Subject: [PATCH] Added assets from the resource file
---
assets/ExportFunctionDefinitionsINI.java | 40 ++++++
assets/proxy.dll.cpp | 26 ++++
assets/proxy.sln | 30 +++++
assets/proxy.vcxproj | 160 +++++++++++++++++++++++
4 files changed, 256 insertions(+)
create mode 100644 assets/ExportFunctionDefinitionsINI.java
create mode 100644 assets/proxy.dll.cpp
create mode 100644 assets/proxy.sln
create mode 100644 assets/proxy.vcxproj
diff --git a/assets/ExportFunctionDefinitionsINI.java b/assets/ExportFunctionDefinitionsINI.java
new file mode 100644
index 0000000..8472bc2
--- /dev/null
+++ b/assets/ExportFunctionDefinitionsINI.java
@@ -0,0 +1,40 @@
+/*
+ * This file has been created by using the existing Ghidra ExportFunctionInfoScript.java script as a guide.
+ * One would ask "Why don't you save this output as JSON? Wouldn't that be easier?" And the answer is "yes, it would be",
+ * however I want to keep Spartacus a standalone executable, and adding a NuGet package for JSON would break that.
+ */
+
+import java.util.*;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.charset.Charset;
+
+import ghidra.app.script.GhidraScript;
+import ghidra.program.model.listing.*;
+import ghidra.program.model.data.*;
+
+public class ExportFunctionDefinitionsINI extends GhidraScript {
+
+ @Override
+ public void run() throws Exception {
+
+ //String iniData = "";
+ List iniData = new ArrayList();
+ Listing listing = currentProgram.getListing();
+ FunctionIterator iter = listing.getFunctions(true);
+ while (iter.hasNext() && !monitor.isCancelled()) {
+ Function f = iter.next();
+
+ iniData.add("[" + f.getName() + "]");
+ iniData.add("return=" + f.getReturnType().getName());
+ iniData.add("signature=" + f.getSignature().getPrototypeString());
+
+ ParameterDefinition[] functionParameters = f.getSignature().getArguments();
+ for (int i = 0; i < functionParameters.length; i++) {
+ iniData.add("parameters[" + functionParameters[i].getOrdinal() + "]=" + functionParameters[i].getName() + "|" + functionParameters[i].getDataType().getName());
+ }
+ }
+
+ Files.write(Paths.get("%EXPORT_TO%"), iniData, Charset.defaultCharset());
+ }
+}
\ No newline at end of file
diff --git a/assets/proxy.dll.cpp b/assets/proxy.dll.cpp
new file mode 100644
index 0000000..c53e14c
--- /dev/null
+++ b/assets/proxy.dll.cpp
@@ -0,0 +1,26 @@
+#pragma once
+
+%_PRAGMA_COMMENTS_%
+
+#include
+
+VOID Payload() {
+ // Run your payload here.
+}
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
+{
+ switch (fdwReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ Payload();
+ break;
+ case DLL_THREAD_ATTACH:
+ break;
+ case DLL_THREAD_DETACH:
+ break;
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
\ No newline at end of file
diff --git a/assets/proxy.sln b/assets/proxy.sln
new file mode 100644
index 0000000..4f7c3b8
--- /dev/null
+++ b/assets/proxy.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.4.33213.308
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "proxy", "proxy.vcxproj", "{6FCED408-75B2-4EF9-9E5F-3EC58B19249B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {6FCED408-75B2-4EF9-9E5F-3EC58B19249B}.Debug|x64.ActiveCfg = Debug|x64
+ {6FCED408-75B2-4EF9-9E5F-3EC58B19249B}.Debug|x64.Build.0 = Debug|x64
+ {6FCED408-75B2-4EF9-9E5F-3EC58B19249B}.Debug|x86.ActiveCfg = Debug|Win32
+ {6FCED408-75B2-4EF9-9E5F-3EC58B19249B}.Debug|x86.Build.0 = Debug|Win32
+ {6FCED408-75B2-4EF9-9E5F-3EC58B19249B}.Release|x64.ActiveCfg = Release|x64
+ {6FCED408-75B2-4EF9-9E5F-3EC58B19249B}.Release|x64.Build.0 = Release|x64
+ {6FCED408-75B2-4EF9-9E5F-3EC58B19249B}.Release|x86.ActiveCfg = Release|Win32
+ {6FCED408-75B2-4EF9-9E5F-3EC58B19249B}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {D766E4B4-286A-400F-AEF0-4FE4441221C5}
+ EndGlobalSection
+EndGlobal
\ No newline at end of file
diff --git a/assets/proxy.vcxproj b/assets/proxy.vcxproj
new file mode 100644
index 0000000..09534c7
--- /dev/null
+++ b/assets/proxy.vcxproj
@@ -0,0 +1,160 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {6fced408-75b2-4ef9-9e5f-3ec58b19249b}
+ proxy
+ 10.0
+
+
+
+ DynamicLibrary
+ true
+ v143
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v143
+ true
+ Unicode
+
+
+ DynamicLibrary
+ true
+ v143
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v143
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %_NAME_%
+
+
+ %_NAME_%
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;VERSION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ NotUsing
+ pch.h
+
+
+ Windows
+ true
+ false
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;VERSION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ NotUsing
+ pch.h
+
+
+ Windows
+ true
+ true
+ true
+ false
+
+
+
+
+ Level3
+ true
+ _DEBUG;VERSION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ NotUsing
+ pch.h
+ MultiThreaded
+
+
+ Windows
+ true
+ false
+ proxy.def
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;VERSION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ NotUsing
+ pch.h
+ MultiThreaded
+
+
+ Windows
+ true
+ true
+ true
+ false
+ proxy.def
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file