Skip to content
SSH and RESTful scaffold for Backend and DevOps engineers username: admin password:admin
Branch: master
Clone or download
Latest commit 717f534 Jul 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd new bot Jul 17, 2019
doc read me Jul 1, 2019
flx add nes game for felix Jun 24, 2019
ginbro add nes game for felix Jun 24, 2019
images trim code Jul 4, 2019
models fix json arry uint Jul 12, 2019
ssh2ws fix sshInfo error Jul 12, 2019
staticbin newfe Jul 15, 2019
utils new bot Jul 17, 2019
wslog add hook Jun 27, 2019
.gitattributes socks proxy Mar 15, 2019
.gitignore add term log for slack api Jun 25, 2019
.travis.yml sshw May 16, 2019
LICENSE socks proxy Mar 15, 2019
Makefile fix json arry uint Jul 12, 2019 optimize Jun 28, 2019 brofist asicii and makefile release May 23, 2019
go.mod new bot Jul 17, 2019
go.sum new bot Jul 17, 2019
main.go makefile Apr 23, 2019

Felix 中文

Build Status Go Report Card

Thanks to 360 Total Security and 360-web-platform

For Whom

  • BackEnd Engineer
  • Golang SQL RESTful APIs engineer
  • DevOps Engineer
  • People Heavily engage with SSH

Do What

  • a slim jump SSH server with Web UI
  • manage massive SSH login configuration
  • ssh login speedily
  • generate a RESTful app from SQL database with gin-gonic/gin and GORM in GO
  • start TCP and SOCK proxy with ssh speedily
  • terminal todo task list
  • Pewdiepie's brofit command to subscribe the Youtube channel



$ felix -h
  felix [flags]
  felix [command]

Available Commands:
  brofist     Pewdiepie needs your help.Do your part to subscribe Pewdiepie's Youtube Channel.
  clean       purge all felix configuration
  ginbin      Ginbin allows you to embed a directory of static files into your Go binary to be later served from
  ginbro      generate a RESTful codebase from SQL database
  help        Help about any command
  json        open a tab in browser to convert json to golang struct
  scpd        scp download file or folder
  scpu        scp upload a file or a folder
  ssh         open a ssh terminal
  sshad       add a ssh connection configuration
  sshdu       duplicate a ssh connection
  sshedit     update a ssh connection
  sshexport   export all ssh connection configuration to a csv file
  sshimport   import massive ssh connection configuration from a csv file
  sshinfo     view a ssh connection
  sshls       list all ssh connection configuration or search by hostname
  sshproxy    ssh port proxy
  sshrm       delete a ssh connection
  sshsocks    start a socks4/5 proxy
  sshw        open a web UI for Felix http://localhost:2222
  task        list all rows in TaskList
  taskad      add a row into TaskList
  taskok      set a row done in TaskList
  taskrm      remove a row in TaskList

  -h, --help      help for felix
      --verbose   verbose
  -V, --version   show binary build information

Use "felix [command] --help" for more information about a command.

Build and Run

or just go build run binary by ./felix


command: felix sshw

$ felix sshw -h
the demo website is

  felix sshw [flags]

  -a, --addr string       listening addr (default ":2222")
  -x, --expire uint       token expire in * minute (default 1440)
  -h, --help              help for sshw
  -p, --password string   auth password (default "admin")
  -s, --secret string     jwt secret string
  -u, --user string       auth user (default "admin")

Global Flags:
      --verbose   verbose
$ felix sshw
use random string as jwt secret: @Ubr)Vrp~Zoo6Rvrk1PP1*ZXPYby_Z)s
login user: admin
login password: admin
login expire in 1440 minutes
[GIN-debug] [WARNING] Now Gin requires Go 1.6 or later and Go 1.7 will be required soon.

[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "_release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

[GIN-debug] POST   /api/login                --> (4 handlers)
[GIN-debug] GET    /api/ws/:id               --> (5 handlers)
[GIN-debug] GET    /api/ssh                  --> (5 handlers)
[GIN-debug] POST   /api/ssh                  --> (5 handlers)
[GIN-debug] GET    /api/ssh/:id              --> (5 handlers)
[GIN-debug] PATCH  /api/ssh/:id              --> (5 handlers)
[GIN-debug] DELETE /api/ssh/:id              --> (5 handlers)
[GIN-debug] GET    /api/sftp/:id             --> (5 handlers)
[GIN-debug] GET    /api/sftp/:id/dl          --> (5 handlers)
[GIN-debug] GET    /api/sftp/:id/cat         --> (5 handlers)
[GIN-debug] GET    /api/sftp/:id/rm          --> (5 handlers)
[GIN-debug] GET    /api/sftp/:id/rename      --> (5 handlers)
[GIN-debug] GET    /api/sftp/:id/mkdir       --> (5 handlers)
[GIN-debug] POST   /api/sftp/:id/up          --> (5 handlers)
[GIN-debug] Listening and serving HTTP on :2222

command: felix ginbro ginbro doc

felix ginbro command is migrated from dejavuzhou/ginbro. Generated WordPress MySQL database running demo

Generated code base

$ felix ginbro
Error: required flag(s) "appDir", "dbAddr" not set
  felix ginbro [flags]

felix rest -u root -p password -a "" -d dbname -c utf8 --authTable=users --authColumn=pw_column -o=FelixRestOut"

  -o, --appDir string       app's code output directory
  -l, --appListen string    app's listening addr (default "")
      --authColumn string   bcrypt password column (default "password")
      --authTable string    login user table (default "users")
  -a, --dbAddr string       database connection addr (default "")
  -c, --dbCharset string    database charset (default "utf8")
  -n, --dbName string       database name
  -p, --dbPassword string   database user password (default "password")
  -t, --dbType string       database type: mysql/postgres/mssql/sqlite (default "mysql")
  -u, --dbUser string       database username (default "root")
  -h, --help                help for ginbro

Global Flags:
      --verbose   verbose

required flag(s) "appDir", "dbAddr" not set

the output code base

ginbro output code base dir

command: felix sshls

felix sshls

command: felix ssh 3

felix sshls

command: felix ssh 2

felix sshls

command: felix sshsocks 34 -l 1080

felix sshls

command: felix taskad

felix sshls

Code Logic

  • save SSH configurations into a SQLite.db in $HOME/.felix.db
  • use spf13/cobra as command framework

felix ginbro Logic

  1. use SQL query get all tables and column schema from database
  2. transform SQL type into Golang type and Swagger Doc type
  3. use Golang Std Lib(text/template) to output Gin's handler and Route files and GORM model files
  4. os.exec call go fmt to format the output codebase

felix sshls Logic

  1. use GORM retrieve all SSH configuration from SQLite.db
  2. use olekukonko/tablewriter write table into terminal

felix ssh 9 Logic

  1. get a ssh configuration by ID
  2. use package start ssh session
  3. customize stdin and stdout to listen Sudo command for password message then input sudo password automatically
You can’t perform that action at this time.