From ae01c69f8d9bedc560d82b9936c472eaad4ada98 Mon Sep 17 00:00:00 2001 From: Sean Date: Thu, 13 Nov 2025 10:32:41 +0800 Subject: [PATCH 1/4] added exit message --- .nvim.lua | 11 +++++++++++ HNroute.txt | 2 +- main.py | 21 ++++++++++----------- pyproject.toml | 5 +++++ 4 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 .nvim.lua create mode 100644 pyproject.toml diff --git a/.nvim.lua b/.nvim.lua new file mode 100644 index 0000000..11849cd --- /dev/null +++ b/.nvim.lua @@ -0,0 +1,11 @@ +return { + { + "AstroNvim/astrolsp", + ---@type AstroLSPOpts + opts = { + server = { + basedpyright = false, + }, + }, + }, +} diff --git a/HNroute.txt b/HNroute.txt index 59d3883..e6b6bd2 100644 --- a/HNroute.txt +++ b/HNroute.txt @@ -1 +1 @@ -{"lng":"120.7335575167566","lat":"30.52802386594508"},{"lng":"120.7335664998117","lat":"30.527949984828833"},{"lng":"120.73357997439435","lat":"30.527887769107984"},{"lng":"120.73361590661474","lat":"30.527825553346897"},{"lng":"120.7336653134178","lat":"30.527771114522935"},{"lng":"120.73372370327594","lat":"30.527720564158813"},{"lng":"120.73379107618919","lat":"30.527689456229226"},{"lng":"120.73387641521265","lat":"30.527662236782586"},{"lng":"120.73397073729119","lat":"30.52765057130309"},{"lng":"120.73407404242484","lat":"30.527646682809618"},{"lng":"120.73416387297584","lat":"30.527677790753035"},{"lng":"120.73428514421968","lat":"30.52773611811983"},{"lng":"120.73436150018803","lat":"30.52781388788721"},{"lng":"120.73441539851864","lat":"30.527922765455916"},{"lng":"120.73444234768392","lat":"30.52803941985705"},{"lng":"120.73445133073903","lat":"30.528156074116726"},{"lng":"120.73445582226658","lat":"30.5283038359759"},{"lng":"120.73446031379413","lat":"30.528420489914918"},{"lng":"120.73446031379413","lat":"30.52852158988096"},{"lng":"120.73446480532168","lat":"30.528618801286576"},{"lng":"120.73446480532168","lat":"30.528719901044198"},{"lng":"120.73445582226658","lat":"30.52881322380307"},{"lng":"120.73442887310128","lat":"30.528902658028688"},{"lng":"120.73439294088088","lat":"30.52898820373192"},{"lng":"120.73434353407784","lat":"30.529034864992525"},{"lng":"120.73427616116459","lat":"30.529081526230495"},{"lng":"120.73420429672379","lat":"30.52912429901208"},{"lng":"120.73414590686563","lat":"30.529143741179244"},{"lng":"120.73408302547993","lat":"30.52915929491014"},{"lng":"120.73399319492894","lat":"30.52915540647765"},{"lng":"120.73390785590549","lat":"30.52915540647765"},{"lng":"120.73383599146469","lat":"30.529135964312847"},{"lng":"120.733773110079","lat":"30.529108745275526"},{"lng":"120.73372370327594","lat":"30.529065972487018"},{"lng":"120.73365633036269","lat":"30.529003757487974"},{"lng":"120.73361590661474","lat":"30.528925988682573"},{"lng":"120.7335754828668","lat":"30.528855996703964"},{"lng":"120.7335664998117","lat":"30.528782116226836"},{"lng":"120.7335575167566","lat":"30.528719901044198"},{"lng":"120.7335575167566","lat":"30.52863435510235"},{"lng":"120.7335575167566","lat":"30.528541032169947"},{"lng":"120.7335575167566","lat":"30.528451597608097"},{"lng":"120.7335485337015","lat":"30.528350497568482"},{"lng":"120.73355302522906","lat":"30.528261062829475"},{"lng":"120.7335575167566","lat":"30.52818329342363"},{"lng":"120.73356200828415","lat":"30.528128854802127"} \ No newline at end of file +{"lng":"120.73355340732613","lat":"30.52791217112062"},{"lng":"120.73356688190877","lat":"30.527881063252995"},{"lng":"120.73357586496387","lat":"30.52786162083062"},{"lng":"120.73359832260162","lat":"30.527830512946643"},{"lng":"120.73362976329447","lat":"30.527779962613735"},{"lng":"120.73366120398732","lat":"30.52773718923438"},{"lng":"120.73371959384546","lat":"30.52769052734429"},{"lng":"120.73375103453832","lat":"30.527671084883416"},{"lng":"120.73382289897911","lat":"30.527651642418597"},{"lng":"120.73388128883727","lat":"30.527639976937824"},{"lng":"120.73389925494746","lat":"30.527643865431564"},{"lng":"120.73394417022297","lat":"30.527639976937824"},{"lng":"120.73401603466377","lat":"30.527639976937824"},{"lng":"120.73407891604946","lat":"30.527651642418597"},{"lng":"120.73412832285251","lat":"30.527659419404994"},{"lng":"120.73418671271065","lat":"30.527686638852433"},{"lng":"120.73422264493105","lat":"30.527709969801247"},{"lng":"120.73428552631675","lat":"30.527764408659813"},{"lng":"120.73433942464736","lat":"30.52782662446044"},{"lng":"120.7343618822851","lat":"30.52791217112062"},{"lng":"120.73436637381265","lat":"30.528032714012635"},{"lng":"120.7343708653402","lat":"30.528199918419226"},{"lng":"120.7343798483953","lat":"30.528417672559534"},{"lng":"120.73438433992285","lat":"30.528635426206904"},{"lng":"120.7343708653402","lat":"30.528802629565835"},{"lng":"120.73434840770246","lat":"30.528907617572916"},{"lng":"120.73421366187596","lat":"30.52900871702698"},{"lng":"120.73427654326166","lat":"30.528969832634147"},{"lng":"120.73413281438006","lat":"30.529063155150546"},{"lng":"120.73403849230151","lat":"30.529090374200766"},{"lng":"120.73391722105767","lat":"30.529094262635883"},{"lng":"120.73378696675871","lat":"30.529063155150546"},{"lng":"120.73372408537301","lat":"30.529020382341763"},{"lng":"120.73365671245978","lat":"30.528965944194"},{"lng":"120.73361179718427","lat":"30.528911506015422"},{"lng":"120.73356688190877","lat":"30.52884151402627"},{"lng":"120.73356239038122","lat":"30.528755968192584"},{"lng":"120.73356239038122","lat":"30.528689864541718"},{"lng":"120.73354442427102","lat":"30.528569322473196"},{"lng":"120.73355789885368","lat":"30.528464334096896"},{"lng":"120.73355340732613","lat":"30.5283010186171"},{"lng":"120.73357137343632","lat":"30.52820380689034"},{"lng":"120.73354891579858","lat":"30.528145479807133"},{"lng":"120.73353544121592","lat":"30.528083264212718"},{"lng":"120.73353544121592","lat":"30.52802493705642"},{"lng":"120.73353094968837","lat":"30.52798994074566"} diff --git a/main.py b/main.py index 86bff17..0dfbbb3 100644 --- a/main.py +++ b/main.py @@ -1,18 +1,13 @@ -import signal +import asyncio import logging -import coloredlogs import os -import asyncio - +import signal -from init import init -from init import tunnel -from init import route +import coloredlogs -import run import config - - +import run +from init import init, route, tunnel debug = os.environ.get("DEBUG", False) @@ -75,4 +70,8 @@ async def main(): if __name__ == "__main__": - asyncio.run(main()) \ No newline at end of file + try: + asyncio.run(main()) + except KeyboardInterrupt: + print("\nExiting...") + diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..59b797d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,5 @@ +[tool.basedpyright] +typeCheckingMode = "basic" +reportUnknownMemberType = "none" +reportOptionalMemberAccess = "none" +reportAttributeAccessIssue = "none" From 9696e1c8461ba96e350244245a4c5d768f4fed2a Mon Sep 17 00:00:00 2001 From: It_is_Sean Date: Sun, 16 Nov 2025 02:41:52 +0800 Subject: [PATCH 2/4] feature: the speed will decrease naturally as time moves on --- .DS_Store | Bin 0 -> 6148 bytes config.yaml | 4 +++- main.py | 10 +++++----- pyproject.toml | 2 ++ run.py | 12 +++++++++--- util/speed.py | 6 ++++++ 6 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 .DS_Store create mode 100644 util/speed.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a170eab9ab8aed98173511a8e1ac9d8c7f7dc810 GIT binary patch literal 6148 zcmeHKv2GJV5PgdeFxWzl(oi6DR3Jr)6e=3T5g92ZC^f>d9VL7(##CJXRTtZsp&wNTUREP4hs7`N+U=*F!extUw=@JHS=2iejjc50*{67B@C(G4xW?eUd(dw(^Gq-CcgE+==i0jS{Bhk}>i(&5&lYR80;WDGkQ7J?oG2jcL(V2xD3$^J z(!tIj0f-rgz42Pk5|WcE7K&v+dT1`B5<{xfBZdp<9M3hbP%Hz6bT~bHIIZmTgyMX4 z&Y$~mxFTTclLASBSb;|P+L8VLQT_QpPDY5_&S?6`f|A-7K&v+j?mH{0WU-9k^+BKfuC`x=Gp)N literal 0 HcmV?d00001 diff --git a/config.yaml b/config.yaml index 8dae34a..097ce0c 100644 --- a/config.yaml +++ b/config.yaml @@ -1,4 +1,6 @@ -v: 3.3 +max_speed: 3.3 +min_speed: 2.5 +target_loops: 3 routeConfig: "HNroute.txt" libimobiledeviceDir: "libimobiledevice" imageDir: "DeveloperDiskImage" diff --git a/main.py b/main.py index 0dfbbb3..c7d49b0 100644 --- a/main.py +++ b/main.py @@ -8,6 +8,7 @@ import config import run from init import init, route, tunnel +from util import speed debug = os.environ.get("DEBUG", False) @@ -23,9 +24,10 @@ logging.getLogger('blib2to3.pgen2.driver').setLevel(logging.DEBUG if debug else logging.WARNING) logging.getLogger('urllib3.connectionpool').setLevel(logging.DEBUG if debug else logging.WARNING) - +loop_cnt = 0 async def main(): + global loop_cnt logger = logging.getLogger(__name__) coloredlogs.install(level=logging.INFO) logger.setLevel(logging.INFO) @@ -47,10 +49,10 @@ async def main(): logger.info(f"got route from {config.config.routeConfig}") try: - print(f"已开始模拟跑步,速度大约为 {config.config.v} m/s") + print(f"已开始模拟跑步, 目前是第{loop_cnt +1}/{config.config.target_loops}圈") print("会无限循环,按 Ctrl+C 退出") print("请勿直接关闭窗口,否则无法还原正常定位") - await run.run(address, port, loc, config.config.v) + await run.run(address, port, loc) except KeyboardInterrupt: logger.debug("get KeyboardInterrupt (inner)") logger.debug(f"Is process alive? {process.is_alive()}") @@ -65,8 +67,6 @@ async def main(): logger.debug("terminating tunnel process") process.terminate() logger.info("tunnel process terminated") - print("Bye") - if __name__ == "__main__": diff --git a/pyproject.toml b/pyproject.toml index 8cd7426..d3d654a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,6 +3,8 @@ typeCheckingMode = "basic" reportUnknownMemberType = "none" reportOptionalMemberAccess = "none" reportAttributeAccessIssue = "none" +reportUnreachable = false +reportArgumentType = false [project] name = "iosrealrun-cli-18" version = "0.1.0" diff --git a/run.py b/run.py index 8e3acc3..14131d6 100644 --- a/run.py +++ b/run.py @@ -8,6 +8,9 @@ import time import random import asyncio +from main import loop_cnt +from util.speed import current_speed + from functools import lru_cache @@ -163,15 +166,18 @@ async def run1(dvt, loc: list, v, dt=0.2): await asyncio.sleep(dt - elapsed) clock = time.time() -async def run(address, port, loc: list, v, d=15): +async def run(address, port, loc: list,d=15): + global loop_cnt random.seed(time.time()) rsd = RemoteServiceDiscoveryService((address, port)) await asyncio.sleep(2) await rsd.connect() dvt = DvtSecureSocketProxyService(rsd) dvt.perform_handshake() - while True: + v = current_speed(loop_cnt) vRand = 1000/(1000/v-(2*random.random()-1)*d) + print(f"当前速度为{vRand}/{v}") await run1(dvt, loc, vRand) - print("跑完一圈了") \ No newline at end of file + print("跑完一圈了") + loop_cnt += 1 diff --git a/util/speed.py b/util/speed.py new file mode 100644 index 0000000..9409de9 --- /dev/null +++ b/util/speed.py @@ -0,0 +1,6 @@ +import config +import math +def current_speed(current_loop): + lam = (1 / config.config.target_loops) * math.log(config.config.max_speed/ config.config.min_speed) + return config.config.max_speed* math.exp(-lam * current_loop) + From 45791af4186d202ec0da14ec83c7490b66815ea6 Mon Sep 17 00:00:00 2001 From: It_is_Sean Date: Sun, 16 Nov 2025 02:46:33 +0800 Subject: [PATCH 3/4] fix: now the speed would not decrease after the user reach his target --- util/speed.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/speed.py b/util/speed.py index 9409de9..1ef84cb 100644 --- a/util/speed.py +++ b/util/speed.py @@ -1,6 +1,8 @@ import config import math def current_speed(current_loop): + if current_loop >= config.config.target_loops: + return config.config.min_speed lam = (1 / config.config.target_loops) * math.log(config.config.max_speed/ config.config.min_speed) return config.config.max_speed* math.exp(-lam * current_loop) From a2ca053b99f91b1ea51e21a843ffd63f2996bd09 Mon Sep 17 00:00:00 2001 From: It_is_Sean Date: Mon, 17 Nov 2025 01:02:02 +0800 Subject: [PATCH 4/4] added install.sh --- install.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..e69de29