長話短說。 在Python中有一些編碼問題。Python - wifi - reauth ap
上的程序,以欺騙的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' : '[email protected]' }
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 我怎麼在可變APID 獲得AP MAC地址我怎麼哈希是變量中的新的MAC地址請求並將其放入變量hashid 如何通過發送適當的表單數據。即計劃編號。
如果您沒有提供更多關於re-auth網絡工作原理的詳細信息,就不可能知道如何通過網絡重新授權。 – Anzel
剛剛更新了問題 – daugherjo