<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: San Kang</title>
    <description>The latest articles on DEV Community by San Kang (@sankworks).</description>
    <link>https://dev.to/sankworks</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3054002%2F327d9727-4321-48f6-96dd-0bc0adb5de53.png</url>
      <title>DEV Community: San Kang</title>
      <link>https://dev.to/sankworks</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sankworks"/>
    <language>en</language>
    <item>
      <title>[Adult Learning Log] C Language – Week 4 Review</title>
      <dc:creator>San Kang</dc:creator>
      <pubDate>Thu, 03 Jul 2025 04:11:54 +0000</pubDate>
      <link>https://dev.to/sankworks/adult-learning-log-c-language-week-4-review-c9p</link>
      <guid>https://dev.to/sankworks/adult-learning-log-c-language-week-4-review-c9p</guid>
      <description>&lt;h3&gt;
  
  
  ○ Key Learning Points from Week 4
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Learned about the concepts and types of arithmetic operators, relational operators, logical operators, and conditional operators.&lt;/li&gt;
&lt;li&gt;Studied increment/decrement operators, compound assignment operators, comma operators, and bitwise operators.&lt;/li&gt;
&lt;li&gt;Understood type conversion and operator precedence.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  ○ Expression (Formula)
&lt;/h3&gt;

&lt;p&gt;An expression is a combination of constants, variables, and operators, divided into operators and operands.&lt;/p&gt;

&lt;h3&gt;
  
  
  ○ Arithmetic Operators (Basic Arithmetic): &lt;code&gt;+&lt;/code&gt;, &lt;code&gt;-&lt;/code&gt;, &lt;code&gt;*&lt;/code&gt;, &lt;code&gt;/&lt;/code&gt;, &lt;code&gt;%&lt;/code&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Division between &lt;code&gt;int&lt;/code&gt; types results in an &lt;code&gt;int&lt;/code&gt; (decimal parts are truncated).&lt;/li&gt;
&lt;li&gt;Division between &lt;code&gt;float&lt;/code&gt; types yields &lt;code&gt;float&lt;/code&gt; results.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;%&lt;/code&gt; (Modulus Operator) returns the remainder of dividing the first operand by the second operand.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ○ Increment/Decrement Operators
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;++variable&lt;/code&gt;, &lt;code&gt;variable++&lt;/code&gt;, &lt;code&gt;--variable&lt;/code&gt;, &lt;code&gt;variable--&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The position of the increment/decrement operator affects when the value is updated.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  ○ Assignment Operators
&lt;/h3&gt;

&lt;p&gt;Operators that assign the result of an expression to a variable.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The left side must be a variable, while the right side can be any expression.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Error&lt;/span&gt;
&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// Valid (Different from the math "="!)&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// Valid (Assigns 3 to x, then assigns x's value to y)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ○ Compound Assignment Operators
&lt;/h3&gt;

