Skip to main content

Windows 10 Warning: 250M Account Trojan Can Disable Windows Defender

Trickbot is not a new threat, but it is an evolving one. The latest twist of the banking Trojan knife as far as Windows 10 users are concerned is the addition of new methods to not only evade but actually disable Windows Defender security protection. As  reported  on July 14 in  Forbes , Trickbot is a particularly stealthy banking Trojan that has been around since 2016. Since then, it was thought to have compromised no less than 250 million email accounts in an effort to distribute the malware payload. That payload includes the stealing of online banking credentials and cryptocurrency wallets. Microsoft has always been front and center as far as Trickbot attack campaigns are concerned, with weaponized Word and Excel files being a favored approach. The  latest campaign  is targeting Windows 10 users and implementing a highly detailed and convincing, but fake nonetheless, Office 365 page to prompt for browser updates that install the Trojan itself. Disab...

Let’s get classy: how to create modules and classes with Python



Cubes

In object-oriented computer languages such as Python, classes are basically a template to create your own objects. Objects are an encapsulation of variables and functions into a single entity. Objects get their variables and functions from classes.


Say what?

Here are some examples that will help you understand — read on. There is also an interactive code shell, simply press the “Run” button at the top of the specific window.

The simplest way to describe classes and how to use them is this:

Imagine you have great powers. You create a species (“class”).

Then you create attributes for that species (“properties”) — height, weight, limbs, color, powers, and so on.

Then you create an instance of that species — Fido the dog, Drogon from Game of Thrones, and so on. Then you work with these instances:

In a game, for instance, they would engage in action, interact, using their attributes.


In a banking app, they would be the different transactions.


In a vehicle buy/sell/trade/lease app, the vehicle class could then spawn sub-classes such as cars. Each would have attributes such as mileage, options, features, color, and trim.


You can already see why this is useful. You are creating, re-using, adapting, and enhancing items in a very efficient, logical, and useful way.

By now, you have probably realized that this is a way to classify and group, one that that is similar to how humans learn:

Animals are living things that are not human or trees, in a basic sense


then you move on to different types of animals — dogs, cats are probably the first animals most of us learnt about


then you move to different attributes of animals — shapes, sizes, sounds, appendages and so on.


For instance, when you were a child, your first understanding of a dog was probably something with four legs that barked. Then you learnt to distinguish that some were real dogs, others were toys. That this “dog” concept contained many types.

Creating and using classes is basically:

building a template to put “things” in — a classification


which can then be operated on. For example, pulling up all the people with dogs that you could request to link to a blog on pets, or all bank clients who might be good prospects for a new credit card.


The main point here is classes are objects that can produce instances of those templates, on which operations and methods can be applied. It is an excellent way to conceptualize, organize, and build a hierarchy for any organization or process.

As our world gets more complex, this is a way to mimic that complexity from a hierarchical perspective. It also builds a deeper understanding of the processes and interactions for business, technical, and social settings from a virtual information technology point.

An example might be a video game you create. Each character could be a “class”, with its own attributes, that interacts with instances of other classes. King George of the “King” class might interact with Court Jester Funnyman of the “Clown” class, and so on. A King might have a royal “servant” class, and a “servant” class would always have a “King” class, for example.

This is what we will do:

create a class and use it


create a module and move the class creation and initiation to the module


call the module in a new program to use the class


The code is available in GitHub here.

#TSB - Create Class in Python - rocket positions (x,y) and graph#some items and comments bolded to call attention to process
import matplotlib.pyplot as pltclass Rocket():
def __init__(self, x=0, y=0):
#each rocket has (x,y) position; user or calling function has choice
#of passing in x and y values, or by default they are set at 0
self.x = x
self.y = y

def move_up(self):
self.y += 1

def move_down(self):
self.y -= 1

def move_right(self):
self.x += 1

def move_left(self):
self.x -= 1#Make a series of rockets - x,y positions, I am calling it rocket
rockets=[]
rockets.append(Rocket())
rockets.append(Rocket(0,2))
rockets.append(Rocket(1,4))
rockets.append(Rocket(2,6))
rockets.append(Rocket(3,7))
rockets.append(Rocket(5,9))
rockets.append(Rocket(8, 15))

#Show on a graph where each rocket isfor index, rocket in enumerate(rockets):
#original position of rockets
print("Rocket %d is at (%d, %d)." % (index, rocket.x, rocket.y))
plt.plot(rocket.x, rocket.y, 'ro', linewidth=2, linestyle='dashed', markersize=12)
#move the 'rocket' one up
rocket.move_up()
print("New Rocket position %d is at (%d, %d)." % (index, rocket.x, rocket.y))
#plot the new position
plt.plot(rocket.x, rocket.y, 'bo', linewidth=2, linestyle='dashed', markersize=12)
#move the rocket left, then plot the new position
rocket.move_left()
plt.plot(rocket.x, rocket.y, 'yo', linewidth=2, linestyle='dashed', markersize=12)#show graph legend to match colors with position
plt.gca().legend(('original position','^ - Moved up', '< - Moved left'))
plt.show()
#plt.legend(loc='upper left')

Output from code above, using Python class

Now let us create a module and move some of the code above to the module. Any time we need to create this simple set of x,y coordinates in any program, we can use the module to do so.

What is a module and why do we need it?

A module is a file containing Python definitions and statements. Module is Python code that can be called from other programs for commonly used tasks, without having to type them in each and every program that uses them.

