typescript-virtual-container 1.4.4 → 1.4.5
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/builds/self-standalone.js +321 -272
- package/builds/self-standalone.js.map +4 -4
- package/builds/standalone-wo-sftp.js +261 -212
- package/builds/standalone-wo-sftp.js.map +4 -4
- package/builds/standalone.js +265 -216
- package/builds/standalone.js.map +4 -4
- package/builds/web-full-api.min.js +5 -5
- package/builds/web-full-api.min.js.map +3 -3
- package/builds/web.min.js +5 -5
- package/builds/web.min.js.map +3 -3
- package/bun.lock +97 -0
- package/dist/Honeypot/index.d.ts.map +1 -0
- package/dist/Honeypot/index.js +299 -0
- package/dist/Honeypot/index.js.map +1 -0
- package/dist/SSHClient/index.d.ts.map +1 -0
- package/dist/SSHClient/index.js +238 -0
- package/dist/SSHClient/index.js.map +1 -0
- package/dist/SSHMimic/exec.d.ts.map +1 -0
- package/dist/SSHMimic/exec.js +28 -0
- package/dist/SSHMimic/exec.js.map +1 -0
- package/dist/SSHMimic/executor.d.ts.map +1 -0
- package/dist/SSHMimic/executor.js +161 -0
- package/dist/SSHMimic/executor.js.map +1 -0
- package/dist/SSHMimic/hostKey.d.ts.map +1 -0
- package/dist/SSHMimic/hostKey.js +18 -0
- package/dist/SSHMimic/hostKey.js.map +1 -0
- package/dist/SSHMimic/index.d.ts.map +1 -0
- package/dist/SSHMimic/index.js +250 -0
- package/dist/SSHMimic/index.js.map +1 -0
- package/dist/SSHMimic/loginBanner.d.ts.map +1 -0
- package/dist/SSHMimic/loginBanner.js +23 -0
- package/dist/SSHMimic/loginBanner.js.map +1 -0
- package/dist/SSHMimic/loginFormat.d.ts.map +1 -0
- package/dist/SSHMimic/loginFormat.js +11 -0
- package/dist/SSHMimic/loginFormat.js.map +1 -0
- package/dist/SSHMimic/prompt.d.ts.map +1 -0
- package/dist/SSHMimic/prompt.js +10 -0
- package/dist/SSHMimic/prompt.js.map +1 -0
- package/dist/SSHMimic/sftp.d.ts.map +1 -0
- package/dist/SSHMimic/sftp.js +620 -0
- package/dist/SSHMimic/sftp.js.map +1 -0
- package/dist/VirtualFileSystem/binaryPack.d.ts.map +1 -0
- package/dist/VirtualFileSystem/binaryPack.js +217 -0
- package/dist/VirtualFileSystem/binaryPack.js.map +1 -0
- package/dist/VirtualFileSystem/index.d.ts.map +1 -0
- package/dist/VirtualFileSystem/index.js +690 -0
- package/dist/VirtualFileSystem/index.js.map +1 -0
- package/dist/VirtualFileSystem/internalTypes.d.ts.map +1 -0
- package/dist/VirtualFileSystem/internalTypes.js +1 -0
- package/dist/VirtualFileSystem/internalTypes.js.map +1 -0
- package/dist/VirtualFileSystem/path.d.ts.map +1 -0
- package/dist/VirtualFileSystem/path.js +50 -0
- package/dist/VirtualFileSystem/path.js.map +1 -0
- package/dist/VirtualPackageManager/index.d.ts.map +1 -0
- package/dist/VirtualPackageManager/index.js +854 -0
- package/dist/VirtualPackageManager/index.js.map +1 -0
- package/dist/VirtualShell/index.d.ts.map +1 -0
- package/dist/VirtualShell/index.js +285 -0
- package/dist/VirtualShell/index.js.map +1 -0
- package/dist/VirtualShell/shell.d.ts.map +1 -0
- package/dist/VirtualShell/shell.js +503 -0
- package/dist/VirtualShell/shell.js.map +1 -0
- package/dist/VirtualShell/shellParser.d.ts.map +1 -0
- package/dist/VirtualShell/shellParser.js +266 -0
- package/dist/VirtualShell/shellParser.js.map +1 -0
- package/dist/VirtualUserManager/index.d.ts.map +1 -0
- package/dist/VirtualUserManager/index.js +608 -0
- package/dist/VirtualUserManager/index.js.map +1 -0
- package/dist/commands/adduser.d.ts.map +1 -0
- package/dist/commands/adduser.js +90 -0
- package/dist/commands/adduser.js.map +1 -0
- package/dist/commands/alias.d.ts.map +1 -0
- package/dist/commands/alias.js +69 -0
- package/dist/commands/alias.js.map +1 -0
- package/dist/commands/apt.d.ts.map +1 -0
- package/dist/commands/apt.js +211 -0
- package/dist/commands/apt.js.map +1 -0
- package/dist/commands/awk.d.ts.map +1 -0
- package/dist/commands/awk.js +170 -0
- package/dist/commands/awk.js.map +1 -0
- package/dist/commands/base64.d.ts.map +1 -0
- package/dist/commands/base64.js +29 -0
- package/dist/commands/base64.js.map +1 -0
- package/dist/commands/cat.d.ts.map +1 -0
- package/dist/commands/cat.js +45 -0
- package/dist/commands/cat.js.map +1 -0
- package/dist/commands/cd.d.ts.map +1 -0
- package/dist/commands/cd.js +22 -0
- package/dist/commands/cd.js.map +1 -0
- package/dist/commands/chmod.d.ts.map +1 -0
- package/dist/commands/chmod.js +88 -0
- package/dist/commands/chmod.js.map +1 -0
- package/dist/commands/clear.d.ts.map +1 -0
- package/dist/commands/clear.js +14 -0
- package/dist/commands/clear.js.map +1 -0
- package/dist/commands/command-helpers.d.ts.map +1 -0
- package/dist/commands/command-helpers.js +222 -0
- package/dist/commands/command-helpers.js.map +1 -0
- package/dist/commands/cp.d.ts.map +1 -0
- package/dist/commands/cp.js +76 -0
- package/dist/commands/cp.js.map +1 -0
- package/dist/commands/curl.d.ts.map +1 -0
- package/dist/commands/curl.js +128 -0
- package/dist/commands/curl.js.map +1 -0
- package/dist/commands/cut.d.ts.map +1 -0
- package/dist/commands/cut.js +35 -0
- package/dist/commands/cut.js.map +1 -0
- package/dist/commands/date.d.ts.map +1 -0
- package/dist/commands/date.js +29 -0
- package/dist/commands/date.js.map +1 -0
- package/dist/commands/declare.d.ts.map +1 -0
- package/dist/commands/declare.js +45 -0
- package/dist/commands/declare.js.map +1 -0
- package/dist/commands/deluser.d.ts.map +1 -0
- package/dist/commands/deluser.js +84 -0
- package/dist/commands/deluser.js.map +1 -0
- package/dist/commands/df.d.ts.map +1 -0
- package/dist/commands/df.js +22 -0
- package/dist/commands/df.js.map +1 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +46 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/dpkg.d.ts.map +1 -0
- package/dist/commands/dpkg.js +162 -0
- package/dist/commands/dpkg.js.map +1 -0
- package/dist/commands/du.d.ts.map +1 -0
- package/dist/commands/du.js +51 -0
- package/dist/commands/du.js.map +1 -0
- package/dist/commands/echo.d.ts.map +1 -0
- package/dist/commands/echo.js +46 -0
- package/dist/commands/echo.js.map +1 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +21 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/exit.d.ts.map +1 -0
- package/dist/commands/exit.js +17 -0
- package/dist/commands/exit.js.map +1 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +34 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/find.d.ts.map +1 -0
- package/dist/commands/find.js +56 -0
- package/dist/commands/find.js.map +1 -0
- package/dist/commands/free.d.ts.map +1 -0
- package/dist/commands/free.js +44 -0
- package/dist/commands/free.js.map +1 -0
- package/dist/commands/grep.d.ts.map +1 -0
- package/dist/commands/grep.js +121 -0
- package/dist/commands/grep.js.map +1 -0
- package/dist/commands/groups.d.ts.map +1 -0
- package/dist/commands/groups.js +18 -0
- package/dist/commands/groups.js.map +1 -0
- package/dist/commands/gzip.d.ts.map +1 -0
- package/dist/commands/gzip.js +83 -0
- package/dist/commands/gzip.js.map +1 -0
- package/dist/commands/head.d.ts.map +1 -0
- package/dist/commands/head.js +47 -0
- package/dist/commands/head.js.map +1 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +124 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/helpers.d.ts.map +1 -0
- package/dist/commands/helpers.js +167 -0
- package/dist/commands/helpers.js.map +1 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +27 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/hostname.d.ts.map +1 -0
- package/dist/commands/hostname.js +13 -0
- package/dist/commands/hostname.js.map +1 -0
- package/dist/commands/htop.d.ts.map +1 -0
- package/dist/commands/htop.js +18 -0
- package/dist/commands/htop.js.map +1 -0
- package/dist/commands/id.d.ts.map +1 -0
- package/dist/commands/id.js +18 -0
- package/dist/commands/id.js.map +1 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +3 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/kill.d.ts.map +1 -0
- package/dist/commands/kill.js +19 -0
- package/dist/commands/kill.js.map +1 -0
- package/dist/commands/ln.d.ts.map +1 -0
- package/dist/commands/ln.js +67 -0
- package/dist/commands/ln.js.map +1 -0
- package/dist/commands/ls.d.ts.map +1 -0
- package/dist/commands/ls.js +201 -0
- package/dist/commands/ls.js.map +1 -0
- package/dist/commands/lsb-release.d.ts.map +1 -0
- package/dist/commands/lsb-release.js +62 -0
- package/dist/commands/lsb-release.js.map +1 -0
- package/dist/commands/man.d.ts.map +1 -0
- package/dist/commands/man.js +50 -0
- package/dist/commands/man.js.map +1 -0
- package/dist/commands/mkdir.d.ts.map +1 -0
- package/dist/commands/mkdir.js +29 -0
- package/dist/commands/mkdir.js.map +1 -0
- package/dist/commands/mv.d.ts.map +1 -0
- package/dist/commands/mv.js +43 -0
- package/dist/commands/mv.js.map +1 -0
- package/dist/commands/nano.d.ts.map +1 -0
- package/dist/commands/nano.js +35 -0
- package/dist/commands/nano.js.map +1 -0
- package/dist/commands/neofetch.d.ts.map +1 -0
- package/dist/commands/neofetch.js +49 -0
- package/dist/commands/neofetch.js.map +1 -0
- package/dist/commands/node.d.ts.map +1 -0
- package/dist/commands/node.js +317 -0
- package/dist/commands/node.js.map +1 -0
- package/dist/commands/npm.d.ts.map +1 -0
- package/dist/commands/npm.js +110 -0
- package/dist/commands/npm.js.map +1 -0
- package/dist/commands/passwd.d.ts.map +1 -0
- package/dist/commands/passwd.js +45 -0
- package/dist/commands/passwd.js.map +1 -0
- package/dist/commands/ping.d.ts.map +1 -0
- package/dist/commands/ping.js +29 -0
- package/dist/commands/ping.js.map +1 -0
- package/dist/commands/printf.d.ts.map +1 -0
- package/dist/commands/printf.js +145 -0
- package/dist/commands/printf.js.map +1 -0
- package/dist/commands/ps.d.ts.map +1 -0
- package/dist/commands/ps.js +47 -0
- package/dist/commands/ps.js.map +1 -0
- package/dist/commands/pwd.d.ts.map +1 -0
- package/dist/commands/pwd.js +8 -0
- package/dist/commands/pwd.js.map +1 -0
- package/dist/commands/python.d.ts.map +1 -0
- package/dist/commands/python.js +2059 -0
- package/dist/commands/python.js.map +1 -0
- package/dist/commands/read.d.ts.map +1 -0
- package/dist/commands/read.js +40 -0
- package/dist/commands/read.js.map +1 -0
- package/dist/commands/registry.d.ts.map +1 -0
- package/dist/commands/registry.js +235 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/commands/rm.d.ts.map +1 -0
- package/dist/commands/rm.js +37 -0
- package/dist/commands/rm.js.map +1 -0
- package/dist/commands/runtime.d.ts.map +1 -0
- package/dist/commands/runtime.js +286 -0
- package/dist/commands/runtime.js.map +1 -0
- package/dist/commands/sed.d.ts.map +1 -0
- package/dist/commands/sed.js +61 -0
- package/dist/commands/sed.js.map +1 -0
- package/dist/commands/seq.d.ts.map +1 -0
- package/dist/commands/seq.js +51 -0
- package/dist/commands/seq.js.map +1 -0
- package/dist/commands/set.d.ts.map +1 -0
- package/dist/commands/set.js +27 -0
- package/dist/commands/set.js.map +1 -0
- package/dist/commands/sh.d.ts.map +1 -0
- package/dist/commands/sh.js +432 -0
- package/dist/commands/sh.js.map +1 -0
- package/dist/commands/shift.d.ts.map +1 -0
- package/dist/commands/shift.js +63 -0
- package/dist/commands/shift.js.map +1 -0
- package/dist/commands/sleep.d.ts.map +1 -0
- package/dist/commands/sleep.js +19 -0
- package/dist/commands/sleep.js.map +1 -0
- package/dist/commands/sort.d.ts.map +1 -0
- package/dist/commands/sort.js +45 -0
- package/dist/commands/sort.js.map +1 -0
- package/dist/commands/source.d.ts.map +1 -0
- package/dist/commands/source.js +40 -0
- package/dist/commands/source.js.map +1 -0
- package/dist/commands/stat.d.ts.map +1 -0
- package/dist/commands/stat.js +57 -0
- package/dist/commands/stat.js.map +1 -0
- package/dist/commands/su.d.ts.map +1 -0
- package/dist/commands/su.js +58 -0
- package/dist/commands/su.js.map +1 -0
- package/dist/commands/sudo.d.ts.map +1 -0
- package/dist/commands/sudo.js +55 -0
- package/dist/commands/sudo.js.map +1 -0
- package/dist/commands/tail.d.ts.map +1 -0
- package/dist/commands/tail.js +48 -0
- package/dist/commands/tail.js.map +1 -0
- package/dist/commands/tar.d.ts.map +1 -0
- package/dist/commands/tar.js +103 -0
- package/dist/commands/tar.js.map +1 -0
- package/dist/commands/tee.d.ts.map +1 -0
- package/dist/commands/tee.js +37 -0
- package/dist/commands/tee.js.map +1 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +115 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/touch.d.ts.map +1 -0
- package/dist/commands/touch.js +26 -0
- package/dist/commands/touch.js.map +1 -0
- package/dist/commands/tr.d.ts.map +1 -0
- package/dist/commands/tr.js +62 -0
- package/dist/commands/tr.js.map +1 -0
- package/dist/commands/tree.d.ts.map +1 -0
- package/dist/commands/tree.js +19 -0
- package/dist/commands/tree.js.map +1 -0
- package/dist/commands/true.d.ts.map +1 -0
- package/dist/commands/true.js +25 -0
- package/dist/commands/true.js.map +1 -0
- package/dist/commands/type.d.ts.map +1 -0
- package/dist/commands/type.js +40 -0
- package/dist/commands/type.js.map +1 -0
- package/dist/commands/uname.d.ts.map +1 -0
- package/dist/commands/uname.js +30 -0
- package/dist/commands/uname.js.map +1 -0
- package/dist/commands/uniq.d.ts.map +1 -0
- package/dist/commands/uniq.js +39 -0
- package/dist/commands/uniq.js.map +1 -0
- package/dist/commands/unset.d.ts.map +1 -0
- package/dist/commands/unset.js +17 -0
- package/dist/commands/unset.js.map +1 -0
- package/dist/commands/uptime.d.ts.map +1 -0
- package/dist/commands/uptime.js +49 -0
- package/dist/commands/uptime.js.map +1 -0
- package/dist/commands/wc.d.ts.map +1 -0
- package/dist/commands/wc.js +56 -0
- package/dist/commands/wc.js.map +1 -0
- package/dist/commands/wget.d.ts.map +1 -0
- package/dist/commands/wget.js +127 -0
- package/dist/commands/wget.js.map +1 -0
- package/dist/commands/which.d.ts.map +1 -0
- package/dist/commands/which.js +33 -0
- package/dist/commands/which.js.map +1 -0
- package/dist/commands/who.d.ts.map +1 -0
- package/dist/commands/who.js +23 -0
- package/dist/commands/who.js.map +1 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +13 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/commands/xargs.d.ts.map +1 -0
- package/dist/commands/xargs.js +22 -0
- package/dist/commands/xargs.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/linuxRootfs.d.ts.map +1 -0
- package/dist/modules/linuxRootfs.js +620 -0
- package/dist/modules/linuxRootfs.js.map +1 -0
- package/dist/modules/neofetch.d.ts.map +1 -0
- package/dist/modules/neofetch.js +285 -0
- package/dist/modules/neofetch.js.map +1 -0
- package/dist/modules/shellInteractive.d.ts.map +1 -0
- package/dist/modules/shellInteractive.js +27 -0
- package/dist/modules/shellInteractive.js.map +1 -0
- package/dist/modules/shellRuntime.d.ts.map +1 -0
- package/dist/modules/shellRuntime.js +53 -0
- package/dist/modules/shellRuntime.js.map +1 -0
- package/dist/self-standalone.d.ts.map +1 -0
- package/dist/self-standalone.js +419 -0
- package/dist/self-standalone.js.map +1 -0
- package/dist/standalone-wo-sftp.d.ts.map +1 -0
- package/dist/standalone-wo-sftp.js +31 -0
- package/dist/standalone-wo-sftp.js.map +1 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/standalone.js +36 -0
- package/dist/standalone.js.map +1 -0
- package/dist/types/commands.d.ts.map +1 -0
- package/dist/types/commands.js +1 -0
- package/dist/types/commands.js.map +1 -0
- package/dist/types/pipeline.d.ts.map +1 -0
- package/dist/types/pipeline.js +1 -0
- package/dist/types/pipeline.js.map +1 -0
- package/dist/types/streams.d.ts.map +1 -0
- package/dist/types/streams.js +1 -0
- package/dist/types/streams.js.map +1 -0
- package/dist/types/vfs.d.ts.map +1 -0
- package/dist/types/vfs.js +1 -0
- package/dist/types/vfs.js.map +1 -0
- package/dist/utils/expand.d.ts.map +1 -0
- package/dist/utils/expand.js +477 -0
- package/dist/utils/expand.js.map +1 -0
- package/dist/utils/perfLogger.d.ts.map +1 -0
- package/dist/utils/perfLogger.js +50 -0
- package/dist/utils/perfLogger.js.map +1 -0
- package/dist/utils/tokenize.d.ts.map +1 -0
- package/dist/utils/tokenize.js +115 -0
- package/dist/utils/tokenize.js.map +1 -0
- package/dist/utils/vfsDiff.d.ts.map +1 -0
- package/dist/utils/vfsDiff.js +178 -0
- package/dist/utils/vfsDiff.js.map +1 -0
- package/dist/web-api.d.ts.map +1 -0
- package/dist/web-api.js +47 -0
- package/dist/web-api.js.map +1 -0
- package/dist/web-full.d.ts.map +1 -0
- package/dist/web-full.js +9 -0
- package/dist/web-full.js.map +1 -0
- package/dist/web.d.ts.map +1 -0
- package/dist/web.js +774 -0
- package/dist/web.js.map +1 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +162 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/classes/HoneyPot.html +31 -0
- package/docs/classes/SshClient.html +66 -0
- package/docs/classes/VirtualFileSystem.html +262 -0
- package/docs/classes/VirtualPackageManager.html +63 -0
- package/docs/classes/VirtualSftpServer.html +169 -0
- package/docs/classes/VirtualShell.html +265 -0
- package/docs/classes/VirtualSshServer.html +177 -0
- package/docs/classes/VirtualUserManager.html +276 -0
- package/docs/docs/.nojekyll +1 -0
- package/docs/docs/assets/hierarchy.js +1 -0
- package/docs/docs/assets/highlight.css +162 -0
- package/docs/docs/assets/icons.js +18 -0
- package/docs/docs/assets/icons.svg +1 -0
- package/docs/docs/assets/main.js +60 -0
- package/docs/docs/assets/navigation.js +1 -0
- package/docs/docs/assets/search.js +1 -0
- package/docs/docs/assets/style.css +1633 -0
- package/docs/docs/hierarchy.html +1 -0
- package/docs/docs/index.html +1842 -0
- package/docs/docs/media/LICENSE +21 -0
- package/docs/docs/modules.html +1 -0
- package/docs/functions/assertDiff.html +6 -0
- package/docs/functions/diffSnapshots.html +7 -0
- package/docs/functions/formatDiff.html +6 -0
- package/docs/functions/getArg.html +13 -0
- package/docs/functions/getFlag.html +15 -0
- package/docs/functions/ifFlag.html +11 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +1842 -0
- package/docs/interfaces/AuditLogEntry.html +6 -0
- package/docs/interfaces/CommandContext.html +22 -0
- package/docs/interfaces/CommandResult.html +26 -0
- package/docs/interfaces/ExecStream.html +11 -0
- package/docs/interfaces/HoneyPotStats.html +14 -0
- package/docs/interfaces/InstalledPackage.html +20 -0
- package/docs/interfaces/NanoEditorSession.html +8 -0
- package/docs/interfaces/PackageDefinition.html +30 -0
- package/docs/interfaces/PackageFile.html +8 -0
- package/docs/interfaces/RemoveOptions.html +4 -0
- package/docs/interfaces/ShellEnv.html +6 -0
- package/docs/interfaces/ShellModule.html +14 -0
- package/docs/interfaces/ShellProperties.html +14 -0
- package/docs/interfaces/ShellStream.html +11 -0
- package/docs/interfaces/SudoChallenge.html +24 -0
- package/docs/interfaces/VfsBaseNode.html +12 -0
- package/docs/interfaces/VfsDiff.html +10 -0
- package/docs/interfaces/VfsDiffEntry.html +6 -0
- package/docs/interfaces/VfsDiffModified.html +10 -0
- package/docs/interfaces/VfsDirectoryNode.html +15 -0
- package/docs/interfaces/VfsFileNode.html +17 -0
- package/docs/interfaces/VfsOptions.html +12 -0
- package/docs/interfaces/VfsSnapshot.html +3 -0
- package/docs/interfaces/VfsSnapshotBaseNode.html +8 -0
- package/docs/interfaces/VfsSnapshotDirectoryNode.html +10 -0
- package/docs/interfaces/VfsSnapshotFileNode.html +12 -0
- package/docs/interfaces/WriteFileOptions.html +6 -0
- package/docs/media/LICENSE +21 -0
- package/docs/modules.html +1 -0
- package/docs/types/CommandMode.html +2 -0
- package/docs/types/CommandOutcome.html +2 -0
- package/docs/types/VfsNodeStats.html +2 -0
- package/docs/types/VfsNodeType.html +2 -0
- package/docs/types/VfsPersistenceMode.html +5 -0
- package/docs/types/VfsSnapshotNode.html +2 -0
- package/examples/web.min.js +5 -5
- package/package.json +4 -2
- package/tsconfig.json +7 -2
- package/typedoc.json +8 -0
- package/src/Honeypot/index.d.ts.map +0 -1
- package/src/Honeypot/index.js +0 -298
- package/src/SSHClient/index.d.ts.map +0 -1
- package/src/SSHClient/index.js +0 -237
- package/src/SSHMimic/exec.d.ts.map +0 -1
- package/src/SSHMimic/exec.js +0 -27
- package/src/SSHMimic/executor.d.ts.map +0 -1
- package/src/SSHMimic/executor.js +0 -160
- package/src/SSHMimic/hostKey.d.ts.map +0 -1
- package/src/SSHMimic/hostKey.js +0 -17
- package/src/SSHMimic/index.d.ts.map +0 -1
- package/src/SSHMimic/index.js +0 -249
- package/src/SSHMimic/loginBanner.d.ts.map +0 -1
- package/src/SSHMimic/loginBanner.js +0 -22
- package/src/SSHMimic/loginFormat.d.ts.map +0 -1
- package/src/SSHMimic/loginFormat.js +0 -10
- package/src/SSHMimic/prompt.d.ts.map +0 -1
- package/src/SSHMimic/prompt.js +0 -9
- package/src/SSHMimic/sftp.d.ts.map +0 -1
- package/src/SSHMimic/sftp.js +0 -619
- package/src/VirtualFileSystem/binaryPack.d.ts.map +0 -1
- package/src/VirtualFileSystem/binaryPack.js +0 -216
- package/src/VirtualFileSystem/index.d.ts.map +0 -1
- package/src/VirtualFileSystem/index.js +0 -689
- package/src/VirtualFileSystem/internalTypes.d.ts.map +0 -1
- package/src/VirtualFileSystem/internalTypes.js +0 -0
- package/src/VirtualFileSystem/path.d.ts.map +0 -1
- package/src/VirtualFileSystem/path.js +0 -49
- package/src/VirtualPackageManager/index.d.ts.map +0 -1
- package/src/VirtualPackageManager/index.js +0 -853
- package/src/VirtualShell/index.d.ts.map +0 -1
- package/src/VirtualShell/index.js +0 -284
- package/src/VirtualShell/shell.d.ts.map +0 -1
- package/src/VirtualShell/shell.js +0 -502
- package/src/VirtualShell/shellParser.d.ts.map +0 -1
- package/src/VirtualShell/shellParser.js +0 -265
- package/src/VirtualUserManager/index.d.ts.map +0 -1
- package/src/VirtualUserManager/index.js +0 -607
- package/src/commands/adduser.d.ts.map +0 -1
- package/src/commands/adduser.js +0 -89
- package/src/commands/alias.d.ts.map +0 -1
- package/src/commands/alias.js +0 -68
- package/src/commands/apt.d.ts.map +0 -1
- package/src/commands/apt.js +0 -210
- package/src/commands/awk.d.ts.map +0 -1
- package/src/commands/awk.js +0 -169
- package/src/commands/base64.d.ts.map +0 -1
- package/src/commands/base64.js +0 -28
- package/src/commands/cat.d.ts.map +0 -1
- package/src/commands/cat.js +0 -44
- package/src/commands/cd.d.ts.map +0 -1
- package/src/commands/cd.js +0 -21
- package/src/commands/chmod.d.ts.map +0 -1
- package/src/commands/chmod.js +0 -87
- package/src/commands/clear.d.ts.map +0 -1
- package/src/commands/clear.js +0 -13
- package/src/commands/command-helpers.d.ts.map +0 -1
- package/src/commands/command-helpers.js +0 -221
- package/src/commands/cp.d.ts.map +0 -1
- package/src/commands/cp.js +0 -75
- package/src/commands/curl.d.ts.map +0 -1
- package/src/commands/curl.js +0 -127
- package/src/commands/cut.d.ts.map +0 -1
- package/src/commands/cut.js +0 -34
- package/src/commands/date.d.ts.map +0 -1
- package/src/commands/date.js +0 -28
- package/src/commands/declare.d.ts.map +0 -1
- package/src/commands/declare.js +0 -44
- package/src/commands/deluser.d.ts.map +0 -1
- package/src/commands/deluser.js +0 -83
- package/src/commands/df.d.ts.map +0 -1
- package/src/commands/df.js +0 -21
- package/src/commands/diff.d.ts.map +0 -1
- package/src/commands/diff.js +0 -45
- package/src/commands/dpkg.d.ts.map +0 -1
- package/src/commands/dpkg.js +0 -161
- package/src/commands/du.d.ts.map +0 -1
- package/src/commands/du.js +0 -50
- package/src/commands/echo.d.ts.map +0 -1
- package/src/commands/echo.js +0 -45
- package/src/commands/env.d.ts.map +0 -1
- package/src/commands/env.js +0 -20
- package/src/commands/exit.d.ts.map +0 -1
- package/src/commands/exit.js +0 -16
- package/src/commands/export.d.ts.map +0 -1
- package/src/commands/export.js +0 -33
- package/src/commands/find.d.ts.map +0 -1
- package/src/commands/find.js +0 -55
- package/src/commands/free.d.ts.map +0 -1
- package/src/commands/free.js +0 -43
- package/src/commands/grep.d.ts.map +0 -1
- package/src/commands/grep.js +0 -120
- package/src/commands/groups.d.ts.map +0 -1
- package/src/commands/groups.js +0 -17
- package/src/commands/gzip.d.ts.map +0 -1
- package/src/commands/gzip.js +0 -82
- package/src/commands/head.d.ts.map +0 -1
- package/src/commands/head.js +0 -46
- package/src/commands/help.d.ts.map +0 -1
- package/src/commands/help.js +0 -123
- package/src/commands/helpers.d.ts.map +0 -1
- package/src/commands/helpers.js +0 -166
- package/src/commands/history.d.ts.map +0 -1
- package/src/commands/history.js +0 -26
- package/src/commands/hostname.d.ts.map +0 -1
- package/src/commands/hostname.js +0 -12
- package/src/commands/htop.d.ts.map +0 -1
- package/src/commands/htop.js +0 -17
- package/src/commands/id.d.ts.map +0 -1
- package/src/commands/id.js +0 -17
- package/src/commands/index.d.ts.map +0 -1
- package/src/commands/index.js +0 -2
- package/src/commands/kill.d.ts.map +0 -1
- package/src/commands/kill.js +0 -18
- package/src/commands/ln.d.ts.map +0 -1
- package/src/commands/ln.js +0 -66
- package/src/commands/ls.d.ts.map +0 -1
- package/src/commands/ls.js +0 -200
- package/src/commands/lsb-release.d.ts.map +0 -1
- package/src/commands/lsb-release.js +0 -61
- package/src/commands/man.d.ts.map +0 -1
- package/src/commands/man.js +0 -49
- package/src/commands/mkdir.d.ts.map +0 -1
- package/src/commands/mkdir.js +0 -28
- package/src/commands/mv.d.ts.map +0 -1
- package/src/commands/mv.js +0 -42
- package/src/commands/nano.d.ts.map +0 -1
- package/src/commands/nano.js +0 -34
- package/src/commands/neofetch.d.ts.map +0 -1
- package/src/commands/neofetch.js +0 -48
- package/src/commands/node.d.ts.map +0 -1
- package/src/commands/node.js +0 -316
- package/src/commands/npm.d.ts.map +0 -1
- package/src/commands/npm.js +0 -109
- package/src/commands/passwd.d.ts.map +0 -1
- package/src/commands/passwd.js +0 -44
- package/src/commands/ping.d.ts.map +0 -1
- package/src/commands/ping.js +0 -28
- package/src/commands/printf.d.ts.map +0 -1
- package/src/commands/printf.js +0 -144
- package/src/commands/ps.d.ts.map +0 -1
- package/src/commands/ps.js +0 -46
- package/src/commands/pwd.d.ts.map +0 -1
- package/src/commands/pwd.js +0 -7
- package/src/commands/python.d.ts.map +0 -1
- package/src/commands/python.js +0 -2058
- package/src/commands/read.d.ts.map +0 -1
- package/src/commands/read.js +0 -39
- package/src/commands/registry.d.ts.map +0 -1
- package/src/commands/registry.js +0 -234
- package/src/commands/rm.d.ts.map +0 -1
- package/src/commands/rm.js +0 -36
- package/src/commands/runtime.d.ts.map +0 -1
- package/src/commands/runtime.js +0 -285
- package/src/commands/sed.d.ts.map +0 -1
- package/src/commands/sed.js +0 -60
- package/src/commands/seq.d.ts.map +0 -1
- package/src/commands/seq.js +0 -50
- package/src/commands/set.d.ts.map +0 -1
- package/src/commands/set.js +0 -26
- package/src/commands/sh.d.ts.map +0 -1
- package/src/commands/sh.js +0 -431
- package/src/commands/shift.d.ts.map +0 -1
- package/src/commands/shift.js +0 -62
- package/src/commands/sleep.d.ts.map +0 -1
- package/src/commands/sleep.js +0 -18
- package/src/commands/sort.d.ts.map +0 -1
- package/src/commands/sort.js +0 -44
- package/src/commands/source.d.ts.map +0 -1
- package/src/commands/source.js +0 -39
- package/src/commands/stat.d.ts.map +0 -1
- package/src/commands/stat.js +0 -56
- package/src/commands/su.d.ts.map +0 -1
- package/src/commands/su.js +0 -57
- package/src/commands/sudo.d.ts.map +0 -1
- package/src/commands/sudo.js +0 -54
- package/src/commands/tail.d.ts.map +0 -1
- package/src/commands/tail.js +0 -47
- package/src/commands/tar.d.ts.map +0 -1
- package/src/commands/tar.js +0 -102
- package/src/commands/tee.d.ts.map +0 -1
- package/src/commands/tee.js +0 -36
- package/src/commands/test.d.ts.map +0 -1
- package/src/commands/test.js +0 -114
- package/src/commands/touch.d.ts.map +0 -1
- package/src/commands/touch.js +0 -25
- package/src/commands/tr.d.ts.map +0 -1
- package/src/commands/tr.js +0 -61
- package/src/commands/tree.d.ts.map +0 -1
- package/src/commands/tree.js +0 -18
- package/src/commands/true.d.ts.map +0 -1
- package/src/commands/true.js +0 -24
- package/src/commands/type.d.ts.map +0 -1
- package/src/commands/type.js +0 -39
- package/src/commands/uname.d.ts.map +0 -1
- package/src/commands/uname.js +0 -29
- package/src/commands/uniq.d.ts.map +0 -1
- package/src/commands/uniq.js +0 -38
- package/src/commands/unset.d.ts.map +0 -1
- package/src/commands/unset.js +0 -16
- package/src/commands/uptime.d.ts.map +0 -1
- package/src/commands/uptime.js +0 -48
- package/src/commands/wc.d.ts.map +0 -1
- package/src/commands/wc.js +0 -55
- package/src/commands/wget.d.ts.map +0 -1
- package/src/commands/wget.js +0 -126
- package/src/commands/which.d.ts.map +0 -1
- package/src/commands/which.js +0 -32
- package/src/commands/who.d.ts.map +0 -1
- package/src/commands/who.js +0 -22
- package/src/commands/whoami.d.ts.map +0 -1
- package/src/commands/whoami.js +0 -12
- package/src/commands/xargs.d.ts.map +0 -1
- package/src/commands/xargs.js +0 -21
- package/src/index.d.ts.map +0 -1
- package/src/index.js +0 -9
- package/src/modules/linuxRootfs.d.ts.map +0 -1
- package/src/modules/linuxRootfs.js +0 -619
- package/src/modules/neofetch.d.ts.map +0 -1
- package/src/modules/neofetch.js +0 -284
- package/src/modules/shellInteractive.d.ts.map +0 -1
- package/src/modules/shellInteractive.js +0 -26
- package/src/modules/shellRuntime.d.ts.map +0 -1
- package/src/modules/shellRuntime.js +0 -52
- package/src/self-standalone.d.ts.map +0 -1
- package/src/self-standalone.js +0 -418
- package/src/standalone-wo-sftp.d.ts.map +0 -1
- package/src/standalone-wo-sftp.js +0 -30
- package/src/standalone.d.ts.map +0 -1
- package/src/standalone.js +0 -35
- package/src/types/commands.d.ts.map +0 -1
- package/src/types/commands.js +0 -0
- package/src/types/pipeline.d.ts.map +0 -1
- package/src/types/pipeline.js +0 -0
- package/src/types/streams.d.ts.map +0 -1
- package/src/types/streams.js +0 -0
- package/src/types/vfs.d.ts.map +0 -1
- package/src/types/vfs.js +0 -0
- package/src/utils/expand.d.ts.map +0 -1
- package/src/utils/expand.js +0 -476
- package/src/utils/perfLogger.d.ts.map +0 -1
- package/src/utils/perfLogger.js +0 -49
- package/src/utils/tokenize.d.ts.map +0 -1
- package/src/utils/tokenize.js +0 -114
- package/src/utils/vfsDiff.d.ts.map +0 -1
- package/src/utils/vfsDiff.js +0 -177
- package/src/web-api.d.ts.map +0 -1
- package/src/web-api.js +0 -46
- package/src/web-full.d.ts.map +0 -1
- package/src/web-full.js +0 -8
- package/src/web.d.ts.map +0 -1
- package/src/web.js +0 -773
- package/tests/command-helpers.test.d.ts +0 -2
- package/tests/command-helpers.test.d.ts.map +0 -1
- package/tests/command-helpers.test.js +0 -92
- package/tests/commands-admin-net.test.d.ts +0 -2
- package/tests/commands-admin-net.test.d.ts.map +0 -1
- package/tests/commands-admin-net.test.js +0 -353
- package/tests/commands-advanced.test.d.ts +0 -2
- package/tests/commands-advanced.test.d.ts.map +0 -1
- package/tests/commands-advanced.test.js +0 -378
- package/tests/commands-core.test.d.ts +0 -2
- package/tests/commands-core.test.d.ts.map +0 -1
- package/tests/commands-core.test.js +0 -477
- package/tests/commands-missing.test.d.ts +0 -2
- package/tests/commands-missing.test.d.ts.map +0 -1
- package/tests/commands-missing.test.js +0 -470
- package/tests/commands-specific-units.test.d.ts +0 -2
- package/tests/commands-specific-units.test.d.ts.map +0 -1
- package/tests/commands-specific-units.test.js +0 -264
- package/tests/commands-text-sys.test.d.ts +0 -2
- package/tests/commands-text-sys.test.d.ts.map +0 -1
- package/tests/commands-text-sys.test.js +0 -366
- package/tests/expand.test.d.ts +0 -2
- package/tests/expand.test.d.ts.map +0 -1
- package/tests/expand.test.js +0 -138
- package/tests/helpers.test.d.ts +0 -2
- package/tests/helpers.test.d.ts.map +0 -1
- package/tests/helpers.test.js +0 -52
- package/tests/new-features.test.d.ts +0 -2
- package/tests/new-features.test.d.ts.map +0 -1
- package/tests/new-features.test.js +0 -850
- package/tests/parser-executor.test.d.ts +0 -2
- package/tests/parser-executor.test.d.ts.map +0 -1
- package/tests/parser-executor.test.js +0 -25
- package/tests/sftp.test.d.ts +0 -2
- package/tests/sftp.test.d.ts.map +0 -1
- package/tests/sftp.test.js +0 -246
- package/tests/ssh-exec.test.d.ts +0 -2
- package/tests/ssh-exec.test.d.ts.map +0 -1
- package/tests/ssh-exec.test.js +0 -39
- package/tests/test-helper.d.ts +0 -56
- package/tests/test-helper.d.ts.map +0 -1
- package/tests/test-helper.js +0 -71
- package/tests/users.test.d.ts +0 -2
- package/tests/users.test.d.ts.map +0 -1
- package/tests/users.test.js +0 -71
- package/tests/web.test.d.ts +0 -2
- package/tests/web.test.d.ts.map +0 -1
- package/tests/web.test.js +0 -149
- /package/{src → dist}/Honeypot/index.d.ts +0 -0
- /package/{src → dist}/SSHClient/index.d.ts +0 -0
- /package/{src → dist}/SSHMimic/exec.d.ts +0 -0
- /package/{src → dist}/SSHMimic/executor.d.ts +0 -0
- /package/{src → dist}/SSHMimic/hostKey.d.ts +0 -0
- /package/{src → dist}/SSHMimic/index.d.ts +0 -0
- /package/{src → dist}/SSHMimic/loginBanner.d.ts +0 -0
- /package/{src → dist}/SSHMimic/loginFormat.d.ts +0 -0
- /package/{src → dist}/SSHMimic/prompt.d.ts +0 -0
- /package/{src → dist}/SSHMimic/sftp.d.ts +0 -0
- /package/{src → dist}/VirtualFileSystem/binaryPack.d.ts +0 -0
- /package/{src → dist}/VirtualFileSystem/index.d.ts +0 -0
- /package/{src → dist}/VirtualFileSystem/internalTypes.d.ts +0 -0
- /package/{src → dist}/VirtualFileSystem/path.d.ts +0 -0
- /package/{src → dist}/VirtualPackageManager/index.d.ts +0 -0
- /package/{src → dist}/VirtualShell/index.d.ts +0 -0
- /package/{src → dist}/VirtualShell/shell.d.ts +0 -0
- /package/{src → dist}/VirtualShell/shellParser.d.ts +0 -0
- /package/{src → dist}/VirtualUserManager/index.d.ts +0 -0
- /package/{src → dist}/commands/adduser.d.ts +0 -0
- /package/{src → dist}/commands/alias.d.ts +0 -0
- /package/{src → dist}/commands/apt.d.ts +0 -0
- /package/{src → dist}/commands/awk.d.ts +0 -0
- /package/{src → dist}/commands/base64.d.ts +0 -0
- /package/{src → dist}/commands/cat.d.ts +0 -0
- /package/{src → dist}/commands/cd.d.ts +0 -0
- /package/{src → dist}/commands/chmod.d.ts +0 -0
- /package/{src → dist}/commands/clear.d.ts +0 -0
- /package/{src → dist}/commands/command-helpers.d.ts +0 -0
- /package/{src → dist}/commands/cp.d.ts +0 -0
- /package/{src → dist}/commands/curl.d.ts +0 -0
- /package/{src → dist}/commands/cut.d.ts +0 -0
- /package/{src → dist}/commands/date.d.ts +0 -0
- /package/{src → dist}/commands/declare.d.ts +0 -0
- /package/{src → dist}/commands/deluser.d.ts +0 -0
- /package/{src → dist}/commands/df.d.ts +0 -0
- /package/{src → dist}/commands/diff.d.ts +0 -0
- /package/{src → dist}/commands/dpkg.d.ts +0 -0
- /package/{src → dist}/commands/du.d.ts +0 -0
- /package/{src → dist}/commands/echo.d.ts +0 -0
- /package/{src → dist}/commands/env.d.ts +0 -0
- /package/{src → dist}/commands/exit.d.ts +0 -0
- /package/{src → dist}/commands/export.d.ts +0 -0
- /package/{src → dist}/commands/find.d.ts +0 -0
- /package/{src → dist}/commands/free.d.ts +0 -0
- /package/{src → dist}/commands/grep.d.ts +0 -0
- /package/{src → dist}/commands/groups.d.ts +0 -0
- /package/{src → dist}/commands/gzip.d.ts +0 -0
- /package/{src → dist}/commands/head.d.ts +0 -0
- /package/{src → dist}/commands/help.d.ts +0 -0
- /package/{src → dist}/commands/helpers.d.ts +0 -0
- /package/{src → dist}/commands/history.d.ts +0 -0
- /package/{src → dist}/commands/hostname.d.ts +0 -0
- /package/{src → dist}/commands/htop.d.ts +0 -0
- /package/{src → dist}/commands/id.d.ts +0 -0
- /package/{src → dist}/commands/index.d.ts +0 -0
- /package/{src → dist}/commands/kill.d.ts +0 -0
- /package/{src → dist}/commands/ln.d.ts +0 -0
- /package/{src → dist}/commands/ls.d.ts +0 -0
- /package/{src → dist}/commands/lsb-release.d.ts +0 -0
- /package/{src → dist}/commands/man.d.ts +0 -0
- /package/{src → dist}/commands/mkdir.d.ts +0 -0
- /package/{src → dist}/commands/mv.d.ts +0 -0
- /package/{src → dist}/commands/nano.d.ts +0 -0
- /package/{src → dist}/commands/neofetch.d.ts +0 -0
- /package/{src → dist}/commands/node.d.ts +0 -0
- /package/{src → dist}/commands/npm.d.ts +0 -0
- /package/{src → dist}/commands/passwd.d.ts +0 -0
- /package/{src → dist}/commands/ping.d.ts +0 -0
- /package/{src → dist}/commands/printf.d.ts +0 -0
- /package/{src → dist}/commands/ps.d.ts +0 -0
- /package/{src → dist}/commands/pwd.d.ts +0 -0
- /package/{src → dist}/commands/python.d.ts +0 -0
- /package/{src → dist}/commands/read.d.ts +0 -0
- /package/{src → dist}/commands/registry.d.ts +0 -0
- /package/{src → dist}/commands/rm.d.ts +0 -0
- /package/{src → dist}/commands/runtime.d.ts +0 -0
- /package/{src → dist}/commands/sed.d.ts +0 -0
- /package/{src → dist}/commands/seq.d.ts +0 -0
- /package/{src → dist}/commands/set.d.ts +0 -0
- /package/{src → dist}/commands/sh.d.ts +0 -0
- /package/{src → dist}/commands/shift.d.ts +0 -0
- /package/{src → dist}/commands/sleep.d.ts +0 -0
- /package/{src → dist}/commands/sort.d.ts +0 -0
- /package/{src → dist}/commands/source.d.ts +0 -0
- /package/{src → dist}/commands/stat.d.ts +0 -0
- /package/{src → dist}/commands/su.d.ts +0 -0
- /package/{src → dist}/commands/sudo.d.ts +0 -0
- /package/{src → dist}/commands/tail.d.ts +0 -0
- /package/{src → dist}/commands/tar.d.ts +0 -0
- /package/{src → dist}/commands/tee.d.ts +0 -0
- /package/{src → dist}/commands/test.d.ts +0 -0
- /package/{src → dist}/commands/touch.d.ts +0 -0
- /package/{src → dist}/commands/tr.d.ts +0 -0
- /package/{src → dist}/commands/tree.d.ts +0 -0
- /package/{src → dist}/commands/true.d.ts +0 -0
- /package/{src → dist}/commands/type.d.ts +0 -0
- /package/{src → dist}/commands/uname.d.ts +0 -0
- /package/{src → dist}/commands/uniq.d.ts +0 -0
- /package/{src → dist}/commands/unset.d.ts +0 -0
- /package/{src → dist}/commands/uptime.d.ts +0 -0
- /package/{src → dist}/commands/wc.d.ts +0 -0
- /package/{src → dist}/commands/wget.d.ts +0 -0
- /package/{src → dist}/commands/which.d.ts +0 -0
- /package/{src → dist}/commands/who.d.ts +0 -0
- /package/{src → dist}/commands/whoami.d.ts +0 -0
- /package/{src → dist}/commands/xargs.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
- /package/{src → dist}/modules/linuxRootfs.d.ts +0 -0
- /package/{src → dist}/modules/neofetch.d.ts +0 -0
- /package/{src → dist}/modules/shellInteractive.d.ts +0 -0
- /package/{src → dist}/modules/shellRuntime.d.ts +0 -0
- /package/{src → dist}/self-standalone.d.ts +0 -0
- /package/{src → dist}/standalone-wo-sftp.d.ts +0 -0
- /package/{src → dist}/standalone.d.ts +0 -0
- /package/{src → dist}/types/commands.d.ts +0 -0
- /package/{src → dist}/types/pipeline.d.ts +0 -0
- /package/{src → dist}/types/streams.d.ts +0 -0
- /package/{src → dist}/types/vfs.d.ts +0 -0
- /package/{src → dist}/utils/expand.d.ts +0 -0
- /package/{src → dist}/utils/perfLogger.d.ts +0 -0
- /package/{src → dist}/utils/tokenize.d.ts +0 -0
- /package/{src → dist}/utils/vfsDiff.d.ts +0 -0
- /package/{src → dist}/web-api.d.ts +0 -0
- /package/{src → dist}/web-full.d.ts +0 -0
- /package/{src → dist}/web.d.ts +0 -0
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
/** biome-ignore-all lint/style/useNamingConvention: ENV VAR KEYS + system names */
|
|
2
|
+
/**
|
|
3
|
+
* linuxRootfs.ts
|
|
4
|
+
*
|
|
5
|
+
* Bootstraps a realistic Linux directory hierarchy in the VFS.
|
|
6
|
+
* Called once during VirtualShell initialization. Idempotent — skips
|
|
7
|
+
* paths that already exist so FS-mode snapshots survive restarts.
|
|
8
|
+
*
|
|
9
|
+
* Public API:
|
|
10
|
+
* - bootstrapLinuxRootfs() one-shot boot (VirtualShell calls this)
|
|
11
|
+
* - refreshProc() refresh /proc/* (call on session changes)
|
|
12
|
+
* - syncEtcPasswd() sync /etc/passwd|group|shadow from UserManager
|
|
13
|
+
* - createLinuxRootfsEngine() returns engine with .boot() + .tick() for
|
|
14
|
+
* runtimes that want a live refresh loop
|
|
15
|
+
*/
|
|
16
|
+
import * as os from "node:os";
|
|
17
|
+
// ─── helpers ────────────────────────────────────────────────────────────────
|
|
18
|
+
function ensureDir(vfs, path, mode = 0o755) {
|
|
19
|
+
if (!vfs.exists(path))
|
|
20
|
+
vfs.mkdir(path, mode);
|
|
21
|
+
}
|
|
22
|
+
function ensureFile(vfs, path, content, mode = 0o644) {
|
|
23
|
+
if (!vfs.exists(path))
|
|
24
|
+
vfs.writeFile(path, content, { mode });
|
|
25
|
+
}
|
|
26
|
+
function write(vfs, path, content) {
|
|
27
|
+
vfs.writeFile(path, content);
|
|
28
|
+
}
|
|
29
|
+
/** FNV-1a 32-bit — deterministic seed from any string */
|
|
30
|
+
function fnv1a(str) {
|
|
31
|
+
let h = 2166136261;
|
|
32
|
+
for (let i = 0; i < str.length; i++) {
|
|
33
|
+
h ^= str.charCodeAt(i);
|
|
34
|
+
h = Math.imul(h, 16777619);
|
|
35
|
+
}
|
|
36
|
+
return h >>> 0;
|
|
37
|
+
}
|
|
38
|
+
// ─── /etc ────────────────────────────────────────────────────────────────────
|
|
39
|
+
function bootstrapEtc(vfs, hostname, props) {
|
|
40
|
+
ensureDir(vfs, "/etc");
|
|
41
|
+
// os-release — authoritative distro identity used by neofetch, lsb_release
|
|
42
|
+
ensureFile(vfs, "/etc/os-release", `${[
|
|
43
|
+
`NAME="Fortune GNU/Linux"`,
|
|
44
|
+
`PRETTY_NAME="${props.os}"`,
|
|
45
|
+
`ID=fortune`,
|
|
46
|
+
`ID_LIKE=debian`,
|
|
47
|
+
`HOME_URL="https://github.com/itsrealfortune/typescript-virtual-container"`,
|
|
48
|
+
`VERSION_CODENAME=aurora`,
|
|
49
|
+
`VERSION_ID="1.0"`,
|
|
50
|
+
].join("\n")}\n`);
|
|
51
|
+
ensureFile(vfs, "/etc/debian_version", "12.0\n");
|
|
52
|
+
ensureFile(vfs, "/etc/hostname", `${hostname}\n`);
|
|
53
|
+
ensureFile(vfs, "/etc/shells", "/bin/sh\n/bin/bash\n/usr/bin/bash\n");
|
|
54
|
+
ensureFile(vfs, "/etc/profile", `${[
|
|
55
|
+
"export PATH=/usr/local/bin:/usr/bin:/bin",
|
|
56
|
+
"export PS1='\\u@\\h:\\w\\$ '",
|
|
57
|
+
].join("\n")}\n`);
|
|
58
|
+
ensureFile(vfs, "/etc/issue", "Fortune GNU/Linux 1.0 \\n \\l\n");
|
|
59
|
+
ensureFile(vfs, "/etc/motd", ["", `Welcome to ${props.os}`, `Kernel: ${props.kernel}`, ""].join("\n"));
|
|
60
|
+
// APT sources
|
|
61
|
+
ensureDir(vfs, "/etc/apt");
|
|
62
|
+
ensureDir(vfs, "/etc/apt/sources.list.d");
|
|
63
|
+
ensureFile(vfs, "/etc/apt/sources.list", `${[
|
|
64
|
+
"# Fortune GNU/Linux package sources",
|
|
65
|
+
"deb [virtual] fortune://packages.fortune.local aurora main contrib",
|
|
66
|
+
"deb [virtual] fortune://security.fortune.local aurora-security main",
|
|
67
|
+
].join("\n")}\n`);
|
|
68
|
+
// network
|
|
69
|
+
ensureDir(vfs, "/etc/network");
|
|
70
|
+
ensureFile(vfs, "/etc/network/interfaces", `${[
|
|
71
|
+
"auto lo",
|
|
72
|
+
"iface lo inet loopback",
|
|
73
|
+
"",
|
|
74
|
+
"auto eth0",
|
|
75
|
+
"iface eth0 inet dhcp",
|
|
76
|
+
].join("\n")}\n`);
|
|
77
|
+
ensureFile(vfs, "/etc/resolv.conf", "nameserver 1.1.1.1\nnameserver 8.8.8.8\n");
|
|
78
|
+
ensureFile(vfs, "/etc/hosts", `${[
|
|
79
|
+
"127.0.0.1 localhost",
|
|
80
|
+
`127.0.1.1 ${hostname}`,
|
|
81
|
+
"::1 localhost ip6-localhost ip6-loopback",
|
|
82
|
+
].join("\n")}\n`);
|
|
83
|
+
ensureDir(vfs, "/etc/cron.d");
|
|
84
|
+
ensureDir(vfs, "/etc/init.d");
|
|
85
|
+
ensureDir(vfs, "/etc/systemd");
|
|
86
|
+
ensureDir(vfs, "/etc/systemd/system");
|
|
87
|
+
// fstab
|
|
88
|
+
ensureFile(vfs, "/etc/fstab", `${[
|
|
89
|
+
"# <file system> <mount point> <type> <options> <dump> <pass>",
|
|
90
|
+
"UUID=00000000-0000-0000-0000-000000000001 / ext4 errors=remount-ro 0 1",
|
|
91
|
+
"UUID=00000000-0000-0000-0000-000000000002 /boot ext4 defaults 0 2",
|
|
92
|
+
"UUID=00000000-0000-0000-0000-000000000003 none swap sw 0 0",
|
|
93
|
+
"tmpfs /tmp tmpfs defaults,noatime 0 0",
|
|
94
|
+
"tmpfs /run tmpfs defaults,noatime 0 0",
|
|
95
|
+
].join("\n")}\n`);
|
|
96
|
+
// login.defs — useradd/passwd defaults
|
|
97
|
+
ensureFile(vfs, "/etc/login.defs", `${[
|
|
98
|
+
"MAIL_DIR /var/mail",
|
|
99
|
+
"PASS_MAX_DAYS 99999",
|
|
100
|
+
"PASS_MIN_DAYS 0",
|
|
101
|
+
"PASS_WARN_AGE 7",
|
|
102
|
+
"UID_MIN 1000",
|
|
103
|
+
"UID_MAX 60000",
|
|
104
|
+
"GID_MIN 1000",
|
|
105
|
+
"GID_MAX 60000",
|
|
106
|
+
"CREATE_HOME yes",
|
|
107
|
+
"UMASK 022",
|
|
108
|
+
"USERGROUPS_ENAB yes",
|
|
109
|
+
"ENCRYPT_METHOD SHA512",
|
|
110
|
+
].join("\n")}\n`);
|
|
111
|
+
// security + pam
|
|
112
|
+
ensureDir(vfs, "/etc/security");
|
|
113
|
+
ensureFile(vfs, "/etc/security/limits.conf", "# /etc/security/limits.conf\n");
|
|
114
|
+
ensureFile(vfs, "/etc/security/access.conf", "# /etc/security/access.conf\n");
|
|
115
|
+
ensureDir(vfs, "/etc/pam.d");
|
|
116
|
+
ensureFile(vfs, "/etc/pam.d/common-auth", "auth required pam_unix.so\n");
|
|
117
|
+
ensureFile(vfs, "/etc/pam.d/common-account", "account required pam_unix.so\n");
|
|
118
|
+
ensureFile(vfs, "/etc/pam.d/common-password", "password required pam_unix.so obscure sha512\n");
|
|
119
|
+
ensureFile(vfs, "/etc/pam.d/common-session", "session required pam_unix.so\n");
|
|
120
|
+
ensureFile(vfs, "/etc/pam.d/sshd", "@include common-auth\n@include common-account\n@include common-session\n");
|
|
121
|
+
// sudo config
|
|
122
|
+
ensureDir(vfs, "/etc/sudoers.d");
|
|
123
|
+
ensureFile(vfs, "/etc/sudoers", "root ALL=(ALL:ALL) ALL\n%sudo ALL=(ALL:ALL) ALL\n", 0o440);
|
|
124
|
+
// ld
|
|
125
|
+
ensureFile(vfs, "/etc/ld.so.conf", "include /etc/ld.so.conf.d/*.conf\n");
|
|
126
|
+
ensureDir(vfs, "/etc/ld.so.conf.d");
|
|
127
|
+
ensureFile(vfs, "/etc/ld.so.conf.d/x86_64-linux-gnu.conf", "/lib/x86_64-linux-gnu\n/usr/lib/x86_64-linux-gnu\n");
|
|
128
|
+
// locale + timezone
|
|
129
|
+
ensureFile(vfs, "/etc/locale.conf", "LANG=en_US.UTF-8\n");
|
|
130
|
+
ensureFile(vfs, "/etc/timezone", "UTC\n");
|
|
131
|
+
ensureFile(vfs, "/etc/localtime", "UTC\n");
|
|
132
|
+
}
|
|
133
|
+
// ─── /etc/passwd + /etc/group + /etc/shadow ─────────────────────────────────
|
|
134
|
+
/**
|
|
135
|
+
* Sync `/etc/passwd`, `/etc/group`, and `/etc/shadow` from the
|
|
136
|
+
* VirtualUserManager's current user list into the VFS.
|
|
137
|
+
*/
|
|
138
|
+
export function syncEtcPasswd(vfs, users) {
|
|
139
|
+
const userList = users.listUsers();
|
|
140
|
+
const passwdLines = [
|
|
141
|
+
"root:x:0:0:root:/root:/bin/bash",
|
|
142
|
+
"daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin",
|
|
143
|
+
"www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin",
|
|
144
|
+
"nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin",
|
|
145
|
+
];
|
|
146
|
+
let uid = 1000;
|
|
147
|
+
for (const u of userList) {
|
|
148
|
+
if (u === "root")
|
|
149
|
+
continue;
|
|
150
|
+
passwdLines.push(`${u}:x:${uid}:${uid}::/home/${u}:/bin/bash`);
|
|
151
|
+
uid++;
|
|
152
|
+
}
|
|
153
|
+
vfs.writeFile("/etc/passwd", `${passwdLines.join("\n")}\n`);
|
|
154
|
+
const groupLines = [
|
|
155
|
+
"root:x:0:",
|
|
156
|
+
"daemon:x:1:",
|
|
157
|
+
`sudo:x:27:${userList.filter((u) => users.isSudoer(u)).join(",")}`,
|
|
158
|
+
`users:x:100:${userList.filter((u) => u !== "root").join(",")}`,
|
|
159
|
+
"nogroup:x:65534:",
|
|
160
|
+
];
|
|
161
|
+
vfs.writeFile("/etc/group", `${groupLines.join("\n")}\n`);
|
|
162
|
+
// shadow — fake hashes, never real credentials
|
|
163
|
+
const shadowLines = [
|
|
164
|
+
"root:*:19000:0:99999:7:::",
|
|
165
|
+
"daemon:*:19000:0:99999:7:::",
|
|
166
|
+
];
|
|
167
|
+
for (const u of userList) {
|
|
168
|
+
if (u === "root")
|
|
169
|
+
continue;
|
|
170
|
+
shadowLines.push(`${u}:!:19000:0:99999:7:::`);
|
|
171
|
+
}
|
|
172
|
+
vfs.writeFile("/etc/shadow", `${shadowLines.join("\n")}\n`, { mode: 0o640 });
|
|
173
|
+
}
|
|
174
|
+
// ─── /proc helpers ───────────────────────────────────────────────────────────
|
|
175
|
+
/** Derive a stable virtual PID from a tty string e.g. "pts/0" → 1000 */
|
|
176
|
+
function ttyToPid(tty) {
|
|
177
|
+
const match = tty.match(/(\d+)$/);
|
|
178
|
+
return 1000 + (match?.[1] ? parseInt(match[1], 10) : 0);
|
|
179
|
+
}
|
|
180
|
+
/** Write /proc/<pid>/ subtree for a single virtual process */
|
|
181
|
+
function writeProcPid(vfs, pid, username, _tty, cmdline, startedAt, env) {
|
|
182
|
+
const dir = `/proc/${pid}`;
|
|
183
|
+
ensureDir(vfs, dir);
|
|
184
|
+
ensureDir(vfs, `${dir}/fd`);
|
|
185
|
+
ensureDir(vfs, `${dir}/fdinfo`);
|
|
186
|
+
const uptimeSec = Math.floor((Date.now() - new Date(startedAt).getTime()) / 1000);
|
|
187
|
+
const comm = cmdline.split(/\s+/)[0] ?? "bash";
|
|
188
|
+
write(vfs, `${dir}/cmdline`, `${cmdline.replace(/\s+/g, "\0")}\0`);
|
|
189
|
+
write(vfs, `${dir}/comm`, comm);
|
|
190
|
+
write(vfs, `${dir}/status`, `${[
|
|
191
|
+
`Name: ${comm}`,
|
|
192
|
+
`State: S (sleeping)`,
|
|
193
|
+
`Pid: ${pid}`,
|
|
194
|
+
`PPid: 1`,
|
|
195
|
+
`Uid: 0\t0\t0\t0`,
|
|
196
|
+
`Gid: 0\t0\t0\t0`,
|
|
197
|
+
`VmRSS: 4096 kB`,
|
|
198
|
+
`VmSize: 16384 kB`,
|
|
199
|
+
`Threads: 1`,
|
|
200
|
+
].join("\n")}\n`);
|
|
201
|
+
write(vfs, `${dir}/stat`, `${pid} (${comm}) S 1 ${pid} ${pid} 0 -1 4194304 0 0 0 0 ${uptimeSec} 0 0 0 20 0 1 0 0 16384 4096 0\n`);
|
|
202
|
+
write(vfs, `${dir}/environ`, `${Object.entries(env).map(([k, v]) => `${k}=${v}`).join("\0")}\0`);
|
|
203
|
+
write(vfs, `${dir}/cwd`, `/home/${username}\0`);
|
|
204
|
+
write(vfs, `${dir}/exe`, "/bin/bash\0");
|
|
205
|
+
// Standard fd stubs (stdin/stdout/stderr)
|
|
206
|
+
for (const fd of ["0", "1", "2"]) {
|
|
207
|
+
ensureFile(vfs, `${dir}/fd/${fd}`, "");
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// ─── /proc boot log ──────────────────────────────────────────────────────────
|
|
211
|
+
function bootProcLog(vfs, props) {
|
|
212
|
+
ensureDir(vfs, "/proc/boot");
|
|
213
|
+
ensureFile(vfs, "/proc/boot/log", `${[
|
|
214
|
+
"[ 0.000000] Linux virtual kernel booting...",
|
|
215
|
+
"[ 0.000120] init memory subsystem",
|
|
216
|
+
"[ 0.000240] mount /proc /sys /dev",
|
|
217
|
+
"[ 0.000420] start init",
|
|
218
|
+
"[ 0.000680] system ready",
|
|
219
|
+
].join("\n")}\n`);
|
|
220
|
+
ensureFile(vfs, "/proc/boot/version", `Linux ${props.kernel} (virtual)\n`);
|
|
221
|
+
}
|
|
222
|
+
// ─── /proc refresh ───────────────────────────────────────────────────────────
|
|
223
|
+
/**
|
|
224
|
+
* Populate and refresh `/proc` virtual entries based on host stats and
|
|
225
|
+
* provided active sessions. Rewrites uptime, meminfo, cpuinfo, loadavg,
|
|
226
|
+
* per-pid entries, and /proc/self.
|
|
227
|
+
*
|
|
228
|
+
* Safe to call repeatedly — acts as a live kernel state snapshot.
|
|
229
|
+
*/
|
|
230
|
+
export function refreshProc(vfs, props, hostname, shellStartTime, sessions = []) {
|
|
231
|
+
ensureDir(vfs, "/proc");
|
|
232
|
+
const uptimeSec = Math.floor((Date.now() - shellStartTime) / 1000);
|
|
233
|
+
const idleSec = Math.floor(uptimeSec * 0.9);
|
|
234
|
+
write(vfs, "/proc/uptime", `${uptimeSec}.00 ${idleSec}.00\n`);
|
|
235
|
+
// meminfo — real host values, Linux-compatible format
|
|
236
|
+
const totalMemKb = Math.floor(os.totalmem() / 1024);
|
|
237
|
+
const freeMemKb = Math.floor(os.freemem() / 1024);
|
|
238
|
+
const availMemKb = Math.floor(freeMemKb * 0.95);
|
|
239
|
+
write(vfs, "/proc/meminfo", `${[
|
|
240
|
+
`MemTotal: ${String(totalMemKb).padStart(10)} kB`,
|
|
241
|
+
`MemFree: ${String(freeMemKb).padStart(10)} kB`,
|
|
242
|
+
`MemAvailable: ${String(availMemKb).padStart(10)} kB`,
|
|
243
|
+
`Buffers: ${String(Math.floor(totalMemKb * 0.02)).padStart(10)} kB`,
|
|
244
|
+
`Cached: ${String(Math.floor(totalMemKb * 0.15)).padStart(10)} kB`,
|
|
245
|
+
`SwapTotal: ${String(Math.floor(totalMemKb * 0.5)).padStart(10)} kB`,
|
|
246
|
+
`SwapFree: ${String(Math.floor(totalMemKb * 0.5)).padStart(10)} kB`,
|
|
247
|
+
].join("\n")}\n`);
|
|
248
|
+
// cpuinfo — real host CPU passthrough
|
|
249
|
+
const cpus = os.cpus();
|
|
250
|
+
const cpuLines = [];
|
|
251
|
+
for (let i = 0; i < cpus.length; i++) {
|
|
252
|
+
const c = cpus[i];
|
|
253
|
+
if (!c)
|
|
254
|
+
continue;
|
|
255
|
+
cpuLines.push(`processor\t: ${i}`, `model name\t: ${c.model}`, `cpu MHz\t\t: ${c.speed.toFixed(3)}`, `cache size\t: 8192 KB`, "");
|
|
256
|
+
}
|
|
257
|
+
write(vfs, "/proc/cpuinfo", `${cpuLines.join("\n")}\n`);
|
|
258
|
+
write(vfs, "/proc/version", `Linux version ${props.kernel} (fortune@build) (gcc version 12.2.0) #1 SMP\n`);
|
|
259
|
+
write(vfs, "/proc/hostname", `${hostname}\n`);
|
|
260
|
+
// loadavg — slightly random but bounded
|
|
261
|
+
const load = (Math.random() * 0.5).toFixed(2);
|
|
262
|
+
const numProcs = 1 + sessions.length;
|
|
263
|
+
write(vfs, "/proc/loadavg", `${load} ${load} ${load} ${numProcs}/${numProcs} 1\n`);
|
|
264
|
+
// /proc/net stubs
|
|
265
|
+
ensureDir(vfs, "/proc/net");
|
|
266
|
+
ensureFile(vfs, "/proc/net/dev", `${[
|
|
267
|
+
"Inter-| Receive | Transmit",
|
|
268
|
+
" face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed",
|
|
269
|
+
" lo: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
|
|
270
|
+
" eth0: 131072 1024 0 0 0 0 0 0 65536 512 0 0 0 0 0 0",
|
|
271
|
+
].join("\n")}\n`);
|
|
272
|
+
ensureFile(vfs, "/proc/net/if_inet6", "");
|
|
273
|
+
ensureFile(vfs, "/proc/net/tcp", " sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode\n");
|
|
274
|
+
ensureFile(vfs, "/proc/net/tcp6", " sl local_address remote_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode\n");
|
|
275
|
+
// /proc/cmdline — kernel boot args
|
|
276
|
+
write(vfs, "/proc/cmdline", `BOOT_IMAGE=/boot/vmlinuz-${props.kernel} root=/dev/sda2 ro quiet splash\n`);
|
|
277
|
+
// /proc/filesystems
|
|
278
|
+
ensureFile(vfs, "/proc/filesystems", `${["nodev\tsysfs", "nodev\ttmpfs", "nodev\tproc", "nodev\tdevtmpfs", "\text4", "\tvfat", "nodev\tsquashfs", "nodev\toverlay"].join("\n")}\n`);
|
|
279
|
+
// /proc/mounts (= /proc/self/mounts)
|
|
280
|
+
const mountsContent = `${[
|
|
281
|
+
"sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0",
|
|
282
|
+
"proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0",
|
|
283
|
+
"devtmpfs /dev devtmpfs rw,nosuid,size=8192k,nr_inodes=4096,mode=755 0 0",
|
|
284
|
+
"tmpfs /run tmpfs rw,nosuid,nodev,noexec,relatime,size=204800k,mode=755 0 0",
|
|
285
|
+
"tmpfs /tmp tmpfs rw,nosuid,nodev,noatime 0 0",
|
|
286
|
+
"/dev/sda2 / ext4 rw,relatime,errors=remount-ro 0 0",
|
|
287
|
+
"/dev/sda1 /boot ext4 rw,relatime 0 0",
|
|
288
|
+
"tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0",
|
|
289
|
+
"devpts /dev/pts devpts rw,nosuid,noexec,relatime,mode=620,ptmxmode=000 0 0",
|
|
290
|
+
"squashfs /snap/core squashfs ro,nodev,relatime 0 0",
|
|
291
|
+
].join("\n")}\n`;
|
|
292
|
+
write(vfs, "/proc/mounts", mountsContent);
|
|
293
|
+
ensureDir(vfs, "/proc/self");
|
|
294
|
+
write(vfs, "/proc/self/mounts", mountsContent);
|
|
295
|
+
// /proc/partitions
|
|
296
|
+
write(vfs, "/proc/partitions", `${[
|
|
297
|
+
"major minor #blocks name",
|
|
298
|
+
"",
|
|
299
|
+
" 8 0 41943040 sda",
|
|
300
|
+
" 8 1 524288 sda1",
|
|
301
|
+
" 8 2 41417216 sda2",
|
|
302
|
+
" 7 0 10485760 loop0",
|
|
303
|
+
].join("\n")}\n`);
|
|
304
|
+
// /proc/swaps
|
|
305
|
+
write(vfs, "/proc/swaps", "Filename\t\t\t\tType\t\tSize\t\tUsed\t\tPriority\n" +
|
|
306
|
+
`/dev/sda3\t\t\t\tpartition\t${Math.floor(os.totalmem() / 2048)}\t\t0\t\t-2\n`);
|
|
307
|
+
// /proc/sys — sysctl virtual tree
|
|
308
|
+
ensureDir(vfs, "/proc/sys");
|
|
309
|
+
ensureDir(vfs, "/proc/sys/kernel");
|
|
310
|
+
ensureDir(vfs, "/proc/sys/net");
|
|
311
|
+
ensureDir(vfs, "/proc/sys/vm");
|
|
312
|
+
ensureFile(vfs, "/proc/sys/kernel/hostname", `${hostname}\n`);
|
|
313
|
+
ensureFile(vfs, "/proc/sys/kernel/ostype", "Linux\n");
|
|
314
|
+
ensureFile(vfs, "/proc/sys/kernel/osrelease", `${props.kernel}\n`);
|
|
315
|
+
ensureFile(vfs, "/proc/sys/kernel/pid_max", "32768\n");
|
|
316
|
+
ensureFile(vfs, "/proc/sys/kernel/threads-max", "65536\n");
|
|
317
|
+
ensureFile(vfs, "/proc/sys/kernel/randomize_va_space", "2\n");
|
|
318
|
+
ensureFile(vfs, "/proc/sys/kernel/dmesg_restrict", "0\n");
|
|
319
|
+
ensureFile(vfs, "/proc/sys/net/ipv4/ip_forward", "0\n");
|
|
320
|
+
ensureFile(vfs, "/proc/sys/vm/swappiness", "60\n");
|
|
321
|
+
ensureFile(vfs, "/proc/sys/vm/overcommit_memory", "0\n");
|
|
322
|
+
// init process (PID 1)
|
|
323
|
+
writeProcPid(vfs, 1, "root", "pts/0", "/sbin/init", new Date(shellStartTime).toISOString(), {});
|
|
324
|
+
// per-session processes
|
|
325
|
+
for (const session of sessions) {
|
|
326
|
+
const pid = ttyToPid(session.tty);
|
|
327
|
+
writeProcPid(vfs, pid, session.username, session.tty, "bash", session.startedAt, {
|
|
328
|
+
USER: session.username,
|
|
329
|
+
HOME: `/home/${session.username}`,
|
|
330
|
+
TERM: "xterm-256color",
|
|
331
|
+
SHELL: "/bin/bash",
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
// /proc/self — mirror of most recent session, or init
|
|
335
|
+
const selfPid = sessions.length > 0 ? ttyToPid(sessions[sessions.length - 1].tty) : 1;
|
|
336
|
+
if (vfs.exists("/proc/self")) {
|
|
337
|
+
try {
|
|
338
|
+
vfs.remove("/proc/self");
|
|
339
|
+
}
|
|
340
|
+
catch { /* ignore */ }
|
|
341
|
+
}
|
|
342
|
+
const selfSrc = `/proc/${selfPid}`;
|
|
343
|
+
ensureDir(vfs, "/proc/self");
|
|
344
|
+
ensureDir(vfs, "/proc/self/fd");
|
|
345
|
+
if (vfs.exists(selfSrc)) {
|
|
346
|
+
for (const entry of vfs.list(selfSrc)) {
|
|
347
|
+
const srcPath = `${selfSrc}/${entry}`;
|
|
348
|
+
const dstPath = `/proc/self/${entry}`;
|
|
349
|
+
try {
|
|
350
|
+
const st = vfs.stat(srcPath);
|
|
351
|
+
if (st.type === "file")
|
|
352
|
+
write(vfs, dstPath, vfs.readFile(srcPath));
|
|
353
|
+
}
|
|
354
|
+
catch { /* skip unreadable entries */ }
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
// Minimal fallback
|
|
359
|
+
write(vfs, "/proc/self/cmdline", "bash\0");
|
|
360
|
+
write(vfs, "/proc/self/comm", "bash");
|
|
361
|
+
write(vfs, "/proc/self/status", "Name:\tbash\nState:\tS (sleeping)\nPid:\t1\nPPid:\t0\n");
|
|
362
|
+
write(vfs, "/proc/self/environ", "");
|
|
363
|
+
write(vfs, "/proc/self/cwd", "/root\0");
|
|
364
|
+
write(vfs, "/proc/self/exe", "/bin/bash\0");
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
// ─── /sys ─────────────────────────────────────────────────────────────────────
|
|
368
|
+
function bootstrapSys(vfs, hostname, props) {
|
|
369
|
+
ensureDir(vfs, "/sys");
|
|
370
|
+
ensureDir(vfs, "/sys/devices");
|
|
371
|
+
ensureDir(vfs, "/sys/devices/virtual");
|
|
372
|
+
ensureDir(vfs, "/sys/devices/virtual/dmi");
|
|
373
|
+
ensureDir(vfs, "/sys/devices/virtual/dmi/id");
|
|
374
|
+
const seed = fnv1a(hostname);
|
|
375
|
+
const product = `VirtualNode-${(seed % 10000).toString().padStart(4, "0")}`;
|
|
376
|
+
// Full DMI table — deterministic, seeded from hostname
|
|
377
|
+
const dmi = {
|
|
378
|
+
bios_vendor: "Virtual BIOS",
|
|
379
|
+
bios_version: "1.0",
|
|
380
|
+
bios_date: "01/01/2025",
|
|
381
|
+
sys_vendor: "Fortune Systems",
|
|
382
|
+
product_name: product,
|
|
383
|
+
product_family: "VirtualContainer",
|
|
384
|
+
product_version: "v1",
|
|
385
|
+
product_uuid: `${seed.toString(16).padStart(8, "0")}-0000-0000-0000-000000000000`,
|
|
386
|
+
product_serial: `SN-${seed}`,
|
|
387
|
+
chassis_type: "3",
|
|
388
|
+
chassis_vendor: "Virtual",
|
|
389
|
+
chassis_version: "v1",
|
|
390
|
+
board_name: "fortune-board",
|
|
391
|
+
modalias: `dmi:bvnVirtual:bvr1.0:svnFortune:pn${product}`,
|
|
392
|
+
};
|
|
393
|
+
for (const [k, v] of Object.entries(dmi)) {
|
|
394
|
+
ensureFile(vfs, `/sys/devices/virtual/dmi/id/${k}`, `${v}\n`);
|
|
395
|
+
}
|
|
396
|
+
ensureDir(vfs, "/sys/class");
|
|
397
|
+
ensureDir(vfs, "/sys/class/net");
|
|
398
|
+
ensureDir(vfs, "/sys/kernel");
|
|
399
|
+
ensureFile(vfs, "/sys/kernel/hostname", `${hostname}\n`);
|
|
400
|
+
ensureFile(vfs, "/sys/kernel/osrelease", `${props.kernel}\n`);
|
|
401
|
+
ensureFile(vfs, "/sys/kernel/ostype", "Linux\n");
|
|
402
|
+
}
|
|
403
|
+
// ─── /dev ─────────────────────────────────────────────────────────────────────
|
|
404
|
+
function bootstrapDev(vfs) {
|
|
405
|
+
ensureDir(vfs, "/dev");
|
|
406
|
+
// character devices
|
|
407
|
+
ensureFile(vfs, "/dev/null", "", 0o666);
|
|
408
|
+
ensureFile(vfs, "/dev/zero", "", 0o666);
|
|
409
|
+
ensureFile(vfs, "/dev/full", "", 0o666);
|
|
410
|
+
ensureFile(vfs, "/dev/random", "", 0o444);
|
|
411
|
+
ensureFile(vfs, "/dev/urandom", "", 0o444);
|
|
412
|
+
ensureFile(vfs, "/dev/mem", "", 0o640);
|
|
413
|
+
// terminal devices
|
|
414
|
+
ensureFile(vfs, "/dev/console", "", 0o600);
|
|
415
|
+
ensureFile(vfs, "/dev/tty", "", 0o666);
|
|
416
|
+
ensureFile(vfs, "/dev/tty0", "", 0o620);
|
|
417
|
+
ensureFile(vfs, "/dev/tty1", "", 0o620);
|
|
418
|
+
ensureFile(vfs, "/dev/ttyS0", "", 0o660);
|
|
419
|
+
// loop devices
|
|
420
|
+
for (let i = 0; i < 8; i++) {
|
|
421
|
+
ensureFile(vfs, `/dev/loop${i}`, "", 0o660);
|
|
422
|
+
}
|
|
423
|
+
ensureDir(vfs, "/dev/loop-control");
|
|
424
|
+
// block device stubs (sda + partitions)
|
|
425
|
+
ensureFile(vfs, "/dev/sda", "", 0o660);
|
|
426
|
+
ensureFile(vfs, "/dev/sda1", "", 0o660);
|
|
427
|
+
ensureFile(vfs, "/dev/sda2", "", 0o660);
|
|
428
|
+
// misc
|
|
429
|
+
ensureDir(vfs, "/dev/pts");
|
|
430
|
+
ensureDir(vfs, "/dev/shm");
|
|
431
|
+
ensureFile(vfs, "/dev/stdin", "", 0o666);
|
|
432
|
+
ensureFile(vfs, "/dev/stdout", "", 0o666);
|
|
433
|
+
ensureFile(vfs, "/dev/stderr", "", 0o666);
|
|
434
|
+
}
|
|
435
|
+
// ─── /usr ─────────────────────────────────────────────────────────────────────
|
|
436
|
+
function bootstrapUsr(vfs) {
|
|
437
|
+
ensureDir(vfs, "/usr");
|
|
438
|
+
ensureDir(vfs, "/usr/bin");
|
|
439
|
+
ensureDir(vfs, "/usr/sbin");
|
|
440
|
+
ensureDir(vfs, "/usr/local");
|
|
441
|
+
ensureDir(vfs, "/usr/local/bin");
|
|
442
|
+
ensureDir(vfs, "/usr/local/lib");
|
|
443
|
+
ensureDir(vfs, "/usr/local/share");
|
|
444
|
+
ensureDir(vfs, "/usr/share");
|
|
445
|
+
ensureDir(vfs, "/usr/share/doc");
|
|
446
|
+
ensureDir(vfs, "/usr/share/man");
|
|
447
|
+
ensureDir(vfs, "/usr/share/man/man1");
|
|
448
|
+
ensureDir(vfs, "/usr/lib");
|
|
449
|
+
// Stubs so `which` can resolve built-in commands
|
|
450
|
+
const builtins = [
|
|
451
|
+
"sh", "bash", "ls", "cat", "echo", "grep", "find", "sort",
|
|
452
|
+
"head", "tail", "cut", "tr", "sed", "awk", "wc", "tee",
|
|
453
|
+
"tar", "gzip", "gunzip", "touch", "mkdir", "rm", "mv", "cp",
|
|
454
|
+
"chmod", "ln", "pwd", "env", "date", "sleep", "id", "whoami",
|
|
455
|
+
"hostname", "uname", "ps", "kill", "df", "du", "curl", "wget",
|
|
456
|
+
"nano", "diff", "uniq", "xargs", "base64",
|
|
457
|
+
];
|
|
458
|
+
for (const bin of builtins) {
|
|
459
|
+
ensureFile(vfs, `/usr/bin/${bin}`, `#!/bin/sh\nexec builtin ${bin} "$@"\n`, 0o755);
|
|
460
|
+
}
|
|
461
|
+
ensureFile(vfs, "/usr/bin/lsb_release", '#!/bin/sh\nexec lsb_release "$@"\n', 0o755);
|
|
462
|
+
}
|
|
463
|
+
// ─── /var ─────────────────────────────────────────────────────────────────────
|
|
464
|
+
function bootstrapVar(vfs) {
|
|
465
|
+
ensureDir(vfs, "/var");
|
|
466
|
+
ensureDir(vfs, "/var/log");
|
|
467
|
+
ensureDir(vfs, "/var/log/apt");
|
|
468
|
+
ensureDir(vfs, "/var/tmp");
|
|
469
|
+
ensureDir(vfs, "/var/cache");
|
|
470
|
+
ensureDir(vfs, "/var/cache/apt");
|
|
471
|
+
ensureDir(vfs, "/var/cache/apt/archives");
|
|
472
|
+
ensureDir(vfs, "/var/lib");
|
|
473
|
+
ensureDir(vfs, "/var/lib/apt");
|
|
474
|
+
ensureDir(vfs, "/var/lib/apt/lists");
|
|
475
|
+
ensureDir(vfs, "/var/lib/dpkg");
|
|
476
|
+
ensureDir(vfs, "/var/lib/dpkg/info");
|
|
477
|
+
ensureDir(vfs, "/var/lib/misc");
|
|
478
|
+
ensureDir(vfs, "/var/spool");
|
|
479
|
+
ensureDir(vfs, "/var/spool/cron");
|
|
480
|
+
ensureDir(vfs, "/var/mail");
|
|
481
|
+
// dpkg status — starts empty, VirtualPackageManager populates it
|
|
482
|
+
ensureFile(vfs, "/var/lib/dpkg/status", "");
|
|
483
|
+
ensureFile(vfs, "/var/lib/dpkg/available", "");
|
|
484
|
+
// syslog stubs
|
|
485
|
+
ensureFile(vfs, "/var/log/syslog", `${new Date().toUTCString()} fortune kernel: Virtual container started\n`);
|
|
486
|
+
ensureFile(vfs, "/var/log/auth.log", "");
|
|
487
|
+
ensureFile(vfs, "/var/log/kern.log", "");
|
|
488
|
+
ensureFile(vfs, "/var/log/dpkg.log", "");
|
|
489
|
+
ensureFile(vfs, "/var/log/apt/history.log", "");
|
|
490
|
+
ensureFile(vfs, "/var/log/apt/term.log", "");
|
|
491
|
+
// /run — systemd tmpfs runtime dir (canonical on modern Debian)
|
|
492
|
+
// /var/run is a legacy symlink to /run
|
|
493
|
+
ensureDir(vfs, "/run");
|
|
494
|
+
ensureDir(vfs, "/run/lock");
|
|
495
|
+
ensureDir(vfs, "/run/systemd");
|
|
496
|
+
ensureDir(vfs, "/run/user");
|
|
497
|
+
ensureFile(vfs, "/run/utmp", "");
|
|
498
|
+
}
|
|
499
|
+
// ─── /bin + /sbin symlinks ────────────────────────────────────────────────────
|
|
500
|
+
function bootstrapBin(vfs) {
|
|
501
|
+
// Modern Debian: /bin and /sbin are symlinks to /usr/bin and /usr/sbin
|
|
502
|
+
if (!vfs.exists("/bin"))
|
|
503
|
+
vfs.symlink("/usr/bin", "/bin");
|
|
504
|
+
if (!vfs.exists("/sbin"))
|
|
505
|
+
vfs.symlink("/usr/sbin", "/sbin");
|
|
506
|
+
// /var/run → /run (systemd compat)
|
|
507
|
+
if (!vfs.exists("/var/run"))
|
|
508
|
+
vfs.symlink("/run", "/var/run");
|
|
509
|
+
ensureDir(vfs, "/lib");
|
|
510
|
+
ensureDir(vfs, "/lib64");
|
|
511
|
+
ensureDir(vfs, "/lib/x86_64-linux-gnu");
|
|
512
|
+
ensureDir(vfs, "/lib/modules");
|
|
513
|
+
}
|
|
514
|
+
// ─── /tmp ─────────────────────────────────────────────────────────────────────
|
|
515
|
+
function bootstrapTmp(vfs) {
|
|
516
|
+
ensureDir(vfs, "/tmp", 0o1777);
|
|
517
|
+
}
|
|
518
|
+
// ─── /root home ───────────────────────────────────────────────────────────────
|
|
519
|
+
function bootstrapRoot(vfs) {
|
|
520
|
+
ensureDir(vfs, "/root", 0o700);
|
|
521
|
+
ensureFile(vfs, "/root/.bashrc", `${[
|
|
522
|
+
"# root .bashrc",
|
|
523
|
+
"export PS1='\\[\\033[0;31m\\]\\u@\\h\\[\\033[0m\\]:\\[\\033[0;34m\\]\\w\\[\\033[0m\\]# '",
|
|
524
|
+
"export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
|
525
|
+
"alias ll='ls -la'",
|
|
526
|
+
"alias la='ls -A'",
|
|
527
|
+
].join("\n")}\n`);
|
|
528
|
+
ensureFile(vfs, "/root/.profile", "[ -f ~/.bashrc ] && . ~/.bashrc\n");
|
|
529
|
+
}
|
|
530
|
+
// ─── /opt /srv /mnt /media /home ─────────────────────────────────────────────
|
|
531
|
+
function bootstrapMisc(vfs, props) {
|
|
532
|
+
ensureDir(vfs, "/opt");
|
|
533
|
+
ensureDir(vfs, "/srv");
|
|
534
|
+
ensureDir(vfs, "/mnt");
|
|
535
|
+
ensureDir(vfs, "/media");
|
|
536
|
+
ensureDir(vfs, "/home");
|
|
537
|
+
// /boot — grub + kernel images
|
|
538
|
+
ensureDir(vfs, "/boot");
|
|
539
|
+
ensureDir(vfs, "/boot/grub");
|
|
540
|
+
ensureDir(vfs, "/boot/grub/grub.cfg.d");
|
|
541
|
+
ensureFile(vfs, "/boot/grub/grub.cfg", `${[
|
|
542
|
+
"# GRUB configuration (virtual)",
|
|
543
|
+
"set default=0",
|
|
544
|
+
"set timeout=5",
|
|
545
|
+
"",
|
|
546
|
+
`menuentry "Fortune GNU/Linux" {`,
|
|
547
|
+
` linux /vmlinuz root=/dev/sda2 ro quiet splash`,
|
|
548
|
+
` initrd /initrd.img`,
|
|
549
|
+
`}`,
|
|
550
|
+
].join("\n")}\n`);
|
|
551
|
+
// kernel + initrd stubs in /boot
|
|
552
|
+
const kver = props.kernel;
|
|
553
|
+
ensureFile(vfs, `/boot/vmlinuz-${kver}`, "", 0o644);
|
|
554
|
+
ensureFile(vfs, `/boot/initrd.img-${kver}`, "", 0o644);
|
|
555
|
+
ensureFile(vfs, `/boot/System.map-${kver}`, `${kver} virtual\n`, 0o644);
|
|
556
|
+
ensureFile(vfs, `/boot/config-${kver}`, `# Linux kernel config ${kver}\n`, 0o644);
|
|
557
|
+
// root-level symlinks (Debian convention)
|
|
558
|
+
if (!vfs.exists("/vmlinuz"))
|
|
559
|
+
vfs.symlink(`/boot/vmlinuz-${kver}`, "/vmlinuz");
|
|
560
|
+
if (!vfs.exists("/vmlinuz.old"))
|
|
561
|
+
vfs.symlink(`/boot/vmlinuz-${kver}`, "/vmlinuz.old");
|
|
562
|
+
if (!vfs.exists("/initrd.img"))
|
|
563
|
+
vfs.symlink(`/boot/initrd.img-${kver}`, "/initrd.img");
|
|
564
|
+
if (!vfs.exists("/initrd.img.old"))
|
|
565
|
+
vfs.symlink(`/boot/initrd.img-${kver}`, "/initrd.img.old");
|
|
566
|
+
// /snap — snapd mount namespace root
|
|
567
|
+
ensureDir(vfs, "/snap");
|
|
568
|
+
ensureDir(vfs, "/snap/bin");
|
|
569
|
+
// /lost+found — ext4 fsck recovery dir (mode 0o700, root only)
|
|
570
|
+
ensureDir(vfs, "/lost+found", 0o700);
|
|
571
|
+
}
|
|
572
|
+
// ─── main entry point ─────────────────────────────────────────────────────────
|
|
573
|
+
/**
|
|
574
|
+
* Bootstraps the full Linux rootfs hierarchy in the VFS.
|
|
575
|
+
* Safe to call multiple times — idempotent.
|
|
576
|
+
*
|
|
577
|
+
* @param vfs Target virtual filesystem.
|
|
578
|
+
* @param users User manager (for /etc/passwd sync).
|
|
579
|
+
* @param hostname Virtual hostname.
|
|
580
|
+
* @param props Shell properties (kernel, os, arch).
|
|
581
|
+
* @param shellStartTime Unix ms of shell creation (for uptime).
|
|
582
|
+
* @param sessions Active sessions (for /proc/<pid> population).
|
|
583
|
+
*/
|
|
584
|
+
export function bootstrapLinuxRootfs(vfs, users, hostname, props, shellStartTime, sessions = []) {
|
|
585
|
+
bootstrapEtc(vfs, hostname, props);
|
|
586
|
+
bootstrapSys(vfs, hostname, props);
|
|
587
|
+
bootstrapDev(vfs);
|
|
588
|
+
bootstrapUsr(vfs);
|
|
589
|
+
bootstrapVar(vfs);
|
|
590
|
+
bootstrapBin(vfs);
|
|
591
|
+
bootstrapTmp(vfs);
|
|
592
|
+
bootstrapRoot(vfs);
|
|
593
|
+
bootstrapMisc(vfs, props);
|
|
594
|
+
bootProcLog(vfs, props);
|
|
595
|
+
refreshProc(vfs, props, hostname, shellStartTime, sessions);
|
|
596
|
+
syncEtcPasswd(vfs, users);
|
|
597
|
+
}
|
|
598
|
+
// ─── optional live engine ─────────────────────────────────────────────────────
|
|
599
|
+
/**
|
|
600
|
+
* Engine for runtimes that want periodic /proc refresh (e.g. web shell
|
|
601
|
+
* with live `top`/`ps` output). Call `.boot()` once, then `.tick()` on
|
|
602
|
+
* each session change or on a timer.
|
|
603
|
+
*
|
|
604
|
+
* ```ts
|
|
605
|
+
* const engine = createLinuxRootfsEngine(vfs, props, hostname, Date.now());
|
|
606
|
+
* engine.boot(users, sessions);
|
|
607
|
+
* setInterval(() => engine.tick(shell.listActiveSessions()), 5000);
|
|
608
|
+
* ```
|
|
609
|
+
*/
|
|
610
|
+
export function createLinuxRootfsEngine(vfs, props, hostname, startTime) {
|
|
611
|
+
return {
|
|
612
|
+
boot(users, sessions = []) {
|
|
613
|
+
bootstrapLinuxRootfs(vfs, users, hostname, props, startTime, sessions);
|
|
614
|
+
},
|
|
615
|
+
tick(sessions = []) {
|
|
616
|
+
refreshProc(vfs, props, hostname, startTime, sessions);
|
|
617
|
+
},
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
//# sourceMappingURL=linuxRootfs.js.map
|