{"id":368,"date":"2015-01-11T18:36:58","date_gmt":"2015-01-11T18:36:58","guid":{"rendered":"https:\/\/www.hackmethod.com\/?p=368"},"modified":"2022-06-03T05:40:41","modified_gmt":"2022-06-03T05:40:41","slug":"overthewire-bandit-8","status":"publish","type":"post","link":"https:\/\/hackmethod.com\/overthewire-bandit-8\/","title":{"rendered":"OvertheWire &#8211; Bandit 8"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;section&#8221; _builder_version=&#8221;3.22&#8243;][et_pb_row admin_label=&#8221;row&#8221; _builder_version=&#8221;3.25&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text admin_label=&#8221;Text&#8221; _builder_version=&#8221;4.7.4&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;]<strong><span style=\"color: #666666;\">Recap of Level 7:<\/span>\u00a0<\/strong>Searching for file types using owners, groups and file size<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/overthewire.org\/wargames\/bandit\/bandit8.html\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Bandit Level 8<\/strong><\/a><\/p>\n<h4><strong>Objective:<\/strong><\/h4>\n<p>Find the password to the next level<\/p>\n<h4><strong>Intel Given:<\/strong><\/h4>\n<ul>\n<li>The password for the next level is stored in the file <strong>data.txt<\/strong> next to the word <strong>millionth<\/strong><\/li>\n<\/ul>\n<p><!--more--><\/p>\n<h4><strong>How to:<\/strong><\/h4>\n<p>This is easy. In fact I already taught you the skills needed to complete this in the <a href=\"https:\/\/www.hackmethod.com\/bandit-6\/\" target=\"_blank\" rel=\"noopener noreferrer\">Bandit 6 Walkthrough<\/a>. \u00a0We know that the password is in the file data.txt and when we read the file with <code>cat<\/code> it looks something like this.<\/p>\n<p><strong><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"369\" data-permalink=\"https:\/\/hackmethod.com\/overthewire-bandit-8\/screen-shot-2015-01-11-at-12-26-52-pm\/\" data-orig-file=\"https:\/\/i0.wp.com\/hackmethod.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-11-at-12.26.52-PM.png?fit=359%2C271&amp;ssl=1\" data-orig-size=\"359,271\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bandit 8.1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/hackmethod.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-11-at-12.26.52-PM.png?fit=300%2C226&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/hackmethod.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-11-at-12.26.52-PM.png?fit=359%2C271&amp;ssl=1\" class=\" wp-image-369 size-full aligncenter\" src=\"https:\/\/i0.wp.com\/www.hackmethod.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-11-at-12.26.52-PM.png?resize=359%2C271&#038;ssl=1\" alt=\"Bandit 8.1\" width=\"359\" height=\"271\" srcset=\"https:\/\/i0.wp.com\/hackmethod.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-11-at-12.26.52-PM.png?w=359&amp;ssl=1 359w, https:\/\/i0.wp.com\/hackmethod.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-11-at-12.26.52-PM.png?resize=300%2C226&amp;ssl=1 300w\" sizes=\"(max-width: 359px) 100vw, 359px\" \/><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>We could just scroll through and look through the word &#8220;millionth&#8221; but as hackers-in-training we prefer to do things efficiently. So rather than scroll through this entire list we simply have our shell search for us. By reading the file and then piping the output into a grep we are easily given the result. <code>cat data.txt | grep -i 'millionth'<\/code> will give you the desired result.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.hackmethod.com\/wp-content\/uploads\/2015\/01\/Bandit-8.2.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"370\" data-permalink=\"https:\/\/hackmethod.com\/overthewire-bandit-8\/bandit-8-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/hackmethod.com\/wp-content\/uploads\/2015\/01\/Bandit-8.2.png?fit=380%2C52&amp;ssl=1\" data-orig-size=\"380,52\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Bandit 8.2\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/hackmethod.com\/wp-content\/uploads\/2015\/01\/Bandit-8.2.png?fit=300%2C41&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/hackmethod.com\/wp-content\/uploads\/2015\/01\/Bandit-8.2.png?fit=380%2C52&amp;ssl=1\" class=\" size-full wp-image-370 aligncenter\" src=\"https:\/\/i0.wp.com\/www.hackmethod.com\/wp-content\/uploads\/2015\/01\/Bandit-8.2.png?resize=380%2C52&#038;ssl=1\" alt=\"Bandit 8.2\" width=\"380\" height=\"52\" srcset=\"https:\/\/i0.wp.com\/hackmethod.com\/wp-content\/uploads\/2015\/01\/Bandit-8.2.png?w=380&amp;ssl=1 380w, https:\/\/i0.wp.com\/hackmethod.com\/wp-content\/uploads\/2015\/01\/Bandit-8.2.png?resize=300%2C41&amp;ssl=1 300w\" sizes=\"(max-width: 380px) 100vw, 380px\" \/><\/a><\/p>\n<p>You may be wondering what the <code>-i<\/code> is on the end of my grep? Well I urge you to read the man page on it to find out. Here&#8217;s a tip for getting through man pages quickly. When you enter the man page if you hit <code>\/<\/code> and type in a search string and hit enter your shell will highlight what you&#8217;re looking for if it exists. For example if I was looking for what <code>-i<\/code> did in the grep man page I would type <code>\/-i<\/code>. Pressing <code>n<\/code> will give you the next result. Hitting return and then q will drop you back into your shell.<\/p>\n<h4><strong>Conclusion:<\/strong><\/h4>\n<p>We reviewed grep from the previous lesson and used to it discover our answer when piping our read file command into it. We also went over how to search through a man page to help make our searches more efficient. In the next lesson we will dig a little deeper into using more advanced commands to search through strings.<\/p>\n<p>&nbsp;[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;1_2,1_2&#8243; _builder_version=&#8221;4.7.4&#8243; _module_preset=&#8221;default&#8221;][et_pb_column type=&#8221;1_2&#8243; _builder_version=&#8221;4.7.4&#8243; _module_preset=&#8221;default&#8221;][et_pb_image src=&#8221;https:\/\/hackmethod.com\/wp-content\/uploads\/2020\/12\/Previous.png&#8221; alt=&#8221;Previous Level&#8221; title_text=&#8221;Previous&#8221; url=&#8221;https:\/\/hackmethod.com\/overthewire-bandit-7&#8243; _builder_version=&#8221;4.7.4&#8243; _module_preset=&#8221;default&#8221;][\/et_pb_image][\/et_pb_column][et_pb_column type=&#8221;1_2&#8243; _builder_version=&#8221;4.7.4&#8243; _module_preset=&#8221;default&#8221;][et_pb_image src=&#8221;https:\/\/hackmethod.com\/wp-content\/uploads\/2020\/12\/Next.png&#8221; alt=&#8221;Next Level&#8221; title_text=&#8221;Next&#8221; url=&#8221;https:\/\/hackmethod.com\/overthewire-bandit-9&#8243; align=&#8221;right&#8221; _builder_version=&#8221;4.7.4&#8243; _module_preset=&#8221;default&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recap of Level 7:\u00a0Searching for file types using owners, groups and file size &nbsp; Bandit Level 8 Objective: Find the password to the next level Intel Given: The password for the next level is stored in the file data.txt next to the word millionth How to: This is easy. In fact I already taught you [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":369,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"<strong><a href=\"https:\/\/www.hackmethod.com\/overthewire-bandit-7\/\">Recap of Last\u00a0Lesson<\/a>:\u00a0<\/strong>Searching for file types using owners, groups and file size\r\n\r\n<a href=\"http:\/\/overthewire.org\/wargames\/bandit\/bandit8.html\" target=\"_blank\"><strong>Bandit Level 8<\/strong><\/a>\r\n\r\n<strong>Objective<\/strong>\r\n\r\nFind the password to the next level\r\n\r\n<strong>Intel Given<\/strong>\r\n<ul>\r\n\t<li>The password for the next level is stored in the file <strong>data.txt<\/strong> next to the word <strong>millionth<\/strong><\/li>\r\n<\/ul>\r\n<!--more-->\r\n\r\n<strong>How to<\/strong>\r\n\r\nThis is easy. In fact I already taught you the skills needed to complete this in the <a href=\"https:\/\/www.hackmethod.com\/bandit-6\/\" target=\"_blank\">Bandit 6 Walkthrough<\/a>. \u00a0We know that the password is in the file data.txt and when we read the file with 'cat' it looks something like this.\r\n\r\n<strong><img class=\" wp-image-369 size-full aligncenter\" src=\"https:\/\/www.hackmethod.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-11-at-12.26.52-PM.png\" alt=\"Bandit 8.1\" width=\"359\" height=\"271\" \/><\/strong>\r\n\r\n&nbsp;\r\n\r\nWe could just scroll through and look through the word \"millionth\" but as hackers-in-training we prefer to do things efficiently. So rather than scroll through this entire list we simply have our shell search for us. By reading the file and then piping the output into a grep we are easily given the result. 'cat data.txt | grep -i 'millionth' will give you the desired result.\r\n\r\n<a href=\"https:\/\/www.hackmethod.com\/wp-content\/uploads\/2015\/01\/Bandit-8.2.png\"><img class=\" size-full wp-image-370 aligncenter\" src=\"https:\/\/www.hackmethod.com\/wp-content\/uploads\/2015\/01\/Bandit-8.2.png\" alt=\"Bandit 8.2\" width=\"380\" height=\"52\" \/><\/a>\r\n\r\nYou may be wondering what the '-i' is on the end of my grep? Well I urge you to read the man page on it to find out. Here's a tip for getting through man pages quickly. When you enter the man page if you hit '\/' and type in a search string and hit enter your shell will highlight what you're looking for if it exists. For example if I was looking for what '-i' did in the grep man page I would type '\/-i'. Pressing 'n' will give you the next result. Hitting return and then q will drop you back into your shell.\r\n\r\n<strong>Conclusion<\/strong>\r\n\r\nWe reviewed grep from the previous lesson and used to it discover our answer when piping our read file command into it. We also went over how to search through a man page to help make our searches more efficient. In the next lesson we will dig a little deeper into using more advanced commands to search through strings.\r\n\r\n&nbsp;","_et_gb_content_width":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[44],"tags":[43,45,50],"class_list":["post-368","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-overthewire","tag-bandit","tag-overthewire","tag-tutorial"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/hackmethod.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-11-at-12.26.52-PM.png?fit=359%2C271&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5zY4D-5W","_links":{"self":[{"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/posts\/368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/comments?post=368"}],"version-history":[{"count":6,"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/posts\/368\/revisions"}],"predecessor-version":[{"id":27499,"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/posts\/368\/revisions\/27499"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/media\/369"}],"wp:attachment":[{"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/media?parent=368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/categories?post=368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/tags?post=368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}