improve wifiscan, enable by default

git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2216 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2015-01-21 22:44:10 +00:00
parent 2c2c434fec
commit db75c29143
6 changed files with 110 additions and 26 deletions

View File

@ -1,10 +1,10 @@
Package: webif
Priority: optional
Section: web
Version: 1.2.0-2
Version: 1.2.0-3
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.1.14),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=1.2.0),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools,dbupdate,mongoose
Depends: webif-channelicons(>=1.1.14),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=1.2.0),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,mongoose
Suggests:
Description: An evolving web interface for the Humax.
Tags: http://hummy.tv/forum/threads/5866/

View File

@ -25,15 +25,73 @@ foreach line [split $op "\n"] {
switch -glob [string trim $key] {
*Address {
if {$cur} {
puts ""
if {![llength $authtypes]} {
lappend authtypes "WEP"
}
puts ","
puts " \"auth\": \"$authtypes\""
puts " \},"
} else {
incr cur
}
set authtypes {}
puts " \{"
set mac "$val:[join $extra :]"
puts -nonewline " \"address\": \"[string trim $mac]\""
}
IE {
switch -glob [string trim $val] {
"WPA Version 1" {
lappend authtypes "WPA/"
}
*WPA2* {
lappend authtypes "WPA2/"
}
}
}
"Group Cipher" {
switch -glob [string trim $val] {
TKIP {
set x [lindex $authtypes end]
append x "TKIP"
lset authtypes end $x
}
CCMP {
set x [lindex $authtypes end]
append x "AES"
lset authtypes end $x
}
}
}
"Pairwise Ciphers*" {
switch -glob [string trim $val] {
*TKIP* {
set x [lindex $authtypes end]
if {![string match *TKIP* $x]} {
if {![string match */ $x]} {
append x +
}
append x "TKIP"
}
lset authtypes end $x
}
*CCMP* {
set x [lindex $authtypes end]
if {![string match *AES* $x]} {
if {![string match */ $x]} {
append x +
}
append x "AES"
}
lset authtypes end $x
}
}
}
Protocol {
puts ","
puts -nonewline " \"protocol\": \"[string trim [
string map {802.11 ""} $val]]\""
}
ESSID {
puts ","
puts -nonewline " \"ssid\": \"[string trim $val \"]\""
@ -60,7 +118,11 @@ foreach line [split $op "\n"] {
}
if {$cur} {
puts ""
if {![llength $authtypes]} {
lappend authtypes "WEP"
}
puts ","
puts " \"auth\": \"$authtypes\""
puts " \}"
}

View File

@ -85,26 +85,21 @@ if {$if eq "wifi"} {
pack data $ssid -str $([string length $ssid] * 8)
pack data $pass -str $([string length $pass] * 8) $(8 * 0x78)
switch $auth {
8 {
# "WPA2 PSK (AES)"
set bytes {3 4 4}
}
7 {
# "WPA2 PSK (TKIP+AES)"
set bytes {3 4 2}
}
6 {
# "WPA PSK (AES)"
set bytes {2 3 4}
}
5 {
# "WPA PSK (TKIP)"
set bytes {2 3 2}
}
default {
set bytes {0 0 0}
}
set authmap {
8 {3 4 4} # WPA2 PSK (AES)
7 {3 4 2} # WPA2 PSK (TKIP+AES)
6 {2 3 4} # WPA PSK (AES)
5 {2 3 2} # WPA PSK (TKIP)
4 {1 1 2} # WEP 128-bit ASCII # Guess
3 {1 2 2} # WEP 128-bit Hex # Guess
2 {1 1 1} # WEP 64-bit ASCII # Guess
1 {1 0 1} # WEP 64-bit Hex
0 {0 0 0} # None
}
if {[dict exists $authmap $auth]} {
set bytes [dict get $authmap $auth]
} else {
set bytes {0 0 0}
}
pack data [lindex $bytes 0] -intle 8 $(8 * 0x68)
pack data [lindex $bytes 1] -intle 8 $(8 * 0x6c)

View File

@ -52,7 +52,9 @@ if (v.encryption == 'on')
else
str += '<td></td>';
str += '<td><a class=ssid href=#>' + v.ssid + '</a></td>';
str += '<td class=footnote>(Channel ' + v.channel + ')</td>';
str += '<td class=blood>' + 'Channel ' + v.channel + ',</td>' +
'<td class=blood>' + '802.11 ' + v.protocol + ',</td>' +
'<td class=blood>' + v.auth + '</td>';
str += '</tr>';
$('#ns_ssid_list').append(str);
});
@ -68,5 +70,30 @@ $('#ns_ssid_list').on('click', 'a.ssid', function(el) {
$(form).find('input[name=ssid]').val($(this).text());
});
$('#ns_wifi_authmode').on('change', function() {
val = ~~($(this).val());
switch (val)
{
case 0:
$('#ns_pp').disable().attr('size', 10);
break;
case 1:
$('#ns_pp').enable().attr('size', 14).attr('maxlength', 10);
break;
case 2:
$('#ns_pp').enable().attr('size', 8).attr('maxlength', 5);
break;
case 3:
$('#ns_pp').enable().attr('size', 30).attr('maxlength', 26);
break;
case 4:
$('#ns_pp').enable().attr('size', 16).attr('maxlength', 13);
break;
default:
$('#ns_pp').enable().attr('size', 40).attr('maxlength', 128);
break;
}
}).trigger('change');

View File

@ -106,7 +106,7 @@ proc _ns_iftable {if tag} {
append r "
<th class=key>Authentication Type</th>
<td><select name=auth>
<td><select id=ns_wifi_authmode name=auth>
"
set val [system param WLAN_AUTH_TYPE]
foreach id [array names authtypes] {