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
package/src/SSHMimic/sftp.js
DELETED
|
@@ -1,619 +0,0 @@
|
|
|
1
|
-
/** biome-ignore-all lint/style/useNamingConvention: const as enum */
|
|
2
|
-
import { EventEmitter } from "node:events";
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import { Server as SshServer } from "ssh2";
|
|
5
|
-
import { createPerfLogger } from "../utils/perfLogger";
|
|
6
|
-
import { VirtualShell } from "../VirtualShell";
|
|
7
|
-
import { loadOrCreateHostKey } from "./hostKey";
|
|
8
|
-
// ── Dev-mode logger — silent in production ────────────────────────────────────
|
|
9
|
-
const DEV = !!process.env.DEV_MODE;
|
|
10
|
-
const devLog = DEV ? console.log.bind(console) : () => { };
|
|
11
|
-
const devWarn = DEV ? console.warn.bind(console) : () => { };
|
|
12
|
-
const devErr = DEV ? console.error.bind(console) : () => { };
|
|
13
|
-
const SFTP_STATUS_CODE = {
|
|
14
|
-
OK: 0,
|
|
15
|
-
EOF: 1,
|
|
16
|
-
NO_SUCH_FILE: 2,
|
|
17
|
-
PERMISSION_DENIED: 3,
|
|
18
|
-
FAILURE: 4,
|
|
19
|
-
BAD_MESSAGE: 5,
|
|
20
|
-
NO_CONNECTION: 6,
|
|
21
|
-
CONNECTION_LOST: 7,
|
|
22
|
-
OP_UNSUPPORTED: 8,
|
|
23
|
-
};
|
|
24
|
-
const OPEN_MODE = {
|
|
25
|
-
READ: 0x00000001,
|
|
26
|
-
WRITE: 0x00000002,
|
|
27
|
-
APPEND: 0x00000004,
|
|
28
|
-
CREAT: 0x00000008,
|
|
29
|
-
TRUNC: 0x00000010,
|
|
30
|
-
EXCL: 0x00000020,
|
|
31
|
-
};
|
|
32
|
-
const perf = createPerfLogger("SftpMimic");
|
|
33
|
-
export class SftpMimic extends EventEmitter {
|
|
34
|
-
port;
|
|
35
|
-
server;
|
|
36
|
-
hostname;
|
|
37
|
-
shell;
|
|
38
|
-
vfs;
|
|
39
|
-
users;
|
|
40
|
-
nextHandleId = 0;
|
|
41
|
-
handles = new Map();
|
|
42
|
-
constructor({ port, hostname = "typescript-vm", shell, vfs, users, }) {
|
|
43
|
-
super();
|
|
44
|
-
perf.mark("constructor");
|
|
45
|
-
this.port = port;
|
|
46
|
-
this.server = null;
|
|
47
|
-
this.hostname = hostname;
|
|
48
|
-
this.shell = null;
|
|
49
|
-
if (shell) {
|
|
50
|
-
this.vfs = shell.vfs;
|
|
51
|
-
this.users = shell.users;
|
|
52
|
-
this.hostname = shell.hostname;
|
|
53
|
-
this.shell = shell;
|
|
54
|
-
}
|
|
55
|
-
else if (vfs && users) {
|
|
56
|
-
this.vfs = vfs;
|
|
57
|
-
this.users = users;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
const defaultShell = new VirtualShell(hostname);
|
|
61
|
-
this.vfs = defaultShell.vfs;
|
|
62
|
-
this.users = defaultShell.users;
|
|
63
|
-
this.shell = defaultShell;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
getVfs() {
|
|
67
|
-
return this.shell?.vfs ?? this.vfs;
|
|
68
|
-
}
|
|
69
|
-
getUsers() {
|
|
70
|
-
return this.shell?.users ?? this.users;
|
|
71
|
-
}
|
|
72
|
-
async start() {
|
|
73
|
-
perf.mark("start");
|
|
74
|
-
const privateKey = loadOrCreateHostKey();
|
|
75
|
-
// Ensure VirtualShell is fully initialized before accepting connections
|
|
76
|
-
if (this.shell) {
|
|
77
|
-
await this.shell.ensureInitialized();
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
// If using standalone VFS+Users, initialize users now
|
|
81
|
-
await this.users.initialize();
|
|
82
|
-
}
|
|
83
|
-
this.server = new SshServer({
|
|
84
|
-
hostKeys: [privateKey],
|
|
85
|
-
ident: `SSH-2.0-${this.hostname}`,
|
|
86
|
-
}, (client) => {
|
|
87
|
-
const allowedAuthMethods = [
|
|
88
|
-
"password",
|
|
89
|
-
"keyboard-interactive",
|
|
90
|
-
];
|
|
91
|
-
let authUser = "root";
|
|
92
|
-
let sessionId = null;
|
|
93
|
-
let remoteAddress = "unknown";
|
|
94
|
-
this.emit("client:connect");
|
|
95
|
-
// Add error handling for the client
|
|
96
|
-
client.on("error", (error) => {
|
|
97
|
-
devErr(`[SFTP] Client error:`, error);
|
|
98
|
-
});
|
|
99
|
-
const acceptSession = (username) => {
|
|
100
|
-
authUser = username;
|
|
101
|
-
sessionId = this.getUsers().registerSession(authUser, remoteAddress).id;
|
|
102
|
-
const homeRoot = "/home";
|
|
103
|
-
if (!this.getVfs().exists(homeRoot)) {
|
|
104
|
-
this.getVfs().mkdir(homeRoot, 0o755);
|
|
105
|
-
}
|
|
106
|
-
const homePath = `/home/${authUser}`;
|
|
107
|
-
if (!this.getVfs().exists(homePath)) {
|
|
108
|
-
this.getVfs().mkdir(homePath, 0o755);
|
|
109
|
-
this.getVfs().writeFile(`${homePath}/README.txt`, `Welcome to ${this.hostname}`);
|
|
110
|
-
void this.getVfs().flushMirror();
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
client.on("authentication", (ctx) => {
|
|
114
|
-
const candidateUser = ctx.username || "root";
|
|
115
|
-
remoteAddress = ctx.ip ?? remoteAddress;
|
|
116
|
-
devLog(`[SFTP] Auth attempt: user=${candidateUser}, method=${ctx.method}, ip=${remoteAddress}`);
|
|
117
|
-
if (ctx.method === "password") {
|
|
118
|
-
// If no password is set for the user, allow login without verification
|
|
119
|
-
if (!this.getUsers().hasPassword(candidateUser)) {
|
|
120
|
-
acceptSession(candidateUser);
|
|
121
|
-
this.emit("auth:success", { username: authUser, remoteAddress });
|
|
122
|
-
ctx.accept();
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
if (!this.getUsers().verifyPassword(candidateUser, ctx.password ?? "")) {
|
|
126
|
-
this.emit("auth:failure", {
|
|
127
|
-
username: candidateUser,
|
|
128
|
-
remoteAddress,
|
|
129
|
-
});
|
|
130
|
-
ctx.reject(allowedAuthMethods);
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
acceptSession(candidateUser);
|
|
134
|
-
this.emit("auth:success", { username: authUser, remoteAddress });
|
|
135
|
-
ctx.accept();
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (ctx.method === "keyboard-interactive") {
|
|
139
|
-
const keyboardCtx = ctx;
|
|
140
|
-
// If no password is set, accept immediately
|
|
141
|
-
if (!this.getUsers().hasPassword(candidateUser)) {
|
|
142
|
-
acceptSession(candidateUser);
|
|
143
|
-
this.emit("auth:success", { username: authUser, remoteAddress });
|
|
144
|
-
keyboardCtx.accept();
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
keyboardCtx.prompt([{ prompt: "Password: ", echo: false }], (answers) => {
|
|
148
|
-
const password = answers[0] ?? "";
|
|
149
|
-
if (!this.getUsers().verifyPassword(candidateUser, password)) {
|
|
150
|
-
this.emit("auth:failure", {
|
|
151
|
-
username: candidateUser,
|
|
152
|
-
remoteAddress,
|
|
153
|
-
});
|
|
154
|
-
keyboardCtx.reject(allowedAuthMethods);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
acceptSession(candidateUser);
|
|
158
|
-
this.emit("auth:success", {
|
|
159
|
-
username: authUser,
|
|
160
|
-
remoteAddress,
|
|
161
|
-
});
|
|
162
|
-
keyboardCtx.accept();
|
|
163
|
-
});
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
ctx.reject(allowedAuthMethods);
|
|
167
|
-
});
|
|
168
|
-
client.on("close", () => {
|
|
169
|
-
this.getUsers().unregisterSession(sessionId);
|
|
170
|
-
this.emit("client:disconnect", { user: authUser });
|
|
171
|
-
sessionId = null;
|
|
172
|
-
});
|
|
173
|
-
client.on("ready", () => {
|
|
174
|
-
client.on("session", (accept, _reject) => {
|
|
175
|
-
const session = accept();
|
|
176
|
-
// Add error handling for the session
|
|
177
|
-
session.on("error", (error) => {
|
|
178
|
-
devErr(`[SFTP] Session error for user=${authUser}:`, error);
|
|
179
|
-
});
|
|
180
|
-
session.on("sftp", (acceptSftp) => {
|
|
181
|
-
const sftp = acceptSftp();
|
|
182
|
-
this.attachSftpHandlers(sftp, authUser);
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
return new Promise((resolve, reject) => {
|
|
188
|
-
this.server?.once("error", (err) => reject(err));
|
|
189
|
-
this.server?.listen(this.port, "0.0.0.0", () => {
|
|
190
|
-
const address = this.server?.address();
|
|
191
|
-
const actualPort = address && typeof address === "object" && "port" in address
|
|
192
|
-
? address.port
|
|
193
|
-
: this.port;
|
|
194
|
-
devLog(`SFTP Mimic listening on port ${actualPort}`);
|
|
195
|
-
this.emit("start", { port: actualPort });
|
|
196
|
-
resolve(actualPort);
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
stop() {
|
|
201
|
-
perf.mark("stop");
|
|
202
|
-
if (this.server) {
|
|
203
|
-
this.server.close(() => {
|
|
204
|
-
devLog("SFTP Mimic stopped");
|
|
205
|
-
this.emit("stop");
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Resolves SFTP request paths with proper handling of relative paths.
|
|
211
|
-
* Relative paths (including ".") are resolved relative to the user's home directory.
|
|
212
|
-
* This is standard SFTP behavior where the "working directory" is always the home.
|
|
213
|
-
*/
|
|
214
|
-
resolveRequestPath(requestPath, authUser) {
|
|
215
|
-
const homePath = `/home/${authUser}`;
|
|
216
|
-
// Empty path or "." → resolve to home directory
|
|
217
|
-
if (!requestPath || requestPath === ".") {
|
|
218
|
-
return homePath;
|
|
219
|
-
}
|
|
220
|
-
// Relative path (doesn't start with "/") → resolve relative to home
|
|
221
|
-
if (!requestPath.startsWith("/")) {
|
|
222
|
-
const joined = path.posix.join(homePath, requestPath);
|
|
223
|
-
return path.posix.normalize(joined);
|
|
224
|
-
}
|
|
225
|
-
// Absolute path → just normalize it
|
|
226
|
-
return path.posix.normalize(requestPath);
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Verifies that a target path is confined within the user's home directory.
|
|
230
|
-
* This implements chroot-like behavior for security.
|
|
231
|
-
* @param targetPath - The normalized target path
|
|
232
|
-
* @param authUser - The authenticated username
|
|
233
|
-
* @returns true if path is within home, false if traversal attempt detected
|
|
234
|
-
*/
|
|
235
|
-
isPathWithinHome(targetPath, authUser) {
|
|
236
|
-
const homePath = `/home/${authUser}`;
|
|
237
|
-
const normalized = path.posix.normalize(targetPath);
|
|
238
|
-
// Allow access to home directory itself
|
|
239
|
-
if (normalized === homePath) {
|
|
240
|
-
return true;
|
|
241
|
-
}
|
|
242
|
-
// Check if path is within home directory (starts with /home/username/)
|
|
243
|
-
if (normalized.startsWith(`${homePath}/`)) {
|
|
244
|
-
return true;
|
|
245
|
-
}
|
|
246
|
-
// Reject any attempt to escape home directory
|
|
247
|
-
return false;
|
|
248
|
-
}
|
|
249
|
-
createAttrs(node) {
|
|
250
|
-
const permissions = node.mode & 0o777;
|
|
251
|
-
const fileType = node.type === "directory" ? 0o040000 : 0o100000;
|
|
252
|
-
return {
|
|
253
|
-
mode: fileType | permissions,
|
|
254
|
-
size: node.type === "file" ? node.size : 0,
|
|
255
|
-
uid: 0,
|
|
256
|
-
gid: 0,
|
|
257
|
-
atime: Math.floor(node.createdAt.getTime() / 1000),
|
|
258
|
-
mtime: Math.floor(node.updatedAt.getTime() / 1000),
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
openHandle(handleValue) {
|
|
262
|
-
const handleId = ++this.nextHandleId;
|
|
263
|
-
const handle = Buffer.alloc(4);
|
|
264
|
-
handle.writeUInt32BE(handleId, 0);
|
|
265
|
-
this.handles.set(handle.toString("hex"), handleValue);
|
|
266
|
-
return handle;
|
|
267
|
-
}
|
|
268
|
-
getHandle(handle) {
|
|
269
|
-
return this.handles.get(handle.toString("hex"));
|
|
270
|
-
}
|
|
271
|
-
closeHandle(handle) {
|
|
272
|
-
this.handles.delete(handle.toString("hex"));
|
|
273
|
-
}
|
|
274
|
-
attachSftpHandlers(sftp, authUser) {
|
|
275
|
-
const getVfs = () => this.getVfs();
|
|
276
|
-
const getUsers = () => this.getUsers();
|
|
277
|
-
sftp.on("OPEN", (reqid, filename, flags) => {
|
|
278
|
-
const targetPath = this.resolveRequestPath(filename, authUser);
|
|
279
|
-
// Security: Confine to home directory
|
|
280
|
-
if (!this.isPathWithinHome(targetPath, authUser)) {
|
|
281
|
-
devWarn(`[SFTP] Path traversal attempt blocked: user=${authUser}, path=${targetPath}`);
|
|
282
|
-
sftp.status(reqid, SFTP_STATUS_CODE.PERMISSION_DENIED);
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
const openMode = flags;
|
|
286
|
-
const _canRead = Boolean(openMode & OPEN_MODE.READ);
|
|
287
|
-
const _canWrite = Boolean(openMode & OPEN_MODE.WRITE || openMode & OPEN_MODE.APPEND);
|
|
288
|
-
const canCreate = Boolean(openMode & OPEN_MODE.CREAT);
|
|
289
|
-
const shouldTruncate = Boolean(openMode & OPEN_MODE.TRUNC);
|
|
290
|
-
try {
|
|
291
|
-
if (!getVfs().exists(targetPath)) {
|
|
292
|
-
if (!canCreate) {
|
|
293
|
-
sftp.status(reqid, SFTP_STATUS_CODE.NO_SUCH_FILE);
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
getVfs().writeFile(targetPath, Buffer.alloc(0));
|
|
297
|
-
}
|
|
298
|
-
const stats = getVfs().stat(targetPath);
|
|
299
|
-
if (stats.type === "directory") {
|
|
300
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
let buffer = Buffer.from(getVfs().readFile(targetPath), "utf8");
|
|
304
|
-
if (shouldTruncate) {
|
|
305
|
-
buffer = Buffer.alloc(0);
|
|
306
|
-
}
|
|
307
|
-
if (openMode & OPEN_MODE.APPEND) {
|
|
308
|
-
const handle = this.openHandle({
|
|
309
|
-
type: "file",
|
|
310
|
-
path: targetPath,
|
|
311
|
-
flags: openMode,
|
|
312
|
-
buffer,
|
|
313
|
-
});
|
|
314
|
-
sftp.handle(reqid, handle);
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
const handle = this.openHandle({
|
|
318
|
-
type: "file",
|
|
319
|
-
path: targetPath,
|
|
320
|
-
flags: openMode,
|
|
321
|
-
buffer,
|
|
322
|
-
});
|
|
323
|
-
sftp.handle(reqid, handle);
|
|
324
|
-
}
|
|
325
|
-
catch (error) {
|
|
326
|
-
devErr("SFTP OPEN error:", error);
|
|
327
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
sftp.on("READ", (reqid, handle, offset, length) => {
|
|
331
|
-
const entry = this.getHandle(handle);
|
|
332
|
-
if (!entry || entry.type !== "file") {
|
|
333
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
if (offset >= entry.buffer.length) {
|
|
337
|
-
sftp.status(reqid, SFTP_STATUS_CODE.EOF);
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
const chunk = entry.buffer.slice(offset, offset + length);
|
|
341
|
-
sftp.data(reqid, chunk);
|
|
342
|
-
});
|
|
343
|
-
sftp.on("WRITE", async (reqid, handle, offset, data) => {
|
|
344
|
-
const entry = this.getHandle(handle);
|
|
345
|
-
if (!entry || entry.type !== "file") {
|
|
346
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
const end = offset + data.length;
|
|
350
|
-
if (end > entry.buffer.length) {
|
|
351
|
-
const nextBuffer = Buffer.alloc(end);
|
|
352
|
-
entry.buffer.copy(nextBuffer, 0, 0, entry.buffer.length);
|
|
353
|
-
entry.buffer = nextBuffer;
|
|
354
|
-
}
|
|
355
|
-
data.copy(entry.buffer, offset);
|
|
356
|
-
sftp.status(reqid, SFTP_STATUS_CODE.OK);
|
|
357
|
-
});
|
|
358
|
-
sftp.on("FSTAT", (reqid, handle) => {
|
|
359
|
-
const entry = this.getHandle(handle);
|
|
360
|
-
if (!entry) {
|
|
361
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
try {
|
|
365
|
-
const stats = getVfs().stat(entry.path);
|
|
366
|
-
sftp.attrs(reqid, this.createAttrs(stats));
|
|
367
|
-
}
|
|
368
|
-
catch {
|
|
369
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
sftp.on("CLOSE", async (reqid, handle) => {
|
|
373
|
-
const entry = this.getHandle(handle);
|
|
374
|
-
if (!entry) {
|
|
375
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
if (entry.type === "file") {
|
|
379
|
-
try {
|
|
380
|
-
getUsers().assertWriteWithinQuota(authUser, entry.path, entry.buffer);
|
|
381
|
-
getVfs().writeFile(entry.path, entry.buffer);
|
|
382
|
-
void getVfs().flushMirror();
|
|
383
|
-
}
|
|
384
|
-
catch (error) {
|
|
385
|
-
devErr("SFTP CLOSE write error:", error);
|
|
386
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
387
|
-
this.closeHandle(handle);
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
this.closeHandle(handle);
|
|
392
|
-
sftp.status(reqid, SFTP_STATUS_CODE.OK);
|
|
393
|
-
});
|
|
394
|
-
sftp.on("OPENDIR", (reqid, requestPath) => {
|
|
395
|
-
const targetPath = this.resolveRequestPath(requestPath, authUser);
|
|
396
|
-
// Security: Confine to home directory
|
|
397
|
-
if (!this.isPathWithinHome(targetPath, authUser)) {
|
|
398
|
-
devWarn(`[SFTP] Path traversal attempt blocked: user=${authUser}, path=${targetPath}`);
|
|
399
|
-
sftp.status(reqid, SFTP_STATUS_CODE.PERMISSION_DENIED);
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
try {
|
|
403
|
-
const stats = getVfs().stat(targetPath);
|
|
404
|
-
if (stats.type !== "directory") {
|
|
405
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
|
-
const entries = getVfs().list(targetPath);
|
|
409
|
-
const handle = this.openHandle({
|
|
410
|
-
type: "dir",
|
|
411
|
-
path: targetPath,
|
|
412
|
-
entries,
|
|
413
|
-
index: 0,
|
|
414
|
-
});
|
|
415
|
-
sftp.handle(reqid, handle);
|
|
416
|
-
}
|
|
417
|
-
catch {
|
|
418
|
-
sftp.status(reqid, SFTP_STATUS_CODE.NO_SUCH_FILE);
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
sftp.on("READDIR", (reqid, handle) => {
|
|
422
|
-
const entry = this.getHandle(handle);
|
|
423
|
-
if (!entry || entry.type !== "dir") {
|
|
424
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
if (entry.index >= entry.entries.length) {
|
|
428
|
-
sftp.status(reqid, SFTP_STATUS_CODE.EOF);
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
const filename = entry.entries[entry.index++];
|
|
432
|
-
const filePath = path.posix.join(entry.path, filename);
|
|
433
|
-
const stats = getVfs().stat(filePath);
|
|
434
|
-
const attrs = this.createAttrs(stats);
|
|
435
|
-
const longname = `${stats.type === "directory" ? "d" : "-"}${(stats.mode & 0o777).toString(8)} ${filename}`;
|
|
436
|
-
return sftp.name(reqid, [{ filename, longname, attrs }]);
|
|
437
|
-
});
|
|
438
|
-
sftp.on("STAT", (reqid, requestPath) => {
|
|
439
|
-
const targetPath = this.resolveRequestPath(requestPath, authUser);
|
|
440
|
-
// Security: Confine to home directory
|
|
441
|
-
if (!this.isPathWithinHome(targetPath, authUser)) {
|
|
442
|
-
devWarn(`[SFTP] Path traversal attempt blocked: user=${authUser}, path=${targetPath}`);
|
|
443
|
-
sftp.status(reqid, SFTP_STATUS_CODE.PERMISSION_DENIED);
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
try {
|
|
447
|
-
const stats = getVfs().stat(targetPath);
|
|
448
|
-
sftp.attrs(reqid, this.createAttrs(stats));
|
|
449
|
-
}
|
|
450
|
-
catch {
|
|
451
|
-
sftp.status(reqid, SFTP_STATUS_CODE.NO_SUCH_FILE);
|
|
452
|
-
}
|
|
453
|
-
});
|
|
454
|
-
sftp.on("LSTAT", (reqid, requestPath) => {
|
|
455
|
-
const targetPath = this.resolveRequestPath(requestPath, authUser);
|
|
456
|
-
// Security: Confine to home directory
|
|
457
|
-
if (!this.isPathWithinHome(targetPath, authUser)) {
|
|
458
|
-
devWarn(`[SFTP] Path traversal attempt blocked: user=${authUser}, path=${targetPath}`);
|
|
459
|
-
sftp.status(reqid, SFTP_STATUS_CODE.PERMISSION_DENIED);
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
try {
|
|
463
|
-
const stats = getVfs().stat(targetPath);
|
|
464
|
-
sftp.attrs(reqid, this.createAttrs(stats));
|
|
465
|
-
}
|
|
466
|
-
catch {
|
|
467
|
-
sftp.status(reqid, SFTP_STATUS_CODE.NO_SUCH_FILE);
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
sftp.on("FSETSTAT", (reqid, handle, attrs) => {
|
|
471
|
-
const entry = this.getHandle(handle);
|
|
472
|
-
if (!entry) {
|
|
473
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
474
|
-
return;
|
|
475
|
-
}
|
|
476
|
-
try {
|
|
477
|
-
if (attrs.mode !== undefined) {
|
|
478
|
-
getVfs().chmod(entry.path, attrs.mode);
|
|
479
|
-
}
|
|
480
|
-
sftp.status(reqid, SFTP_STATUS_CODE.OK);
|
|
481
|
-
}
|
|
482
|
-
catch {
|
|
483
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
sftp.on("SETSTAT", (reqid, requestPath, attrs) => {
|
|
487
|
-
const targetPath = this.resolveRequestPath(requestPath, authUser);
|
|
488
|
-
// Security: Confine to home directory
|
|
489
|
-
if (!this.isPathWithinHome(targetPath, authUser)) {
|
|
490
|
-
devWarn(`[SFTP] Path traversal attempt blocked: user=${authUser}, path=${targetPath}`);
|
|
491
|
-
sftp.status(reqid, SFTP_STATUS_CODE.PERMISSION_DENIED);
|
|
492
|
-
return;
|
|
493
|
-
}
|
|
494
|
-
try {
|
|
495
|
-
if (attrs.mode !== undefined) {
|
|
496
|
-
getVfs().chmod(targetPath, attrs.mode);
|
|
497
|
-
}
|
|
498
|
-
sftp.status(reqid, SFTP_STATUS_CODE.OK);
|
|
499
|
-
}
|
|
500
|
-
catch {
|
|
501
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
502
|
-
}
|
|
503
|
-
});
|
|
504
|
-
sftp.on("REALPATH", (reqid, requestPath) => {
|
|
505
|
-
const normalized = this.resolveRequestPath(requestPath, authUser);
|
|
506
|
-
// Security: Confine to home directory
|
|
507
|
-
if (!this.isPathWithinHome(normalized, authUser)) {
|
|
508
|
-
devWarn(`[SFTP] Path traversal attempt blocked: user=${authUser}, path=${normalized}`);
|
|
509
|
-
sftp.status(reqid, SFTP_STATUS_CODE.PERMISSION_DENIED);
|
|
510
|
-
return;
|
|
511
|
-
}
|
|
512
|
-
sftp.name(reqid, [
|
|
513
|
-
{
|
|
514
|
-
filename: normalized,
|
|
515
|
-
longname: normalized,
|
|
516
|
-
attrs: {
|
|
517
|
-
mode: 0o040755,
|
|
518
|
-
uid: 0,
|
|
519
|
-
gid: 0,
|
|
520
|
-
size: 0,
|
|
521
|
-
atime: 0,
|
|
522
|
-
mtime: 0,
|
|
523
|
-
},
|
|
524
|
-
},
|
|
525
|
-
]);
|
|
526
|
-
});
|
|
527
|
-
sftp.on("MKDIR", (reqid, requestPath) => {
|
|
528
|
-
const targetPath = this.resolveRequestPath(requestPath, authUser);
|
|
529
|
-
// Security: Confine to home directory
|
|
530
|
-
if (!this.isPathWithinHome(targetPath, authUser)) {
|
|
531
|
-
devWarn(`[SFTP] Path traversal attempt blocked: user=${authUser}, path=${targetPath}`);
|
|
532
|
-
sftp.status(reqid, SFTP_STATUS_CODE.PERMISSION_DENIED);
|
|
533
|
-
return;
|
|
534
|
-
}
|
|
535
|
-
try {
|
|
536
|
-
getVfs().mkdir(targetPath, 0o755);
|
|
537
|
-
void getVfs().flushMirror();
|
|
538
|
-
sftp.status(reqid, SFTP_STATUS_CODE.OK);
|
|
539
|
-
}
|
|
540
|
-
catch {
|
|
541
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
542
|
-
}
|
|
543
|
-
});
|
|
544
|
-
sftp.on("RMDIR", (reqid, requestPath) => {
|
|
545
|
-
const targetPath = this.resolveRequestPath(requestPath, authUser);
|
|
546
|
-
// Security: Confine to home directory
|
|
547
|
-
if (!this.isPathWithinHome(targetPath, authUser)) {
|
|
548
|
-
devWarn(`[SFTP] Path traversal attempt blocked: user=${authUser}, path=${targetPath}`);
|
|
549
|
-
sftp.status(reqid, SFTP_STATUS_CODE.PERMISSION_DENIED);
|
|
550
|
-
return;
|
|
551
|
-
}
|
|
552
|
-
try {
|
|
553
|
-
getVfs().remove(targetPath, { recursive: false });
|
|
554
|
-
void getVfs().flushMirror();
|
|
555
|
-
sftp.status(reqid, SFTP_STATUS_CODE.OK);
|
|
556
|
-
}
|
|
557
|
-
catch {
|
|
558
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
559
|
-
}
|
|
560
|
-
});
|
|
561
|
-
sftp.on("REMOVE", (reqid, requestPath) => {
|
|
562
|
-
const targetPath = this.resolveRequestPath(requestPath, authUser);
|
|
563
|
-
// Security: Confine to home directory
|
|
564
|
-
if (!this.isPathWithinHome(targetPath, authUser)) {
|
|
565
|
-
devWarn(`[SFTP] Path traversal attempt blocked: user=${authUser}, path=${targetPath}`);
|
|
566
|
-
sftp.status(reqid, SFTP_STATUS_CODE.PERMISSION_DENIED);
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
try {
|
|
570
|
-
getVfs().remove(targetPath, { recursive: false });
|
|
571
|
-
void getVfs().flushMirror();
|
|
572
|
-
sftp.status(reqid, SFTP_STATUS_CODE.OK);
|
|
573
|
-
}
|
|
574
|
-
catch {
|
|
575
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
sftp.on("RENAME", (reqid, oldPath, newPath) => {
|
|
579
|
-
const fromPath = this.resolveRequestPath(oldPath, authUser);
|
|
580
|
-
const toPath = this.resolveRequestPath(newPath, authUser);
|
|
581
|
-
// Security: Confine both source and destination to home directory
|
|
582
|
-
if (!this.isPathWithinHome(fromPath, authUser) ||
|
|
583
|
-
!this.isPathWithinHome(toPath, authUser)) {
|
|
584
|
-
devWarn(`[SFTP] Path traversal attempt blocked: user=${authUser}, from=${fromPath}, to=${toPath}`);
|
|
585
|
-
sftp.status(reqid, SFTP_STATUS_CODE.PERMISSION_DENIED);
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
try {
|
|
589
|
-
getVfs().move(fromPath, toPath);
|
|
590
|
-
void getVfs().flushMirror();
|
|
591
|
-
sftp.status(reqid, SFTP_STATUS_CODE.OK);
|
|
592
|
-
}
|
|
593
|
-
catch {
|
|
594
|
-
sftp.status(reqid, SFTP_STATUS_CODE.FAILURE);
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
sftp.on("READLINK", (reqid) => {
|
|
598
|
-
sftp.status(reqid, SFTP_STATUS_CODE.OP_UNSUPPORTED);
|
|
599
|
-
});
|
|
600
|
-
sftp.on("SYMLINK", (reqid) => {
|
|
601
|
-
sftp.status(reqid, SFTP_STATUS_CODE.OP_UNSUPPORTED);
|
|
602
|
-
});
|
|
603
|
-
sftp.on("error", (error) => {
|
|
604
|
-
devErr(`[SFTP] Stream error for user=${authUser}:`, error);
|
|
605
|
-
});
|
|
606
|
-
sftp.on("close", () => {
|
|
607
|
-
devLog(`[SFTP] Stream closed for user=${authUser}`);
|
|
608
|
-
this.handles.clear();
|
|
609
|
-
});
|
|
610
|
-
sftp.on("end", () => {
|
|
611
|
-
devLog(`[SFTP] end event for user=${authUser}`);
|
|
612
|
-
this.handles.clear();
|
|
613
|
-
});
|
|
614
|
-
sftp.on("END", () => {
|
|
615
|
-
devLog(`[SFTP] END event for user=${authUser}`);
|
|
616
|
-
this.handles.clear();
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"binaryPack.d.ts","sourceRoot":"","sources":["binaryPack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EACX,qBAAqB,EAGrB,MAAM,iBAAiB,CAAC;AA+EzB;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,qBAAqB,GAAG,MAAM,CAM7D;AA0FD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAiB5D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAErD"}
|