Python-wifi-reauth ap

Python-wifi-reauth ap,python,web,wifi,Python,Web,Wifi,长话短说。 在python中的一些编码方面存在一些问题 正在开发一个欺骗mac地址的程序,并在ap上打开新的试用会话, 这只是为了教育 该程序与具有1小时免费通行证的ap一起工作。 该程序的工作原理如下: 关闭wifi适配器 运行.bat脚本,将mac地址更改为随机mac地址。 重新打开wifi。 打开浏览器并通过新mac地址发送登录信息。 每1小时重复一次 问题是: 我可以关闭dowm,更改地址,然后带回来。但是 如何在var中获取新地址并通过web浏览器重新验证自己。 开始新一轮的审判 im

长话短说。 在python中的一些编码方面存在一些问题

正在开发一个欺骗mac地址的程序,并在ap上打开新的试用会话, 这只是为了教育

该程序与具有1小时免费通行证的ap一起工作。 该程序的工作原理如下: 关闭wifi适配器 运行.bat脚本,将mac地址更改为随机mac地址。 重新打开wifi。 打开浏览器并通过新mac地址发送登录信息。 每1小时重复一次

问题是: 我可以关闭dowm,更改地址,然后带回来。但是 如何在var中获取新地址并通过web浏览器重新验证自己。 开始新一轮的审判

import urllib.parse
import urllib.request
import os
import time

def main():
    wifidown()
    changemac()
    wifiup()
    reauth()
    time.sleep(3600)

def wifidown():
    os.system("wmic path win32_networkadapter where index=7 call disable")

def changemac():
    os.system("C:\Users\username\somewhere\theprogram\theprogram.bat")

def wifiup():
    os.system("wmic path win32_networkadapter where index=7 call enable")

def reauth():
    url = 'https://server.name.com/anothername/?client-mac=mymacaddress&ap-mac=addressofap&hash=somehasvaluethatpassesthrough'
    values = {'plan' : 'trial',
              'zip code' : '12345',
              'e mail' : 'anemail@someemail' }

    data = urllib.parse.urlencode(values)
    data = data.encode('utf-8')
    req = urllib.request.Request(url, data)
    response = urllib.request.urlopen(req)
    the_page = response.read()

while True:
    main()
多谢各位

更新**

是的,有帮助。我试着这样做

macid = "01:02:03:04:05:06"
mac = "?client-mac=" + macid
apid = "01:02:03:04:05:06"
ap = "&ap-mac=" + apid
hashid = "8JTsXjOC7jcCppExAqbsBmFF4kNMePA6wgrMaMI6MLDUO6bZsc8tgQMfEfGY%2Bp9aLEdXfTZCapb%2B93DotAFLlQ%3D%3D"
thehash = "&hash=" + hashid
url = 'https://the.ap.server.website/' + mac + ap + thehash

def main():
    wifidown()
    changemac()
    wifiup()
    urlfunction()
    time.sleep(3600)

def wifidown():
    os.system("wmic path win32_networkadapter where index=7 call disable")

def changemac():
    os.system("C:\Users\esc_fn\Desktop\macchanger\macchange.bat")

def urlfunction():
    webbrowser.open_new(url)

def wifiup():
    os.system("wmic path win32_networkadapter where index=7 call enable")

while True:
    main()
ap使用一个名为purchase.js的脚本获取表单数据并发送。 代码是

var pdate = new Date();
var offerlink = basepath + 'terms/';

