Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #59761
    jingjohn77
    Participant

    Error whiile running

    collisions 0\n\n’
    Traceback (most recent call last):
    File “/root/PycharmProjects/macChanger/Macchanger.py”, line 28, in <module>
    mac_address_search_result = re.compile(r”\w\w:\w\w:\w\w:\w\w:\w\w:\w\w”).search(ifconfig_result)
    TypeError: cannot use a string pattern on a bytes-like object

    my code

    import subprocess
    import optparse
    import re

    def get_arguments():
    parser = optparse.OptionParser()
    parser.add_option(“-i”, “–interface”, help=”interface to change its mac addreesses”, dest=”interface”)
    parser.add_option(“-m”, “–mac”, dest=”new_mac”, help=”new mac addreesses”)
    (options, arguments) = parser.parse_args()
    if not options.interface:
    parser.error(“[-] please specify an interface, se –help for more info.”)
    elif not options.new_mac:
    parser.error(“[-] please specify an mac, se –help for more info.”)
    return options

    def change_mac(interface, new_mac):
    subprocess.call([“ifconfig”, interface, “down”])
    subprocess.call([“ifconfig”, interface, “hw”, “ether”, new_mac])
    subprocess.call([“ifconfig”, interface, “up”])

    options=get_arguments()

    #change_mac(options.interface, options.new_mac)

    ifconfig_result = subprocess.check_output([“ifconfig”, options.interface])
    print(ifconfig_result)
    mac_address_search_result = re.search(r”\w\w:\w\w:\w\w:\w\w:\w\w:\w\w”,ifconfig_result)
    print(mac_address_search_result.group(0))

    I followed step by step, what is the issue?

    #59762
    jingjohn77
    Participant

    Oh Wait I got it, i was running python3 sorry never mind

    #59770
    Diego PérezDiego Pérez
    Participant

    Hi!

    Cool you got it!
    Diego

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Privacy Overview
ZSecurity logo featuring a stylized red letter Z

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

3rd Party Cookies

This website uses Google Analytics and Linkedin to collect anonymous information such as the number of visitors to the site, and the most popular pages.

Keeping these cookies enabled helps us to improve our website.