&lt;p&gt;Combines &lt;code&gt;=&lt;/code&gt; with arithmetic operators, e.g., &lt;code&gt;x += y&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allows shorthand for reassigning the result to the same variable.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  ○ Relational Operators: &lt;code&gt;==&lt;/code&gt;, &lt;code&gt;!=&lt;/code&gt;, &lt;code&gt;&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;&lt;/code&gt;, &lt;code&gt;&amp;gt;=&lt;/code&gt;, &lt;code&gt;&amp;lt;=&lt;/code&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Compares two operands; returns TRUE (&lt;code&gt;1&lt;/code&gt;) or FALSE (&lt;code&gt;0&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Cannot chain comparisons as in math: &lt;code&gt;2 &amp;lt; x &amp;lt; 5&lt;/code&gt; → This is invalid.

&lt;ul&gt;
&lt;li&gt;Correct way: &lt;code&gt;(2 &amp;lt; x) &amp;amp;&amp;amp; (x &amp;lt; 5)&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h3&gt;
  
  
  ○ Logical Operators: &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;, &lt;code&gt;||&lt;/code&gt;, &lt;code&gt;!&lt;/code&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Used to combine multiple conditions.&lt;/li&gt;
&lt;li&gt;Returns &lt;code&gt;1&lt;/code&gt; (TRUE) if the condition is met, &lt;code&gt;0&lt;/code&gt; (FALSE) otherwise.&lt;/li&gt;
&lt;li&gt;In C, &lt;strong&gt;non-zero values are considered TRUE&lt;/strong&gt; and &lt;code&gt;0&lt;/code&gt; is FALSE.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Note&lt;/em&gt;: In this class, negative numbers were also treated as FALSE due to representing no electric signal.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ○ Ternary Operator (Conditional Operator)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The only operator that takes three operands:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="n"&gt;max_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// Returns a if TRUE, b if FALSE&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ○ Comma Operator
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Evaluates two expressions separated by &lt;code&gt;,&lt;/code&gt; sequentially.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  ○ Bitwise Operators: &lt;code&gt;&amp;amp;&lt;/code&gt;, &lt;code&gt;|&lt;/code&gt;, &lt;code&gt;^&lt;/code&gt;, &lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt;, &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt;, &lt;code&gt;~&lt;/code&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt; shifts bits to the left, effectively doubling the value per shift (due to binary nature).&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  ○ Type Conversion &amp;amp; Operator Precedence
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Type Conversion (Casting)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Changes the data type during program execution.&lt;/li&gt;
&lt;li&gt;Be cautious—improper casting can lead to data loss.&lt;/li&gt;
&lt;li&gt;When mixing different data types, C automatically promotes to the larger type.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Explicit Casting
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Developer explicitly converts the type using parentheses before the variable:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;35&lt;/span&gt;  &lt;span class="c1"&gt;// Casts 1.35 to int&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Operator Precedence
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Determines the order of operations among multiple operators.&lt;/li&gt;
&lt;li&gt;Refer to the textbook’s precedence chart for details.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  ○ Practice
&lt;/h3&gt;

&lt;p&gt;Try writing and executing C code using the operators learned this week.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9awoip9q57idu9s0u6sa.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9awoip9q57idu9s0u6sa.jpg" alt="Image description" width="800" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzp9rq5ievlu1a1m18b3i.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzp9rq5ievlu1a1m18b3i.jpg" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpt3xvwrugdc2jzmcokq5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpt3xvwrugdc2jzmcokq5.jpg" alt="Image description" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>clanguage</category>
      <category>studylog</category>
      <category>adulteducation</category>
      <category>creditbank</category>
    </item>
    <item>
      <title>[Adult Learning Log] Data Structures – Week 3 Review</title>
      <dc:creator>San Kang</dc:creator>
      <pubDate>Wed, 02 Jul 2025 03:05:08 +0000</pubDate>
      <link>https://dev.to/sankworks/adult-learning-log-data-structures-week-3-review-30gk</link>
      <guid>https://dev.to/sankworks/adult-learning-log-data-structures-week-3-review-30gk</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;○ Key Takeaways from Week 3&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Learned about stacks, related operations, practical uses, and implementation methods.&lt;/li&gt;
&lt;li&gt;Understood the difference between static and dynamic stack connections and their implementation.&lt;/li&gt;
&lt;li&gt;Practiced writing &lt;code&gt;size()&lt;/code&gt; and &lt;code&gt;print_stack()&lt;/code&gt; for a stack implemented using a linked list.&lt;/li&gt;
&lt;li&gt;Studied expression evaluation and conversion using stacks.&lt;/li&gt;
&lt;li&gt;Learned about multiple stacks implemented in one array.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ Stack: Last-In First-Out (LIFO) Structure&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Think of a stack like a pile of plates: the last one added is the first to be removed.&lt;/li&gt;
&lt;li&gt;The top of the stack is called &lt;code&gt;top&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The bottom does not need to be accessed directly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Abstract Data Type (ADT) for Stack
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Common Operations:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;init()&lt;/code&gt; – initialize the stack
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;push(a)&lt;/code&gt; – add element &lt;code&gt;a&lt;/code&gt; to the top
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pop()&lt;/code&gt; – remove and return the top element
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;is_empty()&lt;/code&gt; – return TRUE if empty, else FALSE
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;is_full()&lt;/code&gt; – return TRUE if full, else FALSE
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;peek()&lt;/code&gt; – return top element without removing it&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;push()&lt;/code&gt; is called on a full stack → &lt;strong&gt;Overflow Error&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;pop()&lt;/code&gt; or &lt;code&gt;peek()&lt;/code&gt; is called on an empty stack → &lt;strong&gt;Underflow Error&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Common Use Cases:
&lt;/h4&gt;

&lt;p&gt;Undo actions, back button in browsers, parenthesis matching, calculators, maze solving, etc.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ Dynamically Linked Stack&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Unlike array-based stacks, dynamic stacks using linked lists allocate memory using &lt;code&gt;malloc()&lt;/code&gt; as needed.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;top&lt;/code&gt; pointer dynamically moves with each operation.&lt;/li&gt;
&lt;li&gt;Memory-efficient and flexible but more complex to implement and slower.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example Usage (C):
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="k"&gt;typedef&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;Element&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"LinkedStack.h"&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Stack Test&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Input Data: "&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%3d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
        &lt;span class="n"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Output Data: "&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;is_empty&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
        &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%3d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;destroy_stack&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;  &lt;span class="c1"&gt;// Free all dynamic nodes&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;○ Stack Size and Print (Linked List Version)&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;In a linked stack, each node contains &lt;code&gt;data&lt;/code&gt; and a &lt;code&gt;link&lt;/code&gt; to the next.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;top&lt;/code&gt; node is the most recently pushed.&lt;/li&gt;
&lt;li&gt;Must traverse the list to count or print.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;size()&lt;/code&gt; Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;top → A → B → C → D → NULL
Returns: 4 (O(4) time complexity)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;print_stack()&lt;/code&gt;:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Traverse from top and print each node’s data.&lt;/li&gt;
&lt;li&gt;Prints in reverse order of input.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ Expression Evaluation and Notation Conversion&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Three common forms: prefix, infix, postfix

&lt;ul&gt;
&lt;li&gt;Humans use &lt;strong&gt;infix&lt;/strong&gt;, computers use &lt;strong&gt;postfix&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;a + b&lt;/code&gt; → infix, &lt;code&gt;ab+&lt;/code&gt; → postfix&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Expression Handling via Stack:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Infix → Postfix conversion then calculate&lt;/li&gt;
&lt;li&gt;Operators with higher precedence (&lt;code&gt;*&lt;/code&gt;, &lt;code&gt;/&lt;/code&gt;) should be output before lower ones (&lt;code&gt;+&lt;/code&gt;, &lt;code&gt;-&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Left parenthesis always pushed (lowest priority)&lt;/li&gt;
&lt;li&gt;Right parenthesis triggers pop until left parenthesis is removed&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ Multiple Stacks in a Single Array&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Implementing two or more stacks in one array improves memory efficiency.&lt;/li&gt;
&lt;li&gt;Typically: Stack 1 grows from left, Stack 2 grows from right.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>datastructures</category>
      <category>studylog</category>
      <category>adulteducation</category>
      <category>creditbank</category>
    </item>
    <item>
      <title>[Adult Learning Log] Data Structures – Week 2 Review</title>
      <dc:creator>San Kang</dc:creator>
      <pubDate>Wed, 02 Jul 2025 03:04:04 +0000</pubDate>
      <link>https://dev.to/sankworks/adult-learning-log-data-structures-week-2-review-3h2b</link>
      <guid>https://dev.to/sankworks/adult-learning-log-data-structures-week-2-review-3h2b</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;○ Key Takeaways from Week 2&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Learned the concept of arrays and array-based sequential lists.&lt;/li&gt;
&lt;li&gt;Studied 1D/2D array declarations, initialization, sparse matrix representation, and transpose matrices.&lt;/li&gt;
&lt;li&gt;Learned how strings are implemented and the role and danger of omitting the &lt;code&gt;\0&lt;/code&gt; null character.&lt;/li&gt;
&lt;li&gt;Understood how arrays behave when passed as function arguments.&lt;/li&gt;
&lt;li&gt;Covered structure definitions, declarations, operations, and nested structures.&lt;/li&gt;
&lt;li&gt;Learned about pointers and dynamic memory allocation.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ Sequential List&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A list implemented using arrays.&lt;/li&gt;
&lt;li&gt;An array is a collection of elements of the same data type.&lt;/li&gt;
&lt;li&gt;Stored sequentially in memory, both logically and physically (addresses are also consecutive).&lt;/li&gt;
&lt;li&gt;Offers fast access via index but can be slow for insert/delete operations.&lt;/li&gt;
&lt;li&gt;Important to understand the abstract data type (ADT) concept of a list and how to implement it using arrays.&lt;/li&gt;
&lt;li&gt;Later, this will be compared with linked lists (pointer-based).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ 1D Array&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A set of  pairs. Accessing by index yields the corresponding value.&lt;/li&gt;
&lt;li&gt;Declared as &lt;code&gt;data_type array_name[size];&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;int A[6];&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;int A[6] = {1, 2, 3, 4, 5, 6};&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;int A[] = {1, 2, 3, 4, 5, 6};&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;A&lt;/code&gt; holds the address of &lt;code&gt;A[0]&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;Local variables in C are not auto-initialized to 0, so uninitialized values may contain garbage data.&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ 2D Array&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Declared as &lt;code&gt;data_type array_name[rows][columns];&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;int A[2][3];&lt;/code&gt; creates a 2x3 matrix.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Initialized like:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;int A[2][3] = {{1,2,3}, {4,5,6}};&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;int A[2][3] = {1,2,3,4,5,6};&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Sparse matrices save space but make operations more complex.&lt;/li&gt;

&lt;li&gt;Represented as triplets: &lt;code&gt;{row, column, value}&lt;/code&gt;
&lt;/li&gt;

&lt;li&gt;Transpose matrix: swaps rows and columns, useful when column-wise operations are needed.&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ Strings = Character Array + Null Terminator &lt;code&gt;\0&lt;/code&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Example: &lt;code&gt;char S1[16] = "Hello World";&lt;/code&gt; automatically adds &lt;code&gt;\0&lt;/code&gt; at the end.&lt;/li&gt;
&lt;li&gt;Without &lt;code&gt;\0&lt;/code&gt;, memory is read until a null byte is found—may cause garbage output or segmentation fault.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;strcpy()&lt;/code&gt; or &lt;code&gt;strcpy_s()&lt;/code&gt; to initialize character arrays safely.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ Passing Arrays to Functions&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;C uses call-by-value, but arrays are passed by reference (by address).&lt;/li&gt;
&lt;li&gt;Changes inside the function affect the original array.&lt;/li&gt;
&lt;li&gt;Must also pass the size of the array explicitly.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ Structure (struct) Basics&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Combines different data types under one unit.&lt;/li&gt;
&lt;li&gt;Must be defined before use.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="k"&gt;typedef&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;Student&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;202403156&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Hong Gil-dong"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;96&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;242403156&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;strcpy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Hong Gil-dong"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;.&lt;/code&gt; to access members.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;strcpy()&lt;/code&gt; is needed for character arrays (strings).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ Struct Operations and Nested Structures&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Only assignment (&lt;code&gt;=&lt;/code&gt;) is supported. Other operations like comparison (&lt;code&gt;&amp;gt;&lt;/code&gt;) are not allowed.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="k"&gt;typedef&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;Birthday&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;typedef&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="n"&gt;Birthday&lt;/span&gt; &lt;span class="n"&gt;birthday&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;Friend&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;Friend&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;○ Passing Structs to Functions&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Passed by value (copied), so changes inside the function don’t affect the original.&lt;/li&gt;
&lt;li&gt;Use pointers to modify original struct values.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ Polynomial Representation&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Practice in storing and manipulating structured data.&lt;/li&gt;
&lt;li&gt;Store coefficients in arrays, usually in ascending order by degree:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;int coef[] = {7, 5, 2, 3};&lt;/code&gt; → index 0 = constant, index 3 = highest degree term.&lt;/li&gt;
&lt;li&gt;Easier coding and readability when using index = degree.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ Pointer Basics&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A pointer holds the address of another variable.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;*&lt;/code&gt; to access or modify the value being pointed to.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;&amp;amp;&lt;/code&gt; to get a variable's address.&lt;/li&gt;
&lt;li&gt;Arrays act like pointers in many contexts.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ Dynamic Memory Allocation&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Allocates memory at runtime, allows efficient use of memory.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;malloc()&lt;/code&gt; is used to request memory from the heap.&lt;/li&gt;
&lt;li&gt;Always &lt;code&gt;free()&lt;/code&gt; the memory to avoid memory leaks.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;pi&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;pi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;malloc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// use pi&lt;/span&gt;
&lt;span class="n"&gt;free&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pi&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>datastructures</category>
      <category>studylog</category>
      <category>adulteducation</category>
      <category>creditbank</category>
    </item>
    <item>
      <title>[Adult Learning Log] C Language - Week 3 Review</title>
      <dc:creator>San Kang</dc:creator>
      <pubDate>Thu, 26 Jun 2025 05:42:53 +0000</pubDate>
      <link>https://dev.to/sankworks/adult-learning-log-c-language-week-3-review-1c3e</link>
      <guid>https://dev.to/sankworks/adult-learning-log-c-language-week-3-review-1c3e</guid>
      <description>&lt;h2&gt;
  
  
  ○ Key Takeaways from Week 3
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Learned how to use &lt;code&gt;sizeof&lt;/code&gt; to find out the memory size occupied by a variable or data type.&lt;/li&gt;
&lt;li&gt;Understood the concepts of variables and constants, and the classification, size, and range of data types.&lt;/li&gt;
&lt;li&gt;Learned about &lt;code&gt;unsigned&lt;/code&gt;, &lt;code&gt;signed&lt;/code&gt; type specifiers and how to use suffixes to specify data types for integer constants.&lt;/li&gt;
&lt;li&gt;Studied symbolic constants and the differences between constants and variables.&lt;/li&gt;
&lt;li&gt;Learned the concept of Underflow, which is the opposite of Overflow.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ○ Review Highlights
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Reviewed the concept of Overflow and the importance of selecting appropriate data types.&lt;/li&gt;
&lt;li&gt;Revisited how negative numbers are represented in computers using Two's Complement.&lt;/li&gt;
&lt;li&gt;Reviewed fixed-point vs. floating-point number representations.&lt;/li&gt;
&lt;li&gt;Refreshed understanding of ASCII codes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ○ Data Types and Sizes: (1) Integer Types
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;short&lt;/code&gt; : 16-bit (2 bytes) → Range: -2^15 ~ 2^15 - 1&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;int&lt;/code&gt; : 32-bit (4 bytes) → Range: -2^31 ~ 2^31 - 1&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;long&lt;/code&gt; : 32-bit (4 bytes) → Range: -2^31 ~ 2^31 - 1&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;long long&lt;/code&gt; : 64-bit (8 bytes) → Range: -2^63 ~ 2^63 - 1&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Why are there so many integer types in C?&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allows programmers to choose appropriate types based on use-case.&lt;/li&gt;
&lt;li&gt;Increasing the bit size extends the range but consumes more memory.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ○ Signed vs Unsigned
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;unsigned&lt;/code&gt;: Represents only non-negative values. No sign bit required.&lt;br&gt;&lt;br&gt;
→ For 32 bits: 0 ~ 2^32 - 1&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;signed&lt;/code&gt;: Includes both positive and negative values (usually default as &lt;code&gt;int&lt;/code&gt;).&lt;br&gt;&lt;br&gt;
→ With 1 bit for sign, 31 bits remain for value: -2^31 ~ 2^31 - 1&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ○ Integer Constant Suffixes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;u&lt;/code&gt; or &lt;code&gt;U&lt;/code&gt; → unsigned (e.g., &lt;code&gt;123u&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;l&lt;/code&gt; or &lt;code&gt;L&lt;/code&gt; → long (e.g., &lt;code&gt;123L&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ul&lt;/code&gt; or &lt;code&gt;UL&lt;/code&gt; → unsigned long (e.g., &lt;code&gt;123UL&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ○ Overflow
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Occurs when data exceeds the size limits of its data type.&lt;/li&gt;
&lt;li&gt;Can lead to incorrect results or system behavior.&lt;/li&gt;
&lt;li&gt;Happens when the sum requires more bits than available.&lt;/li&gt;
&lt;li&gt;If the sign bit in the result differs from operands, overflow occurs.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Always choose data types with sufficient size to prevent overflow.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ○ Symbolic Constants
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Constants expressed using symbols (e.g., &lt;code&gt;#define&lt;/code&gt;) for readability and maintainability.&lt;/li&gt;
&lt;li&gt;Changing a value in one place instead of multiple occurrences makes code maintenance easier.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#define EXCHANGE_RATE 1120    // preferred
&lt;/span&gt;&lt;span class="c1"&gt;// #define EXCHANGE_RATE = 1120; → incorrect&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Symbolic Constant vs Variable
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;#define&lt;/code&gt; is a &lt;strong&gt;preprocessor directive&lt;/strong&gt; and is replaced before compilation.&lt;/li&gt;
&lt;li&gt;It &lt;strong&gt;does not occupy memory&lt;/strong&gt; or have a data type.&lt;/li&gt;
&lt;li&gt;Variables are stored in memory and can be changed at runtime.&lt;/li&gt;
&lt;li&gt;Think of symbolic constants as constant variables that don’t exist in memory.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ○ Data Types and Sizes: (2) Floating Point Types
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;float&lt;/code&gt;: 32-bit (4 bytes) → Single precision, ~7 decimal digits&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;double&lt;/code&gt;: 64-bit (8 bytes) → Double precision, ~15~16 decimal digits&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;long double&lt;/code&gt;: 64-bit+ → Extended precision (compiler-dependent)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Fixed vs Floating Point
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Fixed-point: Simple but limited for large numbers&lt;/li&gt;
&lt;li&gt;Floating-point: Used in science/engineering for representing very large/small numbers&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Floating-point Overflow &amp;amp; Underflow
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Overflow: Too large to represent → often shows &lt;code&gt;inf&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Underflow: Too small to represent&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why decimal for float range but binary for int?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Integers stored in binary → binary ranges (&lt;code&gt;2^n&lt;/code&gt;) are precise and meaningful.&lt;/li&gt;
&lt;li&gt;Floats care about &lt;strong&gt;how many decimal digits can be represented accurately&lt;/strong&gt;, so decimal notation is more informative.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ○ Data Types and Sizes: (3) Character Type
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;char&lt;/code&gt; type stores characters using ASCII codes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Control Characters
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Non-printable characters used for control:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;\0&lt;/code&gt; → null terminator (marks end of string)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\a&lt;/code&gt; → bell (beep sound)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\b&lt;/code&gt; → backspace&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\t&lt;/code&gt; → horizontal tab&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\n&lt;/code&gt; → newline&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\v&lt;/code&gt; → vertical tab&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\f&lt;/code&gt; → form feed&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\r&lt;/code&gt; → carriage return&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\"&lt;/code&gt;, &lt;code&gt;\'&lt;/code&gt;, &lt;code&gt;\\&lt;/code&gt; → literal quote or backslash&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;\0&lt;/code&gt; Null Terminator
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Marks end of a string in memory.&lt;/li&gt;
&lt;li&gt;Strings in C are arrays of characters; they don't store length separately.&lt;/li&gt;
&lt;li&gt;So &lt;code&gt;\0&lt;/code&gt; acts like a period to signify end of the string.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ○ Practice Activities
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Practice 1: &lt;code&gt;sizeof&lt;/code&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;sizeof&lt;/code&gt; to display memory size for various data types and variables.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb33sxuvccvmm05pnh63u.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb33sxuvccvmm05pnh63u.jpg" alt="Image description" width="800" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Practice 2: Currency Converter
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Input USD amount → output converted KRW amount.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Symbolic Constant&lt;/strong&gt; for exchange rate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8nc5glm70gothdxilrg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8nc5glm70gothdxilrg.jpg" alt="Image description" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Practice 3: ASCII &amp;amp; Char Practice
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Print numeric and character values using ASCII codes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8tro51q2slppu18ec0t.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8tro51q2slppu18ec0t.jpg" alt="Image description" width="800" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>c</category>
      <category>programming</category>
      <category>studylog</category>
      <category>adulteducation</category>
    </item>
    <item>
      <title>[Adult Learning Log] C Language - Week 2 Review</title>
      <dc:creator>San Kang</dc:creator>
      <pubDate>Thu, 26 Jun 2025 03:26:54 +0000</pubDate>
      <link>https://dev.to/sankworks/adult-learning-log-c-language-week-2-review-1kgb</link>
      <guid>https://dev.to/sankworks/adult-learning-log-c-language-week-2-review-1kgb</guid>
      <description>&lt;h1&gt;
  
  
  [C Language Week 2] Comments, Preprocessor, Variables, and More
&lt;/h1&gt;

&lt;h2&gt;
  
  
  ○ Key Takeaways from Week 2
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Hands-on practice: Simple calculator, monthly salary calculator&lt;/li&gt;
&lt;li&gt;Learned that most C programs define functions inside the &lt;code&gt;main&lt;/code&gt; function&lt;/li&gt;
&lt;li&gt;Learned three ways to write comments in C&lt;/li&gt;
&lt;li&gt;Understood what a preprocessor is, why it’s used, and the meaning of directives like &lt;code&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Learned the structure of functions and the significance of return values&lt;/li&gt;
&lt;li&gt;Covered variable declarations, identifier naming rules, and standard data types&lt;/li&gt;
&lt;li&gt;Practiced using &lt;code&gt;printf()&lt;/code&gt;, &lt;code&gt;scanf()&lt;/code&gt;, and &lt;code&gt;scanf_s()&lt;/code&gt; functions&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ○ Typical Program Structure
&lt;/h2&gt;

&lt;p&gt;Most programs follow this pattern: &lt;strong&gt;Input → Process → Output&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  ○ Comments in C
&lt;/h2&gt;

&lt;p&gt;C supports the following types of comments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single-line comment:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;  &lt;span class="cm"&gt;/* This is a single-line comment */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Multi-line comment:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;  &lt;span class="cm"&gt;/* This is a
     multi-line
     comment */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Since C99:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;  &lt;span class="c1"&gt;// Comment from here to end of the line&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ○ Preprocessor
&lt;/h2&gt;

&lt;p&gt;Preprocessing refers to tasks performed &lt;strong&gt;before compilation starts&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;#include&lt;/code&gt;: directive to include external files&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;stdio.h&lt;/code&gt;: standard input/output header file

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;stdio&lt;/code&gt; = Standard Input Output
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.h&lt;/code&gt; = Header file&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;This allows access to functions like &lt;code&gt;scanf()&lt;/code&gt; and &lt;code&gt;printf()&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why use header files?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Organize frequently used code (functions, constants, structures, etc.)&lt;/li&gt;
&lt;li&gt;Reduce duplication, improve modularity and maintenance&lt;/li&gt;
&lt;li&gt;Directives like &lt;code&gt;#include&lt;/code&gt; allow reusable code blocks&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example 2:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#define _CRT_SECURE_NO_WARNINGS  // Used in Visual Studio to suppress scanf warnings
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ○ Structure of a Function
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;int&lt;/code&gt;: return type (integer)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;main&lt;/code&gt;: function name (entry point)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;void&lt;/code&gt;: no input parameters&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;{ }&lt;/code&gt;: function body&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;return 0;&lt;/code&gt;: signals successful termination&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;return 0&lt;/code&gt; = Success&lt;br&gt;&lt;br&gt;
&lt;code&gt;return 1&lt;/code&gt; or other values = Error or abnormal termination&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  ○ Variables
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Declaration:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;        &lt;span class="c1"&gt;// Declares integer variable x&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Declares float variable&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Standard Data Types:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Integer types: &lt;code&gt;short&lt;/code&gt;, &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;long long&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Floating-point types: &lt;code&gt;float&lt;/code&gt;, &lt;code&gt;double&lt;/code&gt;, &lt;code&gt;long double&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Character type: &lt;code&gt;char&lt;/code&gt; (read as “character”)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Identifier Rules:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Must consist of letters, digits, and underscores (&lt;code&gt;_&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Cannot contain spaces&lt;/li&gt;
&lt;li&gt;First character must be a letter or &lt;code&gt;_&lt;/code&gt; (not a digit)&lt;/li&gt;
&lt;li&gt;Case-sensitive&lt;/li&gt;
&lt;li&gt;Cannot use reserved keywords (e.g., &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;float&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Good names describe purpose: &lt;code&gt;year&lt;/code&gt;, &lt;code&gt;bank_account&lt;/code&gt;, &lt;code&gt;BankAccount&lt;/code&gt;&lt;br&gt;&lt;br&gt;
Poor names: &lt;code&gt;i&lt;/code&gt;, &lt;code&gt;j&lt;/code&gt;, &lt;code&gt;k&lt;/code&gt; (unclear meaning)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Initialization:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Multiple variables of the same type can be initialized in one line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// Recommended&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;        &lt;span class="c1"&gt;// Not recommended (only height is initialized)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ○ &lt;code&gt;printf()&lt;/code&gt; and &lt;code&gt;scanf()&lt;/code&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;printf()&lt;/code&gt; Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  &lt;span class="c1"&gt;// %d = decimal integer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;%d&lt;/code&gt; tells &lt;code&gt;printf&lt;/code&gt; to print an integer in decimal format&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;scanf()&lt;/code&gt; Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Enter radius: "&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;scanf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%f"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;amp;&lt;/code&gt; (ampersand) passes the &lt;strong&gt;address&lt;/strong&gt; of the variable so &lt;code&gt;scanf()&lt;/code&gt; knows where to store the input&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;○ Omitting &lt;code&gt;&amp;amp;radius&lt;/code&gt; (e.g., &lt;code&gt;scanf("%f", radius);&lt;/code&gt;) will cause an error.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;%lf&lt;/code&gt; to read a &lt;code&gt;double&lt;/code&gt; value (&lt;code&gt;lf&lt;/code&gt; = long float)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ○ &lt;code&gt;scanf()&lt;/code&gt; vs &lt;code&gt;scanf_s()&lt;/code&gt; and Security
&lt;/h2&gt;

&lt;p&gt;In Visual Studio, using &lt;code&gt;scanf()&lt;/code&gt; often triggers a warning recommending &lt;code&gt;scanf_s()&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why?
&lt;/h3&gt;

&lt;p&gt;To &lt;strong&gt;prevent buffer overflow&lt;/strong&gt;, which is a common vulnerability.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;scanf()&lt;/code&gt; without input size limits can cause excessive input to overwrite memory&lt;/li&gt;
&lt;li&gt;This can allow attackers to execute arbitrary code (a classic exploit)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;This technique is known as &lt;strong&gt;pwnable hacking&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Many systems (Windows, Adobe, UNIX tools) have been exploited in the past due to such vulnerabilities&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;scanf_s()&lt;/code&gt; is a &lt;strong&gt;Microsoft-specific&lt;/strong&gt; secure function that forces the developer to specify buffer sizes&lt;/li&gt;
&lt;li&gt;Not portable to Linux/GCC environments → safer alternatives like &lt;code&gt;fgets()&lt;/code&gt; are often used&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  To disable the warning in Visual Studio:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#define _CRT_SECURE_NO_WARNINGS
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ○ Practice Exercises
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Input two numbers and print the sum&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffuuswodm2r0ao107ktsb.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffuuswodm2r0ao107ktsb.jpg" alt="Image description" width="800" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Calculate monthly salary based on annual salary&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3s2texxhf586j9x8srfz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3s2texxhf586j9x8srfz.jpg" alt="Image description" width="800" height="276"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>c</category>
      <category>programming</category>
      <category>studylog</category>
      <category>adulteducation</category>
    </item>
    <item>
      <title>[Adult Learning Log] Data Structures &amp; Algorithms – Week 1 Review</title>
      <dc:creator>San Kang</dc:creator>
      <pubDate>Mon, 16 Jun 2025 04:23:24 +0000</pubDate>
      <link>https://dev.to/sankworks/adult-learning-log-data-structures-algorithms-week-1-review-m8</link>
      <guid>https://dev.to/sankworks/adult-learning-log-data-structures-algorithms-week-1-review-m8</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;○ New Things I Learned&lt;/strong&gt;
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Learned why data structures and algorithms are crucial in computer science.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Understood the notations O, Ω, and Θ used for representing the order (number of operations required to solve a problem), and why Big-O notation is especially important.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Gained a clearer understanding of pseudo-code (or Pseudo-Code), and why logarithmic complexity such as log₂(n) is often used.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;○ Why Are Data Structures and Algorithms Important?&lt;/strong&gt;
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Data structures and algorithms are essential in designing any software or program.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Structure:&lt;/strong&gt; What structure should be used to store and manage the data? / &lt;strong&gt;Algorithm:&lt;/strong&gt; How can we solve the problem efficiently?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Structuring data enables computers to apply algorithms efficiently. These structures are reusable across various programs (generality), and users can use them without knowing the internal implementation (abstraction).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A strong foundation in computer science (i.e., algorithmic thinking) is a must for becoming a competent developer in any field. It is especially important in hiring for entry-level positions, internships, and jobs at large or global companies that often include algorithm tests.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ Algorithm Complexity Analysis&lt;/strong&gt;
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;To write efficient algorithms, we must be able to analyze their complexity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Although measuring execution time is intuitive, it’s not always practical. Instead, we use a concept called "order" that approximates the number of operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Big-O (O):&lt;/strong&gt; Upper bound (worst-case performance)  / &lt;strong&gt;Big-Omega (Ω):&lt;/strong&gt; Lower bound (best-case performance) / &lt;strong&gt;Big-Theta (Θ):&lt;/strong&gt; Tight bound (average-case performance)  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;In practice, Big-O is most commonly used because systems must be designed with the worst-case scenario in mind. Designing based on the best case is unrealistic.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;○ What is Pseudo-Code?&lt;/strong&gt;
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Pseudo-code is a commonly used way to describe algorithms — it presents the core logic in a way that’s easy for humans to understand.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Although it can't be executed directly, it helps visualize the steps of an algorithm clearly. Once understood, it can easily be implemented in any programming language.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Since it is not bound to any specific syntax, there is no strict grammar. However, there are conventional styles that make it readable — you can think of it as the "body language" of the computer science world.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

</description>
      <category>datastructures</category>
      <category>studylog</category>
      <category>algorithms</category>
      <category>adulteducation</category>
    </item>
    <item>
      <title>[Adult Learning Log] Network 1 – Week 1 Review</title>
      <dc:creator>San Kang</dc:creator>
      <pubDate>Fri, 13 Jun 2025 01:05:10 +0000</pubDate>
      <link>https://dev.to/sankworks/adult-learning-log-network-1-week-1-review-563</link>
      <guid>https://dev.to/sankworks/adult-learning-log-network-1-week-1-review-563</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;○ New Things I Learned&lt;/strong&gt;
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;I learned why IP addresses are divided into four parts (e.g., 0000.0000.0000.0000).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I understood the relationship between hostnames and IP addresses.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I finally understood what IPv4, IPv6, and DNS—terms often seen in router settings—actually mean.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;○ IP Address&lt;/strong&gt;
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An IP address is an address system used by the IP protocol at the network layer to identify individual hosts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It consists of 32 binary bits and is usually divided into four 8-bit sections, expressed in decimal format (e.g., 1111.1111.1111.1111).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This commonly used format is called IPv4, where “v4” stands for “version 4.”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;However, with the rapid expansion of the Internet, a more scalable address system became necessary—this led to the development of IPv6.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;IPv6 is composed of 128 bits, divided into eight 16-bit blocks. Each block is expressed as four-digit hexadecimal numbers (ranging from 0 to FFFF).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In most home networks and small websites, IPv4 is still more widely used. Therefore, both IPv4 and IPv6 are often used together in a configuration called Dual Stack.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;○ Hostname&lt;/strong&gt;
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;To connect to a specific host on the Internet, you need its IP address.&lt;br&gt;
However, users prefer to use easily recognizable and meaningful text-based names instead of numeric IP addresses.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;That’s why when a user enters a hostname, a DNS (Domain Name System) server translates it into the corresponding IP address.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A DNS structure is typically divided into four hierarchical levels: Country Domain, Organization Type, Organization Name, and Host, separated by dots (.).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Example:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://www.google.co.kr" rel="noopener noreferrer"&gt;www.google.co.kr&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;→ www (Host), google (Organization Name), co (Organization Type), kr (Country Domain)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Note: The term hostname can refer to the entire name (&lt;a href="http://www.google.co.kr" rel="noopener noreferrer"&gt;www.google.co.kr&lt;/a&gt;), or in a narrower sense, it may specifically refer to the host part (e.g., www for a web server).&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

</description>
      <category>networking</category>
      <category>studylog</category>
      <category>adulteducation</category>
      <category>creditbank</category>
    </item>
    <item>
      <title>[Write Up] Bandit Wargame Clear Log (Level 25 - 33)</title>
      <dc:creator>San Kang</dc:creator>
      <pubDate>Tue, 10 Jun 2025 04:06:53 +0000</pubDate>
      <link>https://dev.to/sankworks/write-up-bandit-wargame-clear-log-level-25-33-25oh</link>
      <guid>https://dev.to/sankworks/write-up-bandit-wargame-clear-log-level-25-33-25oh</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;26. Bandit Level 25 → Level 26&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
Logging in to bandit26 from bandit25 should be fairly easy… The shell for user bandit26 is not /bin/bash, but something else. Find out what it is, how it works and how to break out of it.&lt;/p&gt;

&lt;p&gt;NOTE: if you’re a Windows user and typically use Powershell to ssh into bandit: Powershell is known to cause issues with the intended solution to this level. You should use command prompt instead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ssh, cat, more, vi, ls, id, pwd&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I started by entering &lt;code&gt;ls&lt;/code&gt; to check the files in the current directory.&lt;br&gt;
I found the &lt;code&gt;bandit26.sshkey&lt;/code&gt; file and used the &lt;code&gt;cat&lt;/code&gt; command to view its contents.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdez6k2le39xxhabpe1fc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdez6k2le39xxhabpe1fc.jpg" alt="Image description" width="800" height="653"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;It looked like a valid private key, so I ran &lt;code&gt;ssh -i bandit26.sshkey bandit26@localhost -p 2220&lt;/code&gt; to try logging into bandit26.&lt;br&gt;
The bandit system asked me to confirm the connection, and I typed &lt;code&gt;yes&lt;/code&gt;. Unfortunately, the connection closed immediately after.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu9rlvv5fsf1x8lmx2pdk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu9rlvv5fsf1x8lmx2pdk.jpg" alt="Image description" width="800" height="180"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs6b8drkw8bdiy5rexlbn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs6b8drkw8bdiy5rexlbn.jpg" alt="Image description" width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;To find out what shell bandit26 uses, I ran &lt;code&gt;cat /etc/passwd | grep bandit26&lt;/code&gt;.&lt;br&gt;
The result showed that the shell is a script called &lt;code&gt;showtext&lt;/code&gt;.&lt;br&gt;
I used the &lt;code&gt;cat&lt;/code&gt; command to read it, and I found that it runs the &lt;code&gt;more&lt;/code&gt; command.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2gm0be6mn84ljcibj60q.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2gm0be6mn84ljcibj60q.jpg" alt="Image description" width="800" height="214"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;more&lt;/code&gt; command similar to &lt;code&gt;cat&lt;/code&gt;, but it only displays one screen at a time.&lt;br&gt;
I realized that if the bandit program can not shows full contents at once, the disconnection wouldn't be happen.&lt;br&gt;
So I ran &lt;code&gt;ssh -i bandit26.sshkey bandit26@localhost -p 2220&lt;/code&gt; again and adjusted the terminal screen size much smaller than before. Then entered &lt;code&gt;yes&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5lq4uy7dndsogkaczyym.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5lq4uy7dndsogkaczyym.jpg" alt="Image description" width="432" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;It worked! The connection was fine.&lt;br&gt;
Next, I pressed &lt;code&gt;v&lt;/code&gt; to enter &lt;code&gt;vi&lt;/code&gt; editor mode. And then, I ran &lt;code&gt;:set shell=/bin/bash&lt;/code&gt; to set the shell to &lt;code&gt;bash&lt;/code&gt;.&lt;br&gt;
After that, I entered &lt;code&gt;:sh&lt;/code&gt; to open a shell temporarily without closing the vi editor.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fao7g1qv05yt35gub0d1x.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fao7g1qv05yt35gub0d1x.jpg" alt="Image description" width="800" height="240"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F59q7a50k1xpp7ajgd1m0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F59q7a50k1xpp7ajgd1m0.jpg" alt="Image description" width="800" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqmjn77ata8crxhbg30ua.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqmjn77ata8crxhbg30ua.jpg" alt="Image description" width="800" height="232"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Finally, I logged in Level 26, and got the password for Level 26 using `cat /etc/bandit_pass/bandit26'.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fogiy3ffjpyqyf248ztrn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fogiy3ffjpyqyf248ztrn.jpg" alt="Image description" width="800" height="246"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;##&lt;strong&gt;Bandit Level 26 → Level 27&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
Good job getting a shell! Now hurry and grab the password for bandit27!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ls&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I entered &lt;code&gt;ls&lt;/code&gt; to check the files in the current directory.&lt;br&gt;
I found the &lt;code&gt;bandit27-do&lt;/code&gt; file and executed it to learn how I can use it.&lt;br&gt;
The instruction indicated me that the file runs a command as another user.&lt;br&gt;
So I executed the &lt;code&gt;bandit27-do&lt;/code&gt; file with the &lt;code&gt;id&lt;/code&gt; command.&lt;br&gt;
The result showed me that the Efective  User ID(&lt;code&gt;euid&lt;/code&gt;) is &lt;code&gt;bandit27&lt;/code&gt;. Efective  User ID refers to the user ID that determines the permissions for a process or task.&lt;br&gt;
Based on this, I executed &lt;code&gt;./bandit27-do cat /etc/bandit_pass/bandit27&lt;/code&gt;.&lt;br&gt;
Finally, I successfully retrieved the password for the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpljskzgdjtw2fephquo1.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpljskzgdjtw2fephquo1.jpg" alt="Image description" width="800" height="238"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;##&lt;strong&gt;Bandit Level 27 → Level 28&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
There is a git repository at ssh://bandit27-git@localhost/home/bandit27-git/repo via the port 2220. The password for the user bandit27-git is the same as for the user bandit27.&lt;/p&gt;

&lt;p&gt;Clone the repository and find the password for the next level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
git&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;First of all, I ran &lt;code&gt;man git&lt;/code&gt; to learn about the &lt;code&gt;git&lt;/code&gt; command and its available options.&lt;br&gt;
I found the &lt;code&gt;clone&lt;/code&gt; command, which is used to clone a repository into a new directory.&lt;br&gt;
Next, I created a working directory with &lt;code&gt;mkdir /tmp/sank27&lt;/code&gt; and  moved into it using &lt;code&gt;cd&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkedy24qiqhndo6638rxx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkedy24qiqhndo6638rxx.jpg" alt="Image description" width="800" height="60"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frjtd3o7esu2rwli4vt34.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frjtd3o7esu2rwli4vt34.jpg" alt="Image description" width="800" height="92"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffkd3eu5o0i9c7ko8qwjo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffkd3eu5o0i9c7ko8qwjo.jpg" alt="Image description" width="800" height="258"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Then I entered &lt;code&gt;git clone ssh://bandit27-git@localhost/home/bandit27-git/repo&lt;/code&gt;, but somthing was wrong---I got a "permission denied" error.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcb18jobxvgp2wyglopma.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcb18jobxvgp2wyglopma.jpg" alt="Image description" width="800" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I wondered what I had missed, so I re-read the level instructions carefully.&lt;br&gt;
Then I realized that I had forgotten to include the port number.&lt;br&gt;
I corrected the command to &lt;code&gt;git clone ssh://bandit27-git@localhost:2220/home/bandit27-git/repo&lt;/code&gt;. This time, the system asked for a password, so I entered the one for Level 27.&lt;br&gt;
The cloning process completed successfully. I used &lt;code&gt;ls&lt;/code&gt; to check the contents and then found a directory named &lt;code&gt;repo&lt;/code&gt;. &lt;br&gt;
I moved into it using &lt;code&gt;cd&lt;/code&gt; and used &lt;code&gt;ls&lt;/code&gt; again. There was a &lt;code&gt;README&lt;/code&gt; file inside.&lt;br&gt;
I read it using &lt;code&gt;cat&lt;/code&gt;, and finally, I successfully obtained the password for the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9btsos47qzeouitw2ib.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9btsos47qzeouitw2ib.jpg" alt="Image description" width="800" height="481"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5bo6mgg7tmgzezk0copg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5bo6mgg7tmgzezk0copg.jpg" alt="Image description" width="800" height="511"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;##&lt;strong&gt;Bandit Level 28 → Level 29&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
There is a git repository at ssh://bandit28-git@localhost/home/bandit28-git/repo via the port 2220. The password for the user bandit28-git is the same as for the user bandit28.&lt;/p&gt;

&lt;p&gt;Clone the repository and find the password for the next level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
git&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;First, I created a working directory with &lt;code&gt;mkdir /tmp/sank28&lt;/code&gt; and moved into it using &lt;code&gt;cd&lt;/code&gt;.&lt;br&gt;
Then I ran &lt;code&gt;git clone ssh://bandit28-git@localhost:2220/home/bandit28-git/repo&lt;/code&gt;, and entered the password for Level 28.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5iyvk7x11u6vg1mdcwu5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5iyvk7x11u6vg1mdcwu5.jpg" alt="Image description" width="800" height="662"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;After the cloning process completed  successfully. I used &lt;code&gt;ls&lt;/code&gt; to check the contents and then found a directory named &lt;code&gt;repo&lt;/code&gt;.&lt;br&gt;
I moved into it using &lt;code&gt;cd&lt;/code&gt; and ran &lt;code&gt;ls&lt;/code&gt; again. There was a file named &lt;code&gt;README.md&lt;/code&gt;, and I read it using &lt;code&gt;cat&lt;/code&gt;.&lt;br&gt;
It seemed like the file had included the password for the next level before someone edited it.&lt;br&gt;
So I used the &lt;code&gt;git log&lt;/code&gt; command to check the commit history of the file. And then I noticed that the latest commit was made to fix an information leak.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiibbf58uq0i9970hjvzh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiibbf58uq0i9970hjvzh.jpg" alt="Image description" width="800" height="734"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;So I checked out the previous commit using &lt;code&gt;git checkout&lt;/code&gt; command, and then re-read the &lt;code&gt;README.md&lt;/code&gt; file with &lt;code&gt;cat&lt;/code&gt;.&lt;br&gt;
Finally, I successfully obtained the password for the next level. &lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhlfwe8qc7414xhpdem8z.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhlfwe8qc7414xhpdem8z.jpg" alt="Image description" width="800" height="716"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;##&lt;strong&gt;Bandit Level 29 → Level 30&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
There is a git repository at ssh://bandit29-git@localhost/home/bandit29-git/repo via the port 2220. The password for the user bandit29-git is the same as for the user bandit29.&lt;/p&gt;

&lt;p&gt;Clone the repository and find the password for the next level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
git&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;First, I created a working directory with &lt;code&gt;mkdir /tmp/sank29&lt;/code&gt; and moved into it using &lt;code&gt;cd&lt;/code&gt;.&lt;br&gt;
Then I ran &lt;code&gt;git clone ssh://bandit29-git@localhost:2220/home/bandit29-git/repo&lt;/code&gt;, and entered the password for Level 29.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh6auqwww35wkzcbr1f99.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh6auqwww35wkzcbr1f99.jpg" alt="Image description" width="800" height="679"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;After the cloning process completed  successfully. I used &lt;code&gt;ls&lt;/code&gt; to check the contents and then found a directory named &lt;code&gt;repo&lt;/code&gt;.&lt;br&gt;
I moved into it using &lt;code&gt;cd&lt;/code&gt; and ran &lt;code&gt;ls&lt;/code&gt; again. There was a file named &lt;code&gt;README.md&lt;/code&gt;, and I read it using &lt;code&gt;cat&lt;/code&gt;.&lt;br&gt;
It seemed like the file had included the password for the next level before someone edited it.&lt;br&gt;
I used the &lt;code&gt;git log&lt;/code&gt; command to check the commit history of the file, but I couldn't find any useful clues.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fchxra380xzqq8i1b9s1k.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fchxra380xzqq8i1b9s1k.jpg" alt="Image description" width="800" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;So I ran &lt;code&gt;man git&lt;/code&gt; to learn about the &lt;code&gt;git&lt;/code&gt; command, its subcommands, and options.&lt;br&gt;
I came across the &lt;code&gt;branch&lt;/code&gt; command. It looked useful, but I was not sure how to use it.&lt;br&gt;
So I ran &lt;code&gt;git branch -h, which showed usage examples and general options.&lt;br&gt;
Then I used the &lt;/code&gt;git branch -a&lt;code&gt; to list all branches, and discovered a branch named &lt;/code&gt;dev`.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtkun3rbl8abliwny4hx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtkun3rbl8abliwny4hx.jpg" alt="Image description" width="800" height="69"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5g0l6pigliov7zjz7csb.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5g0l6pigliov7zjz7csb.jpg" alt="Image description" width="800" height="656"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnhnfy5o5icpr1lg2ggj4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnhnfy5o5icpr1lg2ggj4.jpg" alt="Image description" width="800" height="741"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I guessed that developers might have stored the password, so I checked out the &lt;code&gt;dev&lt;/code&gt; branch.&lt;br&gt;
After switching, I ran &lt;code&gt;ls&lt;/code&gt; and re-read the &lt;code&gt;README.md&lt;/code&gt; file using &lt;code&gt;cat&lt;/code&gt;. I successfully found the password for the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhitce8u7smrtma6f4aeu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhitce8u7smrtma6f4aeu.jpg" alt="Image description" width="800" height="719"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;##&lt;strong&gt;Bandit Level 30 → Level 31&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
There is a git repository at ssh://bandit30-git@localhost/home/bandit30-git/repo via the port 2220. The password for the user bandit30-git is the same as for the user bandit30.&lt;/p&gt;

&lt;p&gt;Clone the repository and find the password for the next level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
git&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;First, I created a working directory with &lt;code&gt;mkdir /tmp/sank30&lt;/code&gt; and moved into it using &lt;code&gt;cd&lt;/code&gt;.&lt;br&gt;
Then I ran &lt;code&gt;git clone ssh://bandit30-git@localhost:2220/home/bandit30-git/repo&lt;/code&gt;, and entered the password for current level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoabwfbxjpnr0x5hhhtm.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoabwfbxjpnr0x5hhhtm.jpg" alt="Image description" width="800" height="622"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;After the cloning process completed  successfully. I used &lt;code&gt;ls&lt;/code&gt; to check the contents and then found a directory named &lt;code&gt;repo&lt;/code&gt;.&lt;br&gt;
I moved into it using &lt;code&gt;cd&lt;/code&gt; and ran &lt;code&gt;ls&lt;/code&gt; again. There was a file named &lt;code&gt;README.md&lt;/code&gt;, and I read it using &lt;code&gt;cat&lt;/code&gt;, but I couldn't find useful message.&lt;br&gt;
Next, I used the &lt;code&gt;git log&lt;/code&gt; command to check the commit history of the file, but couldn't find any useful clues.&lt;br&gt;
I also ran &lt;code&gt;git branch&lt;/code&gt;, but still I couldn't get any clues.&lt;br&gt;
So I ran &lt;code&gt;man git&lt;/code&gt; to learn about the &lt;code&gt;git&lt;/code&gt; command, its subcommands, and options.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1z8z2ncbbxxs5fk0egi0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1z8z2ncbbxxs5fk0egi0.jpg" alt="Image description" width="800" height="516"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I came across the &lt;code&gt;tag&lt;/code&gt; command. It looked useful, so I ran &lt;code&gt;git tag&lt;/code&gt; to check if git tags existed.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnbxqnmf5sv10fxfygfnu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnbxqnmf5sv10fxfygfnu.jpg" alt="Image description" width="800" height="74"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;As a result, I found a tag named &lt;code&gt;secret&lt;/code&gt;. I wanted to read it, but the &lt;code&gt;cat&lt;/code&gt; command didn't work for tag.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zkjwxbd4kdbwnw457an.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zkjwxbd4kdbwnw457an.jpg" alt="Image description" width="800" height="707"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;So I ran &lt;code&gt;man git&lt;/code&gt; again, and found out the &lt;code&gt;show&lt;/code&gt; command. I thought that it might work.&lt;br&gt;
I ran &lt;code&gt;git show secret&lt;/code&gt;, and it worked! Finally, I successfully obtained the password for the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmhrnyd7w5tnls4hloxfo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmhrnyd7w5tnls4hloxfo.jpg" alt="Image description" width="800" height="73"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3gxdgckasxny9vr5b5c0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3gxdgckasxny9vr5b5c0.jpg" alt="Image description" width="800" height="118"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;##&lt;strong&gt;Bandit Level 31 → Level 32&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
There is a git repository at ssh://bandit31-git@localhost/home/bandit31-git/repo via the port 2220. The password for the user bandit31-git is the same as for the user bandit31.&lt;/p&gt;

&lt;p&gt;Clone the repository and find the password for the next level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
git&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;First, I created a working directory by running &lt;code&gt;mkdir /tmp/sank31&lt;/code&gt;, then I moved into it.&lt;br&gt;
Next, I cloned the repository using: &lt;code&gt;git clone ssh://bandit31-git@localhost:2220/home/bandit31-git/repo&lt;/code&gt;.&lt;br&gt;
After the cloning process completed, I ran &lt;code&gt;ls&lt;/code&gt; and found a directory named &lt;code&gt;repo&lt;/code&gt;.&lt;br&gt;
I moved into &lt;code&gt;repo&lt;/code&gt; using cd, and used &lt;code&gt;ls&lt;/code&gt; again.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fos5b66fw8dy9iy7h8xa4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fos5b66fw8dy9iy7h8xa4.jpg" alt="Image description" width="800" height="716"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;There was a file named &lt;code&gt;README.md&lt;/code&gt;, and I read it using &lt;code&gt;cat&lt;/code&gt;.&lt;br&gt;
The file instructed me: "This time your task is to push a file to the remote repository", with details.&lt;br&gt;
So, I created a file using &lt;code&gt;vi&lt;/code&gt;, intending to name it &lt;code&gt;key.txt&lt;/code&gt; , but I accidentally named it &lt;code&gt;key.ext&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqlpl1nksdp0sa80rqyrc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqlpl1nksdp0sa80rqyrc.jpg" alt="Image description" width="800" height="197"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F44wrgr2mo8hzn8prc5n5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F44wrgr2mo8hzn8prc5n5.jpg" alt="Image description" width="800" height="771"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;So I crrected name of the file using &lt;code&gt;mv&lt;/code&gt;.&lt;br&gt;
I already knew the steps for pushing a file to a remote git repository.&lt;br&gt;
    1. &lt;code&gt;git add&lt;/code&gt;&lt;br&gt;
    2. &lt;code&gt;git commit&lt;/code&gt;&lt;br&gt;
    3. &lt;code&gt;git psuh&lt;/code&gt;&lt;br&gt;
I first tried &lt;code&gt;git add key.txt&lt;/code&gt;, but it didn't work. The system told me to use &lt;code&gt;-f&lt;/code&gt; opition.&lt;br&gt;
So I corrected the command &lt;code&gt;gat add -f key.txt&lt;/code&gt;. This time, it worked.&lt;br&gt;
Then I entered &lt;code&gt;git commit -m "upload key.txt&lt;/code&gt;. It means that make a memo about "upload key.txt" for commit.&lt;br&gt;
After the commit process completed, I pushed it running &lt;code&gt;git push origin master&lt;/code&gt;. The &lt;code&gt;origin&lt;/code&gt; in my command is a nickname for a remote repository---usually created automatically when you clone a repository.&lt;br&gt;
The system prompted me for a password, so I entered the one for Level 31, and then it gave me the password for the next level.&lt;br&gt;
Finally I could successfully log in for Level 32.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ed1tzm951vf4260jxg1.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ed1tzm951vf4260jxg1.jpg" alt="Image description" width="800" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F753999mo8m9d0mk2dgxs.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F753999mo8m9d0mk2dgxs.jpg" alt="Image description" width="800" height="577"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;##&lt;strong&gt;Bandit Level 32 → Level 33&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
After all this git stuff, it’s time for another escape. Good luck!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
sh, man&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;When I logged into bandit32, I was greeted withe the message: "WELCOME TO THE UPPERCASE SHELL".&lt;br&gt;
I quickly noticed that I couldn't typed command properly---every command I entered was automatically converted to uppercase, which made them invalid in a Linux shell.&lt;br&gt;
I suspected that a custom shell script was being used for this level, one that forces all input to uppercase.&lt;br&gt;
If that was the case, it's likely had a &lt;code&gt;shebang&lt;/code&gt;(#!) at the top, specifying which shell to use.&lt;br&gt;
To bypass the uppercase behavior, I ran &lt;code&gt;$0&lt;/code&gt;, which refers to the current shell script or program, and it worked.&lt;br&gt;
It launched the real shell &lt;code&gt;sh&lt;/code&gt; without the uppercase transformation.&lt;br&gt;
Finally, I successfully obtained the passowordf for the next level by using &lt;code&gt;cat /etc/bandit_pass/bandit33&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj18p8u8zx9knai9h6v7q.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj18p8u8zx9knai9h6v7q.jpg" alt="Image description" width="800" height="237"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;That's it! --- all levels of the OverTheWire Bandit Wargame completed!&lt;br&gt;
I'll be takling more wargames soon, so stay tuned.&lt;br&gt;
Thank you for following along!&lt;/p&gt;

</description>
      <category>linux</category>
      <category>wargame</category>
      <category>bandit</category>
      <category>overthewire</category>
    </item>
    <item>
      <title>[Write Up] Bandit Wargame Clear Log (Level 20 - 25)</title>
      <dc:creator>San Kang</dc:creator>
      <pubDate>Thu, 05 Jun 2025 12:53:11 +0000</pubDate>
      <link>https://dev.to/sankworks/write-up-bandit-wargame-clear-log-level-20-25-1lp</link>
      <guid>https://dev.to/sankworks/write-up-bandit-wargame-clear-log-level-20-25-1lp</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;OverTheWire Bandit Wargame Level 10–20: My Step-by-Step Solutions&lt;/strong&gt;
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;This is the second review about Over the wire : Bandit wargames.&lt;br&gt;
While I studying python3, I explored various area of IT and became interested in cybersecurity.&lt;br&gt;
Then I found the Bandit wargames and totally got hooked.&lt;br&gt;
Starting today, I'll write down how I cleared each level of the wargames. This will be a way for me to improve both computer skills and English writing skills.&lt;br&gt;
Please let me know if I use any awkward expressions or provide incorrect information.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;If you need more details about Bandit wargames, please check this link : &lt;a href="http://www.overthewire.org/wargames" rel="noopener noreferrer"&gt;http://www.overthewire.org/wargames&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;21. Bandit Level 20 → Level 21&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
There is a setuid binary in the homedirectory that does the following: it makes a connection to localhost on the port you specify as a commandline argument. It then reads a line of text from the connection and compares it to the password in the previous level (bandit20). If the password is correct, it will transmit the password for the next level (bandit21).&lt;/p&gt;

&lt;p&gt;NOTE: Try connecting to your own network daemon to see if it works as you think&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ssh, nc, cat, bash, screen, tmux, Unix ‘job control’ (bg, fg, jobs, &amp;amp;, CTRL-Z, …)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I used &lt;code&gt;ls&lt;/code&gt; first to find a setuid binary, and I found the &lt;code&gt;suconnect&lt;/code&gt; file.&lt;br&gt;
Next, I excuted &lt;code&gt;./suconnect&lt;/code&gt; to see how to use it.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp0229l1agjm6f9g006dh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp0229l1agjm6f9g006dh.jpg" alt="Image description" width="800" height="171"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;After that, I opened another terminal emulator and logged into the &lt;code&gt;bandit20&lt;/code&gt; account again.(At first, I made a mistake by not logging into the&lt;code&gt;bandit20&lt;/code&gt; account)&lt;br&gt;
In the second terminal, I ran &lt;code&gt;nc -nlvp 12345&lt;/code&gt; and entered current level's password when prompted.&lt;br&gt;
The &lt;code&gt;-nlvp&lt;/code&gt; option is a combination of four options: &lt;code&gt;-n&lt;/code&gt; means "Do not resolce DNS(use raw IP)", &lt;code&gt;-l&lt;/code&gt; put Netcat in listen mode, &lt;code&gt;-v&lt;/code&gt; enables verbose ouput, and &lt;code&gt;-p&lt;/code&gt; specifies the port number.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkr8szgozs5kdwjnqa8r5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkr8szgozs5kdwjnqa8r5.jpg" alt="Image description" width="800" height="98"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Back in the first terminal, I ran &lt;code&gt;./suconnect 12345&lt;/code&gt;, which connected to the Netcat server and sent the password for the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxvnuwd4xj9ugtoe72m92.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxvnuwd4xj9ugtoe72m92.jpg" alt="Image description" width="800" height="103"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;As a result, I received the password for level 20 in the second terinal and I used it to log in successfully.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxmxzfq0vuojh1o6yzq2n.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxmxzfq0vuojh1o6yzq2n.jpg" alt="Image description" width="800" height="130"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;22. Bandit Level 21 → Level 22&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
A program is running automatically at regular intervals from cron, the time-based job scheduler. Look in /etc/cron.d/ for the configuration and see what command is being executed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
cron, crontab, crontab(5) (use “man 5 crontab” to access this)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I started by using the &lt;code&gt;ls&lt;/code&gt; command to check the files in current directory, but there was nothing there.&lt;br&gt;
Next, I moved into the &lt;code&gt;/etc/cron.d&lt;/code&gt; directory using the &lt;code&gt;cd&lt;/code&gt; command.&lt;br&gt;
Then I ran &lt;code&gt;ls -l&lt;/code&gt;  to view the files in the directory along with their permissions.&lt;br&gt;
I found a file named &lt;code&gt;cronjob_bandit22&lt;/code&gt;, and I read it using the &lt;code&gt;cat&lt;/code&gt; command.&lt;br&gt;
The file indicated that when the cron job runs, it execute a script called &lt;code&gt;cronjob_bandit22.sh&lt;/code&gt;.&lt;br&gt;
So I used &lt;code&gt;cat&lt;/code&gt; again to read the &lt;code&gt;cronjob_bandit22.sh&lt;/code&gt; file. &lt;br&gt;
From the script, I learned that it write the password for the next level to a specific file: &lt;code&gt;/tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv&lt;/code&gt;.&lt;br&gt;
So I ran &lt;code&gt;cat /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv&lt;/code&gt; to read the password.&lt;br&gt;
As a result, I got the password for level 22, so I successfully logged into the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy0kx7zkwxcczpiapp0i8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy0kx7zkwxcczpiapp0i8.jpg" alt="Image description" width="800" height="475"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;23. Bandit Level 22 → Level 23&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
A program is running automatically at regular intervals from cron, the time-based job scheduler. Look in /etc/cron.d/ for the configuration and see what command is being executed.&lt;/p&gt;

&lt;p&gt;NOTE: Looking at shell scripts written by other people is a very useful skill. The script for this level is intentionally made easy to read. If you are having problems understanding what it does, try executing it to see the debug information it prints.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
cron, crontab, crontab(5) (use “man 5 crontab” to access this)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I ran &lt;code&gt;cd /etc/cron.d&lt;/code&gt; and used &lt;code&gt;ls&lt;/code&gt; to check th files in the current directory.&lt;br&gt;
Then I entered &lt;code&gt;cat cronjob_bandit23&lt;/code&gt; to read the file. It indicated that a cronjub runs a script called &lt;code&gt;cronjob_bandit23.sh&lt;/code&gt;.&lt;br&gt;
So I used &lt;code&gt;cat&lt;/code&gt; again to read the 'cronjob_bandit23.sh` file.&lt;br&gt;
From the script, I learned that it copy the file to a sepcific path using the current user's name.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3yehyi7sg2xtcoa3kv5q.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3yehyi7sg2xtcoa3kv5q.jpg" alt="Image description" width="800" height="458"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I copied the code in the script and created a new file named &lt;code&gt;key23.sh&lt;/code&gt; using the &lt;code&gt;vi&lt;/code&gt; command.&lt;br&gt;
I replaced &lt;code&gt;$(whoami)&lt;/code&gt; with &lt;code&gt;bandit23&lt;/code&gt; in the script to make it work manually.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0gopyb2f6ltjqrxghxpy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0gopyb2f6ltjqrxghxpy.jpg" alt="Image description" width="800" height="317"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feivux3m7jc4i95s4fep6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feivux3m7jc4i95s4fep6.jpg" alt="Image description" width="800" height="733"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;After saving the file, I changed it's permissions to 777 using &lt;code&gt;chmod&lt;/code&gt;, and then executed it.&lt;br&gt;
The password for 23 level was copied to &lt;code&gt;/tmp/8ca319486bfbbc3663ea0fbe813263491&lt;/code&gt;.&lt;br&gt;
Finally, I ran &lt;code&gt;cat /tmp/8ca319486bfbbc3663ea0fbe81326349&lt;/code&gt; to read the password.&lt;br&gt;
As a result, I got the password for level 23.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3mpcb0gto763fsuoxahf.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3mpcb0gto763fsuoxahf.jpg" alt="Image description" width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;24. Bandit Level 23 → Level 24&lt;/strong&gt; (I spent so much time in this level!!)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
A program is running automatically at regular intervals from cron, the time-based job scheduler. Look in /etc/cron.d/ for the configuration and see what command is being executed.&lt;/p&gt;

&lt;p&gt;NOTE: This level requires you to create your own first shell-script. This is a very big step and you should be proud of yourself when you beat this level!&lt;/p&gt;

&lt;p&gt;NOTE 2: Keep in mind that your shell script is removed once executed, so you may want to keep a copy around…&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
chmod, cron, crontab, crontab(5) (use “man 5 crontab” to access this)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I ran &lt;code&gt;cd /etc/cron.d&lt;/code&gt; and used the &lt;code&gt;ls&lt;/code&gt; command to check the files in the current directory. &lt;br&gt;
I found a file named &lt;code&gt;cronjob_bandit24&lt;/code&gt;, so I entered &lt;code&gt;cat cronjob_bandit24&lt;/code&gt; to read it.&lt;br&gt;
The file indicated that a cronjob excutes a script called &lt;code&gt;cronjob_bandit24.sh&lt;/code&gt;.&lt;br&gt;
By the way, the &lt;code&gt;*****&lt;/code&gt; format represents the cron schedule: miniute, hour, day of month, month, day of week, respectively.&lt;br&gt;
I used &lt;code&gt;cat&lt;/code&gt; again to read the 'cronjob_bandit24.sh&lt;code&gt; file.&lt;br&gt;
From the script, I learn that it executes and deletes all files in a specific specific directory---in this case, &lt;/code&gt;/var/spool/bandit24/foo`.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmdwrpszq5nr1vcq9vyqk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmdwrpszq5nr1vcq9vyqk.jpg" alt="Image description" width="800" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I moved into &lt;code&gt;/var/stool/bandit24/foo&lt;/code&gt; derectory using &lt;code&gt;cd&lt;/code&gt; and I tried to use the &lt;code&gt;ls&lt;/code&gt; command, but I couldn't, because I had no permission.&lt;br&gt;
Because I wanted to creat a shell-script, I used the &lt;code&gt;echo&lt;/code&gt; command, which immediately wries a string to a file: &lt;code&gt;echo "cat /etc/bandit_pass/bandit24 &amp;gt; /tmp/passwd24" &amp;gt; sank24.sh&lt;/code&gt;&lt;br&gt;
(I could have used the &lt;code&gt;vi&lt;/code&gt; command as before, but I choose &lt;code&gt;echo&lt;/code&gt; this time because it was simpler.)&lt;br&gt;
Then, I and changed permissions of &lt;code&gt;sank24.sh&lt;/code&gt; to 777 using &lt;code&gt;chmod&lt;/code&gt;, so the cronjob could execute it.&lt;br&gt;
I confirmed the permission using &lt;code&gt;ls -l&lt;/code&gt;, then waited. Eventually, &lt;code&gt;sank24.sh&lt;/code&gt; was deleted by the cronjob, and &lt;code&gt;passwd24&lt;/code&gt; appeared int the &lt;code&gt;/tmp&lt;/code&gt; directory.&lt;br&gt;
Finally, the &lt;code&gt;passwd24&lt;/code&gt; file was appeared, and I successfully got the password for the next level by reading it.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flu09pqta3dawc8drcwlk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flu09pqta3dawc8drcwlk.jpg" alt="Image description" width="800" height="363"&gt;&lt;/a&gt; &lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;25. Bandit Level 24 → Level 25&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
A daemon is listening on port 30002 and will give you the password for bandit25 if given the password for bandit24 and a secret numeric 4-digit pincode. There is no way to retrieve the pincode except by going through all of the 10000 combinations, called brute-forcing.&lt;br&gt;
You do not need to create new connections each time&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;It was obvious that I had to write code that automatically submits this level's password along with all possible 4-digit pincodes.&lt;br&gt;
So, I ran &lt;code&gt;mkdir /tmp/sank25&lt;/code&gt; to make a working directory, and moved into it.&lt;br&gt;
Since Python3 was the most familiar programing language to me, I decided to use it. I checked the path of &lt;code&gt;python3&lt;/code&gt; using &lt;code&gt;which python3.&lt;br&gt;
Then I create a Python script named&lt;/code&gt;auto.py` with the following content:&lt;/p&gt;
&lt;h1&gt;
  
  
  !/usr/bin/python3
&lt;/h1&gt;

&lt;p&gt;for i in range(10000):&lt;br&gt;
    a = "gb8KRRCsshuZXI0tUuR6ypOFjiZbf3G8 "&lt;br&gt;
    b = f"{i:04d}"&lt;br&gt;
    print(a+b)&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhexaln94f9nn0r1wz0ss.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhexaln94f9nn0r1wz0ss.jpg" alt="Image description" width="800" height="174"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe8l2o730afgswo3vvkyb.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe8l2o730afgswo3vvkyb.jpg" alt="Image description" width="800" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;After saving the file, I tried to excute it, but Oops! I got a "permission denied" error.&lt;br&gt;
So, I changed permissions of the &lt;code&gt;auto.py&lt;/code&gt; script using &lt;code&gt;chmod&lt;/code&gt;. Then tried again.&lt;br&gt;
The code worked! So I ran &lt;code&gt;./auto.py | nc localhost 30002&lt;/code&gt; to find the password for the next level.&lt;br&gt;
My command worked successfully, so got the password.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4p7yw1z744kfwdby4bfq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4p7yw1z744kfwdby4bfq.jpg" alt="Image description" width="800" height="647"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ql7ur63z9qvvbhkn0es.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ql7ur63z9qvvbhkn0es.jpg" alt="Image description" width="800" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foqgwceqycy8slxnecx3c.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foqgwceqycy8slxnecx3c.jpg" alt="Image description" width="800" height="189"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Then I realized that using &lt;code&gt;grep&lt;/code&gt; would help filter the output more clearly. &lt;br&gt;
So I entered &lt;code&gt;./auto.py | nc localhost 30002&lt;/code&gt; and add &lt;code&gt;grep -v&lt;/code&gt; with &lt;code&gt;|&lt;/code&gt; symbol. The &lt;code&gt;-v&lt;/code&gt; option means &lt;code&gt;invert match&lt;/code&gt;, so it helps to select nonmatching lines.&lt;br&gt;
That was how I retrieved the password for the next level. I then used it to log into Level 25.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb7t9a3zxh1ahyz3qyl88.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb7t9a3zxh1ahyz3qyl88.jpg" alt="Image description" width="800" height="164"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;I’m continuing with higher levels, and I’ll post my solutions step by step.&lt;br&gt;
If you find this helpful or want to follow along, feel free to leave a comment!&lt;/p&gt;

</description>
      <category>linux</category>
      <category>wargame</category>
      <category>bandit</category>
      <category>overthewire</category>
    </item>
    <item>
      <title>[Write Up] Bandit Wargame Clear Log (Level 10 - 20)</title>
      <dc:creator>San Kang</dc:creator>
      <pubDate>Fri, 30 May 2025 04:47:56 +0000</pubDate>
      <link>https://dev.to/sankworks/write-up-bandit-wargame-clear-log-level-10-20-2042</link>
      <guid>https://dev.to/sankworks/write-up-bandit-wargame-clear-log-level-10-20-2042</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;OverTheWire Bandit Wargame Level 10–20: My Step-by-Step Solutions&lt;/strong&gt;
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;This is the second review about Over the wire : Bandit wargames.&lt;br&gt;
While I studying python3, I explored various area of IT and became interested in cybersecurity.&lt;br&gt;
Then I found the Bandit wargames and totally got hooked.&lt;br&gt;
Starting today, I'll write down how I cleared each level of the wargames. This will be a way for me to improve both computer skills and English writing skills.&lt;br&gt;
Please let me know if I use any awkward expressions or provide incorrect information.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;If you need more details about Bandit wargames, please check this link : &lt;a href="http://www.overthewire.org/wargames" rel="noopener noreferrer"&gt;http://www.overthewire.org/wargames&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;11. Bandit Level 10 → Level 11&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in the file data.txt, which contains base64 encoded data&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Reading Material&lt;/strong&gt;&lt;br&gt;
Base64 on Wikipedia&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I soved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I entered the &lt;code&gt;ls&lt;/code&gt; command first, and then I found the &lt;code&gt;data.txt&lt;/code&gt; file which contained base64 encoded data.&lt;br&gt;
So I decoded it using the &lt;code&gt;base64&lt;/code&gt; command with the &lt;code&gt;-d&lt;/code&gt; option, which stands for decode.&lt;br&gt;
After I added &lt;code&gt;data.txt&lt;/code&gt;, I pressed the &lt;code&gt;Enter&lt;/code&gt; key. Then the password popped up, so I logged into level 11.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh99rmb0lmd2m5iwyixc6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh99rmb0lmd2m5iwyixc6.jpg" alt="Image description" width="800" height="227"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;12. Bandit Level 11 → Level 12&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in the file data.txt, where all lowercase (a-z) and uppercase (A-Z) letters have been rotated by 13 positions&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Reading Material&lt;/strong&gt;&lt;br&gt;
Rot13 on Wikipedia&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I soved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I started by entering &lt;code&gt;ls&lt;/code&gt; to check the files in the current directory and I found the &lt;code&gt;data.txt&lt;/code&gt; file.&lt;br&gt;
I tried to read it using &lt;code&gt;cat&lt;/code&gt;, but the contents were unreadable. To understand it, I needed to decode the letters.&lt;br&gt;
So I used the &lt;code&gt;tr&lt;/code&gt; command which helps translate or delete characters.&lt;br&gt;
I used the arguments &lt;code&gt;'[A-Za-z]'&lt;/code&gt; and  &lt;code&gt;'[N-ZA-Mn-za-m]'&lt;/code&gt; to define the ROT13 transformation, conbined with the '|' symbol to pipe the contets form &lt;code&gt;cat&lt;/code&gt;.&lt;br&gt;
As a result, I found the password for the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd0y50j1chxo8999wxg63.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd0y50j1chxo8999wxg63.jpg" alt="Image description" width="800" height="285"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;13. Bandit Level 12 → Level 13&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in the file data.txt, which is a hexdump of a file that has been repeatedly compressed. For this level it may be useful to create a directory under /tmp in which you can work. Use mkdir with a hard to guess directory name. Or better, use the command “mktemp -d”. Then copy the datafile using cp, and rename it using mv (read the manpages!)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd, mkdir, cp, mv, file&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Reading Material&lt;/strong&gt;&lt;br&gt;
Hex dump on Wikipedia&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I soved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I found the &lt;code&gt;data.txt&lt;/code&gt; file using the &lt;code&gt;ls&lt;/code&gt; command. After that, I made the &lt;code&gt;sank12&lt;/code&gt; directory in the &lt;code&gt;temp&lt;/code&gt; directory to solve this game more easier.&lt;br&gt;
Then I copied the &lt;code&gt;data.txt&lt;/code&gt; file using the &lt;code&gt;cp&lt;/code&gt; command into the &lt;code&gt;sank12&lt;/code&gt; directory.&lt;br&gt;
I moved into the &lt;code&gt;sank12&lt;/code&gt; directory using the &lt;code&gt;cd&lt;/code&gt; command, and then I typed &lt;code&gt;ls&lt;/code&gt; to find the &lt;code&gt;data.txt&lt;/code&gt; file.&lt;br&gt;
Next, I entered the &lt;code&gt;xxd&lt;/code&gt; command with the &lt;code&gt;-r&lt;/code&gt; option to decode the &lt;code&gt;data.txt&lt;/code&gt; file. But it was unreadable.&lt;br&gt;
So I added the &lt;code&gt;&amp;gt;&lt;/code&gt; symbol and a new file name -- in this case, &lt;code&gt;bandit12&lt;/code&gt; to save the result.&lt;br&gt;
I checked the files in the current directory using &lt;code&gt;ls&lt;/code&gt;. The &lt;code&gt;bandit12&lt;/code&gt; file apeared.&lt;br&gt;
I needed to know what the &lt;code&gt;bandit12&lt;/code&gt; file type is. So I used the &lt;code&gt;file&lt;/code&gt; command to check and then I knew it was &lt;code&gt;gzip&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ztppammmzx53eras25m.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ztppammmzx53eras25m.jpg" alt="Image description" width="800" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Before I decoded it, I had to change the file extension to &lt;code&gt;gz&lt;/code&gt;. So I entered &lt;code&gt;mv bandit12 bandit12.gz&lt;/code&gt;, which means "I want to move the &lt;code&gt;bandit&lt;/code&gt; file to the &lt;code&gt;bandit.gz&lt;/code&gt; file.&lt;br&gt;
Then I decoded the &lt;code&gt;bandit.gz&lt;/code&gt; file using the &lt;code&gt;gunzip&lt;/code&gt; command. After that, I entered &lt;code&gt;ls&lt;/code&gt; again and I found the &lt;code&gt;bandit&lt;/code&gt; file.&lt;br&gt;
I used the &lt;code&gt;file&lt;/code&gt; command again, so I could catch that the &lt;code&gt;bandit12&lt;/code&gt;file was compressed by &lt;code&gt;bzip2&lt;/code&gt;.&lt;br&gt;
I changed the &lt;code&gt;bandit12&lt;/code&gt; file to &lt;code&gt;bandit12.bz2&lt;/code&gt;, and I decoded it using the &lt;code&gt;bzip2&lt;/code&gt; command with the &lt;code&gt;-d&lt;/code&gt; option.&lt;br&gt;
And then, I entered the &lt;code&gt;ls&lt;/code&gt; command again. I found the &lt;code&gt;bandit12&lt;/code&gt; file, so I used the &lt;code&gt;file&lt;/code&gt; command again to know what the bandit12&lt;code&gt;file type is.&lt;br&gt;
It was gzip, so I decoded it using the&lt;/code&gt;gunzip&lt;code&gt;command. And then, the&lt;/code&gt;bandit12&lt;code&gt;file apeared.&lt;br&gt;
I checked the type of the&lt;/code&gt;bandit12&lt;code&gt;file using the&lt;/code&gt;file&lt;code&gt;command. It was  the&lt;/code&gt;tar&lt;code&gt;.&lt;br&gt;
I entered&lt;/code&gt;mv bandit12 bandit12.tar&lt;code&gt;, and then I typed&lt;/code&gt;tar -xf bandit12.tar&lt;code&gt;to decode the&lt;/code&gt;bandit12&lt;code&gt;file.&lt;br&gt;
After that, I entered&lt;/code&gt;ls&lt;code&gt;to check the files in the current directory. And I found the&lt;/code&gt;data5.bin&lt;code&gt;file.&lt;br&gt;
I used the&lt;/code&gt;file&lt;code&gt;command, so I knew the typed of the&lt;/code&gt;data5.bin` file was tar.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F81wpf3gegfingo3wjq4z.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F81wpf3gegfingo3wjq4z.jpg" alt="Image description" width="800" height="597"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I entered &lt;code&gt;mv data5.bin data5.tar&lt;/code&gt;. Then I typed &lt;code&gt;tar -xf data5.tar&lt;/code&gt;. After that I used the &lt;code&gt;ls&lt;/code&gt; command.&lt;br&gt;
I found the &lt;code&gt;data6.bin&lt;/code&gt; file. I used the &lt;code&gt;file&lt;/code&gt; command to check the type of the file and then I knew it was &lt;code&gt;tar&lt;/code&gt;.&lt;br&gt;
I entered &lt;code&gt;mv data6.bin data5.tar&lt;/code&gt;. Then I typed &lt;code&gt;tar -xf data6.tar&lt;/code&gt;. After that I used the &lt;code&gt;ls&lt;/code&gt; command.&lt;br&gt;
I found the &lt;code&gt;data8.bin&lt;/code&gt; file. When I checked it using the &lt;code&gt;file&lt;/code&gt; command, it was &lt;code&gt;gzip&lt;/code&gt;.&lt;br&gt;
So I changed the file name to &lt;code&gt;data8gz&lt;/code&gt;, and then I tried to decode it using the &lt;code&gt;gunzip&lt;/code&gt; command.&lt;br&gt;
As a result, the &lt;code&gt;data8&lt;/code&gt; file  apeared. It was the &lt;code&gt;ASCII text&lt;/code&gt; file.&lt;br&gt;
So I used the &lt;code&gt;cat&lt;/code&gt; command to read the file and finally I found the password for the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbz0siwh067c1xflhm3m.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbz0siwh067c1xflhm3m.jpg" alt="Image description" width="800" height="558"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;14. Bandit Level 13 → Level 14&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in /etc/bandit_pass/bandit14 and can only be read by user bandit14. For this level, you don’t get the next password, but you get a private SSH key that can be used to log into the next level. Note: localhost is a hostname that refers to the machine you are working on&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ssh, telnet, nc, openssl, s_client, nmap&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Reading Material&lt;/strong&gt;&lt;br&gt;
SSH/OpenSSH/Keys&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;First of all, I entered the &lt;code&gt;id&lt;/code&gt; command to check my current user ID. It's &lt;code&gt;bandit13&lt;/code&gt;.&lt;br&gt;
So it was clear that I could not read the &lt;code&gt;bandit14&lt;/code&gt; file.##&lt;strong&gt;13. Bandit Level 13 → Level 14&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in /etc/bandit_pass/bandit14 and can only be read by user bandit14. For this level, you don’t get the next password, but you get a private SSH key that can be used to log into the next level. Note: localhost is a hostname that refers to the machine you are working on&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ssh, telnet, nc, openssl, s_client, nmap&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Reading Material&lt;/strong&gt;&lt;br&gt;
SSH/OpenSSH/Keys&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;First of all, I entered the &lt;code&gt;id&lt;/code&gt; command to check my current user ID which was &lt;code&gt;bandit13&lt;/code&gt;.&lt;br&gt;
So it was clear that I could not read the &lt;code&gt;bandit14&lt;/code&gt; file directly.&lt;br&gt;
I used the &lt;code&gt;ls&lt;/code&gt; command to check the files in the current directory and found the &lt;code&gt;sshkey.private&lt;/code&gt; file.&lt;br&gt;
Next, I used the &lt;code&gt;man&lt;/code&gt; command with &lt;code&gt;ssh&lt;/code&gt; to find an option that aloows using a private key. &lt;br&gt;
I found that the &lt;code&gt;-i&lt;/code&gt; option let me specify the identity file for public key authentication.&lt;br&gt;
So I entered the &lt;code&gt;ssh&lt;/code&gt; command with the &lt;code&gt;-i sshkey.private&lt;/code&gt; option.&lt;br&gt;
Then, I added &lt;code&gt;bandit14@locahost -p 2220&lt;/code&gt; that the address which I wanted to logged in.&lt;br&gt;
The bandit system asked me to continue, and I entered &lt;code&gt;yes&lt;/code&gt;. Finally I logged into &lt;code&gt;bandit14&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0wtg4tx6idcnvv1qwxa0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0wtg4tx6idcnvv1qwxa0.jpg" alt="Image description" width="800" height="586"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  **15. Bandit Level 14 → Level 15
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level can be retrieved by submitting the password of the current level to port 30000 on localhost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ssh, telnet, nc, openssl, s_client, nmap&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Reading Material&lt;/strong&gt;&lt;br&gt;
How the Internet works in 5 minutes (YouTube) (Not completely accurate, but good enough for beginners)&lt;br&gt;
IP Addresses&lt;br&gt;
IP Address on Wikipedia&lt;br&gt;
Localhost on Wikipedia&lt;br&gt;
Ports&lt;br&gt;
Port (computer networking) on Wikipedia&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I started by entering &lt;code&gt;cat /etc/bandit_pass/bandit14&lt;/code&gt; to find the current password.&lt;br&gt;
After I found the password, I used the &lt;code&gt;nc&lt;/code&gt; command. The &lt;code&gt;nc&lt;/code&gt; command  stands for &lt;code&gt;netcat&lt;/code&gt;, which is short for &lt;code&gt;network&lt;/code&gt; and the &lt;code&gt;cat&lt;/code&gt; command.&lt;br&gt;
Then I add the localhost IP address(127.0.0.1) and port number(30000), and I pressed the &lt;code&gt;Enter&lt;/code&gt; key.&lt;br&gt;
Then I entered the current level password. As a result, I got the password for the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzvpr0c6wsypde6ui59yx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzvpr0c6wsypde6ui59yx.jpg" alt="Image description" width="800" height="262"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;16. Bandit Level 15 → Level 16&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level can be retrieved by submitting the password of the current level to port 30001 on localhost using SSL/TLS encryption.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful note&lt;/strong&gt;: Getting “DONE”, “RENEGOTIATING” or “KEYUPDATE”? Read the “CONNECTED COMMANDS” section in the manpage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ssh, telnet, nc, ncat, socat, openssl, s_client, nmap, netstat, ss&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Reading Material&lt;/strong&gt;&lt;br&gt;
Secure Socket Layer/Transport Layer Security on Wikipedia&lt;br&gt;
OpenSSL Cookbook - Testing with OpenSSL&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;First of all, I entered &lt;code&gt;cat /etc/bandit_pass/bandit15&lt;/code&gt; to find the current level's password.&lt;br&gt;
Next, I ran the &lt;code&gt;openssl&lt;/code&gt; command with the &lt;code&gt;s_client&lt;/code&gt; subcommand(I made many mistakes here at first---I kept using &lt;code&gt;-s_client&lt;/code&gt;, but you should not use the dash. It's a subcommand, not an option.)&lt;br&gt;
The &lt;code&gt;s_client&lt;/code&gt; subcommand helps you connect directly to an SSL/TLS serever.&lt;br&gt;
Then I added the &lt;code&gt;-connect&lt;/code&gt; option with the address &lt;code&gt;localhost:30001 and pressed &lt;/code&gt;Enter`.&lt;br&gt;
Once connected, I pasted the current level's password. As a result, I got the password for the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff7upj2rx96k6lnqrv8sm.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff7upj2rx96k6lnqrv8sm.jpg" alt="Image description" width="800" height="74"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8itxnu6tnagb7xasixfh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8itxnu6tnagb7xasixfh.jpg" alt="Image description" width="800" height="162"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;17. Bandit Level 16 → Level 17&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The credentials for the next level can be retrieved by submitting the password of the current level to a port on localhost in the range 31000 to 32000. First find out which of these ports have a server listening on them. Then find out which of those speak SSL/TLS and which don’t. There is only 1 server that will give the next credentials, the others will simply send back to you whatever you send to it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful note&lt;/strong&gt;: Getting “DONE”, “RENEGOTIATING” or “KEYUPDATE”? Read the “CONNECTED COMMANDS” section in the manpage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ssh, telnet, nc, ncat, socat, openssl, s_client, nmap, netstat, ss&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Reading Material&lt;/strong&gt;&lt;br&gt;
Port scanner on Wikipedia&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I started by entering &lt;code&gt;cat /etc/bandit_pass/bandit16&lt;/code&gt; to find the password for the current level.&lt;br&gt;
Next, I entered the &lt;code&gt;nc&lt;/code&gt; command with the &lt;code&gt;-r -w 1 -z&lt;/code&gt; option.&lt;br&gt;
The &lt;code&gt;-r&lt;/code&gt; option makes to scan ports in a random order instead of sequentially. It helps you avoid detection by intrusion detection systems(IDS) by making scan patterns unpredictable.&lt;br&gt;
The &lt;code&gt;-w 1&lt;/code&gt; option sets limits the connection attimpt timeout to 1 second. This option helps you speed up scans and avoid hanging on unresponsive ports.&lt;br&gt;
The &lt;code&gt;-z&lt;/code&gt; option means to check connection without sending or receicing any data. If you want to check only the ports are opened or not, this option will be help.&lt;br&gt;
As a result, I found five opended ports, so I tried to find out which of those speak SSL/TLS one by one.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fskgbg27osf54idhv3d89.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fskgbg27osf54idhv3d89.jpg" alt="Image description" width="800" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I tried &lt;code&gt;port 31046&lt;/code&gt; first by using &lt;code&gt;openssl s_client -connect localhost:31046&lt;/code&gt;, but it didn't support SSL/TLS.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl20v7ag985axiag7aq37.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl20v7ag985axiag7aq37.jpg" alt="Image description" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;So I moved on to the next one: I entered &lt;code&gt;openssl s_client -connect localhost:31790&lt;/code&gt;, and it worked!&lt;br&gt;
Once connected, I pasted the current level's password. However, it only reurned a single message---&lt;code&gt;KEYUPDATE&lt;/code&gt;, and nothing else.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fscwimaum9yxrss0fxkqj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fscwimaum9yxrss0fxkqj.jpg" alt="Image description" width="800" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8n7u0g4l5yjqcnabmiw0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8n7u0g4l5yjqcnabmiw0.jpg" alt="Image description" width="800" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;That felt suspicious because the wargame description stated: &lt;em&gt;"There is only 1 server that will give the next credentials, the others will simply send back to you whatever you send to it."&lt;/em&gt;&lt;br&gt;
So I retried the same command, but dhis time I added the &lt;code&gt;-ign_eof&lt;/code&gt; option, which allows you to keep reading input even after the server disconnects. &lt;br&gt;
I ran the command again and pasted the current level's password. This time, the server responded with an RSA private key.&lt;br&gt;
I saved the key as &lt;code&gt;key16&lt;/code&gt; inside the &lt;code&gt;/tmp/sank16&lt;/code&gt; directory.&lt;br&gt;
Then I tried to log in to the next level using the command: &lt;code&gt;ssh -i key16 bandit17@localhost -p 2220&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnueh8a1ee7iqvei841va.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnueh8a1ee7iqvei841va.jpg" alt="Image description" width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzrh5gchy5dqy3of695j5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzrh5gchy5dqy3of695j5.jpg" alt="Image description" width="800" height="692"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2mmxkfbsvfadivw0o7py.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2mmxkfbsvfadivw0o7py.jpg" alt="Image description" width="800" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;But I was denied., because permissions on the &lt;code&gt;key16&lt;/code&gt; file were too open.&lt;br&gt;
I checked the file permissions using &lt;code&gt;ls -l key16&lt;/code&gt; and then fixed it with &lt;code&gt;chmod 700 key16&lt;/code&gt;.&lt;br&gt;
After that, I retried the SSH login---and it worked!&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F38zl42dprlv6xgc65esk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F38zl42dprlv6xgc65esk.jpg" alt="Image description" width="800" height="746"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;18. Bandit Level 17 → Level 18&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
There are 2 files in the homedirectory: passwords.old and passwords.new. The password for the next level is in passwords.new and is the only line that has been changed between passwords.old and passwords.new&lt;/p&gt;

&lt;p&gt;NOTE: if you have solved this level and see ‘Byebye!’ when trying to log into bandit18, this is related to the next level, bandit19&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
cat, grep, ls, diff&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I started by entering &lt;code&gt;ls&lt;/code&gt; to check the files in the current directory, and I found two files: &lt;code&gt;passwords.new&lt;/code&gt; and &lt;code&gt;password.old&lt;/code&gt;.&lt;br&gt;
I used the &lt;code&gt;diff&lt;/code&gt; command to check the difference with those two files. I entered &lt;code&gt;diff passwords.new passwords.old&lt;/code&gt;.&lt;br&gt;
As a result, I found the password for the next level. So I logged into level 18.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flio3id2zi1zv28p9vsnd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flio3id2zi1zv28p9vsnd.jpg" alt="Image description" width="800" height="298"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;19. Bandit Level 18 → Level 19&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in a file readme in the homedirectory. Unfortunately, someone has modified .bashrc to log you out when you log in with SSH.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ssh, ls, cat&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;The wargame discripion stated: &lt;em&gt;"Someone has modified .bashrc to log you out when you log in with SSH."&lt;/em&gt;&lt;br&gt;
&lt;code&gt;.bashrc&lt;/code&gt; is a user-level script that runs automatically when a &lt;code&gt;bash shell&lt;/code&gt; is started, so I needed to bypass or avoid it.&lt;br&gt;
To do that, I entered &lt;code&gt;ssh bandit18@bandit.labs.overthewire.org -p 2220 /bin/sh&lt;/code&gt;, which starts a &lt;code&gt;sh&lt;/code&gt; shell instead of  &lt;code&gt;bash&lt;/code&gt;.&lt;br&gt;
I succefully logged into level 18, then I used the &lt;code&gt;ls&lt;/code&gt; command and found the &lt;code&gt;readme&lt;/code&gt; file.&lt;br&gt;
Finally I ran &lt;code&gt;cat readme&lt;/code&gt; and got the password for the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcme2frxz6kd0zgv1eo7y.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcme2frxz6kd0zgv1eo7y.jpg" alt="Image description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;20. Bandit Level 19 → Level 20&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
To gain access to the next level, you should use the setuid binary in the homedirectory. Execute it without arguments to find out how to use it. The password for this level can be found in the usual place (/etc/bandit_pass), after you have used the setuid binary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Reading Material&lt;/strong&gt;&lt;br&gt;
setuid on Wikipedia&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I started by entering &lt;code&gt;ls&lt;/code&gt; to check the files in the current directory.&lt;br&gt;
I found the &lt;code&gt;bandit20-do&lt;/code&gt; file and executed it to see how to use it.&lt;br&gt;
The file allows me to run a command as another user---in this case, bandit20.&lt;br&gt;
So I ran &lt;code&gt;./bandit20-do cat etc/bandit_pass/bandit20&lt;/code&gt; and got the passoword for level 20.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F40aepddef4pk2mgir74u.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F40aepddef4pk2mgir74u.jpg" alt="Image description" width="800" height="309"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;I’m continuing with higher levels, and I’ll post my solutions step by step.&lt;br&gt;
If you find this helpful or want to follow along, feel free to leave a comment!&lt;/p&gt;

</description>
      <category>linux</category>
      <category>wargame</category>
      <category>bandit</category>
      <category>overthewire</category>
    </item>
    <item>
      <title>[Write Up] Bandit Wargame Clear Log (Level 0 - 10)</title>
      <dc:creator>San Kang</dc:creator>
      <pubDate>Mon, 26 May 2025 06:32:13 +0000</pubDate>
      <link>https://dev.to/sankworks/write-up-bandit-wargame-clear-log-level-0-10-3mng</link>
      <guid>https://dev.to/sankworks/write-up-bandit-wargame-clear-log-level-0-10-3mng</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;OverTheWire Bandit Wargame Level 0–10: My Step-by-Step Solutions&lt;/strong&gt;
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;This is the first review about Over the wire : Bandit wargames.&lt;br&gt;
While I studying python3, I explored various area of IT and became interested in cybersecurity.&lt;br&gt;
Then I found the Bandit wargames and totally got hooked.&lt;br&gt;
Starting today, I'll write down how I cleared each level of the wargames. This will be a way for me to improve both computer skills and English writing skills.&lt;br&gt;
Please let me know if I use any awkward expressions or provide incorrect information.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;If you need more details about Bandit wargames, please check this link : &lt;a href="http://www.overthewire.org/wargames" rel="noopener noreferrer"&gt;http://www.overthewire.org/wargames&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;0. Bandit Level 0&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The goal of this level is for you to log into the game using SSH. The host to which you need to connect is bandit.labs.overthewire.org, on port 2220. The username is bandit0 and the password is bandit0. Once logged in, go to the Level 1 page to find out how to beat Level 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ssh&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Reading Material&lt;/strong&gt;&lt;br&gt;
Secure Shell (SSH) on Wikipedia&lt;br&gt;
How to use SSH on wikiHow&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;The task was to log into the game using SSH, so I started by typing &lt;code&gt;ssh&lt;/code&gt;.&lt;br&gt;
Then I entered &lt;code&gt;bandit0@bandit.labs.overthewire.org&lt;/code&gt;, which includes the username and server address.&lt;br&gt;
After that, I added the '-p 2220' option. &lt;code&gt;-p&lt;/code&gt; specifies the port,  and 2220 is the port number provided by the Bandit wargames site.&lt;br&gt;
The password to log in is 'bandit0' provided by the Bandit wargames site.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknei4z1t2iuko73hif7t.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknei4z1t2iuko73hif7t.jpg" alt="Image description" width="800" height="531"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;1. Bandit Level 0 → Level 1&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in a file called readme located in the home directory. Use this password to log into bandit1 using SSH. Whenever you find a password for a level, use SSH (on port 2220) to log into that level and continue the game.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ls , cd , cat , file , du , find&lt;/p&gt;

&lt;p&gt;TIP: Create a file for notes and passwords on your local machine!&lt;/p&gt;

&lt;p&gt;Passwords for levels are not saved automatically. If you do not save them yourself, you will need to start over from bandit0.&lt;/p&gt;

&lt;p&gt;Passwords also occasionally change. It is recommended to take notes on how to solve each challenge. As levels get more challenging, detailed notes are useful to return to where you left off, reference for later problems, or help others after you’ve completed the challenge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;~&lt;/code&gt; means the &lt;code&gt;home directroy&lt;/code&gt;. So I knew current directory was home directory.&lt;br&gt;
I entered &lt;code&gt;ls&lt;/code&gt; first to check the list of files in the current directory.&lt;br&gt;
I found the &lt;code&gt;readme&lt;/code&gt; file, so I typed &lt;code&gt;cat readme&lt;/code&gt; to read it.&lt;br&gt;
The password for next level appeared. After I coppying it, I entered &lt;code&gt;exit&lt;/code&gt; to logout.&lt;br&gt;
Using the password, I logged into the next level with &lt;code&gt;ssh bandit1@bandit.labs.overthewire.org -p 2220&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ki2lkrwgbv2x1prs3ct.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ki2lkrwgbv2x1prs3ct.jpg" alt="Image description" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;2. Bandit Level 1 → Level 2&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in a file called - located in the home directory&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ls , cd , cat , file , du , find&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Reading Material&lt;/strong&gt;&lt;br&gt;
Google Search for “dashed filename”&lt;br&gt;
Advanced Bash-scripting Guide - Chapter 3 - Special Characters&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;~&lt;/code&gt; showed me that the current directory was the home directory.&lt;br&gt;
I entered &lt;code&gt;ls&lt;/code&gt; to check the list of files in the home directory.&lt;br&gt;
There was a file named &lt;code&gt;-&lt;/code&gt;. But if I just typed &lt;code&gt;cat -&lt;/code&gt;, I couldn't read the file because &lt;code&gt;-&lt;/code&gt; usually means "use standard input" or "use options". My computer couldn't probably didn't recognize that &lt;code&gt;-&lt;/code&gt; was the actual file name. &lt;br&gt;
So I use the full path like &lt;code&gt;cat ./-&lt;/code&gt; to make it clear that &lt;code&gt;-&lt;/code&gt; was a file.&lt;br&gt;
After I got the password for the next level, I logged out and logged into level2.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fltld2vt2nat1up9vfdj3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fltld2vt2nat1up9vfdj3.jpg" alt="Image description" width="800" height="228"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;3. Bandit Level 2 → Level 3&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in a file called spaces in this filename located in the home directory&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ls , cd , cat , file , du , find&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Reading Material&lt;/strong&gt;&lt;br&gt;
Google Search for “spaces in filename”&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;~&lt;/code&gt; showed me that the current directory was the home directory.&lt;br&gt;
I entered 'ls' to check the list of files in the home directory, and I found a file named &lt;code&gt;spaces in this filename&lt;/code&gt;.&lt;br&gt;
If I had just typed "cat spaces in this filename", my computer probably wouldn't have recognized  it as a single file name, because it wouldn't understand that the spaces were part of the name.&lt;br&gt;
So I had to make it clear that "spaces in this filename" was a single filename. I had two options.&lt;br&gt;
First, I could use &lt;code&gt;""&lt;/code&gt;. If I typed &lt;code&gt;""&lt;/code&gt; like &lt;code&gt;cat "spaces in this filename"&lt;/code&gt;, the computer would recognize it correctly.&lt;br&gt;
Or, I could use &lt;code&gt;\&lt;/code&gt; like &lt;code&gt;cat spaces\ in\ this\ filename&lt;/code&gt;. That also works.&lt;br&gt;
I usually choose second method because it's more convenient when using &lt;code&gt;Tab&lt;/code&gt;. The &lt;code&gt;Tab&lt;/code&gt; key has an autocomplete function, so try it!&lt;br&gt;
After I got the password for the next level, I logged out and logged into level3.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76pntqx50g4warsr6kr8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76pntqx50g4warsr6kr8.jpg" alt="Image description" width="800" height="405"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;4. Bandit Level 3 → Level 4&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in a hidden file in the inhere directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ls , cd , cat , file , du , find&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I started by entering &lt;code&gt;ls&lt;/code&gt; to find the &lt;code&gt;inhere&lt;/code&gt; directory.&lt;br&gt;
After I found the &lt;code&gt;inhere&lt;/code&gt; directory, I typed &lt;code&gt;cd inhere&lt;/code&gt; to enter in.&lt;br&gt;
Then I used &lt;code&gt;ls -a&lt;/code&gt;. The &lt;code&gt;-a&lt;/code&gt; option means "all", so it helps to show hidden files.&lt;br&gt;
I found the &lt;code&gt;...Hiding-From-You&lt;/code&gt; file, and opened it using the &lt;code&gt;cat&lt;/code&gt; command.&lt;br&gt;
I got the password for the next level, so I logged into level 4.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fue4tskdplcigh6cglgt0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fue4tskdplcigh6cglgt0.jpg" alt="Image description" width="800" height="290"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;5. Bandit Level 4 → Level 5&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in the only human-readable file in the inhere directory. Tip: if your terminal is messed up, try the “reset” command.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ls , cd , cat , file , du , find&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I started by typing &lt;code&gt;ls&lt;/code&gt; to find the &lt;code&gt;inhere&lt;/code&gt; directory.&lt;br&gt;
After I entered the &lt;code&gt;inhere&lt;/code&gt; directory, I tried the &lt;code&gt;ls&lt;/code&gt; command again to check the files in the current directory.&lt;br&gt;
There were eight files, and I wanted to check all of them conveniently, so I used the &lt;code&gt;file&lt;/code&gt; command to determine what kind of data each file contained.&lt;br&gt;
I also used the &lt;code&gt;./*&lt;/code&gt; as the argument.  &lt;code&gt;./&lt;/code&gt; refers to the current directory, and the &lt;code&gt;*&lt;/code&gt; means "all files".&lt;br&gt;
As a result, I found that &lt;code&gt;-file07&lt;/code&gt; contained ASCII text.&lt;br&gt;
I got the password using the &lt;code&gt;cat&lt;/code&gt; command, then I logged into level 5.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7uwk12ge6ckukv1y77v2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7uwk12ge6ckukv1y77v2.jpg" alt="Image description" width="800" height="568"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;6. Bandit Level 5 → Level 6&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in a file somewhere under the inhere directory and has all of the following properties:&lt;/p&gt;

&lt;p&gt;human-readable&lt;br&gt;
1033 bytes in size&lt;br&gt;
not executable&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ls , cd , cat , file , du , find &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I started by entering &lt;code&gt;ls&lt;/code&gt; to find the &lt;code&gt;inhere&lt;/code&gt; directory, and then moved into it.&lt;br&gt;
Next, I typed &lt;code&gt;ls&lt;/code&gt; again to see what was inside. There were nineteen subdirectories.&lt;br&gt;
Should I check each directory one by one? No way!&lt;br&gt;
So I used the &lt;code&gt;find&lt;/code&gt; command, which helps locate files based on certain criteria.&lt;br&gt;
I entered &lt;code&gt;-type f&lt;/code&gt; to search only for regular files.&lt;br&gt;
Then I added &lt;code&gt;-size 1033c&lt;/code&gt;, where &lt;code&gt;c&lt;/code&gt;  stands for bytes.&lt;br&gt;
Finally, I included &lt;code&gt;! -excutable&lt;/code&gt;. The &lt;code&gt;!&lt;/code&gt; negates the condition, meaning the file should &lt;strong&gt;not&lt;/strong&gt; be executable.  Then I pressed the &lt;code&gt;Enter&lt;/code&gt; key.&lt;br&gt;
Only one file matched all the conditions. I read that file using &lt;code&gt;cat&lt;/code&gt; and found password for the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv38pnu3qchqct2f90gqa.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv38pnu3qchqct2f90gqa.jpg" alt="Image description" width="800" height="258"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;7. Bandit Level 6 → Level 7&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored somewhere on the server and has all of the following properties:&lt;/p&gt;

&lt;p&gt;owned by user bandit7&lt;br&gt;
owned by group bandit6&lt;br&gt;
33 bytes in size&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
ls , cd , cat , file , du , find , grep&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;First of all, I moved into &lt;code&gt;root directory&lt;/code&gt; using &lt;code&gt;cd /&lt;/code&gt;, because I didn't know where the password file was.&lt;br&gt;
Then I used the &lt;code&gt;find&lt;/code&gt; command, which helps locate files based on specific criteria.&lt;br&gt;
I added &lt;code&gt;-user bandit7&lt;/code&gt; and &lt;code&gt;-group bandit6&lt;/code&gt; to search for files owned by user bandit7 and group bandit6.&lt;br&gt;
Next, I included &lt;code&gt;-size 33c, where&lt;/code&gt;c&lt;code&gt;stands for bytes. Then I pressed the&lt;/code&gt;Enter&lt;code&gt;key.&lt;br&gt;
I got the result, however, there were too many lines to read.&lt;br&gt;
So I added&lt;/code&gt;2&amp;gt; /dev/null&lt;code&gt;which dicards error massage automatically.&lt;br&gt;
Only one file poped up. I read the file using&lt;/code&gt;cat` and found password for the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F509kes9og3zb8hplih7g.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F509kes9og3zb8hplih7g.jpg" alt="Image description" width="800" height="564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhtuckn803cvep1jnlml7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhtuckn803cvep1jnlml7.jpg" alt="Image description" width="800" height="589"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;8. Bandit Level 7 → Level 8&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in the file data.txt next to the word millionth&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
man, grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;First, I typed the &lt;code&gt;ls&lt;/code&gt; command to find the &lt;code&gt;data.txt&lt;/code&gt; file, and then tried to read it using &lt;code&gt;cat&lt;/code&gt;.&lt;br&gt;
There were too much text in the file, so I a needed more efficient method.&lt;br&gt;
I knew two options to solve this problem : using the &lt;code&gt;vi&lt;/code&gt; command or the &lt;code&gt;grep&lt;/code&gt; command.&lt;br&gt;
If you enter &lt;code&gt;vi data.txt&lt;/code&gt;, the &lt;code&gt;data.txt&lt;/code&gt; file will be opened in the visual editor program. And then you can use the &lt;code&gt;/&lt;/code&gt; command to search for a word - in this case, &lt;code&gt;millionth&lt;/code&gt;. &lt;br&gt;
But I prefer using the &lt;code&gt;grep&lt;/code&gt; command, whcih helps locate a specific word.&lt;br&gt;
So I entered &lt;code&gt;cat data.txt | grep millionth&lt;/code&gt;. The &lt;code&gt;|&lt;/code&gt; sympol is called a pipe - it sends the result to the next command.&lt;br&gt;
As a result, the word &lt;code&gt;millionth&lt;/code&gt; and the password popped up. I copied it and then logged into level 8.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa4pz8k2ld96hwqvjuu0j.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa4pz8k2ld96hwqvjuu0j.jpg" alt="Image description" width="800" height="675"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw7d6lt0av4yn2v3gwam4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw7d6lt0av4yn2v3gwam4.jpg" alt="Image description" width="800" height="756"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5pertnbjwcithaxt8pd3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5pertnbjwcithaxt8pd3.jpg" alt="Image description" width="800" height="779"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn4ae4w3pwvb635xm5fli.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn4ae4w3pwvb635xm5fli.jpg" alt="Image description" width="800" height="275"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;9. Bandit Level 8 → Level 9&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in the file data.txt and is the only line of text that occurs only once&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Reading Material&lt;/strong&gt;&lt;br&gt;
Piping and Redirection&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I first found the &lt;code&gt;data.txt&lt;/code&gt; file using the &lt;code&gt;ls&lt;/code&gt; command. Then, I tried to read it using &lt;code&gt;cat&lt;/code&gt;, but it contained too many lines to easily find the password.&lt;br&gt;
So I used &lt;code&gt;sort data.txt&lt;/code&gt; to sort the lines alphabetically, but it was still too difficult to locate the password.&lt;br&gt;
That's why I used the &lt;code&gt;uniq&lt;/code&gt; command with the &lt;code&gt;-u&lt;/code&gt; option, conbined with the &lt;code&gt;|&lt;/code&gt;(pipe) symbol. This combination helps extract the only line of text that appears exactly once.&lt;br&gt;
As a result, I got the password for the next level.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk38tv1v3d9e5yjx3y6w5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk38tv1v3d9e5yjx3y6w5.jpg" alt="Image description" width="800" height="643"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5hpqmaddxnovywc2kqii.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5hpqmaddxnovywc2kqii.jpg" alt="Image description" width="800" height="733"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcva67sy6lswgq9ta6lfv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcva67sy6lswgq9ta6lfv.jpg" alt="Image description" width="800" height="285"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;10. Bandit Level 9 → Level 10&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Level Goal&lt;/strong&gt;&lt;br&gt;
The password for the next level is stored in the file data.txt in one of the few human-readable strings, preceded by several ‘=’ characters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands you may need to solve this level&lt;/strong&gt;&lt;br&gt;
grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I solved it&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;First, I found the &lt;code&gt;data.txt&lt;/code&gt; file using the &lt;code&gt;ls&lt;/code&gt; command. Then, I tried to read it using &lt;code&gt;cat&lt;/code&gt;, but it was unreadable because it contained not only text but also binary data.&lt;br&gt;
So I used the &lt;code&gt;strings&lt;/code&gt; command in combination with &lt;code&gt;grep&lt;/code&gt;. The &lt;code&gt;strings&lt;/code&gt; command extracts only human-readable text from binary files.&lt;br&gt;
As a result, I found the password for the level 10.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fioojavh0gpzf5dufr93j.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fioojavh0gpzf5dufr93j.jpg" alt="Image description" width="800" height="692"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcx3s24rxam3g7105v4xl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcx3s24rxam3g7105v4xl.jpg" alt="Image description" width="800" height="579"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;I’m continuing with higher levels, and I’ll post my solutions step by step.&lt;br&gt;
If you find this helpful or want to follow along, feel free to leave a comment!&lt;/p&gt;

</description>
      <category>linux</category>
      <category>wargame</category>
      <category>bandit</category>
      <category>overthewire</category>
    </item>
    <item>
      <title>🧙‍♂️ Mini Project 2 - RPG Simulator v1.0 (with Python) 🎮</title>
      <dc:creator>San Kang</dc:creator>
      <pubDate>Thu, 08 May 2025 15:25:14 +0000</pubDate>
      <link>https://dev.to/sankworks/mini-project-2-rpg-simulator-v10-with-python-1eme</link>
      <guid>https://dev.to/sankworks/mini-project-2-rpg-simulator-v10-with-python-1eme</guid>
      <description>&lt;p&gt;This mini project is a simple &lt;strong&gt;text-based RPG battle simulator&lt;/strong&gt; built using Python.&lt;br&gt;&lt;br&gt;
It was created as part of my learning journey after completing the SoloLearn Python course, with lots of help and code review from ChatGPT.&lt;br&gt;&lt;br&gt;
I'm excited to announce that &lt;strong&gt;version 1.0 is complete&lt;/strong&gt;!&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Features Implemented in v1.0
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Battle Mode Selection&lt;/strong&gt;: Easy (vs. Fox) / Hard (vs. Dragon)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Character Selection&lt;/strong&gt;: Knight / Wizard&lt;/li&gt;
&lt;li&gt;Each character and enemy has unique stats (&lt;code&gt;str&lt;/code&gt;, &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;HP&lt;/code&gt;, &lt;code&gt;MP&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;In-battle actions:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Attack&lt;/strong&gt;: based on strength, no MP cost&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spell&lt;/strong&gt;: based on intelligence, costs 10 MP&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;MP check before casting spells&lt;/li&gt;

&lt;li&gt;End of battle is determined by HP reaching 0&lt;/li&gt;

&lt;li&gt;If the enemy is defeated by your attack, it won't counterattack&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  🐉 Feature Planned: Smarter Dragon AI (Hard Mode)
&lt;/h2&gt;

&lt;p&gt;In the next update, I plan to improve the Dragon’s behavior:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each turn, the Dragon will randomly choose to either:

&lt;ul&gt;
&lt;li&gt;Perform an &lt;code&gt;attack&lt;/code&gt; or
&lt;/li&gt;
&lt;li&gt;Cast a &lt;code&gt;spell&lt;/code&gt; (only if it has enough MP)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;I'll use &lt;code&gt;random.choice()&lt;/code&gt; and basic conditionals to implement this logic.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🔧 Refactoring Plan (Next Steps)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Encapsulate Battle Logic in a Function&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Currently, the combat code for each character is repeated&lt;/li&gt;
&lt;li&gt;Planning to extract it into a function like &lt;code&gt;battle(player, enemy)&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unified Data Structures&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Merge individual variables like HP and MP into a single dictionary per character&lt;/li&gt;
&lt;li&gt;Include calculated values like &lt;code&gt;attack&lt;/code&gt; and &lt;code&gt;spell&lt;/code&gt; damage&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Clean End-of-Battle Logic&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Refactor win/lose/draw messages for better readability&lt;/li&gt;
&lt;li&gt;Handle draw cases more explicitly&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  💬 Reflections
&lt;/h2&gt;

&lt;p&gt;Even though this project is small, I learned a lot—from managing loops and conditionals to designing a basic game flow.&lt;br&gt;&lt;br&gt;
More importantly, I'm now thinking not just about &lt;em&gt;what works&lt;/em&gt;, but &lt;em&gt;how to structure code better&lt;/em&gt;.&lt;br&gt;&lt;br&gt;
It’s super rewarding to see how even text-based games can grow step by step!&lt;/p&gt;

&lt;p&gt;Stay tuned for &lt;strong&gt;version 1.1&lt;/strong&gt;, where the Dragon gets... smarter 😈&lt;/p&gt;




&lt;p&gt;📌 GitHub Repo: &lt;a href="https://github.com/sankworks/rpg-simulator" rel="noopener noreferrer"&gt;🔗 sankworks/rpg-simulator&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Python #MiniProject #TextBasedGame #RPG #SoloLearn #ChatGPT
&lt;/h1&gt;

</description>
    </item>
  </channel>
</rss>