$(document).ready(function(){
// Hide Sponsored Access form
$('#complimentary_spn').hide();
$('#xsubad').hide();

$('a#inline').fancybox({
    hideOnContentClick: false,
    showCloseButton: false,
    margin: 0,
    padding: 0
});

$('a.iframe').fancybox({
    hideOnContentClick: false,
    showCloseButton: false,
    scrolling: 'no',
    margin: 0,
    padding: 0,
    height: 510
});

$('#triggerComplete').fancybox({
    hideOnContentClick: false,
    showCloseButton: false,
    margin: 0,
    padding: 0
});

$('#rateplanid').change(function(){
    // Clear all errors
    clear_all_errors('#messageBox');

    var planid = $(this).val();
    if (planid > 0)
    {
        $('#complimentary_spn').fadeOut('fast');
        $('#xsubad').fadeOut('fast');
        $('#paid').fadeIn('fast');

        // Set offer and restrictions link
        $('#offerlink').find('.pop').attr('href', offerlink+'ppu');
    }
    else
    {
        $('#paid').fadeOut('fast');
        $('#complimentary_spn').fadeIn('fast');

        if ($.inArray(planid, do_reg) < 0)
            $('#xsubad').fadeIn('fast');

        // Set offer and restrictions link
        $('#offerlink').find('.pop').attr('href', offerlink+planid);
    }

    // Set plan cookie to expire in 10 minutes
    pdate.setTime(pdate.getTime() + (10 * 60 * 1000));
    setCookie('planid', planid, pdate, '/', '', '');

    // Reset required fields
    set_required_fields();

    // Disable submit buttons
    check_enable_submit();

    $(this).blur();
});

// Set default plan
if (getCookie('planid'))
    $('#rateplanid').val(getCookie('planid'));
else if (planid)
    $('#rateplanid').val(planid);

// Trigger change to set required fields
$('#rateplanid').trigger('change');

$("#pwreset").click(function(){
    $.post(
        basepath + 'ajax/resetpw',
        {
            username: $('#resetuser').val()
        },
        function(data) {
            if (data == '')
            {
                $.fancybox.close();
                return;
            }

            set_error('resetuser', data);
        }
    );
});

$('input, select').not('#resetuser').change(function(){
    $.post(
        actionurl+'/validate',
        $('#purchaseForm').serialize() + '&key=' + $(this).attr('name'),
        function(data) { validate_done(data) }
    );
});

$('input.submitOrderButton, input.startSessionButton').click(function(){
    if ($(this).hasClass('opaque'))
        return;

    $.post(
        actionurl+'/validate',
        $('#purchaseForm').serialize(),
        function(data) { validate_done(data) }
    );
});
});

// Override validation error
validate_error = function(json_data)
{
//console.info('purchase.validate_error');

try
{
    if (json_data.errors.nobilling)
    {
        // Pop payment form
        $('.iframe').click()
        return;
    }

    $.each(json_data.errors, function(key, msg) {
        set_error(key, msg);
    });

    window.location.hash = '#messageBox';
}
catch (e)
{
    console.error('purchase.validate_error - %s - %s', e.name, e.message);
}
};

// Override validation success
validate_success = function(json_data)
{
//console.info('purchase.validate_success');

try
{
    var planid = $('#rateplanid').val();

    // For Sponsored Access, perform login
    if ($.inArray(planid, ['spn']) >= 0)
    {
        do_login();
        return;
    }

    // For paid access, pop confirmation screen
    $('#completePopup').html(json_data.data.pophtml);
    $('#triggerComplete').click();

    // Track with Omniture
    var s = s_gi('comcastwificaptiveportalprod');
    s.tl(this,'o','Payment Confirmation Desktop Page');

    return;
}
catch (e)
{
    console.error('purchase.validate_success - %s - %s', e.name, e.message);
}
};

var confirmed = function()
{
$.fancybox.close();
do_login();
};

 var set_required_fields = function()
 {
  //console.info('purchase.set_required_fields');

// Clear required fields
$('.required').removeClass('required');

var planid = $('#rateplanid').val();
if (planid > 0)
{
    // Set required fields
    $('input#username, input#password, input#password1, input#password2').addClass('required');
    $('input#firstname, input#lastname, input#email').addClass('required');
    $('#paymentFormInputs1, #paymentFormInputs2').find(':input').each(function() {
          $(this).not('#storeinfo').addClass('required');
    });
}
else
{
    // Set required fields
    $('#complimentary_'+planid).find(':input').each(function() {
      $(this).addClass('required');
    });
}
};
我的问题是:

如何在名为macid的变量中获取新的mac地址 如何在变量apid中获取ap mac地址 如何获取它请求的哈希值并将其放入变量hashid中
如何通过发送适当的表单数据。即。。计划id.

您只需要在身份验证服务器上进行身份验证,对吗?我认为认证和重新认证的过程是相同的。建议使用请求模块。这是给你的

请尝试使用如下身份验证代码:

>>> from requests.auth import HTTPBasicAuth
>>> requests.get('https://api.github.com/user', auth=HTTPBasicAuth('user', 'pass'))
<Response [200]>

希望有帮助

如果您没有提供有关重新验证web工作原理的更多详细信息,则无法告诉您如何通过web重新验证question@daugherjo如果这个答案有帮助,请接受它。如果您有进一步的问题,请提出另一个问题,这样其他人就不会对这个不相关的答案感到困惑