For example, when you call “matplotlib.plot”, you are calling a package module. If you didn’t have this module you would have to define the plot functionality in every program that used a plot graph.

From the Python documentation:

If you quit from the Python interpreter and enter it again, the definitions you have made (functions and variables) are lost. Therefore, if you want to write a somewhat longer program, you are better off using a text editor to prepare the input for the interpreter and running it with that file as input instead.This is known as creating a script. As your program gets longer, you may want to split it into several files for easier maintenance. You may also want to use a handy function that you’ve written in several programs without copying its definition into each program.


To support this, Python has a way to put definitions in a file and use them in a script or in an interactive instance of the interpreter. Such a file is called a module; definitions from a module can be imported into other modules or into the main module (the collection of variables that you have access to in a script executed at the top level and in calculator mode).


Here’s our simple module. It takes the class creation and the functions to move an instance of that class from the program above and into its own class. We will then use this in a new program simply by calling and referencing this module:

Our simple module creates a class with (x, y) attributes and associated functions

Notice what we did above:

created and initialized the class


created a function to move an instance of the class in the four major directions (up, down, right, left) and the increments — as parameters, or arguments to the function


created another function to calculate the distance between two instances of the class, using the graph distance formula


Here’s how we will use the new module to re-write the same program from the first part. Notice in the import section at the beginning, we now import the simple_module1 module that we just created:

Here’s the output from the code using our module. Note that they are the same, except for the chart title and the shape of the position markers, which I changed for comparative purposes.

Output from code from creating and calling our own module!

Comparison of the original file-left(create class, use it) and same functionality using a module, right

Comparison of the output. On the right side, I change the marker shape for distinction, but the positions are unchanged.

That’s great, you may say — what are some other uses for this? One classic example is a bank account. A customer class might contain the name and contact details and — more importantly — the account class would have deposit and withdrawal elements.


This is grossly oversimplified but, for illustrative purposes, it is useful. That’s it — create a template, then define instances of that template with details (properties), and add value by adding, subtracting, modifying, moving, and using these instances for your program objectives.

Still wondering about classes? Ok, let’s get “classy” — here’s another simple illustration. We will call this class “Person”. It has only two properties — name and age. We will then add an instance of this with a person’s name and age, and print it. Depending on what your objective is, you can imagine all the other details you might add — for example, marital status and location preferences for a social networking app, job experience in years and industry specialization for a career related app. Press the little triangle below to see it work.

A simple class structure in Python — might take a minute to fully initialize after you press Run on top of window to view results

So there you have it. You can create many different classes, with parent classes, sub-classes and so on. Thanks for reading — please clap if you liked it. Here are some other references if you would like to learn more:

Python documentation — Classes


Python Object Oriented — Tutorials Point


Classes and Objects — learnpython.org


Comments

Popular posts from this blog

SmartBillions Challenges Hackers with 1,500 Ether Reward, Gets Hacked and Pulls Most of It Out

SmartBillions, a so-called fully decentralized and transparent lottery system, managed by an Ethereum smart contract, recently challenged hackers to get through its smart contract’s security, and added a 1,500  Ether  ($450,000) reward to be collected by anyone that managed to compromise it. The goal was to demonstrate “the SmartBillions lottery smart contract’s comprehensive security.” Initially, according to a  press release , the prize was to be collected by any hacker that managed to break into the smart contract and withdraw the funds, as a way to prove how serious the team took investor protection. The team stated: “The development team is so confident in their product and its security that they will risk their own funds (1500 ETH), to demonstrate its safety.” A few days later, the issued challenge seemingly backfired, as a hacker did manage to compromise the smart contract. The hacker, according to a  Reddit thread , essentially managed to game th...

Windows 10 Warning: 250M Account Trojan Can Disable Windows Defender

Trickbot is not a new threat, but it is an evolving one. The latest twist of the banking Trojan knife as far as Windows 10 users are concerned is the addition of new methods to not only evade but actually disable Windows Defender security protection. As  reported  on July 14 in  Forbes , Trickbot is a particularly stealthy banking Trojan that has been around since 2016. Since then, it was thought to have compromised no less than 250 million email accounts in an effort to distribute the malware payload. That payload includes the stealing of online banking credentials and cryptocurrency wallets. Microsoft has always been front and center as far as Trickbot attack campaigns are concerned, with weaponized Word and Excel files being a favored approach. The  latest campaign  is targeting Windows 10 users and implementing a highly detailed and convincing, but fake nonetheless, Office 365 page to prompt for browser updates that install the Trojan itself. Disab...

How To Convert DEB Packages Into Arch Linux Packages

We already learned how to  build packages for multiple platforms , and how to  build packages from source . Today, we are going to learn how to convert DEB packages into Arch Linux packages. You might ask,  AUR is the large software repository on the planet, and almost all software are available in it. Why would I need to convert a DEB package into Arch Linux package? True! However, some packages cannot be compiled (closed source packages) or cannot be built from AUR for various reasons like error during compiling or unavailable files. Or, the developer is too lazy to build a package in AUR or s/he doesn’t like to create an AUR package. In such cases, we can use this quick and dirty method to convert DEB packages into Arch Linux packages. Debtap – Convert DEB Packages Into Arch Linux Packages For this purpose, we are going to use an utility called  “Debtap” . It stands  DEB   T o  A rch (Linux)  P ackage. Debtap is available in AUR, so yo...