示例#1
0
def test_print():
    timer = 1
    timer *= 3600
    threading.Timer(timer, test_print).start()
    target_mac = random_mac_address('randomize')
    set_interface_mac('Ethernet', target_mac)
    print "IP changing"
示例#2
0
def main(args, root_or_admin):
    spoofer = None

    try:
        spoofer = get_os_spoofer()
    except NotImplementedError:
        return UNSUPPORTED_PLATFORM

    if args['list']:
        list_interfaces(args, spoofer)
    elif args['randomize'] or args['set'] or args['reset']:
        for target in args['<devices>']:
            # Fill out the details for `target`, which could be a Hardware
            # Port or a literal device.
            #print("Debuf:",target)
            result = find_interface(target)
            if result is None:
                print('- couldn\'t find the device for {target}'.format(
                    target=target
                ))
                return INVALID_TARGET

            port, device, address, current_address = result
            if args['randomize']:
                target_mac = random_mac_address(args['--local'])
            elif args['set']:
                target_mac = args['<mac>']
            elif args['reset']:
                if address is None:
                    print('- {target} missing hardware MAC'.format(
                        target=target
                    ))
                    continue
                target_mac = address

            if not MAC_ADDRESS_R.match(target_mac):
                print('- {mac} is not a valid MAC address'.format(
                    mac=target_mac
                ))
                return INVALID_MAC_ADDR

            if not root_or_admin:
                if sys.platform == 'win32':
                    print('Error: Must run this with administrative privileges to set MAC addresses')
                    return NON_ROOT_USER
                else:
                    print('Error: Must run this as root (or with sudo) to set MAC addresses')
                    return NON_ROOT_USER

            set_interface_mac(device, target_mac, port)
    elif args['normalize']:
        print(normalize_mac_address(args['<mac>']))

    else:
        print('Error: Invalid arguments - check help usage')
        return INVALID_ARGS

    del spoofer

    return SUCCESS
示例#3
0
def fakemac(target='eth0'):
    root = os.geteuid() == 0
    if root:
        port, device, _, mac = find_interface(target)
        target_mac = random_mac_address()
        set_interface_mac(device, target_mac, port)
        print('{0} mac changed {1} -> {2}'.format(target, mac, target_mac))
    else:
        print('no mac changed')
示例#4
0
def fakemac(target='eth0'):
    root = os.geteuid() == 0
    if root:
        port, device, _, mac = find_interface(target)
        target_mac = random_mac_address()
        set_interface_mac(device, target_mac, port)
        print('{0} mac changed {1} -> {2}'.format(target, mac, target_mac))
    else:
        print('no mac changed')
示例#5
0
def main(args, root_or_admin):
    spoofer = None

    try:
        spoofer = get_os_spoofer()
    except NotImplementedError:
        return UNSUPPORTED_PLATFORM

    if args['list']:
        list_interfaces(args, spoofer)
    elif args['randomize'] or args['set'] or args['reset']:
        for target in args['<devices>']:
            # Fill out the details for `target`, which could be a Hardware
            # Port or a literal device.
            #print("Debuf:",target)
            result = find_interface(target)
            if result is None:
                print('- couldn\'t find the device for {target}'.format(
                    target=target))
                return INVALID_TARGET

            port, device, address, current_address = result
            if args['randomize']:
                target_mac = random_mac_address(args['--local'])
            elif args['set']:
                target_mac = args['<mac>']
                if int(target_mac[1], 16) % 2:
                    print(
                        'Warning: The address you supplied is a multicast address and thus can not be used as a host address.'
                    )
            elif args['reset']:
                if address is None:
                    print('- {target} missing hardware MAC'.format(
                        target=target))
                    continue
                target_mac = address

            if not MAC_ADDRESS_R.match(target_mac):
                print('- {mac} is not a valid MAC address'.format(
                    mac=target_mac))
                return INVALID_MAC_ADDR

            if not root_or_admin:
                if sys.platform == 'win32':
                    print(
                        'Error: Must run this with administrative privileges to set MAC addresses'
                    )
                    return NON_ROOT_USER
                else:
                    print(
                        'Error: Must run this as root (or with sudo) to set MAC addresses'
                    )
                    return NON_ROOT_USER

            set_interface_mac(device, target_mac, port)
    elif args['normalize']:
        print(normalize_mac_address(args['<mac>']))

    else:
        print('Error: Invalid arguments - check help usage')
        return INVALID_ARGS

    del spoofer

    return SUCCESS
