Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Local mac changer

Guys i was coding this script which is mac changer at local network.This script purpose is to change mac address randomly and use it about 1 minute.After 1 minutes get back previous mac address.it is working what i said except one.When i get back own mac address again i didn't reach any web site.This is my problem.How should i do ? (sorry for bad english)  

import os
import random
import time


def GetHEX():
tmp = "0123456789abcdef"
return random.choice(tmp) +""+ random.choice(tmp)

def GetMAC():
arr = []
for i in range(6):
arr.append(GetHEX())
arr = ":".join(arr)
return arr
def DefaultMAC():
dMAC = ""
path = "/sys/class/net/wlp3s0f0/address"
with open(path,"r") as file:
dMAC = str(file.readlines())[2:-4]
return dMAC
def ChangeMAC(interface,mac):

os.system("sudo /etc/init.d/networking stop")
os.system("sudo ip link set {} down".format(interface))
os.system("sudo ifconfig {} hw ether {}".format(interface, mac) )
os.system("sudo ip link set {} up".format(interface))
os.system("sudo /etc/init.d/networking start")

if __name__=="__main__":
arr = GetMAC()
dMAC = DefaultMAC()
#interface = raw_input("
[*]Please enter the network interface name :")
print "Created MAC : "+arr
print "Default MAC : "+dMAC
#ChangeMAC(interface,arr)
#time.sleep(15) # this code is purpose of testing
#ChangeMAC(interface,dMAC)
use [code]-tag, please. my first idea is to disable networkcard for 5 - 10 seconds after mac-change. so you will connect to your network again with new mac
i added time.sleep now it is working.My purpose is to change mac address than reach other machine but when i change mac address i can not reach them.i think i should create arp request with my new mac address using scapy.Is this soliton for me ?
I think, the arp request is a good idea
I wrote arp request after mac change but i didn't reach global network


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Magpi3Jun 5, 2019 08:10 AM 0 145 Jun 5, 2019 08:10 AM
Last Post: Magpi3
[Shell] by samir50Sep 24, 2018 12:33 PM 3 262 Sep 24, 2018 12:33 PM
Last Post: ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™
[Shell] by HackooMar 20, 2017 08:18 PM 5 248 Mar 20, 2017 08:18 PM
Last Post: b00st3d