{"action":"closed","issue":{"url":"https://api.github.com/repos/cea-sec/ivre/issues/274","repository_url":"https://api.github.com/repos/cea-sec/ivre","labels_url":"https://api.github.com/repos/cea-sec/ivre/issues/274/labels{/name}","comments_url":"https://api.github.com/repos/cea-sec/ivre/issues/274/comments","events_url":"https://api.github.com/repos/cea-sec/ivre/issues/274/events","html_url":"https://github.com/cea-sec/ivre/issues/274","id":169085475,"number":274,"title":"scancli: use of --limit, --skip and --short are mutually exclusive","user":{"login":"gelim","id":179122,"avatar_url":"https://avatars.githubusercontent.com/u/179122?v=3","gravatar_id":"","url":"https://api.github.com/users/gelim","html_url":"https://github.com/gelim","followers_url":"https://api.github.com/users/gelim/followers","following_url":"https://api.github.com/users/gelim/following{/other_user}","gists_url":"https://api.github.com/users/gelim/gists{/gist_id}","starred_url":"https://api.github.com/users/gelim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gelim/subscriptions","organizations_url":"https://api.github.com/users/gelim/orgs","repos_url":"https://api.github.com/users/gelim/repos","events_url":"https://api.github.com/users/gelim/events{/privacy}","received_events_url":"https://api.github.com/users/gelim/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cea-sec/ivre/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"p-l-","id":5064814,"avatar_url":"https://avatars.githubusercontent.com/u/5064814?v=3","gravatar_id":"","url":"https://api.github.com/users/p-l-","html_url":"https://github.com/p-l-","followers_url":"https://api.github.com/users/p-l-/followers","following_url":"https://api.github.com/users/p-l-/following{/other_user}","gists_url":"https://api.github.com/users/p-l-/gists{/gist_id}","starred_url":"https://api.github.com/users/p-l-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/p-l-/subscriptions","organizations_url":"https://api.github.com/users/p-l-/orgs","repos_url":"https://api.github.com/users/p-l-/repos","events_url":"https://api.github.com/users/p-l-/events{/privacy}","received_events_url":"https://api.github.com/users/p-l-/received_events","type":"User","site_admin":false},"assignees":[{"login":"p-l-","id":5064814,"avatar_url":"https://avatars.githubusercontent.com/u/5064814?v=3","gravatar_id":"","url":"https://api.github.com/users/p-l-","html_url":"https://github.com/p-l-","followers_url":"https://api.github.com/users/p-l-/followers","following_url":"https://api.github.com/users/p-l-/following{/other_user}","gists_url":"https://api.github.com/users/p-l-/gists{/gist_id}","starred_url":"https://api.github.com/users/p-l-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/p-l-/subscriptions","organizations_url":"https://api.github.com/users/p-l-/orgs","repos_url":"https://api.github.com/users/p-l-/repos","events_url":"https://api.github.com/users/p-l-/events{/privacy}","received_events_url":"https://api.github.com/users/p-l-/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2016-08-03T09:19:36Z","updated_at":"2016-08-04T15:14:26Z","closed_at":"2016-08-04T15:14:26Z","body":"Hi,\r\n\r\nThere is an use case with `scancli` when you want to extract an IP subset of your dataset, so you may want to use `--limit` combined with `--short`.\r\nIn this case result is unattended: you receive the whole IP list of your dataset.\r\n\r\nBy looking at the code, you use the `distinct()` method that is ignoring the `limit()` set previously on the db cursor.\r\n\r\nIn order to get the expected behavior I changed the code like this:\r\n\r\n```\r\ndiff --git a/ivre/tools/scancli.py b/ivre/tools/scancli.py\r\nindex 6b82493..90ae0a7 100644\r\n--- a/ivre/tools/scancli.py\r\n+++ b/ivre/tools/scancli.py\r\n@@ -531,11 +531,11 @@ def main():\r\n                                  default=db.db.nmap.serialize)\r\n     elif args.short:\r\n         def displayfunction(x):\r\n-            for h in x.distinct('addr'):\r\n+            for h in x:\r\n                 try:\r\n-                    out.write(utils.int2ip(h) + '\\n')\r\n+                    out.write(utils.int2ip(h['addr']) + '\\n')\r\n                 except:\r\n-                    out.write(str(h) + '\\n')\r\n+                    out.write(str(h['addr']) + '\\n')\r\n     elif args.honeyd:\r\n         def displayfunction(x):\r\n             display_honeyd_preamble(out)\r\n```\r\n\r\nThat modification is still not satisfying me because of the  performance impact.\r\nI have ~40k entries, and got 0.4sec vs. 1.4sec (original code, patched code) by doing a simple `ivre scancli --short`...\r\n\r\nCheers dans la casa"}}
{"actor":{"display_login":"commial"}}