示例#6
0
def main(args, root_or_admin):
    spoofer = None

    try:
        spoofer = get_os_spoofer()
    except NotImplementedError:
        return UNSUPPORTED_PLATFORM

    if args['list']:
        list_interfaces(args, spoofer)
    elif args['randomize'] or args['set'] or args['reset']:
        for target in args['<devices>']:
            # Fill out the details for `target`, which could be a Hardware
            # Port or a literal device.
            #print("Debuf:",target)
            result = find_interface(target)
            if result is None:
                print('- couldn\'t find the device for {target}'.format(
                    target=target))
                return INVALID_TARGET

            port, device, address, current_address = result
            if args['randomize']:
                target_mac = random_mac_address(args['--local'])
            elif args['set']:
                target_mac = args['<mac>']
                if int(target_mac[1], 16) % 2:
                    print(
                        'Warning: The address you supplied is a multicast address and thus can not be used as a host address.'
                    )
            elif args['reset']:
                if address is None:
                    print('- {target} missing hardware MAC'.format(
                        target=target))
                    continue
                target_mac = address

            if not MAC_ADDRESS_R.match(target_mac):
                print('- {mac} is not a valid MAC address'.format(
                    mac=target_mac))
                return INVALID_MAC_ADDR

            if not root_or_admin:
                if sys.platform == 'win32':
                    print(
                        'Error: Must run this with administrative privileges to set MAC addresses'
                    )
                    return NON_ROOT_USER
                else:
                    print(
                        'Error: Must run this as root (or with sudo) to set MAC addresses'
                    )
                    return NON_ROOT_USER

            # Expand acceptable input MAC is displayed with atleast the
            # following (-: )
            p = re.compile('[^0-9A-Z]')
            target_mac = p.sub(':', target_mac.upper())
            (prt, dev, addr, cur_addr) = spoofer.find_interface(device)
            etime = time.strftime('%X')

            if target_mac != cur_addr:
                set_interface_mac(device, target_mac, prt)
                print etime + " " + port + " [" + device + "] set to " + target_mac
            else:
                if args['--force']:
                    set_interface_mac(device, target_mac, prt)
                    print etime + " " + prt + " [" + device + "] forced to " + target_mac
                elif '--maintain' not in args:
                    print(
                        'Error: Already the current MAC addresses, use --force to force the address again'
                    )
                    # return EXISTING_MAC_ADDR
            if args['--maintain']:
                sys.stdout.write("\r" + etime + " " + prt + " [" + device +
                                 "] " + cur_addr)
                sys.stdout.flush()

    elif args['normalize']:
        print(normalize_mac_address(args['<mac>']))

    else:
        print('Error: Invalid arguments - check help usage')
        return INVALID_ARGS

    del spoofer

    return SUCCESS
        except:
            pass


#SETTINGS
#Please check your network details
interface_name = 'Wi-Fi'
ip_address, mask, gateway = get_default_network_details()
count_loops = 0
count_failures = 0

#endless loop
while (True):
    try:
        print("[INFO] *Changing MAC & IP*")
        print("[INFO] New Mac is: " + random_mac_address(interface_name))
        delay(3, 5)
        change_ip(interface_name, ip_address, mask, gateway)
        delay(3, 5)
        print("[INFO] Start Browser")
        driver = webdriver.Chrome(os.getcwd() +
                                  "\\webdriver\\chromedriver.exe")
        for i in range(10):
            count_loops += 1
            #go to website
            driver.get("https://www.google.com/recaptcha/api2/demo")
            element = WebDriverWait(driver, 10).until(
                EC.presence_of_element_located((By.TAG_NAME, "iframe")))
            #switch to recaptcha frame
            frames = driver.find_elements_by_tag_name("iframe")
            driver.switch_to.frame(frames[0])
示例#8
0
from spoofmac.util import random_mac_address
from spoofmac.interface import set_interface_mac

target_mac = random_mac_address('randomize')
set_interface_mac('Ethernet', target_mac)