{"action":"created","comment":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/comments/46736817","id":46736817,"diff_hunk":"@@ -840,31 +842,39 @@ def cmd_migrate_help\n   #   platforms a path for the unix domain socket used for IPC.\n   # @return [void]\n   def cmd_migrate(*args)\n-    if args.length == 0 || args.include?('-h')\n+    if args.length == 0 || args.any? { |arg| %w(-h --pid --name).include? arg }\n       cmd_migrate_help\n       return true\n     end\n \n-    pid = args[0].to_i\n-    if pid == 0\n-      print_error('A process ID must be specified, not a process name')\n-      return\n-    end\n-\n+    pid = nil\n     writable_dir = nil\n     opts = {\n       timeout: nil\n     }\n \n-    @@transport_opts.parse(args) do |opt, idx, val|","path":"lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb","position":43,"original_position":43,"commit_id":"3ecac615a2843d55e8e27ce9d99eab185e4f69f7","original_commit_id":"3ecac615a2843d55e8e27ce9d99eab185e4f69f7","user":{"login":"jhart-r7","id":3869433,"avatar_url":"https://avatars.githubusercontent.com/u/3869433?v=3","gravatar_id":"","url":"https://api.github.com/users/jhart-r7","html_url":"https://github.com/jhart-r7","followers_url":"https://api.github.com/users/jhart-r7/followers","following_url":"https://api.github.com/users/jhart-r7/following{/other_user}","gists_url":"https://api.github.com/users/jhart-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/jhart-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhart-r7/subscriptions","organizations_url":"https://api.github.com/users/jhart-r7/orgs","repos_url":"https://api.github.com/users/jhart-r7/repos","events_url":"https://api.github.com/users/jhart-r7/events{/privacy}","received_events_url":"https://api.github.com/users/jhart-r7/received_events","type":"User","site_admin":false},"body":"This was a bit of a bug but fortunately it didn't show itself -- the options for transport are a superset of those for migrate, so even though we were parsing options for `migrate` using the parser for `transport` it didn't matter.","created_at":"2015-12-04T21:52:01Z","updated_at":"2015-12-04T21:52:01Z","html_url":"https://github.com/rapid7/metasploit-framework/pull/6315#discussion_r46736817","pull_request_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6315","_links":{"self":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/comments/46736817"},"html":{"href":"https://github.com/rapid7/metasploit-framework/pull/6315#discussion_r46736817"},"pull_request":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6315"}}},"pull_request":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6315","id":52724462,"html_url":"https://github.com/rapid7/metasploit-framework/pull/6315","diff_url":"https://github.com/rapid7/metasploit-framework/pull/6315.diff","patch_url":"https://github.com/rapid7/metasploit-framework/pull/6315.patch","issue_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/6315","number":6315,"state":"open","locked":false,"title":"Support migrating to processes by process name","user":{"login":"jhart-r7","id":3869433,"avatar_url":"https://avatars.githubusercontent.com/u/3869433?v=3","gravatar_id":"","url":"https://api.github.com/users/jhart-r7","html_url":"https://github.com/jhart-r7","followers_url":"https://api.github.com/users/jhart-r7/followers","following_url":"https://api.github.com/users/jhart-r7/following{/other_user}","gists_url":"https://api.github.com/users/jhart-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/jhart-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhart-r7/subscriptions","organizations_url":"https://api.github.com/users/jhart-r7/orgs","repos_url":"https://api.github.com/users/jhart-r7/repos","events_url":"https://api.github.com/users/jhart-r7/events{/privacy}","received_events_url":"https://api.github.com/users/jhart-r7/received_events","type":"User","site_admin":false},"body":"Fixes #6313, assuming there isn't already a better way of doing this.\r\n\r\nExisting functionality remains unchanged, but you can now pass a PID or process name as an explicit, named argument.  If you pass the PID as a named argument, it functions as if you just specified the PID alone (IOW, `migrate 12345` == `migrate -P 12345`), but if you pass a process name, it finds the PID of that process and migrates to it:\r\n\r\n```\r\nmeterpreter > migrate -N vmtoolsd.exe\r\n[*] Migrating from 2480 to 1576...\r\n[*] Migration completed successfully.\r\n```","created_at":"2015-12-04T21:35:25Z","updated_at":"2015-12-04T21:52:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2fc82b5025ca0c0b0d62947ec23bcc12b2dfa15e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6315/commits","review_comments_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6315/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/6315/comments","statuses_url":"https://api.github.com/repos/rapid7/metasploit-framework/statuses/3ecac615a2843d55e8e27ce9d99eab185e4f69f7","head":{"label":"jhart-r7:feature/6313-migrate-name","ref":"feature/6313-migrate-name","sha":"3ecac615a2843d55e8e27ce9d99eab185e4f69f7","user":{"login":"jhart-r7","id":3869433,"avatar_url":"https://avatars.githubusercontent.com/u/3869433?v=3","gravatar_id":"","url":"https://api.github.com/users/jhart-r7","html_url":"https://github.com/jhart-r7","followers_url":"https://api.github.com/users/jhart-r7/followers","following_url":"https://api.github.com/users/jhart-r7/following{/other_user}","gists_url":"https://api.github.com/users/jhart-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/jhart-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhart-r7/subscriptions","organizations_url":"https://api.github.com/users/jhart-r7/orgs","repos_url":"https://api.github.com/users/jhart-r7/repos","events_url":"https://api.github.com/users/jhart-r7/events{/privacy}","received_events_url":"https://api.github.com/users/jhart-r7/received_events","type":"User","site_admin":false},"repo":{"id":9270398,"name":"metasploit-framework","full_name":"jhart-r7/metasploit-framework","owner":{"login":"jhart-r7","id":3869433,"avatar_url":"https://avatars.githubusercontent.com/u/3869433?v=3","gravatar_id":"","url":"https://api.github.com/users/jhart-r7","html_url":"https://github.com/jhart-r7","followers_url":"https://api.github.com/users/jhart-r7/followers","following_url":"https://api.github.com/users/jhart-r7/following{/other_user}","gists_url":"https://api.github.com/users/jhart-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/jhart-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhart-r7/subscriptions","organizations_url":"https://api.github.com/users/jhart-r7/orgs","repos_url":"https://api.github.com/users/jhart-r7/repos","events_url":"https://api.github.com/users/jhart-r7/events{/privacy}","received_events_url":"https://api.github.com/users/jhart-r7/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jhart-r7/metasploit-framework","description":"Metasploit Framework","fork":true,"url":"https://api.github.com/repos/jhart-r7/metasploit-framework","forks_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/forks","keys_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/teams","hooks_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/hooks","issue_events_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/issues/events{/number}","events_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/events","assignees_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/assignees{/user}","branches_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/branches{/branch}","tags_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/tags","blobs_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/languages","stargazers_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/stargazers","contributors_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/contributors","subscribers_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/subscribers","subscription_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/subscription","commits_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/contents/{+path}","compare_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/merges","archive_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/downloads","issues_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/issues{/number}","pulls_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/labels{/name}","releases_url":"https://api.github.com/repos/jhart-r7/metasploit-framework/releases{/id}","created_at":"2013-04-07T02:59:51Z","updated_at":"2014-12-19T01:21:47Z","pushed_at":"2015-12-04T21:33:14Z","git_url":"git://github.com/jhart-r7/metasploit-framework.git","ssh_url":"git@github.com:jhart-r7/metasploit-framework.git","clone_url":"https://github.com/jhart-r7/metasploit-framework.git","svn_url":"https://github.com/jhart-r7/metasploit-framework","homepage":"http://www.metasploit.com/","size":326331,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rapid7:master","ref":"master","sha":"340fe5640f6a45572cb5ffbedd34d935f118a799","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-12-04T13:32:42Z","pushed_at":"2015-12-04T21:35:26Z","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":452735,"stargazers_count":4893,"watchers_count":4893,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3581,"mirror_url":null,"open_issues_count":241,"forks":3581,"open_issues":241,"watchers":4893,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6315"},"html":{"href":"https://github.com/rapid7/metasploit-framework/pull/6315"},"issue":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/issues/6315"},"comments":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/issues/6315/comments"},"review_comments":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6315/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/6315/commits"},"statuses":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/statuses/3ecac615a2843d55e8e27ce9d99eab185e4f69f7"}}}}