Skip to content

ratnadeep007/goshell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Virtual Shell (goshell)

goshell is a sandboxed virtual shell written in Go. It runs against an in-memory filesystem and embeds common agent tools directly into the binary.

Features

  • In-memory VFS with ls, cd, pwd, mkdir, touch, cp, mv, rm, cat, find, dump, grep, awk, env, and export
  • Pipelines and redirection with |, >, and >>
  • Embedded tools: jq, sqlite3, python, node, and which
  • SQLite dot commands: .tables, .schema, .databases, .indexes, .mode, .headers, .separator, .nullvalue, .output, .read, .import, .dump
  • Configurable allowlists and blacklist rules
  • Host import and VFS export support

Run

go run ./cmd/goshell

With config:

go run ./cmd/goshell -config example_config.json

Import a host directory:

go run ./cmd/goshell -import /full/path/on/host

Config

example_config.json supports these fields:

{
  "allowed_builtins": ["ls", "cd", "pwd", "mkdir", "touch", "cat", "rm", "cp", "mv", "find", "dump", "echo", "grep", "awk", "env", "export", "source", "which"],
  "allowed_external": ["python", "python3", "sqlite3", "jq", "node"],
  "embedded_tools": ["jq", "sqlite3", "python", "python3", "node", "nodejs", "which"],
  "import_path": "./test",
  "blacklist": ["rm\\s+-rf\\s+/"] ,
  "init_commands": ["echo \"Welcome to goshell\""],
  "prompt": "goshell:{cwd}$ "
}

Examples

goshell:/$ echo '{"a":1}' | jq '.a'
1

goshell:/$ sqlite3 main.db
sqlite> .tables
sqlite> .schema

goshell:/$ echo 'print("hello")' | python
hello

goshell:/$ echo 'console.log("ok")' | node
ok

About

Sandbox enviroment for Agents in Golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages