Skip to content

walirt/Webterminal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webterminal

A web terminal by golang

Install

go build .
If you do not enable go modules, run export GO111MODULE=on, then run go build .
If you are in China, you can use a proxy download package, run export GOPROXY=https://goproxy.cn

Usage

./Webterminal

API

  • GET / index (Have a test case)
  • GET /echo echo command (Test websocket)
  • GET /terminal open websocket and ssh (You have to submit ssh verification form via websocket within 10 seconds, Otherwise it will disconnect overtime)
  • POST /test verify the validity of the ssh form
  • POST /upload upload file (ssh private key)

Note

Data exchange format

// login form
type Form struct {
  Host      string `json:"host"`
  Port      int    `json:"port"`
  User      string `json:"user"`
  AuthType  string `json:"auth_type"` // password or secretkey
  Password  string `json:"password"`
  SecretKey string `json:"key"` // upload file return filename
}
// exchange message
type Message struct {
  Type string `json:"type"` // login or cmd or resize or heartbeat
  Cmd  string `json:"cmd"` // command 
  Cols int    `json:"cols"` // resize col
  Rows int    `json:"rows"` // resize row
  Form Form   `json:"form"` 
}

Test case

Modify the ssh.yml file
Then the browser visits http://localhost:8999/
Click on start
access / and click 'start' button

TODO

  • rzsz
  • sftp

License

About

A web terminal by golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published