{"action":"created","comment":{"url":"https://api.github.com/repos/radare/radare2-extras/pulls/comments/72536354","id":72536354,"diff_hunk":"@@ -0,0 +1,199 @@\n+#include \"windows.h\"\r\n+#include \"stdio.h\"\r\n+#define strDeviceName     L\"\\\\\\\\.\\\\r2k\\\\\"\r\n+typedef  struct _PPA {\r\n+\tLARGE_INTEGER address;\r\n+\tDWORD len;\r\n+\tunsigned char buffer;\r\n+} PA, * PPA;\r\n+\r\n+typedef struct _RTL_PROCESS_MODULE_INFORMATION\r\n+{\r\n+\tHANDLE Section;         // Not filled in\r\n+\tPVOID MappedBase;\r\n+\tPVOID ImageBase;\r\n+\tULONG ImageSize;\r\n+\tULONG Flags;\r\n+\tUSHORT LoadOrderIndex;\r\n+\tUSHORT InitOrderIndex;\r\n+\tUSHORT LoadCount;\r\n+\tUSHORT OffsetToFileName;\r\n+\tUCHAR  FullPathName[256];\r\n+} RTL_PROCESS_MODULE_INFORMATION, *PRTL_PROCESS_MODULE_INFORMATION;\r\n+\r\n+typedef struct _RTL_PROCESS_MODULES\r\n+{\r\n+\tULONG NumberOfModules;\r\n+\tRTL_PROCESS_MODULE_INFORMATION Modules[1];\r\n+} RTL_PROCESS_MODULES, *PRTL_PROCESS_MODULES;\r\n+\r\n+#define INTEGER INT\r\n+#define\t\tCLOSE_DRIVER\t\t\t\tCTL_CODE(FILE_DEVICE_UNKNOWN, 0x803, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)\r\n+#define\t\tIOCTL_READ_PHYS_MEM\t\t\tCTL_CODE(FILE_DEVICE_UNKNOWN, 0x807, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)\r\n+#define\t\tIOCTL_READ_KERNEL_MEM\t\tCTL_CODE(FILE_DEVICE_UNKNOWN, 0x804, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)\r\n+#define\t\tIOCTL_GET_PHYSADDR\t\t\tCTL_CODE(FILE_DEVICE_UNKNOWN, 0x809, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)\r\n+#define\t\tIOCTL_WRITE_PHYS_MEM\t\tCTL_CODE(FILE_DEVICE_UNKNOWN, 0x808, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)\r\n+#define\t\tIOCTL_GET_SYSTEM_MODULES\tCTL_CODE(FILE_DEVICE_UNKNOWN, 0x80a, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)\r\n+#define\t\tIOCTL_WRITE_KERNEL_MEM\t\tCTL_CODE(FILE_DEVICE_UNKNOWN, 0x805, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)\r\n+\r\n+\r\n+BOOL IsDriverPresent(VOID)\r\n+{\r\n+\tBOOL\tRet = FALSE;\r\n+\tHANDLE\thFile;\r\n+\r\n+\thFile = CreateFile(strDeviceName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_DIRECTORY, 0);\r\n+\tif (hFile != INVALID_HANDLE_VALUE)\r\n+\t{\r\n+\t\tCloseHandle(hFile);\r\n+\t\tRet = TRUE;\r\n+\t}\r\n+\treturn(Ret);\r\n+}\r\n+\r\n+void GetDriverInfo(VOID)\r\n+{\r\n+\tLPVOID\t\tlpBuffer = NULL;\r\n+\tLPVOID\t\tlpBufferReal = NULL;\r\n+\tLPVOID\t\tlpBufMods = NULL;\r\n+\tLPVOID\t\tlpBufWrite = NULL;\r\n+\r\n+\tHANDLE\t\thDevice = INVALID_HANDLE_VALUE;\r\n+\tDWORD\t\tStatus = 1;\r\n+\tULONG\t\tbRead;\r\n+\tPPA         t,PPAWrite;\r\n+\tPA\t\t\tdireccion;\r\n+\tCHAR *      buffer;\r\n+\tint i;\r\n+\tdo\t// no es un loop , es para evitar gotos ;)\r\n+\t{\r\n+\t\t#define bufmodsize 1024*1024\r\n+\t\tif (!(lpBufMods = malloc(bufmodsize)))\r\n+\t\t\tbreak;\r\n+\t\t\r\n+\t\thDevice = CreateFile(strDeviceName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);\r\n+\t\tif (hDevice == INVALID_HANDLE_VALUE)\r\n+\t\t\tbreak;\r\n+\t\t\r\n+\t\t\r\n+\t\tif (!(DeviceIoControl(hDevice, IOCTL_GET_SYSTEM_MODULES, lpBufMods, bufmodsize, lpBufMods, bufmodsize, &bRead, NULL)))\r\n+\t\t\tbreak;\r\n+\r\n+\t\t\r\n+\t\tPRTL_PROCESS_MODULES pm = (PRTL_PROCESS_MODULES)lpBufMods;\r\n+\t\tPRTL_PROCESS_MODULE_INFORMATION pMod = pm->Modules;\r\n+\t\t#define bufsize 1024\r\n+\t\tif (!(lpBuffer = malloc(bufsize)))\r\n+\t\t\tbreak;\r\n+\t\tif (!(lpBufWrite = malloc(bufsize)))\r\n+\t\t\tbreak;\r\n+\t\tlpBufferReal = VirtualAlloc(NULL, 1, MEM_COMMIT, PAGE_READWRITE);\r\n+\t\t#define bufrealsize 1024\r\n+\t\tif (!(lpBufferReal = malloc(bufrealsize)))\r\n+\t\t\tbreak;\r\n+\t\t\r\n+\r\n+\t\tfor (i = 0; i < pm->NumberOfModules; i++)\r\n+\t\t{\r\n+\t\t\tprintf(\"%p = %-50s \", pMod[i].ImageBase, pMod[i].FullPathName);\r\n+\t\t\tt = (PPA)lpBuffer;\r\n+\t\t\tt->address.QuadPart = pMod[i].ImageBase;\r\n+\t\t\tt->len = 256;\r\n+\t\t\tif (!(DeviceIoControl(hDevice, IOCTL_READ_KERNEL_MEM, lpBuffer, bufsize, lpBuffer, bufsize, &bRead, NULL)))\r\n+\t\t\t\tprintf(\" [FALLO]\\n\");\r\n+\t\t\telse\r\n+\t\t\t{\r\n+\t\t\t\tprintf(\" [leeido]\");\r\n+\t\t\t\tPPAWrite = (PPA)lpBufWrite;\r\n+\t\t\t\tPPAWrite->address.QuadPart = pMod[i].ImageBase;\r\n+\t\t\t\tPPAWrite->len = 256;\r\n+\t\t\t\tmemcpy(&PPAWrite->buffer, lpBuffer, 256);\r\n+\t\t\t\tif (!(DeviceIoControl(hDevice, IOCTL_WRITE_KERNEL_MEM, lpBufWrite, bufsize, lpBufWrite, bufsize, &bRead, NULL)))\r\n+\t\t\t\t{\r\n+\t\t\t\t\tprintf(\" [FALLO]\");\r\n+\t\t\t\t}\r","path":"r2k/test/test.c","position":114,"original_position":114,"commit_id":"595c0dd32a1e052650d9a537f825fe587fa2d91c","original_commit_id":"595c0dd32a1e052650d9a537f825fe587fa2d91c","user":{"login":"radare","id":917142,"avatar_url":"https://avatars.githubusercontent.com/u/917142?v=3","gravatar_id":"","url":"https://api.github.com/users/radare","html_url":"https://github.com/radare","followers_url":"https://api.github.com/users/radare/followers","following_url":"https://api.github.com/users/radare/following{/other_user}","gists_url":"https://api.github.com/users/radare/gists{/gist_id}","starred_url":"https://api.github.com/users/radare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radare/subscriptions","organizations_url":"https://api.github.com/users/radare/orgs","repos_url":"https://api.github.com/users/radare/repos","events_url":"https://api.github.com/users/radare/events{/privacy}","received_events_url":"https://api.github.com/users/radare/received_events","type":"User","site_admin":false},"body":"`} else { ` in one line","created_at":"2016-07-27T22:29:25Z","updated_at":"2016-07-27T22:29:25Z","html_url":"https://github.com/radare/radare2-extras/pull/60#discussion_r72536354","pull_request_url":"https://api.github.com/repos/radare/radare2-extras/pulls/60","_links":{"self":{"href":"https://api.github.com/repos/radare/radare2-extras/pulls/comments/72536354"},"html":{"href":"https://github.com/radare/radare2-extras/pull/60#discussion_r72536354"},"pull_request":{"href":"https://api.github.com/repos/radare/radare2-extras/pulls/60"}}},"pull_request":{"url":"https://api.github.com/repos/radare/radare2-extras/pulls/60","id":79105298,"html_url":"https://github.com/radare/radare2-extras/pull/60","diff_url":"https://github.com/radare/radare2-extras/pull/60.diff","patch_url":"https://github.com/radare/radare2-extras/pull/60.patch","issue_url":"https://api.github.com/repos/radare/radare2-extras/issues/60","number":60,"state":"open","locked":false,"title":"Initial commit","user":{"login":"skuater","id":8082461,"avatar_url":"https://avatars.githubusercontent.com/u/8082461?v=3","gravatar_id":"","url":"https://api.github.com/users/skuater","html_url":"https://github.com/skuater","followers_url":"https://api.github.com/users/skuater/followers","following_url":"https://api.github.com/users/skuater/following{/other_user}","gists_url":"https://api.github.com/users/skuater/gists{/gist_id}","starred_url":"https://api.github.com/users/skuater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skuater/subscriptions","organizations_url":"https://api.github.com/users/skuater/orgs","repos_url":"https://api.github.com/users/skuater/repos","events_url":"https://api.github.com/users/skuater/events{/privacy}","received_events_url":"https://api.github.com/users/skuater/received_events","type":"User","site_admin":false},"body":"Driver for manage kernel memory","created_at":"2016-07-27T21:59:17Z","updated_at":"2016-07-27T22:29:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc485732dfa884a225adb3fa5ce5285610368c72","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/radare/radare2-extras/pulls/60/commits","review_comments_url":"https://api.github.com/repos/radare/radare2-extras/pulls/60/comments","review_comment_url":"https://api.github.com/repos/radare/radare2-extras/pulls/comments{/number}","comments_url":"https://api.github.com/repos/radare/radare2-extras/issues/60/comments","statuses_url":"https://api.github.com/repos/radare/radare2-extras/statuses/595c0dd32a1e052650d9a537f825fe587fa2d91c","head":{"label":"skuater:r2k","ref":"r2k","sha":"595c0dd32a1e052650d9a537f825fe587fa2d91c","user":{"login":"skuater","id":8082461,"avatar_url":"https://avatars.githubusercontent.com/u/8082461?v=3","gravatar_id":"","url":"https://api.github.com/users/skuater","html_url":"https://github.com/skuater","followers_url":"https://api.github.com/users/skuater/followers","following_url":"https://api.github.com/users/skuater/following{/other_user}","gists_url":"https://api.github.com/users/skuater/gists{/gist_id}","starred_url":"https://api.github.com/users/skuater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skuater/subscriptions","organizations_url":"https://api.github.com/users/skuater/orgs","repos_url":"https://api.github.com/users/skuater/repos","events_url":"https://api.github.com/users/skuater/events{/privacy}","received_events_url":"https://api.github.com/users/skuater/received_events","type":"User","site_admin":false},"repo":{"id":29064695,"name":"radare2-extras","full_name":"skuater/radare2-extras","owner":{"login":"skuater","id":8082461,"avatar_url":"https://avatars.githubusercontent.com/u/8082461?v=3","gravatar_id":"","url":"https://api.github.com/users/skuater","html_url":"https://github.com/skuater","followers_url":"https://api.github.com/users/skuater/followers","following_url":"https://api.github.com/users/skuater/following{/other_user}","gists_url":"https://api.github.com/users/skuater/gists{/gist_id}","starred_url":"https://api.github.com/users/skuater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skuater/subscriptions","organizations_url":"https://api.github.com/users/skuater/orgs","repos_url":"https://api.github.com/users/skuater/repos","events_url":"https://api.github.com/users/skuater/events{/privacy}","received_events_url":"https://api.github.com/users/skuater/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/skuater/radare2-extras","description":"source graveyard and related candies for radare2","fork":true,"url":"https://api.github.com/repos/skuater/radare2-extras","forks_url":"https://api.github.com/repos/skuater/radare2-extras/forks","keys_url":"https://api.github.com/repos/skuater/radare2-extras/keys{/key_id}","collaborators_url":"https://api.github.com/repos/skuater/radare2-extras/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/skuater/radare2-extras/teams","hooks_url":"https://api.github.com/repos/skuater/radare2-extras/hooks","issue_events_url":"https://api.github.com/repos/skuater/radare2-extras/issues/events{/number}","events_url":"https://api.github.com/repos/skuater/radare2-extras/events","assignees_url":"https://api.github.com/repos/skuater/radare2-extras/assignees{/user}","branches_url":"https://api.github.com/repos/skuater/radare2-extras/branches{/branch}","tags_url":"https://api.github.com/repos/skuater/radare2-extras/tags","blobs_url":"https://api.github.com/repos/skuater/radare2-extras/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/skuater/radare2-extras/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/skuater/radare2-extras/git/refs{/sha}","trees_url":"https://api.github.com/repos/skuater/radare2-extras/git/trees{/sha}","statuses_url":"https://api.github.com/repos/skuater/radare2-extras/statuses/{sha}","languages_url":"https://api.github.com/repos/skuater/radare2-extras/languages","stargazers_url":"https://api.github.com/repos/skuater/radare2-extras/stargazers","contributors_url":"https://api.github.com/repos/skuater/radare2-extras/contributors","subscribers_url":"https://api.github.com/repos/skuater/radare2-extras/subscribers","subscription_url":"https://api.github.com/repos/skuater/radare2-extras/subscription","commits_url":"https://api.github.com/repos/skuater/radare2-extras/commits{/sha}","git_commits_url":"https://api.github.com/repos/skuater/radare2-extras/git/commits{/sha}","comments_url":"https://api.github.com/repos/skuater/radare2-extras/comments{/number}","issue_comment_url":"https://api.github.com/repos/skuater/radare2-extras/issues/comments{/number}","contents_url":"https://api.github.com/repos/skuater/radare2-extras/contents/{+path}","compare_url":"https://api.github.com/repos/skuater/radare2-extras/compare/{base}...{head}","merges_url":"https://api.github.com/repos/skuater/radare2-extras/merges","archive_url":"https://api.github.com/repos/skuater/radare2-extras/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/skuater/radare2-extras/downloads","issues_url":"https://api.github.com/repos/skuater/radare2-extras/issues{/number}","pulls_url":"https://api.github.com/repos/skuater/radare2-extras/pulls{/number}","milestones_url":"https://api.github.com/repos/skuater/radare2-extras/milestones{/number}","notifications_url":"https://api.github.com/repos/skuater/radare2-extras/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/skuater/radare2-extras/labels{/name}","releases_url":"https://api.github.com/repos/skuater/radare2-extras/releases{/id}","deployments_url":"https://api.github.com/repos/skuater/radare2-extras/deployments","created_at":"2015-01-10T17:23:11Z","updated_at":"2016-07-27T21:34:21Z","pushed_at":"2016-07-27T21:36:03Z","git_url":"git://github.com/skuater/radare2-extras.git","ssh_url":"git@github.com:skuater/radare2-extras.git","clone_url":"https://github.com/skuater/radare2-extras.git","svn_url":"https://github.com/skuater/radare2-extras","homepage":null,"size":995,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"radare:master","ref":"master","sha":"e64ef9d398506905ebccf58d48f5e19b2f0c6849","user":{"login":"radare","id":917142,"avatar_url":"https://avatars.githubusercontent.com/u/917142?v=3","gravatar_id":"","url":"https://api.github.com/users/radare","html_url":"https://github.com/radare","followers_url":"https://api.github.com/users/radare/followers","following_url":"https://api.github.com/users/radare/following{/other_user}","gists_url":"https://api.github.com/users/radare/gists{/gist_id}","starred_url":"https://api.github.com/users/radare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radare/subscriptions","organizations_url":"https://api.github.com/users/radare/orgs","repos_url":"https://api.github.com/users/radare/repos","events_url":"https://api.github.com/users/radare/events{/privacy}","received_events_url":"https://api.github.com/users/radare/received_events","type":"User","site_admin":false},"repo":{"id":5411297,"name":"radare2-extras","full_name":"radare/radare2-extras","owner":{"login":"radare","id":917142,"avatar_url":"https://avatars.githubusercontent.com/u/917142?v=3","gravatar_id":"","url":"https://api.github.com/users/radare","html_url":"https://github.com/radare","followers_url":"https://api.github.com/users/radare/followers","following_url":"https://api.github.com/users/radare/following{/other_user}","gists_url":"https://api.github.com/users/radare/gists{/gist_id}","starred_url":"https://api.github.com/users/radare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radare/subscriptions","organizations_url":"https://api.github.com/users/radare/orgs","repos_url":"https://api.github.com/users/radare/repos","events_url":"https://api.github.com/users/radare/events{/privacy}","received_events_url":"https://api.github.com/users/radare/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/radare/radare2-extras","description":"Source graveyard and random candy for radare2","fork":false,"url":"https://api.github.com/repos/radare/radare2-extras","forks_url":"https://api.github.com/repos/radare/radare2-extras/forks","keys_url":"https://api.github.com/repos/radare/radare2-extras/keys{/key_id}","collaborators_url":"https://api.github.com/repos/radare/radare2-extras/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/radare/radare2-extras/teams","hooks_url":"https://api.github.com/repos/radare/radare2-extras/hooks","issue_events_url":"https://api.github.com/repos/radare/radare2-extras/issues/events{/number}","events_url":"https://api.github.com/repos/radare/radare2-extras/events","assignees_url":"https://api.github.com/repos/radare/radare2-extras/assignees{/user}","branches_url":"https://api.github.com/repos/radare/radare2-extras/branches{/branch}","tags_url":"https://api.github.com/repos/radare/radare2-extras/tags","blobs_url":"https://api.github.com/repos/radare/radare2-extras/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/radare/radare2-extras/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/radare/radare2-extras/git/refs{/sha}","trees_url":"https://api.github.com/repos/radare/radare2-extras/git/trees{/sha}","statuses_url":"https://api.github.com/repos/radare/radare2-extras/statuses/{sha}","languages_url":"https://api.github.com/repos/radare/radare2-extras/languages","stargazers_url":"https://api.github.com/repos/radare/radare2-extras/stargazers","contributors_url":"https://api.github.com/repos/radare/radare2-extras/contributors","subscribers_url":"https://api.github.com/repos/radare/radare2-extras/subscribers","subscription_url":"https://api.github.com/repos/radare/radare2-extras/subscription","commits_url":"https://api.github.com/repos/radare/radare2-extras/commits{/sha}","git_commits_url":"https://api.github.com/repos/radare/radare2-extras/git/commits{/sha}","comments_url":"https://api.github.com/repos/radare/radare2-extras/comments{/number}","issue_comment_url":"https://api.github.com/repos/radare/radare2-extras/issues/comments{/number}","contents_url":"https://api.github.com/repos/radare/radare2-extras/contents/{+path}","compare_url":"https://api.github.com/repos/radare/radare2-extras/compare/{base}...{head}","merges_url":"https://api.github.com/repos/radare/radare2-extras/merges","archive_url":"https://api.github.com/repos/radare/radare2-extras/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/radare/radare2-extras/downloads","issues_url":"https://api.github.com/repos/radare/radare2-extras/issues{/number}","pulls_url":"https://api.github.com/repos/radare/radare2-extras/pulls{/number}","milestones_url":"https://api.github.com/repos/radare/radare2-extras/milestones{/number}","notifications_url":"https://api.github.com/repos/radare/radare2-extras/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/radare/radare2-extras/labels{/name}","releases_url":"https://api.github.com/repos/radare/radare2-extras/releases{/id}","deployments_url":"https://api.github.com/repos/radare/radare2-extras/deployments","created_at":"2012-08-14T10:22:09Z","updated_at":"2016-06-08T10:50:14Z","pushed_at":"2016-07-27T21:59:17Z","git_url":"git://github.com/radare/radare2-extras.git","ssh_url":"git@github.com:radare/radare2-extras.git","clone_url":"https://github.com/radare/radare2-extras.git","svn_url":"https://github.com/radare/radare2-extras","homepage":"http://www.radare.org/","size":7350,"stargazers_count":39,"watchers_count":39,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":25,"forks":29,"open_issues":25,"watchers":39,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/radare/radare2-extras/pulls/60"},"html":{"href":"https://github.com/radare/radare2-extras/pull/60"},"issue":{"href":"https://api.github.com/repos/radare/radare2-extras/issues/60"},"comments":{"href":"https://api.github.com/repos/radare/radare2-extras/issues/60/comments"},"review_comments":{"href":"https://api.github.com/repos/radare/radare2-extras/pulls/60/comments"},"review_comment":{"href":"https://api.github.com/repos/radare/radare2-extras/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/radare/radare2-extras/pulls/60/commits"},"statuses":{"href":"https://api.github.com/repos/radare/radare2-extras/statuses/595c0dd32a1e052650d9a537f825fe587fa2d91c"}}}}
{"actor":{"display_login":"radare"}}