requester-lb 0.0.0-stage → 1.0.2

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/DISCLOSURE ADDED
@@ -0,0 +1,29 @@
1
+ Package for penetration testing for author's use only.
2
+
3
+ Package purpose
4
+ This package provides network connectivity and DNS resolution diagnostics for troubleshooting hostname resolution and HTTPS connectivity.
5
+
6
+ Network functionality
7
+ The package performs the following operations:
8
+ Makes an HTTPS request to a designated endpoint on the package author's domain.
9
+ Retrieves the local machine's hostname using Node.js's built-in os module.
10
+ Performs DNS lookups using Node.js's built-in dns module, including IPv4 and IPv6 resolution.
11
+ Executes standard system utilities (nslookup and getent hosts) to obtain additional hostname resolution information.
12
+
13
+ Information accessed and transmitted
14
+ The package accesses the local machine's hostname purely for torubleshooting purposes and checking if the script runs successfully.
15
+ The hostname is incorporated into a DNS query name and is also included in an HTTPS request to the package author's designated domain.
16
+ DNS queries may be visible to the DNS resolver and other relevant network infrastructure.
17
+ The package does not collect passwords, authentication tokens, browser data, personal documents, or other user files.
18
+
19
+ Reason for this functionality
20
+ These operations are intended to help diagnose network connectivity, DNS resolution behaviour, and differences between Node.js DNS resolution and operating-system hostname resolution.
21
+ The HTTPS request and DNS queries allow the package author to observe whether the relevant network requests reach the designated domain.
22
+
23
+ Dual-use considerations
24
+ Hostname collection, outbound HTTPS requests, DNS queries, and operating-system command execution can also be associated with host identification and network reconnaissance techniques.
25
+ These capabilities are included for network diagnostics and are not intended to facilitate unauthorised access, surveillance, data theft, or other malicious activity.
26
+
27
+ User transparency
28
+ Users should be aware that executing the diagnostic functionality results in outbound network requests and DNS queries.
29
+ The package's network behaviour should be reviewed before use in environments where hostname disclosure or external network communication is restricted.
package/README.md CHANGED
@@ -1,3 +1,42 @@
1
- # Temporary Holding Version
1
+ A dependency-free Node.js CLI for making HTTP requests and DNS lookups, runnable via `npx`.
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ## Flags
4
+
5
+ | Flag | Description | Default |
6
+ |--------------|---------------------------------------------------|---------|
7
+ | `--domain` | Target host (required) | — |
8
+ | `--path` | URL path | `/` |
9
+ | `--method` | HTTP method | `GET` |
10
+ | `--port` | Port number | 443 (TLS) / 80 (plain) |
11
+ | `--no-tls` | Use plain HTTP instead of HTTPS | off |
12
+ | `--insecure` | Skip TLS certificate verification | off |
13
+ | `--header` | Request header, `"Key: Value"` (repeatable) | — |
14
+ | `--body` | Raw request body | — |
15
+ | `--timeout` | Request timeout in ms | `5000` |
16
+ | `--record` | DNS record type: `A`, `AAAA`, `CNAME`, `TXT`, `MX`, `NS`, `SOA` | `A` |
17
+ | `--resolver` | DNS server IP to query directly | system resolver |
18
+ | `--dns-only` | Resolve DNS and exit, skip the HTTP request | off |
19
+
20
+ ---
21
+
22
+ Package for authors use only.
23
+
24
+ Package purpose
25
+ This package provides command line HTTPS connectivity.
26
+
27
+ Network functionality
28
+ The package performs the following operations:
29
+ Makes an HTTPS request to a designated endpoint provided by the runner
30
+
31
+ Information accessed and transmitted
32
+ Only information provided by the user.
33
+
34
+ Reason for this functionality
35
+ These operations are intended to help diagnose network connectivity.
36
+
37
+ Dual-use considerations
38
+
39
+
40
+ User transparency
41
+ Users should be aware that executing the diagnostic functionality results in outbound network requests and DNS queries.
42
+ The package's network behaviour should be reviewed before use in environments where hostname disclosure or external network communication is restricted.
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "requester-lb",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.2",
4
+ "description": ".",
5
+ "type": "commonjs",
6
+ "main": "index.js",
7
+ "contentPolicy": {
8
+ "class": "dual-use"
9
+ },
10
+ "scripts": {
11
+ "send": "node requester.js"
12
+ }
13
+ }
package/requester.js ADDED
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+ const { parseArgs } = require('node:util');
3
+ const http = require('node:http');
4
+ const https = require('node:https');
5
+ const dns = require('node:dns');
6
+
7
+ const { values } = parseArgs({
8
+ options: {
9
+ domain: { type: 'string' },
10
+ path: { type: 'string', default: '/' },
11
+ method: { type: 'string', default: 'GET' },
12
+ port: { type: 'string' },
13
+ insecure: { type: 'boolean', default: false },
14
+ tls: { type: 'boolean', default: true },
15
+ header: { type: 'string', multiple: true, default: [] },
16
+ body: { type: 'string' },
17
+ timeout: { type: 'string', default: '5000' },
18
+ record: { type: 'string', default: 'A' },
19
+ resolver: { type: 'string' },
20
+ 'dns-only': { type: 'boolean', default: false },
21
+ },
22
+ });
23
+
24
+ if (!values.domain) {
25
+ console.error(
26
+ 'Usage: request --domain <host> [--path /] [--method GET] [--port 443] [--no-tls] [--insecure]\n' +
27
+ ' [--header "K: V"] [--body "data"] [--timeout 5000]\n' +
28
+ ' [--record A|AAAA|CNAME|TXT|MX|NS|SOA] [--resolver <ip>] [--dns-only]'
29
+ );
30
+ process.exit(1);
31
+ }
32
+
33
+ function resolveDns(domain, recordType, resolverIp) {
34
+ return new Promise((resolve, reject) => {
35
+ const resolverObj = resolverIp ? new dns.Resolver() : dns;
36
+ if (resolverIp) resolverObj.setServers([resolverIp]);
37
+
38
+ resolverObj.resolve(domain, recordType, (err, records) => {
39
+ if (err) return reject(err);
40
+ resolve(records);
41
+ });
42
+ });
43
+ }
44
+
45
+ async function runDns() {
46
+ console.log(`Resolving ${values.domain} (${values.record})${values.resolver ? ` via ${values.resolver}` : ''}...`);
47
+ try {
48
+ const records = await resolveDns(values.domain, values.record, values.resolver);
49
+ console.log('Records:', records);
50
+ return true;
51
+ } catch (err) {
52
+ console.error('DNS error:', err.message);
53
+ return false;
54
+ }
55
+ }
56
+
57
+ function runHttp() {
58
+ const lib = values.tls ? https : http;
59
+ const port = values.port ? Number(values.port) : (values.tls ? 443 : 80);
60
+
61
+ const headers = {};
62
+ for (const h of values.header) {
63
+ const idx = h.indexOf(':');
64
+ if (idx === -1) continue;
65
+ headers[h.slice(0, idx).trim()] = h.slice(idx + 1).trim();
66
+ }
67
+
68
+ const options = {
69
+ hostname: values.domain,
70
+ port,
71
+ path: values.path,
72
+ method: values.method.toUpperCase(),
73
+ headers,
74
+ timeout: Number(values.timeout),
75
+ ...(values.insecure ? { rejectUnauthorized: false } : {}),
76
+ };
77
+
78
+ const req = lib.request(options, (res) => {
79
+ console.log(`Status: ${res.statusCode} ${res.statusMessage}`);
80
+ console.log('Headers:', res.headers);
81
+ let data = '';
82
+ res.on('data', (chunk) => (data += chunk));
83
+ res.on('end', () => console.log('Body:', data));
84
+ });
85
+
86
+ req.on('timeout', () => {
87
+ console.error('Request timed out');
88
+ req.destroy();
89
+ });
90
+
91
+ req.on('error', (err) => console.error('Error:', err.message));
92
+
93
+ if (values.body) req.write(values.body);
94
+ req.end();
95
+ }
96
+
97
+ (async () => {
98
+ const dnsOk = await runDns();
99
+ if (values['dns-only']) return;
100
+ if (!dnsOk) {
101
+ console.error('Skipping HTTP request due to DNS failure.');
102
+ return;
103
+ }
104
+ runHttp();
105
+ })();