{"action":"created","issue":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/4810","labels_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/4810/labels{/name}","comments_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/4810/comments","events_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/4810/events","html_url":"https://github.com/rapid7/metasploit-framework/pull/4810","id":58439235,"number":4810,"title":"Fix #3827, Add support to rename a job","user":{"login":"wchen-r7","id":1170914,"avatar_url":"https://avatars.githubusercontent.com/u/1170914?v=3","gravatar_id":"","url":"https://api.github.com/users/wchen-r7","html_url":"https://github.com/wchen-r7","followers_url":"https://api.github.com/users/wchen-r7/followers","following_url":"https://api.github.com/users/wchen-r7/following{/other_user}","gists_url":"https://api.github.com/users/wchen-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/wchen-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wchen-r7/subscriptions","organizations_url":"https://api.github.com/users/wchen-r7/orgs","repos_url":"https://api.github.com/users/wchen-r7/repos","events_url":"https://api.github.com/users/wchen-r7/events{/privacy}","received_events_url":"https://api.github.com/users/wchen-r7/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rapid7/metasploit-framework/labels/feature","name":"feature","color":"bfe5bf"},{"url":"https://api.github.com/repos/rapid7/metasploit-framework/labels/misc","name":"misc","color":"bfdadc"}],"state":"open","locked":false,"assignee":{"login":"wvu-r7","id":4551878,"avatar_url":"https://avatars.githubusercontent.com/u/4551878?v=3","gravatar_id":"","url":"https://api.github.com/users/wvu-r7","html_url":"https://github.com/wvu-r7","followers_url":"https://api.github.com/users/wvu-r7/followers","following_url":"https://api.github.com/users/wvu-r7/following{/other_user}","gists_url":"https://api.github.com/users/wvu-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/wvu-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wvu-r7/subscriptions","organizations_url":"https://api.github.com/users/wvu-r7/orgs","repos_url":"https://api.github.com/users/wvu-r7/repos","events_url":"https://api.github.com/users/wvu-r7/events{/privacy}","received_events_url":"https://api.github.com/users/wvu-r7/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-02-21T03:18:58Z","updated_at":"2015-02-24T09:59:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/4810","html_url":"https://github.com/rapid7/metasploit-framework/pull/4810","diff_url":"https://github.com/rapid7/metasploit-framework/pull/4810.diff","patch_url":"https://github.com/rapid7/metasploit-framework/pull/4810.patch"},"body":"Fix #3827 \r\n\r\nThis patch is a feature that allows you to change a job name in msfconsole.\r\n\r\nTo test, here's how:\r\n\r\n## Normally:\r\n\r\n- [ ] Start msfconsole\r\n- [ ] ```use exploit/multi/handler```\r\n- [ ] ```set exitonsession false```\r\n- [ ] ```run ```\r\n- [ ] Do ```jobs``` and find the job ID of the handler (should be 0)\r\n- [ ] Do ```rename_job 0 \"my custom job\"```\r\n- [ ] You should see that it says something like \"job 0 updated\"\r\n- [ ] Do ```jobs``` again, you should see the new job name.\r\n\r\n## Additional testing (still in msfconsole):\r\n\r\n- [ ] Do ```rename_job 4444 test```\r\n- [ ] It should say that job 4444 does not exist.\r\n\r\n## And finally:\r\n\r\n- [ ] Do ```rename_job``` or ```rename_job -h```\r\n- [ ] You should see the help message\r\n\r\n## Note\r\n\r\nI noticed that the only way to be able to change a job name is to actually ignore the Protected access control and call ```name=``` directly with the ```send``` method. Typically this kind of practice is not encouraged, but like I said this seems to be only way, so if you know how this is actually bad, please do tell and give me a solution (if possible)."},"comment":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/comments/75728452","html_url":"https://github.com/rapid7/metasploit-framework/pull/4810#issuecomment-75728452","issue_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/4810","id":75728452,"user":{"login":"wvu-r7","id":4551878,"avatar_url":"https://avatars.githubusercontent.com/u/4551878?v=3","gravatar_id":"","url":"https://api.github.com/users/wvu-r7","html_url":"https://github.com/wvu-r7","followers_url":"https://api.github.com/users/wvu-r7/followers","following_url":"https://api.github.com/users/wvu-r7/following{/other_user}","gists_url":"https://api.github.com/users/wvu-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/wvu-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wvu-r7/subscriptions","organizations_url":"https://api.github.com/users/wvu-r7/orgs","repos_url":"https://api.github.com/users/wvu-r7/repos","events_url":"https://api.github.com/users/wvu-r7/events{/privacy}","received_events_url":"https://api.github.com/users/wvu-r7/received_events","type":"User","site_admin":false},"created_at":"2015-02-24T09:59:37Z","updated_at":"2015-02-24T09:59:37Z","body":"From ```lib/rex/job_container.rb```:\r\n\r\n```ruby\r\nprotected\r\n\r\n  attr_writer   :name #:nodoc:\r\n```\r\n\r\nChecking it out:\r\n\r\n```\r\nmsf > use exploit/multi/handler\r\nmsf exploit(handler) > run -j\r\n[*] Exploit running as background job.\r\nmsf exploit(handler) >\r\n[*] Started reverse handler on 10.6.0.59:4444\r\n[*] Starting the payload handler...\r\n\r\nmsf exploit(handler) > jobs\r\n\r\nJobs\r\n====\r\n\r\n  Id  Name\r\n  --  ----\r\n  0   Exploit: multi/handler\r\n\r\nmsf exploit(handler) > irb\r\n[*] Starting IRB shell...\r\n\r\n>> framework.jobs['0'].name\r\n=> \"Exploit: multi/handler\"\r\n>> framework.jobs['0'].name = 'hi sinn3r'\r\nNoMethodError: protected method `name=' called for #<Rex::Job:0x0000000696df10>\r\n        from (irb):2:in `cmd_irb'\r\n        from /home/wvu/metasploit-framework/lib/rex/ui/text/irb_shell.rb:53:in `block in run'\r\n        from /home/wvu/metasploit-framework/lib/rex/ui/text/irb_shell.rb:52:in `catch'\r\n        from /home/wvu/metasploit-framework/lib/rex/ui/text/irb_shell.rb:52:in `run'\r\n        from /home/wvu/metasploit-framework/lib/msf/ui/console/command_dispatcher/core.rb:772:in `cmd_irb'\r\n        from /home/wvu/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:427:in `run_command'\r\n        from /home/wvu/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:389:in `block in run_single'\r\n        from /home/wvu/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:383:in `each'\r\n        from /home/wvu/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:383:in `run_single'\r\n        from /home/wvu/metasploit-framework/lib/rex/ui/text/shell.rb:200:in `run'\r\n        from /home/wvu/metasploit-framework/lib/metasploit/framework/command/console.rb:38:in `start'\r\n        from /home/wvu/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'\r\n        from ./msfconsole:48:in `<main>'\r\n>> framework.jobs['0'].send(:name=, 'hi sinn3r')\r\n=> \"hi sinn3r\"\r\n>>\r\nmsf exploit(handler) > jobs\r\n\r\nJobs\r\n====\r\n\r\n  Id  Name\r\n  --  ----\r\n  0   hi sinn3r\r\n\r\nmsf exploit(handler) >\r\n```\r\n\r\nI agree. :)"}}