<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jsquared </title>
    <description>The latest articles on DEV Community by Jsquared  (@jsquared).</description>
    <link>https://dev.to/jsquared</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1050529%2F52043443-89bc-4028-88dd-fb5b75f7eb74.jpg</url>
      <title>DEV Community: Jsquared </title>
      <link>https://dev.to/jsquared</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jsquared"/>
    <language>en</language>
    <item>
      <title>Demystifying PGP Keys: Understanding the Inner Workings of Public-Key Cryptography</title>
      <dc:creator>Jsquared </dc:creator>
      <pubDate>Tue, 30 May 2023 21:36:02 +0000</pubDate>
      <link>https://dev.to/jsquared/demystifying-pgp-keys-understanding-the-inner-workings-of-public-key-cryptography-57aj</link>
      <guid>https://dev.to/jsquared/demystifying-pgp-keys-understanding-the-inner-workings-of-public-key-cryptography-57aj</guid>
      <description>&lt;p&gt;In the world of secure communication, PGP (Pretty Good Privacy) stands as a widely used encryption standard. At the heart of PGP lies the concept of public-key cryptography, which ensures the confidentiality, integrity, and authentication of digital messages. In this article, we will delve into the workings of PGP keys, exploring the principles of public-key cryptography, key generation, encryption, and digital signatures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Public-Key Cryptography
&lt;/h2&gt;

&lt;p&gt;Public-key cryptography, also known as asymmetric cryptography, employs a pair of mathematically related keys: the public key and the private key. These keys are generated together, but while the public key is shared openly, the private key remains a closely guarded secret. Public-key cryptography relies on the fact that data encrypted with the public key can only be decrypted using the corresponding private key.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ocmFbP03--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zwfpblx5m89mxblg6gre.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ocmFbP03--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zwfpblx5m89mxblg6gre.png" alt="Image description" width="616" height="301"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  PGP Key Generation
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Key Pair Generation: To generate a PGP key pair, a user typically utilizes specialized software or tools. The process involves generating a random private key and using mathematical algorithms to derive the corresponding public key. The private key must be kept secure, ideally stored in a password-protected keyring or secure key management system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Public Key Distribution: Once the key pair is generated, the public key can be freely distributed to others via email, key servers, or public key directories. The public key is associated with the user’s identity and is used by others to encrypt messages intended for that user.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  PGP Key Usage
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Encryption: When a sender wants to send an encrypted message to a recipient, they obtain the recipient’s public key and use it to encrypt the message. This process ensures that only the intended recipient, possessing the corresponding private key, can decrypt and read the message. The encrypted message can be safely transmitted over insecure channels.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Decryption: Upon receiving an encrypted message, the recipient uses their private key to decrypt the message and access its contents. The private key is never shared or disclosed to others, ensuring the confidentiality of the communication.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fiMOiXKz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i9103llikvqg4hez3vdx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fiMOiXKz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i9103llikvqg4hez3vdx.png" alt="Image description" width="250" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Digital Signatures: In addition to encryption, PGP keys also enable the use of digital signatures. A digital signature is created by using the sender’s private key to encrypt a unique hash value derived from the message. This encrypted hash serves as a digital fingerprint, verifying the authenticity and integrity of the message. Recipients can verify the signature using the sender’s public key, confirming that the message has not been tampered with and originated from the claimed sender.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Key Trust and Web of Trust
&lt;/h2&gt;

&lt;p&gt;To establish trust in the authenticity of public keys, PGP relies on a decentralized model called the Web of Trust. Users verify the identity of others by personally signing their public keys, essentially vouching for their authenticity. These signatures create a network of trust, where the reputation and trustworthiness of individuals within the network determine the level of confidence in the associated public keys.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Revocation and Expiration
&lt;/h2&gt;

