(segment: string)
| 297 | } |
| 298 | |
| 299 | function nestedShellPayload(segment: string): string | undefined { |
| 300 | const head = /^\S*/.exec(segment)![0]; |
| 301 | for (const shell of NESTED_SHELL_HEADS) { |
| 302 | if (!shell.head.test(head)) continue; |
| 303 | const match = shell.flag.exec(segment); |
| 304 | if (!match) return undefined; |
| 305 | const payload = match[1]!.trim(); |
| 306 | const unquoted = /^(['"])([\s\S]*)\1$/.exec(payload); |
| 307 | return unquoted ? unquoted[2] : payload; |
| 308 | } |
| 309 | return undefined; |
| 310 | } |
| 311 | |
| 312 | function isPrivilegedSegment(segment: string): boolean { |
| 313 | const lower = segment.toLowerCase(); |
no test coverage detected