thnoxs-crack 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/cookies.json +11 -0
  2. package/index.js +188 -0
  3. package/package.json +19 -0
package/cookies.json ADDED
@@ -0,0 +1,11 @@
1
+ [
2
+ {
3
+ "name": "wordpress_logged_in_533284b5b3b4d51be8be729f3cd64864",
4
+ "value": "ankit%20jaiswal%7C1776177666%7C1yTduBbvOA30abSbmj2tVcP17FftroIV9UpGNoA0VmD%7C46158281d6a3dbe8680f738b44e9de5dd2c82ea085754accb14811f956a91528",
5
+ "domain": "macked.app",
6
+ "path": "/",
7
+ "expires": 1776177666,
8
+ "httpOnly": true,
9
+ "secure": true
10
+ }
11
+ ]
package/index.js ADDED
@@ -0,0 +1,188 @@
1
+ #!/usr/bin/env node
2
+
3
+ import puppeteer from "puppeteer-core";
4
+ import { program } from "commander";
5
+ import fs from "fs";
6
+ import path from "path";
7
+ import os from "os";
8
+ import readline from "readline";
9
+
10
+ // Helper: Get Download Location from User
11
+ const askDownloadLocation = () => {
12
+ const rl = readline.createInterface({
13
+ input: process.stdin,
14
+ output: process.stdout,
15
+ });
16
+
17
+ console.log("\nWhere do you want to save the downloaded file?");
18
+ console.log("1. Current Directory");
19
+ console.log("2. Desktop");
20
+ console.log("3. Downloads folder");
21
+ console.log("4. Documents folder");
22
+
23
+ return new Promise((resolve) => {
24
+ rl.question("\nEnter choice (1-4): ", (answer) => {
25
+ rl.close();
26
+ let downloadPath = process.cwd(); // Default to current directory
27
+ const homeDir = os.homedir();
28
+
29
+ switch (answer.trim()) {
30
+ case "1":
31
+ downloadPath = process.cwd();
32
+ break;
33
+ case "2":
34
+ downloadPath = path.join(homeDir, "Desktop");
35
+ break;
36
+ case "3":
37
+ downloadPath = path.join(homeDir, "Downloads");
38
+ break;
39
+ case "4":
40
+ downloadPath = path.join(homeDir, "Documents");
41
+ break;
42
+ default:
43
+ console.log("Invalid choice, defaulting to Current Directory.");
44
+ downloadPath = process.cwd();
45
+ }
46
+ resolve(downloadPath);
47
+ });
48
+ });
49
+ };
50
+
51
+ // Helper: Get Chrome Path based on OS
52
+ const getChromePath = () => {
53
+ const platform = os.platform();
54
+ if (platform === "darwin") {
55
+ return "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
56
+ } else if (platform === "win32") {
57
+ return "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
58
+ } else if (platform === "linux") {
59
+ return "/usr/bin/google-chrome";
60
+ }
61
+ return ""; // Fallback
62
+ };
63
+
64
+ program
65
+ .command("install <app_name>")
66
+ .description("Search and download Mac cracked apps")
67
+ .action(async (appName) => {
68
+ await fetchAndDownload(appName);
69
+ });
70
+
71
+ program.parse(process.argv);
72
+
73
+ async function fetchAndDownload(appName) {
74
+ // Check for cookies in the directory where command is run
75
+ const cookiePath = path.resolve(process.cwd(), "cookies.json");
76
+
77
+ if (!fs.existsSync(cookiePath)) {
78
+ console.log("Error: cookies.json file not found in the current directory.");
79
+ console.log(
80
+ "Please make sure you have your cookies exported here to access download links.",
81
+ );
82
+ return;
83
+ }
84
+
85
+ const cookies = JSON.parse(fs.readFileSync(cookiePath, "utf-8"));
86
+
87
+ // Ask user where to save the file
88
+ const downloadDir = await askDownloadLocation();
89
+ console.log(`\nSelected Download Path: ${downloadDir}\n`);
90
+
91
+ let browser;
92
+
93
+ console.log(`Searching for "${appName}" on Macked...`);
94
+
95
+ try {
96
+ const chromePath = getChromePath();
97
+ if (!fs.existsSync(chromePath)) {
98
+ console.log("Error: Google Chrome not found at default location.");
99
+ console.log(`Expected path: ${chromePath}`);
100
+ return;
101
+ }
102
+
103
+ browser = await puppeteer.launch({
104
+ headless: "new",
105
+ executablePath: chromePath,
106
+ args: ["--no-sandbox", "--disable-setuid-sandbox"],
107
+ });
108
+
109
+ const page = await browser.newPage();
110
+ await page.setCookie(...cookies);
111
+ await page.setUserAgent(
112
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
113
+ );
114
+
115
+ // Route downloads to chosen directory
116
+ const client = await page.target().createCDPSession();
117
+ await client.send("Page.setDownloadBehavior", {
118
+ behavior: "allow",
119
+ downloadPath: downloadDir,
120
+ });
121
+
122
+ // Step 1: Search
123
+ const searchUrl = `https://macked.app/?s=${encodeURIComponent(appName)}&type=post`;
124
+ await page.goto(searchUrl, { waitUntil: "networkidle2" });
125
+
126
+ // Step 2: Extract Post URL
127
+ const postUrl = await page.evaluate((searchName) => {
128
+ const cards = Array.from(document.querySelectorAll(".posts-item"));
129
+ for (const card of cards) {
130
+ const titleEl = card.querySelector(".item-thumbnail img");
131
+ const linkEl = card.querySelector(".item-thumbnail a");
132
+ if (
133
+ titleEl &&
134
+ linkEl &&
135
+ titleEl.alt.toLowerCase().includes(searchName.toLowerCase())
136
+ ) {
137
+ return linkEl.href;
138
+ }
139
+ }
140
+ return null;
141
+ }, appName);
142
+
143
+ if (!postUrl) {
144
+ console.log(`Target App "${appName}" not found on Macked.`);
145
+ await browser.close();
146
+ return;
147
+ }
148
+
149
+ console.log(`Target Post Found: ${postUrl}`);
150
+ console.log(`Bypassing security to extract direct download link...`);
151
+
152
+ // Step 3: Get Download Link
153
+ await page.goto(postUrl, { waitUntil: "networkidle2" });
154
+
155
+ const downloadLink = await page.evaluate(() => {
156
+ const a = document.querySelector('a[href*="/dl/"]');
157
+ return a ? a.href : null;
158
+ });
159
+
160
+ if (!downloadLink) {
161
+ console.log(
162
+ `Error: Direct download link missing. Your cookies might be expired.`,
163
+ );
164
+ await browser.close();
165
+ return;
166
+ }
167
+
168
+ console.log(`Download Link Extracted: ${downloadLink}`);
169
+ console.log(`Starting background download to: ${downloadDir}`);
170
+ console.log(
171
+ `Please wait... (This may take some time depending on file size)`,
172
+ );
173
+
174
+ // Trigger Download
175
+ await page.goto(downloadLink, { waitUntil: "domcontentloaded" });
176
+
177
+ // Simple wait mechanism for download to process (can be adjusted)
178
+ await new Promise((resolve) => setTimeout(resolve, 15000));
179
+
180
+ console.log(
181
+ `\nDownload trigger complete. Check your folder: ${downloadDir}`,
182
+ );
183
+ } catch (error) {
184
+ console.log(`System Error: ${error.message}`);
185
+ } finally {
186
+ if (browser) await browser.close();
187
+ }
188
+ }
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "thnoxs-crack",
3
+ "version": "1.0.0",
4
+ "description": "CLI to search and download Mac cracked apps",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "thnoxs": "./index.js"
9
+ },
10
+ "scripts": {
11
+ "test": "echo \"Error: no test specified\" && exit 1"
12
+ },
13
+ "author": "Ankit Jaiswal",
14
+ "license": "ISC",
15
+ "dependencies": {
16
+ "commander": "^14.0.3",
17
+ "puppeteer-core": "^24.40.0"
18
+ }
19
+ }