MacChanger with Python- Your first step to Ethical hacking

MacChanger with Python- Your first step to Ethical hacking

MacChanger with Python- Ethical Hacking is fun and interesting, but there are a lot of things an Ethical hacker should be aware of. Such as, covering his tracks. And, one of the ways to do this is using a MacChanger. In this tutorial, I will teach you how to write a MacChanger with Python.

I will cover the following topics:

  • Why Python for Ethical Hacking?
  • What is a MacChanger?
  • Installing PyCharm on Ubuntu
  • Writing a MacChanger

Before writing a MacChanger, let’s see why we should use Python for Ethical Hacking.

Why Python for Ethical Hacking?

Ethical Hacking is the process of finding vulnerabilities in a system that an attacker can exploit and cause damage. And then, these results are used to improve the security of the network and the system. We already have many Ethical Hacking Tools available, so what’s the need for Python?

Python is used to Automate the process of Ethical Hacking. Ethical Hacking is not a one-step process. There are different Phases of Ethical Hacking and some of which you will have to conduct more than once. Ethical Hacking with Python makes this easy. 

Suppose you want to test a website for vulnerabilities, you will have to run tests on the website. After you are done with this project, you might have to test another website. Now, you will have to follow the same steps from scratch. Python can be used here to automate these testing steps. So, you write the code once and use it every time you want to test a website.

Now that we know what we are dealing with, let’s understand what a MacChanger is!

What is a MacChanger?

Every networking device is assigned a MAC address by the device manufacturer which is helpful to communicate with other devices. A MAC address is hard-coded on the device and it is not possible to permanently change it. But, we can change it temporarily using a MacChanger. A MacChanger is a tool that changes the MAC address to the desired (or random) address until that device is rebooted. Once, the device is rebooted, the MAC address of that device will be set to its original MAC address.

Now that we know what a MacChanger is, let’s build this using Python!

For this tutorial on writing a MacChanger with Python, we will run our Python scripts in PyCharm, which is an integrated development environment. So, to run our Python Script, we need to install PyCharm first. Let’s see how to install PyCharm on Ubuntu. 

Installing PyCharm on Ubuntu

To install PyCharm on Ubuntu, first go to this link:

Here, you will find two Editions, and for this tutorial, we will use the Community Edition.

When you click on the download button, the download should start. After the download is completed, we will have to install PyCharm. By default, this file will be downloaded in the “Downloads” directory. Open a terminal and run the following commands:

$ cd Downloads
$ tar -xvf pycharm-community-2018.3.4.tar.gz

Remember to replace the name of the file in the above command with the name of the file that is downloaded in your system.

The above command will extract the PyCharm files. And now, to run PyCharm, you will have to go into the pycharm-community-2018.3.4/bin folder and run the file. To do this, run the following commands:

$ cd pycharm-community-2018.3.4/
$ cd bin/
$ ./

When you run it for the first time, you will have to accept the Terms and Conditions. Once done, PyCharm will be up and running.

Now that we have installed PyCharm, let’s move on to writing a MacChanger.

Writing a MacChanger

You will write the MacChanger script in PyCharm. To start PyCharm, go to the directory where PyCharm was extracted and run the shell script.

$ cd pycharm-community-2018.3.4/ 
$ cd bin/
$ ./

You will see the welcome screen of PyCharm. Click on “Create New Project”.

Enter a name for your project. I will name this Mac_changer. And then click “Create“. 

You will now see the workplace. Next, let’s create a Python file. To do this, right click on the project name, go to “New” and click on “Python file“.

You can now write the python script here. But first, you should decide which network device you want to change the MAC address for. For this, open the terminal and run the following command:

$ ifconfig

You should see a list of the network interfaces and their respective MAC address. You might have different interface names or MAC addresses. When using the scripts in this blog, make sure you change the interface name to the one in your system. For this tutorial, I will change the MAC address of “ens33“.

The script to change the MAC Address is as follows:

import subprocess["sudo","ifconfig","ens33","down"])["sudo","ifconfig","ens33","hw","ether","00:11:22:33:44:55"])["sudo","ifconfig","ens33","up"])

I will be changing the MAC address to 00:11:22:33:44:55. Now run this script. To run the script, click on the “Run” tab at the top and click on “Run“.

After running the script, to check whether the MAC address of the interface has changed or not, we will check the details again. Just run the ifconfig command in the terminal.

Do you see the change in the MAC address? The new MAC address is 00:11:22:33:44:55. That’s how simple it is. Now whenever you need to change the MAC address, all you have to do is update the MAC address and/or the interface name in the Python script.

But this doesn’t make any difference or save much time right? I mean, it’s just 3 commands, we can do it manually. Why write a Python script for this?

Let me tell you how it can make a difference. Just think of the scenario where you will have to change the MAC address every 5 minutes. And suppose you are working for an hour, you will have to run these 3 commands 12 times. So, you will have to run 3 * 12 = 36 commands in total. Okay, now it seems too much, isn’t it?

Well, when you write the Python script, you can just run this script in a loop to change the MAC address every 5 minutes. Now you see how much time and effort you can save.

Congratulations! You have written a MacChanger in Python and seen it in action. Now that you know how Python can be beneficial for Ethical Hacking, learn some more modules, commands, and start automating Ethical Hacking with Python.

Originally published by  Omkar S Hiremath at