&lt;p&gt;In case a private key is compromised or lost, PGP allows for key revocation. A revocation certificate, generated with the private key, is distributed to notify others that the associated key is no longer valid or trustworthy. Additionally, PGP keys can have expiration dates, ensuring that keys are regularly renewed or revoked if no longer in use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;PGP keys and public-key cryptography provide a robust framework for secure communication, ensuring the confidentiality, integrity, and authenticity of digital messages. By understanding the workings of PGP keys, individuals can leverage this encryption standard to protect their sensitive information, establish secure communication channels, and authenticate the identity of participants. PGP’s reliance on public and private key pairs, encryption, and digital signatures empowers users to communicate with confidence in an increasingly interconnected and privacy-sensitive world.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>security</category>
    </item>
    <item>
      <title>Python V.S. Javascript: Which is Better for Webscraping?</title>
      <dc:creator>Jsquared </dc:creator>
      <pubDate>Sat, 22 Apr 2023 03:56:48 +0000</pubDate>
      <link>https://dev.to/jsquared/python-vs-javascript-which-is-better-for-webscraping-1dh0</link>
      <guid>https://dev.to/jsquared/python-vs-javascript-which-is-better-for-webscraping-1dh0</guid>
      <description>&lt;p&gt;JavaScript and Python are currently the most popular programming languages overall, but at the same time, they are also the top choices for web scraping. The data extraction discipline is developing fast as both small and large organizations rely on these practices to get valuable information that drives them forward.&lt;/p&gt;

&lt;p&gt;Even though the capabilities of scraping bots are getting more advanced, there are more complexities involved. Web scrapers are becoming specialized and designed for different kinds of uses. In other words, when choosing a web scraping service or building your scraper, you will have a lot of things to consider.&lt;/p&gt;

&lt;p&gt;This blog article will discuss which programming language you should choose for scraping and when.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Web Scraping?
&lt;/h2&gt;

&lt;p&gt;Web scraping, web crawling, or data extraction are the terms that describe the process of gathering valuable data from web pages. It's an automated process involving large amounts of data. When browsing the web and downloading some page, text, or image, you could say that's manual web scraping. However, doing this manually doesn't make sense as it requires a lot of time and effort. Scraping bots can do this much faster and deliver data in a structured fashion so that you can easily use it for analysis. Web scrapers are software tools designed to help you with this process, but these tools come with different functionalities, capabilities, and features. Apart from the design, these factors depend on the coding language used for their development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Python
&lt;/h2&gt;

&lt;p&gt;Python is widely known as a scraping language because of its comprehensive capabilities and flexibility. You can use it for almost all web-crawling efforts without a hitch. At the same time, it's both simple to learn and great for beginners. Python is effective for simple data extracting processes and also suitable for more complex applications. One of the most used frameworks for scraping is BeautifulSoup, based on Python. It's straightforward to use and makes tasks like parsing, searching, and navigation a piece of cake. Python web scraping tools are effective at simulating human behavior, accurate scraping, and data targeting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Javascript
&lt;/h2&gt;

