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]})
|
||||
}
|
||||
|
||||
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) {
|
||||
socket.emit("notification", {
|
||||
is_ok,
|
||||
@ -65,6 +75,10 @@ io.on("connection", (socket) => {
|
||||
await send_private_data();
|
||||
})
|
||||
|
||||
socket.on("open_ports_req", async () => {
|
||||
await send_open_ports();
|
||||
})
|
||||
|
||||
socket.on("reset_adid", async () => {
|
||||
await spawnPromise("bash", ["/conf/reset_adid.sh"]);
|
||||
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>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2>Open ports</h2>
|
||||
<p id="open-ports"></p>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
@ -13,6 +13,7 @@ import {
|
||||
lat_priv_info_table,
|
||||
lon_priv_info_table,
|
||||
recentButton,
|
||||
open_ports,
|
||||
} from "./shared";
|
||||
|
||||
import { start_notifications } from "./notifications";
|
||||
@ -116,6 +117,11 @@ socket.on("private_info", (data) => {
|
||||
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.onAny((ev, ...args) => {
|
||||
@ -227,6 +233,18 @@ async function screenshot_loop() {
|
||||
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();
|
||||
start_notifications();
|
||||
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 lon_priv_info_table = document.getElementById("lon_priv_info_table")!;
|
||||
|
||||
export const open_ports = document.getElementById("open-ports")!;
|
||||
export const socket = io();
|
||||
|
Loading…
x
Reference in New Issue
Block a user