summaryrefslogtreecommitdiff
path: root/SPECS/README.md
blob: 64952d822290fae4255acd0d17753f3c4a05c8c8 (plain)
1
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# SPECS - Deobfuscated CLI Application Structure

This directory contains the deobfuscated and domain-separated components of the CLI.js application.

## Directory Structure Overview

```
SPECS/
├── README.md                           # This file
├── core/
│   ├── shell-parser.js                # Shell command parsing and escaping
│   ├── module-system.js               # Module loading and bundling utilities
│   └── main.js                        # Main application entry point
├── utils/
│   ├── string-utils.js                # String manipulation utilities
│   ├── object-utils.js                # Object manipulation and serialization
│   ├── path-utils.js                  # Cross-platform path handling
│   ├── type-checking.js               # Type validation utilities
│   └── uuid.js                        # UUID generation
├── platform/
│   ├── environment-detection.js       # Runtime environment detection
│   ├── global-object.js               # Cross-platform global object access
│   └── compatibility.js               # Browser/Node.js compatibility layers
├── network/
│   ├── http-client.js                 # HTTP request handling
│   ├── fetch-polyfill.js              # Fetch API utilities and detection
│   ├── xhr-wrapper.js                 # XMLHttpRequest instrumentation
│   └── url-parsing.js                 # URL parsing and manipulation
├── instrumentation/
│   ├── console-monitor.js             # Console output instrumentation
│   ├── dom-events.js                  # DOM event capture and handling
│   ├── error-capture.js               # Error handling (non-Sentry)
│   └── performance-monitor.js         # Performance tracking utilities
├── async/
│   ├── sync-promise.js                # Synchronous Promise implementation
│   ├── promise-buffer.js              # Promise management utilities
│   └── async-helpers.js               # Async operation utilities
└── security/
    ├── command-sanitizer.js           # Command injection protection
    ├── input-validation.js            # Input sanitization
    └── safe-escaping.js               # Safe string escaping utilities
```

## Domain Separation

### Core (`core/`)

- **shell-parser.js**: Advanced shell command parsing with variable substitution and glob support
- **module-system.js**: Webpack-style module loading and CommonJS/ES6 compatibility
- **main.js**: Application entry point and orchestration

### Utilities (`utils/`)

- **string-utils.js**: Text processing, truncation, and pattern matching
- **object-utils.js**: Deep object manipulation, normalization, and serialization
- **path-utils.js**: Cross-platform path operations and resolution
- **type-checking.js**: Runtime type validation and checking utilities
- **uuid.js**: UUID generation with crypto fallbacks

### Platform (`platform/`)

- **environment-detection.js**: Detect browser vs Node.js, platform-specific features
- **global-object.js**: Abstraction for accessing global objects across environments
- **compatibility.js**: Polyfills and compatibility layers

### Network (`network/`)

- **http-client.js**: Generic HTTP client with rate limiting and retry logic
- **fetch-polyfill.js**: Fetch API detection and native implementation checks
- **xhr-wrapper.js**: XMLHttpRequest instrumentation and monitoring
- **url-parsing.js**: URL parsing, query string handling, and sanitization

### Instrumentation (`instrumentation/`)

- **console-monitor.js**: Console output capture and logging instrumentation
- **dom-events.js**: DOM click/keypress event handling and capture
- **error-capture.js**: Generic error handling (excluding Sentry-specific code)
- **performance-monitor.js**: Performance timing and monitoring utilities

### Async (`async/`)

- **sync-promise.js**: Custom Promise implementation for synchronous operations
- **promise-buffer.js**: Promise queuing and buffer management
- **async-helpers.js**: Async operation utilities and helpers

### Security (`security/`)

- **command-sanitizer.js**: Protection against command injection attacks
- **input-validation.js**: Input sanitization and validation
- **safe-escaping.js**: Safe escaping for shell commands and strings

## Deobfuscation Process

1. **Symbol Mapping**: Reverse minified variable names to meaningful identifiers
2. **Function Extraction**: Separate bundled functions into logical modules
3. **Code Beautification**: Format and structure code for readability
4. **Documentation**: Add inline comments explaining complex logic
5. **Type Annotations**: Add JSDoc comments where appropriate

## Excluded Components

- **Sentry SDK**: All Sentry-related error tracking and monitoring code has been excluded per requirements
- **Third-party Libraries**: External dependencies remain bundled but are clearly marked
- **Build Artifacts**: Webpack-specific bundling code is isolated in module-system.js

## Usage

Each file is designed to be self-contained with clear exports and minimal dependencies. The deobfuscated code maintains the original functionality while being human-readable and maintainable.