├── .gitignore ├── DetExploit.ico ├── INIReader ├── INIReader.cpp ├── INIReader.h ├── ini.c └── ini.h ├── README.md ├── README_JAPANESE.md ├── addon.cpp ├── autoupd.cpp ├── banner.png ├── compile.sh ├── config.ini ├── detexploit.hpp ├── dev_config.ini ├── exploitdb.cpp ├── include └── .DS_Store ├── jvn.cpp ├── local_app.cpp ├── main.cpp ├── nvd.cpp ├── report.cpp ├── resources ├── default.ini ├── langpack │ ├── en_langdata.hpp │ └── ja_langdata.hpp ├── report_template.html ├── report_template.md ├── report_template.txt ├── sshot_v0.6-alpha.jpg └── sshot_v0.9-alpha.png ├── utils.cpp └── winupdate.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | *.pyc 3 | *.vbs 4 | detexploit_report* 5 | history.detexploit 6 | exploitdb.detexploit 7 | -------------------------------------------------------------------------------- /DetExploit.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/detexploit/DetExploit/042d6633ca938dad00c50800bd10dd9a35c2e707/DetExploit.ico -------------------------------------------------------------------------------- /INIReader/INIReader.cpp: -------------------------------------------------------------------------------- 1 | // Read an INI file into easy-to-access name/value pairs. 2 | 3 | // SPDX-License-Identifier: BSD-3-Clause 4 | 5 | // Copyright (C) 2009-2019, Ben Hoyt 6 | 7 | // inih and INIReader are released under the New BSD license (see LICENSE.txt). 8 | // Go to the project home page for more info: 9 | // 10 | // https://github.com/benhoyt/inih 11 | 12 | #include 13 | #include 14 | #include 15 | #include "ini.h" 16 | #include "INIReader.h" 17 | 18 | using std::string; 19 | 20 | INIReader::INIReader(const string& filename) 21 | { 22 | _error = ini_parse(filename.c_str(), ValueHandler, this); 23 | } 24 | 25 | int INIReader::ParseError() const 26 | { 27 | return _error; 28 | } 29 | 30 | string INIReader::Get(const string& section, const string& name, const string& default_value) const 31 | { 32 | string key = MakeKey(section, name); 33 | // Use _values.find() here instead of _values.at() to support pre C++11 compilers 34 | return _values.count(key) ? _values.find(key)->second : default_value; 35 | } 36 | 37 | string INIReader::GetString(const string& section, const string& name, const string& default_value) const 38 | { 39 | const string str = Get(section, name, ""); 40 | return str.empty() ? default_value : str; 41 | } 42 | 43 | long INIReader::GetInteger(const string& section, const string& name, long default_value) const 44 | { 45 | string valstr = Get(section, name, ""); 46 | const char* value = valstr.c_str(); 47 | char* end; 48 | // This parses "1234" (decimal) and also "0x4D2" (hex) 49 | long n = strtol(value, &end, 0); 50 | return end > value ? n : default_value; 51 | } 52 | 53 | double INIReader::GetReal(const string& section, const string& name, double default_value) const 54 | { 55 | string valstr = Get(section, name, ""); 56 | const char* value = valstr.c_str(); 57 | char* end; 58 | double n = strtod(value, &end); 59 | return end > value ? n : default_value; 60 | } 61 | 62 | bool INIReader::GetBoolean(const string& section, const string& name, bool default_value) const 63 | { 64 | string valstr = Get(section, name, ""); 65 | // Convert to lower case to make string comparisons case-insensitive 66 | std::transform(valstr.begin(), valstr.end(), valstr.begin(), ::tolower); 67 | if (valstr == "true" || valstr == "yes" || valstr == "on" || valstr == "1") 68 | return true; 69 | else if (valstr == "false" || valstr == "no" || valstr == "off" || valstr == "0") 70 | return false; 71 | else 72 | return default_value; 73 | } 74 | 75 | bool INIReader::HasSection(const string& section) const 76 | { 77 | const string key = MakeKey(section, ""); 78 | std::map::const_iterator pos = _values.lower_bound(key); 79 | if (pos == _values.end()) 80 | return false; 81 | // Does the key at the lower_bound pos start with "section"? 82 | return pos->first.compare(0, key.length(), key) == 0; 83 | } 84 | 85 | bool INIReader::HasValue(const string& section, const string& name) const 86 | { 87 | string key = MakeKey(section, name); 88 | return _values.count(key); 89 | } 90 | 91 | string INIReader::MakeKey(const string& section, const string& name) 92 | { 93 | string key = section + "=" + name; 94 | // Convert to lower case to make section/name lookups case-insensitive 95 | std::transform(key.begin(), key.end(), key.begin(), ::tolower); 96 | return key; 97 | } 98 | 99 | int INIReader::ValueHandler(void* user, const char* section, const char* name, 100 | const char* value) 101 | { 102 | INIReader* reader = static_cast(user); 103 | string key = MakeKey(section, name); 104 | if (reader->_values[key].size() > 0) 105 | reader->_values[key] += "\n"; 106 | reader->_values[key] += value; 107 | return 1; 108 | } 109 | -------------------------------------------------------------------------------- /INIReader/INIReader.h: -------------------------------------------------------------------------------- 1 | // Read an INI file into easy-to-access name/value pairs. 2 | 3 | // SPDX-License-Identifier: BSD-3-Clause 4 | 5 | // Copyright (C) 2009-2019, Ben Hoyt 6 | 7 | // inih and INIReader are released under the New BSD license (see LICENSE.txt). 8 | // Go to the project home page for more info: 9 | // 10 | // https://github.com/benhoyt/inih 11 | 12 | #ifndef __INIREADER_H__ 13 | #define __INIREADER_H__ 14 | 15 | #include 16 | #include 17 | 18 | // Read an INI file into easy-to-access name/value pairs. (Note that I've gone 19 | // for simplicity here rather than speed, but it should be pretty decent.) 20 | class INIReader 21 | { 22 | public: 23 | // Construct INIReader and parse given filename. See ini.h for more info 24 | // about the parsing. 25 | explicit INIReader(const std::string& filename); 26 | 27 | // Return the result of ini_parse(), i.e., 0 on success, line number of 28 | // first error on parse error, or -1 on file open error. 29 | int ParseError() const; 30 | 31 | // Get a string value from INI file, returning default_value if not found. 32 | std::string Get(const std::string& section, const std::string& name, 33 | const std::string& default_value) const; 34 | 35 | // Get a string value from INI file, returning default_value if not found, 36 | // empty, or contains only whitespace. 37 | std::string GetString(const std::string& section, const std::string& name, 38 | const std::string& default_value) const; 39 | 40 | // Get an integer (long) value from INI file, returning default_value if 41 | // not found or not a valid integer (decimal "1234", "-1234", or hex "0x4d2"). 42 | long GetInteger(const std::string& section, const std::string& name, long default_value) const; 43 | 44 | // Get a real (floating point double) value from INI file, returning 45 | // default_value if not found or not a valid floating point value 46 | // according to strtod(). 47 | double GetReal(const std::string& section, const std::string& name, double default_value) const; 48 | 49 | // Get a boolean value from INI file, returning default_value if not found or if 50 | // not a valid true/false value. Valid true values are "true", "yes", "on", "1", 51 | // and valid false values are "false", "no", "off", "0" (not case sensitive). 52 | bool GetBoolean(const std::string& section, const std::string& name, bool default_value) const; 53 | 54 | // Return true if the given section exists (section must contain at least 55 | // one name=value pair). 56 | bool HasSection(const std::string& section) const; 57 | 58 | // Return true if a value exists with the given section and field names. 59 | bool HasValue(const std::string& section, const std::string& name) const; 60 | 61 | private: 62 | int _error; 63 | std::map _values; 64 | static std::string MakeKey(const std::string& section, const std::string& name); 65 | static int ValueHandler(void* user, const char* section, const char* name, 66 | const char* value); 67 | }; 68 | 69 | #endif // __INIREADER_H__ 70 | -------------------------------------------------------------------------------- /INIReader/ini.c: -------------------------------------------------------------------------------- 1 | /* inih -- simple .INI file parser 2 | 3 | SPDX-License-Identifier: BSD-3-Clause 4 | 5 | Copyright (C) 2009-2019, Ben Hoyt 6 | 7 | inih is released under the New BSD license (see LICENSE.txt). Go to the project 8 | home page for more info: 9 | 10 | https://github.com/benhoyt/inih 11 | 12 | */ 13 | 14 | #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) 15 | #define _CRT_SECURE_NO_WARNINGS 16 | #endif 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "ini.h" 23 | 24 | #if !INI_USE_STACK 25 | #include 26 | #endif 27 | 28 | #define MAX_SECTION 50 29 | #define MAX_NAME 50 30 | 31 | /* Used by ini_parse_string() to keep track of string parsing state. */ 32 | typedef struct { 33 | const char* ptr; 34 | size_t num_left; 35 | } ini_parse_string_ctx; 36 | 37 | /* Strip whitespace chars off end of given string, in place. Return s. */ 38 | static char* rstrip(char* s) 39 | { 40 | char* p = s + strlen(s); 41 | while (p > s && isspace((unsigned char)(*--p))) 42 | *p = '\0'; 43 | return s; 44 | } 45 | 46 | /* Return pointer to first non-whitespace char in given string. */ 47 | static char* lskip(const char* s) 48 | { 49 | while (*s && isspace((unsigned char)(*s))) 50 | s++; 51 | return (char*)s; 52 | } 53 | 54 | /* Return pointer to first char (of chars) or inline comment in given string, 55 | or pointer to null at end of string if neither found. Inline comment must 56 | be prefixed by a whitespace character to register as a comment. */ 57 | static char* find_chars_or_comment(const char* s, const char* chars) 58 | { 59 | #if INI_ALLOW_INLINE_COMMENTS 60 | int was_space = 0; 61 | while (*s && (!chars || !strchr(chars, *s)) && 62 | !(was_space && strchr(INI_INLINE_COMMENT_PREFIXES, *s))) { 63 | was_space = isspace((unsigned char)(*s)); 64 | s++; 65 | } 66 | #else 67 | while (*s && (!chars || !strchr(chars, *s))) { 68 | s++; 69 | } 70 | #endif 71 | return (char*)s; 72 | } 73 | 74 | /* Version of strncpy that ensures dest (size bytes) is null-terminated. */ 75 | static char* strncpy0(char* dest, const char* src, size_t size) 76 | { 77 | strncpy(dest, src, size - 1); 78 | dest[size - 1] = '\0'; 79 | return dest; 80 | } 81 | 82 | /* See documentation in header file. */ 83 | int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler, 84 | void* user) 85 | { 86 | /* Uses a fair bit of stack (use heap instead if you need to) */ 87 | #if INI_USE_STACK 88 | char line[INI_MAX_LINE]; 89 | int max_line = INI_MAX_LINE; 90 | #else 91 | char* line; 92 | int max_line = INI_INITIAL_ALLOC; 93 | #endif 94 | #if INI_ALLOW_REALLOC && !INI_USE_STACK 95 | char* new_line; 96 | int offset; 97 | #endif 98 | char section[MAX_SECTION] = ""; 99 | char prev_name[MAX_NAME] = ""; 100 | 101 | char* start; 102 | char* end; 103 | char* name; 104 | char* value; 105 | int lineno = 0; 106 | int error = 0; 107 | 108 | #if !INI_USE_STACK 109 | line = (char*)malloc(INI_INITIAL_ALLOC); 110 | if (!line) { 111 | return -2; 112 | } 113 | #endif 114 | 115 | #if INI_HANDLER_LINENO 116 | #define HANDLER(u, s, n, v) handler(u, s, n, v, lineno) 117 | #else 118 | #define HANDLER(u, s, n, v) handler(u, s, n, v) 119 | #endif 120 | 121 | /* Scan through stream line by line */ 122 | while (reader(line, max_line, stream) != NULL) { 123 | #if INI_ALLOW_REALLOC && !INI_USE_STACK 124 | offset = strlen(line); 125 | while (offset == max_line - 1 && line[offset - 1] != '\n') { 126 | max_line *= 2; 127 | if (max_line > INI_MAX_LINE) 128 | max_line = INI_MAX_LINE; 129 | new_line = realloc(line, max_line); 130 | if (!new_line) { 131 | free(line); 132 | return -2; 133 | } 134 | line = new_line; 135 | if (reader(line + offset, max_line - offset, stream) == NULL) 136 | break; 137 | if (max_line >= INI_MAX_LINE) 138 | break; 139 | offset += strlen(line + offset); 140 | } 141 | #endif 142 | 143 | lineno++; 144 | 145 | start = line; 146 | #if INI_ALLOW_BOM 147 | if (lineno == 1 && (unsigned char)start[0] == 0xEF && 148 | (unsigned char)start[1] == 0xBB && 149 | (unsigned char)start[2] == 0xBF) { 150 | start += 3; 151 | } 152 | #endif 153 | start = lskip(rstrip(start)); 154 | 155 | if (strchr(INI_START_COMMENT_PREFIXES, *start)) { 156 | /* Start-of-line comment */ 157 | } 158 | #if INI_ALLOW_MULTILINE 159 | else if (*prev_name && *start && start > line) { 160 | /* Non-blank line with leading whitespace, treat as continuation 161 | of previous name's value (as per Python configparser). */ 162 | if (!HANDLER(user, section, prev_name, start) && !error) 163 | error = lineno; 164 | } 165 | #endif 166 | else if (*start == '[') { 167 | /* A "[section]" line */ 168 | end = find_chars_or_comment(start + 1, "]"); 169 | if (*end == ']') { 170 | *end = '\0'; 171 | strncpy0(section, start + 1, sizeof(section)); 172 | *prev_name = '\0'; 173 | #if INI_CALL_HANDLER_ON_NEW_SECTION 174 | if (!HANDLER(user, section, NULL, NULL) && !error) 175 | error = lineno; 176 | #endif 177 | } 178 | else if (!error) { 179 | /* No ']' found on section line */ 180 | error = lineno; 181 | } 182 | } 183 | else if (*start) { 184 | /* Not a comment, must be a name[=:]value pair */ 185 | end = find_chars_or_comment(start, "=:"); 186 | if (*end == '=' || *end == ':') { 187 | *end = '\0'; 188 | name = rstrip(start); 189 | value = end + 1; 190 | #if INI_ALLOW_INLINE_COMMENTS 191 | end = find_chars_or_comment(value, NULL); 192 | if (*end) 193 | *end = '\0'; 194 | #endif 195 | value = lskip(value); 196 | rstrip(value); 197 | 198 | /* Valid name[=:]value pair found, call handler */ 199 | strncpy0(prev_name, name, sizeof(prev_name)); 200 | if (!HANDLER(user, section, name, value) && !error) 201 | error = lineno; 202 | } 203 | else if (!error) { 204 | /* No '=' or ':' found on name[=:]value line */ 205 | error = lineno; 206 | } 207 | } 208 | 209 | #if INI_STOP_ON_FIRST_ERROR 210 | if (error) 211 | break; 212 | #endif 213 | } 214 | 215 | #if !INI_USE_STACK 216 | free(line); 217 | #endif 218 | 219 | return error; 220 | } 221 | 222 | /* See documentation in header file. */ 223 | int ini_parse_file(FILE* file, ini_handler handler, void* user) 224 | { 225 | return ini_parse_stream((ini_reader)fgets, file, handler, user); 226 | } 227 | 228 | /* See documentation in header file. */ 229 | int ini_parse(const char* filename, ini_handler handler, void* user) 230 | { 231 | FILE* file; 232 | int error; 233 | 234 | file = fopen(filename, "r"); 235 | if (!file) 236 | return -1; 237 | error = ini_parse_file(file, handler, user); 238 | fclose(file); 239 | return error; 240 | } 241 | 242 | /* An ini_reader function to read the next line from a string buffer. This 243 | is the fgets() equivalent used by ini_parse_string(). */ 244 | static char* ini_reader_string(char* str, int num, void* stream) { 245 | ini_parse_string_ctx* ctx = (ini_parse_string_ctx*)stream; 246 | const char* ctx_ptr = ctx->ptr; 247 | size_t ctx_num_left = ctx->num_left; 248 | char* strp = str; 249 | char c; 250 | 251 | if (ctx_num_left == 0 || num < 2) 252 | return NULL; 253 | 254 | while (num > 1 && ctx_num_left != 0) { 255 | c = *ctx_ptr++; 256 | ctx_num_left--; 257 | *strp++ = c; 258 | if (c == '\n') 259 | break; 260 | num--; 261 | } 262 | 263 | *strp = '\0'; 264 | ctx->ptr = ctx_ptr; 265 | ctx->num_left = ctx_num_left; 266 | return str; 267 | } 268 | 269 | /* See documentation in header file. */ 270 | int ini_parse_string(const char* string, ini_handler handler, void* user) { 271 | ini_parse_string_ctx ctx; 272 | 273 | ctx.ptr = string; 274 | ctx.num_left = strlen(string); 275 | return ini_parse_stream((ini_reader)ini_reader_string, &ctx, handler, 276 | user); 277 | } 278 | -------------------------------------------------------------------------------- /INIReader/ini.h: -------------------------------------------------------------------------------- 1 | /* inih -- simple .INI file parser 2 | 3 | SPDX-License-Identifier: BSD-3-Clause 4 | 5 | Copyright (C) 2009-2019, Ben Hoyt 6 | 7 | inih is released under the New BSD license (see LICENSE.txt). Go to the project 8 | home page for more info: 9 | 10 | https://github.com/benhoyt/inih 11 | 12 | */ 13 | 14 | #ifndef __INI_H__ 15 | #define __INI_H__ 16 | 17 | /* Make this header file easier to include in C++ code */ 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #include 23 | 24 | /* Nonzero if ini_handler callback should accept lineno parameter. */ 25 | #ifndef INI_HANDLER_LINENO 26 | #define INI_HANDLER_LINENO 0 27 | #endif 28 | 29 | /* Typedef for prototype of handler function. */ 30 | #if INI_HANDLER_LINENO 31 | typedef int (*ini_handler)(void* user, const char* section, 32 | const char* name, const char* value, 33 | int lineno); 34 | #else 35 | typedef int (*ini_handler)(void* user, const char* section, 36 | const char* name, const char* value); 37 | #endif 38 | 39 | /* Typedef for prototype of fgets-style reader function. */ 40 | typedef char* (*ini_reader)(char* str, int num, void* stream); 41 | 42 | /* Parse given INI-style file. May have [section]s, name=value pairs 43 | (whitespace stripped), and comments starting with ';' (semicolon). Section 44 | is "" if name=value pair parsed before any section heading. name:value 45 | pairs are also supported as a concession to Python's configparser. 46 | 47 | For each name=value pair parsed, call handler function with given user 48 | pointer as well as section, name, and value (data only valid for duration 49 | of handler call). Handler should return nonzero on success, zero on error. 50 | 51 | Returns 0 on success, line number of first error on parse error (doesn't 52 | stop on first error), -1 on file open error, or -2 on memory allocation 53 | error (only when INI_USE_STACK is zero). 54 | */ 55 | int ini_parse(const char* filename, ini_handler handler, void* user); 56 | 57 | /* Same as ini_parse(), but takes a FILE* instead of filename. This doesn't 58 | close the file when it's finished -- the caller must do that. */ 59 | int ini_parse_file(FILE* file, ini_handler handler, void* user); 60 | 61 | /* Same as ini_parse(), but takes an ini_reader function pointer instead of 62 | filename. Used for implementing custom or string-based I/O (see also 63 | ini_parse_string). */ 64 | int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler, 65 | void* user); 66 | 67 | /* Same as ini_parse(), but takes a zero-terminated string with the INI data 68 | instead of a file. Useful for parsing INI data from a network socket or 69 | already in memory. */ 70 | int ini_parse_string(const char* string, ini_handler handler, void* user); 71 | 72 | /* Nonzero to allow multi-line value parsing, in the style of Python's 73 | configparser. If allowed, ini_parse() will call the handler with the same 74 | name for each subsequent line parsed. */ 75 | #ifndef INI_ALLOW_MULTILINE 76 | #define INI_ALLOW_MULTILINE 1 77 | #endif 78 | 79 | /* Nonzero to allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of 80 | the file. See https://github.com/benhoyt/inih/issues/21 */ 81 | #ifndef INI_ALLOW_BOM 82 | #define INI_ALLOW_BOM 1 83 | #endif 84 | 85 | /* Chars that begin a start-of-line comment. Per Python configparser, allow 86 | both ; and # comments at the start of a line by default. */ 87 | #ifndef INI_START_COMMENT_PREFIXES 88 | #define INI_START_COMMENT_PREFIXES ";#" 89 | #endif 90 | 91 | /* Nonzero to allow inline comments (with valid inline comment characters 92 | specified by INI_INLINE_COMMENT_PREFIXES). Set to 0 to turn off and match 93 | Python 3.2+ configparser behaviour. */ 94 | #ifndef INI_ALLOW_INLINE_COMMENTS 95 | #define INI_ALLOW_INLINE_COMMENTS 1 96 | #endif 97 | #ifndef INI_INLINE_COMMENT_PREFIXES 98 | #define INI_INLINE_COMMENT_PREFIXES ";" 99 | #endif 100 | 101 | /* Nonzero to use stack for line buffer, zero to use heap (malloc/free). */ 102 | #ifndef INI_USE_STACK 103 | #define INI_USE_STACK 1 104 | #endif 105 | 106 | /* Maximum line length for any line in INI file (stack or heap). Note that 107 | this must be 3 more than the longest line (due to '\r', '\n', and '\0'). */ 108 | #ifndef INI_MAX_LINE 109 | #define INI_MAX_LINE 200 110 | #endif 111 | 112 | /* Nonzero to allow heap line buffer to grow via realloc(), zero for a 113 | fixed-size buffer of INI_MAX_LINE bytes. Only applies if INI_USE_STACK is 114 | zero. */ 115 | #ifndef INI_ALLOW_REALLOC 116 | #define INI_ALLOW_REALLOC 0 117 | #endif 118 | 119 | /* Initial size in bytes for heap line buffer. Only applies if INI_USE_STACK 120 | is zero. */ 121 | #ifndef INI_INITIAL_ALLOC 122 | #define INI_INITIAL_ALLOC 200 123 | #endif 124 | 125 | /* Stop parsing on first error (default is to keep parsing). */ 126 | #ifndef INI_STOP_ON_FIRST_ERROR 127 | #define INI_STOP_ON_FIRST_ERROR 0 128 | #endif 129 | 130 | /* Nonzero to call the handler at the start of each new section (with 131 | name and value NULL). Default is to only call the handler on 132 | each name=value pair. */ 133 | #ifndef INI_CALL_HANDLER_ON_NEW_SECTION 134 | #define INI_CALL_HANDLER_ON_NEW_SECTION 0 135 | #endif 136 | 137 | #ifdef __cplusplus 138 | } 139 | #endif 140 | 141 | #endif /* __INI_H__ */ 142 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **This README is English version.** 2 | **If you want to view Japanese version, please check the [README_JAPANESE.md](README_JAPANESE.md).** 3 | 4 | 5 | 6 | [![GitHub Release](https://img.shields.io/github/release/detexploit/DetExploit.svg)](https://github.com/detexploit/DetExploit/releases/latest) 7 | [![License: GPLv2](https://img.shields.io/badge/license-GPL--3.0-blue)](www.gnu.org/licenses/gpl-3.0.en.html) 8 | 9 | ## Info (Last Update: 2019/10/04) 10 | 11 | Hi, thank you for visiting this repository. 12 | You may know that there is no commit for a while...... but development is still going on !!! 13 | Currently, I am re-writing whole program into C++ to reduce binary size and more advantages. 14 | This is very important procedure to release our program, so please understand it... :) 15 | I've prepared some milestone, so you may check out it!! 16 | 17 | ``` 18 | Schedule 19 | 20 | 1. Python to C++ to resuce binary size 21 | 2. Release binary from GitHub Releases 22 | 3. Publish demo movies of client/server (Currently working on ...) 23 | 4. Publish slides of DetExploit (Japanese version is already ready, so wait for little bit more!!) 24 | ``` 25 | 26 | ## Table of contents 27 | 28 | 29 | 30 | - [DetExploit v1.3α](#detexploit-v13α) 31 | - [Table of contents](#table-of-contents) 32 | - [Abstract](#abstract) 33 | - [Demo](#demo) 34 | - [How to run](#how-to-run) 35 | - [Supported Database](#supported-database) 36 | - [License](#license) 37 | - [Contact to developer](#contact-to-developer) 38 | 39 | 40 | 41 | ## Abstract 42 | 43 | DetExploit is software that detect vulnerable applications and not-installed important OS updates on the system, and notify them to user. 44 | 45 | As we know, most of cyberattacks uses vulnerability that is released out year before. 46 | 47 | I thought this is huge problem, and this kind of technology should be more powerful than technology that will detect unknown malwares or exploits. 48 | 49 | Also this project is my theme of [Mitou Jr](https://jr.mitou.org/index_en.html) project in Japan. 50 | 51 | I wish and work hard to make this an huge OSS (Open Source Software) project, to help these days society. 52 | 53 | ## Demo 54 | 55 | + Demo Video Clip (v0.5, English, Click and jump to YouTube to play video) 56 | 57 | [![Alt text](https://img.youtube.com/vi/VBev9dtGtEM/0.jpg)](https://www.youtube.com/watch?v=VBev9dtGtEM) 58 | 59 | ## How to run 60 | 61 | **You can download latest stable build of DetExploit from [Releases](https://github.com/detexploit/DetExploit/releases) page.** 62 | 63 | Easiest way to run is shown below (Do not forget to unzip the downloaded file). 64 | 65 | ``` 66 | # Execute DetExploit 67 | C:\path\to>cd DetExploit_ReleaseYYYYMMDD 68 | C:\path\to\DetExlopit_ReleaseYYYYMMDD>DetExploit.exe 69 | ``` 70 | 71 | ## Supported Database 72 | 73 | + [ExploitDB](https://exploit-db.com/) 74 | + [JVN (Japan Vulnerability Notes)](https://jvn.jp/) 75 | + [NVD (National Vulnerability Database)](https://nvd.nist.gov/) 76 | + [US-CERT](https://www.us-cert.gov/) 77 | + [JPCERT](https://www.jpcert.or.jp/) 78 | + More on further version 79 | 80 | ## License 81 | 82 | GNU GPLv3 License 83 | 84 | ## Contact to developer 85 | 86 | + MOPI (Email: [moppoi5168@gmail.com](mailto:moppoi5168@gmail.com) / Twitter: [@moppoi5168](https://twitter.com/moppoi5168)) 87 | -------------------------------------------------------------------------------- /README_JAPANESE.md: -------------------------------------------------------------------------------- 1 | # DetExploit v1.3α 2 | 3 | ![ScreenShot1](resources/sshot_v0.9-alpha.png) 4 | 5 | ** DetExploit v0.9αのスクリーンショット ** 6 | 7 | [English Version README is right here (英語版のREADMEを表示)](README.md) 8 | 9 | ## 目次 10 | 11 | 12 | 13 | - [DetExploit v1.3α](#detexploit-v13α) 14 | - [目次](#目次) 15 | - [概要](#概要) 16 | - [デモ](#デモ) 17 | - [実行方法](#実行方法) 18 | - [サポートしているデータベース](#サポートしているデータベース) 19 | - [ライセンス](#ライセンス) 20 | - [開発者へ連絡](#開発者へ連絡) 21 | 22 | 23 | 24 | ## 概要 25 | 26 | DetExploitはシステム上に存在する脆弱なアプリケーションやインストールされていない重要なOSのアップデートを検知して、ユーザーに通知するソフトウェアです。 27 | 28 | 近年のサイバー攻撃で使用されるほとんどの脆弱性が一年以上前に攻撃コードなどが公開されているものだというのは皆さんご存知だと思います。 29 | 30 | そんな状況ならば未知の脅威に対処するための技術よりも既知の脅威に対処するための技術が発展するべきだと私は考えました。 31 | 32 | 本プロジェクトは私の[未踏ジュニア](https://jr.mitou.org/)のテーマ作品です。 33 | 34 | 私は本プロジェクトが発展して、大規模なOSSになることを願い開発を続けていきます。 35 | 36 | ## デモ 37 | 38 | + デモ映像 (v0.5, クリックするとYouTubeにジャンプします) 39 | 40 | [![Alt text](https://img.youtube.com/vi/aIMhaA_ysUY/0.jpg)](https://www.youtube.com/watch?v=aIMhaA_ysUY) 41 | 42 | ## 実行方法 43 | 44 | **[Releases](https://github.com/detexploit/DetExploit/releases) から最新のビルドをダウンロードすることができます。** 45 | 46 | 最も簡単な方法を以下に記しておきます (ダウンロードしたzip圧縮ファイルを解凍することを忘れないでくださいね!!) 47 | 48 | ``` 49 | # DetExploitを実行 50 | C:\path\to>cd DetExploit_ReleaseYYYYMMDD 51 | C:\path\to\DetExlopit_ReleaseYYYYMMDD>DetExploit.exe 52 | ``` 53 | 54 | ## サポートしているデータベース 55 | 56 | + [ExploitDB](https://exploit-db.com/) 57 | + [JVN (Japan Vulnerability Notes)](https://jvn.jp/) 58 | + [NVD (National Vulnerability Database)](https://nvd.nist.gov/) 59 | + [US-CERT](https://www.us-cert.gov/) 60 | + [JPCERT](https://www.jpcert.or.jp/) 61 | + 随時追加予定 62 | 63 | ## ライセンス 64 | 65 | GNU GPLv3 License 66 | 67 | ## 開発者へ連絡 68 | 69 | + MOPI (Email: [moppoi5168@gmail.com](mailto:moppoi5168@gmail.com) / Twitter: [@naogramer](https://twitter.com/moppoi5168)) 70 | -------------------------------------------------------------------------------- /addon.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | addon.cpp 3 | DetExploit program file for loading external function file (addon). 4 | DetExploit (https://github.com/moppoi5168/DetExploit) 5 | Licensed by GPL License 6 | */ 7 | 8 | #define DEXP_ADDON_SIGN "SignStartDetExploitAddonPackage1.2SignEnd" 9 | 10 | #include "detexploit.hpp" 11 | 12 | std::vector load_addon(const std::string& src, const char* delim) { 13 | std::vector vec; 14 | std::string::size_type len = src.length(); 15 | 16 | for (std::string::size_type i = 0, n; i < len; i = n + 1) { 17 | n = src.find_first_of(delim, i); 18 | if (n == std::string::npos) { 19 | n = len; 20 | } 21 | vec.push_back(src.substr(i, n - i)); 22 | } 23 | 24 | return vec; 25 | } 26 | 27 | std::string insert_inst(const std::vector& v, const char* delim) { 28 | std::string s = ""; 29 | if (!v.empty()) { 30 | s += v[0]; 31 | for (decltype(v.size()) i = 1, c = v.size(); i < c; ++i) { 32 | if (delim) s += delim; 33 | s += v[i]; 34 | } 35 | } 36 | return s; 37 | } 38 | -------------------------------------------------------------------------------- /autoupd.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | addon.cpp 3 | DetExploit program file for loading external function file (addon). 4 | DetExploit (https://github.com/moppoi5168/DetExploit) 5 | Licensed by GPL License 6 | */ 7 | 8 | #define DEXP_ADDON_SIGN "SignStartDetExploitAddonPackage1.2SignEnd" 9 | 10 | #include "detexploit.hpp" 11 | 12 | std::vector load_addon(const std::string& src, const char* delim) { 13 | std::vector vec; 14 | std::string::size_type len = src.length(); 15 | 16 | for (std::string::size_type i = 0, n; i < len; i = n + 1) { 17 | n = src.find_first_of(delim, i); 18 | if (n == std::string::npos) { 19 | n = len; 20 | } 21 | vec.push_back(src.substr(i, n - i)); 22 | } 23 | 24 | return vec; 25 | } 26 | 27 | std::string insert_inst(const std::vector& v, const char* delim) { 28 | std::string s = ""; 29 | if (!v.empty()) { 30 | s += v[0]; 31 | for (decltype(v.size()) i = 1, c = v.size(); i < c; ++i) { 32 | if (delim) s += delim; 33 | s += v[i]; 34 | } 35 | } 36 | return s; 37 | } 38 | -------------------------------------------------------------------------------- /banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/detexploit/DetExploit/042d6633ca938dad00c50800bd10dd9a35c2e707/banner.png -------------------------------------------------------------------------------- /compile.sh: -------------------------------------------------------------------------------- 1 | i686-w64-mingw32-g++ -c main.cpp -o main.detexploit -I./include 2 | i686-w64-mingw32-g++ -c exploitdb.cpp -o exploitdb.detexploit -I./include 3 | i686-w64-mingw32-g++ -c jvn.cpp -o jvn.detexploit -I./include 4 | i686-w64-mingw32-g++ -c nvd.cpp -o nvd.detexploit -I./include 5 | i686-w64-mingw32-g++ -c winupdate.cpp -o winupdate.detexploit -I./include 6 | i686-w64-mingw32-g++ -c utils.cpp -o utils.detexploit -I./include 7 | i686-w64-mingw32-g++ -c report.cpp -o report.detexploit -I./include 8 | i686-w64-mingw32-g++ -c local_app.cpp -o local_app.detexploit -I./include 9 | i686-w64-mingw32-g++ -c INIReader/INIReader.cpp -o INIReader.detexploit -I./include 10 | i686-w64-mingw32-gcc -c INIReader/ini.c -o ini.detexploit -I./include 11 | i686-w64-mingw32-g++ -std=c++11 main.detexploit exploitdb.detexploit jvn.detexploit nvd.detexploit winupdate.detexploit utils.detexploit report.detexploit local_app.detexploit INIReader.detexploit ini.detexploit -o DetExploit.exe -s -lws2_32 -lurlmon -lwininet -Wno-write-strings -I./include -fno-exceptions -fmerge-all-constants -static-libstdc++ -static-libgcc 12 | rm *.detexploit -------------------------------------------------------------------------------- /config.ini: -------------------------------------------------------------------------------- 1 | 2 | ########################################################### 3 | # dev_config.ini 4 | # Configuration file of DetExploit. 5 | # DetExploit (https://github.com/moppoi5168/DetExploit) 6 | # Licensed by GPL License 7 | ########################################################### 8 | 9 | [general] 10 | # DetExploit Language Settings (Default Value: en) 11 | lang = en 12 | # DetExploit will automaticly delete vulnerability data if you set True here. (Default Value: True) 13 | do_not_save_vulndata = True 14 | # If you want to scan also for the operating system update, set True here. (Default Value: True) 15 | os_update_scan = True 16 | # The scan report format of DetExploit. (Default Value: HTML) 17 | report_format = HTML 18 | 19 | [exploitdb] 20 | # If you want to use ExploitDB as source of vulnerability data, set True here. (Default Value: True) 21 | use_exploitdb = True 22 | # File name that DetExploit saves ExploitDB vulnerability data. (Default Value: exploitdb.detexploit) 23 | vulndata_filename = exploitdb.detexploit 24 | 25 | [jvn] 26 | # If you want to use JVN as source of vulnerability data, set True here. (Default Value: True) 27 | use_jvn = True 28 | # The time range of vulnerability data from JVN. 29 | # If you make it longer, time that is required to process will also be longer. (Default Value: 2010, 2019) 30 | data_from = 2010 31 | data_to = 2019 32 | 33 | [nvd] 34 | # If you want to use JVN as source of vulnerability data, set True here. (Default Value: True) 35 | use_nvd = True 36 | # The time range of vulnerability data from NVD. 37 | # If you make it longer, time that is required to process will also be longer. (Default Value: 2010, 2019) 38 | data_from = 2010 39 | data_to = 2019 40 | 41 | [server] 42 | # Name to be identified by DetExploit Server 43 | id = NONAME 44 | # Host Address for the DetExploit Server 45 | host = 0.0.0.0 46 | # Port to serve DetExploit Server (HTTP) 47 | port = 4321 48 | # Interval time while client checks scan cmd 49 | interval = 10 50 | # Debug Mode 51 | debug = True 52 | -------------------------------------------------------------------------------- /detexploit.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | detexploit.hpp 3 | Header file of DetExploit C++ Program. 4 | DetExploit (https://github.com/moppoi5168/DetExploit) 5 | Licensed by GPL License 6 | */ 7 | 8 | #ifndef DETEXPLOIT_HPP 9 | #define DETEXPLOIT_HPP 10 | 11 | #define DETEXPLOIT_VERSION "v1.4-ALPHA-CLI" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #pragma comment(lib, "Ws2_32.lib") 29 | #pragma comment(lib, "urlmon.lib") 30 | #pragma comment(lib, "wininet.lib") 31 | 32 | //#include 33 | #include "resources/langpack/en_langdata.hpp" 34 | #include "INIReader/INIReader.h" 35 | 36 | typedef struct DVI { 37 | std::string version; 38 | bool is_edb; 39 | bool is_jvn; 40 | bool is_nvd; 41 | bool is_winupd; 42 | std::string severity; 43 | } VulnInfo; 44 | 45 | /* main.cpp */ 46 | INIReader init_cp(char *arg); 47 | 48 | /* exploitdb.cpp */ 49 | #define EDB_VULNDATA_FILENAME "exploitdb.detexploit" 50 | std::map proc_edb(HANDLE hStdout); 51 | int edb_download_vulndata(HANDLE hStdout); 52 | std::vector edb_extract_vulndata(HANDLE hStdout); 53 | std::map edb_parse_vulndata(std::vector data_list); 54 | std::map edb_scan(std::map edb_vulndata, std::map installed); 55 | 56 | /* jvn.cpp */ 57 | std::map jvn_download_vulndata(HANDLE hStdout); 58 | std::map jvn_scan(std::map jvn_vulndata, std::map installed); 59 | 60 | /* nvd.cpp */ 61 | std::map nvd_download_vulndata(HANDLE hStdout); 62 | std::map nvd_scan(std::map nvd_vulndata, std::map installed); 63 | 64 | /* winupdate.cpp */ 65 | 66 | /* utils.cpp */ 67 | std::string ghostname(); 68 | bool checkFileExistence(const std::string& str); 69 | std::vector split(const std::string& src, const char* delim); 70 | std::string join(const std::vector& v, const char* delim); 71 | std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len); 72 | bool config_test(); 73 | 74 | /* report.cpp */ 75 | std::string determine_severity(std::string data_src, std::string ext); 76 | void generate_report(INIReader cp, std::string session_id, std::string scan_starttime, std::string scan_endtime, std::map resultdict); 77 | 78 | /* local_app.cpp */ 79 | std::map getapp_all(); 80 | std::map getapp_from_wmi(); 81 | std::map getapp_from_hklm(); 82 | std::map getapp_from_hklmwow64(); 83 | std::map getapp_from_hkcu(); 84 | 85 | #endif -------------------------------------------------------------------------------- /dev_config.ini: -------------------------------------------------------------------------------- 1 | 2 | ########################################################### 3 | # dev_config.ini 4 | # Configuration file of DetExploit. 5 | # DetExploit (https://github.com/moppoi5168/DetExploit) 6 | # Licensed by GPL License 7 | ########################################################### 8 | 9 | [general] 10 | # DetExploit Language Settings (Default Value: en) 11 | lang = ja 12 | # DetExploit will automaticly delete vulnerability data if you set True here. (Default Value: True) 13 | do_not_save_vulndata = True 14 | # If you want to scan also for the operating system update, set True here. (Default Value: True) 15 | os_update_scan = True 16 | # The scan report format of DetExploit. (Default Value: HTML) 17 | report_format = HTML 18 | 19 | [exploitdb] 20 | # If you want to use ExploitDB as source of vulnerability data, set True here. (Default Value: True) 21 | use_exploitdb = True 22 | # File name that DetExploit saves ExploitDB vulnerability data. (Default Value: exploitdb.detexploit) 23 | vulndata_filename = exploitdb.detexploit 24 | 25 | [jvn] 26 | # If you want to use JVN as source of vulnerability data, set True here. (Default Value: True) 27 | use_jvn = True 28 | # The time range of vulnerability data from JVN. 29 | # If you make it longer, time that is required to process will also be longer. (Default Value: 2010, 2019) 30 | data_from = 2019 31 | data_to = 2019 32 | 33 | [nvd] 34 | # If you want to use JVN as source of vulnerability data, set True here. (Default Value: True) 35 | use_nvd = True 36 | # The time range of vulnerability data from NVD. 37 | # If you make it longer, time that is required to process will also be longer. (Default Value: 2010, 2019) 38 | data_from = 2019 39 | data_to = 2019 40 | 41 | [server] 42 | # Name to be identified by DetExploit Server 43 | id = NONAME 44 | # Host Address for the DetExploit Server 45 | host = 0.0.0.0 46 | # Port to serve DetExploit Server (HTTP) 47 | port = 4321 48 | # Interval time while client checks scan cmd 49 | interval = 10 50 | # Debug Mode 51 | debug = True 52 | -------------------------------------------------------------------------------- /exploitdb.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | exploitdb.cpp 3 | DetExploit program file related to ExploitDB. 4 | DetExploit (https://github.com/moppoi5168/DetExploit) 5 | Licensed by GPL License 6 | */ 7 | 8 | #include "detexploit.hpp" 9 | 10 | std::map proc_edb(HANDLE hStdout) { 11 | std::vector extracted; 12 | std::map edb_vulndata; 13 | edb_download_vulndata(hStdout); 14 | extracted = edb_extract_vulndata(hStdout); 15 | edb_vulndata = edb_parse_vulndata(extracted); 16 | return edb_vulndata; 17 | } 18 | 19 | int edb_download_vulndata(HANDLE hStdout) { 20 | LPCTSTR Url, File; 21 | HRESULT hr; 22 | std::cout << EXPLOITDB_DOWNLOAD_INTRO << std::endl; 23 | std::string edb_url = ""; 24 | std::string savepath = EDB_VULNDATA_FILENAME; 25 | Url = _T("https://github.com/offensive-security/exploitdb/raw/master/files_exploits.csv"); 26 | File = _T(EDB_VULNDATA_FILENAME); 27 | hr = URLDownloadToFile(0, Url, File, 0, 0); 28 | if (checkFileExistence(EDB_VULNDATA_FILENAME)) { 29 | SetConsoleTextAttribute(hStdout, FOREGROUND_GREEN); 30 | std::cout << EXPLOITDB_DOWNLOAD_SUCCESS << std::endl; 31 | SetConsoleTextAttribute(hStdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); 32 | std::cout << "===========================================================" << std::endl; 33 | } else { 34 | SetConsoleTextAttribute(hStdout, FOREGROUND_RED); 35 | std::cout << EXPLOITDB_DOWNLOAD_FAILED << std::endl; 36 | SetConsoleTextAttribute(hStdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); 37 | exit(1); 38 | } 39 | } 40 | 41 | std::vector edb_extract_vulndata(HANDLE hStdout) { 42 | std::vector tmp; 43 | std::string str; 44 | std::ifstream ifs(EDB_VULNDATA_FILENAME); 45 | std::string extract_msg = EXPLOITDB_EXTRACT_WIN; 46 | extract_msg += EDB_VULNDATA_FILENAME; 47 | extract_msg += "......"; 48 | std::cout << extract_msg << std::endl; 49 | while (getline(ifs, str)) { 50 | if (str.find("windows") != std::string::npos) { 51 | tmp.push_back(str.c_str()); 52 | } 53 | } 54 | SetConsoleTextAttribute(hStdout, FOREGROUND_GREEN); 55 | std::cout << EXPLOITDB_EXTRACT_SUCCESS << std::endl; 56 | SetConsoleTextAttribute(hStdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); 57 | std::cout << "===========================================================" << std::endl; 58 | return tmp; 59 | } 60 | 61 | std::map edb_parse_vulndata(std::vector data_list) { 62 | std::map product_dict; 63 | for (int i = 0; i < data_list.size(); i++) { 64 | std::vector splitted = split(data_list[i], ","); 65 | std::string base = splitted[2]; 66 | std::vector splitted_sec = split(base, " "); 67 | std::string name = splitted_sec[0] + splitted_sec[1]; 68 | std::string version = splitted_sec[2]; 69 | product_dict[name] = version; 70 | } 71 | return product_dict; 72 | } 73 | 74 | std::map edb_scan(std::map edb_vulndata, std::map installed) { 75 | std::map resultdict; 76 | std::string level = ""; 77 | VulnInfo vinfo; 78 | for (auto fit = edb_vulndata.begin(); fit != edb_vulndata.end(); fit++) { 79 | for (auto nit = installed.begin(); nit != installed.end(); nit++) { 80 | if ((*fit).first == (*nit).first && (*fit).second == (*nit).second) { 81 | level = determine_severity(EDB, "NOEXT"); 82 | vinfo.version = (*fit).second; 83 | vinfo.is_edb = true; 84 | vinfo.is_jvn = false; 85 | vinfo.is_nvd = false; 86 | vinfo.is_winupd = false; 87 | vinfo.severity = level; 88 | resultdict[(*fit).first] = vinfo; 89 | std::cout << "===========================================================" << std::endl; 90 | std::cout << DETECT_ALERT << std::endl; 91 | std::cout << APP_NAME << (*fit).first << " >>" << std::endl; 92 | std::cout << APP_VERSION << (*fit).second << " >>" << std::endl; 93 | std::cout << DETECT_USING_NVD << std::endl; 94 | std::cout << OBJECT_LEVEL << level << " >>" << std::endl; 95 | std::cout << "===========================================================" << std::endl; 96 | } 97 | } 98 | } 99 | return resultdict; 100 | } 101 | -------------------------------------------------------------------------------- /include/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/detexploit/DetExploit/042d6633ca938dad00c50800bd10dd9a35c2e707/include/.DS_Store -------------------------------------------------------------------------------- /jvn.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | jvn.cpp 3 | DetExploit program file related to JVN. 4 | DetExploit (https://github.com/moppoi5168/DetExploit) 5 | Licensed by GPL License 6 | */ 7 | 8 | #include "detexploit.hpp" 9 | 10 | std::map jvn_download_vulndata(HANDLE hStdout) { 11 | std::map product_dict; 12 | std::string Url = ""; 13 | std::string str = ""; 14 | std::cout << JVN_DOWNLOAD_INTRO << std::endl; 15 | std::cout << JVN_DOWNLOAD_ALERT_ONE << std::endl; 16 | std::cout << JVN_DOWNLOAD_ALERT_TWO << "\n\n"; 17 | for (int y = 2019; y < 2020; y++) { // int y = 2010 18 | for (int m = 1; m < 13; m++) { 19 | Url = "https://jvndb.jvn.jp/myjvn?method=getVulnOverviewList&feed=hnd&rangeDatePublished=n&rangeDateFirstPublished=n&datePublicStartY="; 20 | Url += std::to_string(y); 21 | Url += "&datePublicStartM="; 22 | Url += std::to_string(m); 23 | Url += "&datePublicEmdY="; 24 | Url += std::to_string(y); 25 | Url += "&datePublicEmdM="; 26 | Url += std::to_string(m); 27 | URLDownloadToFile(0, Url.c_str(), _T("jvn_temp.xml"), 0, 0); 28 | std::ifstream ifs("jvn_temp.xml"); 29 | while (getline(ifs, str)) { 30 | if (str.find("sec:cpe") != std::string::npos) { 31 | std::vector splitted = split(str.substr(6), " "); 32 | try { 33 | std::string name = splitted[3].substr(9); 34 | std::string va = splitted[1].substr(9); 35 | std::string version = va.erase(va.size() - 1); 36 | product_dict[name] = version; 37 | } catch (...) { 38 | continue; 39 | } 40 | } 41 | } 42 | } 43 | std::cout << JVN_DOWNLOAD_PROGRESS << std::to_string(y) << std::endl; 44 | } 45 | SetConsoleTextAttribute(hStdout, FOREGROUND_GREEN); 46 | std::cout << JVN_DOWNLOAD_SUCCESS << std::endl; 47 | SetConsoleTextAttribute(hStdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); 48 | std::cout << "===========================================================" << std::endl; 49 | return product_dict; 50 | } 51 | 52 | std::map jvn_scan(std::map jvn_vulndata, std::map installed) { 53 | std::map resultdict; 54 | std::string level = ""; 55 | VulnInfo vinfo; 56 | for (auto fit = jvn_vulndata.begin(); fit != jvn_vulndata.end(); fit++) { 57 | for (auto nit = installed.begin(); nit != installed.end(); nit++) { 58 | if ((*fit).first == (*nit).first && (*fit).second == (*nit).second) { 59 | level = determine_severity(JVN, "NOEXT"); 60 | vinfo.version = (*fit).second; 61 | vinfo.is_edb = true; 62 | vinfo.is_jvn = false; 63 | vinfo.is_nvd = false; 64 | vinfo.is_winupd = false; 65 | vinfo.severity = level; 66 | resultdict[(*fit).first] = vinfo; 67 | std::cout << "===========================================================" << std::endl; 68 | std::cout << DETECT_ALERT << std::endl; 69 | std::cout << APP_NAME << (*fit).first << " >>" << std::endl; 70 | std::cout << APP_VERSION << (*fit).second << " >>" << std::endl; 71 | std::cout << DETECT_USING_JVN << std::endl; 72 | std::cout << OBJECT_LEVEL << level << " >>" << std::endl; 73 | std::cout << "===========================================================" << std::endl; 74 | } 75 | } 76 | } 77 | return resultdict; 78 | } 79 | 80 | -------------------------------------------------------------------------------- /local_app.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | local_app.cpp 3 | DetExploit program file related to local application info. 4 | DetExploit (https://github.com/moppoi5168/DetExploit) 5 | Licensed by GPL License 6 | */ 7 | 8 | #include "detexploit.hpp" 9 | 10 | std::map getapp_all() { 11 | std::map data; 12 | std::map wmi_data = getapp_from_wmi(); 13 | std::map hklm_data = getapp_from_hklm(); 14 | std::map hklmwow64_data = getapp_from_hklmwow64(); 15 | std::map hkcu_data = getapp_from_hkcu(); 16 | data.insert(wmi_data.begin(), wmi_data.end()); 17 | data.insert(wmi_data.begin(), hklm_data.end()); 18 | data.insert(wmi_data.begin(), hklmwow64_data.end()); 19 | data.insert(wmi_data.begin(), hkcu_data.end()); 20 | return data; 21 | } 22 | 23 | std::map getapp_from_wmi() { 24 | std::map data; 25 | std::system("powershell.exe Get-WmiObject -class Win32_Product > WMIRET.detexploit"); 26 | // ファイルを開いて中身をstd::stringに流し込む 27 | // NameとVersionだけ上手く取り出して、mapに入れる 28 | if (!(DeleteFileA("WMIRET.detexploit"))) { 29 | std::cout << "Warning: Failed to delete HKLMRET.detexploit" << std::endl; 30 | } 31 | return data; 32 | } 33 | 34 | std::map getapp_from_hklm() { 35 | std::map data; 36 | // reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall" /s | findstr "DisplayName DisplayVersion" 37 | // DisplayNameより先にDisplayVersionが表示されることがある 38 | // DisplayNameが来る前にDisplayVersionが来たらそれを次DisplayNameが来るまで保持する感じで 39 | std::system("powershell.exe Get-WmiObject -class Win32_Product > HKLMRET.detexploit"); 40 | // ファイルを開いて中身をstd::stringに流し込む 41 | // for文を回して上に書いていた機構を実装する 42 | if (!(DeleteFileA("HKLMRET.detexploit"))) { 43 | std::cout << "Warning: Failed to delete HKLMRET.detexploit" << std::endl; 44 | } 45 | return data; 46 | } 47 | 48 | std::map getapp_from_hklmwow64() { 49 | std::map data; 50 | return data; 51 | } 52 | 53 | std::map getapp_from_hkcu() { 54 | std::map data; 55 | return data; 56 | } 57 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | main.cpp 3 | Main C++ program file of DetExploit. 4 | DetExploit (https://github.com/moppoi5168/DetExploit) 5 | Licensed by GPL License 6 | */ 7 | 8 | #include "detexploit.hpp" 9 | 10 | int main(int argc, char *argv[]) { 11 | INIReader cp = init_cp(argv[1]); 12 | std::cout << cp.Get("jvn", "data_from", "0000") << std::endl; 13 | int count = 0; 14 | char scan_starttime[128] = ""; 15 | char scan_endtime[128] = ""; 16 | HANDLE hStdout; 17 | CONSOLE_SCREEN_BUFFER_INFO csbi; 18 | hStdout = GetStdHandle(STD_OUTPUT_HANDLE); 19 | GetConsoleScreenBufferInfo(hStdout, &csbi); 20 | SetConsoleTextAttribute(hStdout, FOREGROUND_RED); 21 | std::cout << R"( 22 | ____ _ _____ _ _ _ 23 | | _ \ ___| |_| ____|_ ___ __ | | ___ (_) |_ 24 | | | | |/ _ \ __| _| \ \/ / '_ \| |/ _ \| | __| 25 | | |_| | __/ |_| |___ > <| |_) | | (_) | | |_ 26 | |____/ \___|\__|_____/_/\_\ .__/|_|\___/|_|\__| 27 | |_| 28 | )" << std::endl; 29 | SetConsoleTextAttribute(hStdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); 30 | std::cout << "===========================================================" << std::endl; 31 | std::cout << WELCOME_MESSAGE << std::endl; 32 | std::cout << "===========================================================" << std::endl; 33 | 34 | time_t start = time(NULL); 35 | struct tm *pstart = localtime(&start); 36 | sprintf(scan_starttime, "%d/%d/%d %d:%d:%d", pstart->tm_year+1900, pstart->tm_mon+1, pstart->tm_mday, pstart->tm_hour, pstart->tm_min, pstart->tm_sec); 37 | std::string stime_str = std::string(scan_starttime); 38 | std::string session_id = base64_encode(reinterpret_cast(stime_str.c_str()), stime_str.length()); 39 | 40 | std::map edb_vulndata = proc_edb(hStdout); 41 | std::map jvn_vulndata = jvn_download_vulndata(hStdout); 42 | std::map nvd_vulndata = nvd_download_vulndata(hStdout); 43 | 44 | std::map installed = getapp_all(); 45 | 46 | std::map result; 47 | 48 | std::map scanret_exploitdb = edb_scan(edb_vulndata, installed); 49 | std::map scanret_jvn = jvn_scan(jvn_vulndata, installed); 50 | std::map scanret_nvd = nvd_scan(nvd_vulndata, installed); 51 | // std::map scanret_winupdate = windowsupdate_scan(); 52 | 53 | result.insert(scanret_exploitdb.begin(), scanret_exploitdb.end()); 54 | result.insert(scanret_jvn.begin(), scanret_jvn.end()); 55 | result.insert(scanret_nvd.begin(), scanret_nvd.end()); 56 | // result.insert(scanret_winupdate.begin(), scanret_winupdate.end()); 57 | 58 | time_t end = time(NULL); 59 | struct tm *pend = localtime(&end); 60 | sprintf(scan_endtime, "%d/%d/%d %d:%d:%d", pend->tm_year+1900, pend->tm_mon+1, pend->tm_mday, pend->tm_hour, pend->tm_min, pend->tm_sec); 61 | std::string history = "\n"; 62 | history += "Session ID: " + session_id; 63 | history += "\n"; 64 | history += "Scan started at: " + std::string(scan_starttime); 65 | history += "\n"; 66 | history += "Scan ended at: " + std::string(scan_endtime); 67 | history += "\n"; 68 | history += "Found vulnerable application and available update: " + std::to_string(count); 69 | history += "\n"; 70 | history += "DetExploit Version: "; 71 | history += DETEXPLOIT_VERSION; 72 | history += "\n\n#####################################################################\n\n"; 73 | std::ofstream writeFile; 74 | writeFile.open("history.detexploit"); 75 | writeFile << history; 76 | 77 | generate_report(cp, session_id, std::string(scan_starttime), std::string(scan_endtime), result); 78 | 79 | SetConsoleTextAttribute(hStdout, FOREGROUND_RED); 80 | std::cout << "===========================================================" << std::endl; 81 | std::string resmsg = RESONE; 82 | resmsg += std::to_string(count); 83 | resmsg += RESTWO; 84 | std::cout << resmsg << std::endl; 85 | std::cout << "===========================================================" << std::endl; 86 | SetConsoleTextAttribute(hStdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); 87 | 88 | return 0; 89 | } 90 | 91 | INIReader init_cp(char *arg) { 92 | INIReader cp(arg); 93 | if (cp.ParseError() < 0) { 94 | std::cout << "Error: Cannot parse this config file.\n" << std::endl; 95 | exit(1); 96 | } 97 | return cp; 98 | } 99 | -------------------------------------------------------------------------------- /nvd.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | nvd.cpp 3 | DetExploit program file related to NVD. 4 | DetExploit (https://github.com/moppoi5168/DetExploit) 5 | Licensed by GPL License 6 | */ 7 | 8 | #include "detexploit.hpp" 9 | 10 | std::map nvd_download_vulndata(HANDLE hStdout) { 11 | std::string Url = ""; 12 | std::string str = ""; 13 | std::vector tmp; 14 | std::map product_dict; 15 | std::cout << NVD_DOWNLOAD_INTRO << std::endl; 16 | for (int y = 2010; y < 2020; y++) { 17 | Url = "https://raw.githubusercontent.com/moppoi5168/VulnData/cf6e0e47cf14ee8866c7ddbd1bd9fb226779a3da/NVD-DETEXPLOIT/NVDVULN_"; 18 | Url += std::to_string(y); 19 | Url += ".detexploit"; 20 | URLDownloadToFile(0, Url.c_str(), _T("nvd_temp.xml"), 0, 0); 21 | std::ifstream ifs("nvd_temp.xml"); 22 | while (getline(ifs, str)) { 23 | tmp = split(str, "/,/,/,/"); 24 | try { 25 | product_dict[tmp[0]] = tmp[1]; 26 | } catch (...) { 27 | continue; 28 | } 29 | } 30 | } 31 | std::cout << NVD_DOWNLOAD_SUCCESS << std::endl; 32 | std::cout << "===========================================================" << std::endl; 33 | return product_dict; 34 | } 35 | 36 | std::map nvd_scan(std::map nvd_vulndata, std::map installed) { 37 | std::map resultdict; 38 | std::string level = ""; 39 | VulnInfo vinfo; 40 | for (auto fit = nvd_vulndata.begin(); fit != nvd_vulndata.end(); fit++) { 41 | for (auto nit = installed.begin(); nit != installed.end(); nit++) { 42 | if ((*fit).first == (*nit).first && (*fit).second == (*nit).second) { 43 | level = determine_severity(NVD, "NOEXT"); 44 | vinfo.version = (*fit).second; 45 | vinfo.is_edb = true; 46 | vinfo.is_jvn = false; 47 | vinfo.is_nvd = false; 48 | vinfo.is_winupd = false; 49 | vinfo.severity = level; 50 | resultdict[(*fit).first] = vinfo; 51 | std::cout << "===========================================================" << std::endl; 52 | std::cout << DETECT_ALERT << std::endl; 53 | std::cout << APP_NAME << (*fit).first << " >>" << std::endl; 54 | std::cout << APP_VERSION << (*fit).second << " >>" << std::endl; 55 | std::cout << DETECT_USING_NVD << std::endl; 56 | std::cout << OBJECT_LEVEL << level << " >>" << std::endl; 57 | std::cout << "===========================================================" << std::endl; 58 | } 59 | } 60 | } 61 | return resultdict; 62 | } 63 | -------------------------------------------------------------------------------- /report.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | report.cpp 3 | DetExploit program file related to scan result report. 4 | DetExploit (https://github.com/moppoi5168/DetExploit) 5 | Licensed by GPL License 6 | */ 7 | 8 | #include "detexploit.hpp" 9 | 10 | std::string determine_severity(std::string data_src, std::string ext) { 11 | if (data_src == "ExploitDB") { 12 | std::string rv = LEVEL_DANGER; 13 | return rv; 14 | } else if (data_src == "WinUpdate") { 15 | if (ext == "NOEXT" || ext.find("KB") == std::string::npos) { 16 | std::string rv = LEVEL_WARNING; 17 | return rv; 18 | } 19 | /* TODO: Retrieve informations from Windows Update Catalog, to determine update is important or not. */ 20 | std::string rv = LEVEL_WARNING; 21 | return rv; 22 | } else if (data_src == "JVN") { 23 | std::string rv = LEVEL_CAUTION; 24 | return rv; 25 | } else if (data_src == "NVD") { 26 | std::string rv = LEVEL_CAUTION; 27 | return rv; 28 | } else { 29 | std::string rv = "Error"; 30 | return rv; 31 | } 32 | } 33 | 34 | void generate_report(INIReader cp, std::string session_id, std::string scan_starttime, std::string scan_endtime, std::map resultdict) { 35 | std::string rformat = std::string(cp.Get("general", "report_format", "HTML")); 36 | std::string hostname = ghostname(); 37 | std::string templ = ""; 38 | if (rformat == "HTML") { 39 | std::ifstream ifs("resources/report_template.html"); 40 | if (ifs.fail()) { 41 | std::cerr << "Error: Cannot load resources/report_template.html" << std::endl; 42 | exit(1); 43 | } 44 | std::string templ((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); 45 | } else if (rformat == "Markdown") { 46 | std::ifstream ifs("resources/report_template.md"); 47 | if (ifs.fail()) { 48 | std::cerr << "Error: Cannot load resources/report_template.md" << std::endl; 49 | exit(1); 50 | } 51 | std::string templ((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); 52 | } else if (rformat == "PlainText") { 53 | std::ifstream ifs("resources/report_template.txt"); 54 | if (ifs.fail()) { 55 | std::cerr << "Error: Cannot load resources/report_template.txt" << std::endl; 56 | exit(1); 57 | } 58 | std::string templ((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); 59 | } else { 60 | std::cout << REPORT_FORMAT_READ_ERROR_ONE << std::endl; 61 | std::cout << REPORT_FORMAT_READ_ERROR_TWO << std::endl; 62 | std::ifstream ifs("resources/report_template.html"); 63 | if (ifs.fail()) { 64 | std::cerr << "Error: Cannot load resources/report_template.html" << std::endl; 65 | exit(1); 66 | } 67 | std::string templ((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); 68 | } 69 | std::string row = ""; 70 | std::string detect_using_exploitdb = ""; 71 | std::string attack_code_exists = ""; 72 | std::string detect_using_jvn = ""; 73 | std::string detect_using_nvd = ""; 74 | std::string is_windows_update = ""; 75 | std::string tdid = ""; 76 | for (auto it = resultdict.begin(); it != resultdict.end(); it++) { 77 | VulnInfo vuln_i = (*it).second; 78 | std::string app_name = (*it).first; 79 | std::string app_version = vuln_i.version; 80 | if ((*it).second.is_edb) { 81 | detect_using_exploitdb = "〇"; 82 | attack_code_exists = "〇"; 83 | } else { 84 | detect_using_exploitdb = "×"; 85 | attack_code_exists = "Unknown"; 86 | } 87 | if ((*it).second.is_jvn) { 88 | detect_using_jvn = "〇"; 89 | } else { 90 | detect_using_jvn = "×"; 91 | } 92 | if ((*it).second.is_nvd) { 93 | detect_using_nvd = "〇"; 94 | } else { 95 | detect_using_nvd = "×"; 96 | } 97 | if ((*it).second.is_winupd) { 98 | is_windows_update = "〇"; 99 | } else { 100 | is_windows_update = "×"; 101 | } 102 | if ((*it).second.severity == "DANGER") { 103 | tdid = "danger"; 104 | } else if ((*it).second.severity == "WARINING") { 105 | tdid = "warning"; 106 | } else if ((*it).second.severity == "CAUTION") { 107 | tdid = "caution"; 108 | } else { 109 | tdid = "unknown"; 110 | } 111 | std::string ext = ""; 112 | std::string conts = ""; 113 | if (rformat == "PlainText") { 114 | ext = ".txt"; 115 | conts = "!!CONTS_PlainText!!"; 116 | // conts{boost::format("\n [%1% v%2%] - %3%\n Detected using ExploitDB: %4%\n Detected using JVN: %5%\n Detected using NVD: %6%\n Is it Windows Update: %7%\n Attack Code Existence: %8%\n ") % app_name % app_version % (*it).second.severity % detect_using_exploitdb % detect_using_jvn % detect_using_nvd % is_windows_update % attack_code_exists}; 117 | row = row + conts; 118 | } else if (rformat == "Markdown") { 119 | ext = ".md"; 120 | conts = "!!CONTS_Markdown!!"; 121 | // conts{boost::format("\n ### %1% v%2%\n - Level: %3%\n - Detected by ExploitDB: %4%\n - Detected by JVN: %5%\n - Detected by NVD: %6%\n - Is it Windows Update: %7%\n - Attack Code Existence: %8%\n ") % app_name % app_version % (*it).second.severity % detect_using_exploitdb % detect_using_jvn % detect_using_nvd % is_windows_update % attack_code_exists}; 122 | row = row + conts; 123 | } else { 124 | ext = ".html"; 125 | conts = "!!CONTS_HTML!!"; 126 | // conts{boost::format("\n \n %2%\n %3%\n %4%\n %5%\n %6%\n %7%\n %8%\n %9%\n \n ") % tdid % (*it).second.severity % app_name % app_version % detect_using_exploitdb % detect_using_jvn % detect_using_nvd % is_windows_update % attack_code_exists}; 127 | row = row + conts; 128 | } 129 | // std::string report = boost::format(templ) % DETEXPLOIT_VERSION % hostname % scan_starttime % scan_endtime % "NOTAVAIL" % session_id % LANGPACK_SIGNATURE % row; 130 | std::string report = "!!REPORT!!" + conts; 131 | std::string filename = "detexploit_report_" + session_id + ext; 132 | std::ofstream rfile; 133 | rfile.open(filename, std::ios::out); 134 | if (!rfile) { 135 | std::cout << "Error: Cannot generate report. Please check permission settings, and retry." << std::endl; 136 | exit(1); 137 | } 138 | rfile << report << std::endl; 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /resources/default.ini: -------------------------------------------------------------------------------- 1 | ########################################################### 2 | # default.ini 3 | # This is BACKUP of config.ini, DO NOT EDIT!!!! 4 | # DetExploit (https://github.com/moppoi5168/DetExploit) 5 | # Licensed by GPL License 6 | ########################################################### 7 | 8 | [general] 9 | # DetExploit Language Settings (Default Value: en) 10 | lang = ja 11 | # DetExploit will automaticly delete vulnerability data if you set True here. (Default Value: True) 12 | do_not_save_vulndata = True 13 | # If you want to scan also for the operating system update, set True here. (Default Value: True) 14 | os_update_scan = True 15 | # The scan report format of DetExploit. (Default Value: HTML) 16 | report_format = HTML 17 | 18 | [exploitdb] 19 | # If you want to use ExploitDB as source of vulnerability data, set True here. (Default Value: True) 20 | use_exploitdb = True 21 | # File name that DetExploit saves ExploitDB vulnerability data. (Default Value: exploitdb.detexploit) 22 | vulndata_filename = exploitdb.detexploit 23 | 24 | [jvn] 25 | # If you want to use JVN as source of vulnerability data, set True here. (Default Value: True) 26 | use_jvn = True 27 | # The time range of vulnerability data from JVN. 28 | # If you make it longer, time that is required to process will also be longer. (Default Value: 2010, 2019) 29 | data_from = 2010 30 | data_to = 2019 31 | 32 | [nvd] 33 | # If you want to use JVN as source of vulnerability data, set True here. (Default Value: True) 34 | use_nvd = True 35 | # The time range of vulnerability data from NVD. 36 | # If you make it longer, time that is required to process will also be longer. (Default Value: 2010, 2019) 37 | data_from = 2010 38 | data_to = 2019 39 | -------------------------------------------------------------------------------- /resources/langpack/en_langdata.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | en_langdata.hpp 3 | English language pack of DetExploit. 4 | DetExploit (https://github.com/moppoi5168/DetExploit) 5 | Licensed by GPL License 6 | */ 7 | 8 | #define WELCOME_MESSAGE " Hello, W0rld!! Welcome to DetExploit v1.4-alpha :D" 9 | 10 | /* Used in exploitdb.py */ 11 | #define EXPLOITDB_DOWNLOAD_INTRO " Downloading vulnerability data from ExploitDB GitHub repo." 12 | #define EXPLOITDB_DOWNLOAD_SUCCESS " Download complete." 13 | #define EXPLOITDB_DOWNLOAD_FAILED " Error: ExploitDB vulnerability data download has failed!!!" 14 | #define EXPLOITDB_EXTRACT_WIN " Extracting Windows platform exploit from " 15 | #define EXPLOITDB_EXTRACT_SUCCESS " Extracted successfully." 16 | 17 | /* Used in jvn.py */ 18 | #define JVN_DOWNLOAD_INTRO " Downloading vulnerability data from JVN." 19 | #define JVN_DOWNLOAD_ALERT_ONE " This may need a long time to process." 20 | #define JVN_DOWNLOAD_ALERT_TWO " Do not exit the program." 21 | #define JVN_DOWNLOAD_PROGRESS " Successfully Downloaded: " 22 | #define JVN_DOWNLOAD_SUCCESS " Download complete." 23 | 24 | /* Used in nvd.py */ 25 | #define NVD_DOWNLOAD_INTRO " Downloading vulnerability data from NVD." 26 | #define NVD_DOWNLOAD_SUCCESS " Download complete." 27 | 28 | /* Used in winupdate.py */ 29 | #define WINUPD_SCAN_INTRO " Running update searcher script to gather not-installed update." 30 | 31 | /* Used in * (Scan Phase) */ 32 | #define DETECT_ALERT " << ALERT :: VULNERABLE APPLICATION DETECTED >>" 33 | #define DETECT_UPDATE_ALERT " << ALERT :: AVAILABLE WINDOWS UPDATE DETECTED >>" 34 | #define APP_NAME " << Application Name: " 35 | #define APP_VERSION " << Application Version:" 36 | #define UPDATE_NAME " << Update Name: " 37 | #define DETECT_USING_EXPLOITDB " << Used database: ExploitDB >>" 38 | #define DETECT_USING_JVN " << Used database: Japan Vulnerability Notes >>" 39 | #define DETECT_USING_NVD " << Used database: National Vulnerability Database >>" 40 | #define OBJECT_LEVEL " << Level:" 41 | 42 | /* Used in report.py */ 43 | #define LEVEL_DANGER "DANGER" 44 | #define LEVEL_WARNING "WARNING" 45 | #define LEVEL_CAUTION "CAUTION" 46 | #define EDB "ExploitDB" 47 | #define JVN "JVN" 48 | #define NVD "NVD" 49 | #define REPORT_FORMAT_READ_ERROR_ONE "Error: Scan report format detemination failed. (Check config.ini)" 50 | #define REPORT_FORMAT_READ_ERROR_TWO "Error: Default value will be used (HTML)." 51 | #define REPORT_OUTPUT_INFO_ONE " Report has been saved at ../reports/detexploit_report_" 52 | #define REPORT_OUTPUT_INFO_TWO " !!!" 53 | 54 | /* GUI */ 55 | #define FIRST_MSG "Please click scan button to start." 56 | #define OP_START "Operation has been started." 57 | #define EXPLOITDB_EXTRACT_GUI "Extracting Windows vulnerability from data." 58 | #define EXPLOITDB_PARSE "Parsing vulnerability data." 59 | #define WMI_APP_RET "Retrieving application data from WMI." 60 | #define REG_APP_RET "Retrieving application data from Windows Registry." 61 | #define SCAN_MSG_ONE "Comparing fetched data and installed application list." 62 | #define SCAN_MSG_TWO "Checking available Windows Updates." 63 | #define SCAN_END "Done." 64 | #define GEN_REPORT "Generating report in specified format." 65 | 66 | #define RESONE " RESULT: " 67 | #define RESTWO " vulnerable application or update detected!!" 68 | 69 | #define LANGPACK_SIGNATURE "DetExploit English LP" 70 | -------------------------------------------------------------------------------- /resources/langpack/ja_langdata.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | ja_langdata.hpp 3 | English language pack of DetExploit. 4 | DetExploit (https://github.com/moppoi5168/DetExploit) 5 | Licensed by GPL License 6 | */ 7 | 8 | #define WELCOME_MESSAGE " Hello, W0rld!! DetExploit v1.4-alphaへようこそ! :D" 9 | 10 | /* Used in exploitdb.py */ 11 | #define EXPLOITDB_DOWNLOAD_INTRO " ExploitDBから脆弱性情報をダウンロードしています。" 12 | #define EXPLOITDB_DOWNLOAD_SUCCESS " ダウンロード完了。" 13 | #define EXPLOITDB_DOWNLOAD_FAILED " エラー: ExploitDBの脆弱性情報ダウンロードが失敗しました。" 14 | #define EXPLOITDB_EXTRACT_WIN " 次のファイルからWindows環境の脆弱性のみを抽出しています: " 15 | #define EXPLOITDB_EXTRACT_SUCCESS " 抽出に成功しました。" 16 | 17 | /* Used in jvn.py */ 18 | #define JVN_DOWNLOAD_INTRO " JVNから脆弱性情報をダウンロードしています。" 19 | #define JVN_DOWNLOAD_ALERT_ONE " この処理には時間がかかる可能性があります。" 20 | #define JVN_DOWNLOAD_ALERT_TWO " プログラムを終了しないでください。" 21 | #define JVN_DOWNLOAD_PROGRESS " ダウンロード成功: " 22 | #define JVN_DOWNLOAD_SUCCESS " ダウンロード完了。" 23 | 24 | /* Used in nvd.py */ 25 | #define NVD_DOWNLOAD_INTRO " NVDから脆弱性情報をダウンロードしています。" 26 | #define NVD_DOWNLOAD_SUCCESS " ダウンロード完了。" 27 | 28 | /* Used in winupdate.py */ 29 | #define WINUPD_SCAN_INTRO " インストールされていないアップデートを検索しています。" 30 | 31 | /* Used in * (Scan Phase) */ 32 | #define DETECT_ALERT " << 警告 :: 脆弱なアプリケーションを検知しました >>" 33 | #define DETECT_UPDATE_ALERT " << 警告 :: インストールされていないWindows Updateを検知しました >>" 34 | #define APP_NAME " << アプリケーション名: " 35 | #define APP_VERSION " << アプリケーションのバージョン:" 36 | #define UPDATE_NAME " << アップデート名: " 37 | #define DETECT_USING_EXPLOITDB " << 使用したデータベース: ExploitDB >>" 38 | #define DETECT_USING_JVN " << 使用したデータベース: Japan Vulnerability Notes >>" 39 | #define DETECT_USING_NVD " << 使用したデータベース: National Vulnerability Database >>" 40 | #define OBJECT_LEVEL " << オブジェクトレベル:" 41 | 42 | /* Used in report.py */ 43 | #define LEVEL_DANGER "危険" 44 | #define LEVEL_WARNING "警告" 45 | #define LEVEL_CAUTION "注意" 46 | #define EDB "ExploitDB" 47 | #define JVN "JVN" 48 | #define NVD "NVD" 49 | #define REPORT_FORMAT_READ_ERROR_ONE "エラー: スキャンレポート出力方式が正しく設定されていません。config.iniを確認してください。" 50 | #define REPORT_FORMAT_READ_ERROR_TWO "エラー: 初期値(HTML)が使用されます。" 51 | #define REPORT_OUTPUT_INFO_ONE " レポートは次のファイルに正常に出力されました: ../reports/detexploit_report_" 52 | #define REPORT_OUTPUT_INFO_TWO " " 53 | 54 | 55 | /* GUI */ 56 | #define FIRST_MSG "スキャンボタンをクリックしてスタートしてください。" 57 | #define OP_START "オペレーションが開始しました。" 58 | #define EXPLOITDB_EXTRACT_GUI "Windowsの脆弱性をデータから抽出しています。" 59 | #define EXPLOITDB_PARSE "ExploitDB脆弱性データを解析しています。" 60 | #define WMI_APP_RET "WMIからアプリケーション情報を取得しています。" 61 | #define REG_APP_RET "レジストリからアプリケーション情報を取得しています。" 62 | #define SCAN_MSG_ONE "外部の情報とローカルマシンの情報を使用してスキャンしています。" 63 | #define SCAN_MSG_TWO "未適用のWindows Updateを検索しています。" 64 | #define SCAN_END "完了。" 65 | #define GEN_REPORT "指定されたフォーマットでレポートを出力中。" 66 | 67 | #define RESONE " 結果: " 68 | #define RESTWO " 個の脆弱なアプリケーション、未インストールのアップデートが検知されました。" 69 | 70 | #define LANGPACK_SIGNATURE "DetExploit Japanese LP" 71 | -------------------------------------------------------------------------------- /resources/report_template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 170 | DetExploit Report 171 | 172 | 173 | 174 | 177 |
178 |
179 |

