Latest
Loading...

Python for Ethical Hacking

Command Prompt

Featured Post

#5 Jarvis

Jarvis      Now we are going to create some functions. With the help of this functions we are going to make our Play music Open website...

#9 Return Function || MAC Changer || Python for Hacking

#9 Return Function || MAC Changer || Python for Hacking

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 = optparse.OptionParser()
        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