&lt;p&gt;JavaScript is the most popular web language, and one of the reasons for this is NodeJS. It's a modern and simple language originally developed to allow dynamic functionalities to websites accessed via a browser. When someone visits a website, the browser analyzes the JavaScript and transforms it into a code the computer can process. Node.JS is a JavaScript tool that allows it to run server-side and client-side processes. It can create network applications and run them very quickly. In other words, Node.JS gives JavaScript the capabilities needed to create server-side scripts. That helps scrapers quickly go through sites with dynamic structures and extract information without any problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pros and Cons of Each Language
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Python
&lt;/h3&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python is excellent for both beginners and experienced programmers. Dynamic typing makes it easy to find the right features and functionalities and, combined with a simple syntax, provides a great learning curve.&lt;/li&gt;
&lt;li&gt;Python has a great community with many libraries and tools. In other words, no matter what problem you encounter, you can find answers and the right technical solutions to execute solutions.&lt;/li&gt;
&lt;li&gt;Python can support various task management approaches, including asynchronous programming, multiprocessing, and multithreading. The combination of these approaches makes Python really efficient.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compared to C++ and other statically typed coding languages, Python has a slower performance.&lt;/li&gt;
&lt;li&gt;The Global Interpreter Lock in Python makes it more challenging to scale projects properly, and some tasks have slower execution.&lt;/li&gt;
&lt;li&gt;Dynamic pricing can sometimes lead to mistakes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  JavaScript
&lt;/h2&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript is very fast with optimized memory usage and can work with multiple simultaneous web requests.&lt;/li&gt;
&lt;li&gt;All of the libraries written for Node.JS for native use can also improve the development workflows leading to faster outputs.&lt;/li&gt;
&lt;li&gt;JavaScript has a rich community with many Node.JS packages that can provide valuable tools for easier and quicker use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.JS's event-driven and single-threaded nature offers lower performance when working with demanding GPU computing tasks. However, users can solve this with the "worker threads" module.&lt;/li&gt;
&lt;li&gt;The asynchronous approach involves a lot of callbacks, which can cause complex callback "pile-ups" that go into several layers and make the code difficult to maintain and understand.&lt;/li&gt;
&lt;li&gt;JavaScript is also a dynamic language, meaning potential bugs can happen during runtime.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In the end, Python web scraping solutions are more popular because of a larger community and the Beautiful Soup library that makes it easy to use. Still, Python is often avoided when there's a need for scaling large projects. On the other hand, JavaScript might be a good choice for people who already know this language and would like to use it for scraping. The differences are subtle, and it all comes down to personal preference and knowledge.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>webscraping</category>
      <category>python</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Advice for Those Learning How to Code</title>
      <dc:creator>Jsquared </dc:creator>
      <pubDate>Mon, 17 Apr 2023 18:02:57 +0000</pubDate>
      <link>https://dev.to/jsquared/advice-for-those-learning-how-to-code-4he5</link>
      <guid>https://dev.to/jsquared/advice-for-those-learning-how-to-code-4he5</guid>
      <description>&lt;p&gt;Let's face it: Programming is hard. Even if you have years of experience under your belt, it feels like there is always something new to learn. It can be very frustrating for new programmers who want to learn how to code. Many beginners don't know where to start or even how to start. &lt;/p&gt;

&lt;p&gt;Now, you might be asking who I am. My name is Jsquared and I am a 17 year old programmer, web developer, and cybersecurity enthusiast. I have been writing code since I was  around 6 or 7 years old, with my first programs being simple games written in Python. As I learned more, I became more fascinated, I was able to code much cooler things than simple games, and over years I learned invaluable lessons that made me a better programmer. I believe that anyone can learn to code and in this blog I want to share some tips that has helped me in my journey of programming. &lt;/p&gt;

&lt;p&gt;These are some general advice on how to be successful in learning how to code. It's important to know that you can take multiple approaches to learning programming and there is no one answer but these are the ones that have helped me the most Later on, I will write a blog with resources that I used to learn how to code. &lt;/p&gt;

&lt;h2&gt;
  
  
  1. Take Time Learning the fundamentals
&lt;/h2&gt;

&lt;p&gt;Getting a good grasp of the fundamentals is critically important to achieving long-term success. The foundational knowledge you learn at the beginning of your programming journey will allow you to grasp the logic of more complicated topics further along. If you don’t learn basic computer programming, you could fall behind in the future. So, even if the fundamentals seem boring or unimportant at first, you need to recognize how important it is to learn them. &lt;/p&gt;

&lt;h2&gt;
  
  
  2. It's Okay to Ask for Help
&lt;/h2&gt;

&lt;p&gt;Knowing when to ask for help is a skill you’ll need throughout the course of your life, not just when it comes to programming. To put it simply, you aren’t going to know everything, especially when you’re just starting out. The fastest and easiest way to gain the skills you need to have to be a programmer is to ask those who have the answers. After you try to figure out the answer to your question on your own, be sure to ask someone else. Whether you do it in person or online, speaking to your mentor or teacher and listening to what they have to say is critical when you are learning to become a computer programmer.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. MAKE STUFF!!
&lt;/h2&gt;

&lt;p&gt;If you really want to learn how to code, you need to do more than just read the book and take some notes. You need to put the information you’re learning into action. You might be surprised at how something you read can seem so simple until you try to do it for yourself. Therefore, you should actually start coding as you’re learning. That way, you put the information to use immediately. When you learn by doing, the information will be more likely to stick with you. &lt;strong&gt;Plus you can put your projects on GitHub to show off to potential employers.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Use the Internet to your Advantage
&lt;/h2&gt;

