pentesting 0.55.2 → 0.55.3

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.
@@ -0,0 +1,204 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // src/shared/constants/system.ts
9
+ var EXIT_CODES = {
10
+ /** Successful execution */
11
+ SUCCESS: 0,
12
+ /** General error */
13
+ GENERAL_ERROR: 1,
14
+ /** Command not found */
15
+ COMMAND_NOT_FOUND: 127,
16
+ /** Process killed by SIGALRM (timeout) */
17
+ TIMEOUT: 124,
18
+ /** Process killed by SIGINT (Ctrl+C) */
19
+ SIGINT: 130,
20
+ /** Process killed by SIGTERM */
21
+ SIGTERM: 143,
22
+ /** Process killed by SIGKILL */
23
+ SIGKILL: 137,
24
+ /** Invalid or missing configuration (Unix EX_CONFIG convention = 78) */
25
+ CONFIG_ERROR: 78
26
+ };
27
+ var PROCESS_ACTIONS = {
28
+ LIST: "list",
29
+ STATUS: "status",
30
+ INTERACT: "interact",
31
+ PROMOTE: "promote",
32
+ STOP: "stop",
33
+ STOP_ALL: "stop_all"
34
+ };
35
+ var PROCESS_ROLES = {
36
+ LISTENER: "listener",
37
+ ACTIVE_SHELL: "active_shell",
38
+ SERVER: "server",
39
+ SNIFFER: "sniffer",
40
+ SPOOFER: "spoofer",
41
+ CALLBACK: "callback",
42
+ PROXY: "proxy",
43
+ BACKGROUND: "background"
44
+ };
45
+ var PROCESS_ICONS = {
46
+ [PROCESS_ROLES.LISTENER]: "[LISTENER]",
47
+ [PROCESS_ROLES.ACTIVE_SHELL]: "[SHELL]",
48
+ [PROCESS_ROLES.SERVER]: "[SERVER]",
49
+ [PROCESS_ROLES.SNIFFER]: "[SNIFFER]",
50
+ [PROCESS_ROLES.SPOOFER]: "[SPOOFER]",
51
+ [PROCESS_ROLES.CALLBACK]: "[CALLBACK]",
52
+ [PROCESS_ROLES.PROXY]: "[PROXY]",
53
+ [PROCESS_ROLES.BACKGROUND]: "[BG]"
54
+ };
55
+ var STATUS_MARKERS = {
56
+ RUNNING: "[RUNNING]",
57
+ STOPPED: "[STOPPED]",
58
+ WARNING: "[WARNING]",
59
+ INTERACTIVE: "[INTERACTIVE]",
60
+ EXITED: "[EXITED]"
61
+ };
62
+ var PROCESS_EVENTS = {
63
+ STARTED: "started",
64
+ CONNECTION_DETECTED: "connection_detected",
65
+ ROLE_CHANGED: "role_changed",
66
+ COMMAND_SENT: "command_sent",
67
+ STOPPED: "stopped",
68
+ DIED: "died",
69
+ ZOMBIE_CLEANED: "zombie_cleaned"
70
+ };
71
+ var SYSTEM_LIMITS = {
72
+ /** Maximum wait time for interactive shell responses (10 seconds) */
73
+ MAX_WAIT_MS_INTERACT: 1e4,
74
+ /** Default wait time for interactive shell responses (2 seconds) */
75
+ DEFAULT_WAIT_MS_INTERACT: 2e3,
76
+ /** Maximum characters for process description */
77
+ MAX_DESCRIPTION_LENGTH: 80,
78
+ /** Maximum characters for stored command string */
79
+ MAX_COMMAND_LENGTH: 200,
80
+ /** Maximum characters to show from stdout
81
+ * WHY 50K: background processes (linpeas, scans, shells) produce large
82
+ * output with findings scattered throughout. Let the LLM see it all. */
83
+ MAX_STDOUT_SLICE: 5e4,
84
+ /** Maximum characters to show from stderr */
85
+ MAX_STDERR_SLICE: 5e3,
86
+ /** Maximum characters for error detail messages */
87
+ MAX_ERROR_DETAIL_SLICE: 2e3,
88
+ /** Maximum characters for input prompt previews */
89
+ MAX_PROMPT_PREVIEW: 50,
90
+ /** Maximum characters for input snippets in logs */
91
+ MAX_INPUT_SLICE: 100,
92
+ /** Maximum events to keep in process event log */
93
+ MAX_EVENT_LOG: 30,
94
+ /** Wait time for child PID discovery via pgrep */
95
+ CHILD_PID_DISCOVERY_MS: 500,
96
+ /** Wait time between SIGTERM and SIGKILL during graceful shutdown */
97
+ SHUTDOWN_WAIT_MS: 500,
98
+ /** Wait time between process cleanup batches */
99
+ CLEANUP_BATCH_WAIT_MS: 300,
100
+ /** Timeout for pgrep and pkill operations */
101
+ PROCESS_OP_TIMEOUT_MS: 2e3,
102
+ /** Port range for web services (development servers) */
103
+ WEB_PORT_RANGE: { MIN: 8e3, MAX: 9e3 },
104
+ /** Port range for API services */
105
+ API_PORT_RANGE: { MIN: 3e3, MAX: 3500 },
106
+ /** Number of recent events to fetch for resource summary */
107
+ RECENT_EVENTS_IN_SUMMARY: 10,
108
+ /** Number of events to display in resource summary */
109
+ RECENT_EVENTS_DISPLAY: 5,
110
+ /** Number of recent output lines to show per process */
111
+ RECENT_OUTPUT_LINES: 3
112
+ };
113
+ var DETECTION_PATTERNS = {
114
+ LISTENER: /-(?:lvnp|nlvp|lp|p)\s+(\d+)/,
115
+ HTTP_SERVER: /(?:http\.server|SimpleHTTPServer)\s+(\d+)/,
116
+ GENERIC_PORT: /-(?:p|port|S)\s+(?:\S+:)?(\d+)/,
117
+ CONNECTION: [
118
+ /connection\s+from/i,
119
+ /connect\s+to/i,
120
+ /\$\s*$/m,
121
+ /#\s*$/m,
122
+ /bash-\d/i,
123
+ /sh-\d/i,
124
+ /www-data/i
125
+ ]
126
+ };
127
+ var ORPHAN_PROCESS_NAMES = [
128
+ "arpspoof",
129
+ "ettercap",
130
+ "mitmdump",
131
+ "mitmproxy",
132
+ "dnsspoof",
133
+ "tcpdump",
134
+ "tshark",
135
+ "socat"
136
+ ];
137
+
138
+ // src/engine/process/process-registry.ts
139
+ var backgroundProcesses = /* @__PURE__ */ new Map();
140
+ var processEventLog = [];
141
+ function logEvent(processId, event, detail) {
142
+ processEventLog.push({ timestamp: Date.now(), processId, event, detail });
143
+ if (processEventLog.length > SYSTEM_LIMITS.MAX_EVENT_LOG) {
144
+ processEventLog.splice(0, processEventLog.length - SYSTEM_LIMITS.MAX_EVENT_LOG);
145
+ }
146
+ }
147
+ function getProcess(processId) {
148
+ return backgroundProcesses.get(processId);
149
+ }
150
+ function setProcess(processId, process) {
151
+ backgroundProcesses.set(processId, process);
152
+ }
153
+ function deleteProcess(processId) {
154
+ return backgroundProcesses.delete(processId);
155
+ }
156
+ function hasProcess(processId) {
157
+ return backgroundProcesses.has(processId);
158
+ }
159
+ function getAllProcessIds() {
160
+ return Array.from(backgroundProcesses.keys());
161
+ }
162
+ function getAllProcesses() {
163
+ return backgroundProcesses.values();
164
+ }
165
+ function getProcessEntries() {
166
+ return backgroundProcesses.entries();
167
+ }
168
+ function getProcessCount() {
169
+ return backgroundProcesses.size;
170
+ }
171
+ function clearAllProcesses() {
172
+ backgroundProcesses.clear();
173
+ }
174
+ function getProcessEventLog() {
175
+ return [...processEventLog];
176
+ }
177
+ function getBackgroundProcessesMap() {
178
+ return backgroundProcesses;
179
+ }
180
+
181
+ export {
182
+ __require,
183
+ EXIT_CODES,
184
+ PROCESS_ACTIONS,
185
+ PROCESS_ROLES,
186
+ PROCESS_ICONS,
187
+ STATUS_MARKERS,
188
+ PROCESS_EVENTS,
189
+ SYSTEM_LIMITS,
190
+ DETECTION_PATTERNS,
191
+ ORPHAN_PROCESS_NAMES,
192
+ logEvent,
193
+ getProcess,
194
+ setProcess,
195
+ deleteProcess,
196
+ hasProcess,
197
+ getAllProcessIds,
198
+ getAllProcesses,
199
+ getProcessEntries,
200
+ getProcessCount,
201
+ clearAllProcesses,
202
+ getProcessEventLog,
203
+ getBackgroundProcessesMap
204
+ };