Python Lists


Lists are a big deal. It really can’t be overemphasized what a big deal they are. Lists are not only used for iterating through data, but they are also a popular data storage and
categorization method used for handling data as a program is running. For anyone who’s programmed in another language, lists are often known as arrays.

Lists may be either very simple or very complex, but they all follow the same rules. Lists may contain different types of data, but be careful when working with it. If you create a list that mixes, say, strings and floats, be sure not to try to call a string method on a list item containing a float.

Remember when the string guides said that strings were just a list of characters. Well, now’s the time to be glad that you paid attention to strings. You can do many of the same things that you did
with strings with lists, and you can do them in the same way. So, some of this is going to feel like a repeat of the string guide, but don’t break focus. There are differences, and there are list
specific methods, so assuming that strings and lists are the exact same this will get you into trouble.

Creating a List

Creating a list is a bit different than the other variables that you’ve learned about so far. You can create a list with absolutely no values in it at all. This is useful for situations where you
don’t exactly know what will be added to the list because the data isn’t in the program yet. There will also be plenty of situations where you won’t be sure how many entries will be in a list, so
again, creating an empty one and adding data later is the right move.

Read more

Python Multidimensional Lists


Now it’s time to take lists to a new dimension. No, you don’t need to learn how to code in “The Upside Down,” but there are additional degrees of complexity to lists. Lists are used to hold data,
but they are also used to categorize it. Values inside a list can be further broken down into other sets. That’s essentially what a multidimensional list is.

Two Dimensional Lists

What is a list that holds lists? That’s all a two dimensional list is. The list below consists of three lists. Each of the three lists has five elements. Don’t worry about numbers quite yet. Just
focus on the top level elements, the lists. You can access them the way you would any element in a normal list.

number_sets = [[2, 4, 6, 8, 10], [3, 6, 9, 12, 15], [4, 8, 12, 16, 20]]

Read more

Python Tuples


Tuples are immutable data sets made up of data of different types. While tuples are very similar to lists, they are different in those key ways.

Tuples cannot be changed once they are created. The data they hold can be passed to a different tuple, but the original tuple cannot be changed. This means that tuples don’t have methods for
manipulating them like lists do because they cannot be manipulated.

Like lists, tuples can also contain data of different types. Tuples can contain strings, integers, floats, booleans, and
even lists. Because tuples are immutable, they aren’t meant to be manipulated, so data types don’t matter nearly as much.

Read more

Python While Loops


Many times in programming, you will need to repeat the same task many times. In fact, looping through and repeating an operation is one of the cornerstones of programming. After all, one of the things that computers are way better than humans at is performing repetitive tasks without getting tired or making mistakes.

One of the simplest ways to make a program repeat the same task is to use a while loop. A while loop repeats the same block of code while a condition is true. When that condition becomes false, the loop will break, and the regular flow of code will resume.

The structure of a while loop is similar to what you encountered in the last guide with if. A while loop begins with the word while followed by parenthesis containing the condition of the loop and a colon. The following lines are indented and will execute in the loop.

Infinite While

Check out this while loop. Try it yourself in your interpreter to see exactly what it does. You might be somewhat surprised.

# Import time for sleep
import time

# While loop

What happened? Rather, what is happening? If you haven’t figured out how to stop it yet, just press Ctrl+C. A while loop will run indefinitely as long as the condition that it is given remains True. The loop above was given True as its condition, which will never not be true.

Read more

Python For Loops


There is yet another type of loop. That loop is designed for iterating sets of data. That’s right, lists. Unlike while loops, these for loops have a defined length based on the data set that they are iterating over.

Generally, for loops are used to access and modify each element in a list. To do this, they temporarily represent each element as a new variable used only within the loop.

for loops have a slightly different structure than while loops do. They begin with the word for, which is followed by the temporary variable being created for the loop. Then there is the keyword in specifying the set of data being used, followed by the data set itself and, ultimately, a colon.

For With Range

There is a method called range() that either takes a single number and behaves like a list of numbers going from zero until the number before the one specified or takes two numbers separated by a comma and acts like a slice starting at the first number and listing all numbers until the number before the last one.

Read more

Python Dictionaries


