Skip to content

Commit

Permalink
Added various CIDs, changed geolocalization process
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreag00 committed Mar 7, 2023
1 parent 40e377d commit dca404c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
24 changes: 14 additions & 10 deletions Scriptable-JS/ShorteNB-Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ let MNC2 = MNC2;
let user = "username";
let password = "password";

var eNB, acteNB, CID, band, actMNC, cookies = "";
var eNB, acteNB, CID, band, actMNC, cookies, MNO = "";

// eNB/CID Calculation

eNB = Math.floor(CellID / 256);
acteNB = eNB;
acteNB = eNB
CID = CellID % 256;

// Band Determination
Expand All @@ -20,25 +20,29 @@ if (eNB >= 10000 && eNB <= 99999) {
// Vodafone
band = [,20,,3,1,7,28,,,8,,20,,3,1,7][~~(CID / 10)];
actMNC = 22210;
MNO = "Vodafone";
} else if (eNB >= 100000 && eNB <= 999999) {
if (MNC1 == 22288 || MNC2 == 22288) {
actMNC = 22288;
actMNC = 22288
MNO = "WindTre";
if (eNB >= 502000 && Math.floor(eNB/1000) % 2 != 0) {
eNB -= 401000;
} else if (eNB >= 502000) {
eNB -= 400000;
eNB -= 401000
} else if (eNB >= 502000) {
eNB -= 400000
} else if (Math.floor(eNB/1000) % 2 != 0) {
eNB -= 1000;
}
}
// WindTre
band = [3,20,7,1,38][~~(CID / 6)];
} else {
actMNC = 2221;
actMNC = 2221
MNO = "Tim";
// Tim
band = [,,7,1,3,,20][~~(CID / 10)];
band = [,,7,1,3,,20,28,,,,,7,1,3][~~(CID / 10)];
}
} else if(eNB >= 1000000 && eNB <= 1100000) {
actMNC = 22250;
MNO = "iliad";
// iliad
band = [,,1,,"7 COVID",,7,28,3][~~(CID / 10)];
}
Expand All @@ -64,6 +68,6 @@ if (Keychain.contains("cookie") == false) {

// Return data required by ShorteNB

return{eNB, acteNB, CID, band, actMNC};
return{eNB, acteNB, CID, band, actMNC, MNO};

Script.complete();
10 changes: 2 additions & 8 deletions Scriptable-JS/lteitaly-query.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ req.method = "POST";
req.headers = { "Content-Type": "application/json;charset=UTF-8", "Cookie": cookies, "Referer": "https://lteitaly.it" };
req.body = "[\"databyenb3\",\"actMNC\",\"eNB\"]";

//Check if cookie has expired, if it has update it and quit the shortcut
if(await req.loadString() != "Forbidden") {

let json = await req.loadJSON();

// Process and Update Cookie

req.response.cookies;
Expand All @@ -38,19 +36,15 @@ if(await req.loadString() != "Forbidden") {
let associateIndex = ["- AAU mmWave","- TDD Sub-6GHz","- FDD","- DSS","- Altro"];
let associateDigit = ["No","","Passivo","Intersite","-","Ignoto"];
let NR_Info = [...json[3]].map((it, index) => [associateIndex[index], associateDigit[it]]).filter(it => it[1] !== 'No').map(it => it.join(" ")).join("\n")

return{Name,LTE_Bands,NR_Bands,NR_Info};
Script.complete();
} else {

//Update expired cookie
let user = "username";
let password = "password";

let loginReq = new Request("https://lteitaly.it/api/AV1.php");
loginReq.method = "POST";
loginReq.headers = { "Content-Type": "application/json;charset=UTF-8" };
loginReq.body = "[\"login\",\""+ user +"\",\"" + password +"\",true]";;
loginReq.body = "[\"login\",\""+ user +"\",\""+ password +"\",true]";;
await loginReq.load();
loginReq.response.cookies;

Expand All @@ -60,6 +54,6 @@ if(await req.loadString() != "Forbidden") {
newcookies += cookie.name + "=" + cookie.value + "; ";
}

Keychain.set("cookie", newcookies);
Keychain.set("cookie",newcookies);
Script.complete();
}
Binary file modified ShorteNB.shortcut
Binary file not shown.
4 changes: 2 additions & 2 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Corretto l'error handling in caso di cookie scaduti e cambiato il metodo in cui vengono salvate le impostazioni in modo da non salvarle in chiaro. È possibile cancellare il file settings.json da iCloud Drive.
Sarà necessario effettuare nuovamente il primo setup dello Shortcut.
Modifica minore al salvataggio delle credenziali. Sarà necessario effettuare nuovamente il primo setup dello Shortcut (giuro che sarà l'ultima volta) o eseguire Keychain.set("setup","true") dentro Scriptable.
Aggiunti i CID della B28 e i CID 1xx di Tim, modificato l'ordine di esecuzione per rendere più efficiente l'esecuzione quando il GPS fa fatica a localizzare il telefono, aggiunta l'indicazione dell'MNO rilevato nella notifica.
2 changes: 1 addition & 1 deletion link
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://www.icloud.com/shortcuts/82434d4911f94103862e22d67325ef53
https://www.icloud.com/shortcuts/85691dedefa641eb865352e102284e76
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1
1.1.1

0 comments on commit dca404c

Please sign in to comment.