{"action":"created","issue":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/6118","labels_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/6118/labels{/name}","comments_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/6118/comments","events_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/6118/events","html_url":"https://github.com/rapid7/metasploit-framework/pull/6118","id":112685569,"number":6118,"title":"Support better parsing for HTML/XML/JSON HTTP responses","user":{"login":"wchen-r7","id":1170914,"avatar_url":"https://avatars.githubusercontent.com/u/1170914?v=3","gravatar_id":"","url":"https://api.github.com/users/wchen-r7","html_url":"https://github.com/wchen-r7","followers_url":"https://api.github.com/users/wchen-r7/followers","following_url":"https://api.github.com/users/wchen-r7/following{/other_user}","gists_url":"https://api.github.com/users/wchen-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/wchen-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wchen-r7/subscriptions","organizations_url":"https://api.github.com/users/wchen-r7/orgs","repos_url":"https://api.github.com/users/wchen-r7/repos","events_url":"https://api.github.com/users/wchen-r7/events{/privacy}","received_events_url":"https://api.github.com/users/wchen-r7/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rapid7/metasploit-framework/labels/enhancement","name":"enhancement","color":"5319e7"},{"url":"https://api.github.com/repos/rapid7/metasploit-framework/labels/feature","name":"feature","color":"bfe5bf"},{"url":"https://api.github.com/repos/rapid7/metasploit-framework/labels/library","name":"library","color":"fad8c7"},{"url":"https://api.github.com/repos/rapid7/metasploit-framework/labels/tests","name":"tests","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-21T21:43:10Z","updated_at":"2015-10-26T15:58:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6118","html_url":"https://github.com/rapid7/metasploit-framework/pull/6118","diff_url":"https://github.com/rapid7/metasploit-framework/pull/6118.diff","patch_url":"https://github.com/rapid7/metasploit-framework/pull/6118.patch"},"body":"As a module writer, the new features in this pull request allow you to parse HTTP responses more properly and more precisely than just regular expressions.\r\n\r\n## Description ##\r\n\r\n**Parsing HTML**\r\n\r\nIf you need to walk through the HTML elements in order to find something specific, then instead of calling ```res.body``` and do regular expressions, you can just call ```res.get_html_document```. This will give you a Nokogiri::HTML::Document object that gives you access to the Nokogiri API.\r\n\r\n**Parsing XML**\r\n\r\nSame thing for parsing XML. Instead of calling ```res.body```, You can call ```res.get_xml_document```, and that will give you a Nokogiri::XML::Document.\r\n\r\n**Parsing JSON**\r\n\r\nAnd of course, the ```res.get_json_document``` is for the same purpose. You get a hash. Handy for REST API responses.\r\n\r\n**Other Features**\r\n\r\nI have also added other methods such as:\r\n\r\n* get_meta_elements - If you need to grab the version or whatever, you can use this.\r\n* get_html_scripts - If you have to parse the web app's JavaScript, then you can use this. Each script block is an RKelly object that allows advanced parsing, or you can just call #text and that will give you the raw JavaScript code.\r\n\r\n## Verification ##\r\n\r\n- [ ] Make sure Travis is green"},"comment":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/comments/151183535","html_url":"https://github.com/rapid7/metasploit-framework/pull/6118#issuecomment-151183535","issue_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/6118","id":151183535,"user":{"login":"wchen-r7","id":1170914,"avatar_url":"https://avatars.githubusercontent.com/u/1170914?v=3","gravatar_id":"","url":"https://api.github.com/users/wchen-r7","html_url":"https://github.com/wchen-r7","followers_url":"https://api.github.com/users/wchen-r7/followers","following_url":"https://api.github.com/users/wchen-r7/following{/other_user}","gists_url":"https://api.github.com/users/wchen-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/wchen-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wchen-r7/subscriptions","organizations_url":"https://api.github.com/users/wchen-r7/orgs","repos_url":"https://api.github.com/users/wchen-r7/repos","events_url":"https://api.github.com/users/wchen-r7/events{/privacy}","received_events_url":"https://api.github.com/users/wchen-r7/received_events","type":"User","site_admin":false},"created_at":"2015-10-26T15:58:39Z","updated_at":"2015-10-26T15:58:39Z","body":"Here's a write-up that's related to this pull request: https://github.com/rapid7/metasploit-framework/wiki/How-to-parse-an-HTTP-response"}}