//--
function OnStart()
{
lay = app.CreateLayout("linear","vcenter,fillxy");
//--
app.ShowProgress("Loading...");
var sys = app.CreateSysProc("su");
sys.Out("cat /data/misc/wifi/wpa_supplicant.conf > /sdcard/WiFi.conf");
check = setInterval("CheckFile()",200);
lstWifi = app.CreateList("",1,1);
lay.AddChild(lstWifi);
app.AddLayout( lay );
}
function CheckFile()
{
if(app.FileExists("/sdcard/WiFi.conf")) {
app.HideProgress();
clearInterval(check);
var text = app.ReadFile("/sdcard/WiFi.conf");
text = text.replace(/\"/gi,"");
text = text.replace(/ssid=/gi,"");
text = text.replace(/psk=/gi,"");
text = text.replace(/key_mgmt=/gi,"");
var spt = text.split("network={");
var list = "";
for( var i = 0; i<spt.length; i++ ) {
var a = spt[i];
a = a.replace(/\t/gi,"");
if(a.length<350) {
var net = a.split("\n");
var name = net[1]; pass = net[2]; type = net[3];
list += name+":Password^c^ "+pass+"\nType^c^ "+type+":null,";
}
}
lstWifi.SetList(list);
setTimeout('app.DeleteFile("/sdcard/WiFi.conf")',200);
}
}