Utility class represents the shellcode builder.
| 27 | |
| 28 | // Utility class represents the shellcode builder. |
| 29 | class shellcode |
| 30 | { |
| 31 | // To access the internals. |
| 32 | friend class cobf; |
| 33 | private: |
| 34 | |
| 35 | // Union of the symbol hash and ordinal. |
| 36 | typedef union { |
| 37 | DWORD sym_hash; /*!< The symbol hash used to query it. */ |
| 38 | WORD sym_ord; /*!< The symbol ordinal used to query it. */ |
| 39 | } u_sym_info; |
| 40 | |
| 41 | // Struct of an obfuscated API. |
| 42 | typedef struct { |
| 43 | DWORD dll_name; /*!< Offset to the dll name. */ |
| 44 | BOOL by_name; /*!< True if the symbol is imported by name. */ |
| 45 | u_sym_info sym_info; /*!< The information . */ |
| 46 | DWORD sym_thnk; /*!< Offset to the first thunk that represents the symbol. */ |
| 47 | } obfuscated_sym, * p_obfuscated_sym; |
| 48 | |
| 49 | // Api set schema version 3. |
| 50 | typedef struct _ApiSetHeader63 { |
| 51 | DWORD Version; /*!< The version of the api set schema (6,3). */ |
| 52 | DWORD Size; /*!< Size of the whole table. */ |
| 53 | DWORD Sealed; /*!< Unknown (undocumented). */ |
| 54 | DWORD NumberOfApisets; /*!< Number of entries at the table. */ |
| 55 | DWORD NamesOffset; /*!< Offset to the names table. */ |
| 56 | DWORD TableOffset; /*!< Unknown (undocumented). */ |
| 57 | DWORD Multiplier; /*!< Unknown (undocumented). */ |
| 58 | } ApiSetHeader63, * PApiSetHeader63; |
| 59 | |
| 60 | // Api set schema name entry. |
| 61 | typedef struct _ApisetNameEntry { |
| 62 | DWORD Sealed; /*!< Unknown (undocumented). */ |
| 63 | DWORD Offset; /*!< Offset to the virtual dll name. */ |
| 64 | DWORD Ignored; /*!< Unknown (undocumented). */ |
| 65 | DWORD Size; /*!< Size of the virtual dll name. */ |
| 66 | DWORD HostOffset; /*!< Offset to the real dll name. */ |
| 67 | DWORD NumberOfHosts; /*!< Number of resolved dlls. */ |
| 68 | } ApisetNameEntry, * PApisetNameEntry; |
| 69 | |
| 70 | // Api set schema value entry. |
| 71 | typedef struct _ApisetValueEntry { |
| 72 | DWORD Ignored; /*!< Unknown (undocumented). */ |
| 73 | DWORD NameOffset; /*!< Offset to the name. */ |
| 74 | DWORD NameLength; /*!< Length of the name. */ |
| 75 | DWORD ValueOffset; /*!< Offset to the value. */ |
| 76 | DWORD ValueLength; /*!< Loength of the value. */ |
| 77 | } ApisetValueEntry, * PApisetValueEntry; |
| 78 | |
| 79 | // Api set schema version 6. |
| 80 | typedef struct _ApiSetHeader6 { |
| 81 | DWORD Version; /*!< Version of the api set schema. */ |
| 82 | DWORD Count; /*!< Number of entries. */ |
| 83 | } ApiSetHeader6, * PApiSetHeader6; |
| 84 | |
| 85 | // Api set schema another version name entry. |
| 86 | typedef struct _ApisetNameEntry2 { |
nothing calls this directly
no outgoing calls
no test coverage detected