diff --git a/docs/plugin-development-workshop/Locked.zip b/docs/plugin-development-workshop/Locked.zip new file mode 100644 index 000000000..5d2d86ffa Binary files /dev/null and b/docs/plugin-development-workshop/Locked.zip differ diff --git a/docs/plugin-development-workshop/Workshop-Syllabus-EN.pdf b/docs/plugin-development-workshop/Workshop-Syllabus-EN.pdf new file mode 100644 index 000000000..7d242ea49 Binary files /dev/null and b/docs/plugin-development-workshop/Workshop-Syllabus-EN.pdf differ diff --git a/docs/plugin-development-workshop/candy.hash b/docs/plugin-development-workshop/candy.hash new file mode 100644 index 000000000..3115a5e95 --- /dev/null +++ b/docs/plugin-development-workshop/candy.hash @@ -0,0 +1 @@ +9b0851637cb194a05c4efd7056b08333:10000:7fc6122b1c11f5522af269778b03c79218f2a676801b87d879f22a8e4bb5eb7d \ No newline at end of file diff --git a/docs/plugin-development-workshop/example.hash b/docs/plugin-development-workshop/example.hash new file mode 100644 index 000000000..fa5bef3db --- /dev/null +++ b/docs/plugin-development-workshop/example.hash @@ -0,0 +1 @@ +dc1153d3069912c5ce8c4fc75797c5b4:10000:49493e63559ba3669b1b14ad958aaed1086433a1bcd2d1ac9df28ced1d14f810 \ No newline at end of file diff --git a/docs/plugin-development-workshop/hashcat-6.2.6.zip b/docs/plugin-development-workshop/hashcat-6.2.6.zip new file mode 100644 index 000000000..d2a0897d7 Binary files /dev/null and b/docs/plugin-development-workshop/hashcat-6.2.6.zip differ diff --git a/docs/plugin-development-workshop/m-template-pure.cl b/docs/plugin-development-workshop/m-template-pure.cl new file mode 100644 index 000000000..17dce4e31 --- /dev/null +++ b/docs/plugin-development-workshop/m-template-pure.cl @@ -0,0 +1,27 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_hash_md5.cl) +#include M2S(INCLUDE_PATH/inc_cipher_aes.cl) +#endif + +KERNEL_FQ void m_init (KERN_ATTR_TMPS_ESALT (workshop_temp_t, workshop_t)) +{ +} + +KERNEL_FQ void m_loop (KERN_ATTR_TMPS_ESALT (workshop_temp_t, workshop_t)) +{ +} + +KERNEL_FQ void m_comp (KERN_ATTR_TMPS_ESALT (workshop_temp_t, workshop_t)) +{ +} diff --git a/docs/plugin-development-workshop/m12345-pure.cl b/docs/plugin-development-workshop/m12345-pure.cl new file mode 100644 index 000000000..183b94f1f --- /dev/null +++ b/docs/plugin-development-workshop/m12345-pure.cl @@ -0,0 +1,185 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_hash_md5.cl) +#include M2S(INCLUDE_PATH/inc_cipher_aes.cl) +#endif + +#define COMPARE_S M2S(INCLUDE_PATH/inc_comp_single.cl) +#define COMPARE_M M2S(INCLUDE_PATH/inc_comp_multi.cl) + +typedef struct workshop +{ + u32 encrypted_data[8]; + +} workshop_t; + +typedef struct workshop_temp +{ + u32 digest_buf[4]; + +} workshop_temp_t; + + +KERNEL_FQ void m12345_init (KERN_ATTR_TMPS_ESALT (workshop_temp_t, workshop_t)) +{ + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + md5_ctx_t ctx; + + md5_init (&ctx); + + md5_update_global (&ctx, pws[gid].i, pws[gid].pw_len); + + md5_update_global (&ctx, salt_bufs[SALT_POS_HOST].salt_buf, salt_bufs[SALT_POS_HOST].salt_len); + + md5_final (&ctx); + + char *replace=(char*)&ctx.h[0]; + replace[0] = 0; + replace[1] = 1; + replace[2] = 2; + replace[3] = 3; + + tmps[gid].digest_buf[0] = ctx.h[0]; + tmps[gid].digest_buf[1] = ctx.h[1]; + tmps[gid].digest_buf[2] = ctx.h[2]; + tmps[gid].digest_buf[3] = ctx.h[3]; +} + +KERNEL_FQ void m12345_loop (KERN_ATTR_TMPS_ESALT (workshop_temp_t, workshop_t)) +{ + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + u32 digest[16] = { 0 }; + + digest[0] = tmps[gid].digest_buf[0]; + digest[1] = tmps[gid].digest_buf[1]; + digest[2] = tmps[gid].digest_buf[2]; + digest[3] = tmps[gid].digest_buf[3]; + + for (u32 index = 0; index < LOOP_CNT; index++) + { + md5_ctx_t ctx; + + md5_init (&ctx); + + md5_update (&ctx, digest, 16); + + md5_final (&ctx); + + digest[0] = ctx.h[0]; + digest[1] = ctx.h[1]; + digest[2] = ctx.h[2]; + digest[3] = ctx.h[3]; + } + + tmps[gid].digest_buf[0] = digest[0]; + tmps[gid].digest_buf[1] = digest[1]; + tmps[gid].digest_buf[2] = digest[2]; + tmps[gid].digest_buf[3] = digest[3]; +} + +KERNEL_FQ void m12345_comp (KERN_ATTR_TMPS_ESALT (workshop_temp_t, workshop_t)) +{ + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + /** + * Copy the shared aes-tables + */ + #ifdef REAL_SHM + + LOCAL_VK u32 s_td0[256]; + LOCAL_VK u32 s_td1[256]; + LOCAL_VK u32 s_td2[256]; + LOCAL_VK u32 s_td3[256]; + LOCAL_VK u32 s_td4[256]; + + LOCAL_VK u32 s_te0[256]; + LOCAL_VK u32 s_te1[256]; + LOCAL_VK u32 s_te2[256]; + LOCAL_VK u32 s_te3[256]; + LOCAL_VK u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a *s_td0 = td0; + CONSTANT_AS u32a *s_td1 = td1; + CONSTANT_AS u32a *s_td2 = td2; + CONSTANT_AS u32a *s_td3 = td3; + CONSTANT_AS u32a *s_td4 = td4; + + CONSTANT_AS u32a *s_te0 = te0; + CONSTANT_AS u32a *s_te1 = te1; + CONSTANT_AS u32a *s_te2 = te2; + CONSTANT_AS u32a *s_te3 = te3; + CONSTANT_AS u32a *s_te4 = te4; + + #endif + + if (gid >= GID_CNT) return; + + // aeskey = first 16 bytes of decrypted_crypt_key + u32 aes_key[4]; + aes_key[0] = tmps[gid].digest_buf[0]; + aes_key[1] = tmps[gid].digest_buf[1]; + aes_key[2] = tmps[gid].digest_buf[2]; + aes_key[3] = tmps[gid].digest_buf[3]; + + // iv = only zeroes + u32 iv[4] = { 0 }; + + u32 local_encrypted_data[4]; + local_encrypted_data[0] = esalt_bufs[DIGESTS_OFFSET_HOST].encrypted_data[0]; + local_encrypted_data[1] = esalt_bufs[DIGESTS_OFFSET_HOST].encrypted_data[1]; + local_encrypted_data[2] = esalt_bufs[DIGESTS_OFFSET_HOST].encrypted_data[2]; + local_encrypted_data[3] = esalt_bufs[DIGESTS_OFFSET_HOST].encrypted_data[3]; + + u32 decrypted_data[4] = {0}; // 16 bytes + + u32 ks[44]; + + aes128_set_decrypt_key (ks, aes_key, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3); + + aes128_decrypt (ks, local_encrypted_data, decrypted_data, s_td0, s_td1, s_td2, s_td3, s_td4); + + if ((decrypted_data[0] == 0) && (decrypted_data[1] == 0) && (decrypted_data[2] == 0) && (decrypted_data[3] == 0)) + { + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) + { + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); + } + } +} diff --git a/docs/plugin-development-workshop/module_12345.c b/docs/plugin-development-workshop/module_12345.c new file mode 100644 index 000000000..8ac43e658 --- /dev/null +++ b/docs/plugin-development-workshop/module_12345.c @@ -0,0 +1,237 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "Workshop Example"; +static const u64 KERN_TYPE = 12345; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "dc1153d3069912c5ce8c4fc75797c5b4:10000:49493e63559ba3669b1b14ad958aaed1086433a1bcd2d1ac9df28ced1d14f810"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +// Place any extra needed methods here + +typedef struct workshop +{ + u32 encrypted_data[8]; + +} workshop_t; + +typedef struct workshop_temp +{ + u32 digest_buf[4]; + +} workshop_temp_t; + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (workshop_t); + + return esalt_size; +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (workshop_temp_t); + + return tmp_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + workshop_t *workshop = (workshop_t *) esalt_buf; + + hc_token_t token; + + token.token_cnt = 3; + + // Salt + token.len_min[0] = 32; + token.len_max[0] = 32; + token.sep[0] = ':'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + // Rounds + token.len_min[1] = 5; + token.len_max[1] = 5; + token.sep[1] = ':'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_DIGIT; + + // Encrypted data + token.len_min[2] = 64; + token.len_max[2] = 64; + token.sep[2] = ':'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // Salt information + const u8 *salt_pos = token.buf[0]; + salt->salt_buf[0] = hex_to_u32(salt_pos + 0); + salt->salt_buf[1] = hex_to_u32(salt_pos + 8); + salt->salt_buf[2] = hex_to_u32(salt_pos + 16); + salt->salt_buf[3] = hex_to_u32(salt_pos + 24); + salt->salt_len = 16; + + // Number of rounds - salt-iter determines the number of times the loop() is called + const u8 *rounds_pos = token.buf[1]; + salt->salt_iter = hc_strtoul ((const char *) rounds_pos, NULL, 10); + + // Encrypted data + const u8 *encrypted_data_pos = token.buf[2]; + for(int index = 0; index < 8; index++) + { + workshop->encrypted_data[index] = hex_to_u32(encrypted_data_pos + (index * 8)); + } + + // We are using this to compare with the COMPARE_M method + digest[0] = workshop->encrypted_data[0]; + digest[1] = workshop->encrypted_data[1]; + digest[2] = workshop->encrypted_data[2]; + digest[3] = workshop->encrypted_data[3]; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const workshop_t *workshop = (const workshop_t *) esalt_buf; + + /* 64 hex characters - 32 bytes - encdata */ + u8 encrypted_data[32]; + memcpy (encrypted_data, workshop->encrypted_data, sizeof(workshop->encrypted_data)); + u8 hex_encrypted_data[64 + 1] = { 0 }; + for (u32 i = 0, j = 0; i < 32; i++, j += 2) + { + u8_to_hex (encrypted_data[i], hex_encrypted_data + j); + } + + const int line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x:10000:%s", + byte_swap_32(salt->salt_buf[0]), + byte_swap_32(salt->salt_buf[1]), + byte_swap_32(salt->salt_buf[2]), + byte_swap_32(salt->salt_buf[3]), + hex_encrypted_data); + + return line_len; + } + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_charset = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_deprecated_notice = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_postprocess = MODULE_DEFAULT; + module_ctx->module_hash_decode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hashes_count_min = MODULE_DEFAULT; + module_ctx->module_hashes_count_max = MODULE_DEFAULT; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_size = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_init = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_term = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_jit_cache_disable = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_custom_check = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = module_tmp_size; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/docs/plugin-development-workshop/module_template.c b/docs/plugin-development-workshop/module_template.c new file mode 100644 index 000000000..cdcf66662 --- /dev/null +++ b/docs/plugin-development-workshop/module_template.c @@ -0,0 +1,62 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = ""; +static const u64 KERN_TYPE = ; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = ""; +static const char *ST_HASH = ""; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ +} + +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ +} + +void module_init (module_ctx_t *module_ctx) +{ +}