Python for Ethical Hacking
MAC Changer
Functions returning Value
As we create change mac function in previous section. It will do not return any value. It is not used in that function. But now we are going to create a function for getting optparse commands. It need to return a value for option and arguments. For that we use a function called "return".
Syntax
- def get_arguments()
parser.add_option("-i", "--interface", dest="interface", help="Interface you want to change")
parser.add_option("-m", "--mac", dest="new_mac", help="New MAC Address to change")
return parser.parse_args()
- (options, arguments) = get_arguments()
By doing this we will return parser.parse_arg() value inside get_argument() funtion. Then the value of options and arguments saved by using last line

No comments:
Post a Comment