bonktools 3.0.0 → 3.1.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/bonk_fullchain.pem +36 -35
- package/package.json +1 -1
- package/scripts/download-cert.js +22 -91
package/bonk_fullchain.pem
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
2
|
+
MIIGcTCCBNmgAwIBAgIQBCOxRTvzzdaopUgt3SZ4TzANBgkqhkiG9w0BAQsFADBg
|
|
3
|
+
MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTcwNQYDVQQD
|
|
4
|
+
Ey5TZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gQ0EgRFYgUjM2
|
|
5
|
+
MB4XDTI1MDczMTAwMDAwMFoXDTI2MDgzMTIzNTk1OVowFDESMBAGA1UEAwwJKi5i
|
|
6
|
+
b25rLmlvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1KDYTKGMqzdN
|
|
7
|
+
u0GgjzTFnH5jRxZ9Bkifo0DiD85aGtqO8Q7v9gSe1IFzB0wMUOA4iC1L9ojpoa+9
|
|
8
|
+
T01uepYOHKFV0uz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+
-----END CERTIFICATE-----
|
package/package.json
CHANGED
package/scripts/download-cert.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* This
|
|
3
|
+
* Extract certificate chain directly from bonk.io server
|
|
4
|
+
* This avoids curl, HTTP downloads, proxies, and firewall blocks
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const { execSync } = require('child_process');
|
|
@@ -9,111 +9,42 @@ const fs = require('fs');
|
|
|
9
9
|
const path = require('path');
|
|
10
10
|
|
|
11
11
|
const OUTPUT_FILE = path.join(__dirname, '..', 'bonk_fullchain.pem');
|
|
12
|
-
const
|
|
12
|
+
const BONK_HOST = 'b2ny1.bonk.io';
|
|
13
|
+
const BONK_PORT = 443;
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
function downloadIntermediateCert() {
|
|
18
|
-
try {
|
|
19
|
-
console.log('Downloading intermediate certificate from Sectigo...');
|
|
20
|
-
|
|
21
|
-
// Use HTTP (not HTTPS) to avoid certificate issues
|
|
22
|
-
const intermediateUrl = 'http://crt.sectigo.com/SectigoPublicServerAuthenticationCADVR36.crt';
|
|
23
|
-
|
|
24
|
-
// Download and convert DER to PEM
|
|
25
|
-
const command = `curl -s "${intermediateUrl}" | openssl x509 -inform DER -outform PEM`;
|
|
26
|
-
|
|
27
|
-
const intermediatePem = execSync(command, {
|
|
28
|
-
encoding: 'utf8',
|
|
29
|
-
maxBuffer: 10 * 1024 * 1024
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
if (!intermediatePem || !intermediatePem.includes('BEGIN CERTIFICATE')) {
|
|
33
|
-
throw new Error('Failed to download intermediate certificate');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return intermediatePem;
|
|
37
|
-
} catch (error) {
|
|
38
|
-
console.warn('Warning: Could not download intermediate certificate:', error.message);
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
15
|
+
function main() {
|
|
16
|
+
console.log('Extracting certificate chain directly from bonk.io server...');
|
|
42
17
|
|
|
43
|
-
/**
|
|
44
|
-
* Download root certificate
|
|
45
|
-
*/
|
|
46
|
-
function downloadRootCert() {
|
|
47
18
|
try {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const rootUrl = 'http://crt.usertrust.com/USERTrustRSACertificationAuthority.crt';
|
|
19
|
+
// Windows não suporta < /dev/null
|
|
20
|
+
// Usamos echo. para encerrar a conexão corretamente
|
|
21
|
+
const cmd = `echo.|openssl s_client -showcerts -connect ${BONK_HOST}:${BONK_PORT}`;
|
|
52
22
|
|
|
53
|
-
|
|
54
|
-
const command = `curl -s "${rootUrl}" | openssl x509 -inform DER -outform PEM`;
|
|
55
|
-
|
|
56
|
-
const rootPem = execSync(command, {
|
|
23
|
+
const output = execSync(cmd, {
|
|
57
24
|
encoding: 'utf8',
|
|
58
|
-
maxBuffer:
|
|
25
|
+
maxBuffer: 20 * 1024 * 1024
|
|
59
26
|
});
|
|
60
27
|
|
|
61
|
-
|
|
62
|
-
throw new Error('Failed to download root certificate');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return rootPem;
|
|
66
|
-
} catch (error) {
|
|
67
|
-
console.warn('Warning: Could not download root certificate:', error.message);
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Main function to download and save certificate chain
|
|
74
|
-
*/
|
|
75
|
-
function main() {
|
|
76
|
-
console.log('Building Sectigo certificate chain for bonk.io...');
|
|
77
|
-
|
|
78
|
-
try {
|
|
79
|
-
const certs = [];
|
|
80
|
-
let certCount = 0;
|
|
81
|
-
|
|
82
|
-
// Download intermediate certificate
|
|
83
|
-
const intermediate = downloadIntermediateCert();
|
|
84
|
-
if (intermediate) {
|
|
85
|
-
certs.push(intermediate);
|
|
86
|
-
certCount++;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Download root certificate
|
|
90
|
-
const root = downloadRootCert();
|
|
91
|
-
if (root) {
|
|
92
|
-
certs.push(root);
|
|
93
|
-
certCount++;
|
|
94
|
-
}
|
|
28
|
+
const certs = output.match(/-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/g);
|
|
95
29
|
|
|
96
|
-
if (certs.length === 0) {
|
|
97
|
-
throw new Error('
|
|
30
|
+
if (!certs || certs.length === 0) {
|
|
31
|
+
throw new Error('No certificates found in server response');
|
|
98
32
|
}
|
|
99
33
|
|
|
100
|
-
|
|
101
|
-
const fullChain = certs.join('\n');
|
|
34
|
+
const uniqueCerts = [...new Set(certs)];
|
|
102
35
|
|
|
103
|
-
|
|
104
|
-
fs.writeFileSync(OUTPUT_FILE, fullChain, 'utf8');
|
|
36
|
+
fs.writeFileSync(OUTPUT_FILE, uniqueCerts.join('\n\n'), 'utf8');
|
|
105
37
|
|
|
106
|
-
console.log(`✓
|
|
107
|
-
console.log(`✓
|
|
108
|
-
console.log('✓
|
|
109
|
-
} catch (
|
|
110
|
-
console.error('
|
|
111
|
-
console.error('\nNote: This script requires curl and openssl to be installed on your system.');
|
|
38
|
+
console.log(`✓ Extracted ${uniqueCerts.length} certificate(s)`);
|
|
39
|
+
console.log(`✓ Full chain saved to: ${OUTPUT_FILE}`);
|
|
40
|
+
console.log('✓ Chain captured directly from the server 🔥');
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.error('Failed to extract certificates:', err.message);
|
|
112
43
|
process.exit(1);
|
|
113
44
|
}
|
|
114
45
|
}
|
|
115
46
|
|
|
116
|
-
|
|
47
|
+
|
|
117
48
|
if (require.main === module) {
|
|
118
49
|
main();
|
|
119
50
|
}
|