&lt;p&gt;These days, you can find countless sources of information on the internet on just about any topic. This information can be especially helpful when you are learning how to code. Whether you decide to sign up for a coding boot camp or simply want to check out free tutorials on YouTube or other streaming services, you can learn a lot about coding by just going online. One of the main benefits of learning this way is that you can find the answers you need in many different formats. Therefore, if one explanation doesn’t make sense to you, you can always find a different explanation elsewhere. It's a win-win!&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Don't Just read Source Code
&lt;/h2&gt;

&lt;p&gt;When you get your hands on some source code, it’s easy to just read through it and think you have an understanding of what’s going on. But when you really want to become a computer programmer, you’re going to have to take this a step further. You should actually run the code and tinker with it to figure out how it truly works. This is a much more effective way to learn than simply reading through the code. Remember, being able to read the code isn’t the same as understanding it. As a programmer, you need to cultivate a deep level of understanding, and playing around with sample code is a great way to do that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Learning how to code may seem scary at first but as you learn more, you'll realize that it's actually very fun. Don't think that you're the only one that is having a hard time learning how to code. Everyone is going/went through the same thing. I went through the same thing too. It's simply apart of the process. If you consistently learn and hone your skills, I guarantee you that you will see improvement and growth. &lt;/p&gt;

&lt;p&gt;Thank you for reading my blog! If you liked this article, please consider liking it, sharing it with a friend, and following for more content like this! Got an idea for a future blog post? Comment it down below!  &lt;/p&gt;

&lt;p&gt;Once again, thank you for reading! I really appreciate it! :) &lt;/p&gt;

&lt;p&gt;-- Jsquared&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>learning</category>
    </item>
    <item>
      <title>Password Cracking: What is a Rainbow Table Attack and how do I prevent it?</title>
      <dc:creator>Jsquared </dc:creator>
      <pubDate>Mon, 17 Apr 2023 05:56:53 +0000</pubDate>
      <link>https://dev.to/jsquared/password-cracking-what-is-a-rainbow-table-attack-and-how-do-i-prevent-it-2676</link>
      <guid>https://dev.to/jsquared/password-cracking-what-is-a-rainbow-table-attack-and-how-do-i-prevent-it-2676</guid>
      <description>&lt;h2&gt;
  
  
  What is a Rainbow Table?
&lt;/h2&gt;

&lt;p&gt;A rainbow table attack is a password cracking method that uses a special table (a “rainbow table”) to crack the password hashes in a database. Applications don’t store passwords in plaintext, but instead encrypt passwords using hashes. After the user enters their password to login, it is converted to hashes, and the result is compared with the stored hashes on the server to look for a match. If they match, the user is authenticated and able to login to the application. &lt;/p&gt;

&lt;p&gt;The rainbow table itself refers to a precomputed table that contains the password hash value for each plain text character used during the authentication process. If hackers gain access to the list of password hashes, they can crack all passwords very quickly with a rainbow table. &lt;/p&gt;

&lt;h2&gt;
  
  
  How Does This Attack Work?
&lt;/h2&gt;

&lt;p&gt;Hackers must first gain access to leaked hashes in order to carry out rainbow table attacks. The password database itself might be poorly secured, or they may have gained access to the Active Directory(A database and set of services that connect users with the network resources they need to get their work done). Others gain access through phishing techniques of those that might have access to the password database. Additionally, there are already millions and millions of leaked password hashes on the dark web that are available to hackers. &lt;/p&gt;

