{"action":"created","issue":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5543","labels_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5543/labels{/name}","comments_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5543/comments","events_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5543/events","html_url":"https://github.com/rapid7/metasploit-framework/pull/5543","id":88593692,"number":5543,"title":"Implement transport remove","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},"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/library","name":"library","color":"fad8c7"},{"url":"https://api.github.com/repos/rapid7/metasploit-framework/labels/meterpreter","name":"meterpreter","color":"5319e7"}],"state":"closed","locked":false,"assignee":{"login":"bcook-r7","id":10031469,"avatar_url":"https://avatars.githubusercontent.com/u/10031469?v=3","gravatar_id":"","url":"https://api.github.com/users/bcook-r7","html_url":"https://github.com/bcook-r7","followers_url":"https://api.github.com/users/bcook-r7/followers","following_url":"https://api.github.com/users/bcook-r7/following{/other_user}","gists_url":"https://api.github.com/users/bcook-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/bcook-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcook-r7/subscriptions","organizations_url":"https://api.github.com/users/bcook-r7/orgs","repos_url":"https://api.github.com/users/bcook-r7/repos","events_url":"https://api.github.com/users/bcook-r7/events{/privacy}","received_events_url":"https://api.github.com/users/bcook-r7/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2015-06-16T02:27:42Z","updated_at":"2015-06-22T22:07:54Z","closed_at":"2015-06-22T22:00:19Z","pull_request":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/5543","html_url":"https://github.com/rapid7/metasploit-framework/pull/5543","diff_url":"https://github.com/rapid7/metasploit-framework/pull/5543.diff","patch_url":"https://github.com/rapid7/metasploit-framework/pull/5543.patch"},"body":"This PR adds support for transport removal using the `transport remove` command. The user can now add and remove transports on the fly, which is very helpful in the case of sleeping shells or shells that contain transports that callback on staged TCP listeners, resulting in metsrv being sent unnecessarily down the wire.\r\n\r\nRemoval of transports has the same interface as the addition as far as the `-l` `-p` and `-t` parameters go, this is so that things are consistent with the rest of the interface.\r\n\r\nIt is not possible to remove the currently active transport. This might come as a feature later on, but for now I felt it wasn't worth the extra accounting. If you want to remove a transport, you have to change transports first.\r\n\r\nThis PR requires Meterpreter changes, which can be found here: https://github.com/rapid7/meterpreter/pull/170\r\n\r\n## Sample run\r\n\r\n```\r\nmsf exploit(handler) > [*] Sending stage (1129522 bytes) to 172.16.52.1\r\n[*] Meterpreter session 1 opened (172.16.52.1:6000 -> 172.16.52.1:53110) at 2015-06-16 11:53:57 +1000\r\nWARNING: Local file /Users/oj/code/metasploit-framework/data/meterpreter/ext_server_stdapi.x64.dll is being used\r\nWARNING: Local file /Users/oj/code/metasploit-framework/data/meterpreter/ext_server_priv.x64.dll is being used\r\n\r\nmsf exploit(handler) > sessions -i 1\r\n[*] Starting interaction with 1...\r\n\r\nmeterpreter > transport list\r\nSession Expiry  : @ 2015-06-23 11:53:56\r\n\r\n    Curr  URL                     Comms T/O  Retry Total  Retry Wait\r\n    ----  ---                     ---------  -----------  ----------\r\n    *     tcp://172.16.52.1:6000  300        3600         10\r\n\r\nmeterpreter > transport add -t reverse_tcp -l 172.16.52.1 -p 6005\r\n[*] Adding new transport ...\r\n[+] Successfully added reverse_tcp transport.\r\nmeterpreter > transport list\r\nSession Expiry  : @ 2015-06-23 11:53:56\r\n\r\n    Curr  URL                     Comms T/O  Retry Total  Retry Wait\r\n    ----  ---                     ---------  -----------  ----------\r\n    *     tcp://172.16.52.1:6000  300        3600         10\r\n          tcp://172.16.52.1:6005  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.255.164 - Meterpreter session 1 closed.  Reason: User exit\r\nmsf exploit(handler) > [*] Meterpreter session 2 opened (172.16.52.1:6005 -> 172.16.52.1:53129) at 2015-06-16 11:55:43 +1000\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-06-23 11:53:56\r\n\r\n    Curr  URL                     Comms T/O  Retry Total  Retry Wait\r\n    ----  ---                     ---------  -----------  ----------\r\n    *     tcp://172.16.52.1:6005  300        3600         10\r\n          tcp://172.16.52.1:6000  300        3600         10\r\n\r\nmeterpreter > transport remove -t reverse_tcp -l 172.16.52.1 -p 6000\r\n[*] Removing transport ...\r\n[+] Successfully removed reverse_tcp transport.\r\nmeterpreter > transport list\r\nSession Expiry  : @ 2015-06-23 11:53:56\r\n\r\n    Curr  URL                     Comms T/O  Retry Total  Retry Wait\r\n    ----  ---                     ---------  -----------  ----------\r\n    *     tcp://172.16.52.1:6005  300        3600         10\r\n\r\nmeterpreter >\r\n```\r\n\r\n## Verification\r\n\r\n- [x] Launch a meterpreter session.\r\n- [x] Add 2 or more transports\r\n- [x] Make sure they're in the transport list\r\n- [x] delete one of the new ones, make sure it's deleted by looking at the transport list\r\n- [x] change to one of the new transports\r\n- [x] delete the original transport\r\n\r\nIt should all work as expected on both Windows and Posix."},"comment":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/comments/114281778","html_url":"https://github.com/rapid7/metasploit-framework/pull/5543#issuecomment-114281778","issue_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5543","id":114281778,"user":{"login":"bcook-r7","id":10031469,"avatar_url":"https://avatars.githubusercontent.com/u/10031469?v=3","gravatar_id":"","url":"https://api.github.com/users/bcook-r7","html_url":"https://github.com/bcook-r7","followers_url":"https://api.github.com/users/bcook-r7/followers","following_url":"https://api.github.com/users/bcook-r7/following{/other_user}","gists_url":"https://api.github.com/users/bcook-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/bcook-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcook-r7/subscriptions","organizations_url":"https://api.github.com/users/bcook-r7/orgs","repos_url":"https://api.github.com/users/bcook-r7/repos","events_url":"https://api.github.com/users/bcook-r7/events{/privacy}","received_events_url":"https://api.github.com/users/bcook-r7/received_events","type":"User","site_admin":false},"created_at":"2015-06-22T22:07:54Z","updated_at":"2015-06-22T22:07:54Z","body":"I need to just add ./tools/update_payload_cached_sizes.rb to msftidy :P"}}