Python for Hacking
MAC Changer
If Condition in MAC Changer
Why we use if condition in MAC Changer
If we forgot to give any value needed for the MAC Changer tool the error will occur and it is somewhat difficult to understand for beginner. To make clarity for user we use if statement to make a two error statement for not giving interface and mac address.
Commands
def get_arguments():
parser = optparse.OptionParser()
parser.add_option("-i", "--interface", dest="interface", help="Interface you want to change")
parser.add_option("-m", "--mac", dest="new_mac", help="Enter the New MAC Address")
(options, arguments) = parser.parse_args()
if not options.interface:
parser.error("Please Enter the value of Interface, Check --help for more info")
elif not options.new_mac:
parser.error("Please Enter the value of new mac, Check --help for more info")
return options
We add if statement in get_argument function. Do get detailed knowledge watch video in below.

No comments:
Post a Comment