@testcarrot/supply 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.
- package/package.json +13 -0
- package/poc_script.js +39 -0
package/package.json
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"name": "@testcarrot/supply",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
8
|
+
"postinstall": "node poc_script.js"
|
9
|
+
},
|
10
|
+
"keywords": [],
|
11
|
+
"author": "",
|
12
|
+
"license": "ISC"
|
13
|
+
}
|
package/poc_script.js
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
const fs = require('fs');
|
2
|
+
const http = require('http');
|
3
|
+
|
4
|
+
console.log('[+] POC Script: postinstall script has been triggered.');
|
5
|
+
|
6
|
+
// 1. 내부 파일 생성 시뮬레이션
|
7
|
+
const fileName = 'internal_poc_test.txt';
|
8
|
+
const fileContent = `This file was created by the NPM PoC script at ${new Date().toISOString()}`;
|
9
|
+
|
10
|
+
try {
|
11
|
+
fs.writeFileSync(fileName, fileContent);
|
12
|
+
console.log(`[+] POC Success: Successfully created the test file -> ${fileName}`);
|
13
|
+
} catch (error) {
|
14
|
+
console.error(`[-] POC Error: Failed to create file. Error: ${error.message}`);
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
// 2. 외부 통신 시뮬레이션 (PING 대체)
|
19
|
+
// 중요: 실제 외부 서버가 아닌, 통제 가능한 내부 테스트 서버 주소를 사용해야 합니다.
|
20
|
+
// 또는 보안 장비가 탐지할 수 있는 알려진 Public DNS 같은 곳으로 요청을 보내 테스트할 수 있습니다.
|
21
|
+
const options = {
|
22
|
+
hostname: '8.8.8.8', // 예: Google Public DNS (보안 장비의 DNS 쿼리 로깅/차단 테스트용)
|
23
|
+
port: 53, // DNS 포트
|
24
|
+
path: '/',
|
25
|
+
method: 'GET'
|
26
|
+
};
|
27
|
+
|
28
|
+
console.log(`[+] POC Script: Simulating external network connection to ${options.hostname}...`);
|
29
|
+
|
30
|
+
const req = http.request(options, (res) => {
|
31
|
+
console.log(`[+] POC Success: Network request finished with status code: ${res.statusCode}`);
|
32
|
+
});
|
33
|
+
|
34
|
+
req.on('error', (error) => {
|
35
|
+
// 방화벽 등에 의해 차단되면 이 에러가 발생할 수 있습니다.
|
36
|
+
console.error(`[-] POC Error: Network request failed. It might be blocked by a firewall. Error: ${error.message}`);
|
37
|
+
});
|
38
|
+
|
39
|
+
req.end();
|