├── README.md ├── go.PNG └── remove_Go_flag ├── Project2 ├── CscanFileType.cpp ├── cparserLinuxX64.cpp ├── cparserLinuxX86.cpp ├── cparserLinuxX86.h ├── cparserWindowX86.h ├── cparserWindowX86.cpp ├── cparserFile.h ├── Main.cpp ├── CscanFileType.h ├── cparserLinuxX64.h └── Project2.vcxproj └── Project2.sln /README.md: -------------------------------------------------------------------------------- 1 | # remove_Go_flag -------------------------------------------------------------------------------- /go.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wannianhong/remove_Go_flag/HEAD/go.PNG -------------------------------------------------------------------------------- /remove_Go_flag/Project2/CscanFileType.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wannianhong/remove_Go_flag/HEAD/remove_Go_flag/Project2/CscanFileType.cpp -------------------------------------------------------------------------------- /remove_Go_flag/Project2/cparserLinuxX64.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wannianhong/remove_Go_flag/HEAD/remove_Go_flag/Project2/cparserLinuxX64.cpp -------------------------------------------------------------------------------- /remove_Go_flag/Project2/cparserLinuxX86.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wannianhong/remove_Go_flag/HEAD/remove_Go_flag/Project2/cparserLinuxX86.cpp -------------------------------------------------------------------------------- /remove_Go_flag/Project2/cparserLinuxX86.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wannianhong/remove_Go_flag/HEAD/remove_Go_flag/Project2/cparserLinuxX86.h -------------------------------------------------------------------------------- /remove_Go_flag/Project2/cparserWindowX86.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wannianhong/remove_Go_flag/HEAD/remove_Go_flag/Project2/cparserWindowX86.h -------------------------------------------------------------------------------- /remove_Go_flag/Project2/cparserWindowX86.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wannianhong/remove_Go_flag/HEAD/remove_Go_flag/Project2/cparserWindowX86.cpp -------------------------------------------------------------------------------- /remove_Go_flag/Project2/cparserFile.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | class cparserFile 3 | { 4 | public: 5 | virtual void init() = 0; 6 | virtual int execute(char* lpBuffer, int iSize) = 0; 7 | virtual void uninit() = 0; 8 | }; -------------------------------------------------------------------------------- /remove_Go_flag/Project2/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "CscanFileType.h" 3 | 4 | int main() 5 | { 6 | CscanFileType scanFileType; 7 | scanFileType.init(); 8 | if (scanFileType.Execute("D:\\Project\\go\\ddns\\ddns_ip.exe")) 9 | { 10 | scanFileType.Save_File("remove.exe"); 11 | } 12 | 13 | return 0; 14 | } -------------------------------------------------------------------------------- /remove_Go_flag/Project2/CscanFileType.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cparserFile.h" 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | enum FILE_TYPE_Enum 9 | { 10 | FILE_TYPE_UNKNOW, 11 | FILE_TYPE_WINDOWS_X86, 12 | FILE_TYPE_WINDOWS_X64, 13 | FILE_TYPE_LINUX_X86, 14 | FILE_TYPE_LINUX_X64, 15 | }; 16 | 17 | class CscanFileType 18 | { 19 | public: 20 | int init(); 21 | int Execute(const char* lpFilePath); 22 | void Save_File(const char* lpFilePath); 23 | int uninit(); 24 | private: 25 | map m_map_parserFile; 26 | char* m_lpFileBuffer; 27 | int m_iFileSize; 28 | cparserFile* m_parserFile; 29 | private: 30 | bool GetFileBuffer(const char * lpFilePath); 31 | int GetFileType(); 32 | void * GetParserFile(int type); 33 | 34 | }; -------------------------------------------------------------------------------- /remove_Go_flag/Project2.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31205.134 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project2", "Project2\Project2.vcxproj", "{457678F7-90AB-464A-96F4-D22FEA540656}" 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 | {457678F7-90AB-464A-96F4-D22FEA540656}.Debug|x64.ActiveCfg = Debug|x64 17 | {457678F7-90AB-464A-96F4-D22FEA540656}.Debug|x64.Build.0 = Debug|x64 18 | {457678F7-90AB-464A-96F4-D22FEA540656}.Debug|x86.ActiveCfg = Debug|Win32 19 | {457678F7-90AB-464A-96F4-D22FEA540656}.Debug|x86.Build.0 = Debug|Win32 20 | {457678F7-90AB-464A-96F4-D22FEA540656}.Release|x64.ActiveCfg = Release|x64 21 | {457678F7-90AB-464A-96F4-D22FEA540656}.Release|x64.Build.0 = Release|x64 22 | {457678F7-90AB-464A-96F4-D22FEA540656}.Release|x86.ActiveCfg = Release|Win32 23 | {457678F7-90AB-464A-96F4-D22FEA540656}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {71C2D80E-5593-4A2F-8DB4-C099D5F5FDCD} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /remove_Go_flag/Project2/cparserLinuxX64.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cparserFile.h" 3 | 4 | typedef ULONG64 Elf64_Addr; 5 | 6 | typedef ULONG32 Elf64_Half; 7 | 8 | typedef ULONG64 Elf64_Off; 9 | 10 | typedef LONG64 Elf64_Sword; 11 | 12 | typedef ULONG64 Elf64_Word; 13 | 14 | typedef ULONG64 Elf64_Size; 15 | 16 | typedef USHORT Elf64_Quarter; 17 | 18 | typedef Elf64_Half Elf64_Hashelt; 19 | 20 | typedef ULONG64 Elf64_Xword; 21 | 22 | /* ELF Header */ 23 | #define EI_NIDENT 16 24 | typedef struct 25 | { 26 | unsigned char e_ident[EI_NIDENT]; /* Id bytes */ 27 | Elf64_Quarter e_type; /* file type */ 28 | Elf64_Quarter e_machine; /* machine type */ 29 | Elf64_Half e_version; /* version number */ 30 | Elf64_Addr e_entry; /* entry point */ 31 | Elf64_Off e_phoff; /* Program hdr offset */ 32 | Elf64_Off e_shoff; /* Section hdr offset */ 33 | Elf64_Half e_flags; /* Processor flags */ 34 | Elf64_Quarter e_ehsize; /* sizeof ehdr */ 35 | Elf64_Quarter e_phentsize; /* Program header entry size */ 36 | Elf64_Quarter e_phnum; /* Number of program headers */ 37 | Elf64_Quarter e_shentsize; /* Section header entry size */ 38 | Elf64_Quarter e_shnum; /* Number of section headers */ 39 | Elf64_Quarter e_shstrndx; /* String table index */ 40 | } Elf64_Ehdr; 41 | 42 | typedef struct 43 | { 44 | Elf64_Half p_type; /* entry type */ 45 | Elf64_Half p_flags; /* flags */ 46 | Elf64_Off p_offset; /* offset */ 47 | Elf64_Addr p_vaddr; /* virtual address */ 48 | Elf64_Addr p_paddr; /* physical address */ 49 | Elf64_Xword p_filesz; /* file size */ 50 | Elf64_Xword p_memsz; /* memory size */ 51 | Elf64_Xword p_align; /* memory & file alignment */ 52 | } Elf64_Phdr; 53 | 54 | typedef struct 55 | { 56 | Elf64_Half sh_name; /* section name */ 57 | Elf64_Half sh_type; /* section type */ 58 | Elf64_Xword sh_flags; /* section flags */ 59 | Elf64_Addr sh_addr; /* virtual address */ 60 | Elf64_Off sh_offset; /* file offset */ 61 | Elf64_Xword sh_size; /* section size */ 62 | Elf64_Half sh_link; /* link to another */ 63 | Elf64_Half sh_info; /* misc info */ 64 | Elf64_Xword sh_addralign; /* memory alignment */ 65 | Elf64_Xword sh_entsize; /* table entry size */ 66 | } Elf64_Shdr; 67 | 68 | 69 | struct LinuxX64_Section_ST 70 | { 71 | char section_name[20]; 72 | 73 | }; 74 | class cparserLinuxX64 :public cparserFile 75 | { 76 | public: 77 | virtual void init(); 78 | virtual int execute(char* lpBuffer, int iSize); 79 | virtual void uninit(); 80 | private: 81 | bool GetSection(); 82 | 83 | bool ParserGo(); 84 | private: 85 | char* m_lpPeBuffer; 86 | int m_iPeSize; 87 | DWORD m_dwGoVersion; 88 | DWORD m_dwFuncNameTab; 89 | DWORD m_dwFuncTab; 90 | DWORD m_dwNumFiles; 91 | DWORD m_dwFileTab; 92 | DWORD m_dwImageBase; 93 | DWORD m_dwRuntime_pclntab_file; 94 | DWORD m_dwRuntime_pclntab_mem; 95 | PIMAGE_NT_HEADERS m_pNtHeader; 96 | }; 97 | -------------------------------------------------------------------------------- /remove_Go_flag/Project2/Project2.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {457678f7-90ab-464a-96f4-d22fea540656} 25 | Project2 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v142 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v142 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v142 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v142 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | 76 | 77 | false 78 | 79 | 80 | true 81 | 82 | 83 | false 84 | 85 | 86 | 87 | Level3 88 | true 89 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 90 | true 91 | 92 | 93 | Console 94 | true 95 | 96 | 97 | 98 | 99 | Level3 100 | true 101 | true 102 | true 103 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 104 | true 105 | 106 | 107 | Console 108 | true 109 | true 110 | true 111 | 112 | 113 | 114 | 115 | Level3 116 | true 117 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 118 | true 119 | 120 | 121 | Console 122 | true 123 | 124 | 125 | 126 | 127 | Level3 128 | true 129 | true 130 | true 131 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 132 | true 133 | 134 | 135 | Console 136 | true 137 | true 138 | true 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | --------------------------------------------------------------------------------