Thanks for reading :heart: If you liked this post, share it with all of your programming buddies! Follow me on Facebook | Twitter

☞ Learn Ethical Hacking From Scratch

☞ The Complete Cyber Security Course : Hackers Exposed!

☞ Ethical Hacking With Python, JavaScript and Kali Linux

☞ The Complete Ethical Hacking Course: Beginner to Advanced!

☞ Hacking in Practice: Certified Ethical Hacking MEGA Course

☞ Learn Python & Ethical Hacking From Scratch

☞ The Complete Ethical Hacking Course

☞ Advance Web Hacking : Penetration Testing & Bug Bounty

Python GUI Programming Projects using Tkinter and Python 3

Python GUI Programming Projects using Tkinter and Python 3

Python GUI Programming Projects using Tkinter and Python 3

Learn Hands-On Python Programming By Creating Projects, GUIs and Graphics

Python is a dynamic modern object -oriented programming language
It is easy to learn and can be used to do a lot of things both big and small
Python is what is referred to as a high level language
Python is used in the industry for things like embedded software, web development, desktop applications, and even mobile apps!
SQL-Lite allows your applications to become even more powerful by storing, retrieving, and filtering through large data sets easily
If you want to learn to code, Python GUIs are the best way to start!

I designed this programming course to be easily understood by absolute beginners and young people. We start with basic Python programming concepts. Reinforce the same by developing Project and GUIs.

Why Python?

The Python coding language integrates well with other platforms – and runs on virtually all modern devices. If you’re new to coding, you can easily learn the basics in this fast and powerful coding environment. If you have experience with other computer languages, you’ll find Python simple and straightforward. This OSI-approved open-source language allows free use and distribution – even commercial distribution.

When and how do I start a career as a Python programmer?

In an independent third party survey, it has been revealed that the Python programming language is currently the most popular language for data scientists worldwide. This claim is substantiated by the Institute of Electrical and Electronic Engineers, which tracks programming languages by popularity. According to them, Python is the second most popular programming language this year for development on the web after Java.

Python Job Profiles
Software Engineer
Research Analyst
Data Analyst
Data Scientist
Software Developer
Python Salary

The median total pay for Python jobs in California, United States is $74,410, for a professional with one year of experience
Below are graphs depicting average Python salary by city
The first chart depicts average salary for a Python professional with one year of experience and the second chart depicts the average salaries by years of experience
Who Uses Python?

This course gives you a solid set of skills in one of today’s top programming languages. Today’s biggest companies (and smartest startups) use Python, including Google, Facebook, Instagram, Amazon, IBM, and NASA. Python is increasingly being used for scientific computations and data analysis
Take this course today and learn the skills you need to rub shoulders with today’s tech industry giants. Have fun, create and control intriguing and interactive Python GUIs, and enjoy a bright future! Best of Luck
Who is the target audience?

Anyone who wants to learn to code
For Complete Programming Beginners
For People New to Python
This course was designed for students with little to no programming experience
People interested in building Projects
Anyone looking to start with Python GUI development
Basic knowledge
Access to a computer
Download Python (FREE)
Should have an interest in programming
Interest in learning Python programming
Install Python 3.6 on your computer
What will you learn
Build Python Graphical User Interfaces(GUI) with Tkinter
Be able to use the in-built Python modules for their own projects
Use programming fundamentals to build a calculator
Use advanced Python concepts to code
Build Your GUI in Python programming
Use programming fundamentals to build a Project
Signup Login & Registration Programs
Job Interview Preparation Questions
& Much More

Guide to Python Programming Language

Guide to Python Programming Language

Guide to Python Programming Language

The course will lead you from beginning level to advance in Python Programming Language. You do not need any prior knowledge on Python or any programming language or even programming to join the course and become an expert on the topic.

The course is begin continuously developing by adding lectures regularly.

Please see the Promo and free sample video to get to know more.

Hope you will enjoy it.

Basic knowledge
An Enthusiast Mind
A Computer
Basic Knowledge To Use Computer
Internet Connection
What will you learn
Will Be Expert On Python Programming Language
Build Application On Python Programming Language

Python Programming Tutorials For Beginners

Python Programming Tutorials For Beginners

Python Programming Tutorials For Beginners

Hello and welcome to brand new series of wiredwiki. In this series i will teach you guys all you need to know about python. This series is designed for beginners but that doesn't means that i will not talk about the advanced stuff as well.

As you may all know by now that my approach of teaching is very simple and straightforward.In this series i will be talking about the all the things you need to know to jump start you python programming skills. This series is designed for noobs who are totally new to programming, so if you don't know any thing about

programming than this is the way to go guys Here is the links to all the videos that i will upload in this whole series.

In this video i will talk about all the basic introduction you need to know about python, which python version to choose, how to install python, how to get around with the interface, how to code your first program. Than we will talk about operators, expressions, numbers, strings, boo leans, lists, dictionaries, tuples and than inputs in python. With

Lots of exercises and more fun stuff, let's get started.

Download free Exercise files.


Who is the target audience?

First time Python programmers
Students and Teachers
IT pros who want to learn to code
Aspiring data scientists who want to add Python to their tool arsenal
Basic knowledge
Students should be comfortable working in the PC or Mac operating system
What will you learn
know basic programming concept and skill
build 6 text-based application using python
be able to learn other programming languages
be able to build sophisticated system using python in the future

To know more: