Python for Hacking
MAC Changer
Using RegEx in Python
To use Regex we use to import re module. And we use search function in re module. I have explain the theory in previous post so I will just explain the commands we use.
Commands
- import re
In this command we import the re module
- mac_address_search_result = re.search(r"\w\w:\w\w:\w\w:\w\w:\w\w:\w\w", ifconfig_result)
In this command we search the MAC Address using the rule and save it in a variable
- print(mac_address_search_result.group(0))
In this command we print first capture string in mac_address_search_result using group

No comments:
Post a Comment