Skip to content

Commit

Permalink
Fixed an issue with first login, added back possibility to save decod…
Browse files Browse the repository at this point in the history
…ed data in a Note, JSON (new) or TXT.
  • Loading branch information
Andreag00 authored Jun 22, 2022
1 parent 811e8b8 commit 045bff3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
21 changes: 19 additions & 2 deletions Scriptable-JS/ShorteNB-Core.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
let CellID = CellID;
// Variable Declaration

let CellID = CellID;
let MNC1 = MNC1;
let MNC2 = MNC2;
let user = "username";
let password = "password";

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

// eNB/CID Calculation

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

// Band Determination

if (eNB >= 10000 && eNB <= 99999) {
// Vodafone
band = [,20,,3,1,7,,,,8,,20,,3,1,7][~~(CID / 10)];
actMNC = 22210;
} else if (eNB >= 100000 && eNB <= 999999) {
Expand All @@ -20,18 +28,23 @@ if (eNB >= 10000 && eNB <= 99999) {
} else if (Math.floor(eNB/1000) % 2 != 0) {
eNB -= 1000;
}
// WindTre
band = [3,20,7,1,38][~~(CID / 6)];
} else {
actMNC = 2221
// Tim
band = [,,7,1,3,,20][~~(CID / 10)];
}
} else if(eNB >= 1000000 && eNB <= 1100000) {
actMNC = 22250;
// iliad
band = [,,1,,"7 COVID",,7,28,3][~~(CID / 10)];
}

var bool = Keychain.contains("cookie");

// Check if login has already been done, if not login

if (bool == false) {
let req = new Request("https://lteitaly.it/api/AV1.php");
req.method = "POST";
Expand All @@ -40,13 +53,17 @@ if (bool == false) {
let res = await req.load();
req.response.cookies;

// Process and Save Cookie

for (const cookie of req.response.cookies) {
cookies += cookie.name + "=" + cookie.value + "; ";
}

Keychain.set("cookie", cookies);
}

// Return data required by ShorteNB

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

Script.complete();
Binary file modified ShorteNB.shortcut
Binary file not shown.
2 changes: 1 addition & 1 deletion changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Riscritta la logica per calcolare CID, eNB e banda in JavaScript.
Corretto un problema col primo login, riaggiunta la possibilità di salvare i dati decodificati in un file, aggiungendo anche la possibilità di salvare i dati come un JSON.

DISCLAIMER: questa versione è una beta e potrebbe presentare bug oltre a non essere completa.
2 changes: 1 addition & 1 deletion link
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://www.icloud.com/shortcuts/113ea644da3d4c08ace7435adbc65508
https://www.icloud.com/shortcuts/a8a5b9a825c94ff298872e9e317bfc45
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b7
b8

0 comments on commit 045bff3

Please sign in to comment.