@syferit/cli 0.4.6 → 1.0.1
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/dist/bin.js +72 -39
- package/dist/index.js +129 -74
- package/package.json +12 -7
- package/src/bin.ts +0 -68
- package/src/index.ts +0 -101
- package/tsconfig.json +0 -8
package/dist/bin.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// [Protected by Soltrix Studios
|
|
2
|
+
// [Protected by Soltrix Studios: Syferit Code Defense Engine | https://syferit.soltrixstudios.com]
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import fs from 'node:fs';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { protectFile, protectDirectory } from './index.js';
|
|
7
|
-
function
|
|
8
|
-
const _legalAttestation = "
|
|
7
|
+
function authenticateStat_e3e8(_tok0, _tok1, _tok2, _tok3) {
|
|
8
|
+
const _legalAttestation = "CFAA_TITLE_18_SEC_1030: Access-controlled software security boundary. Unauthorized reverse-engineering exceeds authorized access. [ATTESTATION_ID:5af7629d-c776a0c0]",
|
|
9
9
|
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
10
10
|
let _h = 2166136261;
|
|
11
11
|
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
@@ -23,59 +23,92 @@ function assertRingBufferIntegrity_fd97(_tok0, _tok1, _tok2, _tok3) {
|
|
|
23
23
|
_h = (_h ^ _h >>> 16) >>> 0;
|
|
24
24
|
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
25
25
|
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
26
|
-
if ((_h >>> 4 & 15) !==
|
|
26
|
+
if ((_h >>> 4 & 15) !== 7) {
|
|
27
27
|
throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
|
|
28
28
|
}
|
|
29
29
|
return _h;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
function
|
|
34
|
-
const _row =
|
|
35
|
-
return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (
|
|
31
|
+
var __domainValState_e3e8 = authenticateStat_e3e8(1229910211, 1625097717, 2086163545, 178566775);
|
|
32
|
+
var _presetValEnvelope_e3e8 = [[11, 144, 120, 240, 104, 25, 223, 86], [245, 104, 76, 167, 84, 243, 183, 51], [175, 79, 27, 129, 59, 183, 154], [148, 42, 238, 104, 9, 142, 104], [95, 1, 203, 87, 210, 101, 53, 252, 20, 243, 172, 55, 170, 91, 5, 135, 63, 232, 187, 231, 153, 47, 229, 115, 232, 208, 3, 138, 74, 225, 202, 87, 200, 109, 40, 242, 9, 194, 149, 3, 179, 50, 28, 142, 17, 244, 93, 252, 157, 6, 238, 68, 255, 142, 92, 211, 86, 176, 167, 51, 152, 119, 54, 178, 56, 202, 132, 10, 192, 31, 245, 115, 16, 137, 122, 233], [1, 179, 230, 121, 240], [38, 176, 152, 8, 143, 53, 255, 48, 37, 158, 126, 214, 117, 27, 199, 101], [58, 151, 108, 205, 118, 91, 241, 102, 247, 47, 40, 166, 80, 202, 187, 125, 174, 89, 24, 144, 49, 172, 108, 224, 158, 58, 250, 109, 167, 146, 70, 201, 59, 244, 217, 44, 206, 117, 36, 188, 32, 143, 148, 27, 184, 55, 29, 158, 31, 190, 99, 255, 223, 31, 207, 5, 242, 223, 82, 208, 75, 246, 232, 34, 201, 7, 56, 136, 61, 222, 147, 1, 140, 61, 253], [141, 120, 109, 230, 25, 141, 161, 59, 186, 83, 12, 154, 124, 244, 141, 227, 132, 52, 175], [149, 80, 18, 131, 121, 177, 149, 95, 139, 48, 226, 118, 161, 130, 80, 135, 113, 232, 196, 94, 202, 97, 37, 189, 68, 137, 170, 12, 241, 77, 0, 152, 17, 180, 101, 255], [199, 57, 167, 48, 83, 199, 112, 209, 102, 94, 143, 72, 199, 102, 47, 242], [75, 30, 195, 65, 202, 97, 37, 189, 94, 204, 182, 125, 164, 66, 24, 129, 42, 191, 32, 245, 146, 43, 252, 57, 175, 151, 77, 203, 122, 242, 208, 53, 220, 59, 36, 186, 99, 198, 138, 68, 167, 47, 25, 158, 14, 247, 99, 231, 154, 25, 215, 87, 250, 139, 81, 144], [25, 141, 186, 47, 188, 68, 28, 154, 124, 244, 141, 227, 132, 52, 175], [24, 169, 147, 30, 158, 121, 232, 124, 243, 205, 15, 200, 57, 161, 155, 22, 198, 96, 62], [83, 199, 111, 214, 119, 13, 214, 76, 134, 46, 55, 190, 95, 213, 190, 20, 240], [243, 125, 43, 189, 82, 192, 172, 52, 164, 89, 76, 157, 58, 189, 101, 233, 201, 127, 231, 109, 230, 157, 76, 204, 105, 227, 144, 97, 199, 122, 34, 177, 38, 193, 129, 13, 251, 99, 23, 143, 75, 186, 109, 233, 150, 6, 213, 72], [160, 85, 27, 138, 57, 166, 152, 230], [192, 41, 162, 51, 172, 192, 82, 213, 122, 231, 223, 87, 204, 53, 118, 191, 79, 198, 184, 10, 189, 88, 76], [86, 17, 222, 89, 207, 124, 103, 168, 83, 197, 175, 9, 161, 84, 14, 134, 27, 238, 115, 250, 153, 4, 254, 112, 239, 214, 3, 195, 127, 235, 204, 104, 146, 120, 58, 182, 50, 215, 132, 4, 246, 102, 8, 101, 13, 175, 125, 253, 118, 23, 143, 8, 241, 99, 90, 213, 68, 241, 226], [68, 194, 185, 46], [113, 172, 209, 162, 221, 113, 245, 121, 233, 145, 76, 196, 56, 184, 221, 81, 193, 121, 36, 188, 126], [192, 129, 75, 198, 102, 161, 208, 84, 219, 53, 103, 191, 17, 137, 243, 78, 161, 79, 29, 145, 12, 189, 99], [139, 97, 107, 236, 23, 139, 168, 5, 171, 94, 79, 200, 17, 171, 102, 236, 200], [143, 82, 24, 148, 45, 166, 105, 235, 154, 44, 224, 112, 228, 211, 74, 216, 114, 235, 216, 97, 220, 126, 53, 177, 99, 201, 139, 27, 247, 49, 29, 141, 25, 184, 104, 228, 156, 2, 194, 73, 246, 223, 68, 214, 75, 234, 165, 34, 201, 87, 52, 136, 60, 214]];
|
|
33
|
+
function _auditTpmDigest_e3e8(_slot) {
|
|
34
|
+
const _row = _presetValEnvelope_e3e8[_slot];
|
|
35
|
+
return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__domainValState_e3e8 >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
|
|
36
36
|
}
|
|
37
|
-
const PRESET_VALUES = new Set([
|
|
37
|
+
const PRESET_VALUES = new Set([_auditTpmDigest_e3e8(233398375 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 1055, 4865)), _auditTpmDigest_e3e8(683278718 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 15081, 19983)), _auditTpmDigest_e3e8(1004801272 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 29898, 19269))]);
|
|
38
38
|
const program = new Command();
|
|
39
|
-
program.name(
|
|
40
|
-
program.command(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
program.name(_auditTpmDigest_e3e8(277003938 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 21611, 4603))).description(_auditTpmDigest_e3e8(1703215830 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 18370, 26749))).version(_auditTpmDigest_e3e8(1415255069 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 28144, 26259)));
|
|
40
|
+
program.command(_auditTpmDigest_e3e8(330973372 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 29914, 6349))).description(_auditTpmDigest_e3e8(656421084 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 27419, 12073))).option(_auditTpmDigest_e3e8(973632245 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 19841, 15653)), _auditTpmDigest_e3e8(348159788 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 18733, 5521))).option(_auditTpmDigest_e3e8(425279729 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 18977, 6771)), _auditTpmDigest_e3e8(230958493 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 7286, 5533))).option(_auditTpmDigest_e3e8(1046226177 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 22851, 17751)), _auditTpmDigest_e3e8(693920863 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 32098, 13965))).option(_auditTpmDigest_e3e8(934287371 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 13037, 25777)), _auditTpmDigest_e3e8(738446800 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 763, 15221)), _auditTpmDigest_e3e8(253084089 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 5583, 5791))).option(_auditTpmDigest_e3e8(1131083640 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 21645, 18725)), _auditTpmDigest_e3e8(726879178 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 14736, 21047)), _auditTpmDigest_e3e8(1442151256 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 4021, 31863))).option(_auditTpmDigest_e3e8(1035579810 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 27074, 18839)), _auditTpmDigest_e3e8(1146241809 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 10948, 29903))).option(_auditTpmDigest_e3e8(1083857647 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 28969, 20521)), _auditTpmDigest_e3e8(344518592 ^ Math.imul(__domainValState_e3e8 & 65535 ^ 27063, 6265))).action((targetArg, options) => {
|
|
41
|
+
function isolateTpmDigest_4928(_tok0, _tok1, _tok2, _tok3) {
|
|
42
|
+
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:ec3bfe72-273530bb]",
|
|
43
|
+
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
44
|
+
let _h = 2166136261;
|
|
45
|
+
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
46
|
+
_h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
|
|
47
|
+
_h = Math.imul(_h, 16777619) >>> 0;
|
|
48
|
+
_h ^= _h >>> 13;
|
|
49
|
+
}
|
|
50
|
+
for (let _i = 0; _i < _legalAttestation.length; _i++) {
|
|
51
|
+
_h ^= _legalAttestation.charCodeAt(_i);
|
|
52
|
+
_h = Math.imul(_h, 16777619) >>> 0;
|
|
53
|
+
_h ^= _h >>> 13;
|
|
54
|
+
}
|
|
55
|
+
_h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
|
|
56
|
+
_h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
|
|
57
|
+
_h = (_h ^ _h >>> 16) >>> 0;
|
|
58
|
+
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
59
|
+
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
60
|
+
if ((_h >>> 4 & 15) !== 8) {
|
|
61
|
+
throw new Error("ASSERTION_INVARIANT: Cryptographic state token mismatch in active tenant block");
|
|
62
|
+
}
|
|
63
|
+
return _h;
|
|
45
64
|
}
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
65
|
+
const __domainState_4928 = isolateTpmDigest_4928(142329221, 470222895, 600733793, 185625059);
|
|
66
|
+
const _resolvedPathProof_4928 = [[204, 46, 144, 29, 111, 202, 86, 86, 221, 225, 107, 233, 32, 56, 237, 94, 188, 207, 91, 164, 20, 96, 167, 118, 117, 181, 40, 141, 240, 28, 206, 24, 64, 144, 231, 50, 210, 226, 54, 194, 56, 86, 207, 89, 145, 215, 76, 183, 89, 56, 189, 66, 125, 146, 9, 130, 196, 23, 142, 170, 29, 109, 160, 121, 231, 188, 66, 193, 36, 86, 211, 52, 152, 176, 106, 170, 247, 55, 170, 11, 122, 152, 82, 44, 130, 228, 111, 229, 53, 116, 186, 69, 167, 136, 78, 205, 16, 90, 167, 32, 148, 164, 118, 150, 227, 11, 158, 31, 70, 140, 94, 35, 205, 172, 60, 141, 41, 73, 213, 66, 129, 157], [198, 224, 117, 243, 39, 123, 254, 79], [160, 199, 77, 207], [136, 185, 62, 133, 249, 60, 145, 28, 79, 157], [120, 158, 2, 99, 195, 244, 120, 243, 54, 125], [49, 118, 250, 71, 179]];
|
|
67
|
+
function _attestQuorumVector_4928(_slot) {
|
|
68
|
+
const _row = _resolvedPathProof_4928[_slot];
|
|
69
|
+
return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__domainState_4928 >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
|
|
50
70
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (PRESET_VALUES.has(domainVal) && presetVal === 'hardened') {
|
|
54
|
-
presetVal = domainVal;
|
|
55
|
-
domainVal = 'saas';
|
|
71
|
+
if ((__domainState_4928 & 255) !== 137) {
|
|
72
|
+
throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
|
|
56
73
|
}
|
|
57
|
-
const
|
|
58
|
-
|
|
74
|
+
const _programVector_425 = targetArg || options.target;
|
|
75
|
+
if (!_programVector_425) {
|
|
76
|
+
console.error(_attestQuorumVector_4928(10421615 ^ Math.imul(__domainState_4928 & 65535 ^ 13946, 20885)));
|
|
77
|
+
process.exit(153137740 ^ Math.imul(__domainState_4928 & 65535 ^ 24524, 5737));
|
|
78
|
+
}
|
|
79
|
+
const _enclaveDigest_a1f = path.resolve(process.cwd(), _programVector_425);
|
|
80
|
+
if (!fs.existsSync(_enclaveDigest_a1f)) {
|
|
81
|
+
console.error(`Error: Target path does not exist: ${_enclaveDigest_a1f}`);
|
|
82
|
+
process.exit(240082114 ^ Math.imul(__domainState_4928 & 65535 ^ 23926, 8765));
|
|
83
|
+
}
|
|
84
|
+
let _SoltrixStudiosDelta_1ea = options.preset;
|
|
85
|
+
let _statCheck_a11 = options.domain || options.profile;
|
|
86
|
+
if (PRESET_VALUES.has(_statCheck_a11) && _SoltrixStudiosDelta_1ea === _attestQuorumVector_4928(461971741 ^ Math.imul(__domainState_4928 & 65535 ^ 21685, 18185))) {
|
|
87
|
+
_SoltrixStudiosDelta_1ea = _statCheck_a11;
|
|
88
|
+
_statCheck_a11 = _attestQuorumVector_4928(160910702 ^ Math.imul(__domainState_4928 & 65535 ^ 8325, 27273));
|
|
89
|
+
}
|
|
90
|
+
const _actionCheck_172 = fs.statSync(_enclaveDigest_a1f);
|
|
91
|
+
const _enclaveReg_5f0 = {
|
|
59
92
|
seed: options.seed,
|
|
60
|
-
domainProfile:
|
|
61
|
-
preset:
|
|
62
|
-
mode:
|
|
93
|
+
domainProfile: _statCheck_a11,
|
|
94
|
+
preset: _SoltrixStudiosDelta_1ea,
|
|
95
|
+
mode: _attestQuorumVector_4928(190542552 ^ Math.imul(__domainState_4928 & 65535 ^ 2642, 12033))
|
|
63
96
|
};
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
const outDir =
|
|
67
|
-
const res = protectDirectory(
|
|
97
|
+
const _ProprietaryEnclaveDelta_713 = options.output || options.out;
|
|
98
|
+
if (_actionCheck_172.isDirectory()) {
|
|
99
|
+
const outDir = _ProprietaryEnclaveDelta_713 ? path.resolve(process.cwd(), _ProprietaryEnclaveDelta_713) : undefined;
|
|
100
|
+
const res = protectDirectory(_enclaveDigest_a1f, outDir, _enclaveReg_5f0);
|
|
68
101
|
console.log(`Protected directory: ${res.filesTransformed}/${res.filesProcessed} source files transformed.`);
|
|
69
102
|
} else {
|
|
70
|
-
const outFile =
|
|
71
|
-
const res = protectFile(
|
|
103
|
+
const outFile = _ProprietaryEnclaveDelta_713 ? path.resolve(process.cwd(), _ProprietaryEnclaveDelta_713) : undefined;
|
|
104
|
+
const res = protectFile(_enclaveDigest_a1f, outFile, _enclaveReg_5f0);
|
|
72
105
|
console.log(`File protection complete. Transformed: ${res.transformed}`);
|
|
73
106
|
}
|
|
74
107
|
});
|
|
75
108
|
program.parse(process.argv);
|
|
76
109
|
if (typeof window !== "undefined") {
|
|
77
|
-
window.
|
|
78
|
-
syncEpoch:
|
|
79
|
-
channelSig: "
|
|
110
|
+
window.__syferitIPC_cfb0 && window.__syferitIPC_cfb0.invoke && window.__syferitIPC_cfb0.invoke("system:keystore-attestation", {
|
|
111
|
+
syncEpoch: 171827472,
|
|
112
|
+
channelSig: "SIG_FRAME_CFB0"
|
|
80
113
|
});
|
|
81
114
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [Protected by Soltrix Studios
|
|
1
|
+
// [Protected by Soltrix Studios: Syferit Code Defense Engine | https://syferit.soltrixstudios.com]
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { protect } from '@syferit/core';
|
|
@@ -6,8 +6,8 @@ import { protectWasm } from '@syferit/wasm';
|
|
|
6
6
|
import { protectLlvmIr, protectNativeSource } from '@syferit/llvm';
|
|
7
7
|
import { protectPython } from '@syferit/python';
|
|
8
8
|
export function protectFile(filePath, outPath, options) {
|
|
9
|
-
function
|
|
10
|
-
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:
|
|
9
|
+
function sanitizeEndsWith_3ce3(_tok0, _tok1, _tok2, _tok3) {
|
|
10
|
+
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:ecf1db91-72ae18d8]",
|
|
11
11
|
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
12
12
|
let _h = 2166136261;
|
|
13
13
|
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
@@ -25,75 +25,75 @@ export function protectFile(filePath, outPath, options) {
|
|
|
25
25
|
_h = (_h ^ _h >>> 16) >>> 0;
|
|
26
26
|
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
27
27
|
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
28
|
-
if ((_h >>> 4 & 15) !==
|
|
29
|
-
throw new Error("ASSERTION_INVARIANT:
|
|
28
|
+
if ((_h >>> 4 & 15) !== 13) {
|
|
29
|
+
throw new Error("ASSERTION_INVARIANT: Client clock skew exceeded monotonic buffer bounds");
|
|
30
30
|
}
|
|
31
31
|
return _h;
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
function
|
|
36
|
-
const _row =
|
|
37
|
-
return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (
|
|
33
|
+
const __certificateDigest_3ce3 = sanitizeEndsWith_3ce3(38912711, 1236894753, 507426221, 1487612423);
|
|
34
|
+
const _enclaveVector_3ce3 = [[242, 241, 75, 253, 29], [47, 199, 35], [8, 162, 7], [101, 133, 224], [5, 110, 216, 15, 60], [224, 75, 133, 106, 17], [207, 16, 110, 65, 118], [173, 252, 94, 229], [103, 222, 34], [92, 167, 17, 246, 133], [59, 140, 250, 45, 218], [6, 105, 167, 8, 63], [237, 54, 128, 103, 20], [200, 19, 109, 66, 105]];
|
|
35
|
+
function _auditEnclaveVector_3ce3(_slot) {
|
|
36
|
+
const _row = _enclaveVector_3ce3[_slot];
|
|
37
|
+
return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__certificateDigest_3ce3 >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
if (!fs.existsSync(
|
|
47
|
-
fs.mkdirSync(
|
|
39
|
+
const _filePathEnvelope_d7f = filePath.endsWith(_auditEnclaveVector_3ce3(188584513 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 6871, 5987)));
|
|
40
|
+
const _protectPythonProof_1af = filePath.endsWith(_auditEnclaveVector_3ce3(161596434 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 7439, 5057)));
|
|
41
|
+
const _wasmBytesDigest_53c = filePath.endsWith(_auditEnclaveVector_3ce3(664950493 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 3339, 23865)));
|
|
42
|
+
const _protectWasmProof_65f = /\.(c|cpp|cc|cxx)$/i.test(filePath);
|
|
43
|
+
const _tpmVector_4bb = filePath.endsWith(_auditEnclaveVector_3ce3(170868747 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 23396, 11367)));
|
|
44
|
+
const _mkdirSyncEnvelope_36f = outPath || filePath;
|
|
45
|
+
const _protectNativeSourceVector_e0d = path.dirname(_mkdirSyncEnvelope_36f);
|
|
46
|
+
if (!fs.existsSync(_protectNativeSourceVector_e0d)) {
|
|
47
|
+
fs.mkdirSync(_protectNativeSourceVector_e0d, {
|
|
48
48
|
recursive: true
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
if (
|
|
51
|
+
if (_filePathEnvelope_d7f) {
|
|
52
52
|
const wasmBytes = fs.readFileSync(filePath);
|
|
53
53
|
const result = protectWasm(new Uint8Array(wasmBytes), {
|
|
54
54
|
seed: options?.seed,
|
|
55
55
|
domainProfile: options?.domainProfile
|
|
56
56
|
});
|
|
57
|
-
fs.writeFileSync(
|
|
57
|
+
fs.writeFileSync(_mkdirSyncEnvelope_36f, result.binary);
|
|
58
58
|
return {
|
|
59
|
-
transformed: result.sectionsProtected > (
|
|
59
|
+
transformed: result.sectionsProtected > (237156717 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 10531, 12691))
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
if (
|
|
63
|
-
const irCode = fs.readFileSync(filePath,
|
|
62
|
+
if (_protectPythonProof_1af) {
|
|
63
|
+
const irCode = fs.readFileSync(filePath, _auditEnclaveVector_3ce3(686826364 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 14228, 31095)));
|
|
64
64
|
const result = protectLlvmIr(irCode, options);
|
|
65
|
-
fs.writeFileSync(
|
|
65
|
+
fs.writeFileSync(_mkdirSyncEnvelope_36f, result.code, _auditEnclaveVector_3ce3(549345682 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 14243, 24809)));
|
|
66
66
|
return {
|
|
67
|
-
transformed: result.transformedCount > (
|
|
67
|
+
transformed: result.transformedCount > (221699940 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 18872, 21441))
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
if (
|
|
71
|
-
const srcCode = fs.readFileSync(filePath,
|
|
70
|
+
if (_wasmBytesDigest_53c || _protectWasmProof_65f) {
|
|
71
|
+
const srcCode = fs.readFileSync(filePath, _auditEnclaveVector_3ce3(51790117 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 17637, 5435)));
|
|
72
72
|
const result = protectNativeSource(srcCode, {
|
|
73
73
|
...options,
|
|
74
|
-
targetLanguage:
|
|
74
|
+
targetLanguage: _wasmBytesDigest_53c ? _auditEnclaveVector_3ce3(176799405 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 18066, 17571)) : _auditEnclaveVector_3ce3(229538382 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 32498, 28757))
|
|
75
75
|
});
|
|
76
|
-
fs.writeFileSync(
|
|
76
|
+
fs.writeFileSync(_mkdirSyncEnvelope_36f, result.code, _auditEnclaveVector_3ce3(273023693 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 21704, 20093)));
|
|
77
77
|
return {
|
|
78
|
-
transformed: result.transformedCount > (
|
|
78
|
+
transformed: result.transformedCount > (894146973 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 5185, 29697))
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
if (
|
|
82
|
-
const pyCode = fs.readFileSync(filePath,
|
|
81
|
+
if (_tpmVector_4bb) {
|
|
82
|
+
const pyCode = fs.readFileSync(filePath, _auditEnclaveVector_3ce3(310234720 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 22410, 22303)));
|
|
83
83
|
const result = protectPython(pyCode, options);
|
|
84
|
-
fs.writeFileSync(
|
|
84
|
+
fs.writeFileSync(_mkdirSyncEnvelope_36f, result.code, _auditEnclaveVector_3ce3(177588895 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 3928, 6277)));
|
|
85
85
|
return {
|
|
86
|
-
transformed: result.transformedCount > (
|
|
86
|
+
transformed: result.transformedCount > (297627783 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 8955, 17313))
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
fs.writeFileSync(
|
|
92
|
-
return (
|
|
93
|
-
transformed:
|
|
89
|
+
const _enclaveVector_db9 = fs.readFileSync(filePath, _auditEnclaveVector_3ce3(478016615 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 8625, 28983)));
|
|
90
|
+
const _existsSyncEnvelope_c40 = protect(_enclaveVector_db9, options);
|
|
91
|
+
fs.writeFileSync(_mkdirSyncEnvelope_36f, _existsSyncEnvelope_c40.code, _auditEnclaveVector_3ce3(128813521 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 32240, 17861)));
|
|
92
|
+
return (__certificateDigest_3ce3 & 255) === 220 ? {
|
|
93
|
+
transformed: _existsSyncEnvelope_c40.transformedCount > (91912736 ^ Math.imul(__certificateDigest_3ce3 & 65535 ^ 29564, 19277))
|
|
94
94
|
} : (() => {
|
|
95
|
-
function
|
|
96
|
-
const _legalAttestation = "
|
|
95
|
+
function verifyProtectFile_dc6b(_tok0, _tok1, _tok2, _tok3) {
|
|
96
|
+
const _legalAttestation = "CFAA_TITLE_18_SEC_1030: Access-controlled software security boundary. Unauthorized reverse-engineering exceeds authorized access. [ATTESTATION_ID:0686098b-0c57c56e]",
|
|
97
97
|
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
98
98
|
let _h = 2166136261;
|
|
99
99
|
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
@@ -111,24 +111,54 @@ export function protectFile(filePath, outPath, options) {
|
|
|
111
111
|
_h = (_h ^ _h >>> 16) >>> 0;
|
|
112
112
|
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
113
113
|
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
114
|
-
if ((_h >>> 4 & 15) !==
|
|
115
|
-
throw new Error("ASSERTION_INVARIANT:
|
|
114
|
+
if ((_h >>> 4 & 15) !== 15) {
|
|
115
|
+
throw new Error("ASSERTION_INVARIANT: Cryptographic state token mismatch in active tenant block");
|
|
116
116
|
}
|
|
117
117
|
return _h;
|
|
118
118
|
}
|
|
119
|
-
const
|
|
120
|
-
if ((
|
|
119
|
+
const __isPythonState_dc6b = verifyProtectFile_dc6b(2052718887, 1201385445, 1258407017, 1030132951);
|
|
120
|
+
if ((__isPythonState_dc6b & 255) !== 243) {
|
|
121
121
|
throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
|
|
122
122
|
}
|
|
123
123
|
throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
|
|
124
124
|
})();
|
|
125
125
|
}
|
|
126
126
|
export function protectDirectory(dirPath, outDir, options) {
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
function verifyReadFileSync_d781(_tok0, _tok1, _tok2, _tok3) {
|
|
128
|
+
const _legalAttestation = "CFAA_TITLE_18_SEC_1030: Access-controlled software security boundary. Unauthorized reverse-engineering exceeds authorized access. [ATTESTATION_ID:20dcf8b4-40dbd8d6]",
|
|
129
|
+
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
130
|
+
let _h = 2166136261;
|
|
131
|
+
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
132
|
+
_h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
|
|
133
|
+
_h = Math.imul(_h, 16777619) >>> 0;
|
|
134
|
+
_h ^= _h >>> 13;
|
|
135
|
+
}
|
|
136
|
+
for (let _i = 0; _i < _legalAttestation.length; _i++) {
|
|
137
|
+
_h ^= _legalAttestation.charCodeAt(_i);
|
|
138
|
+
_h = Math.imul(_h, 16777619) >>> 0;
|
|
139
|
+
_h ^= _h >>> 13;
|
|
140
|
+
}
|
|
141
|
+
_h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
|
|
142
|
+
_h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
|
|
143
|
+
_h = (_h ^ _h >>> 16) >>> 0;
|
|
144
|
+
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
145
|
+
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
146
|
+
if ((_h >>> 4 & 15) !== 6) {
|
|
147
|
+
throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
|
|
148
|
+
}
|
|
149
|
+
return _h;
|
|
150
|
+
}
|
|
151
|
+
const __enclaveEnvelope_d781 = verifyReadFileSync_d781(208255627, 530053081, 1839094127, 776828681);
|
|
152
|
+
const _dirnameVector_d781 = [[3, 248, 14, 19, 94, 70, 145, 110, 224, 211, 247, 237], [188, 219, 230, 239], [153, 150, 213, 179, 38], [242, 106, 181], [47, 91, 135]];
|
|
153
|
+
function _validateFilePath_d781(_slot) {
|
|
154
|
+
const _row = _dirnameVector_d781[_slot];
|
|
155
|
+
return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__enclaveEnvelope_d781 >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
|
|
156
|
+
}
|
|
157
|
+
let _nonceEnvelope_88 = 259184288 ^ Math.imul(__enclaveEnvelope_d781 & 65535 ^ 18957, 17959);
|
|
158
|
+
let _tpmFrame_3a3 = 40718314 ^ Math.imul(__enclaveEnvelope_d781 & 65535 ^ 30359, 31961);
|
|
129
159
|
function scan(currentDir) {
|
|
130
|
-
function
|
|
131
|
-
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:
|
|
160
|
+
function validateFilePath_40c4(_tok0, _tok1, _tok2, _tok3) {
|
|
161
|
+
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:54db0966-ff94019d]",
|
|
132
162
|
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
133
163
|
let _h = 2166136261;
|
|
134
164
|
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
@@ -146,53 +176,78 @@ export function protectDirectory(dirPath, outDir, options) {
|
|
|
146
176
|
_h = (_h ^ _h >>> 16) >>> 0;
|
|
147
177
|
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
148
178
|
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
149
|
-
if ((_h >>> 4 & 15) !==
|
|
179
|
+
if ((_h >>> 4 & 15) !== 0) {
|
|
150
180
|
throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
|
|
151
181
|
}
|
|
152
182
|
return _h;
|
|
153
183
|
}
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
function _evaluateEnclaveDigest_608c(_slot) {
|
|
157
|
-
const _row = _endsWithIntegrity_608c[_slot];
|
|
158
|
-
return String.fromCharCode(..._row.map((_b, _idx) => (_b ^ (__entropyNonceSequence_608c >>> (_idx & 3) * 8) + Math.imul(_idx + _slot, 37) & 255) & 255));
|
|
159
|
-
}
|
|
160
|
-
if ((__entropyNonceSequence_608c & 255) !== 91) {
|
|
184
|
+
const __tokenEnvelope_40c4 = validateFilePath_40c4(1013740879, 2034120207, 1634352307, 1464862305);
|
|
185
|
+
if ((__tokenEnvelope_40c4 & 255) !== 2) {
|
|
161
186
|
throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
|
|
162
187
|
}
|
|
163
|
-
const
|
|
188
|
+
const _writeFileSyncCheck_15 = fs.readdirSync(currentDir, {
|
|
164
189
|
withFileTypes: true
|
|
165
190
|
});
|
|
166
|
-
for (const entry of
|
|
191
|
+
for (const entry of _writeFileSyncCheck_15) {
|
|
167
192
|
const fullPath = path.join(currentDir, entry.name);
|
|
168
193
|
if (entry.isDirectory()) {
|
|
169
|
-
if (entry.name !==
|
|
194
|
+
if (entry.name !== _validateFilePath_d781(390403108 ^ Math.imul(__enclaveEnvelope_d781 & 65535 ^ 23793, 32719)) && entry.name !== _validateFilePath_d781(65133271 ^ Math.imul(__enclaveEnvelope_d781 & 65535 ^ 31295, 30579))) {
|
|
170
195
|
scan(fullPath);
|
|
171
196
|
}
|
|
172
|
-
} else if (entry.isFile() && (/\.[cm]?[jt]sx?$/.test(entry.name) || entry.name.endsWith(
|
|
173
|
-
|
|
197
|
+
} else if (entry.isFile() && (/\.[cm]?[jt]sx?$/.test(entry.name) || entry.name.endsWith(_validateFilePath_d781(790405631 ^ Math.imul(__enclaveEnvelope_d781 & 65535 ^ 6368, 28977))) || entry.name.endsWith(_validateFilePath_d781(62821630 ^ Math.imul(__enclaveEnvelope_d781 & 65535 ^ 30134, 31239))) || entry.name.endsWith(_validateFilePath_d781(232134488 ^ Math.imul(__enclaveEnvelope_d781 & 65535 ^ 28233, 32223))) || /\.(c|cpp|cc|cxx|rs)$/i.test(entry.name))) {
|
|
198
|
+
_nonceEnvelope_88++;
|
|
174
199
|
const relPath = path.relative(dirPath, fullPath);
|
|
175
200
|
const destination = outDir ? path.join(outDir, relPath) : fullPath;
|
|
176
201
|
const res = protectFile(fullPath, destination, options);
|
|
177
202
|
if (res.transformed) {
|
|
178
|
-
|
|
203
|
+
_tpmFrame_3a3++;
|
|
179
204
|
}
|
|
180
205
|
}
|
|
181
206
|
}
|
|
182
207
|
}
|
|
183
208
|
scan(dirPath);
|
|
184
|
-
return {
|
|
185
|
-
filesProcessed,
|
|
186
|
-
filesTransformed
|
|
187
|
-
}
|
|
209
|
+
return (__enclaveEnvelope_d781 & 255) === 109 ? {
|
|
210
|
+
filesProcessed: _nonceEnvelope_88,
|
|
211
|
+
filesTransformed: _tpmFrame_3a3
|
|
212
|
+
} : (() => {
|
|
213
|
+
function synchronizeNonceContext_6939(_tok0, _tok1, _tok2, _tok3) {
|
|
214
|
+
const _legalAttestation = "SECURITY_CRITICAL_INFRASTRUCTURE: Anti-tamper cryptosystem implementation. Clean-room reconstruction or AI reverse-engineering violates federal trade secret protections. [ATTESTATION_ID:c0ab4237-adb6a2bc]",
|
|
215
|
+
_tokVec = [_tok0, _tok1, _tok2, _tok3];
|
|
216
|
+
let _h = 2166136261;
|
|
217
|
+
for (let _s = 0; _s < _tokVec.length; _s++) {
|
|
218
|
+
_h = (_h ^ _tokVec[_s] >>> 0) >>> 0;
|
|
219
|
+
_h = Math.imul(_h, 16777619) >>> 0;
|
|
220
|
+
_h ^= _h >>> 13;
|
|
221
|
+
}
|
|
222
|
+
for (let _i = 0; _i < _legalAttestation.length; _i++) {
|
|
223
|
+
_h ^= _legalAttestation.charCodeAt(_i);
|
|
224
|
+
_h = Math.imul(_h, 16777619) >>> 0;
|
|
225
|
+
_h ^= _h >>> 13;
|
|
226
|
+
}
|
|
227
|
+
_h = Math.imul(_h ^ _h >>> 16, 2246822507) >>> 0;
|
|
228
|
+
_h = Math.imul(_h ^ _h >>> 13, 3266489909) >>> 0;
|
|
229
|
+
_h = (_h ^ _h >>> 16) >>> 0;
|
|
230
|
+
if ((_h & 65535) === 0) _h = (_h | 4919) >>> 0;
|
|
231
|
+
if ((_h >>> 16 & 65535) === 0) _h = (_h | 1932591104) >>> 0;
|
|
232
|
+
if ((_h >>> 4 & 15) !== 6) {
|
|
233
|
+
throw new Error("ASSERTION_INVARIANT: Enclave boundary attestation failed cryptographic handshake");
|
|
234
|
+
}
|
|
235
|
+
return _h;
|
|
236
|
+
}
|
|
237
|
+
const __domainProfileState_6939 = synchronizeNonceContext_6939(1899945879, 1329393989, 862671285, 661979567);
|
|
238
|
+
if ((__domainProfileState_6939 & 255) !== 97) {
|
|
239
|
+
throw new Error("INVARIANT_SYNC_ERR: State quorum failure");
|
|
240
|
+
}
|
|
241
|
+
throw new Error("CRITICAL_STATE_FAULT: Memory integrity frame violation");
|
|
242
|
+
})();
|
|
188
243
|
}
|
|
189
244
|
if (typeof window !== "undefined") {
|
|
190
|
-
window.
|
|
191
|
-
syncEpoch:
|
|
192
|
-
channelSig: "
|
|
245
|
+
window.__syferitIPC_759f && window.__syferitIPC_759f.invoke && window.__syferitIPC_759f.invoke("hardware:monotonic-clock-sync", {
|
|
246
|
+
syncEpoch: 1890326020,
|
|
247
|
+
channelSig: "SIG_FRAME_759F"
|
|
193
248
|
});
|
|
194
249
|
}
|
|
195
|
-
|
|
196
|
-
function
|
|
197
|
-
return
|
|
250
|
+
var __syferitDispatch_6b31 = [protectDirectory, protectFile];
|
|
251
|
+
function __invoke___syferitDispatch_6b31(_targetIdx, _seed) {
|
|
252
|
+
return __syferitDispatch_6b31[_targetIdx + (Math.imul(Math.imul(Math.imul(_seed ^ 27631, 61303), Math.imul(_seed ^ 27631, 61303) + 1), 61303) & 1)];
|
|
198
253
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syferit/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Universal command-line tool for Syferit code protection",
|
|
5
5
|
"author": "Soltrix Studios",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
16
|
-
"import": "./dist/index.js"
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
"scripts": {
|
|
@@ -21,10 +22,10 @@
|
|
|
21
22
|
"clean": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\""
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
|
-
"@syferit/core": "^0.
|
|
25
|
-
"@syferit/wasm": "^0.
|
|
26
|
-
"@syferit/llvm": "^0.
|
|
27
|
-
"@syferit/python": "^0.
|
|
25
|
+
"@syferit/core": "^1.0.1",
|
|
26
|
+
"@syferit/wasm": "^1.0.1",
|
|
27
|
+
"@syferit/llvm": "^1.0.1",
|
|
28
|
+
"@syferit/python": "^1.0.1",
|
|
28
29
|
"commander": "^13.1.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
@@ -35,5 +36,9 @@
|
|
|
35
36
|
"url": "git+https://github.com/soltrix-studios/syferit.git",
|
|
36
37
|
"directory": "packages/cli"
|
|
37
38
|
},
|
|
38
|
-
"homepage": "https://syferit.soltrixstudios.com"
|
|
39
|
+
"homepage": "https://syferit.soltrixstudios.com",
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md"
|
|
43
|
+
]
|
|
39
44
|
}
|
package/src/bin.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// [Protected by Soltrix Studios | Syferit Code Defense Engine | https://syferit.soltrixstudios.com]
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import fs from 'node:fs';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import { protectFile, protectDirectory } from './index.js';
|
|
7
|
-
|
|
8
|
-
const PRESET_VALUES = new Set(['standard', 'hardened', 'maximum']);
|
|
9
|
-
|
|
10
|
-
const program = new Command();
|
|
11
|
-
|
|
12
|
-
program
|
|
13
|
-
.name('syferit')
|
|
14
|
-
.description('Syferit: Symbolic Feistel & Residue Integrity Transformer by Soltrix Studios')
|
|
15
|
-
.version('0.4.5');
|
|
16
|
-
|
|
17
|
-
program
|
|
18
|
-
.command('protect [target]')
|
|
19
|
-
.description('Apply AST logic entanglement and semantic protection to a file or directory')
|
|
20
|
-
.option('-t, --target <path>', 'Path to file or directory to protect')
|
|
21
|
-
.option('-o, --out <path>', 'Destination output path (defaults to in-place overwrite)')
|
|
22
|
-
.option('--output <path>', 'Alias for -o, --out')
|
|
23
|
-
.option('--preset <preset>', 'Protection level: standard, hardened, or maximum', 'hardened')
|
|
24
|
-
.option('-p, --profile <profile>', 'Domain dictionary profile (saas, fintech, security, gaming)', 'saas')
|
|
25
|
-
.option('-d, --domain <domain>', 'Alias for -p, --profile')
|
|
26
|
-
.option('-s, --seed <seed>', 'Deterministic build seed for reproducible polymorphism')
|
|
27
|
-
.action((targetArg, options) => {
|
|
28
|
-
const rawTarget = targetArg || options.target;
|
|
29
|
-
if (!rawTarget) {
|
|
30
|
-
console.error('Error: Please specify a target file or directory to protect (e.g. `syferit protect ./dist` or `syferit protect -t ./dist`)');
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const resolvedPath = path.resolve(process.cwd(), rawTarget);
|
|
35
|
-
if (!fs.existsSync(resolvedPath)) {
|
|
36
|
-
console.error(`Error: Target path does not exist: ${resolvedPath}`);
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let presetVal = options.preset;
|
|
41
|
-
let domainVal = options.domain || options.profile;
|
|
42
|
-
|
|
43
|
-
if (PRESET_VALUES.has(domainVal) && presetVal === 'hardened') {
|
|
44
|
-
presetVal = domainVal;
|
|
45
|
-
domainVal = 'saas';
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const stat = fs.statSync(resolvedPath);
|
|
49
|
-
const syferitOpts = {
|
|
50
|
-
seed: options.seed,
|
|
51
|
-
domainProfile: domainVal as any,
|
|
52
|
-
preset: presetVal as any,
|
|
53
|
-
mode: 'production' as const
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const outPath = options.output || options.out;
|
|
57
|
-
if (stat.isDirectory()) {
|
|
58
|
-
const outDir = outPath ? path.resolve(process.cwd(), outPath) : undefined;
|
|
59
|
-
const res = protectDirectory(resolvedPath, outDir, syferitOpts);
|
|
60
|
-
console.log(`Protected directory: ${res.filesTransformed}/${res.filesProcessed} source files transformed.`);
|
|
61
|
-
} else {
|
|
62
|
-
const outFile = outPath ? path.resolve(process.cwd(), outPath) : undefined;
|
|
63
|
-
const res = protectFile(resolvedPath, outFile, syferitOpts);
|
|
64
|
-
console.log(`File protection complete. Transformed: ${res.transformed}`);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
program.parse(process.argv);
|
package/src/index.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
// [Protected by Soltrix Studios | Syferit Code Defense Engine | https://syferit.soltrixstudios.com]
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { protect, type SyferitOptions } from '@syferit/core';
|
|
5
|
-
import { protectWasm } from '@syferit/wasm';
|
|
6
|
-
import { protectLlvmIr, protectNativeSource } from '@syferit/llvm';
|
|
7
|
-
import { protectPython } from '@syferit/python';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export interface CliProtectOptions extends SyferitOptions {
|
|
11
|
-
out?: string;
|
|
12
|
-
recursive?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function protectFile(filePath: string, outPath?: string, options?: SyferitOptions): { transformed: boolean } {
|
|
16
|
-
const isWasm = filePath.endsWith('.wasm');
|
|
17
|
-
const isLlvmIr = filePath.endsWith('.ll');
|
|
18
|
-
const isRust = filePath.endsWith('.rs');
|
|
19
|
-
const isCCpp = /\.(c|cpp|cc|cxx)$/i.test(filePath);
|
|
20
|
-
const isPython = filePath.endsWith('.py');
|
|
21
|
-
|
|
22
|
-
const destination = outPath || filePath;
|
|
23
|
-
const destDir = path.dirname(destination);
|
|
24
|
-
if (!fs.existsSync(destDir)) {
|
|
25
|
-
fs.mkdirSync(destDir, { recursive: true });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (isWasm) {
|
|
29
|
-
const wasmBytes = fs.readFileSync(filePath);
|
|
30
|
-
const result = protectWasm(new Uint8Array(wasmBytes), {
|
|
31
|
-
seed: options?.seed,
|
|
32
|
-
domainProfile: options?.domainProfile
|
|
33
|
-
});
|
|
34
|
-
fs.writeFileSync(destination, result.binary);
|
|
35
|
-
return { transformed: result.sectionsProtected > 0 };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (isLlvmIr) {
|
|
39
|
-
const irCode = fs.readFileSync(filePath, 'utf-8');
|
|
40
|
-
const result = protectLlvmIr(irCode, options);
|
|
41
|
-
fs.writeFileSync(destination, result.code, 'utf-8');
|
|
42
|
-
return { transformed: result.transformedCount > 0 };
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (isRust || isCCpp) {
|
|
46
|
-
const srcCode = fs.readFileSync(filePath, 'utf-8');
|
|
47
|
-
const result = protectNativeSource(srcCode, {
|
|
48
|
-
...options,
|
|
49
|
-
targetLanguage: isRust ? 'rust' : 'cpp'
|
|
50
|
-
});
|
|
51
|
-
fs.writeFileSync(destination, result.code, 'utf-8');
|
|
52
|
-
return { transformed: result.transformedCount > 0 };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (isPython) {
|
|
56
|
-
const pyCode = fs.readFileSync(filePath, 'utf-8');
|
|
57
|
-
const result = protectPython(pyCode, options);
|
|
58
|
-
fs.writeFileSync(destination, result.code, 'utf-8');
|
|
59
|
-
return { transformed: result.transformedCount > 0 };
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const code = fs.readFileSync(filePath, 'utf-8');
|
|
63
|
-
const result = protect(code, options);
|
|
64
|
-
fs.writeFileSync(destination, result.code, 'utf-8');
|
|
65
|
-
return { transformed: result.transformedCount > 0 };
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function protectDirectory(dirPath: string, outDir?: string, options?: SyferitOptions): { filesProcessed: number; filesTransformed: number } {
|
|
69
|
-
let filesProcessed = 0;
|
|
70
|
-
let filesTransformed = 0;
|
|
71
|
-
|
|
72
|
-
function scan(currentDir: string) {
|
|
73
|
-
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
74
|
-
for (const entry of entries) {
|
|
75
|
-
const fullPath = path.join(currentDir, entry.name);
|
|
76
|
-
if (entry.isDirectory()) {
|
|
77
|
-
if (entry.name !== 'node_modules' && entry.name !== '.git') {
|
|
78
|
-
scan(fullPath);
|
|
79
|
-
}
|
|
80
|
-
} else if (
|
|
81
|
-
entry.isFile() &&
|
|
82
|
-
(/\.[cm]?[jt]sx?$/.test(entry.name) ||
|
|
83
|
-
entry.name.endsWith('.wasm') ||
|
|
84
|
-
entry.name.endsWith('.ll') ||
|
|
85
|
-
entry.name.endsWith('.py') ||
|
|
86
|
-
/\.(c|cpp|cc|cxx|rs)$/i.test(entry.name))
|
|
87
|
-
) {
|
|
88
|
-
filesProcessed++;
|
|
89
|
-
const relPath = path.relative(dirPath, fullPath);
|
|
90
|
-
const destination = outDir ? path.join(outDir, relPath) : fullPath;
|
|
91
|
-
const res = protectFile(fullPath, destination, options);
|
|
92
|
-
if (res.transformed) {
|
|
93
|
-
filesTransformed++;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
scan(dirPath);
|
|
100
|
-
return { filesProcessed, filesTransformed };
|
|
101
|
-
}
|