Section: 2. Writing a MAC Address Changer – Python Basics

 What is MAC Address & How To Change it

MAC Address

  • Media Access Control
    • Permanent.
    • Physical.
    • Unique.
  • Assigned by manufacturer.

Why change the MAC Address?

  1. Increase anonymity.
  2. Impersonate other devices.
  3. Bypass filters.
Mac_Changer
Using a Module To Execute System Commands
  • The subprocess module contains a number of functions.
  • These functions allow us to execute system commands.
  • Commands depend on the OS which executes the script.

Syntax:
import subprocess
subprocess.call(“COMMAND”, Shell=True)

Mac_Changer
Variables

  • A variable is a location in memory that contains a certain value.
  • Similar to maths, its a name that is used to store information.

Ex:
X=1
Now x has a value of one, so we can do
Y=x+x
And y has a value of 2 now.
print(y)
Will print the value of y on screen which is 2.

Mac_Changer
Handling User Input

  • Easiest way of getting user input is through keyboard.
  • There are a number of ways to achieve that.
  • input() function prompts the user to enter a value.

Ex:
age = input(“What is your age?”)
Result
What is your age ?
The variable age will hold the value of the user input

Mac_Changer Functions

  • Set of instructions to carry out a task.
  • Can take input, and return result.
  • Make the code clearer, reusable, and more abstract.
  • input() function prompts the user to enter a value.

Ex, we can define a function like so:
def function_name(variable1, variable2 …etc)
And call it in code like so:
function_name(value1, value2)

Mac_Changer Decision Making

● Execute code ONLY if a condition is true.

Leave a comment