typescript-virtual-container 1.5.1 → 1.5.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.
- package/.vscode/settings.json +2 -2
- package/README.md +34 -28
- package/build.js +22 -0
- package/builds/{fortune-nyx-v1.5.1-directbash-k6.1.0.mjs → fortune-nyx-v1.5.3-directbash-k6.1.0.mjs} +187 -191
- package/builds/{fortune-nyx-v1.5.1-ssh-nosftp.js → fortune-nyx-v1.5.3-ssh-nosftp.js} +214 -218
- package/builds/{fortune-nyx-v1.5.1-ssh.cjs → fortune-nyx-v1.5.3-ssh.cjs} +142 -146
- package/builds/fortune-nyx-v1.5.3-web.min.js +17036 -0
- package/bun.lock +74 -0
- package/dist/Honeypot/index.d.ts +0 -1
- package/dist/Honeypot/index.js +0 -1
- package/dist/SSHClient/index.d.ts +0 -1
- package/dist/SSHClient/index.js +0 -1
- package/dist/SSHMimic/exec.d.ts +0 -1
- package/dist/SSHMimic/exec.js +0 -1
- package/dist/SSHMimic/executor.d.ts +0 -1
- package/dist/SSHMimic/executor.js +0 -1
- package/dist/SSHMimic/hostKey.d.ts +0 -1
- package/dist/SSHMimic/hostKey.js +0 -1
- package/dist/SSHMimic/index.d.ts +0 -1
- package/dist/SSHMimic/index.js +0 -1
- package/dist/SSHMimic/loginBanner.d.ts +0 -1
- package/dist/SSHMimic/loginBanner.js +0 -1
- package/dist/SSHMimic/loginFormat.d.ts +0 -1
- package/dist/SSHMimic/loginFormat.js +0 -1
- package/dist/SSHMimic/prompt.d.ts +0 -1
- package/dist/SSHMimic/prompt.js +0 -1
- package/dist/SSHMimic/sftp.d.ts +0 -1
- package/dist/SSHMimic/sftp.js +0 -1
- package/dist/VirtualFileSystem/binaryPack.d.ts +0 -1
- package/dist/VirtualFileSystem/binaryPack.js +0 -1
- package/dist/VirtualFileSystem/index.d.ts +0 -1
- package/dist/VirtualFileSystem/index.js +0 -1
- package/dist/VirtualFileSystem/internalTypes.d.ts +0 -1
- package/dist/VirtualFileSystem/internalTypes.js +0 -1
- package/dist/VirtualFileSystem/journal.d.ts +0 -1
- package/dist/VirtualFileSystem/journal.js +0 -1
- package/dist/VirtualFileSystem/path.d.ts +0 -1
- package/dist/VirtualFileSystem/path.js +0 -1
- package/dist/VirtualPackageManager/index.d.ts +0 -1
- package/dist/VirtualPackageManager/index.js +3 -14
- package/dist/VirtualShell/idleManager.d.ts +0 -1
- package/dist/VirtualShell/idleManager.js +0 -1
- package/dist/VirtualShell/index.d.ts +3 -2
- package/dist/VirtualShell/index.js +4 -2
- package/dist/VirtualShell/shell.d.ts +0 -1
- package/dist/VirtualShell/shell.js +0 -1
- package/dist/VirtualShell/shellParser.d.ts +0 -1
- package/dist/VirtualShell/shellParser.js +0 -1
- package/dist/VirtualUserManager/index.d.ts +0 -1
- package/dist/VirtualUserManager/index.js +0 -1
- package/dist/commands/adduser.d.ts +0 -1
- package/dist/commands/adduser.js +0 -1
- package/dist/commands/alias.d.ts +0 -1
- package/dist/commands/alias.js +0 -1
- package/dist/commands/apt.d.ts +0 -1
- package/dist/commands/apt.js +0 -1
- package/dist/commands/awk.d.ts +0 -1
- package/dist/commands/awk.js +0 -1
- package/dist/commands/base64.d.ts +0 -1
- package/dist/commands/base64.js +0 -1
- package/dist/commands/cat.d.ts +0 -1
- package/dist/commands/cat.js +0 -1
- package/dist/commands/cd.d.ts +0 -1
- package/dist/commands/cd.js +0 -1
- package/dist/commands/chmod.d.ts +0 -1
- package/dist/commands/chmod.js +0 -1
- package/dist/commands/clear.d.ts +0 -1
- package/dist/commands/clear.js +0 -1
- package/dist/commands/command-helpers.d.ts +0 -1
- package/dist/commands/command-helpers.js +0 -1
- package/dist/commands/cp.d.ts +0 -1
- package/dist/commands/cp.js +0 -1
- package/dist/commands/curl.d.ts +0 -1
- package/dist/commands/curl.js +0 -1
- package/dist/commands/cut.d.ts +0 -1
- package/dist/commands/cut.js +0 -1
- package/dist/commands/date.d.ts +0 -1
- package/dist/commands/date.js +0 -1
- package/dist/commands/declare.d.ts +0 -1
- package/dist/commands/declare.js +0 -1
- package/dist/commands/deluser.d.ts +0 -1
- package/dist/commands/deluser.js +0 -1
- package/dist/commands/df.d.ts +0 -1
- package/dist/commands/df.js +0 -1
- package/dist/commands/diff.d.ts +0 -1
- package/dist/commands/diff.js +0 -1
- package/dist/commands/dpkg.d.ts +0 -1
- package/dist/commands/dpkg.js +0 -1
- package/dist/commands/du.d.ts +0 -1
- package/dist/commands/du.js +0 -1
- package/dist/commands/echo.d.ts +0 -1
- package/dist/commands/echo.js +0 -1
- package/dist/commands/env.d.ts +0 -1
- package/dist/commands/env.js +0 -1
- package/dist/commands/exit.d.ts +0 -1
- package/dist/commands/exit.js +0 -1
- package/dist/commands/export.d.ts +0 -1
- package/dist/commands/export.js +0 -1
- package/dist/commands/find.d.ts +0 -1
- package/dist/commands/find.js +0 -1
- package/dist/commands/free.d.ts +0 -1
- package/dist/commands/free.js +0 -1
- package/dist/commands/grep.d.ts +0 -1
- package/dist/commands/grep.js +0 -1
- package/dist/commands/groups.d.ts +0 -1
- package/dist/commands/groups.js +0 -1
- package/dist/commands/gzip.d.ts +0 -1
- package/dist/commands/gzip.js +0 -1
- package/dist/commands/head.d.ts +0 -1
- package/dist/commands/head.js +0 -1
- package/dist/commands/help.d.ts +0 -1
- package/dist/commands/help.js +0 -1
- package/dist/commands/helpers.d.ts +0 -1
- package/dist/commands/helpers.js +0 -1
- package/dist/commands/history.d.ts +0 -1
- package/dist/commands/history.js +0 -1
- package/dist/commands/hostname.d.ts +0 -1
- package/dist/commands/hostname.js +0 -1
- package/dist/commands/htop.d.ts +0 -1
- package/dist/commands/htop.js +0 -1
- package/dist/commands/id.d.ts +0 -1
- package/dist/commands/id.js +0 -1
- package/dist/commands/index.d.ts +0 -1
- package/dist/commands/index.js +0 -1
- package/dist/commands/kill.d.ts +0 -1
- package/dist/commands/kill.js +0 -1
- package/dist/commands/ln.d.ts +0 -1
- package/dist/commands/ln.js +0 -1
- package/dist/commands/ls.d.ts +0 -1
- package/dist/commands/ls.js +0 -1
- package/dist/commands/lsb-release.d.ts +0 -1
- package/dist/commands/lsb-release.js +0 -1
- package/dist/commands/man.d.ts +0 -1
- package/dist/commands/man.js +0 -1
- package/dist/commands/manuals-bundle.d.ts +0 -1
- package/dist/commands/manuals-bundle.js +0 -1
- package/dist/commands/mkdir.d.ts +0 -1
- package/dist/commands/mkdir.js +0 -1
- package/dist/commands/mv.d.ts +0 -1
- package/dist/commands/mv.js +0 -1
- package/dist/commands/nano.d.ts +0 -1
- package/dist/commands/nano.js +0 -1
- package/dist/commands/neofetch.d.ts +0 -1
- package/dist/commands/neofetch.js +0 -1
- package/dist/commands/node.d.ts +0 -1
- package/dist/commands/node.js +0 -1
- package/dist/commands/npm.d.ts +0 -1
- package/dist/commands/npm.js +0 -1
- package/dist/commands/passwd.d.ts +0 -1
- package/dist/commands/passwd.js +0 -1
- package/dist/commands/ping.d.ts +0 -1
- package/dist/commands/ping.js +0 -1
- package/dist/commands/printf.d.ts +0 -1
- package/dist/commands/printf.js +0 -1
- package/dist/commands/ps.d.ts +0 -1
- package/dist/commands/ps.js +0 -1
- package/dist/commands/pwd.d.ts +0 -1
- package/dist/commands/pwd.js +0 -1
- package/dist/commands/python.d.ts +0 -1
- package/dist/commands/python.js +0 -1
- package/dist/commands/read.d.ts +0 -1
- package/dist/commands/read.js +0 -1
- package/dist/commands/registry.d.ts +0 -1
- package/dist/commands/registry.js +0 -1
- package/dist/commands/rm.d.ts +0 -1
- package/dist/commands/rm.js +0 -1
- package/dist/commands/runtime.d.ts +0 -1
- package/dist/commands/runtime.js +139 -107
- package/dist/commands/sed.d.ts +0 -1
- package/dist/commands/sed.js +0 -1
- package/dist/commands/seq.d.ts +0 -1
- package/dist/commands/seq.js +0 -1
- package/dist/commands/set.d.ts +0 -1
- package/dist/commands/set.js +0 -1
- package/dist/commands/sh.d.ts +0 -1
- package/dist/commands/sh.js +0 -1
- package/dist/commands/shift.d.ts +0 -1
- package/dist/commands/shift.js +0 -1
- package/dist/commands/sleep.d.ts +0 -1
- package/dist/commands/sleep.js +0 -1
- package/dist/commands/sort.d.ts +0 -1
- package/dist/commands/sort.js +0 -1
- package/dist/commands/source.d.ts +0 -1
- package/dist/commands/source.js +0 -1
- package/dist/commands/stat.d.ts +0 -1
- package/dist/commands/stat.js +0 -1
- package/dist/commands/su.d.ts +0 -1
- package/dist/commands/su.js +0 -1
- package/dist/commands/sudo.d.ts +0 -1
- package/dist/commands/sudo.js +0 -1
- package/dist/commands/tail.d.ts +0 -1
- package/dist/commands/tail.js +0 -1
- package/dist/commands/tar.d.ts +0 -1
- package/dist/commands/tar.js +0 -1
- package/dist/commands/tee.d.ts +0 -1
- package/dist/commands/tee.js +0 -1
- package/dist/commands/test.d.ts +0 -1
- package/dist/commands/test.js +0 -1
- package/dist/commands/touch.d.ts +0 -1
- package/dist/commands/touch.js +0 -1
- package/dist/commands/tr.d.ts +0 -1
- package/dist/commands/tr.js +0 -1
- package/dist/commands/tree.d.ts +0 -1
- package/dist/commands/tree.js +0 -1
- package/dist/commands/true.d.ts +0 -1
- package/dist/commands/true.js +0 -1
- package/dist/commands/type.d.ts +0 -1
- package/dist/commands/type.js +0 -1
- package/dist/commands/uname.d.ts +0 -1
- package/dist/commands/uname.js +0 -1
- package/dist/commands/uniq.d.ts +0 -1
- package/dist/commands/uniq.js +0 -1
- package/dist/commands/unset.d.ts +0 -1
- package/dist/commands/unset.js +0 -1
- package/dist/commands/uptime.d.ts +0 -1
- package/dist/commands/uptime.js +0 -1
- package/dist/commands/wc.d.ts +0 -1
- package/dist/commands/wc.js +0 -1
- package/dist/commands/wget.d.ts +0 -1
- package/dist/commands/wget.js +0 -1
- package/dist/commands/which.d.ts +0 -1
- package/dist/commands/which.js +0 -1
- package/dist/commands/who.d.ts +0 -1
- package/dist/commands/who.js +0 -1
- package/dist/commands/whoami.d.ts +0 -1
- package/dist/commands/whoami.js +0 -1
- package/dist/commands/xargs.d.ts +0 -1
- package/dist/commands/xargs.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/modules/linuxRootfs.d.ts +0 -1
- package/dist/modules/linuxRootfs.js +0 -1
- package/dist/modules/neofetch.d.ts +0 -1
- package/dist/modules/neofetch.js +0 -1
- package/dist/modules/shellInteractive.d.ts +0 -1
- package/dist/modules/shellInteractive.js +0 -1
- package/dist/modules/shellRuntime.d.ts +0 -1
- package/dist/modules/shellRuntime.js +0 -1
- package/dist/self-standalone.d.ts +0 -1
- package/dist/self-standalone.js +0 -1
- package/dist/standalone-wo-sftp.d.ts +0 -1
- package/dist/standalone-wo-sftp.js +0 -1
- package/dist/standalone.d.ts +0 -1
- package/dist/standalone.js +0 -1
- package/dist/types/commands.d.ts +0 -1
- package/dist/types/commands.js +0 -1
- package/dist/types/pipeline.d.ts +0 -1
- package/dist/types/pipeline.js +0 -1
- package/dist/types/streams.d.ts +0 -1
- package/dist/types/streams.js +0 -1
- package/dist/types/vfs.d.ts +0 -1
- package/dist/types/vfs.js +0 -1
- package/dist/utils/expand.d.ts +0 -1
- package/dist/utils/expand.js +0 -1
- package/dist/utils/perfLogger.d.ts +0 -1
- package/dist/utils/perfLogger.js +0 -1
- package/dist/utils/tokenize.d.ts +0 -1
- package/dist/utils/tokenize.js +0 -1
- package/dist/utils/vfsDiff.d.ts +0 -1
- package/dist/utils/vfsDiff.js +0 -1
- package/docs/app.js +1751 -0
- package/docs/classes/HoneyPot.html +17 -17
- package/docs/classes/IdleManager.html +8 -8
- package/docs/classes/SshClient.html +34 -34
- package/docs/classes/VirtualFileSystem.html +38 -38
- package/docs/classes/VirtualPackageManager.html +19 -19
- package/docs/classes/VirtualSftpServer.html +3 -3
- package/docs/classes/VirtualShell.html +41 -40
- package/docs/classes/VirtualSshServer.html +8 -8
- package/docs/classes/VirtualUserManager.html +32 -32
- package/docs/demo.html +82 -0
- package/docs/functions/assertDiff.html +3 -3
- package/docs/functions/diffSnapshots.html +5 -5
- package/docs/functions/formatDiff.html +3 -3
- package/docs/functions/getArg.html +3 -3
- package/docs/functions/getFlag.html +2 -2
- package/docs/functions/ifFlag.html +2 -2
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +41 -19
- package/docs/interfaces/AuditLogEntry.html +3 -3
- package/docs/interfaces/CommandContext.html +13 -13
- package/docs/interfaces/CommandResult.html +13 -13
- package/docs/interfaces/ExecStream.html +6 -6
- package/docs/interfaces/HoneyPotStats.html +3 -3
- package/docs/interfaces/IdleManagerOptions.html +3 -3
- package/docs/interfaces/InstalledPackage.html +11 -11
- package/docs/interfaces/NanoEditorSession.html +5 -5
- package/docs/interfaces/PackageDefinition.html +14 -14
- package/docs/interfaces/PackageFile.html +5 -5
- package/docs/interfaces/PasswordChallenge.html +9 -9
- package/docs/interfaces/RemoveOptions.html +3 -3
- package/docs/interfaces/ShellEnv.html +4 -4
- package/docs/interfaces/ShellModule.html +8 -8
- package/docs/interfaces/ShellProperties.html +5 -5
- package/docs/interfaces/ShellStream.html +7 -7
- package/docs/interfaces/SudoChallenge.html +9 -9
- package/docs/interfaces/VfsBaseNode.html +7 -7
- package/docs/interfaces/VfsDiff.html +7 -7
- package/docs/interfaces/VfsDiffEntry.html +4 -4
- package/docs/interfaces/VfsDiffModified.html +6 -6
- package/docs/interfaces/VfsDirectoryNode.html +8 -8
- package/docs/interfaces/VfsFileNode.html +9 -9
- package/docs/interfaces/VfsOptions.html +6 -6
- package/docs/interfaces/VfsSnapshot.html +3 -3
- package/docs/interfaces/VfsSnapshotBaseNode.html +4 -4
- package/docs/interfaces/VfsSnapshotDirectoryNode.html +5 -5
- package/docs/interfaces/VfsSnapshotFileNode.html +6 -6
- package/docs/interfaces/VirtualActiveSession.html +7 -7
- package/docs/interfaces/VirtualSftpServerOptions.html +3 -3
- package/docs/interfaces/VirtualShellVfsLike.html +4 -4
- package/docs/interfaces/VirtualShellVfsOptions.html +3 -3
- package/docs/interfaces/WriteFileOptions.html +4 -4
- package/docs/modules.html +1 -1
- package/docs/types/ArgParseOptions.html +3 -3
- package/docs/types/CommandMode.html +2 -2
- package/docs/types/CommandOutcome.html +2 -2
- package/docs/types/IdleState.html +1 -1
- package/docs/types/VfsNodeStats.html +2 -2
- package/docs/types/VfsNodeType.html +2 -2
- package/docs/types/VfsPersistenceMode.html +2 -2
- package/docs/types/VfsSnapshotNode.html +2 -2
- package/examples/app.js +1751 -28
- package/examples/app.ts +299 -0
- package/examples/build.js +27 -0
- package/examples/demo.html +33 -0
- package/examples/index.html +68 -13
- package/package.json +3 -2
- package/polyfills/buffer.js +117 -0
- package/polyfills/node_crypto/index.js +167 -7
- package/polyfills/node_fs/index.js +202 -8
- package/polyfills/node_path/index.js +23 -9
- package/polyfills/process.js +14 -0
- package/polyfills/ssh2/index.js +75 -0
- package/scripts/build-all.mjs +77 -49
- package/scripts/build-names.mjs +2 -3
- package/src/VirtualPackageManager/index.ts +4 -15
- package/src/VirtualShell/index.ts +5 -2
- package/src/commands/runtime.ts +44 -1
- package/tsconfig.json +6 -3
- package/typedoc.json +4 -2
- package/builds/fortune-nyx-v1.5.1-web-full.min.js +0 -12
- package/builds/fortune-nyx-v1.5.1-web.min.js +0 -12
- package/dist/Honeypot/index.d.ts.map +0 -1
- package/dist/Honeypot/index.js.map +0 -1
- package/dist/SSHClient/index.d.ts.map +0 -1
- package/dist/SSHClient/index.js.map +0 -1
- package/dist/SSHMimic/exec.d.ts.map +0 -1
- package/dist/SSHMimic/exec.js.map +0 -1
- package/dist/SSHMimic/executor.d.ts.map +0 -1
- package/dist/SSHMimic/executor.js.map +0 -1
- package/dist/SSHMimic/hostKey.d.ts.map +0 -1
- package/dist/SSHMimic/hostKey.js.map +0 -1
- package/dist/SSHMimic/index.d.ts.map +0 -1
- package/dist/SSHMimic/index.js.map +0 -1
- package/dist/SSHMimic/loginBanner.d.ts.map +0 -1
- package/dist/SSHMimic/loginBanner.js.map +0 -1
- package/dist/SSHMimic/loginFormat.d.ts.map +0 -1
- package/dist/SSHMimic/loginFormat.js.map +0 -1
- package/dist/SSHMimic/prompt.d.ts.map +0 -1
- package/dist/SSHMimic/prompt.js.map +0 -1
- package/dist/SSHMimic/sftp.d.ts.map +0 -1
- package/dist/SSHMimic/sftp.js.map +0 -1
- package/dist/VirtualFileSystem/binaryPack.d.ts.map +0 -1
- package/dist/VirtualFileSystem/binaryPack.js.map +0 -1
- package/dist/VirtualFileSystem/index.d.ts.map +0 -1
- package/dist/VirtualFileSystem/index.js.map +0 -1
- package/dist/VirtualFileSystem/internalTypes.d.ts.map +0 -1
- package/dist/VirtualFileSystem/internalTypes.js.map +0 -1
- package/dist/VirtualFileSystem/journal.d.ts.map +0 -1
- package/dist/VirtualFileSystem/journal.js.map +0 -1
- package/dist/VirtualFileSystem/path.d.ts.map +0 -1
- package/dist/VirtualFileSystem/path.js.map +0 -1
- package/dist/VirtualPackageManager/index.d.ts.map +0 -1
- package/dist/VirtualPackageManager/index.js.map +0 -1
- package/dist/VirtualShell/idleManager.d.ts.map +0 -1
- package/dist/VirtualShell/idleManager.js.map +0 -1
- package/dist/VirtualShell/index.d.ts.map +0 -1
- package/dist/VirtualShell/index.js.map +0 -1
- package/dist/VirtualShell/shell.d.ts.map +0 -1
- package/dist/VirtualShell/shell.js.map +0 -1
- package/dist/VirtualShell/shellParser.d.ts.map +0 -1
- package/dist/VirtualShell/shellParser.js.map +0 -1
- package/dist/VirtualUserManager/index.d.ts.map +0 -1
- package/dist/VirtualUserManager/index.js.map +0 -1
- package/dist/commands/adduser.d.ts.map +0 -1
- package/dist/commands/adduser.js.map +0 -1
- package/dist/commands/alias.d.ts.map +0 -1
- package/dist/commands/alias.js.map +0 -1
- package/dist/commands/apt.d.ts.map +0 -1
- package/dist/commands/apt.js.map +0 -1
- package/dist/commands/awk.d.ts.map +0 -1
- package/dist/commands/awk.js.map +0 -1
- package/dist/commands/base64.d.ts.map +0 -1
- package/dist/commands/base64.js.map +0 -1
- package/dist/commands/cat.d.ts.map +0 -1
- package/dist/commands/cat.js.map +0 -1
- package/dist/commands/cd.d.ts.map +0 -1
- package/dist/commands/cd.js.map +0 -1
- package/dist/commands/chmod.d.ts.map +0 -1
- package/dist/commands/chmod.js.map +0 -1
- package/dist/commands/clear.d.ts.map +0 -1
- package/dist/commands/clear.js.map +0 -1
- package/dist/commands/command-helpers.d.ts.map +0 -1
- package/dist/commands/command-helpers.js.map +0 -1
- package/dist/commands/cp.d.ts.map +0 -1
- package/dist/commands/cp.js.map +0 -1
- package/dist/commands/curl.d.ts.map +0 -1
- package/dist/commands/curl.js.map +0 -1
- package/dist/commands/cut.d.ts.map +0 -1
- package/dist/commands/cut.js.map +0 -1
- package/dist/commands/date.d.ts.map +0 -1
- package/dist/commands/date.js.map +0 -1
- package/dist/commands/declare.d.ts.map +0 -1
- package/dist/commands/declare.js.map +0 -1
- package/dist/commands/deluser.d.ts.map +0 -1
- package/dist/commands/deluser.js.map +0 -1
- package/dist/commands/df.d.ts.map +0 -1
- package/dist/commands/df.js.map +0 -1
- package/dist/commands/diff.d.ts.map +0 -1
- package/dist/commands/diff.js.map +0 -1
- package/dist/commands/dpkg.d.ts.map +0 -1
- package/dist/commands/dpkg.js.map +0 -1
- package/dist/commands/du.d.ts.map +0 -1
- package/dist/commands/du.js.map +0 -1
- package/dist/commands/echo.d.ts.map +0 -1
- package/dist/commands/echo.js.map +0 -1
- package/dist/commands/env.d.ts.map +0 -1
- package/dist/commands/env.js.map +0 -1
- package/dist/commands/exit.d.ts.map +0 -1
- package/dist/commands/exit.js.map +0 -1
- package/dist/commands/export.d.ts.map +0 -1
- package/dist/commands/export.js.map +0 -1
- package/dist/commands/find.d.ts.map +0 -1
- package/dist/commands/find.js.map +0 -1
- package/dist/commands/free.d.ts.map +0 -1
- package/dist/commands/free.js.map +0 -1
- package/dist/commands/grep.d.ts.map +0 -1
- package/dist/commands/grep.js.map +0 -1
- package/dist/commands/groups.d.ts.map +0 -1
- package/dist/commands/groups.js.map +0 -1
- package/dist/commands/gzip.d.ts.map +0 -1
- package/dist/commands/gzip.js.map +0 -1
- package/dist/commands/head.d.ts.map +0 -1
- package/dist/commands/head.js.map +0 -1
- package/dist/commands/help.d.ts.map +0 -1
- package/dist/commands/help.js.map +0 -1
- package/dist/commands/helpers.d.ts.map +0 -1
- package/dist/commands/helpers.js.map +0 -1
- package/dist/commands/history.d.ts.map +0 -1
- package/dist/commands/history.js.map +0 -1
- package/dist/commands/hostname.d.ts.map +0 -1
- package/dist/commands/hostname.js.map +0 -1
- package/dist/commands/htop.d.ts.map +0 -1
- package/dist/commands/htop.js.map +0 -1
- package/dist/commands/id.d.ts.map +0 -1
- package/dist/commands/id.js.map +0 -1
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/kill.d.ts.map +0 -1
- package/dist/commands/kill.js.map +0 -1
- package/dist/commands/ln.d.ts.map +0 -1
- package/dist/commands/ln.js.map +0 -1
- package/dist/commands/ls.d.ts.map +0 -1
- package/dist/commands/ls.js.map +0 -1
- package/dist/commands/lsb-release.d.ts.map +0 -1
- package/dist/commands/lsb-release.js.map +0 -1
- package/dist/commands/man.d.ts.map +0 -1
- package/dist/commands/man.js.map +0 -1
- package/dist/commands/manuals-bundle.d.ts.map +0 -1
- package/dist/commands/manuals-bundle.js.map +0 -1
- package/dist/commands/mkdir.d.ts.map +0 -1
- package/dist/commands/mkdir.js.map +0 -1
- package/dist/commands/mv.d.ts.map +0 -1
- package/dist/commands/mv.js.map +0 -1
- package/dist/commands/nano.d.ts.map +0 -1
- package/dist/commands/nano.js.map +0 -1
- package/dist/commands/neofetch.d.ts.map +0 -1
- package/dist/commands/neofetch.js.map +0 -1
- package/dist/commands/node.d.ts.map +0 -1
- package/dist/commands/node.js.map +0 -1
- package/dist/commands/npm.d.ts.map +0 -1
- package/dist/commands/npm.js.map +0 -1
- package/dist/commands/passwd.d.ts.map +0 -1
- package/dist/commands/passwd.js.map +0 -1
- package/dist/commands/ping.d.ts.map +0 -1
- package/dist/commands/ping.js.map +0 -1
- package/dist/commands/printf.d.ts.map +0 -1
- package/dist/commands/printf.js.map +0 -1
- package/dist/commands/ps.d.ts.map +0 -1
- package/dist/commands/ps.js.map +0 -1
- package/dist/commands/pwd.d.ts.map +0 -1
- package/dist/commands/pwd.js.map +0 -1
- package/dist/commands/python.d.ts.map +0 -1
- package/dist/commands/python.js.map +0 -1
- package/dist/commands/read.d.ts.map +0 -1
- package/dist/commands/read.js.map +0 -1
- package/dist/commands/registry.d.ts.map +0 -1
- package/dist/commands/registry.js.map +0 -1
- package/dist/commands/rm.d.ts.map +0 -1
- package/dist/commands/rm.js.map +0 -1
- package/dist/commands/runtime.d.ts.map +0 -1
- package/dist/commands/runtime.js.map +0 -1
- package/dist/commands/sed.d.ts.map +0 -1
- package/dist/commands/sed.js.map +0 -1
- package/dist/commands/seq.d.ts.map +0 -1
- package/dist/commands/seq.js.map +0 -1
- package/dist/commands/set.d.ts.map +0 -1
- package/dist/commands/set.js.map +0 -1
- package/dist/commands/sh.d.ts.map +0 -1
- package/dist/commands/sh.js.map +0 -1
- package/dist/commands/shift.d.ts.map +0 -1
- package/dist/commands/shift.js.map +0 -1
- package/dist/commands/sleep.d.ts.map +0 -1
- package/dist/commands/sleep.js.map +0 -1
- package/dist/commands/sort.d.ts.map +0 -1
- package/dist/commands/sort.js.map +0 -1
- package/dist/commands/source.d.ts.map +0 -1
- package/dist/commands/source.js.map +0 -1
- package/dist/commands/stat.d.ts.map +0 -1
- package/dist/commands/stat.js.map +0 -1
- package/dist/commands/su.d.ts.map +0 -1
- package/dist/commands/su.js.map +0 -1
- package/dist/commands/sudo.d.ts.map +0 -1
- package/dist/commands/sudo.js.map +0 -1
- package/dist/commands/tail.d.ts.map +0 -1
- package/dist/commands/tail.js.map +0 -1
- package/dist/commands/tar.d.ts.map +0 -1
- package/dist/commands/tar.js.map +0 -1
- package/dist/commands/tee.d.ts.map +0 -1
- package/dist/commands/tee.js.map +0 -1
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/test.js.map +0 -1
- package/dist/commands/touch.d.ts.map +0 -1
- package/dist/commands/touch.js.map +0 -1
- package/dist/commands/tr.d.ts.map +0 -1
- package/dist/commands/tr.js.map +0 -1
- package/dist/commands/tree.d.ts.map +0 -1
- package/dist/commands/tree.js.map +0 -1
- package/dist/commands/true.d.ts.map +0 -1
- package/dist/commands/true.js.map +0 -1
- package/dist/commands/type.d.ts.map +0 -1
- package/dist/commands/type.js.map +0 -1
- package/dist/commands/uname.d.ts.map +0 -1
- package/dist/commands/uname.js.map +0 -1
- package/dist/commands/uniq.d.ts.map +0 -1
- package/dist/commands/uniq.js.map +0 -1
- package/dist/commands/unset.d.ts.map +0 -1
- package/dist/commands/unset.js.map +0 -1
- package/dist/commands/uptime.d.ts.map +0 -1
- package/dist/commands/uptime.js.map +0 -1
- package/dist/commands/wc.d.ts.map +0 -1
- package/dist/commands/wc.js.map +0 -1
- package/dist/commands/wget.d.ts.map +0 -1
- package/dist/commands/wget.js.map +0 -1
- package/dist/commands/which.d.ts.map +0 -1
- package/dist/commands/which.js.map +0 -1
- package/dist/commands/who.d.ts.map +0 -1
- package/dist/commands/who.js.map +0 -1
- package/dist/commands/whoami.d.ts.map +0 -1
- package/dist/commands/whoami.js.map +0 -1
- package/dist/commands/xargs.d.ts.map +0 -1
- package/dist/commands/xargs.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/modules/linuxRootfs.d.ts.map +0 -1
- package/dist/modules/linuxRootfs.js.map +0 -1
- package/dist/modules/neofetch.d.ts.map +0 -1
- package/dist/modules/neofetch.js.map +0 -1
- package/dist/modules/shellInteractive.d.ts.map +0 -1
- package/dist/modules/shellInteractive.js.map +0 -1
- package/dist/modules/shellRuntime.d.ts.map +0 -1
- package/dist/modules/shellRuntime.js.map +0 -1
- package/dist/self-standalone.d.ts.map +0 -1
- package/dist/self-standalone.js.map +0 -1
- package/dist/standalone-wo-sftp.d.ts.map +0 -1
- package/dist/standalone-wo-sftp.js.map +0 -1
- package/dist/standalone.d.ts.map +0 -1
- package/dist/standalone.js.map +0 -1
- package/dist/types/commands.d.ts.map +0 -1
- package/dist/types/commands.js.map +0 -1
- package/dist/types/pipeline.d.ts.map +0 -1
- package/dist/types/pipeline.js.map +0 -1
- package/dist/types/streams.d.ts.map +0 -1
- package/dist/types/streams.js.map +0 -1
- package/dist/types/vfs.d.ts.map +0 -1
- package/dist/types/vfs.js.map +0 -1
- package/dist/utils/expand.d.ts.map +0 -1
- package/dist/utils/expand.js.map +0 -1
- package/dist/utils/perfLogger.d.ts.map +0 -1
- package/dist/utils/perfLogger.js.map +0 -1
- package/dist/utils/tokenize.d.ts.map +0 -1
- package/dist/utils/tokenize.js.map +0 -1
- package/dist/utils/vfsDiff.d.ts.map +0 -1
- package/dist/utils/vfsDiff.js.map +0 -1
- package/dist/web-api.d.ts +0 -26
- package/dist/web-api.d.ts.map +0 -1
- package/dist/web-api.js +0 -47
- package/dist/web-api.js.map +0 -1
- package/dist/web-full.d.ts +0 -4
- package/dist/web-full.d.ts.map +0 -1
- package/dist/web-full.js +0 -9
- package/dist/web-full.js.map +0 -1
- package/dist/web.d.ts +0 -108
- package/dist/web.d.ts.map +0 -1
- package/dist/web.js +0 -774
- package/dist/web.js.map +0 -1
- package/examples/app-iife.js +0 -58
- package/examples/index-cf.html +0 -27
- package/examples/web-iife.min.js +0 -13
- package/examples/web.min.js +0 -12
- package/src/web-api.ts +0 -62
- package/src/web-full.ts +0 -11
- package/src/web.ts +0 -930
- package/tests/web.test.ts +0 -182
package/scripts/build-all.mjs
CHANGED
|
@@ -10,12 +10,11 @@
|
|
|
10
10
|
* 5. update README.md — replace filenames in marked sections
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { execSync }
|
|
13
|
+
import { execSync } from "node:child_process";
|
|
14
14
|
import { copyFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
15
|
-
import { join }
|
|
15
|
+
import { dirname, join } from "node:path";
|
|
16
16
|
import { fileURLToPath } from "node:url";
|
|
17
17
|
import { BUILDS_DIR, NAMES } from "./build-names.mjs";
|
|
18
|
-
import { dirname } from "node:path";
|
|
19
18
|
|
|
20
19
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
21
20
|
const root = join(__dirname, "..");
|
|
@@ -35,7 +34,7 @@ run("node scripts/generate-manuals-bundle.mjs");
|
|
|
35
34
|
|
|
36
35
|
// ── 3. esbuild targets ───────────────────────────────────────────────────────
|
|
37
36
|
const ESBUILD = "bunx esbuild";
|
|
38
|
-
const BANNER
|
|
37
|
+
const BANNER = `--banner:js='#!/usr/bin/env node'`;
|
|
39
38
|
|
|
40
39
|
const targets = [
|
|
41
40
|
// self-standalone (ESM, interactive CLI)
|
|
@@ -49,44 +48,37 @@ const targets = [
|
|
|
49
48
|
// standalone SSH only (no SFTP)
|
|
50
49
|
`${ESBUILD} src/standalone-wo-sftp.ts --bundle --platform=node --target=node18 \
|
|
51
50
|
--outfile=${BUILDS_DIR}/${NAMES.standaloneNoSftp} --tree-shaking=true --minify ${BANNER}`,
|
|
52
|
-
|
|
53
|
-
// web shell (browser ESM)
|
|
54
|
-
`${ESBUILD} src/web.ts --bundle --platform=browser --format=esm --target=es2020 \
|
|
55
|
-
--outfile=${BUILDS_DIR}/${NAMES.web} --tree-shaking=true --minify`,
|
|
56
|
-
|
|
57
|
-
// web full API (browser ESM + node polyfills)
|
|
58
|
-
`${ESBUILD} src/web-api.ts --bundle --platform=browser --format=esm --target=es2020 \
|
|
59
|
-
--outfile=${BUILDS_DIR}/${NAMES.webFull} --tree-shaking=true --minify \
|
|
60
|
-
--alias:node:events=./polyfills/node_events/index.js \
|
|
61
|
-
--alias:node:path=./polyfills/node_path/index.js \
|
|
62
|
-
--alias:node:os=./polyfills/node_os/index.js \
|
|
63
|
-
--alias:node:fs=./polyfills/node_fs/index.js \
|
|
64
|
-
--alias:node:fs/promises=./polyfills/node_fs/promises.js \
|
|
65
|
-
--alias:node:crypto=./polyfills/node_crypto/index.js \
|
|
66
|
-
--alias:node:child_process=./polyfills/node_child_process/index.js \
|
|
67
|
-
--alias:node:zlib=./polyfills/node_zlib/index.js \
|
|
68
|
-
--alias:node:vm=./polyfills/node_vm/index.js`,
|
|
69
51
|
];
|
|
70
52
|
|
|
71
53
|
for (const cmd of targets) {
|
|
72
54
|
run(cmd.replace(/\s+/g, " ").trim());
|
|
73
55
|
}
|
|
74
56
|
|
|
75
|
-
// ── 4. Copy web to examples/ ─────────────────────────────────────────────────
|
|
76
|
-
const examplesDir = join(root, "examples");
|
|
77
|
-
mkdirSync(examplesDir, { recursive: true });
|
|
78
|
-
copyFileSync(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
);
|
|
82
|
-
console.log(`\n✓ Copied ${NAMES.web} → examples/web.min.js`);
|
|
83
|
-
|
|
84
|
-
// ──
|
|
57
|
+
// // ── 4. Copy web to examples/ ─────────────────────────────────────────────────
|
|
58
|
+
// const examplesDir = join(root, "examples");
|
|
59
|
+
// mkdirSync(examplesDir, { recursive: true });
|
|
60
|
+
// copyFileSync(
|
|
61
|
+
// join(BUILDS_DIR, NAMES.web),
|
|
62
|
+
// join(examplesDir, "web.min.js"),
|
|
63
|
+
// );
|
|
64
|
+
// console.log(`\n✓ Copied ${NAMES.web} → examples/web.min.js`);
|
|
65
|
+
|
|
66
|
+
// ── 4. Run build.js ───────────────────────────────────────────────────────────
|
|
67
|
+
run("node build.js");
|
|
68
|
+
|
|
69
|
+
// ── 5. Copy demo to docs/ ─────────────────────────────────────────────────────
|
|
70
|
+
const docsDir = join(root, "docs");
|
|
71
|
+
mkdirSync(docsDir, { recursive: true });
|
|
72
|
+
copyFileSync(join(root, "examples", "app.js"), join(docsDir, "app.js"));
|
|
73
|
+
copyFileSync(join(root, "examples", "index.html"), join(docsDir, "demo.html"));
|
|
74
|
+
console.log("\n✓ Copied examples/app.js → docs/app.js");
|
|
75
|
+
console.log("✓ Copied examples/index.html → docs/demo.html");
|
|
76
|
+
|
|
77
|
+
// ── 6. Update README.md ───────────────────────────────────────────────────────
|
|
85
78
|
const readmePath = join(root, "README.md");
|
|
86
79
|
let readme = readFileSync(readmePath, "utf8");
|
|
87
80
|
|
|
88
|
-
const { selfStandalone, standalone, standaloneNoSftp, web
|
|
89
|
-
const selfBase = selfStandalone.replace(".mjs", ""); // local filename without ext for the rm -f
|
|
81
|
+
const { selfStandalone, standalone, standaloneNoSftp, web } = NAMES;
|
|
90
82
|
|
|
91
83
|
// Helper: replace content between <!-- BUILD:tag --> and <!-- /BUILD:tag -->
|
|
92
84
|
function replaceSection(tag, content) {
|
|
@@ -99,26 +91,34 @@ function replaceSection(tag, content) {
|
|
|
99
91
|
|
|
100
92
|
// Overview table — web and selfStandalone filenames
|
|
101
93
|
replaceSection(
|
|
102
|
-
"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
94
|
+
"mode-table",
|
|
95
|
+
[
|
|
96
|
+
`| Mode | Entry point | Use case |`,
|
|
97
|
+
`|------|-------------|----------|`,
|
|
98
|
+
`| **SSH/SFTP server** | \`VirtualSshServer\` / \`VirtualSftpServer\` | Honeypots, remote testing, training environments |`,
|
|
99
|
+
`| **Web shell** | \`builds/${web}\` (ESM) | Embedded terminals, interactive tutorials, browser demos |`,
|
|
100
|
+
`| **Standalone CLI** | \`builds/${selfStandalone}\` (single file) | Local shell, one-liner demos, no install required |`,
|
|
101
|
+
].join("\n"),
|
|
108
102
|
);
|
|
109
103
|
|
|
110
104
|
// curl commands block
|
|
111
105
|
replaceSection(
|
|
112
106
|
"curl-start",
|
|
113
107
|
[
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
`#### Interactivea local shell — persists VFS in .vfs/ in the current directory`,
|
|
109
|
+
`\`\`\`bash`,
|
|
110
|
+
`curl -s ${GH_BASE}/${selfStandalone} -o ${selfStandalone} && node ${selfStandalone}`,
|
|
111
|
+
`\`\`\``,
|
|
116
112
|
``,
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
`#### SSH server (connect with any SSH client on port 2222)`,
|
|
114
|
+
`\`\`\`bash`,
|
|
115
|
+
`curl -s ${GH_BASE}/${standalone} -o ${standalone} && node ${standalone}`,
|
|
116
|
+
`\`\`\``,
|
|
119
117
|
``,
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
`#### SSH server without SFTP (lighter build)`,
|
|
119
|
+
`\`\`\`bash`,
|
|
120
|
+
`curl -s ${GH_BASE}/${standaloneNoSftp} -o ${standaloneNoSftp} && node ${standaloneNoSftp}`,
|
|
121
|
+
`\`\`\``,
|
|
122
122
|
].join("\n"),
|
|
123
123
|
);
|
|
124
124
|
|
|
@@ -141,8 +141,9 @@ replaceSection(
|
|
|
141
141
|
replaceSection(
|
|
142
142
|
"web-table",
|
|
143
143
|
[
|
|
144
|
+
`| Bundle | Format | Entry point | Use case |`,
|
|
145
|
+
`|--------|--------|-------------|----------|`,
|
|
144
146
|
`| \`builds/${web}\` | ESM | \`createWebShell()\` | Embedded terminals, modern bundlers |`,
|
|
145
|
-
`| \`builds/${webFull}\` | ESM | \`createVirtualShellShim()\` | Full \`VirtualShell\`-like API in the browser |`,
|
|
146
147
|
].join("\n"),
|
|
147
148
|
);
|
|
148
149
|
replaceSection(
|
|
@@ -164,11 +165,11 @@ replaceSection(
|
|
|
164
165
|
`</script>`,
|
|
165
166
|
`\`\`\``,
|
|
166
167
|
``,
|
|
167
|
-
`**\`${
|
|
168
|
+
`**\`${web}\`** — mirrors the \`VirtualShell\` programmatic API:`,
|
|
168
169
|
``,
|
|
169
170
|
`\`\`\`html`,
|
|
170
171
|
`<script type="module">`,
|
|
171
|
-
` import { createVirtualShellShim } from "./builds/${
|
|
172
|
+
` import { createVirtualShellShim } from "./builds/${web}";`,
|
|
172
173
|
``,
|
|
173
174
|
` const shell = createVirtualShellShim("web-vm");`,
|
|
174
175
|
` await shell.ensureInitialized();`,
|
|
@@ -183,7 +184,7 @@ replaceSection(
|
|
|
183
184
|
replaceSection(
|
|
184
185
|
"changelog",
|
|
185
186
|
[
|
|
186
|
-
`- [x] Web shell bundles (\`${web}
|
|
187
|
+
`- [x] Web shell bundles (\`${web}\`) — fully browser-native with IndexedDB VFS`,
|
|
187
188
|
`- [x] Self-standalone CLI (\`${selfStandalone}\`) — single-file interactive shell, per-user history, tab completion`,
|
|
188
189
|
].join("\n"),
|
|
189
190
|
);
|
|
@@ -191,6 +192,33 @@ replaceSection(
|
|
|
191
192
|
writeFileSync(readmePath, readme, "utf8");
|
|
192
193
|
console.log("✓ README.md updated with current build filenames");
|
|
193
194
|
|
|
195
|
+
|
|
196
|
+
// ── 7. Strip .html from internal links in docs/ ───────────────────────────────
|
|
197
|
+
// TypeDoc hardcodes .html — post-process all generated files to remove the
|
|
198
|
+
// extension so GitHub Pages serves clean URLs (e.g. /docs/classes/VirtualShell)
|
|
199
|
+
import { readdirSync } from "node:fs";
|
|
200
|
+
|
|
201
|
+
function stripHtmlExtensions(dir) {
|
|
202
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
203
|
+
const full = join(dir, entry.name);
|
|
204
|
+
if (entry.isDirectory()) {
|
|
205
|
+
stripHtmlExtensions(full);
|
|
206
|
+
} else if (entry.name.endsWith(".html")) {
|
|
207
|
+
let src = readFileSync(full, "utf8");
|
|
208
|
+
// Replace href="...something.html" and href="...something.html#anchor"
|
|
209
|
+
// Only relative links (no http/https)
|
|
210
|
+
src = src.replace(
|
|
211
|
+
/href="(?!https?:\/\/)([^"]*)\.html(#[^"]*)?"/g,
|
|
212
|
+
(_, path, hash) => `href="${path}${hash ?? ""}"`,
|
|
213
|
+
);
|
|
214
|
+
writeFileSync(full, src, "utf8");
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
stripHtmlExtensions(docsDir);
|
|
220
|
+
console.log("\n✓ Stripped .html from internal links in docs/");
|
|
221
|
+
|
|
194
222
|
// ── Summary ──────────────────────────────────────────────────────────────────
|
|
195
223
|
console.log("\n✅ Build complete:");
|
|
196
224
|
for (const [key, name] of Object.entries(NAMES)) {
|
package/scripts/build-names.mjs
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { readFileSync } from "node:fs";
|
|
12
|
+
import { dirname, join } from "node:path";
|
|
12
13
|
import { fileURLToPath } from "node:url";
|
|
13
|
-
import { join, dirname } from "node:path";
|
|
14
14
|
|
|
15
15
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
16
|
const root = join(__dirname, "..");
|
|
@@ -32,8 +32,7 @@ export const NAMES = {
|
|
|
32
32
|
selfStandalone: `fortune-nyx-v${pkgVersion}-directbash-${kernelVersion}.mjs`,
|
|
33
33
|
standalone: `fortune-nyx-v${pkgVersion}-ssh.cjs`,
|
|
34
34
|
standaloneNoSftp:`fortune-nyx-v${pkgVersion}-ssh-nosftp.js`,
|
|
35
|
-
web: `fortune-nyx-v${pkgVersion}-web.min.js
|
|
36
|
-
webFull: `fortune-nyx-v${pkgVersion}-web-full.min.js`,
|
|
35
|
+
web: `fortune-nyx-v${pkgVersion}-web.min.js`
|
|
37
36
|
};
|
|
38
37
|
|
|
39
38
|
// Print for shell consumption: NAME=value pairs
|
|
@@ -87,17 +87,6 @@ const PACKAGE_REGISTRY: PackageDefinition[] = [
|
|
|
87
87
|
shortDesc: "Vi IMproved",
|
|
88
88
|
installedSizeKb: 3812,
|
|
89
89
|
files: [
|
|
90
|
-
{
|
|
91
|
-
path: "/usr/bin/vim",
|
|
92
|
-
content:
|
|
93
|
-
"#!/bin/sh\necho 'vim: use nano for editing in this environment'\n",
|
|
94
|
-
mode: 0o755,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
path: "/usr/bin/vi",
|
|
98
|
-
content: '#!/bin/sh\nexec vim "$@"\n',
|
|
99
|
-
mode: 0o755,
|
|
100
|
-
},
|
|
101
90
|
{
|
|
102
91
|
path: "/usr/share/doc/vim/README",
|
|
103
92
|
content: "Vim editor — virtual package.\n",
|
|
@@ -139,7 +128,7 @@ const PACKAGE_REGISTRY: PackageDefinition[] = [
|
|
|
139
128
|
},
|
|
140
129
|
{
|
|
141
130
|
path: "/usr/bin/python3.11",
|
|
142
|
-
content:
|
|
131
|
+
content: "#!/bin/sh\nexec builtin python3 \"$@\"\n",
|
|
143
132
|
mode: 0o755,
|
|
144
133
|
},
|
|
145
134
|
{ path: "/usr/lib/python3.11/.keep", content: "" },
|
|
@@ -169,7 +158,7 @@ const PACKAGE_REGISTRY: PackageDefinition[] = [
|
|
|
169
158
|
},
|
|
170
159
|
{
|
|
171
160
|
path: "/usr/bin/nodejs",
|
|
172
|
-
content:
|
|
161
|
+
content: "#!/bin/sh\nexec builtin node \"$@\"\n",
|
|
173
162
|
mode: 0o755,
|
|
174
163
|
},
|
|
175
164
|
{
|
|
@@ -376,7 +365,7 @@ const PACKAGE_REGISTRY: PackageDefinition[] = [
|
|
|
376
365
|
},
|
|
377
366
|
{
|
|
378
367
|
path: "/usr/bin/gcc-12",
|
|
379
|
-
content:
|
|
368
|
+
content: "#!/bin/sh\necho 'gcc (Fortune GNU/Linux) 12.2.0 (virtual)'\n",
|
|
380
369
|
mode: 0o755,
|
|
381
370
|
},
|
|
382
371
|
],
|
|
@@ -1004,4 +993,4 @@ export class VirtualPackageManager {
|
|
|
1004
993
|
`Status: ${inst ? "install ok installed" : "install ok not-installed"}`,
|
|
1005
994
|
].join("\n");
|
|
1006
995
|
}
|
|
1007
|
-
}
|
|
996
|
+
}
|
|
@@ -243,12 +243,15 @@ class VirtualShell extends EventEmitter {
|
|
|
243
243
|
* @param rawInput Unparsed command line (e.g. `"ls -la /tmp"`).
|
|
244
244
|
* @param authUser Username to run the command as.
|
|
245
245
|
* @param cwd Current working directory for path resolution.
|
|
246
|
+
*
|
|
247
|
+
* @returns CommandResult or a Promise that resolves to CommandResult. The result is also emitted via the "command" event.
|
|
246
248
|
*/
|
|
247
|
-
executeCommand(rawInput: string, authUser: string, cwd: string):
|
|
249
|
+
executeCommand(rawInput: string, authUser: string, cwd: string): CommandResult | Promise<CommandResult> {
|
|
248
250
|
perf.mark("executeCommand");
|
|
249
251
|
this._idle?.ping();
|
|
250
|
-
runCommand(rawInput, authUser, this.hostname, "shell", cwd, this);
|
|
252
|
+
const result = runCommand(rawInput, authUser, this.hostname, "shell", cwd, this);
|
|
251
253
|
this.emit("command", { command: rawInput, user: authUser, cwd });
|
|
254
|
+
return result;
|
|
252
255
|
}
|
|
253
256
|
|
|
254
257
|
/**
|
package/src/commands/runtime.ts
CHANGED
|
@@ -71,6 +71,9 @@ function resolveVfsBinary(
|
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
const MAX_CALL_DEPTH = 8;
|
|
75
|
+
let _callDepth = 0;
|
|
76
|
+
|
|
74
77
|
export async function runCommandDirect(
|
|
75
78
|
name: string,
|
|
76
79
|
args: string[],
|
|
@@ -81,6 +84,32 @@ export async function runCommandDirect(
|
|
|
81
84
|
shell: VirtualShell,
|
|
82
85
|
stdin: string | undefined,
|
|
83
86
|
env: ShellEnv,
|
|
87
|
+
): Promise<CommandResult> {
|
|
88
|
+
// Anti-loop guard: track call depth via env to avoid infinite recursion
|
|
89
|
+
_callDepth++;
|
|
90
|
+
// console.debug(`[depth=${_callDepth}] runCommandDirect: ${name}`);
|
|
91
|
+
if (_callDepth > MAX_CALL_DEPTH) {
|
|
92
|
+
_callDepth--;
|
|
93
|
+
// console.debug(`[LOOP DETECTED] runCommandDirect blocked: ${name}`);
|
|
94
|
+
return { stderr: `${name}: maximum call depth (${MAX_CALL_DEPTH}) exceeded`, exitCode: 126 };
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
return await _runCommandDirectInner(name, args, authUser, hostname, mode, cwd, shell, stdin, env);
|
|
98
|
+
} finally {
|
|
99
|
+
_callDepth--;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function _runCommandDirectInner(
|
|
104
|
+
name: string,
|
|
105
|
+
args: string[],
|
|
106
|
+
authUser: string,
|
|
107
|
+
hostname: string,
|
|
108
|
+
mode: CommandMode,
|
|
109
|
+
cwd: string,
|
|
110
|
+
shell: VirtualShell,
|
|
111
|
+
stdin: string | undefined,
|
|
112
|
+
env: ShellEnv,
|
|
84
113
|
): Promise<CommandResult> {
|
|
85
114
|
const assignRe = /^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/;
|
|
86
115
|
const invocation = [name, ...args];
|
|
@@ -156,6 +185,8 @@ export async function runCommandDirect(
|
|
|
156
185
|
env,
|
|
157
186
|
});
|
|
158
187
|
}
|
|
188
|
+
// builtin not found — stop here, don't fall through to sh -c (avoids infinite loop)
|
|
189
|
+
return { stderr: `${name}: exec builtin '${builtinMatch[1]}' not found`, exitCode: 127 };
|
|
159
190
|
}
|
|
160
191
|
const shMod = resolveModule("sh");
|
|
161
192
|
if (shMod) {
|
|
@@ -212,6 +243,15 @@ export async function runCommand(
|
|
|
212
243
|
|
|
213
244
|
const shellEnv: ShellEnv = env ?? makeDefaultEnv(authUser, hostname);
|
|
214
245
|
|
|
246
|
+
// Anti-loop guard: check depth here too — catches sh -c recursive calls
|
|
247
|
+
_callDepth++;
|
|
248
|
+
// console.debug(`[depth=${_callDepth}] runCommand: ${trimmed.slice(0, 60)}`);
|
|
249
|
+
if (_callDepth > MAX_CALL_DEPTH) {
|
|
250
|
+
_callDepth--;
|
|
251
|
+
// console.debug(`[LOOP DETECTED] runCommand blocked: ${trimmed.slice(0, 60)}`);
|
|
252
|
+
return { stderr: `${trimmed.split(" ")[0]}: maximum call depth (${MAX_CALL_DEPTH}) exceeded`, exitCode: 126 };
|
|
253
|
+
}
|
|
254
|
+
try {
|
|
215
255
|
const rawTokens = tokenizeCommand(trimmed);
|
|
216
256
|
const rawFirstWord = rawTokens[0]?.toLowerCase() ?? "";
|
|
217
257
|
const aliasVal = shellEnv.vars[`__alias_${rawFirstWord}`];
|
|
@@ -375,4 +415,7 @@ export async function runCommand(
|
|
|
375
415
|
exitCode: 1,
|
|
376
416
|
};
|
|
377
417
|
}
|
|
378
|
-
}
|
|
418
|
+
} finally {
|
|
419
|
+
_callDepth--;
|
|
420
|
+
}
|
|
421
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
// Environment setup & latest features
|
|
4
4
|
"lib": [
|
|
5
|
-
"ESNext"
|
|
5
|
+
"ESNext",
|
|
6
|
+
"DOM",
|
|
7
|
+
"DOM.Iterable"
|
|
6
8
|
],
|
|
7
9
|
"target": "ESNext",
|
|
8
10
|
"module": "Preserve",
|
|
@@ -14,6 +16,7 @@
|
|
|
14
16
|
"moduleResolution": "bundler",
|
|
15
17
|
"verbatimModuleSyntax": true,
|
|
16
18
|
"noEmit": false,
|
|
19
|
+
"rewriteRelativeImportExtensions": true,
|
|
17
20
|
|
|
18
21
|
// Best practices
|
|
19
22
|
"strict": true,
|
|
@@ -35,10 +38,10 @@
|
|
|
35
38
|
"forceConsistentCasingInFileNames": true,
|
|
36
39
|
"resolveJsonModule": true,
|
|
37
40
|
"declaration": true,
|
|
38
|
-
"declarationMap":
|
|
41
|
+
"declarationMap": false,
|
|
39
42
|
"rootDir": "src",
|
|
40
43
|
"outDir": "dist",
|
|
41
|
-
"sourceMap":
|
|
44
|
+
"sourceMap": false,
|
|
42
45
|
"composite": true,
|
|
43
46
|
"tsBuildInfoFile": "dist/.tsbuildinfo"
|
|
44
47
|
},
|
package/typedoc.json
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"entryPoints": [
|
|
2
|
+
"entryPoints": [
|
|
3
|
+
"src/index.ts"
|
|
4
|
+
],
|
|
3
5
|
"out": "docs",
|
|
4
6
|
"name": "typescript-virtual-container",
|
|
5
7
|
"includeVersion": true,
|
|
@@ -42,4 +44,4 @@
|
|
|
42
44
|
"excludeInternal": true,
|
|
43
45
|
"treatWarningsAsErrors": false,
|
|
44
46
|
"skipErrorChecking": false
|
|
45
|
-
}
|
|
47
|
+
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
var L=Object.defineProperty;var I=(o,e,t)=>e in o?L(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var p=(o,e,t)=>I(o,typeof e!="symbol"?e+"":e,t);function $(o){let e=[],t="",r=!1,i="",s=0;for(;s<o.length;){let n=o[s],a=o[s+1];if((n==='"'||n==="'")&&!r){r=!0,i=n,s++;continue}if(r&&n===i){r=!1,i="",s++;continue}if(r){t+=n,s++;continue}if(n===" "){t&&(e.push(t),t=""),s++;continue}if(!r&&n==="2"&&a===">"){let c=o.slice(s+1);if(c.startsWith(">>&1")||c.startsWith(">> &1")){t&&(e.push(t),t=""),e.push("2>>&1"),s+=5;continue}if(c.startsWith(">&1")){t&&(e.push(t),t=""),e.push("2>&1"),s+=4;continue}if(c.startsWith(">>")){t&&(e.push(t),t=""),e.push("2>>"),s+=3;continue}if(c.startsWith(">")){t&&(e.push(t),t=""),e.push("2>"),s+=2;continue}}if((n===">"||n==="<")&&!r){t&&(e.push(t),t=""),n===">"&&a===">"?(e.push(">>"),s+=2):(e.push(n),s++);continue}t+=n,s++}return t&&e.push(t),e}function E(o){let e=o.trim();if(!e)return{statements:[],isValid:!0};try{return{statements:M(e),isValid:!0}}catch(t){return{statements:[],isValid:!1,error:t.message}}}function M(o){let e=B(o),t=[];for(let r of e){let s={pipeline:{commands:_(r.text.trim()),isValid:!0}};r.op&&(s.op=r.op),t.push(s)}return t}function B(o){let e=[],t="",r=0,i=!1,s="",n=0,a=c=>{t.trim()&&e.push({text:t,op:c}),t=""};for(;n<o.length;){let c=o[n],l=o.slice(n,n+2);if((c==='"'||c==="'")&&!i){i=!0,s=c,t+=c,n++;continue}if(i&&c===s){i=!1,t+=c,n++;continue}if(i){t+=c,n++;continue}if(c==="("){r++,t+=c,n++;continue}if(c===")"){r--,t+=c,n++;continue}if(r>0){t+=c,n++;continue}if(l==="&&"){a("&&"),n+=2;continue}if(l==="||"){a("||"),n+=2;continue}if(c===";"){a(";"),n++;continue}t+=c,n++}return a(),e}function _(o){return T(o).map(j)}function T(o){let e=[],t="",r=!1,i="";for(let n=0;n<o.length;n++){let a=o[n];if((a==='"'||a==="'")&&!r){r=!0,i=a,t+=a;continue}if(r&&a===i){r=!1,t+=a;continue}if(r){t+=a;continue}if(a==="|"&&o[n+1]!=="|"){if(!t.trim())throw new Error("Syntax error near unexpected token '|'");e.push(t.trim()),t=""}else t+=a}let s=t.trim();if(!s&&e.length>0)throw new Error("Syntax error near unexpected token '|'");return s&&e.push(s),e}function j(o){let e=$(o);if(e.length===0)return{name:"",args:[]};let t=[],r,i,s=!1,n=0,a,c=!1,l=!1;for(;n<e.length;){let f=e[n];if(f==="<"){if(n++,n>=e.length)throw new Error("Syntax error: expected filename after <");r=e[n],n++}else if(f===">>"){if(n++,n>=e.length)throw new Error("Syntax error: expected filename after >>");i=e[n],s=!0,n++}else if(f===">"){if(n++,n>=e.length)throw new Error("Syntax error: expected filename after >");i=e[n],s=!1,n++}else if(f==="2>&1")l=!0,n++;else if(f==="2>>"){if(n++,n>=e.length)throw new Error("Syntax error: expected filename after 2>>");a=e[n],c=!0,n++}else if(f==="2>"){if(n++,n>=e.length)throw new Error("Syntax error: expected filename after 2>");a=e[n],c=!1,n++}else t.push(f),n++}let h=t[0]??"";return{name:/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/.test(h)?h:h.toLowerCase(),args:t.slice(1),inputFile:r,outputFile:i,appendOutput:s,stderrFile:a,stderrAppend:c,stderrToStdout:l}}function U(o,e){let t=[],r=0;for(;r<o.length;){let i=o[r];if(/\s/.test(i)){r++;continue}if(i==="+"){t.push({type:"plus"}),r++;continue}if(i==="-"){t.push({type:"minus"}),r++;continue}if(i==="*"){if(o[r+1]==="*"){t.push({type:"pow"}),r+=2;continue}t.push({type:"mul"}),r++;continue}if(i==="/"){t.push({type:"div"}),r++;continue}if(i==="%"){t.push({type:"mod"}),r++;continue}if(i==="("){t.push({type:"lparen"}),r++;continue}if(i===")"){t.push({type:"rparen"}),r++;continue}if(/\d/.test(i)){let s=r+1;for(;s<o.length&&/\d/.test(o[s]);)s++;t.push({type:"number",value:Number(o.slice(r,s))}),r=s;continue}if(/[A-Za-z_]/.test(i)){let s=r+1;for(;s<o.length&&/[A-Za-z0-9_]/.test(o[s]);)s++;let n=o.slice(r,s),a=e[n],c=a===void 0||a===""?0:Number(a);t.push({type:"number",value:Number.isFinite(c)?c:0}),r=s;continue}return[]}return t}function V(o,e){let t=o.trim();if(t.length===0||t.length>1024)return NaN;let r=U(t,e);if(r.length===0)return NaN;let i=0,s=()=>r[i],n=()=>r[i++],a=()=>{let d=n();if(!d)return NaN;if(d.type==="number")return d.value;if(d.type==="lparen"){let m=g();return r[i]?.type!=="rparen"?NaN:(i++,m)}return NaN},c=()=>{let d=s();return d?.type==="plus"?(n(),c()):d?.type==="minus"?(n(),-c()):a()},l=()=>{let d=c();for(;s()?.type==="pow";){n();let m=c();d=d**m}return d},h=()=>{let d=l();for(;;){let m=s();if(m?.type==="mul"){n(),d*=l();continue}if(m?.type==="div"){n();let x=l();d=x===0?NaN:d/x;continue}if(m?.type==="mod"){n();let x=l();d=x===0?NaN:d%x;continue}return d}},g=()=>{let d=h();for(;;){let m=s();if(m?.type==="plus"){n(),d+=h();continue}if(m?.type==="minus"){n(),d-=h();continue}return d}},f=g();return!Number.isFinite(f)||i!==r.length?NaN:Math.trunc(f)}function Z(o,e){let t=[],r=0;for(;r<o.length;){let i=o.indexOf("'",r);if(i===-1){t.push(e(o.slice(r)));break}t.push(e(o.slice(r,i)));let s=o.indexOf("'",i+1);if(s===-1){t.push(o.slice(i));break}t.push(o.slice(i,s+1)),r=s+1}return t.join("")}function q(o,e){let t="",r=0;for(;r<o.length;){if(o[r]==="$"&&o[r+1]==="("&&o[r+2]==="("){let i=r+3,s=0;for(;i<o.length;){let n=o[i];if(n==="(")s++;else if(n===")"){if(s>0)s--;else if(o[i+1]===")"){let a=o.slice(r+3,i),c=V(a,e);t+=Number.isNaN(c)?"0":String(c),r=i+2;break}}i++}if(i>=o.length){t+=o.slice(r);break}continue}t+=o[r],r++}return t}function w(o,e,t=0,r){let i=r??e.HOME??"/home/user";return Z(o,s=>{let n=s;return n=n.replace(/(^|[\s:])~(\/|$)/g,(a,c,l)=>`${c}${i}${l}`),n=n.replace(/\$\?/g,String(t)),n=n.replace(/\$\$/g,"1"),n=n.replace(/\$#/g,"0"),n=q(n,e),n=n.replace(/\$\{#([A-Za-z_][A-Za-z0-9_]*)\}/g,(a,c)=>String((e[c]??"").length)),n=n.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*):-([^}]*)\}/g,(a,c,l)=>e[c]!==void 0&&e[c]!==""?e[c]:l),n=n.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*):=([^}]*)\}/g,(a,c,l)=>((e[c]===void 0||e[c]==="")&&(e[c]=l),e[c])),n=n.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*):\+([^}]*)\}/g,(a,c,l)=>e[c]!==void 0&&e[c]!==""?l:""),n=n.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(a,c)=>e[c]??""),n=n.replace(/\$([A-Za-z_][A-Za-z0-9_]*|\d+)/g,(a,c)=>e[c]??""),n})}async function D(o,e,t,r){let i="__shellExpandDepth",n=Number(e[i]??"0");if(n>=8)return w(o,e,t);e[i]=String(n+1);try{if(o.includes("$(")){let a="",c=!1,l=0;for(;l<o.length;){let h=o[l];if(h==="'"&&!c){c=!0,a+=h,l++;continue}if(h==="'"&&c){c=!1,a+=h,l++;continue}if(!c&&h==="$"&&o[l+1]==="("){if(o[l+2]==="("){a+=h,l++;continue}let g=0,f=l+1;for(;f<o.length;){if(o[f]==="(")g++;else if(o[f]===")"&&(g--,g===0))break;f++}let d=o.slice(l+2,f).trim(),m=(await r(d)).replace(/\n$/,"");a+=m,l=f+1;continue}a+=h,l++}o=a}return w(o,e,t)}finally{n<=0?delete e[i]:e[i]=String(n)}}var H=new TextEncoder,Q=new TextDecoder;function G(o){let e="";for(let t of o)e+=String.fromCharCode(t);return btoa(e)}function k(o){let e=atob(o),t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=1)t[r]=e.charCodeAt(r);return t}function u(o,e="/"){let r=(o.startsWith("/")?o:`${e}/${o}`).split("/"),i=[];for(let s of r)if(!(!s||s===".")){if(s===".."){i.pop();continue}i.push(s)}return`/${i.join("/")}`||"/"}function y(o){let e=u(o);if(e==="/")return"/";let t=e.split("/").filter(Boolean);return t.pop(),t.length>0?`/${t.join("/")}`:"/"}function b(o){let e=u(o);return e==="/"?"/":e.split("/").filter(Boolean).at(-1)??"/"}function F(o){return o.type==="file"?{...o,contentBase64:o.contentBase64}:{...o,children:o.children.map(e=>F(e))}}function A(o,e){let t=new Date().toISOString();return{type:"directory",name:o,mode:e,createdAt:t,updatedAt:t,children:[]}}function J(o,e,t){let r=new Date().toISOString();return{type:"file",name:o,mode:t,createdAt:r,updatedAt:r,contentBase64:G(e)}}function C(o,e){return o.children.find(t=>t.name===e)}function v(o,e){let t=o.children.findIndex(r=>r.name===e.name);if(t===-1){o.children.push(e);return}o.children[t]=e}function P(o,e){o.children=o.children.filter(t=>t.name!==e)}function R(o){return u(o).split("/").filter(Boolean)}var K=globalThis;function z(o){return new Promise((e,t)=>{o.addEventListener("success",()=>e(o.result)),o.addEventListener("error",()=>t(o.error))})}var N=class{constructor(e={}){p(this,"databaseName");p(this,"storeName");p(this,"key");p(this,"root");this.databaseName=e.databaseName??"typescript-virtual-container-web",this.storeName=e.storeName??"snapshots",this.key=e.key??"current",this.root=A("",493)}async openDatabase(){return new Promise((e,t)=>{let r=K.indexedDB;if(!r){t(new Error("IndexedDB is not available in this environment"));return}let i=r.open(this.databaseName,1);i.addEventListener("upgradeneeded",()=>{let s=i.result;s.objectStoreNames.contains(this.storeName)||s.createObjectStore(this.storeName)}),i.addEventListener("success",()=>e(i.result)),i.addEventListener("error",()=>t(i.error))})}async readSnapshot(){let e=await this.openDatabase();try{let i=e.transaction(this.storeName,"readonly").objectStore(this.storeName).get(this.key),s=await z(i);return s?JSON.parse(s):null}finally{e.close()}}async writeSnapshot(e){let t=await this.openDatabase();try{let r=t.transaction(this.storeName,"readwrite"),i=r.objectStore(this.storeName);await z(i.put(JSON.stringify(e),this.key)),await new Promise((s,n)=>{r.addEventListener("complete",()=>s()),r.addEventListener("error",()=>n(r.error)),r.addEventListener("abort",()=>n(r.error))})}finally{t.close()}}serializeNode(e){return e.type==="file"?{...e}:{...e,children:e.children.map(t=>this.serializeNode(t))}}deserializeNode(e){return e.type==="file"?{...e}:{...e,children:e.children.map(t=>this.deserializeNode(t))}}getNode(e){let t=u(e);if(t==="/")return this.root;let r=R(t),i=this.root;for(let s of r){if(i.type!=="directory")throw new Error(`Not a directory: ${t}`);let n=C(i,s);if(!n)throw new Error(`No such file or directory: ${t}`);i=n}return i}ensureDirectory(e,t){let r=u(e);if(r==="/")return this.root;let i=R(r),s=this.root;for(let n of i){let a=C(s,n);if(!a){let c=A(n,t);v(s,c),s=c;continue}if(a.type!=="directory")throw new Error(`Cannot create directory '${r}': path is a file.`);s=a}return s}removeNode(e,t){let r=u(e);if(r==="/")throw new Error("Cannot remove root directory");let i=this.getNode(y(r));if(i.type!=="directory")throw new Error(`Not a directory: ${y(r)}`);let s=b(r),n=C(i,s);if(!n)throw new Error(`No such file or directory: ${r}`);if(n.type==="directory"&&n.children.length>0&&!t)throw new Error(`Cannot remove '${r}': directory not empty.`);P(i,s)}copyNode(e){return e.type==="file"?{...e,contentBase64:e.contentBase64}:{...e,children:e.children.map(t=>this.copyNode(t))}}async restoreMirror(){let e=await this.readSnapshot();e&&(this.root=this.deserializeNode(e.root))}async flushMirror(){await this.writeSnapshot({root:this.serializeNode(this.root)})}exists(e){try{return this.getNode(e),!0}catch{return!1}}list(e){let t=this.getNode(e);if(t.type!=="directory")throw new Error(`Not a directory: ${e}`);return t.children.map(r=>r.name).sort((r,i)=>r.localeCompare(i))}stat(e){let t=this.getNode(e);return t.type==="file"?{type:"file",mode:t.mode,size:k(t.contentBase64).byteLength,name:t.name}:{type:"directory",mode:t.mode,size:0,name:t.name}}readFile(e){let t=this.getNode(e);if(t.type!=="file")throw new Error(`Is a directory: ${e}`);return Q.decode(k(t.contentBase64))}writeFile(e,t,r=420){let i=u(e),s=this.ensureDirectory(y(i),493),n=typeof t=="string"?H.encode(t):t,a=J(b(i),n,r);v(s,a)}mkdir(e,t=493){this.ensureDirectory(e,t)}touch(e){this.exists(e)||this.writeFile(e,"")}move(e,t){let r=this.getNode(e),i=this.getNode(y(e)),s=this.ensureDirectory(y(t),493);if(i.type!=="directory")throw new Error(`Not a directory: ${y(e)}`);P(i,b(e));let n=F(r);n.name=b(t),v(s,n)}copy(e,t){let r=this.getNode(e),i=this.ensureDirectory(y(t),493),s=this.copyNode(r);s.name=b(t),v(i,s)}remove(e,t={}){this.removeNode(e,t.recursive??!1)}exportSnapshot(){return{root:this.serializeNode(this.root)}}importSnapshot(e){this.root=this.deserializeNode(e.root)}},W=class{constructor(e,t={}){p(this,"hostname");p(this,"vfs");p(this,"env");p(this,"cwd");p(this,"commands",new Map);p(this,"initialized",!1);this.hostname=e,this.cwd=t.cwd??"/home/root",this.env={vars:{PATH:"/usr/bin:/bin",HOME:"/home/root",USER:"root",LOGNAME:"root",SHELL:"/bin/sh",HOSTNAME:e,PWD:this.cwd},lastExitCode:0},this.vfs=new N(t.vfs),this.registerBuiltins()}register(e){this.commands.set(e.name.toLowerCase(),e);for(let t of e.aliases??[])this.commands.set(t.toLowerCase(),e)}registerBuiltins(){this.register({name:"help",description:"List available web commands",params:[],run:()=>({stdout:`${this.listCommands().join(`
|
|
2
|
-
`)}
|
|
3
|
-
`,exitCode:0})}),this.register({name:"pwd",description:"Print current directory",params:[],run:()=>({stdout:`${this.cwd}
|
|
4
|
-
`,exitCode:0})}),this.register({name:"cd",description:"Change current directory",params:["[dir]"],run:({args:e})=>{let t=e[0]?u(e[0],this.cwd):"/home/root";return!this.vfs.exists(t)||this.vfs.stat(t).type!=="directory"?{stderr:`cd: no such file or directory: ${t}`,exitCode:1}:(this.cwd=t,this.env.vars.PWD=t,{exitCode:0,nextCwd:t})}}),this.register({name:"echo",description:"Display text",params:["[-n] [-e] [text...]"],run:({args:e,stdin:t})=>{let r=e.includes("-n"),i=e.filter(a=>a!=="-n"&&a!=="-e"&&a!=="-E"),s=i.length>0?i.join(" "):t??"",n=w(s,this.env.vars,this.env.lastExitCode,this.env.vars.HOME);return{stdout:r?n:`${n}
|
|
5
|
-
`,exitCode:0}}}),this.register({name:"env",description:"Print environment variables",params:[],run:()=>({stdout:`${Object.entries(this.env.vars).map(([e,t])=>`${e}=${t}`).join(`
|
|
6
|
-
`)}
|
|
7
|
-
`,exitCode:0})}),this.register({name:"export",description:"Set environment variables",params:["KEY=VALUE..."],run:({args:e})=>{for(let t of e){let r=t.indexOf("=");if(r===-1)continue;let i=t.slice(0,r).trim(),s=t.slice(r+1);i&&(this.env.vars[i]=s)}return{exitCode:0}}}),this.register({name:"unset",description:"Unset environment variables",params:["NAME..."],run:({args:e})=>{for(let t of e)delete this.env.vars[t];return{exitCode:0}}}),this.register({name:"mkdir",description:"Create directories",params:["[-p] dir..."],run:async({args:e})=>{let t=e.filter(r=>r!=="-p");for(let r of t)this.vfs.mkdir(u(r,this.cwd));return await this.vfs.flushMirror(),{exitCode:0}}}),this.register({name:"touch",description:"Create files",params:["file..."],run:async({args:e})=>{for(let t of e)this.vfs.touch(u(t,this.cwd));return await this.vfs.flushMirror(),{exitCode:0}}}),this.register({name:"rm",description:"Remove files or directories",params:["[-r] [-f] path..."],run:async({args:e})=>{let t=e.includes("-r"),r=e.filter(i=>i!=="-r"&&i!=="-f");for(let i of r)this.vfs.remove(u(i,this.cwd),{recursive:t});return await this.vfs.flushMirror(),{exitCode:0}}}),this.register({name:"cp",description:"Copy files or directories",params:["[-r] source destination"],run:async({args:e})=>{let t=e.includes("-r"),r=e.filter(s=>s!=="-r");if(r.length<2)return{stderr:"cp: missing destination file operand",exitCode:1};let i=u(r.at(-1),this.cwd);for(let s of r.slice(0,-1)){let n=u(s,this.cwd);if(!t&&this.vfs.stat(n).type==="directory")return{stderr:`cp: -r not specified; omitting directory '${n}'`,exitCode:1};this.vfs.copy(n,i)}return await this.vfs.flushMirror(),{exitCode:0}}}),this.register({name:"mv",description:"Move or rename files",params:["source destination"],run:async({args:e})=>{if(e.length<2)return{stderr:"mv: missing destination file operand",exitCode:1};let t=u(e[0],this.cwd),r=u(e[1],this.cwd);return this.vfs.move(t,r),await this.vfs.flushMirror(),{exitCode:0}}}),this.register({name:"cat",description:"Concatenate files",params:["[file...]"],run:({args:e,stdin:t})=>{if(e.length===0)return{stdout:t??"",exitCode:0};let r="";for(let i of e)r+=this.vfs.readFile(u(i,this.cwd));return{stdout:r,exitCode:0}}}),this.register({name:"ls",description:"List files",params:["[path]"],run:({args:e})=>{let t=u(e[0]??".",this.cwd);return{stdout:`${this.vfs.list(t).join(" ")}
|
|
8
|
-
`,exitCode:0}}}),this.register({name:"tee",description:"Read from stdin and write to files",params:["[-a] file..."],run:async({args:e,stdin:t})=>{let r=e.includes("-a"),i=e.filter(n=>n!=="-a"),s=t??"";for(let n of i){let a=u(n,this.cwd);if(r&&this.vfs.exists(a)){let c=this.vfs.readFile(a);this.vfs.writeFile(a,`${c}${s}`)}else this.vfs.writeFile(a,s)}return await this.vfs.flushMirror(),{stdout:s,exitCode:0}}}),this.register({name:"curl",description:"Fetch a URL and optionally write to a file",params:["[-o file] URL"],run:async({args:e})=>{let t=e.indexOf("-o"),r=t!==-1?e[t+1]:void 0,s=e.filter((c,l)=>c!=="-o"&&l!==t+1).at(-1);if(!s)return{stderr:"curl: missing URL",exitCode:2};let n=await fetch(s),a=await n.text();return r?(this.vfs.writeFile(u(r,this.cwd),a),await this.vfs.flushMirror(),{exitCode:n.ok?0:1}):{stdout:a,exitCode:n.ok?0:1}}}),this.register({name:"wget",description:"Fetch a URL and optionally write to a file",params:["[-O file] URL"],run:async({args:e})=>{let t=e.indexOf("-O"),r=t!==-1?e[t+1]:void 0,s=e.filter((l,h)=>l!=="-O"&&h!==t+1).at(-1);if(!s)return{stderr:"wget: missing URL",exitCode:2};let n=await fetch(s),a=await n.text(),c=r??b(new URL(s).pathname||"index.html");return this.vfs.writeFile(u(c,this.cwd),a),await this.vfs.flushMirror(),{exitCode:n.ok?0:1}}}),this.register({name:"true",description:"Return success",params:[],run:()=>({exitCode:0})}),this.register({name:"false",description:"Return failure",params:[],run:()=>({exitCode:1})})}listCommands(){let e=new Map;for(let t of this.commands.values())e.set(t.name,t);return Array.from(e.values()).sort((t,r)=>t.name.localeCompare(r.name)).map(t=>`${t.name}${t.params.length>0?` ${t.params.join(" ")}`:""}`)}resolveCommand(e){return this.commands.get(e.toLowerCase())}async ensureInitialized(){this.initialized||(await this.vfs.restoreMirror(),this.vfs.exists("/home")||this.vfs.mkdir("/home"),this.vfs.exists("/home/root")||(this.vfs.mkdir("/home/root"),this.vfs.writeFile("/home/root/README.txt",`Welcome to ${this.hostname}
|
|
9
|
-
`)),this.vfs.exists("/tmp")||this.vfs.mkdir("/tmp"),this.vfs.exists("/etc")||this.vfs.mkdir("/etc"),this.vfs.exists("/etc/hostname")||this.vfs.writeFile("/etc/hostname",`${this.hostname}
|
|
10
|
-
`),this.vfs.exists("/etc/hosts")||this.vfs.writeFile("/etc/hosts",`127.0.0.1 localhost
|
|
11
|
-
::1 localhost
|
|
12
|
-
`),this.initialized=!0)}getCurrentWorkingDirectory(){return this.cwd}async executeCommandLine(e,t=!0){await this.ensureInitialized();let r=e.trim();if(!r)return{exitCode:0};let i=await D(r,this.env.vars,this.env.lastExitCode,a=>this.executeCommandLine(a,!1).then(c=>c.stdout??"")),s=E(i),n=await this.executeStatements(s.statements);return this.env.lastExitCode=n.exitCode??0,t&&await this.vfs.flushMirror(),n}async executeStatements(e){let t={exitCode:0},r=0;for(;r<e.length;){let i=e[r];if(t=await this.executePipeline(i.pipeline.commands),this.env.lastExitCode=t.exitCode??0,t.closeSession||t.switchUser)return t;let s=i.op;if(!(!s||s===";")){if(s==="&&"){if((t.exitCode??0)!==0)for(;r<e.length&&e[r]?.op==="&&";)r+=1}else if(s==="||"&&(t.exitCode??0)===0)for(;r<e.length&&e[r]?.op==="||";)r+=1}r+=1}return t}async executePipeline(e){return e.length===0?{exitCode:0}:e.length===1?this.executeSingleCommandWithRedirections(e[0]):this.executePipelineChain(e)}async executeSingleCommandWithRedirections(e){let t;if(e.inputFile){let i=u(e.inputFile,this.cwd);try{t=this.vfs.readFile(i)}catch{return{stderr:`${e.inputFile}: No such file or directory`,exitCode:1}}}let r=await this.executeCommand(e.name,e.args,t);if(e.outputFile){let i=u(e.outputFile,this.cwd),s=r.stdout??"";if(e.appendOutput&&this.vfs.exists(i)){let n=this.vfs.readFile(i);this.vfs.writeFile(i,`${n}${s}`)}else this.vfs.writeFile(i,s);return{...r,stdout:""}}return r}async executePipelineChain(e){let t="",r=0;for(let i=0;i<e.length;i+=1){let s=e[i];if(i===0&&s.inputFile){let a=u(s.inputFile,this.cwd);try{t=this.vfs.readFile(a)}catch{return{stderr:`${s.inputFile}: No such file or directory`,exitCode:1}}}let n=await this.executeCommand(s.name,s.args,t);t=n.stdout??"",r=n.exitCode??0}return{stdout:t,exitCode:r}}async executeCommand(e,t,r){let i=this.resolveCommand(e);if(!i)return{stderr:`${e}: command not found`,exitCode:127};let n={args:t.map(a=>w(a,this.env.vars,this.env.lastExitCode,this.env.vars.HOME)),stdin:r,cwd:this.cwd,env:this.env,rawInput:`${e} ${t.join(" ")}`.trim(),shell:this};try{let a=await i.run(n);return a.nextCwd&&(this.cwd=a.nextCwd,this.env.vars.PWD=a.nextCwd),a}catch(a){return{stderr:a instanceof Error?a.message:String(a),exitCode:1}}}};function O(o="typescript-vm",e={}){return new W(o,e)}var S=class{constructor(e="typescript-vm"){p(this,"shell");this.shell=O(e,{})}async ensureInitialized(){await this.shell.ensureInitialized()}async executeCommandLine(e){return this.shell.executeCommandLine(e)}async run(e){return this.executeCommandLine(e)}getVfs(){return this.shell.vfs}getHostname(){return this.shell.hostname}writeFileAsUser(e,t,r){return this.shell.vfs.writeFile(t,r)}getEnv(){return this.shell.env}addCommand(e,t,r){this.shell.register({name:e,params:t,aliases:[],description:"",run:r})}};function ce(o){return new S(o)}export{ce as createVirtualShellShim};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
var R=Object.defineProperty;var F=(o,e,t)=>e in o?R(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var m=(o,e,t)=>F(o,typeof e!="symbol"?e+"":e,t);function S(o){let e=[],t="",r=!1,n="",s=0;for(;s<o.length;){let i=o[s],a=o[s+1];if((i==='"'||i==="'")&&!r){r=!0,n=i,s++;continue}if(r&&i===n){r=!1,n="",s++;continue}if(r){t+=i,s++;continue}if(i===" "){t&&(e.push(t),t=""),s++;continue}if(!r&&i==="2"&&a===">"){let c=o.slice(s+1);if(c.startsWith(">>&1")||c.startsWith(">> &1")){t&&(e.push(t),t=""),e.push("2>>&1"),s+=5;continue}if(c.startsWith(">&1")){t&&(e.push(t),t=""),e.push("2>&1"),s+=4;continue}if(c.startsWith(">>")){t&&(e.push(t),t=""),e.push("2>>"),s+=3;continue}if(c.startsWith(">")){t&&(e.push(t),t=""),e.push("2>"),s+=2;continue}}if((i===">"||i==="<")&&!r){t&&(e.push(t),t=""),i===">"&&a===">"?(e.push(">>"),s+=2):(e.push(i),s++);continue}t+=i,s++}return t&&e.push(t),e}function $(o){let e=o.trim();if(!e)return{statements:[],isValid:!0};try{return{statements:L(e),isValid:!0}}catch(t){return{statements:[],isValid:!1,error:t.message}}}function L(o){let e=I(o),t=[];for(let r of e){let s={pipeline:{commands:M(r.text.trim()),isValid:!0}};r.op&&(s.op=r.op),t.push(s)}return t}function I(o){let e=[],t="",r=0,n=!1,s="",i=0,a=c=>{t.trim()&&e.push({text:t,op:c}),t=""};for(;i<o.length;){let c=o[i],d=o.slice(i,i+2);if((c==='"'||c==="'")&&!n){n=!0,s=c,t+=c,i++;continue}if(n&&c===s){n=!1,t+=c,i++;continue}if(n){t+=c,i++;continue}if(c==="("){r++,t+=c,i++;continue}if(c===")"){r--,t+=c,i++;continue}if(r>0){t+=c,i++;continue}if(d==="&&"){a("&&"),i+=2;continue}if(d==="||"){a("||"),i+=2;continue}if(c===";"){a(";"),i++;continue}t+=c,i++}return a(),e}function M(o){return B(o).map(_)}function B(o){let e=[],t="",r=!1,n="";for(let i=0;i<o.length;i++){let a=o[i];if((a==='"'||a==="'")&&!r){r=!0,n=a,t+=a;continue}if(r&&a===n){r=!1,t+=a;continue}if(r){t+=a;continue}if(a==="|"&&o[i+1]!=="|"){if(!t.trim())throw new Error("Syntax error near unexpected token '|'");e.push(t.trim()),t=""}else t+=a}let s=t.trim();if(!s&&e.length>0)throw new Error("Syntax error near unexpected token '|'");return s&&e.push(s),e}function _(o){let e=S(o);if(e.length===0)return{name:"",args:[]};let t=[],r,n,s=!1,i=0,a,c=!1,d=!1;for(;i<e.length;){let f=e[i];if(f==="<"){if(i++,i>=e.length)throw new Error("Syntax error: expected filename after <");r=e[i],i++}else if(f===">>"){if(i++,i>=e.length)throw new Error("Syntax error: expected filename after >>");n=e[i],s=!0,i++}else if(f===">"){if(i++,i>=e.length)throw new Error("Syntax error: expected filename after >");n=e[i],s=!1,i++}else if(f==="2>&1")d=!0,i++;else if(f==="2>>"){if(i++,i>=e.length)throw new Error("Syntax error: expected filename after 2>>");a=e[i],c=!0,i++}else if(f==="2>"){if(i++,i>=e.length)throw new Error("Syntax error: expected filename after 2>");a=e[i],c=!1,i++}else t.push(f),i++}let h=t[0]??"";return{name:/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/.test(h)?h:h.toLowerCase(),args:t.slice(1),inputFile:r,outputFile:n,appendOutput:s,stderrFile:a,stderrAppend:c,stderrToStdout:d}}function T(o,e){let t=[],r=0;for(;r<o.length;){let n=o[r];if(/\s/.test(n)){r++;continue}if(n==="+"){t.push({type:"plus"}),r++;continue}if(n==="-"){t.push({type:"minus"}),r++;continue}if(n==="*"){if(o[r+1]==="*"){t.push({type:"pow"}),r+=2;continue}t.push({type:"mul"}),r++;continue}if(n==="/"){t.push({type:"div"}),r++;continue}if(n==="%"){t.push({type:"mod"}),r++;continue}if(n==="("){t.push({type:"lparen"}),r++;continue}if(n===")"){t.push({type:"rparen"}),r++;continue}if(/\d/.test(n)){let s=r+1;for(;s<o.length&&/\d/.test(o[s]);)s++;t.push({type:"number",value:Number(o.slice(r,s))}),r=s;continue}if(/[A-Za-z_]/.test(n)){let s=r+1;for(;s<o.length&&/[A-Za-z0-9_]/.test(o[s]);)s++;let i=o.slice(r,s),a=e[i],c=a===void 0||a===""?0:Number(a);t.push({type:"number",value:Number.isFinite(c)?c:0}),r=s;continue}return[]}return t}function j(o,e){let t=o.trim();if(t.length===0||t.length>1024)return NaN;let r=T(t,e);if(r.length===0)return NaN;let n=0,s=()=>r[n],i=()=>r[n++],a=()=>{let l=i();if(!l)return NaN;if(l.type==="number")return l.value;if(l.type==="lparen"){let p=g();return r[n]?.type!=="rparen"?NaN:(n++,p)}return NaN},c=()=>{let l=s();return l?.type==="plus"?(i(),c()):l?.type==="minus"?(i(),-c()):a()},d=()=>{let l=c();for(;s()?.type==="pow";){i();let p=c();l=l**p}return l},h=()=>{let l=d();for(;;){let p=s();if(p?.type==="mul"){i(),l*=d();continue}if(p?.type==="div"){i();let x=d();l=x===0?NaN:l/x;continue}if(p?.type==="mod"){i();let x=d();l=x===0?NaN:l%x;continue}return l}},g=()=>{let l=h();for(;;){let p=s();if(p?.type==="plus"){i(),l+=h();continue}if(p?.type==="minus"){i(),l-=h();continue}return l}},f=g();return!Number.isFinite(f)||n!==r.length?NaN:Math.trunc(f)}function V(o,e){let t=[],r=0;for(;r<o.length;){let n=o.indexOf("'",r);if(n===-1){t.push(e(o.slice(r)));break}t.push(e(o.slice(r,n)));let s=o.indexOf("'",n+1);if(s===-1){t.push(o.slice(n));break}t.push(o.slice(n,s+1)),r=s+1}return t.join("")}function U(o,e){let t="",r=0;for(;r<o.length;){if(o[r]==="$"&&o[r+1]==="("&&o[r+2]==="("){let n=r+3,s=0;for(;n<o.length;){let i=o[n];if(i==="(")s++;else if(i===")"){if(s>0)s--;else if(o[n+1]===")"){let a=o.slice(r+3,n),c=j(a,e);t+=Number.isNaN(c)?"0":String(c),r=n+2;break}}n++}if(n>=o.length){t+=o.slice(r);break}continue}t+=o[r],r++}return t}function w(o,e,t=0,r){let n=r??e.HOME??"/home/user";return V(o,s=>{let i=s;return i=i.replace(/(^|[\s:])~(\/|$)/g,(a,c,d)=>`${c}${n}${d}`),i=i.replace(/\$\?/g,String(t)),i=i.replace(/\$\$/g,"1"),i=i.replace(/\$#/g,"0"),i=U(i,e),i=i.replace(/\$\{#([A-Za-z_][A-Za-z0-9_]*)\}/g,(a,c)=>String((e[c]??"").length)),i=i.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*):-([^}]*)\}/g,(a,c,d)=>e[c]!==void 0&&e[c]!==""?e[c]:d),i=i.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*):=([^}]*)\}/g,(a,c,d)=>((e[c]===void 0||e[c]==="")&&(e[c]=d),e[c])),i=i.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*):\+([^}]*)\}/g,(a,c,d)=>e[c]!==void 0&&e[c]!==""?d:""),i=i.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(a,c)=>e[c]??""),i=i.replace(/\$([A-Za-z_][A-Za-z0-9_]*|\d+)/g,(a,c)=>e[c]??""),i})}async function E(o,e,t,r){let n="__shellExpandDepth",i=Number(e[n]??"0");if(i>=8)return w(o,e,t);e[n]=String(i+1);try{if(o.includes("$(")){let a="",c=!1,d=0;for(;d<o.length;){let h=o[d];if(h==="'"&&!c){c=!0,a+=h,d++;continue}if(h==="'"&&c){c=!1,a+=h,d++;continue}if(!c&&h==="$"&&o[d+1]==="("){if(o[d+2]==="("){a+=h,d++;continue}let g=0,f=d+1;for(;f<o.length;){if(o[f]==="(")g++;else if(o[f]===")"&&(g--,g===0))break;f++}let l=o.slice(d+2,f).trim(),p=(await r(l)).replace(/\n$/,"");a+=p,d=f+1;continue}a+=h,d++}o=a}return w(o,e,t)}finally{i<=0?delete e[n]:e[n]=String(i)}}var Z=new TextEncoder,q=new TextDecoder;function H(o){let e="";for(let t of o)e+=String.fromCharCode(t);return btoa(e)}function D(o){let e=atob(o),t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=1)t[r]=e.charCodeAt(r);return t}function u(o,e="/"){let r=(o.startsWith("/")?o:`${e}/${o}`).split("/"),n=[];for(let s of r)if(!(!s||s===".")){if(s===".."){n.pop();continue}n.push(s)}return`/${n.join("/")}`||"/"}function y(o){let e=u(o);if(e==="/")return"/";let t=e.split("/").filter(Boolean);return t.pop(),t.length>0?`/${t.join("/")}`:"/"}function b(o){let e=u(o);return e==="/"?"/":e.split("/").filter(Boolean).at(-1)??"/"}function O(o){return o.type==="file"?{...o,contentBase64:o.contentBase64}:{...o,children:o.children.map(e=>O(e))}}function k(o,e){let t=new Date().toISOString();return{type:"directory",name:o,mode:e,createdAt:t,updatedAt:t,children:[]}}function Q(o,e,t){let r=new Date().toISOString();return{type:"file",name:o,mode:t,createdAt:r,updatedAt:r,contentBase64:H(e)}}function C(o,e){return o.children.find(t=>t.name===e)}function v(o,e){let t=o.children.findIndex(r=>r.name===e.name);if(t===-1){o.children.push(e);return}o.children[t]=e}function A(o,e){o.children=o.children.filter(t=>t.name!==e)}function z(o){return u(o).split("/").filter(Boolean)}var G=globalThis;function P(o){return new Promise((e,t)=>{o.addEventListener("success",()=>e(o.result)),o.addEventListener("error",()=>t(o.error))})}var N=class{constructor(e={}){m(this,"databaseName");m(this,"storeName");m(this,"key");m(this,"root");this.databaseName=e.databaseName??"typescript-virtual-container-web",this.storeName=e.storeName??"snapshots",this.key=e.key??"current",this.root=k("",493)}async openDatabase(){return new Promise((e,t)=>{let r=G.indexedDB;if(!r){t(new Error("IndexedDB is not available in this environment"));return}let n=r.open(this.databaseName,1);n.addEventListener("upgradeneeded",()=>{let s=n.result;s.objectStoreNames.contains(this.storeName)||s.createObjectStore(this.storeName)}),n.addEventListener("success",()=>e(n.result)),n.addEventListener("error",()=>t(n.error))})}async readSnapshot(){let e=await this.openDatabase();try{let n=e.transaction(this.storeName,"readonly").objectStore(this.storeName).get(this.key),s=await P(n);return s?JSON.parse(s):null}finally{e.close()}}async writeSnapshot(e){let t=await this.openDatabase();try{let r=t.transaction(this.storeName,"readwrite"),n=r.objectStore(this.storeName);await P(n.put(JSON.stringify(e),this.key)),await new Promise((s,i)=>{r.addEventListener("complete",()=>s()),r.addEventListener("error",()=>i(r.error)),r.addEventListener("abort",()=>i(r.error))})}finally{t.close()}}serializeNode(e){return e.type==="file"?{...e}:{...e,children:e.children.map(t=>this.serializeNode(t))}}deserializeNode(e){return e.type==="file"?{...e}:{...e,children:e.children.map(t=>this.deserializeNode(t))}}getNode(e){let t=u(e);if(t==="/")return this.root;let r=z(t),n=this.root;for(let s of r){if(n.type!=="directory")throw new Error(`Not a directory: ${t}`);let i=C(n,s);if(!i)throw new Error(`No such file or directory: ${t}`);n=i}return n}ensureDirectory(e,t){let r=u(e);if(r==="/")return this.root;let n=z(r),s=this.root;for(let i of n){let a=C(s,i);if(!a){let c=k(i,t);v(s,c),s=c;continue}if(a.type!=="directory")throw new Error(`Cannot create directory '${r}': path is a file.`);s=a}return s}removeNode(e,t){let r=u(e);if(r==="/")throw new Error("Cannot remove root directory");let n=this.getNode(y(r));if(n.type!=="directory")throw new Error(`Not a directory: ${y(r)}`);let s=b(r),i=C(n,s);if(!i)throw new Error(`No such file or directory: ${r}`);if(i.type==="directory"&&i.children.length>0&&!t)throw new Error(`Cannot remove '${r}': directory not empty.`);A(n,s)}copyNode(e){return e.type==="file"?{...e,contentBase64:e.contentBase64}:{...e,children:e.children.map(t=>this.copyNode(t))}}async restoreMirror(){let e=await this.readSnapshot();e&&(this.root=this.deserializeNode(e.root))}async flushMirror(){await this.writeSnapshot({root:this.serializeNode(this.root)})}exists(e){try{return this.getNode(e),!0}catch{return!1}}list(e){let t=this.getNode(e);if(t.type!=="directory")throw new Error(`Not a directory: ${e}`);return t.children.map(r=>r.name).sort((r,n)=>r.localeCompare(n))}stat(e){let t=this.getNode(e);return t.type==="file"?{type:"file",mode:t.mode,size:D(t.contentBase64).byteLength,name:t.name}:{type:"directory",mode:t.mode,size:0,name:t.name}}readFile(e){let t=this.getNode(e);if(t.type!=="file")throw new Error(`Is a directory: ${e}`);return q.decode(D(t.contentBase64))}writeFile(e,t,r=420){let n=u(e),s=this.ensureDirectory(y(n),493),i=typeof t=="string"?Z.encode(t):t,a=Q(b(n),i,r);v(s,a)}mkdir(e,t=493){this.ensureDirectory(e,t)}touch(e){this.exists(e)||this.writeFile(e,"")}move(e,t){let r=this.getNode(e),n=this.getNode(y(e)),s=this.ensureDirectory(y(t),493);if(n.type!=="directory")throw new Error(`Not a directory: ${y(e)}`);A(n,b(e));let i=O(r);i.name=b(t),v(s,i)}copy(e,t){let r=this.getNode(e),n=this.ensureDirectory(y(t),493),s=this.copyNode(r);s.name=b(t),v(n,s)}remove(e,t={}){this.removeNode(e,t.recursive??!1)}exportSnapshot(){return{root:this.serializeNode(this.root)}}importSnapshot(e){this.root=this.deserializeNode(e.root)}},W=class{constructor(e,t={}){m(this,"hostname");m(this,"vfs");m(this,"env");m(this,"cwd");m(this,"commands",new Map);m(this,"initialized",!1);this.hostname=e,this.cwd=t.cwd??"/home/root",this.env={vars:{PATH:"/usr/bin:/bin",HOME:"/home/root",USER:"root",LOGNAME:"root",SHELL:"/bin/sh",HOSTNAME:e,PWD:this.cwd},lastExitCode:0},this.vfs=new N(t.vfs),this.registerBuiltins()}register(e){this.commands.set(e.name.toLowerCase(),e);for(let t of e.aliases??[])this.commands.set(t.toLowerCase(),e)}registerBuiltins(){this.register({name:"help",description:"List available web commands",params:[],run:()=>({stdout:`${this.listCommands().join(`
|
|
2
|
-
`)}
|
|
3
|
-
`,exitCode:0})}),this.register({name:"pwd",description:"Print current directory",params:[],run:()=>({stdout:`${this.cwd}
|
|
4
|
-
`,exitCode:0})}),this.register({name:"cd",description:"Change current directory",params:["[dir]"],run:({args:e})=>{let t=e[0]?u(e[0],this.cwd):"/home/root";return!this.vfs.exists(t)||this.vfs.stat(t).type!=="directory"?{stderr:`cd: no such file or directory: ${t}`,exitCode:1}:(this.cwd=t,this.env.vars.PWD=t,{exitCode:0,nextCwd:t})}}),this.register({name:"echo",description:"Display text",params:["[-n] [-e] [text...]"],run:({args:e,stdin:t})=>{let r=e.includes("-n"),n=e.filter(a=>a!=="-n"&&a!=="-e"&&a!=="-E"),s=n.length>0?n.join(" "):t??"",i=w(s,this.env.vars,this.env.lastExitCode,this.env.vars.HOME);return{stdout:r?i:`${i}
|
|
5
|
-
`,exitCode:0}}}),this.register({name:"env",description:"Print environment variables",params:[],run:()=>({stdout:`${Object.entries(this.env.vars).map(([e,t])=>`${e}=${t}`).join(`
|
|
6
|
-
`)}
|
|
7
|
-
`,exitCode:0})}),this.register({name:"export",description:"Set environment variables",params:["KEY=VALUE..."],run:({args:e})=>{for(let t of e){let r=t.indexOf("=");if(r===-1)continue;let n=t.slice(0,r).trim(),s=t.slice(r+1);n&&(this.env.vars[n]=s)}return{exitCode:0}}}),this.register({name:"unset",description:"Unset environment variables",params:["NAME..."],run:({args:e})=>{for(let t of e)delete this.env.vars[t];return{exitCode:0}}}),this.register({name:"mkdir",description:"Create directories",params:["[-p] dir..."],run:async({args:e})=>{let t=e.filter(r=>r!=="-p");for(let r of t)this.vfs.mkdir(u(r,this.cwd));return await this.vfs.flushMirror(),{exitCode:0}}}),this.register({name:"touch",description:"Create files",params:["file..."],run:async({args:e})=>{for(let t of e)this.vfs.touch(u(t,this.cwd));return await this.vfs.flushMirror(),{exitCode:0}}}),this.register({name:"rm",description:"Remove files or directories",params:["[-r] [-f] path..."],run:async({args:e})=>{let t=e.includes("-r"),r=e.filter(n=>n!=="-r"&&n!=="-f");for(let n of r)this.vfs.remove(u(n,this.cwd),{recursive:t});return await this.vfs.flushMirror(),{exitCode:0}}}),this.register({name:"cp",description:"Copy files or directories",params:["[-r] source destination"],run:async({args:e})=>{let t=e.includes("-r"),r=e.filter(s=>s!=="-r");if(r.length<2)return{stderr:"cp: missing destination file operand",exitCode:1};let n=u(r.at(-1),this.cwd);for(let s of r.slice(0,-1)){let i=u(s,this.cwd);if(!t&&this.vfs.stat(i).type==="directory")return{stderr:`cp: -r not specified; omitting directory '${i}'`,exitCode:1};this.vfs.copy(i,n)}return await this.vfs.flushMirror(),{exitCode:0}}}),this.register({name:"mv",description:"Move or rename files",params:["source destination"],run:async({args:e})=>{if(e.length<2)return{stderr:"mv: missing destination file operand",exitCode:1};let t=u(e[0],this.cwd),r=u(e[1],this.cwd);return this.vfs.move(t,r),await this.vfs.flushMirror(),{exitCode:0}}}),this.register({name:"cat",description:"Concatenate files",params:["[file...]"],run:({args:e,stdin:t})=>{if(e.length===0)return{stdout:t??"",exitCode:0};let r="";for(let n of e)r+=this.vfs.readFile(u(n,this.cwd));return{stdout:r,exitCode:0}}}),this.register({name:"ls",description:"List files",params:["[path]"],run:({args:e})=>{let t=u(e[0]??".",this.cwd);return{stdout:`${this.vfs.list(t).join(" ")}
|
|
8
|
-
`,exitCode:0}}}),this.register({name:"tee",description:"Read from stdin and write to files",params:["[-a] file..."],run:async({args:e,stdin:t})=>{let r=e.includes("-a"),n=e.filter(i=>i!=="-a"),s=t??"";for(let i of n){let a=u(i,this.cwd);if(r&&this.vfs.exists(a)){let c=this.vfs.readFile(a);this.vfs.writeFile(a,`${c}${s}`)}else this.vfs.writeFile(a,s)}return await this.vfs.flushMirror(),{stdout:s,exitCode:0}}}),this.register({name:"curl",description:"Fetch a URL and optionally write to a file",params:["[-o file] URL"],run:async({args:e})=>{let t=e.indexOf("-o"),r=t!==-1?e[t+1]:void 0,s=e.filter((c,d)=>c!=="-o"&&d!==t+1).at(-1);if(!s)return{stderr:"curl: missing URL",exitCode:2};let i=await fetch(s),a=await i.text();return r?(this.vfs.writeFile(u(r,this.cwd),a),await this.vfs.flushMirror(),{exitCode:i.ok?0:1}):{stdout:a,exitCode:i.ok?0:1}}}),this.register({name:"wget",description:"Fetch a URL and optionally write to a file",params:["[-O file] URL"],run:async({args:e})=>{let t=e.indexOf("-O"),r=t!==-1?e[t+1]:void 0,s=e.filter((d,h)=>d!=="-O"&&h!==t+1).at(-1);if(!s)return{stderr:"wget: missing URL",exitCode:2};let i=await fetch(s),a=await i.text(),c=r??b(new URL(s).pathname||"index.html");return this.vfs.writeFile(u(c,this.cwd),a),await this.vfs.flushMirror(),{exitCode:i.ok?0:1}}}),this.register({name:"true",description:"Return success",params:[],run:()=>({exitCode:0})}),this.register({name:"false",description:"Return failure",params:[],run:()=>({exitCode:1})})}listCommands(){let e=new Map;for(let t of this.commands.values())e.set(t.name,t);return Array.from(e.values()).sort((t,r)=>t.name.localeCompare(r.name)).map(t=>`${t.name}${t.params.length>0?` ${t.params.join(" ")}`:""}`)}resolveCommand(e){return this.commands.get(e.toLowerCase())}async ensureInitialized(){this.initialized||(await this.vfs.restoreMirror(),this.vfs.exists("/home")||this.vfs.mkdir("/home"),this.vfs.exists("/home/root")||(this.vfs.mkdir("/home/root"),this.vfs.writeFile("/home/root/README.txt",`Welcome to ${this.hostname}
|
|
9
|
-
`)),this.vfs.exists("/tmp")||this.vfs.mkdir("/tmp"),this.vfs.exists("/etc")||this.vfs.mkdir("/etc"),this.vfs.exists("/etc/hostname")||this.vfs.writeFile("/etc/hostname",`${this.hostname}
|
|
10
|
-
`),this.vfs.exists("/etc/hosts")||this.vfs.writeFile("/etc/hosts",`127.0.0.1 localhost
|
|
11
|
-
::1 localhost
|
|
12
|
-
`),this.initialized=!0)}getCurrentWorkingDirectory(){return this.cwd}async executeCommandLine(e,t=!0){await this.ensureInitialized();let r=e.trim();if(!r)return{exitCode:0};let n=await E(r,this.env.vars,this.env.lastExitCode,a=>this.executeCommandLine(a,!1).then(c=>c.stdout??"")),s=$(n),i=await this.executeStatements(s.statements);return this.env.lastExitCode=i.exitCode??0,t&&await this.vfs.flushMirror(),i}async executeStatements(e){let t={exitCode:0},r=0;for(;r<e.length;){let n=e[r];if(t=await this.executePipeline(n.pipeline.commands),this.env.lastExitCode=t.exitCode??0,t.closeSession||t.switchUser)return t;let s=n.op;if(!(!s||s===";")){if(s==="&&"){if((t.exitCode??0)!==0)for(;r<e.length&&e[r]?.op==="&&";)r+=1}else if(s==="||"&&(t.exitCode??0)===0)for(;r<e.length&&e[r]?.op==="||";)r+=1}r+=1}return t}async executePipeline(e){return e.length===0?{exitCode:0}:e.length===1?this.executeSingleCommandWithRedirections(e[0]):this.executePipelineChain(e)}async executeSingleCommandWithRedirections(e){let t;if(e.inputFile){let n=u(e.inputFile,this.cwd);try{t=this.vfs.readFile(n)}catch{return{stderr:`${e.inputFile}: No such file or directory`,exitCode:1}}}let r=await this.executeCommand(e.name,e.args,t);if(e.outputFile){let n=u(e.outputFile,this.cwd),s=r.stdout??"";if(e.appendOutput&&this.vfs.exists(n)){let i=this.vfs.readFile(n);this.vfs.writeFile(n,`${i}${s}`)}else this.vfs.writeFile(n,s);return{...r,stdout:""}}return r}async executePipelineChain(e){let t="",r=0;for(let n=0;n<e.length;n+=1){let s=e[n];if(n===0&&s.inputFile){let a=u(s.inputFile,this.cwd);try{t=this.vfs.readFile(a)}catch{return{stderr:`${s.inputFile}: No such file or directory`,exitCode:1}}}let i=await this.executeCommand(s.name,s.args,t);t=i.stdout??"",r=i.exitCode??0}return{stdout:t,exitCode:r}}async executeCommand(e,t,r){let n=this.resolveCommand(e);if(!n)return{stderr:`${e}: command not found`,exitCode:127};let i={args:t.map(a=>w(a,this.env.vars,this.env.lastExitCode,this.env.vars.HOME)),stdin:r,cwd:this.cwd,env:this.env,rawInput:`${e} ${t.join(" ")}`.trim(),shell:this};try{let a=await n.run(i);return a.nextCwd&&(this.cwd=a.nextCwd,this.env.vars.PWD=a.nextCwd),a}catch(a){return{stderr:a instanceof Error?a.message:String(a),exitCode:1}}}};function ie(o="typescript-vm",e={}){return new W(o,e)}export{N as IndexedDbMirrorVfs,W as WebShell,ie as createWebShell};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Honeypot/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACnB;AAID;;;;;GAKG;AACH,qBAAa,QAAQ;IACpB,OAAO,CAAC,QAAQ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
|
|
1
|
-
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/SSHMimic/exec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AASpD,wBAAgB,OAAO,CACtB,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,YAAY,GACjB,IAAI,CA+BN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/SSHMimic/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAInE,SAAS,UAAU,CAAC,IAAY;IAC/B,OAAO,IAAI;SACT,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;SACtB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,OAAO,CACtB,MAAkB,EAClB,GAAW,EACX,QAAgB,EAChB,QAAgB,EAChB,KAAmB;IAEnB,OAAO,CAAC,OAAO,CACd,UAAU,CACT,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,CAAC,QAAQ,CAAC,EAClB,KAAK,EACL,SAAS,EACT,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAClC,CACD;SACC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;QAChB,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAClD,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,EAAE,CA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