Somebody hit lists with gamma rays. Okay, so Dictionaries aren’t the Incredible Hulk, but they are supercharged in what they can do. In other languages, dictionaries are referred to as hashes, associative arrays, and associative lists. It’s probably best to think of them as associative lists because that’s exactly what they are. Dictionaries are lists that associate two values with one another. To think of it in terms of an actual dictionary, they associate a word, or key with a definition, or value. They function sort of like a list with custom indexes.

Read more

Python Advanced Dictionaries


You’ve already gotten acquainted with dictionaries, but just like the other data structures Python supports, there are methods and more powerful ways to use them. There aren’t as many methods for working with dictionaries as there are for lists, but that’s because dictionaries just don’t need them. Plus, many of the ones that do exist, work to break down dictionaries into lists and tuples to make them easier to manage. So, those list methods can be used in conjunction with the dictionary ones to create an efficient machine for handling data.

Dictionary Methods

Items, Keys, and Values

These methods work to break down dictionaries into other data structures to make working with them much more manageable. Doing so also gives access to the methods of those data structures. Through these combinations of methods and loops, you can access and manipulate data with ease.

Read more

Python Functions


Code would quickly become an ugly and unruly mess if there wasn’t a way to easily repeat and reuse it. You’ve already seen some of that with loops. They’re great for repeating the same task multiple times right away. What if you wanted to reuse a block of code whenever you wanted? Well, that’s where functions come in.

Here’s another trip back to math class. If you remember, functions took in a number, did something to it, then outputted the new value. They were often represented in tables with the input on one side and the output on the other. Functions in programming are similar. Sometimes they take input. Sometimes they don’t. Much of the time they return a value as well, but they don’t always have to. In every case, they are used to repeat an operation whenever they are used, and that’s the greatest similarity with the math concept.

Read more

Python Classes


Classes are the cornerstone of Object Oriented Programming. They are the blueprints used to create objects. And, as the name suggests, all of Object Oriented Programming centers around the use of objects to build programs.

You don’t write objects, not really. They are created, or instantiated, in a program using a class as their basis. So, you design objects by writing classes. That means that the most important part of understanding Object Oriented Programming is understanding what classes are and how they work.

Read more

Python Constructors


By now, you should be familiar with the way basic classes work in Python. If classes were just what you’ve seen, they’d be fairly rigid and not all that useful.

Thankfully, classes are much more than just that. They are designed to be much more adaptable and can take in information to shape the way they look initially. Not every car starts off exactly the same, and neither should classes. After all, how awful would it be if every car was an orange 71′ Ford Pinto? That’s not a good situation.

Writing A Class

Start off by setting up a class like the one in the last guide. This class will evolve over the course of this guide. It will move from being a rigid, photocopy-like, situation to a template that can generate multiple unique objects within the outline of the class.

Write the first line of the class, defining it as a class and naming it. This guide is going to stick with the car analogy from before. Don’t forget to pass your class object so that it extends the base object class.

Read more

Wireshark running on Kali

Basics of network protocol analyzer Wireshark On Linux

Wireshark is just one of the valuable tools provided by Kali Linux. Like the others, it can be used for either positive or negative purposes. Of course, this guide will cover monitoring your own network traffic to detect any potentially unwanted activity.

Wireshark is incredibly powerful, and it can appear daunting at first, but it serves the single purpose of monitoring network traffic, and all of those many options that it makes available only serve to enhance it’s monitoring ability.


Kali ships with Wireshark. However, the wireshark-gtk package provides a nicer interface that makes working with Wireshark a much friendlier experience. So, the first step in using Wireshark is installing the wireshark-gtk package.

# apt install wireshark-gtk

Don’t worry if you’re running Kali on a live medium. It’ll still work.

Basic Configuration

Before you do anything else, it’s probably best to set Wireshark up the way you will be most comfortable using it. Wireshark offers a number of different layouts as well as options that configure the program’s behavior. Despite their numbers, using them is fairly straightforward.

Start out by opening Wireshark-gtk. Make sure it is the GTK version. They are listed separately by Kali.

Read more

How to install Logstash On Debian Linux

How to install Logstash On Debian Linux

How to install Logstash On Debian Linux


The following guide describes a basic installation of Logstash on Debian Linux.

Operating System and Software Versions

  • Operating System: – Debian 9 (Stretch)
  • Software: – Logstash 5.2


Privileged access to your Debian system will be required.




Read more