Scan Overview

180 |
181 |
    182 |
  • Machine Name: %1%
  • 183 |
  • Scan started at: %2%
  • 184 |
  • Scan ended at: %3%
  • 185 |
  • Detected Vulnerable App or Update: %4%
  • 186 |
  • DetExploit Version: %5%
  • 187 |
188 |
189 |
190 |
191 |

Flags

192 |
193 |
    194 |
  • Session ID: %6%
  • 195 |
  • Language Pack: %7%
  • 196 |
  • -
  • 197 |
  • -
  • 198 |
  • -
  • 199 |
200 |
201 |
202 |
203 |
204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | %8% 216 | 243 |
LevelObject NameObject VersionExploitDBMyJVN APINVDWindows UpdateAttack Code Exists
244 |
245 |
246 |
247 | 248 | 249 | -------------------------------------------------------------------------------- /resources/report_template.md: -------------------------------------------------------------------------------- 1 | # DetExploit Scan Report 2 | 3 | ## Scan Overview 4 | 5 | - Machine Name: %1% 6 | - Scan started at: %2% 7 | - Scan ended at: %3% 8 | - Detected vulnerability or update: %4% 9 | - Platform: %5% 10 | 11 | ## Flags 12 | 13 | - Session ID: %6% 14 | - Language Pack: %7% 15 | 16 | ## Result 17 | 18 | %8% 19 | -------------------------------------------------------------------------------- /resources/report_template.txt: -------------------------------------------------------------------------------- 1 | 2 | ################################################## 3 | # DetExploit Scan Report # 4 | ################################################## 5 | 6 | ## Scan Overview ################################# 7 | - Machine Name: %1% 8 | - Scan started at: %2% 9 | - Scan ended at: %3% 10 | - Detected Vulnerable App or Update: %4% 11 | - DetExploit Version: %5% 12 | ################################################## 13 | 14 | ## Flags ######################################### 15 | - Session ID: %6% 16 | - Language Pack: %7% 17 | ################################################## 18 | 19 | ## Result ######################################## 20 | 21 | %8% 22 | 23 | ################################################## -------------------------------------------------------------------------------- /resources/sshot_v0.6-alpha.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/detexploit/DetExploit/042d6633ca938dad00c50800bd10dd9a35c2e707/resources/sshot_v0.6-alpha.jpg -------------------------------------------------------------------------------- /resources/sshot_v0.9-alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/detexploit/DetExploit/042d6633ca938dad00c50800bd10dd9a35c2e707/resources/sshot_v0.9-alpha.png -------------------------------------------------------------------------------- /utils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | utils.cpp 3 | DetExploit program file for utilities used in entire program. 4 | DetExploit (https://github.com/moppoi5168/DetExploit) 5 | Licensed by GPL License 6 | */ 7 | 8 | #define MAX_KEY_LENGTH 255 9 | #define MAX_VALUE_NAME 16383 10 | 11 | #include "detexploit.hpp" 12 | 13 | static const std::string base64_chars = 14 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 15 | "abcdefghijklmnopqrstuvwxyz" 16 | "0123456789+/"; 17 | 18 | std::string ghostname() { 19 | char hostname[256]; 20 | DWORD hostnameLength = 256; 21 | GetComputerName(hostname, &hostnameLength); 22 | return std::string(hostname); 23 | } 24 | 25 | bool checkFileExistence(const std::string& str) { 26 | std::ifstream ifs(str); 27 | return ifs.is_open(); 28 | } 29 | 30 | std::vector split(const std::string& src, const char* delim) { 31 | std::vector vec; 32 | std::string::size_type len = src.length(); 33 | 34 | for (std::string::size_type i = 0, n; i < len; i = n + 1) { 35 | n = src.find_first_of(delim, i); 36 | if (n == std::string::npos) { 37 | n = len; 38 | } 39 | vec.push_back(src.substr(i, n - i)); 40 | } 41 | 42 | return vec; 43 | } 44 | 45 | std::string join(const std::vector& v, const char* delim) { 46 | std::string s = ""; 47 | if (!v.empty()) { 48 | s += v[0]; 49 | for (decltype(v.size()) i = 1, c = v.size(); i < c; ++i) { 50 | if (delim) s += delim; 51 | s += v[i]; 52 | } 53 | } 54 | return s; 55 | } 56 | 57 | std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) { 58 | std::string ret = ""; 59 | int i = 0; 60 | int j = 0; 61 | unsigned char char_array_3[3]; 62 | unsigned char char_array_4[4]; 63 | 64 | while (in_len--) { 65 | char_array_3[i++] = *(bytes_to_encode++); 66 | if (i == 3) { 67 | char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; 68 | char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); 69 | char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); 70 | char_array_4[3] = char_array_3[2] & 0x3f; 71 | for(i = 0; (i <4) ; i++) 72 | ret += base64_chars[char_array_4[i]]; 73 | i = 0; 74 | } 75 | } 76 | if (i) { 77 | for(j = i; j < 3; j++) 78 | char_array_3[j] = '\0'; 79 | char_array_4[0] = ( char_array_3[0] & 0xfc) >> 2; 80 | char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); 81 | char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); 82 | for (j = 0; (j < i + 1); j++) 83 | ret += base64_chars[char_array_4[j]]; 84 | while((i++ < 3)) 85 | ret += '='; 86 | } 87 | return ret; 88 | } 89 | 90 | bool config_test() { 91 | return false; 92 | } 93 | -------------------------------------------------------------------------------- /winupdate.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | winupdate.cpp 3 | DetExploit program file related to Windows Update. 4 | DetExploit (https://github.com/moppoi5168/DetExploit) 5 | Licensed by GPL License 6 | */ 7 | 8 | #include "detexploit.hpp" --------------------------------------------------------------------------------