Python Advanced Dictionaries

Introduction

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

Introduction

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

Introduction

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

Introduction

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.

Installation

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

Objective

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

Requirements

Privileged access to your Debian system will be required.

Difficulty

EASY

Conventions

Read more

Learning Linux Commands: netstat

Introduction

netstat command is a useful command to reveal a network status of your system. It allows a system administrator to keep track of any network connections by querying their status, origin and destination.

Furthermore, netstat is the all-in-one networking monitoring tool as it can also be used to display route tables, interface statistics, masquerade connections, as well as multicast memberships. ss command is a future successor of the netstat command.

Read more

Hosting Django With Nginx and Gunicorn on Linux

Introduction

Hosting Django web applications is fairly simple, though it can get more complex than a standard PHP application. There are a few ways to handle making Django interface with a web server. Gunicorn is easily one of the simplest.

Gunicorn(short for Green Unicorn) acts as in intermediary server between your web server, Nginx in this case, and Django itself. It handles serving the application itself while Nginx picks up the static content.

Gunicorn

Installation

Installing Gunicorn is super easy with Pip. If you’ve already set up your Django project using virtualenv, you have Pip and should be familiar with the way it works. So, install Gunicorn in your virtualenv.

$ pip install gunicorn

Read more

How to install Java SE Development Kit on Debian Linux

Objective

The objective of this guide is to provide a simple to follow steps on how to install Java SE Development Kit on Debian Linux.

OS and Software Version

  • Operating System: Debian 9 (Stretch)
  • Software: Java SE Development Kit 8

Requirements

Privileged access to your Debian Linux is required. Optionally, curl will be used to download an appropriate Java JDK tarball.

Difficulty

EASY

Conventions

Read more

PHP 7 - speed

Installation of the latest bleeding edge PHP 7 on Debian 8 Jessie Linux

Introduction

PHP 7 - speedDebian’s current stable package repository may not always contain an up to date software to be in line with
our expectations. There is a very good reason for this, such as a stable system as a trade-off for running bleeding edge software.

PHP server-side scripting language is not an exemption! At
the time of writing the current Debian’s PHP version is 5.6.29 whereas the latest PHP source release is 7.1.0( given that there is no PHP 6 at all ).

The current PHP developer’s claims put PHP 7 in front of PHP 5.6 in terms of speed, where PHP 7 is supposed to be as twice as fast as its predecessor:

Thanks to the new Zend Engine 3.0, your apps see up to 2x faster performance and 50% better memory consumption than PHP 5.6, allowing you to serve more concurrent users without adding any
hardware. Designed and refactored for today’s workloads, PHP 7 is the ultimate choice for web developers today.

Reference: zend.com/en/resources/php-7

Objective

To compare a speed between PHP 5.6 and latest PHP 7.1.0 is not an objective of this article. However, the objective is the get that latest PHP 7 release installed on Debian 8 system. Additionally we
will install PHP-FPM (FastCGI Process Manager). This guide will offer two possible installations.

Read more

Debian apt-get squeeze sources.list

Related sources.list repositories:
Wheezy,
Jessie,
Stretch,
Buster

Security Updates

# /etc/apt/sources.list :
deb http://security.debian.org/ squeeze/updates main contrib non-free
deb-src http://security.debian.org/ squeeze/updates main contrib non-free

Australia Mirror

# /etc/apt/sources.list :
deb http://ftp.au.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.au.debian.org/debian/ squeeze main contrib non-free

Read more