&lt;p&gt;The reason why hackers like to use the rainbow table method is that it's an easy way to decrypt passwords to enable them to gain unauthorized access to systems, rather than relying on the dictionary attack method (which consumes more memory space) or brute force attack (which consumes more computing power). All the attacker needs to do is just check the rainbow table to find the password’s hash. Rainbow tables are deliberately designed to consume less computing power at the cost of using more space. As a result, it usually produces results quicker than a dictionary or brute force attacks, often taking minutes to crack where other methods may take much longer. But this does have some downsides. Rainbow tables take a considerable amount of time to compile from the ground up. This is because all the hashes and the computing work that goes with them must be calculated and stored beforehand (although precompiled ones can also be downloaded online). But once you figure that out, you have a rainbow table that you can always reuse whenever you need to crack a password.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real World Scenarios:
&lt;/h2&gt;

&lt;p&gt;Let's move on to how we can see this method of password cracking in the real world. Here are two real life examples of how this could be used: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An attacker spots a web application with outdated password hashing techniques and poor overall security. The attacker steals the password hashes and, using a rainbow table, the attacker is able to decrypt the passwords of every user of the application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A hacker finds a vulnerability in a company’s Active Directory and is able to gain access to the password hashes. Once they have the list of hashes they execute a rainbow table attack to decrypt the hashes into plaintext passwords. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How to Prevent Rainbow Table Attacks: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Salting: Hashed passwords should never be stored without salting. Salting is a technique to protect passwords stored in databases by adding a string of 32 or more characters and then hashing them. This makes the password more difficult to decrypt. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multifactor Authentication: Using multi-factor (MFA) or two-factor authentication (2FA) that involves multiple steps, for example, makes it difficult for anyone to access your account with just a password. This makes it impossible for an attacker to use a rainbow table attack effectively.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Outdated Hashing Algorithms: Hackers look for applications and servers using obsolete password hashing algorithms MD5 and SHA1. If your application uses either algorithm, your risk for rainbow table attacks substantially increases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Monitoring Servers: Most modern server security software monitors against attempts to access sensitive information and can automatically act to mitigate intruders before they can find the password database.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion and Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Some security experts argue that rainbow tables have been rendered obsolete by modern password cracking methodologies. Instead, most attackers now use the more advanced Graphics Processor Unit (GPU) based password cracking methods.&lt;/p&gt;

&lt;p&gt;A moderately-sized GPU farm can easily recreate a rainbow table within a few seconds. This means that encoding those passwords into a rainbow table would not make that much sense. Moreover, most passwords are salted anyway, meaning we would need rainbow tables for each salt value, and for larger salts, this is entirely impractical. Bitcoin and other cryptocurrency miners have been tapping GPU technology to calculate hashes for bitcoin farming. There are existing tools that can leverage GPU technology to decrypt password hashes potentially. For example, the Linux-based GPU cluster was used to crack 90 percent of the 6.5 million leaked LinkedIn password hashes in 2012.&lt;/p&gt;

&lt;p&gt;Nonetheless, rainbow tables may not be the biggest threat to organizations today. Still, they are certainly a threat and should be considered and accounted for as part of an overall security strategy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;If you liked this article, please consider liking and following for more blogs on cybersecurity and hacking!!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-Jsquared&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>security</category>
      <category>penetrationtesting</category>
      <category>hacking</category>
    </item>
    <item>
      <title>Tutorial: DNS Enumeration using Python</title>
      <dc:creator>Jsquared </dc:creator>
      <pubDate>Sat, 08 Apr 2023 05:14:03 +0000</pubDate>
      <link>https://dev.to/jsquared/tutorial-dns-enumeration-using-python-1339</link>
      <guid>https://dev.to/jsquared/tutorial-dns-enumeration-using-python-1339</guid>
      <description>&lt;h2&gt;
  
  
  Explanation of DNS Enumeration
&lt;/h2&gt;

&lt;p&gt;DNS Enumeration is a method of collecting data about a domain's configurations. DNS, or the Domain Name System, translates human readable domain names (for example, &lt;a href="http://www.amazon.com" rel="noopener noreferrer"&gt;www.amazon.com&lt;/a&gt;) to machine readable IP addresses (something such as 192.0.2.44). The process of DNS Enumeration returns various important information about the target like DNS record types, host names, IP addresses and much more depending upon the configuration of that target system.The main objective of DNS enumeration is to collect as much information as possible about a particular victim to identify potential vulnerabilities. &lt;/p&gt;

