adding open ports
This commit is contained in:
parent
e23cac512e
commit
178c65be34
@ -29,6 +29,16 @@ async function send_private_data() {
|
|||||||
io.emit("private_info", {adid, latitude: gps_coords[0], longitude: gps_coords[1]})
|
io.emit("private_info", {adid, latitude: gps_coords[0], longitude: gps_coords[1]})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function send_open_ports() {
|
||||||
|
let ports = new Set((await spawnPromise("bash", ["/conf/get_ports.sh"])).output.trim().split(' '));
|
||||||
|
|
||||||
|
let start_ports = fs.readFileSync("/ports").toString().trim().split(' ');
|
||||||
|
for (let port of start_ports) {
|
||||||
|
ports.delete(port);
|
||||||
|
}
|
||||||
|
io.emit("open_ports", [...ports]);
|
||||||
|
}
|
||||||
|
|
||||||
function send_notification(socket, is_ok, context, message) {
|
function send_notification(socket, is_ok, context, message) {
|
||||||
socket.emit("notification", {
|
socket.emit("notification", {
|
||||||
is_ok,
|
is_ok,
|
||||||
@ -65,6 +75,10 @@ io.on("connection", (socket) => {
|
|||||||
await send_private_data();
|
await send_private_data();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
socket.on("open_ports_req", async () => {
|
||||||
|
await send_open_ports();
|
||||||
|
})
|
||||||
|
|
||||||
socket.on("reset_adid", async () => {
|
socket.on("reset_adid", async () => {
|
||||||
await spawnPromise("bash", ["/conf/reset_adid.sh"]);
|
await spawnPromise("bash", ["/conf/reset_adid.sh"]);
|
||||||
await send_private_data();
|
await send_private_data();
|
||||||
|
6
android/conf/get_ports.sh
Normal file
6
android/conf/get_ports.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
out=$(adb shell su root "ss -tunlp | tail -n+2 | awk -F \" \" '{print \$5}' | awk -F ':' '{print \$NF}' | sort -n | uniq")
|
||||||
|
|
||||||
|
if [ ! -f /ports ]; then
|
||||||
|
echo -n $out > /ports
|
||||||
|
fi
|
||||||
|
echo -n $out
|
@ -129,6 +129,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<h2>Open ports</h2>
|
||||||
|
<p id="open-ports"></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
@ -13,6 +13,7 @@ import {
|
|||||||
lat_priv_info_table,
|
lat_priv_info_table,
|
||||||
lon_priv_info_table,
|
lon_priv_info_table,
|
||||||
recentButton,
|
recentButton,
|
||||||
|
open_ports,
|
||||||
} from "./shared";
|
} from "./shared";
|
||||||
|
|
||||||
import { start_notifications } from "./notifications";
|
import { start_notifications } from "./notifications";
|
||||||
@ -116,6 +117,11 @@ socket.on("private_info", (data) => {
|
|||||||
lon_priv_info_table.textContent = data.longitude;
|
lon_priv_info_table.textContent = data.longitude;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on("open_ports", (data: string[]) => {
|
||||||
|
console.log("open_ports");
|
||||||
|
open_ports.textContent = data.toString();
|
||||||
|
});
|
||||||
|
|
||||||
socket.emit("private_info_req");
|
socket.emit("private_info_req");
|
||||||
|
|
||||||
socket.onAny((ev, ...args) => {
|
socket.onAny((ev, ...args) => {
|
||||||
@ -227,6 +233,18 @@ async function screenshot_loop() {
|
|||||||
while (performance.now() - before < 100) await sleep(50);
|
while (performance.now() - before < 100) await sleep(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function open_ports_loop() {
|
||||||
|
var before;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
before = performance.now();
|
||||||
|
socket.emit("open_ports_req");
|
||||||
|
while (performance.now() - before < 2000) await sleep(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open_ports_loop();
|
||||||
screenshot_loop();
|
screenshot_loop();
|
||||||
start_notifications();
|
start_notifications();
|
||||||
start_traffic_log();
|
start_traffic_log();
|
||||||
|
@ -12,4 +12,5 @@ export const adid_priv_info_table = document.getElementById("adid_priv_info_tabl
|
|||||||
export const lat_priv_info_table = document.getElementById("lat_priv_info_table")!;
|
export const lat_priv_info_table = document.getElementById("lat_priv_info_table")!;
|
||||||
export const lon_priv_info_table = document.getElementById("lon_priv_info_table")!;
|
export const lon_priv_info_table = document.getElementById("lon_priv_info_table")!;
|
||||||
|
|
||||||
|
export const open_ports = document.getElementById("open-ports")!;
|
||||||
export const socket = io();
|
export const socket = io();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user