{"action":"created","comment":{"url":"https://api.github.com/repos/zmap/zgrab2/pulls/comments/198283294","pull_request_review_id":132187537,"id":198283294,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5ODI4MzI5NA==","diff_hunk":"@@ -566,49 +551,60 @@ func (scanner *Scanner) newIPPScan(target *zgrab2.ScanTarget) *scan {\n \treturn &newScan\n }\n \n+// TODO: Do you want to retry with TLS for all versions? Just one's you've already tried? Haven't tried? Just the same version?\n+func (scanner *Scanner) tryGrabForVersions(target *zgrab2.ScanTarget, versions *[]version) (*scan, *zgrab2.ScanError) {\n+\tscan := scanner.newIPPScan(target)\n+\t// TODO: Implement scan.Cleanup()\n+\tvar err *zgrab2.ScanError\n+\tfor i := 0; i < len(*versions); i++ {\n+\t\terr = scanner.Grab(scan, target, &(*versions)[i])\n+\t\tif err != nil && err.Err == ErrVersionNotSupported && i < len(*versions)-1 {\n+\t\t\tcontinue\n+\t\t}\n+\t\tbreak\n+\t}\n+\treturn scan, err\n+}\n+\n+// TODO: Incorporate status into this? I don't think so, b/c with certain statuses, we should return\n+// early, so special casing seems to make sense\n+func (scan *scan) shouldReportResult(scanner *Scanner) bool {\n+\tif scan.results.Response != nil {\n+\t\treturn true\n+\t} else if scanner.config.IPPSecure {\n+\t\tl := scan.results.TLSLog\n+\t\treturn l != nil && l.HandshakeLog != nil && l.HandshakeLog.ServerHello != nil\n+\t}\n+\treturn false\n+}\n+\n // Scan TODO: describe how scan operates in appropriate detail\n //1. Send a request (currently get-printer-attributes)\n //2. Take in that response & read out version numbers\n func (scanner *Scanner) Scan(target zgrab2.ScanTarget) (zgrab2.ScanStatus, interface{}, error) {\n-\tscan := scanner.newIPPScan(&target)\n-\t//defer scan.Cleanup()\n-\tvar err *zgrab2.ScanError\n-\t// Try all known IPP versions from newest to oldest until version is supported\n-\tfor i := 0; i < len(Versions); i++ {\n-\t\terr = scanner.Grab(scan, &target, &Versions[i])\n-\t\tif err == nil || (err != nil && err.Err != ErrVersionNotSupported) {\n-\t\t\tbreak\n-\t\t}\n-\t\tif i == len(Versions) - 1 && err.Err == ErrVersionNotSupported {\n-\t\t\treturn zgrab2.SCAN_APPLICATION_ERROR, &scan.results, err.Err\n-\t\t}\n-\t}\n+\t// Try all known IPP versions from newest to oldest until we reach a supported version\n+\tscan, err := scanner.tryGrabForVersions(&target, &Versions)\n \tif err != nil {\n-\t\t// Adapted from http module's RetryHTTPS logic\n+\t\t// If versionNotSupported error was confirmed, the scanner was connecting w/o TLS, so don't retry\n+\t\t// Same goes for a protocol error of any kind. It means we got something back but it didn't conform.\n+\t\tif err.Status == zgrab2.SCAN_APPLICATION_ERROR || err.Status == zgrab2.SCAN_PROTOCOL_ERROR {\n+\t\t\treturn err.Unpack(&scan.results)","path":"modules/ipp/scanner.go","position":378,"original_position":378,"commit_id":"a68cd0047fdb2667768e0db6b5cd8112a48e189c","original_commit_id":"a68cd0047fdb2667768e0db6b5cd8112a48e189c","user":{"login":"justinbastress","id":33579608,"node_id":"MDQ6VXNlcjMzNTc5NjA4","avatar_url":"https://avatars0.githubusercontent.com/u/33579608?v=4","gravatar_id":"","url":"https://api.github.com/users/justinbastress","html_url":"https://github.com/justinbastress","followers_url":"https://api.github.com/users/justinbastress/followers","following_url":"https://api.github.com/users/justinbastress/following{/other_user}","gists_url":"https://api.github.com/users/justinbastress/gists{/gist_id}","starred_url":"https://api.github.com/users/justinbastress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinbastress/subscriptions","organizations_url":"https://api.github.com/users/justinbastress/orgs","repos_url":"https://api.github.com/users/justinbastress/repos","events_url":"https://api.github.com/users/justinbastress/events{/privacy}","received_events_url":"https://api.github.com/users/justinbastress/received_events","type":"User","site_admin":false},"body":"It looks like this will always return a non-nil result (so always indicating a detection in these cases) -- is that the intent? Since `scan.results` is (IIRC) a `ScanResults` and not a `*ScanResults`, its default/not-yet-set value will be `{}`, not `nil`.\r\n\r\n","created_at":"2018-06-26T20:18:16Z","updated_at":"2018-06-26T20:18:16Z","html_url":"https://github.com/zmap/zgrab2/pull/140#discussion_r198283294","pull_request_url":"https://api.github.com/repos/zmap/zgrab2/pulls/140","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/zmap/zgrab2/pulls/comments/198283294"},"html":{"href":"https://github.com/zmap/zgrab2/pull/140#discussion_r198283294"},"pull_request":{"href":"https://api.github.com/repos/zmap/zgrab2/pulls/140"}}},"pull_request":{"url":"https://api.github.com/repos/zmap/zgrab2/pulls/140","id":197493928,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3NDkzOTI4","html_url":"https://github.com/zmap/zgrab2/pull/140","diff_url":"https://github.com/zmap/zgrab2/pull/140.diff","patch_url":"https://github.com/zmap/zgrab2/pull/140.patch","issue_url":"https://api.github.com/repos/zmap/zgrab2/issues/140","number":140,"state":"open","locked":false,"title":"(IPP) improve scan output","user":{"login":"clayzim","id":15946582,"node_id":"MDQ6VXNlcjE1OTQ2NTgy","avatar_url":"https://avatars2.githubusercontent.com/u/15946582?v=4","gravatar_id":"","url":"https://api.github.com/users/clayzim","html_url":"https://github.com/clayzim","followers_url":"https://api.github.com/users/clayzim/followers","following_url":"https://api.github.com/users/clayzim/following{/other_user}","gists_url":"https://api.github.com/users/clayzim/gists{/gist_id}","starred_url":"https://api.github.com/users/clayzim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clayzim/subscriptions","organizations_url":"https://api.github.com/users/clayzim/orgs","repos_url":"https://api.github.com/users/clayzim/repos","events_url":"https://api.github.com/users/clayzim/events{/privacy}","received_events_url":"https://api.github.com/users/clayzim/received_events","type":"User","site_admin":false},"body":"Correctly determines whether to include ScanResults object in output json.\r\nRejects successful responses which are identifiable as non-IPP.\r\nReduces code duplication by refactoring several re-usable segments into independent functions.\r\nGreatly simplifies IPP zgrab2 schema by depending upon HTTP zgrab2 schema.\r\n\r\n## How to Test\r\n\r\n`make integration-test`\r\n\r\n## Notes & Caveats\r\n\r\nFuture Work:\r\nCould use further refactoring.\r\nAdd support for Upgrade to HTTPS.\r\n\r\n## Issue Tracking\r\n\r\nN/A\r\n","created_at":"2018-06-26T17:14:13Z","updated_at":"2018-06-26T20:18:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e885eafb5d253169fc739c6aa0bc6f9142643601","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/zmap/zgrab2/pulls/140/commits","review_comments_url":"https://api.github.com/repos/zmap/zgrab2/pulls/140/comments","review_comment_url":"https://api.github.com/repos/zmap/zgrab2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zmap/zgrab2/issues/140/comments","statuses_url":"https://api.github.com/repos/zmap/zgrab2/statuses/a68cd0047fdb2667768e0db6b5cd8112a48e189c","head":{"label":"zmap:feature/ipp-improve-scan-output","ref":"feature/ipp-improve-scan-output","sha":"a68cd0047fdb2667768e0db6b5cd8112a48e189c","user":{"login":"zmap","id":3345672,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzNDU2NzI=","avatar_url":"https://avatars3.githubusercontent.com/u/3345672?v=4","gravatar_id":"","url":"https://api.github.com/users/zmap","html_url":"https://github.com/zmap","followers_url":"https://api.github.com/users/zmap/followers","following_url":"https://api.github.com/users/zmap/following{/other_user}","gists_url":"https://api.github.com/users/zmap/gists{/gist_id}","starred_url":"https://api.github.com/users/zmap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmap/subscriptions","organizations_url":"https://api.github.com/users/zmap/orgs","repos_url":"https://api.github.com/users/zmap/repos","events_url":"https://api.github.com/users/zmap/events{/privacy}","received_events_url":"https://api.github.com/users/zmap/received_events","type":"Organization","site_admin":false},"repo":{"id":66118002,"node_id":"MDEwOlJlcG9zaXRvcnk2NjExODAwMg==","name":"zgrab2","full_name":"zmap/zgrab2","owner":{"login":"zmap","id":3345672,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzNDU2NzI=","avatar_url":"https://avatars3.githubusercontent.com/u/3345672?v=4","gravatar_id":"","url":"https://api.github.com/users/zmap","html_url":"https://github.com/zmap","followers_url":"https://api.github.com/users/zmap/followers","following_url":"https://api.github.com/users/zmap/following{/other_user}","gists_url":"https://api.github.com/users/zmap/gists{/gist_id}","starred_url":"https://api.github.com/users/zmap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmap/subscriptions","organizations_url":"https://api.github.com/users/zmap/orgs","repos_url":"https://api.github.com/users/zmap/repos","events_url":"https://api.github.com/users/zmap/events{/privacy}","received_events_url":"https://api.github.com/users/zmap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zmap/zgrab2","description":"ZGrab 2.0 Framework ","fork":false,"url":"https://api.github.com/repos/zmap/zgrab2","forks_url":"https://api.github.com/repos/zmap/zgrab2/forks","keys_url":"https://api.github.com/repos/zmap/zgrab2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zmap/zgrab2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zmap/zgrab2/teams","hooks_url":"https://api.github.com/repos/zmap/zgrab2/hooks","issue_events_url":"https://api.github.com/repos/zmap/zgrab2/issues/events{/number}","events_url":"https://api.github.com/repos/zmap/zgrab2/events","assignees_url":"https://api.github.com/repos/zmap/zgrab2/assignees{/user}","branches_url":"https://api.github.com/repos/zmap/zgrab2/branches{/branch}","tags_url":"https://api.github.com/repos/zmap/zgrab2/tags","blobs_url":"https://api.github.com/repos/zmap/zgrab2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zmap/zgrab2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zmap/zgrab2/git/refs{/sha}","trees_url":"https://api.github.com/repos/zmap/zgrab2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zmap/zgrab2/statuses/{sha}","languages_url":"https://api.github.com/repos/zmap/zgrab2/languages","stargazers_url":"https://api.github.com/repos/zmap/zgrab2/stargazers","contributors_url":"https://api.github.com/repos/zmap/zgrab2/contributors","subscribers_url":"https://api.github.com/repos/zmap/zgrab2/subscribers","subscription_url":"https://api.github.com/repos/zmap/zgrab2/subscription","commits_url":"https://api.github.com/repos/zmap/zgrab2/commits{/sha}","git_commits_url":"https://api.github.com/repos/zmap/zgrab2/git/commits{/sha}","comments_url":"https://api.github.com/repos/zmap/zgrab2/comments{/number}","issue_comment_url":"https://api.github.com/repos/zmap/zgrab2/issues/comments{/number}","contents_url":"https://api.github.com/repos/zmap/zgrab2/contents/{+path}","compare_url":"https://api.github.com/repos/zmap/zgrab2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zmap/zgrab2/merges","archive_url":"https://api.github.com/repos/zmap/zgrab2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zmap/zgrab2/downloads","issues_url":"https://api.github.com/repos/zmap/zgrab2/issues{/number}","pulls_url":"https://api.github.com/repos/zmap/zgrab2/pulls{/number}","milestones_url":"https://api.github.com/repos/zmap/zgrab2/milestones{/number}","notifications_url":"https://api.github.com/repos/zmap/zgrab2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zmap/zgrab2/labels{/name}","releases_url":"https://api.github.com/repos/zmap/zgrab2/releases{/id}","deployments_url":"https://api.github.com/repos/zmap/zgrab2/deployments","created_at":"2016-08-19T23:22:02Z","updated_at":"2018-06-26T16:00:30Z","pushed_at":"2018-06-26T19:03:09Z","git_url":"git://github.com/zmap/zgrab2.git","ssh_url":"git@github.com:zmap/zgrab2.git","clone_url":"https://github.com/zmap/zgrab2.git","svn_url":"https://github.com/zmap/zgrab2","homepage":"","size":2333,"stargazers_count":24,"watchers_count":24,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":29,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":9,"open_issues":29,"watchers":24,"default_branch":"master"}},"base":{"label":"zmap:master","ref":"master","sha":"9b00db7f29af922e92af38f145a270f1186bfd95","user":{"login":"zmap","id":3345672,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzNDU2NzI=","avatar_url":"https://avatars3.githubusercontent.com/u/3345672?v=4","gravatar_id":"","url":"https://api.github.com/users/zmap","html_url":"https://github.com/zmap","followers_url":"https://api.github.com/users/zmap/followers","following_url":"https://api.github.com/users/zmap/following{/other_user}","gists_url":"https://api.github.com/users/zmap/gists{/gist_id}","starred_url":"https://api.github.com/users/zmap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmap/subscriptions","organizations_url":"https://api.github.com/users/zmap/orgs","repos_url":"https://api.github.com/users/zmap/repos","events_url":"https://api.github.com/users/zmap/events{/privacy}","received_events_url":"https://api.github.com/users/zmap/received_events","type":"Organization","site_admin":false},"repo":{"id":66118002,"node_id":"MDEwOlJlcG9zaXRvcnk2NjExODAwMg==","name":"zgrab2","full_name":"zmap/zgrab2","owner":{"login":"zmap","id":3345672,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzNDU2NzI=","avatar_url":"https://avatars3.githubusercontent.com/u/3345672?v=4","gravatar_id":"","url":"https://api.github.com/users/zmap","html_url":"https://github.com/zmap","followers_url":"https://api.github.com/users/zmap/followers","following_url":"https://api.github.com/users/zmap/following{/other_user}","gists_url":"https://api.github.com/users/zmap/gists{/gist_id}","starred_url":"https://api.github.com/users/zmap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmap/subscriptions","organizations_url":"https://api.github.com/users/zmap/orgs","repos_url":"https://api.github.com/users/zmap/repos","events_url":"https://api.github.com/users/zmap/events{/privacy}","received_events_url":"https://api.github.com/users/zmap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zmap/zgrab2","description":"ZGrab 2.0 Framework ","fork":false,"url":"https://api.github.com/repos/zmap/zgrab2","forks_url":"https://api.github.com/repos/zmap/zgrab2/forks","keys_url":"https://api.github.com/repos/zmap/zgrab2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zmap/zgrab2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zmap/zgrab2/teams","hooks_url":"https://api.github.com/repos/zmap/zgrab2/hooks","issue_events_url":"https://api.github.com/repos/zmap/zgrab2/issues/events{/number}","events_url":"https://api.github.com/repos/zmap/zgrab2/events","assignees_url":"https://api.github.com/repos/zmap/zgrab2/assignees{/user}","branches_url":"https://api.github.com/repos/zmap/zgrab2/branches{/branch}","tags_url":"https://api.github.com/repos/zmap/zgrab2/tags","blobs_url":"https://api.github.com/repos/zmap/zgrab2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zmap/zgrab2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zmap/zgrab2/git/refs{/sha}","trees_url":"https://api.github.com/repos/zmap/zgrab2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zmap/zgrab2/statuses/{sha}","languages_url":"https://api.github.com/repos/zmap/zgrab2/languages","stargazers_url":"https://api.github.com/repos/zmap/zgrab2/stargazers","contributors_url":"https://api.github.com/repos/zmap/zgrab2/contributors","subscribers_url":"https://api.github.com/repos/zmap/zgrab2/subscribers","subscription_url":"https://api.github.com/repos/zmap/zgrab2/subscription","commits_url":"https://api.github.com/repos/zmap/zgrab2/commits{/sha}","git_commits_url":"https://api.github.com/repos/zmap/zgrab2/git/commits{/sha}","comments_url":"https://api.github.com/repos/zmap/zgrab2/comments{/number}","issue_comment_url":"https://api.github.com/repos/zmap/zgrab2/issues/comments{/number}","contents_url":"https://api.github.com/repos/zmap/zgrab2/contents/{+path}","compare_url":"https://api.github.com/repos/zmap/zgrab2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zmap/zgrab2/merges","archive_url":"https://api.github.com/repos/zmap/zgrab2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zmap/zgrab2/downloads","issues_url":"https://api.github.com/repos/zmap/zgrab2/issues{/number}","pulls_url":"https://api.github.com/repos/zmap/zgrab2/pulls{/number}","milestones_url":"https://api.github.com/repos/zmap/zgrab2/milestones{/number}","notifications_url":"https://api.github.com/repos/zmap/zgrab2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zmap/zgrab2/labels{/name}","releases_url":"https://api.github.com/repos/zmap/zgrab2/releases{/id}","deployments_url":"https://api.github.com/repos/zmap/zgrab2/deployments","created_at":"2016-08-19T23:22:02Z","updated_at":"2018-06-26T16:00:30Z","pushed_at":"2018-06-26T19:03:09Z","git_url":"git://github.com/zmap/zgrab2.git","ssh_url":"git@github.com:zmap/zgrab2.git","clone_url":"https://github.com/zmap/zgrab2.git","svn_url":"https://github.com/zmap/zgrab2","homepage":"","size":2333,"stargazers_count":24,"watchers_count":24,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":29,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":9,"open_issues":29,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zmap/zgrab2/pulls/140"},"html":{"href":"https://github.com/zmap/zgrab2/pull/140"},"issue":{"href":"https://api.github.com/repos/zmap/zgrab2/issues/140"},"comments":{"href":"https://api.github.com/repos/zmap/zgrab2/issues/140/comments"},"review_comments":{"href":"https://api.github.com/repos/zmap/zgrab2/pulls/140/comments"},"review_comment":{"href":"https://api.github.com/repos/zmap/zgrab2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zmap/zgrab2/pulls/140/commits"},"statuses":{"href":"https://api.github.com/repos/zmap/zgrab2/statuses/a68cd0047fdb2667768e0db6b5cd8112a48e189c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"justinbastress"}}