&lt;p&gt;In this article, I will show you how you can perform DNS enumeration using the Python language. We will be utilizing the &lt;code&gt;dnspython&lt;/code&gt; library that will help us carry out DNS requests which will return us with DNS records for the website we choose. &lt;/p&gt;

&lt;p&gt;to install &lt;code&gt;dnspython&lt;/code&gt; all you need to do is run this command:&lt;br&gt;
&lt;code&gt;$ pip install dnspython&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When you have finished installing the library, create a new file called &lt;code&gt;dns_enumeration.py&lt;/code&gt;(or whatever you want to call it).&lt;/p&gt;
&lt;h2&gt;
  
  
  The Coding Part
&lt;/h2&gt;

&lt;p&gt;To begin with, we need to specify the domain we want to analyze (we will use twitter.com) and what kind of DNS record types we want the program to return. For this tutorial, we'll just have the program return the six most common DNS record types:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import dns.resolver

# Set the target domain and record type
target_domain = "twitter.com" #using twitter as an example
record_types = ["A", "AAAA", "CNAME", "MX", "NS", "SOA", "TXT"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(Don't forget to import the library)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You might be asking, what is a DNS record type? You can think of a set of DNS records like a business listing on Yelp. That listing will give you a bunch of useful information about a business such as their location, hours, services offered, etc. All domains are required to have at least a few essential DNS records for a user to be able to access their website using a domain name, and there are several optional records that serve additional purposes. In this case, the record types will give us information about the domain like the IP address, IPV6 address, which server contains the DNS records, etc. &lt;/p&gt;

&lt;p&gt;Now, we can move on to creating a DNS resolver as well as creating the code that will perform the DNS lookup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Create a DNS resolver
resolver = dns.resolver.Resolver()
for record_type in record_types:
    # Performs DNS lookup for the defined domain and record type
    try:
        answers = resolver.resolve(target_domain, record_type)
    except dns.resolver.NoAnswer:
        continue
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A DNS resolver, also known as a resolver, is a server on the Internet that converts domain names into IP addresses.When you use the Internet, every time you connect to a website using its domain name, your computer needs to know that website's IP address. So your computer contacts a DNS resolver, and gets the current IP address of the domain you want to access. &lt;/p&gt;

&lt;p&gt;Last part is we need to print out the results from the queries (this is pretty simple):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    # Prints the results
    print(f"{record_type} records for {target_domain}:")
    for rdata in answers:
        print(f" {rdata}")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(f-strings are string literals that have an f at the beginning and curly braces containing expressions that will be replaced with their values)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When you run the program you should get an output that looks like this (depends on what domain you choose):&lt;/p&gt;

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

&lt;p&gt;And that's the end of the tutorial! If you want to dive further, here are some links that I provided for you to read more: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.cloudflare.com/learning/dns/dns-records/" rel="noopener noreferrer"&gt;https://www.cloudflare.com/learning/dns/dns-records/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.computerhope.com/jargon/d/dns-resolver.htm" rel="noopener noreferrer"&gt;https://www.computerhope.com/jargon/d/dns-resolver.htm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://book.hacktricks.xyz/network-services-pentesting/pentesting-dns" rel="noopener noreferrer"&gt;https://book.hacktricks.xyz/network-services-pentesting/pentesting-dns&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you liked this article, consider liking it and following me! If you want to see more tutorials like this in the future, comment down below! &lt;/p&gt;

&lt;p&gt;Full source code:&lt;a href="https://github.com/sleepyrob0t/DNS-Enumeration-Python" rel="noopener noreferrer"&gt; https://github.com/sleepyrob0t/DNS-Enumeration-Python &lt;br&gt;
&lt;/a&gt;&lt;br&gt;
-Jsquared &lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>ethicalhacking</category>
      <category>python</category>
      <category>programming</category>
    </item>
    <item>
      <title>Coding a Port Scanner with Python</title>
      <dc:creator>Jsquared </dc:creator>
      <pubDate>Tue, 04 Apr 2023 05:34:51 +0000</pubDate>
      <link>https://dev.to/jsquared/coding-a-port-scanner-with-python-5he7</link>
      <guid>https://dev.to/jsquared/coding-a-port-scanner-with-python-5he7</guid>
      <description>&lt;p&gt;Port scanning is a way for determining which ports on a network device are open, whether it's a server, a router, or a regular machine. To simply put it, a port scanner is just a script or a program that is designed to probe a host for open ports.&lt;/p&gt;

&lt;p&gt;In this blog, I will show you step-by-step how to code a simple port scanner using the pre-installed socket library. The idea of making the port scanner is to connect to a host (it could be a website, server, or any device which is connected to a network/ internet) through a list of ports. If the scanner establishes a connection, then that means the port is open. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DISCLAIMER: THIS IS ONLY FOR EDUCATIONAL PURPOSES ONLY. DO NOT USE THIS ON A HOST THAT YOU DO NOT HAVE PERMISSION TO TEST. PORT SCANNING IS NOT ILLEGAL UNLESS IT IS USED TO GAIN UNAUTHORIZED ACCESS OR BREACH PRIVACY.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First things first, if you want to print in colors, you will need to install colorama (this is completely optional):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip 3 install colorama
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With that out of the way, now we can actually start coding the scanner. First, let's import the &lt;code&gt;socket&lt;/code&gt; module:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import socket # for connecting to the host 
from colorama import init, Fore

# adding some colors (optional)
init()
GREEN = Fore.GREEN
RESET = Fore.RESET
GRAY = Fore.LIGHTBLACK_EX

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;The socket module is a module already built in the Python standard library, so you don't need to install it.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;colorama&lt;/code&gt; is used later when the program prints the ports that are open or closed (again this is optional) &lt;/p&gt;

&lt;p&gt;Next, let's create a function that will be used to decide whether a port is open or not:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def is_port_open(host, port):

    #determines whether the host has the port open
    # creates a new socket
    s = socket.socket()
    try:
        # tries to connect to host using that port
        s.connect((host, port))
        # make a timeout if you want it a little faster (means less accuracy)
        # s.settimeout(0.2) &amp;lt;-- if you want to add a timeout 
    except:
        # cannot connect (port is closed) and returns false 
        return False
    else:
        # the connection is established (port is open)
        return True

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the &lt;code&gt;s.connect((host,port))&lt;/code&gt; function attempts to connect the socket to a remote address using the &lt;code&gt;(host,port)&lt;/code&gt; tuple (Tuples are used to store multiple items in a single variable), it will bring up an exception when it fails to connect to the host, so that is why we put that code into a try-expcept block so when the exception is brought up, it tells us that the port is closed (otherwise it is open). &lt;/p&gt;

&lt;p&gt;Lastly, we can use the function we just made above and repeat it over a number of ports:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# asks user to enter a port 
host = input("Enter the host:")
# repeat over ports, from 1 to 1024
for port in range(1, 1024):
    if is_port_open(host, port):
        print(f"{GREEN}[+] {host}:{port} is open      {RESET}")   #prints green text for open ports 
    else:
        print(f"{GRAY}[!] {host}:{port} is closed    {RESET}", end="\r") #prints gray text for closed ports 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This part of the code will scan all ports from 1 to 1024. You can freely change the range if you so choose, but keep in mind that if you increase the range it will take longer to complete scanning. &lt;/p&gt;

&lt;h2&gt;
  
  
  Potential Issues
&lt;/h2&gt;

&lt;p&gt;Upon running the code, you will notice that the script isn't the fastest. You can change this by adding a timeout of 200 milliseconds (using &lt;code&gt;settimeout(0.2)&lt;/code&gt;. Keep in mind that this will reduce the accuracy of the scanning, especially if you have high latency. &lt;/p&gt;

&lt;p&gt;If you want, the full source code is on &lt;a href="https://github.com/sleepyrob0t/simple-portscanner-python"&gt;Github&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ethicalhacking</category>
      <category>security</category>
      <category>cybersecurity</category>
      <category>penetrationtesting</category>
    </item>
  </channel>
</rss>
