<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by TheCyberBasics on Medium]]></title>
        <description><![CDATA[Stories by TheCyberBasics on Medium]]></description>
        <link>https://medium.com/@thecyberbasics?source=rss-13fc25c74ba5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*pPimaSUgub5C8Y2pu591NQ.jpeg</url>
            <title>Stories by TheCyberBasics on Medium</title>
            <link>https://medium.com/@thecyberbasics?source=rss-13fc25c74ba5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 22:05:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thecyberbasics/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Active vs. Passive Network Scanning]]></title>
            <link>https://thecyberbasics.medium.com/active-vs-passive-network-scanning-2466f62639d1?source=rss-13fc25c74ba5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2466f62639d1</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[TheCyberBasics]]></dc:creator>
            <pubDate>Wed, 19 May 2021 03:33:05 GMT</pubDate>
            <atom:updated>2021-05-19T03:34:15.067Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fvcdv9vekeeigokf" /><figcaption>Photo by <a href="https://unsplash.com/@alinnnaaaa?utm_source=medium&amp;utm_medium=referral">Alina Grubnyak</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Performing a network scan is an essential task in a penetration test. It helps the tester understand the environment they are working against, as well as provides some information for their employer or client about what information is readily available about them. There are two primary categories of network scanning: Passive and Active.</p><h3><strong>Passive Network Scanning</strong></h3><p>In a passive scan, the tester is not directly targeting any port or specific service related to a device on a network. Typical tasks in passive scanning include</p><ul><li>DNS reconnaissance</li><li>Simple packet monitoring and inspection</li><li>Using open-source intelligence (OSINT)</li></ul><p><strong>DNS reconnaissance</strong> involves an IP address and gathering data about the host associated with that address. There are many tools to aid in this research, here are a few of the common ones:</p><ul><li><strong><em>nslookup</em></strong><em>: a built-in command for most operating systems, nslookup resolves a hostname (or fully qualified domain name; FQDN) to the IP addresses associated with it. If a host has multiple IPs, then they are all returned. With more advanced usage, you can specify specific server types to query for (MX, NS, SOA, etc.)</em></li><li><strong><em>dig</em></strong>: <em>dig is a utility most commonly found on Linux/Unix style operating systems and works similarly to nslookup. It is the preferred utility for name resolution on Linux and is part of the BIND DNS package.</em></li><li><strong><em>dnsrecon</em>:<em> </em></strong><em>dnsrecon is a utility available as part of the standard Kali Linux distribution. It provides the ability to perform queries against a host using multiple name servers, as well as providing the ability to brute force subdomains.</em></li></ul><p><strong>Simple packet monitoring and inspection</strong> utilize tools such as Wireshark, and tcpdump to survey network traffic for potential vulnerabilities. Provided the capture device can sniff all available network traffic (capturing in promiscuous mode) a tester can detect unencrypted network traffic like FTP or older HTTP web applications that could lead to host compromises.</p><p><strong>Using Open-Source Intelligence (OSINT). </strong>A tester can find information simply by using readily available search engines such as Google. A popular technique is to employ “google-dorks”, specially crafted google searches tailored to return specific information, in order to find information related to a host. One such technique is to use “site:” as part of the query. For example, searching for:</p><blockquote>site:medium.com blog</blockquote><p>Will return all pages with “blog” in the name, on medium.com’s website. There is an entire <a href="https://www.exploit-db.com/google-hacking-database"><em>site</em></a><em> </em>dedicated to google-dorks, and many of them can reveal surprising information.</p><h3>Active Network Scanning</h3><p>Switching gears completely, active network scanning is <strong>intentionally</strong> targeting specific ports and/or network services for the purposes of obtaining information in order to enumerate the possibility of a vulnerability existing.</p><p><strong><em>DISCLAIMER</em></strong><em>: It should go without saying, but</em><strong><em> do not</em></strong><em> perform active network scanning unless you have written permission of the system owner to perform that testing.</em></p><p>Possibly the best tool for port scanning and service enumeration is nmap.</p><ul><li><strong><em>Nmap </em></strong><em>provides the ability to scan all 65,535 possible ports on a host for any listening service and report back on what service it believes is running on that port.</em></li></ul><p>There are many tools available to automate port scanning using nmap, but my favorite is AutoRecon written by Tib3rius:</p><p><a href="https://github.com/Tib3rius/AutoRecon">GitHub - Tib3rius/AutoRecon: AutoRecon is a multi-threaded network reconnaissance tool which performs automated enumeration of services.</a></p><p>Using the information provided by nmap, a tester can continue to enumerate a host machine for information pertaining to users, services, and begin to map out any web applications present on the host machine.</p><p>Nmap provides several switches to aid in this research, and two of the most helpful are <strong>-sV</strong> and <strong>-sC</strong>. These two switches stand for standard version scans (-sV) and standard script scans (-sC). Between the two of these, a tester can get a solid idea about what services are actually running on the host in question.</p><p>Web content is a little different and there are many tools to aid in that research as well.</p><ul><li><strong><em>Gobuster </em></strong><em>is a Go programming language port of the popular dirbuster tool for brute forcing webserver directories.</em></li><li><strong><em>Burp </em></strong><em>proxy allows a tester to intercept web requests sent to the server and manipulate them in hopes of bypassing security measures, brute-forcing log-in credentials, or performing vulnerability tests against the web server’s functionality.</em></li></ul><p>Thank you for reading this quick overview of the differences between passive and active network scanning, If you enjoyed it please share and if there are any questions please don’t hesitate to comment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2466f62639d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Programming Fundamentals — Loan Payment Schedule]]></title>
            <link>https://python.plainenglish.io/python-programming-fundamentals-loan-payment-schedule-3e49cc1c0c86?source=rss-13fc25c74ba5------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e49cc1c0c86</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[TheCyberBasics]]></dc:creator>
            <pubDate>Tue, 11 Aug 2020 01:21:57 GMT</pubDate>
            <atom:updated>2020-08-12T07:39:38.534Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python Programming Fundamentals — Loan Payment Schedule</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1XjxAf0XIbcX62HB" /><figcaption>Photo by <a href="https://unsplash.com/@neonbrand?utm_source=medium&amp;utm_medium=referral">NeONBRAND</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Sometimes, when learning a new language it is helpful to break down a problem that you are familiar with, and apply the concepts of the programming language to that problem. An example of this is the temperature converter we did a few articles back:</p><p><a href="https://medium.com/python-in-plain-english/programming-fundamentals-functions-and-variables-b7a6d11c220d">Programming FUNdamentals — Functions and Variables</a></p><p>In this article we are going to do the same thing, except this time we are going to build a Loan Payment Schedule (also known as an Amortization Schedule).</p><p><strong>Quick note: I’m not a financial advisor, there are many factors that go into loan payment calculation that are not considered here. This exercise should only be used to approximate payment amounts and timelines.</strong></p><p>We are going to be pulling together many items we’ve touched on before including functions, loops, conditional statements, and importing libraries. Before we begin, there is one library that you may not have already installed, but it will make viewing the results of our program much nicer. We are going to use the python package manager <em>pip</em> to install a library called <em>BeautifulTable</em>. In order to do this, open a command prompt and type</p><pre>pip3 install beautifultable</pre><p>pip3 is the package manager for Python3, and BeautifulTable is only supported on Python3.4 and up.</p><p>Once you have that installed you are ready to go.</p><h3>Payment Calculation</h3><p>If you have ever had a loan of any type, you have made payments on it at one time or another. There is a formula for calculating this payment which is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*eLL0izBfUYfGKTfSiWLSYQ.png" /><figcaption>Loan Payment Formula</figcaption></figure><p>Interest is the rate you pay towards the loan, here it will be used as a decimal (so for example: 5% is .05). The number of payments will be determined by how many years the loan is for multiplied by 12 (one payment per month). If your loan is for less than a year, you can use a fraction (i.e. 9 months is .75).</p><p>With this in hand, we can start building our program!</p><p>We’ll create a function called <em>amortize</em> and give it a few arguments to cover the necessary variables for our formula. We’ll also create some variables to convert our user input into something that can be directly used in the formula:</p><pre>def amortize(value,rate,pmt_yrs):<br>    intrate = rate/12.0<br>    totalpmts = pmt_yrs *12<br>    payment = (intrate * value) / ( 1 - pow(1+intrate,-totalpmts))</pre><p>As it stands, you can call this function with the required arguments and print out <em>payment</em>. This is pretty helpful, but we want a full payment schedule so we still have some work to do.</p><p>Next we’re going to use a <em>while</em> loop to calculate each month’s payment:</p><pre>while value &gt; 0:<br>    interest = (value * intrate)<br>    principle = payment - interest<br>       <br>    if value - payment &lt; 0:<br>        principle = value<br>    <br>    value = value - principle</pre><p>Interest can be calculated by multiplying the interest rate and the current loan value. Each month this number will be different, so we include it in the loop. Principle is the actual amount of the payment that goes towards the loan balance and is found by subtracting the calculated interest from the payment.</p><p>Our loop condition states that we are going to loop as long as the value of the loan is greater than $0. The easiest check here is to see whether the next payment will cause the loan to be less than 0, and if so, then the principle payment of this month will be equal to the loan value.</p><p>Finally, the loan value is updated by subtracting the current months principle payment.</p><p>Here’s what we have so far:</p><pre>def amortize(value,rate,pmt_yrs):<br>    intrate = rate/12.0<br>    totalpmts = pmt_yrs *12<br>    payment = (intrate * value) / ( 1 - pow(1+intrate,-totalpmts))<br><br>    while value &gt; 0:<br>        interest = (value * intrate)<br>        principle = payment - interest<br>       <br>        if value - payment &lt; 0:<br>            principle = value<br>        <br>        value = value - principle</pre><p>This will (silently) compute the loan payment schedule over the lifetime of the loan. For this to be useful, we are going to need some output. This is where BeautifulTable comes in.</p><h3>Building the Table</h3><p>At the top of your script, use the following to include the BeautifulTable library functions in your code:</p><pre>from beautifultable import BeautifulTable</pre><p>Now we can create an instance of the BeautifulTable <em>class</em>. A class is an object oriented programming template for implementing different objects in programming code. Here we are going to create a BeautifulTable object by calling the class’s <em>constructor</em>. A constructor ensures that all necessary variables and data members are available to the new object.</p><pre>table = BeautifulTable()</pre><p>That’s it! Now we have a fully created table object of the BeautifulTable class that we can use.</p><p><em>If you’d like to check out all that BeautifulTable can do, check out its PyPi page<br></em><a href="https://pypi.org/project/beautifultable/">https://pypi.org/project/beautifultable/</a></p><p>Our table needs a header across all of the columns so we create one like this:</p><pre>table.columns.header=[&quot;MONTH&quot;,&quot;LOAN VALUE&quot;,&quot;PAYMENT&quot;,&quot;INTEREST&quot;,&quot;PRINCIPLE&quot;,&quot;NEW VALUE&quot;]</pre><p>Looks a lot like a list right? Here we use the class data members “columns” and “header” to tell table how we want our data set up.</p><p>We’re going to need to know which month we’re on, so we create a counter variable and initialize it to 0 (so the first payment, will be in Month 1).</p><p>Finally, the data needs to be put into the table, so we’ll use the “rows” data member and call it’s “append” method to insert our data into that row of the table.</p><pre>table.rows.append([n,value,payment,interest,principle,value-principle)])</pre><p>Now let’s take a look at our code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*WrSS92Y9gQ6AKHwjojju1Q.png" /><figcaption>Current Amortization Function</figcaption></figure><p>And if we run it with some data, we can see that it works fairly well (only a portion of the output is shown):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*hT1zTQ-JsvuAVwNFSDDS9w.png" /><figcaption>Partial Amortization Schedule</figcaption></figure><p>You could stop here, and have a fully functional loan amortization schedule program. However, there are a few quality of life upgrades we can make to enhance the usability of this program.</p><h3>Upgrading Functionality</h3><p>One downside to the current payment schedule is we don’t know what currency that is. 100,000 could be a lot, or not very much depending on the location of the user. Luckily python includes a library to help with localization.</p><p>The <em>locale</em> library contains many functions to help manage data from different regions of the world. For our purposes we are going to take advantage of the <em>locale.currency</em> method within that library to format our currency to something that looks more familiar. Mine will show up as USD ($), yours may vary depending on your environment variables.</p><pre>import locale<br>locale.setlocale( locale.LC_ALL, &#39;&#39; )</pre><p>The call to <em>setlocale </em>sets the default locale based on your LANG environment variable.</p><p>Now we can modify our amortize function with <em>locale.currency:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*yaOkjfo-ygTJt6dKV6SQsQ.png" /><figcaption>Updated amortize function</figcaption></figure><p>We simply placed the function call within the row append for each monetary item, and converted it to a location based currency with digit grouping. Here’s the new print out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*MNhtEncxtfo1-WN4eKUQHg.png" /><figcaption>Location based currency formatting with grouping</figcaption></figure><h3>Command Line Arguments</h3><p>As if that wasn’t enough, we can extend this a tad bit further. We can make use of the <em>argparse</em> library in order to reuse this application without needing to make changes to the code for different loan amounts, interest rates, or payment lengths.</p><p>There are many different ways to handle command line arguments in python, and argparse is only one such way. To get started we import the library like usual:</p><pre>import argparse</pre><p>Next we need to create an ArgumentParser object. To do that we will call it’s constructor much like we saw earlier with BeautifulTable. Then we will add a few arguments to our program. One for each variable of our function.</p><pre>parser = argparse.ArgumentParser()<br>parser.add_argument(&quot;value&quot;,help=&quot;Loan Value&quot;)<br>parser.add_argument(&quot;rate&quot;,help=&quot;Interest as a decimal(5% = .05)<br>parser.add_argument(&quot;years&quot;,help=&quot;Loan term in years&quot;)</pre><p>Failure to provide all of these items on the command line will result in a message similar to the following:</p><p><em>amortize.py: error: the following arguments are required: value, rate, years</em></p><p>Now we need to assign these command line arguments to variables that we can pass to our function. We do this by first parsing the arguments provided:</p><pre>args = parser.parse_args()</pre><p>Now we can access the data elements of our args object:</p><pre>value = args.value<br>rate = args.rate<br>pmt_yrs = args.years</pre><p>and finally call our amortize function with those variables:</p><pre>amortize(value, rate, pmt_yrs)</pre><p>By wrapping all of this into a main() function, we have a nice starting spot for our program. Note that I also cast each of the inputs as a float data type. This is to aid the calculation of fractional years, as well as the division involved with computing interest rates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*dOt-zYjfkJLNCBMcbDdn6A.png" /><figcaption>main() function</figcaption></figure><p>If you are coding along in IDLE then you’ll notice if you run the program with F5 you will get the error mentioned above. This is because no command line arguments were passed to the program, but it will still work. On the prompt you can simply call the function as your code would. Of course, if you’re running this from a command prompt you should have no issues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*fgWHfME7ULPHHC5X_YBuNA.png" /></figure><p>Putting everything together, we get the full loan payment schedule program below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*AeD4KQsAwaVOxJS1XSEeOw.png" /><figcaption>Full Program</figcaption></figure><p>Hopefully you enjoyed working through this example program, and will be able to apply the concepts here to other problems. If you enjoyed this content, please consider supporting over at <a href="https://www.patreon.com/TheCyberBasics">Patreon </a>or <a href="https://www.buymeacoffee.com/TheCyberBasics">BuyMeACoffee</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e49cc1c0c86" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/python-programming-fundamentals-loan-payment-schedule-3e49cc1c0c86">Python Programming Fundamentals — Loan Payment Schedule</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Programming Fundamentals — Dict, Set, and a List Refresher]]></title>
            <link>https://python.plainenglish.io/python-programming-fundamentals-dict-set-and-a-list-refresher-d8613dbbe881?source=rss-13fc25c74ba5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8613dbbe881</guid>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[TheCyberBasics]]></dc:creator>
            <pubDate>Wed, 17 Jun 2020 03:09:20 GMT</pubDate>
            <atom:updated>2020-06-17T08:43:01.781Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python Programming Fundamentals — Dict, Set, and a List Refresher</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*G4enAnXzMEq-keoa" /><figcaption>Photo by <a href="https://unsplash.com/@impatrickt?utm_source=medium&amp;utm_medium=referral">Patrick Tomasso</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Many times in programming, we want to keep track of certain items</h4><p>These items can be anything: names, data points, words, etc. Python provides a few different ways of tracking them that we’ll talk about today. These are the dictionary (<em>dict</em>), set (<em>set</em>) and we’ll also review a little bit about the most basic form, the list (<em>list</em>).</p><h3>Refresher on Lists</h3><p>If you remember from our first discussion on lists, a list is a python data structure created by the use of the square brackets [] or by using the <em>list </em>keyword like so:</p><pre>&gt;&gt;&gt; myList = list<br>&gt;&gt;&gt; myList<br>&lt;class &#39;list&#39;&gt;</pre><p><a href="https://medium.com/python-in-plain-english/programming-fundamentals-lists-loops-and-user-input-e7d1786151a2">Programming FUNdamentals — Lists, Loops, and User Input</a></p><p>Lists in python don’t care if you have multiple identical values within them. This means that given a list which contains the values “A”,”B”,”A” we get the following:</p><pre>&gt;&gt;&gt; myList = [&quot;A&quot;,&quot;B&quot;,&quot;A&quot;]<br>&gt;&gt;&gt; myList<br>[&#39;A&#39;, &#39;B&#39;, &#39;A&#39;]<br>&gt;&gt;&gt; for item in myList:<br> print(item)</pre><pre>A<br>B<br>A</pre><h3>Dictionaries</h3><p>What is a dictionary? Most commonly you’d think of it as a book (or website even) with words and definitions of those words. In programming we call the word a ‘key’ and the definition a ‘value’. They are often used together in a pair, creatively referred to as a ‘key-value pair’.</p><p>In python a dictionary is referred to by the shorter keyword <em>dict</em> and is symbolized by using the curly braces {}. Let’s take a look at a simple dictionary example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*0SNaUezCq-ZJPVXc_rpaMA.png" /><figcaption>Simple Phone book example</figcaption></figure><p>In the example, we begin by creating a variable <em>phone_book</em> which we will use to store some contact information for our friends John and Sally. In order to create the dictionary we need only use the curly braces, as well as the colon between key-value pairs. “JOHN” is the first key, with a value of “555–1234” so it’s pair is shown as <em>“JOHN”:”555–1234&quot;.</em></p><p>In order to find the value of a key we can use the list syntax we’re familiar with by placing the key inside square brackets [].</p><pre>&gt;&gt;&gt; phone_book[&quot;JOHN&quot;]<br>&#39;555-1234&#39;</pre><p>If you have a larger dictionary, maybe you’d like to see a list of the keys? The <em>keys()</em> function will provide access to every key in the dictionary. Likewise, the <em>values()</em> function will let you see each value stored. There are two ways to really see the keys though.</p><p>First, if you just want a quick view, you can print the result of the keys function</p><pre>&gt;&gt;&gt; phone_book.keys()<br>dict_keys([&#39;JOHN&#39;, &#39;SALLY&#39;])</pre><p>this prints the keys, stored in a dict_keys view. It’s important to note that even though it looks like you should be able to reference the values within this view by subscripts (i.e. [0] would be ‘JOHN’), you cannot. The view is considered <em>iterable</em> meaning that you can use something like this to access each object:</p><pre>&gt;&gt;&gt; for key in phone_book.keys():<br>    print(key)</pre><pre>JOHN<br>SALLY</pre><p>Dictionaries in Python don’t support multiple keys with the same name. For instance, even if you have two friends named John, you would need some other way to distinguish between them in our example. Why? see below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*_kCod2rP9S4zkHzFAW9rZA.png" /><figcaption>Where’s other John?</figcaption></figure><p>Python completely ignores the first instance of “John” in our dictionary and prints the phone number for our other friend John. The easiest way to mitigate this is to use keys which are unique to the key being inserted into the dictionary. Something like “John Doe” and “John Smith” would be more appropriate.</p><p>What if both entries were both for one friend, but who has two different phone numbers? We can solve this quite easily by using a list!</p><pre>&gt;&gt;&gt; phone_book = {&quot;JOHN&quot;:[&quot;555-1234&quot;,&quot;555-8888&quot;],&quot;SALLY&quot;:&quot;555-8888&quot;}<br>&gt;&gt;&gt; phone_book[&quot;JOHN&quot;]<br>[&#39;555-1234&#39;, &#39;555-8888&#39;]</pre><p>Another, slightly more complicated way would be to use more dictionaries!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*ldvjJ8J1swM_pi_aoIve_A.png" /><figcaption>Home and Work numbers for John</figcaption></figure><p>Here we can see that the value portion of our key is in fact, another dictionary with two key-value pairs. One for John’s home number, and one for his work number. We can search for John, and retrieve both numbers, or we can specify that we want his work number and retrieve only that. The only real limitation for what you can do here is your own imagination. You could store entire data structures of information within a dictionary value if you wanted to.</p><h3>Sets</h3><p>Sets are interesting, in that they also use the curly braces like Dictionaries however they do not use key-value pairs. They also do not allow multiple identical entries, meaning that each entry in a set is unique.</p><p>In addition set allow for a few additional operations, namely <em>union</em> and <em>intersection</em>. You may remember from math that a union operation will return a set containing all unique elements from both sets. Let’s look at an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*8yL0RZ2k_lMu6CwTTm0L6w.png" /><figcaption>Example of Set Operations</figcaption></figure><p>You can also take the difference between two sets by simply using the ‘-’ signor check set membership with the <em>in </em>keyword:</p><pre>&gt;&gt;&gt; a = {&quot;A&quot;,&quot;B&quot;,&quot;C&quot;}<br>&gt;&gt;&gt; b = {&quot;D&quot;,&quot;C&quot;,&quot;B&quot;,&quot;E&quot;}<br>&gt;&gt;&gt; b-a<br>{&#39;D&#39;, &#39;E&#39;}<br>..<br>&gt;&gt;&gt; &quot;D&quot; in a<br>False<br>&gt;&gt;&gt; &quot;D&quot; in b<br>True</pre><p>Again, the possibilities are limitless when you combine these three structures together. How do you use them? Let me know below or on Twitter @CyberBasics!</p><p>If you enjoyed this content, please consider supporting over at Patreon or BuyMeACoffee.</p><ul><li><a href="https://www.patreon.com/TheCyberBasics">TheCyberBasics is creating programming and cyber/network security articles | Patreon</a></li><li><a href="https://www.buymeacoffee.com/TheCyberBasics">TheCyberBasics is Creating Programming and Cyber-security articles</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8613dbbe881" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/python-programming-fundamentals-dict-set-and-a-list-refresher-d8613dbbe881">Python Programming Fundamentals — Dict, Set, and a List Refresher</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Programming Fundamentals — Loops]]></title>
            <link>https://python.plainenglish.io/programming-fundamentals-loops-2-0-b227c5fa4674?source=rss-13fc25c74ba5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b227c5fa4674</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python3]]></category>
            <dc:creator><![CDATA[TheCyberBasics]]></dc:creator>
            <pubDate>Thu, 04 Jun 2020 00:52:18 GMT</pubDate>
            <atom:updated>2020-06-04T17:14:50.588Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python Programming Fundamentals — Loops</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*83HRNUafVFo_QLx5" /><figcaption>Photo by <a href="https://unsplash.com/@twinsfisch?utm_source=medium&amp;utm_medium=referral">twinsfisch</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Previously, we looked at the <em>for</em> loop and used it to print out a list of items for the user the select from. This is fantastic, however sometimes we want to do something over and over until some condition is met.</p><p>Enter <em>while</em>. This loop structure allows you to continuously run some code until some condition is met (that you define). Let’s start off by looking at what the <em>while</em> loop looks like in Python.</p><pre>while &lt;condition&gt;:<br>    &lt;stuff to do&gt;<br></pre><p>This time, we’ll create a number guessing game in which the computer will pick a random-ish number. I say random-ish because most computers are only good for pseudo-random numbers. This means, given enough numbers it would be possible to predict the next number. For our purposes — and most purposes outside of Cryptography — this will be good enough.</p><p>Let’s start by creating a function called <em>pickRandom() </em>which will be responsible for….you guessed it, picking the random number. It’s important when writing programs to choose function names that indicate what the function is responsible for.</p><pre>def pickRandom():<br>    rnd = 10<br>    <br>    return rnd</pre><p>I know what you’re thinking…that’s not a random number. No, not yet atleast but we’ll get to it trust me. Random number generation is just a bonus topic here, we’re really trying to understand the <em>while</em> loop.</p><p>Now that we have this function, let’s create our <em>main()</em> which will be where the majority of our code will run from.</p><pre>def main():<br>    my_rnd = pickRandom()<br>    usr_guess = input(&quot;Take a guess at my random number&quot;)</pre><pre>while int(usr_guess) != my_rnd:<br>        usr_guess = input(&quot;Sorry, try again: &quot;)</pre><pre>print(&quot;Wow, how did you know?&quot;)</pre><p>Here we see the <em>while</em> loop in action. First we call <em>pickRandom()</em> to generate our “random” number and follow that up with a prompt for the user to try and guess that number. Then we enter the <em>while </em>loop. The logic of this condition may be confusing at first, we’re checking to see if the user’s input is NOT equal to our random number. If this is evaluated to True (meaning the user guessed incorrectly) we prompt the user to try again (and again, and again…). Now, if the user correctly guesses our number we print a congratulatory message and the program ends. Let’s see it in action:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*SY_yIZpv6IRQz-ojsv_rrA.png" /><figcaption>Exceptional guessing skills</figcaption></figure><p>*The important thing to notice here is that the while loop only executes when the condition evaluates to <strong>True</strong>*</p><p>One of the nice things about Python is that you can use the <em>else</em> clause with your while, so instead of having the print outside of the loop you could include it with the loop like so:</p><pre>def main():<br>    my_rnd = pickRandom()<br>    usr_guess = input(&quot;Take a guess at my random number&quot;)</pre><pre>while int(usr_guess) != my_rnd:<br>        usr_guess = input(&quot;Sorry, try again: &quot;)<br>else:<br>        print(&quot;Wow, how did you know?&quot;)</pre><p>In this instance, it makes no difference except to look a little cleaner.</p><p>So now we have a basic number guessing game that could keep the average kid busy for maybe 2 minutes. But we can do better. Let’s update our <em>pickRandom()</em> to get a new number each time the program is ran:</p><pre>def pickRandom(rnd_max):<br>    from random import randint<br>    rnd = randint(0,rnd_max)</pre><pre>    return rnd</pre><p>We’ve added a few things here so let’s go over them. The first thing we did was add a parameter to allow some flexibility in how large the pool of numbers can be. Next we needed to pull in a function from another <em>library</em>. Libraries are collections of pre-written code that adds functionality to your programs when you include them. Here we need the <em>randint</em> (read: Random Integer) function from the <em>random</em> library. If you wanted, you could simply run</p><pre>import random</pre><p>to import ALL of the functions from the <em>random</em> library, but that’s not necessary here. The <em>randint</em> function requires two arguments <em>a</em> and <em>b</em> which represent the lowest and highest numbers which can be generated. This is <em>inclusive</em> meaning if you want random numbers between 0 and 100 you can get 0 and up to and including 100 as possible numbers.</p><p>Another thing to note about the <em>randint</em> function is that it only returns whole numbers. No decimals here. If you’re truly cruel and wish for your user to guess random numbers with decimals, you could use the <em>random.random</em> function which will generate a random decimal number between 0 and 1. So for a number between 0 and 100 you would type:</p><pre>&gt;&gt;&gt; rnd = random.random() * 100<br>&gt;&gt;&gt; print(rnd)<br>48.47830553364575</pre><p>Truly cruel indeed.</p><p>The only modification we need to make to our <em>main</em> function is to add in the <em>rnd_max</em> argument.</p><pre>def main():<br>    my_rnd = pickRandom(20)<br>    usr_guess = input(&quot;Take a guess at my random number: &quot;)<br>    <br>    while int(usr_guess) != my_rnd:<br>        usr_guess = input(&quot;Sorry, try again: &quot;)<br>    else:<br>        print(&quot;Wow, how did you know?!&quot;)</pre><p>This will generate a random whole number between 0 and 20. Here’s the whole thing so far:</p><pre>def pickRandom(rnd_max):<br>    from random import randint<br>    rnd = randint(0,rnd_max)</pre><pre>    return rnd</pre><pre>def main():<br>    my_rnd = pickRandom(20)<br>    usr_guess = input(&quot;Take a guess at my random number: &quot;)<br>    <br>    while int(usr_guess) != my_rnd:<br>        usr_guess = input(&quot;Sorry, try again: &quot;)<br>    else:<br>        print(&quot;Wow, how did you know?!&quot;)</pre><pre>main()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*9UnO8zK5p6_ar-m-YsheSQ.png" /><figcaption>That was a little harder..brute-force for the win</figcaption></figure><p>This works well, but what if we wanted to play … multiple times? Let’s move our current <em>main </em>function over to another function called <em>play()</em>. Other than the name change, the function will remain the same.</p><pre>def play():<br>    my_rnd = pickRandom(20)<br>    usr_guess = input(&quot;Take a guess at my random number: &quot;)<br>        <br>    while int(usr_guess) != my_rnd:<br>        usr_guess = input(&quot;Sorry, try again: &quot;)<br>    else:<br>        print(&quot;Wow, how did you know?!&quot;)</pre><p>Now let’s update <em>main</em> to add a few things. One of these will be a <em>flag</em> variable which will determine whether the game is played multiple times. Let’s look at the code, and go over it piece by piece:</p><pre>def main():<br>    again = True<br>    while again:<br>        play()<br>        playAgain = input(&quot;Play again? : &quot;)<br>        if playAgain[0].upper() == &quot;N&quot;:<br>            again = True<br>        else:<br>            again = False</pre><p>Our flag variable is called <em>again</em> and we start it out as True. What would happen if we started it out as False? Our <em>while</em> loop would never run, because it would evaluate our condition as False. Next, we call <em>play</em>, which simply runs our game. Once the game is over the user will be prompted with a message asking if they would like to play again. The next line looks a little strange:</p><pre>if playAgain[0].upper() == &quot;N&quot;:</pre><p>This line basically says “If the first character of the contents of playAgain is the letter N”. Since Python treats strings as lists of characters, you can refer to each character individually by using the same syntax you would use on a list, namely the [<em>x</em>] syntax (where the x is any number between 0 and the length of your string). Next we take that character, and use a function from the string library called <em>upper()</em> which takes any character and makes it uppercase. Finally we check to see if that character “is equal to” the letter “N”.</p><p>It’s important to note the difference between “=” and “==” when dealing with variables. “=” is an assignment, meaning <em>variableName</em> <em>= value.</em> “==” is a validation check, meaning “<em>is variableName equal to value”. </em>Ever since I learned the difference, in my head I always say “is equal to” when using “==”.</p><p>If the user types “N”, “n”, “No”,”no”, etc. then the <em>again</em> variable will be set to False, and the game will end. If the user enters a response starting with anything other than the letter N then the game will continue with a new random number.</p><p>Here’s the final code with a look at how the game runs:</p><pre>def pickRandom(rnd_max):<br>    from random import randint<br>    rnd = randint(0,rnd_max)</pre><pre>return rnd</pre><pre>def play():<br>    my_rnd = pickRandom(20)<br>    usr_guess = input(&quot;Take a guess at my random number: &quot;)<br>        <br>    while int(usr_guess) != my_rnd:<br>        usr_guess = input(&quot;Sorry, try again: &quot;)<br>    else:<br>        print(&quot;Wow, how did you know?!&quot;)<br>        <br>def main():<br>    again = True<br>    while again:<br>        play()<br>        playAgain = input(&quot;Play again? : &quot;)<br>        if playAgain[0].upper() == &quot;N&quot;:<br>            again = False</pre><pre>main()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*v5H9CyYmAM20rXQzxmA0-A.png" /><figcaption>Full game, multiple tries</figcaption></figure><p>That does it for this article, hopefully you learned a little bit about the <em>while</em> loop with some random numbers thrown in for fun. As an extension, you could do one of the following:</p><ul><li>Restrict the user to a certain number of turns.</li><li>Award points to users and keep track of the highest scoring users in a variable.</li><li>Add in a “higher/lower” feature which aids the user in guessing the number (maybe after they exceed the max tries).</li></ul><p>I hope you enjoyed this article, if so please consider following me on Medium or supporting me on Patreon (<a href="https://www.patreon.com/TheCyberBasics">https://www.patreon.com/TheCyberBasics</a>). If you’d like to contribute but you’re looking for a little less commitment you can also BuyMeACoffee (<a href="https://www.buymeacoffee.com/TheCyberBasics">https://www.buymeacoffee.com/TheCyberBasics</a>).</p><h4><strong>In Plain English</strong></h4><p>Show some love by <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>subscribing to our YouTube channel</strong></a><strong>!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b227c5fa4674" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/programming-fundamentals-loops-2-0-b227c5fa4674">Python Programming Fundamentals — Loops</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 5 Technical Skills Needed To Start In Cybersecurity]]></title>
            <link>https://thecyberbasics.medium.com/the-5-technical-skills-needed-to-start-in-cybersecurity-857606245116?source=rss-13fc25c74ba5------2</link>
            <guid isPermaLink="false">https://medium.com/p/857606245116</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[TheCyberBasics]]></dc:creator>
            <pubDate>Mon, 25 May 2020 17:18:32 GMT</pubDate>
            <atom:updated>2020-05-25T17:18:32.965Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tmEwxRH3cWneVtyd" /><figcaption>Photo by <a href="https://unsplash.com/@euwars?utm_source=medium&amp;utm_medium=referral">Farzad Nazifi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In the previous article, we looked at five non-technical (soft) skills needed to get started in the cybersecurity field. Today we’ll take a look at five <strong>technical</strong> skills needed to get started.</p><p><a href="https://medium.com/@thecyberbasics/the-5-skills-needed-to-start-in-cybersecurity-7f8a2f6538fb">The 5 Skills Needed To Start In Cybersecurity</a></p><h3>5. Operating Systems Fundamentals</h3><p>Knowing the basics of how your operating system of choice works will aid tremendously in cybersecurity. Take for Linux for example. Within the operating system are numerous services and capabilities that could be useful when trying to secure the system or even when performing security or vulnerability assessments.</p><p>If you’re new to Linux, the learning curve may appear steep however there are many quality avenues for learning the basics like the ones below.</p><ul><li>This course is a complete introduction to Linux and assumes basic knowledge of computers:<br><a href="https://www.edx.org/course/introduction-to-linux">https://www.edx.org/course/introduction-to-linux</a></li><li>OverTheWire is great for getting your feet wet with the Linux command line. The Bandit WarGame starts off simple and builds in difficulty across 34 levels. Knowledge of Secure Shell (SSH) is required to play, however, the site provides excellent references for those who have never used it before:<br><a href="https://overthewire.org/wargames/">https://overthewire.org/wargames/</a></li></ul><h3>4. Programming Fundamentals</h3><p>Regardless of your starting point in cybersecurity, it is inevitable that at some point you will need to write some code. That code could be to automate some small tasks or to develop an entirely new web application, regardless, knowing how to program is a skill that can grow with you as you progress in your career. There are far too many excellent resources online to list them all, but here is a couple that will help you get started.</p><ul><li>From HTML to Python, CodeAcademy has courses that will guide you through the learning process so that you can pick up a new language very quickly. They also have courses for Data Science including SQL and R:<br><a href="https://www.codecademy.com/">https://www.codecademy.com/</a></li><li>KhanAcademy has multiple lessons on HTML, Web Development, and Computer Science fundamentals:<br><a href="https://www.khanacademy.org/computing">https://www.khanacademy.org/computing</a></li></ul><p><em>Shameless plug, I also write beginner Python articles and I hope that you will also consider checking those out: </em><a href="https://medium.com/@thecyberbasics">https://medium.com/@thecyberbasics</a></p><p><a href="https://medium.com/@thecyberbasics">TheCyberBasics - Medium</a></p><h3>3. Networking Fundamentals</h3><p>Computer networking is the backbone of communication in today’s world so having an understanding of how it works is necessary to be successful. You’ll need to be familiar with the seven layers of the OSI model and how packets are sent across networks. In order to do this here are a few resources for online study.</p><ul><li>The University of Michigan offers a free course through Coursera regarding the History of the Internet and includes an introduction to TCP/IP networking:<br><a href="https://www.coursera.org/learn/internet-history">https://www.coursera.org/learn/internet-history</a></li><li>This article from TheGeekStuff walks you through packet creation and transmission across a network in a quick overview:<br><a href="https://www.thegeekstuff.com/2011/11/tcp-ip-fundamentals/">https://www.thegeekstuff.com/2011/11/tcp-ip-fundamentals/</a></li></ul><h3>2. Automation Fundamentals (DevOps)</h3><p>DevOps is the intersection of Development and Operations in a computing environment. Having a strong foundation in DevOps translates into having a strong foundation in automation and quality control. The foundations of automation include understanding how to use tools such as Ansible to automate the tasks of creating and deploying servers, and can even be extended to setting up and securing networking equipment. This is a huge field within cybersecurity so finding resources is a little overwhelming. Listed here are a couple that could be useful to you.</p><ul><li>EdX has multiple courses aimed at providing entry-level DevOps knowledge and is definitely worth a look:<br><a href="https://www.edx.org/learn/devops">https://www.edx.org/learn/devops</a></li><li>RedHat provides foundational training on Ansible and how to get started using this excellent automation software:<br><a href="https://www.ansible.com/resources/get-started">https://www.ansible.com/resources/get-started</a></li></ul><h3>1. System Administration Fundamentals</h3><p>The most important skill for success in cybersecurity is a solid foundation in system administration. From building user-profiles and managing network policies to creating databases and hardening servers, the system administration work roles encompass a large portion of the skillsets needed to excel in cybersecurity. You could argue that cybersecurity is a subset of system administration given how much of the skill sets overlap. Here are a couple of resources to help get started with system administration.</p><ul><li>Google provides this excellent Coursera course as part of their Google IT Support Professional certificate, it goes into detail about what system administration is and provides examples of how to design and build an Active Directory structure:<br><a href="https://www.coursera.org/learn/system-administration-it-infrastructure-services">https://www.coursera.org/learn/system-administration-it-infrastructure-services</a></li><li>CyborgInstitute provides a write up describing the skills necessary for success as a system administrator, in reading you’ll notice many of the skills overlap with that of cybersecurity:<br><a href="http://cyborginstitute.org/projects/administration/fundamentals/">http://cyborginstitute.org/projects/administration/fundamentals/</a></li></ul><p>One thing to notice about this list is that each item listed includes the words “Fundamentals”. This is key because in order to be successful in cybersecurity you don’t need to master every topic, but you need to have a wide variety of exposure to technology and systems in order to build your knowledge on. I also kept to free resources, there are MANY quality resources out there that provide training at a cost, which many times will come with completion certificates or even industry certifications to help build your resume.</p><p>Thank you for reading. If you enjoyed this article, please consider supporting over at <a href="https://www.patreon.com/TheCyberBasics">Patreon</a>. You can also find me on Twitter @BasicsCyber.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=857606245116" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Programming FUNdamentals — Lists, Loops, and User Input]]></title>
            <link>https://python.plainenglish.io/programming-fundamentals-lists-loops-and-user-input-e7d1786151a2?source=rss-13fc25c74ba5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7d1786151a2</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[TheCyberBasics]]></dc:creator>
            <pubDate>Tue, 19 May 2020 03:14:34 GMT</pubDate>
            <atom:updated>2020-06-08T00:21:08.935Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python Programming Fundamentals— Lists, Loops, and User Input</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lURKwrmgZSIZ08i4" /><figcaption>Photo by <a href="https://unsplash.com/@cgower?utm_source=medium&amp;utm_medium=referral">Christopher Gower</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Last time, we created a simple function to convert Fahrenheit to Celsius. This was about as simple as we could go without simply printing “Hello World” to the screen. This time we’re going to take a look at lists, loops, and user input.</p><p>We’ll be working with another toy program in which a user will be prompted to pick their favorite food and the computer, in an attempt to please its new-found friend, will say that it is also its favorite food as well. Let’s dive right in and look at the code. Don’t worry if there are pieces you don’t understand, we’ll go over each part.</p><pre>def fav_food():<br>    foods = [&quot;Pizza&quot;, &quot;Cheeseburger&quot;, &quot;Salad&quot;, &quot;Chicken&quot;]<br>    for i,item in enumerate(foods):<br>        print(i+1,item)</pre><pre>    mine = input(&quot;Which of these is your favorite? : &quot;)<br>    print(foods[int(mine)-1 + &quot; is my favorite too!&quot;)</pre><pre>def fav_food():</pre><p>This part should be familiar from our previous program, we’re creating a <em>function</em> called fav_food. The empty () means we don’t provide any parameters to the function.</p><pre>foods = [&quot;Pizza&quot;, &quot;Cheeseburger&quot;, &quot;Salad&quot;, &quot;Chicken&quot;]</pre><p>Here we are creating a variable named <em>foods, </em>however, instead of storing one value in our box, we’re storing multiple values. In fact, we’re storing a <em>list</em> of values. In Python, using the [] brackets indicate we are creating a list of items. Lists are comma-separated and can contain multiple different <em>data types. </em>Think of it as multiple boxes within your larger box. You could even store lists within your lists (crazy, I know).</p><p>In our case, each <em>element</em> of the list is a string of characters (called a <em>string data type</em>). Elements can be referenced by specifying their location within the list. This is a good time to mention that in programming languages sometimes you start counting at the number 0 and Python is one of those languages. For example, if you wanted to get “Salad” out of the list above you would reference:</p><pre>foods[2]</pre><p>To which you would see “Salad” printed to the screen.</p><pre>for i,item in enumerate(foods):<br>    print(i+1, item)</pre><p>Here’s our loop. In this case, it’s a <em>for loop</em> and uses a special built-in function of Python called <em>enumerate(). </em>This will do two things, the first is it will <em>iterate</em> over the list (move from one item to the next) and keep count of the index of that item (stored in the variable <em>i</em>) and second it will keep track of the current item within the list (stored in the variable <em>item</em>).</p><p>The <em>for</em> portion of the line will repeat for every item within the list and will run whatever code is within the loop. In this case, we will be printing the current index (+1, since we start at 0) as well as the current item in the list. Let’s take a look at what this looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*JFWpa7WOQpQWWjJZizqscg.png" /><figcaption>Printing items in a list with enumerate()</figcaption></figure><p>As you can see, each item from the list is printed, along with its index in the list (+1).</p><p>Next, we need to get the user’s input to figure out what their favorite food is:</p><pre>mine = input(&quot;Which of these is your favorite? : &quot;)</pre><p>We create a variable and instead of specifying what the value that will be stored is, we call another built-in function <em>input</em> which in our example takes one argument which is the message prompt printed to the screen. Any information provided by the user will be stored in the variable <em>mine</em>. For instance, if you typed the number 2 and pressed enter then <em>mine</em> would store the <strong>string </strong>value “2”.</p><p>Finally, we need to print message back to the user, proclaiming that their favorite food is also ours:</p><pre>print(foods[int(mine)-1] + &quot; is also my favorite!&quot;)</pre><p>There’s some weird stuff happening here. Let’s look at the first piece:</p><pre>foods[int(mine)-1]</pre><p>Here we’re looking up a value in our list, and the location we’re looking at will be calculated by <em>casting</em> the user-supplied value as an <em>integer</em> (a number for our purposes) and subtracting 1. This is important because even though we don’t like starting at 0 for counting purposes, the list always starts at 0. Let’s take a look at some code running:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*QXxOXGX-OhHK35zDVRh1mA.png" /><figcaption>Printing User’s food choice</figcaption></figure><p>There are a few things being shown above. First, if we don’t <em>cast</em> our user’s input the interpreter considers it a string and causes a TypeError. Next, if we don’t subtract 1 from our user input we get the incorrect food item. Finally, by casting to an integer and subtracting 1 we get the actual food the user selected.</p><p>Once we have that information we can <em>concatenate</em> (or join) the food with the statement “ is also my favorite”. In Python, the plus sign + can be used for either addition (given numbers) or to join strings into one.</p><p>Let’s put everything together now, and see the final result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*kYZVmcoqcTltZfdLnmS15g.png" /><figcaption>I don’t think the computer is being honest</figcaption></figure><p>A curious reader could extend this example to allow the computer to select a <strong>random</strong> food, possibly a topic for the next tutorial ;).</p><p>If you enjoyed this content, please consider supporting over at Patreon (<a href="https://www.patreon.com/TheCyberBasics">https://www.patreon.com/TheCyberBasics</a>).</p><h4><strong>A note from the Plain English team</strong></h4><p>Did you know that we have four publications and a YouTube channel? You can find all of this from our homepage at <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> — show some love by giving our publications a follow and <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>subscribing to our YouTube channel</strong></a><strong>!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7d1786151a2" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/programming-fundamentals-lists-loops-and-user-input-e7d1786151a2">Programming FUNdamentals — Lists, Loops, and User Input</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 5 Skills Needed To Start In Cybersecurity]]></title>
            <link>https://thecyberbasics.medium.com/the-5-skills-needed-to-start-in-cybersecurity-7f8a2f6538fb?source=rss-13fc25c74ba5------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f8a2f6538fb</guid>
            <category><![CDATA[getting-started]]></category>
            <category><![CDATA[being-successful]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[TheCyberBasics]]></dc:creator>
            <pubDate>Fri, 15 May 2020 00:05:13 GMT</pubDate>
            <atom:updated>2020-05-15T00:05:13.785Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2g9cLPUsJp78awbI" /><figcaption>Photo by <a href="https://unsplash.com/@freestocks?utm_source=medium&amp;utm_medium=referral">freestocks</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Admittedly there is no firm, all-inclusive list of everything a person would need in order to get started in or be successful in such a vast field as Cybersecurity. The goal of this article is not to tell you how to become a cybersecurity master, but instead to outline the skills needed to be successful.</p><h3>5. A Strong Desire to Learn</h3><p>Anyone in cybersecurity will tell you that if you want to succeed you will never stop learning. From degree programs and certifications to learning new programming languages and frameworks, there is an incredible amount to learn and know. The good thing is, you don’t have to know it all (and honestly, it may be impossible for you to know everything). The best practitioners are those who never stop learning, but also leverage those around them that have already learned and specialized in one field or another.</p><h3>4. Attention to Detail</h3><p>Being able to spot the smallest of vulnerabilities within code or a networked system can be the difference between securing the corporate infrastructure, and having to respond to an incident. Having strong attention to detail will also aid in ethical hacking, such as bug bounties and penetration tests, where you need to be able to spot small discrepancies in code to leverage for code execution during a pentest.</p><h3>3. Communication Skills</h3><p>This doesn’t necessarily mean verbal or written explicitly. Being able to convey your ideas, concerns, findings is a valuable skill no matter what specialization or level of management you may find yourself. When delivering a brief or writing a proposal or report your ability to effectively communicate will set you above others in the field.</p><h3>2. Critical Thinking Skills</h3><p>Given a problem, how do you come to a solution? Is the solution a brute force effort (try <em>everything</em>) or is it an efficient and effective solution that can be standardized and repeated? Being able to think critically and develop unique solutions to problems is incredibly important to anyone within cybersecurity from the most junior network analyst to the senior CISO of a large company.</p><h3>1. Be Personable</h3><p>The standard image of someone working in cybersecurity is the stereotypical “hacker” loner who wears a black hoodie and sits in a dark room with the green font on a black terminal, feverishly typing away against their next target. For better or worse, that is not at all what the modern cybersecurity professional looks like. Today, cybersecurity professionals work in teams to accomplish the job, and being personable aids tremendously in that effort.</p><p>You may have noticed that there isn’t any mention of specific programming languages, penetration skills, or server technologies listed above. This is intentional. The skills listed above are called <em>soft skills</em> and refer to the human aspect. They cannot be easily taught or learned, and are rather developed over time. There are certainly <em>hard skills</em> such as knowledge of computer networking and programming that are needed to be successful as well, but having a firm grasp on these five elements will land you firmly on the path to success.</p><p>Thank you for reading. If you enjoyed this article, please consider supporting over at <a href="https://www.patreon.com/TheCyberBasics">Patreon</a>. You can also find me on Twitter @BasicsCyber.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f8a2f6538fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Programming FUNdamentals — Functions and Variables]]></title>
            <link>https://python.plainenglish.io/programming-fundamentals-functions-and-variables-b7a6d11c220d?source=rss-13fc25c74ba5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7a6d11c220d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[dev]]></category>
            <category><![CDATA[python3]]></category>
            <dc:creator><![CDATA[TheCyberBasics]]></dc:creator>
            <pubDate>Thu, 14 May 2020 03:24:17 GMT</pubDate>
            <atom:updated>2020-06-08T00:22:13.760Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python Programming Fundamentals — Functions and Variables</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*NZKoM1USwRDz5esRNgWtUg.jpeg" /><figcaption>Image from Clement H. on Unsplash</figcaption></figure><p>Many times when I start learning a new programming language I try and create small “toy” programs that teach me something fundamental about the languages while using standard programming constructs I’ve picked up through learning how to program in general.</p><p>The first concept we’ll visit is a <em>function</em>.</p><p>A function, in terms of programming, is a portion of code that returns some value (not to be confused with a procedure, which returns no value). This value can be as simple as a return code telling the user that it successfully completed, or in many cases, is the result of some computation.</p><p>Our goal in this article will be to create a Fahrenheit to Celcius temperature converter and in order to do that we’ll need some functions. Go ahead and open up your Python IDLE and type the following code into the &gt;&gt;&gt; prompt:</p><pre>def FtoC(temp):</pre><p>This piece of code is called a function definition in python and is used to create a new function. The python keyword ‘<em>def’</em> stands for “define” or “definition” and lets the interpreter know you are creating a function. The next piece, <em>‘FtoC’</em>, is the name of our function. It doesn’t matter what you name it, but you’ll thank yourself later if you name it something meaningful to the application. The next part is the parameters which we will call our function with, in this case ‘<em>(temp)’. </em>The information between the parenthesis is the actual parameter, in this case, we only need one variable <em>temp</em>.</p><p>A <em>variable</em> is like a special box, that you can store information into and retrieve whenever you need it. Python is quite forgiving in that you can change the information inside the box anytime you wish. This means you could do the following:</p><pre>myVariable = 5<br>myVariable = “string cheese”</pre><p>Python will allow this change to happen because python is considered a <em>dynamically typed language</em>. Which is just fancy talk for figuring out what kind of information is stored in a box whenever the program is run.</p><p>Finally, we type the colon character to let Python know we are done creating the <em>signature</em> of our function. Hitting enter in IDLE will drop you down to the next line, <strong>indented four spaces. *Note: </strong>This is important, white space (the indentations and spacing in a program) matters in Python, so much so there is an eternal debate regarding the use of tabs vs spaces. IDLE will automatically indent by four spaces.</p><p>Now we can tell the function what we want to do. For right now, we will simply return whatever is stored in the ‘<em>temp’</em> box when the function is called. In order to do this, simply type:</p><pre>return temp</pre><p>Now hit enter two times, and you should have the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*Yz94UjC8QEzurSRAM3DznA.png" /><figcaption>Simple function in python</figcaption></figure><p>Now we can actually call the function! Doing so is very simple, type the following into IDLE and hit enter:</p><pre>&gt;&gt;&gt; FtoC(15)</pre><p>You should see the number 15 printed on the next line. Interestingly, you could provide any information into the function and have that data printed back to the screen. Go ahead and try it with something like the following:</p><pre>&gt;&gt;&gt; FtoC(“This is a test”)</pre><p>You’ll see that “This is a test” will be printed on the line below. What happens if you don’t supply the “”? We’ll you’ll get an error like this one:</p><pre>&gt;&gt;&gt; FtoC(This is a test)<br>SyntaxError: invalid syntax</pre><p>or even worse…</p><pre>&gt;&gt;&gt; FtoC(TEST)<br>Traceback (most recent call last):<br> File “&lt;pyshell#6&gt;”, line 1, in &lt;module&gt;<br> FtoC(test)<br>NameError: name ‘test’ is not defined</pre><p>In the first case, Python assumes that the <em>arguments</em> provided are a logical statement and attempts to evaluate it, which is impossible and gives a SyntaxError indicating that your statement is incorrect.</p><p>The second case provides a different error because python is attempting to look inside of a variable named TEST. This variable does not exist, so we see a NameError telling us that our variable doesn’t exist.</p><p>So now we have a straight forward program to print out some data that is provided to the function. But we want to convert Fahrenheit to Celsius. The formula for the conversion is the following:</p><p><strong><em>C = (F − 32) × (5/9)</em></strong></p><p>The parenthesis around 5/9 in the formula is only needed for readability.</p><p>Let’s update our function to look like the one below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/1*iZrrxRezlpab4zPYO_f1Vg.png" /><figcaption>Updated Python Function</figcaption></figure><p>Now when we call the function with a temperature in Fahrenheit, we will get the converted Celsius temperature.</p><pre>&gt;&gt;&gt; FtoC(135)<br>&gt;&gt;&gt; 57.2222222</pre><p>One thing to note, if you enter anything other than a number, the program will error. But that’s a topic for another article.</p><p><strong>BONUS: </strong>As an exercise, write the CtoF function to convert Celsius temperatures to Fahrenheit.</p><p>Thank you for reading. If you enjoyed this article, please consider supporting over at <a href="https://www.patreon.com/TheCyberBasics">Patreon</a></p><h4><strong>A note from the Plain English team</strong></h4><p>Did you know that we have four publications? Show some love by giving them a follow: <a href="https://medium.com/javascript-in-plain-english"><strong>JavaScript in Plain English</strong></a>, <a href="https://medium.com/ai-in-plain-english"><strong>AI in Plain English</strong></a>, <a href="https://medium.com/ux-in-plain-english"><strong>UX in Plain English</strong></a>, <a href="https://medium.com/python-in-plain-english"><strong>Python in Plain English</strong></a><strong> </strong>— thank you and keep learning!</p><p>We’ve also launched a YouTube and would love for you to support us by <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>subscribing to our Plain English channel</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7a6d11c220d" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/programming-fundamentals-functions-and-variables-b7a6d11c220d">Programming FUNdamentals — Functions and Variables</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Programming Fundamentals — Setting up your environment]]></title>
            <link>https://python.plainenglish.io/programming-fundamentals-setting-up-the-environment-139e28c3a4be?source=rss-13fc25c74ba5------2</link>
            <guid isPermaLink="false">https://medium.com/p/139e28c3a4be</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[TheCyberBasics]]></dc:creator>
            <pubDate>Sun, 10 May 2020 02:30:14 GMT</pubDate>
            <atom:updated>2020-06-04T17:15:07.518Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python Programming Fundamentals — Setting up your environment</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*HQO2mlMCy1M8edJaHqMyqA.jpeg" /></figure><p>Have you ever looked at a program and thought to yourself…”There’s no way I can do that, it’s too complicated”? Well don’t worry, this article will be the first of several to introduce the basics of programming to even the most uninitiated beginner. Our language of choice will be the Python programming language due to its simplistic syntax and low learning curve. But before we get down to business, there are a few details to hammer out.</p><ol><li><strong>Development environment.</strong><br>When writing code, it’s important to have an environment that supports your habits and programming style. Each programmer will have their personal favorites and convincing them another environment is better is a futile task at best. <br>One such environment is the Python IDLE, which is included with the standard installation of Python on Windows. IDLE is as barebones as you can get for a full python <em>interpreter</em>. You type Python statements in, and a result is returned. <br>Other notable environments include the PyCharm Integrated Development Environment (IDE) and the Anaconda platform. Both of these programming environments support add-ins which allow developers to add functionality for specific applications, such as Data Science or Machine Learning.<br>Of course, there is no formal requirement to even have a Python IDE to write code! You can use something as simple as a text editor like Notepad on Windows, or Vim/Vi/Gedit on Linux.</li><li><strong>Installing Python<br></strong>This process will look slightly different depending on which operating system you are working with so we’ll cover a couple of possible options.<br><strong>Windows (64-Bit)<br></strong>Head on over to <a href="https://www.python.org/downloads/windows/">https://www.python.org/downloads/windows/</a> and download the Python package titled “Download Windows x86–64 executable installer” for the 64-bit installer. This will ensure you have the latest stable Python installer available. You may notice a version for Python 2, however, you should avoid this as Python has dropped support for Python version 2 as of January 1, 2020. Follow the prompts for installing the package and you’re good to go. (*Note, make sure to select “Add Python 3.8 to Path” as this will allow you to run the python3 executable from a location other than directly from the install folder).<br><strong>Linux</strong><br>Linux is a bit harrier, not because it’s difficult but because there are so many different flavors of Linux available. For the purposes of this and any Linux specific articles, I will provide examples for a Debian based system such as Ubuntu.<br>In order to install Python 3 on Ubuntu type the following commands into a terminal:<br><em>sudo apt-get update<br>sudo apt-get install python3 -y</em><br>These commands will ensure your package manager (apt) is fully up to date and pull the most recent python available.</li><li><strong>Start the IDLE</strong><br>Once you have finished installing on Windows, press the Windows key and type ‘IDLE’. The top result should be your new Python IDLE. You should see something similar to the below.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*8ScevIqrEj96gcavmdPAPQ.png" /><figcaption>Python 3 IDLE</figcaption></figure><p>If you’ve been able to follow along so far you now have a fully working Python interpreter. As is seemingly required in all programming courses, we will start with the “Hello, World” example. The purpose of this example will demonstrate how to print statements in Python.</p><p>Inside your IDLE type the following: <em>print(“Hello, World”)</em> and hit Enter. You should see exactly the same thing as below. There are a few key points to note about what you just typed. First, “print” is what is called a <em>function</em>. A Function is responsible for doing something in a program, that something could be printing a statement, or performing a calculation. Next, the quotations tell the print function that we want this <em>string</em> displayed on the screen. You can absolutely replace “Hello, World” with any string you like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*SDIOxkc9buhz-pe4XtsXLw.png" /><figcaption>Obligatory Hello World Example</figcaption></figure><p>This is very much the bare bones needed to set up a good python programming environment. In the next article, we will discuss more basics such as variables, loops, and arithmetic operations in order to build our first full program: A Fahrenheit to Celcius temperature converter!</p><p>Thank you for reading. If you enjoyed this article, please consider supporting over at <a href="https://www.patreon.com/TheCyberBasics">Patreon</a></p><h4><strong>A note from the Plain English team</strong></h4><p>Did you know that we have four publications? Show some love by giving them a follow: <a href="https://medium.com/javascript-in-plain-english"><strong>JavaScript in Plain English</strong></a>, <a href="https://medium.com/ai-in-plain-english"><strong>AI in Plain English</strong></a>, <a href="https://medium.com/ux-in-plain-english"><strong>UX in Plain English</strong></a>, <a href="https://medium.com/python-in-plain-english"><strong>Python in Plain English</strong></a><strong> </strong>— thank you and keep learning!</p><p>We’ve also launched a YouTube and would love for you to support us by <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>subscribing to our Plain English channel</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=139e28c3a4be" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/programming-fundamentals-setting-up-the-environment-139e28c3a4be">Python Programming Fundamentals — Setting up your environment</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>