{"id":144,"date":"2018-01-27T23:00:50","date_gmt":"2018-01-27T23:00:50","guid":{"rendered":"http:\/\/malwrforensics.com\/en\/?p=144"},"modified":"2018-01-29T00:44:36","modified_gmt":"2018-01-29T00:44:36","slug":"fuzzing-with-pydbg","status":"publish","type":"post","link":"https:\/\/malwrforensics.com\/en\/2018\/01\/27\/fuzzing-with-pydbg\/","title":{"rendered":"Fuzzing with pydbg"},"content":{"rendered":"<p><a href=\"https:\/\/www.securityaddicted.com\/tag\/pydbg\/\">Here<\/a> are some detailed instructions on how to install pydbg.<\/p>\n<p>In its most basic form, you need the following to execute a program:<\/p>\n<pre>from pydbg import *\r\nfrom pydbg.defines import *\r\n\r\n\r\ndef exception_handle(dbg):\r\n\u00a0 \u00a0 print(dbg.dump_context())\r\n    raw_input(\"Press enter to continue...\")\r\n\u00a0 \u00a0 return DBG_EXCEPTION_NOT_HANDLED\r\n\r\ndef debug(exe_path, params):\r\n\u00a0 \u00a0 dbg = pydbg()\r\n\u00a0 \u00a0 pid = dbg.load(exe_path, params)\r\n\u00a0 \u00a0 dbg.set_callback(EXCEPTION_ACCESS_VIOLATION, exception_handle)\r\n\u00a0 \u00a0 dbg.set_callback(EXCEPTION_GUARD_PAGE, exception_handle)\r\n\u00a0 \u00a0 dbg.run()\r\n return\r\n\r\ndef fuzz(exe_file):\r\n    while &lt;cond&gt;:\r\n        &lt;prepare the parameters&gt;\r\n        #debug the program and stop when there's a crash\r\n        debug(exe_file, params)<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are some detailed instructions on how to install pydbg. In its most basic form, you need the following to execute a program: from pydbg import * from pydbg.defines import * def exception_handle(dbg): \u00a0 \u00a0 print(dbg.dump_context()) raw_input(&#8220;Press enter to continue&#8230;&#8221;) \u00a0 \u00a0 return DBG_EXCEPTION_NOT_HANDLED def debug(exe_path, params): \u00a0 \u00a0 dbg = pydbg() \u00a0 \u00a0 pid [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[30,3,36,35,4],"class_list":["post-144","post","type-post","status-publish","format-standard","hentry","category-security","tag-debugger","tag-fuzzing","tag-pydbg","tag-python","tag-windows"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[]}},"featured_image_urls_v2":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":""},"post_excerpt_stackable_v2":"<p>Here are some detailed instructions on how to install pydbg. In its most basic form, you need the following to execute a program: from pydbg import * from pydbg.defines import * def exception_handle(dbg): \u00a0 \u00a0 print(dbg.dump_context()) raw_input(&#8220;Press enter to continue&#8230;&#8221;) \u00a0 \u00a0 return DBG_EXCEPTION_NOT_HANDLED def debug(exe_path, params): \u00a0 \u00a0 dbg = pydbg() \u00a0 \u00a0 pid = dbg.load(exe_path, params) \u00a0 \u00a0 dbg.set_callback(EXCEPTION_ACCESS_VIOLATION, exception_handle) \u00a0 \u00a0 dbg.set_callback(EXCEPTION_GUARD_PAGE, exception_handle) \u00a0 \u00a0 dbg.run() return def fuzz(exe_file): while &lt;cond&gt;: &lt;prepare the parameters&gt; #debug the program and stop when there&#8217;s a crash debug(exe_file, params) &nbsp;<\/p>\n","category_list_v2":"<a href=\"https:\/\/malwrforensics.com\/en\/category\/security\/\" rel=\"category tag\">Security<\/a>","author_info_v2":{"name":"malwrforensics","url":"https:\/\/malwrforensics.com\/en\/author\/u_malwrforensics\/"},"comments_num_v2":"0 comments","_links":{"self":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts\/144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/comments?post=144"}],"version-history":[{"count":2,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts\/144\/revisions"}],"predecessor-version":[{"id":155,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts\/144\/revisions\/155"}],"wp:attachment":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/media?parent=144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/categories?post=144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/tags?post=144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}