Răsfoiți Sursa

Refactor modifierApk.js and pif.js

- Refactor modifierApk.js and pif.js to import the chalk library for console logging.
- Update the condition to check if the device version is less than 138 in modifierApk.js.
- Update the condition to check if the device version is less than 138 in pif.js.
- Add console logs to indicate device updates in modifierApk.js and pif.js.
- Update the APK URL in modifierApk.js.
- Update the script and force-stop commands in pif.js.
- Add console logs to indicate successful updates in pif.js.
- Add console logs to indicate errors in pif.js.

Add kill.js

- Add kill.js to kill the com.google.android.gms and com.google.android.apps.messaging processes on devices.
- Import the chalk library for console logging in kill.js.
- Retrieve the list of devices from the API in kill.js.
- Retrieve the output of a script from devices in kill.js.
- Add console logs to indicate device kills in kill.js.
- Add console logs to indicate errors in kill.js.
xiongzhu 1 an în urmă
părinte
comite
91c7a42368
3 a modificat fișierele cu 89 adăugiri și 21 ștergeri
  1. 58 0
      kill.js
  2. 19 13
      modifierApk.js
  3. 12 8
      pif.js

+ 58 - 0
kill.js

@@ -0,0 +1,58 @@
+import { io } from "socket.io-client"
+import axios from "axios"
+import { setTimeout } from "timers/promises"
+import chalk from "chalk"
+const axiosInstance = axios.create({
+    baseURL: "http://47.98.225.28/api",
+    headers: {
+        Authorization:
+            "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InpvdW1hQWRtaW4iLCJzdWIiOjEsInJvbGVzIjpbImFkbWluIl0sImlhdCI6MTcyNjU4MTk1OH0.dQiHFYaDDa1qp4OpEHaH5SCZ9dafJ8uO9fAAc8HZgAo"
+    }
+})
+
+const {
+    data: { items: devices }
+} = await axiosInstance.post("/device", {
+    page: { page: 1, limit: 1000 },
+    search: { where: { online: true }, order: { name: "ASC" } }
+})
+
+for (let device of devices) {
+    try {
+        const {
+            data: { out }
+        } = await axiosInstance.post(
+            `/device/${device.id}/sendMessage`,
+            {
+                action: "runScript",
+                data: {
+                    script: "cat /data/adb/modules/playintegrityfix/pif.json"
+                }
+            },
+            {
+                timeout: 10000
+            }
+        )
+        console.log(chalk.blue(device.id, device.name, "kill"))
+        axiosInstance
+            .post(
+                `/device/${device.id}/sendMessage`,
+                {
+                    action: "runScript",
+                    data: {
+                        script: `am force-stop com.google.android.gms
+sleep 1
+am force-stop com.google.android.apps.messaging`
+                    }
+                },
+                {
+                    timeout: 60000
+                }
+            )
+            .catch(e =>
+                console.log(chalk.red(device.id, device.name, e.message))
+            )
+    } catch (e) {
+        console.log(chalk.red(e.message))
+    }
+}

+ 19 - 13
modifierApk.js

@@ -1,6 +1,7 @@
 import { io } from "socket.io-client"
 import { io } from "socket.io-client"
 import axios from "axios"
 import axios from "axios"
 import { setTimeout } from "timers/promises"
 import { setTimeout } from "timers/promises"
+import chalk from "chalk"
 const axiosInstance = axios.create({
 const axiosInstance = axios.create({
     baseURL: "http://47.98.225.28/api",
     baseURL: "http://47.98.225.28/api",
     headers: {
     headers: {
@@ -16,20 +17,25 @@ const {
     search: { where: { online: true }, order: { name: "ASC" } }
     search: { where: { online: true }, order: { name: "ASC" } }
 })
 })
 
 
-for (let d of devices) {
-    if (parseInt(d.version) < 136) {
-        await axiosInstance.post(
-            `/device/${device.id}/sendMessage`,
-            {
-                action: "installApk",
-                data: {
-                    apkUrl: ""
+for (let device of devices) {
+    if (parseInt(device.version) < 138) {
+        console.log(chalk.green(`${device.name} update`))
+        axiosInstance
+            .post(
+                `/device/${device.id}/sendMessage`,
+                {
+                    action: "installApk",
+                    data: {
+                        apkUrl: "https://nebuai.oss-cn-hangzhou.aliyuncs.com/application/20241022/brtrfvf0.apk"
+                    }
+                },
+                {
+                    timeout: 60000
                 }
                 }
-            },
-            {
-                timeout: 2000
-            }
-        )
+            )
+            .catch(e => {
+                console.log(chalk.red(e.message))
+            })
         await setTimeout(500)
         await setTimeout(500)
     }
     }
 }
 }

+ 12 - 8
pif.js

@@ -1,6 +1,7 @@
 import { io } from "socket.io-client"
 import { io } from "socket.io-client"
 import axios from "axios"
 import axios from "axios"
 import { setTimeout } from "timers/promises"
 import { setTimeout } from "timers/promises"
+import chalk from "chalk"
 const axiosInstance = axios.create({
 const axiosInstance = axios.create({
     baseURL: "http://47.98.225.28/api",
     baseURL: "http://47.98.225.28/api",
     headers: {
     headers: {
@@ -34,29 +35,32 @@ for (let device of devices) {
         )
         )
         if (
         if (
             !out.includes(
             !out.includes(
-                "google/komodo_beta/komodo:15/AP41.240823.009/12329489:user/release-keys"
+                "samsung/herolteskt/herolteskt:8.0.0/R16NW/G930SKSU1ERE8:user/release-keys"
             )
             )
         ) {
         ) {
-            console.error(device.id, device.name, "update")
+            console.log(chalk.blue(device.id, device.name, "update"))
             axiosInstance
             axiosInstance
                 .post(
                 .post(
                     `/device/${device.id}/sendMessage`,
                     `/device/${device.id}/sendMessage`,
                     {
                     {
                         action: "runScript",
                         action: "runScript",
                         data: {
                         data: {
-                            script: `/data/adb/magisk/busybox wget -O /data/adb/modules/playintegrityfix/pif.json https://nebuai.oss-cn-hangzhou.aliyuncs.com/application/20241016/yq6jx56d.json
-am force-stop com.google.android.gms`
+                            script: `/data/adb/magisk/busybox wget -O /data/adb/modules/playintegrityfix/pif.json https://nebuai.oss-cn-hangzhou.aliyuncs.com/application/20241022/0knkzxmy.json
+am force-stop com.google.android.gms
+am force-stop com.google.android.apps.messaging`
                         }
                         }
                     },
                     },
                     {
                     {
-                        timeout: 10000
+                        timeout: 60000
                     }
                     }
                 )
                 )
-                .catch(e => console.log(device.id, device.name, e.message))
+                .catch(e =>
+                    console.log(chalk.red(device.id, device.name, e.message))
+                )
         } else {
         } else {
-            console.log(device.id, device.name, "OK")
+            console.log(chalk.green(device.id, device.name, "OK"))
         }
         }
     } catch (e) {
     } catch (e) {
-        console.log(e.message)
+        console.log(chalk.red(e.message))
     }
     }
 }
 }