{"id":24989719,"url":"https://github.com/hlustikp/v8shell","last_synced_at":"2025-03-29T12:15:15.928Z","repository":{"id":63203406,"uuid":"562284185","full_name":"HlustikP/V8Shell","owner":"HlustikP","description":"A shell utilizing V8 thats entirely controllable via Javascript.","archived":false,"fork":false,"pushed_at":"2022-11-28T03:13:58.000Z","size":106,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T13:03:14.764Z","etag":null,"topics":["cpp","javascript","js","shell","v8"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HlustikP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-05T21:24:37.000Z","updated_at":"2022-11-28T16:23:40.000Z","dependencies_parsed_at":"2023-01-22T06:44:46.484Z","dependency_job_id":null,"html_url":"https://github.com/HlustikP/V8Shell","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HlustikP%2FV8Shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HlustikP%2FV8Shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HlustikP%2FV8Shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HlustikP%2FV8Shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HlustikP","download_url":"https://codeload.github.com/HlustikP/V8Shell/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246180923,"owners_count":20736460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","javascript","js","shell","v8"],"created_at":"2025-02-04T13:03:19.099Z","updated_at":"2025-03-29T12:15:15.905Z","avatar_url":"https://github.com/HlustikP.png","language":"C++","readme":"A shell utilizing V8 thats entirely controlled via Javascript and love.\n\n# Installation\n## Requirements\n\nYou can download the prebuild executable from the release section of this repo\n- `Windows 10` or higher + (recommended) Windows 10 SDK 10.0.20348 or higher\n- Tested on `Ubuntu 22.04` `20.04` and `Kali 2021.4` (Though it `should` run on most modern `debian` based systems)\n\nAdditionally if you want to build the source yourself\n- Build v8 as a `static monolithic library`, [the v8 docs will guide you through the process](https://v8.dev/docs)\n(this project contains an [args.gn](./args.gn) file that you can use as a gn config\nfor bulding the library)\n- compiler support for `C++ 17`\n- `Ninja` and `CMake` (recommended)\n- Set the environment variables `V8_INCLUDE` and `V8_LIB` respective to the paths of the v8\ninclude directory and the directory containing the v8 static release lib. The `V8_DEBUG`\nenv variable is used to find the debug compiled version of the library.\n- with Ninja and CMake installed just execute inside the root dir:\n```bash\ncmake --preset x64-release\nninja -C ./build/x64-release/\n```\n\nto run unit tests:\n```bash\nctest --test-dir ./build/x64-release/tests \n```\n\n# Usage\n\nV8Shell is a shell that aims to be able to be fully controllable via JavaScript.\nFor that it embedds a v8 runtime to evaluate input as js and exposes functions which\ninvoke native system code.\n\n## As of now the following functions are implemented:\n\n### help()\n\nPrints an overview of all available shell functions.\n\n---\n\n### exit()\n\nAlias: `quit`\n\nTerminates the shell process\n\n---\n\n### print(expression)\n\nEvaluates a given expression and prints the result. Usually the shell will automatically\nprint the result of the evaluation of it's input, so this is useful to print the result\nof a specific expression.\n\n---\n\n### version()\n\nReturns a string containing the current v8 version used by the embedded engine.\n\n---\n\n## File System Functions:\n\n### ls (printToStd = true)\n\nAlias: `ll`\n\nPrints contents of the current working directory, coloring files/directories differently. Returns undefined.\nIf `printToStd` is set to false, it will instead return an array of objects with the signature\n```js\n{\n    filename: \"test.js\",    // string\n    isDirectory: false,     // boolean\n}\n```\nNote: `printToStd` parameter enforces strict equality with the boolean type.\n\n---\n\n### cd(dir)\n\nChanges the current working directory. To enter a sub-directory, pass a string with the name\nof the desired directory:\n```js\ncd('src')\ncd('src/Commands') // can also enter sub-sub-directories\n```\nTo go back to a parent directory, pass the number of directories you want to go up:\n```js\ncd(1)\n```\n\n---\n\n### createFile(filename)\n\nAlias: `touch`\n\nCreates a new file with the name `filename`.\n\n---\n\n### createDir(dirname)\n\nAlias: `mkdir`\n\nCreates a new directory with the name `dirname`.\n\n---\n\n### removeFile(filename)\n\nAlias: `rf`\n\n\u003cp style=\"color:red\"\u003eDANGER - USE WITH CARE\u003c/p\u003e\n\nRemoves the file `filename` from the filesystem. This function does NOT remove the\nentity if its a directory so consider using it to delete files and have a possible\nsafeguard against accidentally deleting a directory.\n\n---\n\n### removeDir(dirname)\n\nAlias: `rd`\n\n\u003cp style=\"color:red\"\u003eDANGER - USE WITH CARE\u003c/p\u003e\n\nRecursively removes the directory `dirname` and all it's contents from the file system.\nThis function does not remove the entity if `dirname` is a file.\n\n---\n\n### rm(entityName)\n\n\u003cp style=\"color:red\"\u003eDANGER - USE WITH CARE\u003c/p\u003e\n\nRemoves the filesystem entity from the filesystem, regardless of type. If it's a directory\nthen the directory's contents will be removed recursively aswell.\n\n---\n\n### rename(oldName, newName)\n\nChanges the name of the path entity `oldName` to `newName`. Note that this function does not\nrename anything if the target would be moved to a different location. This is to prevent\naccidental moving, if thats intended, use the `move` function.\n\n---\n\n### move(from, to)\n\nAlias: `mv`\n\nMoves the path entity `from` to a new location defined in `to`. Note that `to` is the new\npath assigned to it, including the file/directory name.\n\n---\n\n### copy(from, to)\n\nAlias: `cp`\n\nConstructs a copy of `from` at the path of `to`.\n\n---\n\n### read(filename)\n\nReads a given file and returns it's contents as a string.\n\n---\n\n### execute(filename)\n\nReads a given file, parses it's content as JavaScript, compiles and executes it.\n\n---\n\n### runSync(filename, parameters, verbose = true)\n\nCreates a child process and halts execution of the shell until the child process terminates.\nFirst argument `filename` is a string with the name of the application to be executed which \nis first looked for in the current executable's directory, otherwise the PATH is searched.\nThis function will also capture the standard out, eror and in streams and redirect them\nto the shell. Note however that this behaviour is not guarenteed, especially in cases where\na new window is created by the child process.\n```js\nrunSync('calc')\nrunSync('C:/cool-app/app.exe') // can also pass an absolute path\n```\n\nSecond argument is an optional additional object with arguments to be passed to the executable.\n```js\n// cmd equivalent: cmake --preset x64-release\nrunSync('cmake', { preset: 'x64-debug' })\n\n// cmd equivalent: git -v\nrunSync('git', { v: '' })\n```\n\nThere are two special properties for this arguments object, namely `_PREPEND` and `_APPEND`.\nThe string value of the `_PREPEND` propeperty will be `prepended before` all other arguments.\nThe string value of the `_APPEND` property will be `appended after` all other arguments.\n```js\nrunSync('git', { /* some props here */ _PREPEND: 'branch'})\n// equivalent to the shell command 'git branch *INSERT OTHER PROPS*'\n```\nNote though that currently these two special properties might not work reliably on `UNIX` systems.\n\nThe third argument controls verbosity of this functions. If set to `false` then some\nmessages wont be printed, however the standard out/error streams of the child process will\nstill be captured and printed.\n```js\nrunSync('git', { v: '' }, false)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlustikp%2Fv8shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhlustikp%2Fv8shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlustikp%2Fv8shell/lists"}