{"action":"created","issue":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5341","labels_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5341/labels{/name}","comments_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5341/comments","events_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5341/events","html_url":"https://github.com/rapid7/metasploit-framework/pull/5341","id":75925305,"number":5341,"title":"Import Rex::Ui::Text::Table functionality","user":{"login":"sempervictus","id":1331084,"avatar_url":"https://avatars.githubusercontent.com/u/1331084?v=3","gravatar_id":"","url":"https://api.github.com/users/sempervictus","html_url":"https://github.com/sempervictus","followers_url":"https://api.github.com/users/sempervictus/followers","following_url":"https://api.github.com/users/sempervictus/following{/other_user}","gists_url":"https://api.github.com/users/sempervictus/gists{/gist_id}","starred_url":"https://api.github.com/users/sempervictus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sempervictus/subscriptions","organizations_url":"https://api.github.com/users/sempervictus/orgs","repos_url":"https://api.github.com/users/sempervictus/repos","events_url":"https://api.github.com/users/sempervictus/events{/privacy}","received_events_url":"https://api.github.com/users/sempervictus/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/library","name":"library","color":"fad8c7"}],"state":"open","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":8,"created_at":"2015-05-13T09:54:25Z","updated_at":"2015-05-20T18:39:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/5341","html_url":"https://github.com/rapid7/metasploit-framework/pull/5341","diff_url":"https://github.com/rapid7/metasploit-framework/pull/5341.diff","patch_url":"https://github.com/rapid7/metasploit-framework/pull/5341.patch"},"body":"Squash historical commits and merge/updates:\r\n************************************************************************\r\nAllow passing MaxChar to Rex::Ui::Text::Table cols\r\n\r\nPassing MaxChar allows setting the maximum number of characters\r\nprinted within a specific column during the row_to_s method.\r\nThis does not affect CSV output nor truncate the actual data.\r\nMeant for tidying up long console ouput.\r\n\r\nExample: cleaned up 'cmd_creds' to show proof and not maul tables\r\nwith unix session data.\r\n************************************************************************\r\nAdd MaxChar to tbl.row.cell.to_s\r\n\r\nColProps will now take a 'col_name' => { 'MaxChar' => 64 } which\r\nonly affects row.to_s.\r\ncmd_creds without -S will now limit pass and proof to 64 char.\r\n************************************************************************\r\nCreate Rex Tables from CSV\r\n************************************************************************\r\nRex::Text::Ui::Table.new[find_by_colnames]\r\n\r\nAdd :[] to ...Ui::Table allowing user to pass multiple colnames.\r\nReturns a new table with only those columns and their rows.\r\n\r\nUseful when using Rex to filter output, prep CSV, etc.\r\n\r\nTesting:\r\n```\r\nt = Rex::Ui::Text::Table.new('Columns' => ['a','b','c'])\r\nt << ['x','y','z']\r\nt << ['p','q','r']\r\nt['a','c']\r\n\r\n=> a  c\r\n-  -\r\np  r\r\nx  z\r\n```\r\n************************************************************************\r\nAllow Internal Filtering by SearchTerm\r\n\r\nAllow passing 'SearchTerm' into Rex::Ui::Text::Table creation to\r\nfilter all output by regex match to the string passed.\r\nProvides base functionality for higher level subscribers such as\r\ncmd_ls in meterpreter sessions for filtering output\r\n************************************************************************\r\nImport fs.rb\r\n\r\nMerge forked changes to cmd_ls allowing for the use of string\r\nmatching on listing output via Rex::Ui::Text::Table's SearchTerm\r\nfacility.\r\n\r\nExample:\r\n\r\n```\r\nmeterpreter > ls chef -R -S wget\r\nNo entries exist in chef/backup/chef/handlers\r\nNo entries exist in chef/backup/chef/ohai_plugins\r\nNo entries exist in chef/backup/chef\r\nNo entries exist in chef/backup\r\nNo entries exist in chef/cache/cookbooks/avast/attributes\r\nNo entries exist in chef/cache/cookbooks/avast/recipes\r\nNo entries exist in chef/cache/cookbooks/avast\r\nNo entries exist in chef/cache/cookbooks/chef-client/attributes\r\nNo entries exist in chef/cache/cookbooks/chef-client/libraries\r\nNo entries exist in chef/cache/cookbooks/chef-client/recipes\r\nNo entries exist in chef/cache/cookbooks/chef-client\r\nNo entries exist in chef/cache/cookbooks/chef_handler/attributes\r\nNo entries exist in chef/cache/cookbooks/chef_handler/libraries\r\nNo entries exist in chef/cache/cookbooks/chef_handler/providers\r\nNo entries exist in chef/cache/cookbooks/chef_handler/recipes\r\nNo entries exist in chef/cache/cookbooks/chef_handler/resources\r\nNo entries exist in chef/cache/cookbooks/chef_handler\r\nNo entries exist in chef/cache/cookbooks/cron/providers\r\nNo entries exist in chef/cache/cookbooks/cron/recipes\r\nNo entries exist in chef/cache/cookbooks/cron/resources\r\nNo entries exist in chef/cache/cookbooks/cron\r\nNo entries exist in chef/cache/cookbooks/logrotate/attributes\r\nNo entries exist in chef/cache/cookbooks/logrotate/definitions\r\nNo entries exist in chef/cache/cookbooks/logrotate/libraries\r\nNo entries exist in chef/cache/cookbooks/logrotate/recipes\r\nNo entries exist in chef/cache/cookbooks/logrotate\r\nNo entries exist in chef/cache/cookbooks/ohai/attributes\r\nNo entries exist in chef/cache/cookbooks/ohai/files/default/plugins\r\nNo entries exist in chef/cache/cookbooks/ohai/files/default\r\nNo entries exist in chef/cache/cookbooks/ohai/files\r\nNo entries exist in chef/cache/cookbooks/ohai/recipes\r\nNo entries exist in chef/cache/cookbooks/ohai\r\nNo entries exist in chef/cache/cookbooks/svit-windows/attributes\r\nNo entries exist in chef/cache/cookbooks/svit-windows/recipes\r\nNo entries exist in chef/cache/cookbooks/svit-windows/templates/default/plugins\r\nNo entries exist in chef/cache/cookbooks/svit-windows/templates/default\r\nNo entries exist in chef/cache/cookbooks/svit-windows/templates\r\nNo entries exist in chef/cache/cookbooks/svit-windows\r\nNo entries exist in chef/cache/cookbooks/windows/attributes\r\nNo entries exist in chef/cache/cookbooks/windows/files/default/handlers\r\nNo entries exist in chef/cache/cookbooks/windows/files/default\r\nNo entries exist in chef/cache/cookbooks/windows/files\r\nNo entries exist in chef/cache/cookbooks/windows/libraries\r\nNo entries exist in chef/cache/cookbooks/windows/providers\r\nNo entries exist in chef/cache/cookbooks/windows/recipes\r\nNo entries exist in chef/cache/cookbooks/windows/resources\r\nNo entries exist in chef/cache/cookbooks/windows\r\nNo entries exist in chef/cache/cookbooks\r\nNo entries exist in chef/cache\r\nNo entries exist in chef/handlers\r\nNo entries exist in chef/log\r\nNo entries exist in chef/ohai_plugins\r\nNo entries exist in chef/run\r\nListing: chef\r\n=============\r\n\r\nMode              Size  Type  Last modified              Name\r\n----              ----  ----  -------------              ----\r\n100666/rw-rw-rw-  161   fil   2014-07-21 11:08:26 -0400  wget.ps1\r\n100666/rw-rw-rw-  1285  fil   2014-07-21 11:08:26 -0400  wget.vbs\r\n\r\nmeterpreter >\r\n```\r\n************************************************************************\r\nImport sys.rb\r\n\r\nMerge forked changes to cmd_ps allowing for the use of string\r\nmatching on listing output via Rex::Ui::Text::Table's SearchTerm\r\nfacility\r\n\r\nExample:\r\n```\r\nmeterpreter > ps -S x64.*Auth.*Sys\r\n\r\nProcess list\r\n============\r\n\r\n PID   Name                       Arch  Session  User                          Path\r\n ---   ----                       ----  -------  ----                          ----\r\n 400   smss.exe                   x64   0        NT AUTHORITY\\SYSTEM           C:\\Windows\\System32\\smss.exe\r\n...\r\n```"},"comment":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/comments/103989796","html_url":"https://github.com/rapid7/metasploit-framework/pull/5341#issuecomment-103989796","issue_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/5341","id":103989796,"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-05-20T18:39:18Z","updated_at":"2015-05-20T18:39:18Z","body":"@sempervictus here is the resplit version, with some fixes, namely with an empty column in the middle causing the rightmost column to be misaligned.\r\n\r\nhttps://github.com/bcook-r7/metasploit-framework/commits/land-5341-table-others"}}