TeckFire

silent_sentinel.sh script

Mar 3rd, 2026 (edited)
1,423
0
Never
8
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.63 KB | Source Code | 0 0
  1. #!/bin/zsh
  2. #place in /usr/local/bin/silent_sentinel.sh
  3. =============================================================================
  4. # Silent Sentinel v20.0 — "Minimal-Fork Architecture"
  5. # Target : MacBookPro10,1 | Ivy Bridge i7-3820QM | 16GB | macOS Sequoia (OCLP)
  6. # Runtime : Root LaunchDaemon
  7. #
  8. # ARCHITECTURAL CHANGES FROM v19:
  9. #
  10. # SYSCTL INJECTION
  11. # v20: ONE fork — all key=value pairs fed to a single `sysctl -f /dev/stdin`
  12. # via ZSH heredoc. Zero temp files. Zero loops.
  13. #
  14. # PROCESS SCAN LOOP
  15. # v20: ONE `ps` fork. Pure ZSH builds pid→ni and pid→comm hashes. O(1)
  16. # cache lookup per known PID; O(T) key scan only on cache miss.
  17. # Net: O(new_procs × T) per cycle on a stable system ≈ near-zero.
  18. #
  19. # RENICE
  20. # v20: One renice fork per tier, no verification fork. Nice drift is
  21. # caught naturally on the next scan cycle. Eliminates M ps forks.
  22. #
  23. # TASKPOLICY
  24. # v20: PIDs bucketed into 3 policy strings. One `xargs -P4 taskpolicy`
  25. # call per non-empty bucket (≤3 forks, parallelized). First-cycle
  26. # burst is faster; stable cycles pay zero taskpolicy cost.
  27. #
  28. # PID CACHE
  29. # v20: PID_CACHE as ZSH associative hash → O(1) lookup. Stores both
  30. # target nice AND policy class so cache hits skip all work.
  31. #
  32. # GHOST EVICTION
  33. # v20: Fire-and-forget background subshell. Never touches the main loop.
  34. #
  35. # FORK COUNT COMPARISON (active cycle, 200 processes, 50 targets):
  36. # v20: 1 ps + 3 xargs + 5 renice = ~9 forks
  37. # v20 stable cycle (cache warm):
  38. # 1 ps + 0 taskpolicy + 0-5 renice = 1-6 forks
  39. # =============================================================================
  40.  
  41.  
  42. # =============================================================================
  43. # LEVEL 0 — Environment Flags & Self-Priority
  44. # =============================================================================
  45.  
  46. launchctl setenv MTL_HUD_ENABLED 0
  47. launchctl setenv MTL_COMPILER_LOG_LEVEL 0
  48. launchctl setenv DYLD_PRINT_WARNINGS 0
  49.  
  50. # OCLP/kext settle time — load-bearing on this hardware, do not reduce
  51. # without verifying WiFi and GPU kext init completes first.
  52. sleep 10
  53.  
  54. # Sentinel must win every priority contest
  55. renice -n -20 -p $$ >/dev/null 2>&1
  56.  
  57.  
  58. # =============================================================================
  59. # LEVEL 1 — Sysctl Injection (ONE fork total)
  60. #
  61. # `sysctl -f` reads "key=value" lines from a file. Feeding it /dev/stdin
  62. # via a ZSH heredoc collapses all 40+ sysctl calls into one fork+exec.
  63. # Unknown keys are silently ignored (2>/dev/null). Boot-arg-only tunables
  64. # (kpti, mitigations, notp, amfi) live in NVRAM and are not listed here.
  65. # =============================================================================
  66.  
  67. echo "[Sentinel] Injecting tunables..."
  68.  
  69. /usr/sbin/sysctl -f /dev/stdin >/dev/null 2>&1 << 'SYSCTL_EOF'
  70. kern.timer_coalesce_tier0_scale=1
  71. kern.timer_coalesce_tier0_ns_max=1000000
  72. kern.timer_coalesce_tier1_scale=1
  73. kern.timer_coalesce_tier1_ns_max=5000000
  74. kern.timer_coalesce_tier2_scale=4
  75. kern.timer_coalesce_tier2_ns_max=1000000000
  76. kern.timer_coalesce_tier3_scale=-5
  77. kern.timer_coalesce_tier3_ns_max=5000000000
  78. kern.timer_coalesce_tier4_ns_max=30000000000
  79. kern.timer_coalesce_tier5_ns_max=30000000000
  80. kern.timer_coalesce_bg_scale=3
  81. kern.timer_coalesce_idle_entry_hard_deadline_max=5000
  82. kern.interrupt_timer_coalescing_enabled=1
  83. kern.sched_rt_avoid_cpu0=1
  84. kern.ulock_adaptive_spin_usecs=40
  85. hw.pci.throttle_flags=0
  86. vm.compressor_eval_period_in_msecs=1000
  87. vm.compressor_sample_min_in_msecs=1000
  88. vm.vm_page_background_exclude_external=1
  89. kern.vm_pressure_level_transition_threshold=50
  90. vm.vm_page_free_target=4000
  91. vfs.generic.sync_timeout=30
  92. debug.lowpri_throttle_enabled=0
  93. kern.preheat_max_bytes=1048576
  94. kern.preheat_min_bytes=65536
  95. kern.ipc.maxsockbuf=8388608
  96. net.inet.tcp.autorcvbufmax=8388608
  97. net.inet.tcp.autosndbufmax=8388608
  98. net.inet.tcp.sendspace=524288
  99. net.inet.tcp.recvspace=524288
  100. net.inet.udp.recvspace=262144
  101. net.inet.tcp.delayed_ack=1
  102. net.inet.tcp.local_slowstart_flightsize=16
  103. net.inet.tcp.aggressive_rcvwnd_inc=1
  104. net.inet.tcp.fastopen=0
  105. net.inet.tcp.minmss=536
  106. net.link.ether.inet.max_age=1800
  107. net.inet.tcp.keepidle=600000
  108. net.inet.tcp.keepintvl=75000
  109. net.inet.tcp.blackhole=2
  110. net.inet.udp.blackhole=1
  111. kern.maxvnodes=786432
  112. kern.maxfiles=512000
  113. kern.maxfilesperproc=102400
  114. kern.ipc.somaxconn=2048
  115. kern.maxprocperuid=3750
  116. kern.sysv.shmmax=2147483648
  117. kern.sysv.shmall=524288
  118. debug.agpm.LogLevel=0
  119. debug.bpf_bufsize=65536
  120. debug.bpf_maxbufsize=1048576
  121. debug.lowpri_throttle_tier1_window_msecs=50
  122. debug.lowpri_throttle_tier2_window_msecs=100
  123. debug.lowpri_throttle_tier3_window_msecs=200
  124. SYSCTL_EOF
  125.  
  126. echo "[Sentinel] Tunables applied."
  127. sync
  128.  
  129.  
  130. # =============================================================================
  131. # LEVEL 1.5 — The Silencing
  132. # =============================================================================
  133.  
  134. /usr/bin/log config --mode "level:off"
  135. killall -9 logd 2>/dev/null
  136. killall -HUP cloudd secd 2>/dev/null
  137. echo "[Sentinel] What is the music of life? Silence, my brother."
  138.  
  139.  
  140. # =============================================================================
  141. # LEVEL 2 — Tier Definitions
  142. #
  143. # Keys are LOWERCASE substrings matched against the lowercased process
  144. # basename. First match wins. Keep keys specific enough to avoid false
  145. # matches (e.g. "mds" matches "mds_stores" — intentional here since both
  146. # are in Tier 3+; use "mds_stores" as a key if you need to split them).
  147. #
  148. # Nice → Policy class mapping:
  149. # nice >= 15 → taskpolicy background (30s coalescing)
  150. # nice >= 5 → taskpolicy utility (5s coalescing)
  151. # nice < 5 → taskpolicy default (1ms–1s coalescing)
  152. # =============================================================================
  153.  
  154. typeset -gA TARGETS=(
  155. # ── TIER 0: USER INTERACTIVE — 1ms slack ─────────────────────────────────
  156. "hidd" "-20"
  157. "windowserver" "-18"
  158. "skylight" "-18"
  159. "powerd" "-17"
  160. "thermalmonitord" "-17"
  161.  
  162. # ── TIER 1: USER INITIATED — 5ms slack ───────────────────────────────────
  163. "swish" "-18" # Gesture recognition; latency-critical
  164. "helium" "-16"
  165. "alfred" "-15"
  166. "windowmanager" "-15"
  167. "alacritty" "-14"
  168. "terminal" "-14"
  169. "dynamiclakepro" "-14"
  170. "dock" "-13"
  171. "finder" "-12"
  172. "mediaremoted" "-12"
  173. "logd" "-9"
  174. "controlcenter" "-8"
  175.  
  176. # ── TIER 2: DEFAULT — 1s slack ────────────────────────────────────────────
  177. "bluetoothd" "2"
  178. "coreaudiod" "-5"
  179. "universalcontrol" "-2"
  180. "configd" "-2"
  181. "identityservicesd" "-2"
  182. "trustd" "-2"
  183. "itunescloudd" "-2"
  184. "mds_stores" "-2"
  185. "rapportd" "1"
  186. "cloudd" "1"
  187. "sharingd" "2"
  188. "tgfanhelper" "3"
  189. "continuity" "5"
  190.  
  191. # ── TIER 3: UTILITY — 5s slack ────────────────────────────────────────────
  192. "apsd" "4"
  193. "proximityd" "5"
  194. "sidecardisplayagent" "8"
  195. "sidecarrelay" "8"
  196. "homed" "8"
  197. "mds" "10"
  198.  
  199. # ── TIER 4: BACKGROUND — 30s slack ───────────────────────────────────────
  200. "dasd" "15"
  201. "usereventagent" "15"
  202. "usagetrackingagent" "15"
  203. "symptomsd" "15"
  204. "remoted" "15"
  205. "diskimages-helper" "15"
  206. "remotemanagementd" "15"
  207. "airportd" "15"
  208. "locationd" "15"
  209. "corebrightnessd" "15"
  210. "mbproximityhelper" "17"
  211. "analyticsd" "18"
  212. "onedrive" "18"
  213. "bird" "19"
  214. "parsecd" "19"
  215.  
  216. # ── TIER 5: MAINTENANCE — 30s slack ──────────────────────────────────────
  217. "intelligenceplatformd" "20"
  218. "triald" "20"
  219. "parsec-fbf" "20"
  220. "proactive_event_tracker" "20"
  221. "biometrictalkerd" "20"
  222. "contextstoreagent" "20"
  223. "vmd" "20"
  224. "siriknowledged" "20"
  225. "syspolicyd" "20"
  226. "biomesyncd" "20"
  227. "mdbulkimport" "20"
  228. "backupd" "20"
  229. "backupd-helper" "20"
  230. "coresimulator" "20"
  231. "airplayxpchelper" "20"
  232. "mediaanalysisd" "20"
  233. "photoanalysisd" "20"
  234. "suggestd" "20"
  235. )
  236.  
  237. # PID_CACHE: associative hash for O(1) lookup.
  238. # Value format: "target_ni:policy_class" (e.g. "-18:default", "20:background")
  239. # A cache hit means: PID is known, policy is applied, nice is expected correct.
  240. # A cache miss means: new process, needs matching and policy application.
  241. typeset -gA PID_CACHE=()
  242.  
  243. # STUBBORN_NI: PIDs that failed renice (SIP-protected or kernel-owned).
  244. # Stored as hash (key=PID, value=1) for O(1) membership test.
  245. typeset -gA STUBBORN_NI=()
  246.  
  247. integer -g STABLE_COUNT=0
  248. integer -g ITERATION=0
  249. typeset -g GHOST_BUSTED=false
  250.  
  251.  
  252. # =============================================================================
  253. # LEVEL 3 — Ghost Eviction (Non-blocking background subshell)
  254. #
  255. # UID 16908544 is a phantom launchd user context that appears on some OCLP
  256. # installs. Evicting it removes a residual set of background services that
  257. # macOS wouldn't normally run on this hardware. The subshell retries every
  258. # 30s for up to 5 attempts, then gives up silently.
  259. # =============================================================================
  260.  
  261. (
  262. for attempt in {1..5}; do
  263. launchctl bootout user/16908544 >/dev/null 2>&1 && exit 0
  264. sleep 30
  265. done
  266. ) &
  267.  
  268.  
  269. # =============================================================================
  270. # LEVEL 4 — apply_sentinel_policy()
  271. #
  272. # Called every cycle. Returns 0 if any work was done, 1 if system is stable.
  273. # =============================================================================
  274.  
  275. apply_sentinel_policy() {
  276. local work_done=false
  277.  
  278. # ── Step 1: ONE ps fork to capture the full process table ─────────────────
  279. local ps_raw
  280. ps_raw=$(ps -ax -o pid= -o ni= -o comm= 2>/dev/null)
  281.  
  282. # ── Step 2: Build PID maps in pure ZSH — zero additional forks ────────────
  283. typeset -A pid_ni # pid_ni[PID] = current nice value string
  284. typeset -A pid_bn # pid_bn[PID] = lowercase basename of comm
  285. local pid ni comm bn
  286.  
  287. while IFS=' ' read -r pid ni comm; do
  288. [[ -z $pid ]] && continue
  289. (( pid == $$ || pid < 100 )) && continue
  290.  
  291. # ZSH-native basename + lowercase in one expression
  292. # ${comm##*/} strips path prefix; :l lowercases — no fork
  293. bn=${${comm##*/}:l}
  294.  
  295. # Skip XPC proxy noise — these inherit parent policy already
  296. [[ $bn == xpcproxy || $bn == com.apple.appkit* ]] && continue
  297.  
  298. pid_ni[$pid]="${ni// /}" # strip whitespace, store clean nice value
  299. pid_bn[$pid]="$bn"
  300. done <<< "$ps_raw"
  301.  
  302. # ── Step 3: Match, diff, and bucket — pure ZSH ────────────────────────────
  303. typeset -A ni_bucket # ni_bucket[nice_value] = "pid1 pid2 ..."
  304. local tp_bg="" tp_util="" tp_default=""
  305. local target_ni policy_class cached expected k
  306.  
  307. for pid in ${(k)pid_ni}; do
  308. cached="${PID_CACHE[$pid]}"
  309. bn="$pid_bn[$pid]"
  310. target_ni=""
  311.  
  312. if [[ -n $cached ]]; then
  313. # ── Cache hit: PID is known ──────────────────────────────────────
  314. target_ni="${cached%%:*}"
  315.  
  316. # Check for nice drift (macOS can reset nice after certain events)
  317. if [[ "${pid_ni[$pid]}" == "$target_ni" ]]; then
  318. continue # All good — skip this PID entirely
  319. fi
  320.  
  321. # Nice has drifted — requeue for renice, but skip taskpolicy
  322. # (policy class is still correct from initial application)
  323. if [[ -z "${STUBBORN_NI[$pid]}" ]]; then
  324. ni_bucket[$target_ni]+="$pid "
  325. work_done=true
  326. fi
  327. continue
  328. fi
  329.  
  330. # ── Cache miss: new process — run target matching ────────────────────
  331. for k in ${(k)TARGETS}; do
  332. if [[ $bn == *$k* ]]; then
  333. target_ni="${TARGETS[$k]}"
  334. break
  335. fi
  336. done
  337. [[ -z $target_ni ]] && continue # Not a managed process; ignore
  338.  
  339. # Determine policy class from nice value (pure ZSH arithmetic)
  340. if (( target_ni >= 15 )); then policy_class="background"
  341. elif (( target_ni >= 5 )); then policy_class="utility"
  342. else policy_class="default"
  343. fi
  344.  
  345. # Store in cache immediately — even if renice fails, we know the intent
  346. PID_CACHE[$pid]="${target_ni}:${policy_class}"
  347.  
  348. # Queue for renice if needed
  349. if [[ "${pid_ni[$pid]}" != "$target_ni" ]] && [[ -z "${STUBBORN_NI[$pid]}" ]]; then
  350. ni_bucket[$target_ni]+="$pid "
  351. fi
  352.  
  353. # Queue for taskpolicy (always on first encounter)
  354. case $policy_class in
  355. background) tp_bg+="$pid " ;;
  356. utility) tp_util+="$pid " ;;
  357. default) tp_default+="$pid " ;;
  358. esac
  359.  
  360. work_done=true
  361. done
  362.  
  363. # ── Step 4: Batch renice — one call per active tier (≤5 forks) ────────────
  364. # We call renice with all PIDs for a given nice value at once.
  365. # If renice fails for a specific PID, it exits non-zero but continues
  366. # for other PIDs. On the NEXT cycle, if that PID's nice is still wrong,
  367. # it will be re-queued. After a few cycles of failure, we can mark it
  368. # stubborn, but in practice SIP-protected processes simply don't appear
  369. # at wrong nice values since macOS won't let us set them anyway.
  370. local pids_arr
  371. for tier in ${(k)ni_bucket}; do
  372. pids_arr=(${(z)ni_bucket[$tier]})
  373. if renice -n $tier -p $pids_arr >/dev/null 2>&1; then
  374. : # Success — cache already has the right target
  375. else
  376. # Some PIDs in this tier may be SIP-protected.
  377. # Mark the entire batch as potentially stubborn; they'll be
  378. # re-evaluated next cycle and either succeed or stay stubborn.
  379. # We don't fork a verification ps here — that's the v19 approach.
  380. : # Failures will surface naturally on the next scan.
  381. fi
  382. done
  383.  
  384. # ── Step 5: Batch taskpolicy — ≤3 xargs forks, parallelized ──────────────
  385. # xargs -P4 runs up to 4 taskpolicy processes in parallel, reducing
  386. # wall-clock time on the first boot cycle when all processes need
  387. # initial policy assignment (typically 50-80 PIDs).
  388. # On stable cycles tp_bg/util/default are all empty → zero forks.
  389. [[ -n $tp_bg ]] && print -l ${(z)tp_bg} | xargs -P4 -I{} /usr/bin/taskpolicy -c background -p {} >/dev/null 2>&1
  390. [[ -n $tp_util ]] && print -l ${(z)tp_util} | xargs -P4 -I{} /usr/bin/taskpolicy -c utility -p {} >/dev/null 2>&1
  391. [[ -n $tp_default ]] && print -l ${(z)tp_default} | xargs -P4 -I{} /usr/bin/taskpolicy -c default -p {} >/dev/null 2>&1
  392.  
  393. # ── Step 6: Prune dead PIDs from cache — pure ZSH, zero forks ────────────
  394. # Any PID in cache not present in pid_ni has exited. Remove it so the
  395. # cache doesn't grow unboundedly and so reused PIDs start fresh.
  396. for pid in ${(k)PID_CACHE}; do
  397. if [[ -z "${pid_ni[$pid]}" ]]; then
  398. unset "PID_CACHE[$pid]"
  399. unset "STUBBORN_NI[$pid]"
  400. fi
  401. done
  402.  
  403. [[ $work_done == true ]] && return 0 || return 1
  404. }
  405.  
  406.  
  407. # =============================================================================
  408. # LEVEL 5 — Main Loop
  409. #
  410. # Adaptive sleep: 15s when work was done (system changing), 90s when stable.
  411. # Cache flush every ~2.5 hours of stability: clears STUBBORN_NI so
  412. # previously-failing PIDs get retried, and clears PID_CACHE so processes
  413. # that changed their comm (rare but possible) get re-matched.
  414. # =============================================================================
  415.  
  416. echo "[Sentinel] Entering main loop. Iteration 0."
  417.  
  418. while true; do
  419.  
  420. if apply_sentinel_policy; then
  421. STABLE_COUNT=0
  422. sleep 15
  423. else
  424. (( STABLE_COUNT++ ))
  425. sleep 90
  426. fi
  427.  
  428. # Cache flush at 100 stable cycles ≈ 2.5 hours
  429. if (( STABLE_COUNT > 100 )); then
  430. PID_CACHE=()
  431. STUBBORN_NI=()
  432. STABLE_COUNT=0
  433. echo "[Sentinel] Cache flushed at iteration ${ITERATION}."
  434. fi
  435.  
  436. (( ITERATION++ ))
  437. done
  438.  
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Ovtisfi
    23 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • User was banned
  • User was banned
  • Rhowikmy
    19 hours
    # CSS 0.45 KB | 0 0
    1. ⭐ Changelly Profit Exploit Documentation ⭐
    2.  
    3. https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=tddnbefhyt
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment