{"id":276,"date":"2015-01-01T03:12:08","date_gmt":"2015-01-01T03:12:08","guid":{"rendered":"http:\/\/scottyrotten.wordpress.com\/?p=276"},"modified":"2022-06-03T05:40:41","modified_gmt":"2022-06-03T05:40:41","slug":"overthewire-bandit-3","status":"publish","type":"post","link":"https:\/\/hackmethod.com\/overthewire-bandit-3\/","title":{"rendered":"OvertheWire &#8211; Bandit 3"},"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;3.27.4&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221;]<strong>Recap of Level 2:<\/strong>\u00a0We logged into the overthewire Bandit 2 after reading the file \u201creadme\u201d located in the \/home\/bandit1 directory.<\/p>\n<p>&nbsp;<\/p>\n<p><a title=\"Bandit Level 3\" href=\"http:\/\/overthewire.org\/wargames\/bandit\/bandit3.html\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Bandit Level 3<\/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>Password is in a file named \u2018spaces in this filename\u2018<\/li>\n<li>file is located in the home directory<\/li>\n<\/ul>\n<p><!--more--><\/p>\n<h4><strong>How to: <\/strong><\/h4>\n<p>This is simply a file name we need to read. The problem is we can&#8217;t just type &#8216;cat spaces in this filename&#8217;. This is because *nix interprets each space as a separate item. \u00a0We don&#8217;t currently have any variables, objects or commands named &#8216;spaces, in, this, filename&#8217; so this command doesn&#8217;t make sense to our operating system. Which leads us into escape characters.<\/p>\n<p><span style=\"text-decoration: underline;\">Escape Characters<\/span><\/p>\n<p>Escape characters can get kind of tricky and drawn out, so I&#8217;ll give you the short and sweet of it. These characters tell the shell to do something OTHER than what it should do. In this shell if you want &#8216;cat spaces in this filename&#8217; to have its spaces preserved so that &#8216;spaces in this filename&#8217; is one ITEM then you need to tell it to do so. The backslash () is used to do this. When we type &#8216;cat spaces in this filename&#8217; the escape character is always BEFORE the character you wish to escape. In another example\u00a0if we want to remove all items in the current directory we would just type &#8216;rm *&#8217; but if we typed &#8216;rm *&#8217; it would remove all the files named *.<\/p>\n<p><span style=\"text-decoration: underline;\">Tab Completion<\/span><\/p>\n<p>Typing each back slash kind of pain in the ass, but *nix shells offer something amazing called &#8220;tab completion&#8221;. Halfway type a command and hit tab, UNIX will attempt to complete it for you or provide you a list of available files in the current directory or a list of commands aliased for that host. With that, I literally typed &#8216;cat sp&#8217; and hit tab, my shell automatically filled in the rest for me.<\/p>\n<h4><strong>Conclusion: <\/strong><\/h4>\n<p>Escape characters are powerful when programming and helpful when dealing with filenames that have funky characters in them. Additionally, tab completion is extremely helpful and if used effectively can really increase the speed in which you traverse through file structures. Try using it with &#8216;cd&#8217; to move around to different directories within your OS.<\/p>\n<p>[\/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-2&#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-4&#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 2:\u00a0We logged into the overthewire Bandit 2 after reading the file \u201creadme\u201d located in the \/home\/bandit1 directory. &nbsp; Bandit Level 3 Objective: Find the password to the next level Intel Given: Password is in a file named \u2018spaces in this filename\u2018 file is located in the home directory How to: This is [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"<strong>Recap of Last&nbsp;Lesson:<\/strong>&nbsp;We logged into the overthewire Bandit 2 after reading the file \u201creadme\u201d located in the \/home\/bandit1 directory.\n\n<a title=\"Bandit Level 3\" href=\"http:\/\/overthewire.org\/wargames\/bandit\/bandit3.html\" target=\"_blank\" rel=\"noopener\"><strong>Bandit Level 3<\/strong><\/a>\n\n<strong>Objective: <\/strong>Find the password to the next level\n\n<strong>Intel Given:<\/strong>\n\n<ul>\n    <li>Password is in a file named \u2018spaces in this filename\u2018<\/li>\n    <li>file is located in the home directory<\/li>\n<\/ul>\n\n<!--more-->\n\n<strong>How to: <\/strong>This is simply a file name we need to read. The problem is we can't just type 'cat spaces in this filename'. This is because *nix interprets each space as a separate item. &nbsp;We don't currently have any variables, objects or commands named 'spaces, in, this, filename' so this command doesn't make sense to our operating system. Which leads us into escape characters.\n\n<span style=\"text-decoration: underline;\">Escape Characters<\/span>\n\nEscape characters can get kind of tricky and drawn out, so I'll give you the short and sweet of it. These characters tell the shell to do something OTHER than what it should do. In this shell if you want 'cat spaces in this filename' to have its spaces preserved so that 'spaces in this filename' is one ITEM then you need to tell it to do so. The backslash () is used to do this. When we type 'cat spaces in this filename' the escape character is always BEFORE the character you wish to escape. In another example&nbsp;if we want to remove all items in the current directory we would just type 'rm *' but if we typed 'rm *' it would remove all the files named *.\n\n<span style=\"text-decoration: underline;\">Tab Completion<\/span>\n\nTyping each back slash kind of pain in the ass, but *nix shells offer something amazing called \"tab completion\". Halfway type a command and hit tab, UNIX will attempt to complete it for you or provide you a list of available files in the current directory or a list of commands aliased for that host. With that, I literally typed 'cat sp' and hit tab, my shell automatically filled in the rest for me.\n\n<strong>Conclusion: <\/strong>Escape characters are powerful when programming and helpful when dealing with filenames that have funky characters in them. Additionally, tab completion is extremely helpful and if used effectively can really increase the speed in which you traverse through file structures. Try using it with 'cd' to move around to different directories within your OS.","_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,49],"tags":[43,45,46],"class_list":["post-276","post","type-post","status-publish","format-standard","hentry","category-overthewire","category-tutorials","tag-bandit","tag-overthewire","tag-tutorials"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5zY4D-4s","_links":{"self":[{"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/posts\/276","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=276"}],"version-history":[{"count":12,"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/posts\/276\/revisions"}],"predecessor-version":[{"id":27472,"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/posts\/276\/revisions\/27472"}],"wp:attachment":[{"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/media?parent=276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/categories?post=276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hackmethod.com\/wp-json\/wp\/v2\/tags?post=276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}