├── .gitignore ├── consts ├── init.go └── version.go ├── Dockerfile.dev ├── resource └── init.go ├── model ├── dto.go └── itf.go ├── go.mod ├── .github └── workflows │ └── golang-ci.yml ├── .golangci.yml ├── Makefile ├── utils ├── crypto.go └── init.go ├── sc ├── init.go ├── aliyun_oss.go └── qingcloud_qingstor.go ├── args └── args.go ├── store ├── backup_restore.go ├── init.go ├── db.go └── item.go ├── README.md ├── main.go ├── README_en.md ├── go.sum └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | pwbox 3 | *.gz 4 | .DS_Store 5 | vendor 6 | -------------------------------------------------------------------------------- /consts/init.go: -------------------------------------------------------------------------------- 1 | package consts 2 | 3 | const ( 4 | HashCount = 20 5 | BlockSize = 16 6 | PageSize = 20 7 | ) 8 | -------------------------------------------------------------------------------- /Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM golang:1.16 2 | 3 | RUN apt-get update && apt-get install vim-common -y 4 | 5 | 6 | WORKDIR /go/src/github.com/vearne/passwordbox/ 7 | ADD . /go/src/github.com/vearne/passwordbox/ 8 | 9 | RUN go get 10 | -------------------------------------------------------------------------------- /resource/init.go: -------------------------------------------------------------------------------- 1 | package resource 2 | 3 | import ( 4 | "github.com/vearne/passwordbox/model" 5 | ) 6 | 7 | var ( 8 | DataPath string 9 | MaxBackupFileCount int 10 | ) 11 | 12 | var ( 13 | GlobalOSS model.ObjectStorage 14 | ) 15 | 16 | var ( 17 | LoopExit = false 18 | ) 19 | -------------------------------------------------------------------------------- /consts/version.go: -------------------------------------------------------------------------------- 1 | package consts 2 | 3 | 4 | var ( 5 | // Version logs build version injected with -ldflags -X opitons. 6 | Version string 7 | 8 | // BuildTime logs build time injected with -ldflags -X opitons. 9 | BuildTime string 10 | 11 | // GitTag logs git version and injected with -ldflags -X opitons. 12 | GitTag string 13 | ) 14 | 15 | -------------------------------------------------------------------------------- /model/dto.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type DetailItem struct { 4 | ID int `json:"-"` 5 | Title string `json:"title"` 6 | Account string `json:"account"` 7 | Password string `json:"password"` 8 | Comment string `json:"comment"` 9 | ModifiedAt string `json:"modifiedAt"` 10 | } 11 | 12 | type BackupItem struct { 13 | ID int `json:"-"` 14 | Tag string `json:"tag"` 15 | } 16 | 17 | type SimpleItem struct { 18 | ID int `json:"id"` 19 | Title string 20 | IVCiphertext string // base64 encoded 21 | } 22 | 23 | type Database struct { 24 | Name string `survey:"name"` 25 | Password string `survey:"password"` 26 | Hint string `survey:"hint"` 27 | } 28 | -------------------------------------------------------------------------------- /model/itf.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type ObjectStorage interface { 4 | Init() error 5 | GetDirPath() string 6 | UploadFile(key string, localFilePath string) bool 7 | DownloadFile(key string, localFilePath string) bool 8 | // If file in oss is newer than localfile? 9 | // if newer > 0, file in oss is newer than localfile 10 | // if newer == 0 file in oss is new as localfile 11 | // if newer < 0 localfile is newer than file in oss 12 | Compare(key string, localFilePath string) (newer int, err error) 13 | // modify Mtime of local file to consistent with file in oss 14 | AdjustMTime(key string, localFilePath string) error 15 | ListKeys(prefix string) ([]string, error) 16 | Delete(key string) error 17 | } 18 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/vearne/passwordbox 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/AlecAivazis/survey/v2 v2.0.7 7 | github.com/aliyun/aliyun-oss-go-sdk v2.1.1+incompatible 8 | github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect 9 | github.com/boombuler/barcode v1.0.1 // indirect 10 | github.com/fatih/color v1.9.0 11 | github.com/mattn/go-sqlite3 v2.0.3+incompatible 12 | github.com/olekukonko/tablewriter v0.0.4 13 | github.com/pengsrc/go-shared v0.2.0 // indirect 14 | github.com/peterh/liner v1.2.0 15 | github.com/pquerna/otp v1.4.0 16 | github.com/satori/go.uuid v1.2.0 // indirect 17 | github.com/spf13/viper v1.7.0 18 | github.com/urfave/cli/v2 v2.2.0 19 | github.com/vearne/simplelog v0.0.0-20200527094239-692fca69e8b1 20 | github.com/yunify/qingstor-sdk-go v2.2.15+incompatible 21 | ) 22 | -------------------------------------------------------------------------------- /.github/workflows/golang-ci.yml: -------------------------------------------------------------------------------- 1 | name: golang-ci 2 | 3 | on: 4 | # Trigger the workflow on push or pull request, 5 | # but only for the main branch 6 | push: 7 | branches: 8 | - main 9 | - master 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # Allows you to run this workflow manually from the Actions tab 15 | workflow_dispatch: 16 | 17 | jobs: 18 | test: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: checkout 22 | uses: actions/checkout@v4 23 | - name: Set up Go 24 | uses: actions/setup-go@v4 25 | with: 26 | go-version: 1.21.0 27 | - name: Test 28 | run: go test -v ./... 29 | 30 | lint: 31 | runs-on: ubuntu-latest 32 | container: 33 | image: golangci/golangci-lint:v1.52.0 34 | steps: 35 | - name: checkout 36 | uses: actions/checkout@v4 37 | - name: golangci-lint 38 | run: golangci-lint run --modules-download-mode=mod 39 | -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | linters: 2 | disable-all: true # 关闭其他linter 3 | enable: # 下面是开启的linter列表,之后的英文注释介绍了相应linter的功能 4 | - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases 5 | - gosimple # Linter for Go source code that specializes in simplifying a code 6 | - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string 7 | - ineffassign # Detects when assignments to existing variables are not used 8 | - staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks 9 | - unused # Checks Go code for unused constants, variables, functions and types 10 | - exportloopref 11 | 12 | linters-settings: 13 | govet: # 对于linter govet,我们手动开启了它的某些扫描规则 14 | enable-all: true 15 | check-shadowing: true 16 | disable: 17 | - fieldalignment 18 | 19 | 20 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | VERSION = v0.0.16 2 | 3 | CONTAINER=pwbox 4 | IMPORT_PATH = github.com/vearne/passwordbox 5 | 6 | BUILD_TIME = $(shell date +%Y%m%d%H%M%S) 7 | GITTAG = `git log -1 --pretty=format:"%H"` 8 | LDFLAGS = -ldflags "-s -w -X $(IMPORT_PATH)/consts.GitTag=${GITTAG} -X $(IMPORT_PATH)/consts.BuildTime=${BUILD_TIME} -X $(IMPORT_PATH)/consts.Version=${VERSION}" 9 | SOURCE_PATH = /go/src/github.com/vearne/passwordbox/ 10 | 11 | .PHONY: build install release release-linux release-mac docker-img xgo 12 | 13 | 14 | build: 15 | go build $(LDFLAGS) -o pwbox 16 | 17 | install: build 18 | cp -f pwbox /usr/local/bin/ 19 | 20 | 21 | release: release-linux release-mac 22 | 23 | release-linux: docker-img 24 | docker run -v `pwd`:$(SOURCE_PATH) -t -e GOOS=linux -e GOARCH=amd64 -i $(CONTAINER) go build $(LDFLAGS) -o pwbox 25 | tar -zcvf pwbox-$(VERSION)-linux-amd64.tar.gz ./pwbox 26 | rm pwbox 27 | 28 | release-mac: 29 | env GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o pwbox 30 | tar -zcvf pwbox-$(VERSION)-darwin-amd64.tar.gz ./pwbox 31 | rm pwbox 32 | 33 | docker-img: 34 | docker build --rm -t $(CONTAINER) -f Dockerfile.dev . 35 | 36 | xgo: 37 | #xgo --targets=darwin/* -out=./pwbox . 38 | xgo -out=./passwordbox . 39 | 40 | -------------------------------------------------------------------------------- /utils/crypto.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "bytes" 5 | "crypto/aes" 6 | "crypto/cipher" 7 | "crypto/hmac" 8 | "crypto/sha256" 9 | slog "github.com/vearne/simplelog" 10 | ) 11 | 12 | var Space = " " 13 | 14 | func paddingSpace(plaintext []byte) []byte { 15 | mod := len(plaintext) % aes.BlockSize 16 | buff := bytes.NewBuffer(plaintext) 17 | if mod != 0 { 18 | buff.Write([]byte(Space)[0 : aes.BlockSize-mod]) 19 | } 20 | return buff.Bytes() 21 | } 22 | 23 | func GenHMacKey(data []byte, salt []byte) []byte { 24 | h := hmac.New(sha256.New, salt) 25 | // Write Data to it 26 | _, err := h.Write(data) 27 | if err != nil { 28 | slog.Error("GenHMacKey, %v", err) 29 | } 30 | // Get result and encode as hexadecimal string 31 | return h.Sum(nil) 32 | } 33 | 34 | func EncryptAesInCFB(plaintext []byte, key []byte, iv []byte) []byte { 35 | plaintext = paddingSpace(plaintext) 36 | block, err := aes.NewCipher(key) 37 | if err != nil { 38 | return make([]byte, 0) 39 | } 40 | 41 | dst := make([]byte, len(plaintext)) 42 | stream := cipher.NewCFBEncrypter(block, iv) 43 | stream.XORKeyStream(dst, plaintext) 44 | return dst 45 | } 46 | 47 | func DecryptAesInCFB(ciphertext []byte, key []byte, iv []byte) []byte { 48 | block, err := aes.NewCipher(key) 49 | if err != nil { 50 | return make([]byte, 0) 51 | } 52 | 53 | stream := cipher.NewCFBDecrypter(block, iv) 54 | 55 | dst := make([]byte, len(ciphertext)) 56 | stream.XORKeyStream(dst, ciphertext) 57 | 58 | return bytes.TrimSpace(dst) 59 | } 60 | -------------------------------------------------------------------------------- /sc/init.go: -------------------------------------------------------------------------------- 1 | package sc 2 | 3 | import ( 4 | "github.com/vearne/passwordbox/resource" 5 | slog "github.com/vearne/simplelog" 6 | "path/filepath" 7 | ) 8 | 9 | func CompareAndUpload(fileName, fullPath string) { 10 | if resource.GlobalOSS == nil { 11 | return 12 | } 13 | key := filepath.Join(resource.GlobalOSS.GetDirPath(), fileName) 14 | newer, err := resource.GlobalOSS.Compare(key, fullPath) 15 | if err != nil { 16 | slog.Error("CompareAndDownload:%v", err) 17 | return 18 | } 19 | if newer >= 0 { 20 | slog.Debug("no need to upload") 21 | } else { 22 | slog.Info("upload, key:%v", key) 23 | resource.GlobalOSS.UploadFile(key, fullPath) 24 | err := resource.GlobalOSS.AdjustMTime(key, fullPath) 25 | if err != nil { 26 | slog.Error("GlobalOSS.AdjustMTime:%v", err) 27 | } 28 | } 29 | } 30 | 31 | func CompareAndDownloadAll() { 32 | if resource.GlobalOSS == nil { 33 | return 34 | } 35 | keys, err := resource.GlobalOSS.ListKeys(resource.GlobalOSS.GetDirPath()) 36 | if err != nil { 37 | slog.Error("GlobalOSS.ListKeys, error:%v", err) 38 | return 39 | } 40 | for _, key := range keys { 41 | _, filename := filepath.Split(key) 42 | fullpath := filepath.Join(resource.DataPath, filename) 43 | newer, err := resource.GlobalOSS.Compare(key, fullpath) 44 | if err != nil { 45 | slog.Error("CompareAndDownload:%v", err) 46 | return 47 | } 48 | if newer > 0 { 49 | slog.Info("download, key:%v", key) 50 | resource.GlobalOSS.DownloadFile(key, fullpath) 51 | err := resource.GlobalOSS.AdjustMTime(key, fullpath) 52 | if err != nil { 53 | slog.Error("GlobalOSS.AdjustMTime:%v", err) 54 | } 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /args/args.go: -------------------------------------------------------------------------------- 1 | package args 2 | 3 | import ( 4 | "strings" 5 | "unicode" 6 | ) 7 | 8 | const ( 9 | CharEscape = '\\' 10 | CharSingleQuote = '\'' 11 | CharDoubleQuote = '"' 12 | CharBackQuote = '`' 13 | ) 14 | 15 | func IsQuote(r rune) bool { 16 | return r == CharSingleQuote || r == CharDoubleQuote || r == CharBackQuote 17 | } 18 | 19 | // parses line, ignore brackets 20 | func Parse(line string) (lineArgs []string) { 21 | var ( 22 | rl = []rune(line + " ") 23 | buf = strings.Builder{} 24 | quoteChar rune 25 | nextChar rune 26 | escaped bool 27 | in bool 28 | ) 29 | 30 | var ( 31 | isSpace bool 32 | ) 33 | 34 | for k, r := range rl { 35 | isSpace = unicode.IsSpace(r) 36 | if !isSpace && !in { 37 | in = true 38 | } 39 | 40 | switch { 41 | case escaped: 42 | escaped = false 43 | //pass 44 | case r == CharEscape: // Escape mode 45 | if k+1+1 < len(rl) { 46 | nextChar = rl[k+1] 47 | // Only these characters are supported for escaping, 48 | // otherwise the backslash is output as-is 49 | if unicode.IsSpace(nextChar) || IsQuote(nextChar) || nextChar == CharEscape { 50 | escaped = true 51 | continue 52 | } 53 | } 54 | // pass 55 | case IsQuote(r): 56 | if quoteChar == 0 { 57 | quoteChar = r 58 | continue 59 | } 60 | 61 | if quoteChar == r { 62 | quoteChar = 0 63 | continue 64 | } 65 | case isSpace: 66 | if !in { // ignore space 67 | continue 68 | } 69 | if quoteChar == 0 { // Not in quotes 70 | lineArgs = append(lineArgs, buf.String()) 71 | buf.Reset() 72 | in = false 73 | continue 74 | } 75 | } 76 | 77 | buf.WriteRune(r) 78 | } 79 | 80 | return 81 | } 82 | -------------------------------------------------------------------------------- /utils/init.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "crypto/aes" 5 | "crypto/rand" 6 | "crypto/sha256" 7 | "fmt" 8 | slog "github.com/vearne/simplelog" 9 | "io" 10 | "os" 11 | ) 12 | 13 | // 判断所给路径文件/文件夹是否存在 14 | func Exists(path string) bool { 15 | _, err := os.Stat(path) //os.Stat获取文件信息 16 | if err != nil { 17 | return os.IsExist(err) 18 | } 19 | return true 20 | } 21 | 22 | // 判断所给路径是否为文件夹 23 | func IsDir(path string) bool { 24 | s, err := os.Stat(path) 25 | if err != nil { 26 | return false 27 | } 28 | return s.IsDir() 29 | } 30 | 31 | func Sha256N(plaintext string, n int) string { 32 | h := sha256.New() 33 | buff := []byte(plaintext) 34 | for i := 0; i < n; i++ { 35 | _, err := h.Write(buff) 36 | if err != nil { 37 | slog.Error("Sha256N:%v error", err) 38 | } 39 | buff = h.Sum(nil) 40 | h.Reset() 41 | } 42 | return fmt.Sprintf("%x", buff) 43 | } 44 | 45 | func GenRandIV() []byte { 46 | iv := make([]byte, aes.BlockSize) 47 | if _, err := io.ReadFull(rand.Reader, iv); err != nil { 48 | slog.Error("GenRandIV:%v error", err) 49 | } 50 | return iv 51 | } 52 | 53 | func Min(a, b int) int { 54 | if a < b { 55 | return a 56 | } else { 57 | return b 58 | } 59 | } 60 | 61 | func FindInSlice(keyword string, slice []string) bool { 62 | for _, item := range slice { 63 | if keyword == item { 64 | return true 65 | } 66 | } 67 | return false 68 | } 69 | 70 | func CalcTotalPage(total, pageSize int) int { 71 | x := total / pageSize 72 | if total%pageSize != 0 { 73 | x++ 74 | } 75 | return x 76 | } 77 | 78 | func IsSecurePassword(s string) bool { 79 | if len(s) < 8 { 80 | return false 81 | } 82 | var hasLowerCaseChar bool 83 | var hasUpperCaseChar bool 84 | var hasNumberChar bool 85 | var hasSpecialChar bool 86 | for _, char := range s { 87 | if char >= 'a' && char <= 'z' { 88 | hasLowerCaseChar = true 89 | } else if char >= 'A' && char <= 'Z' { 90 | hasUpperCaseChar = true 91 | } else if char >= '0' && char <= '9' { 92 | hasNumberChar = true 93 | } else { 94 | hasSpecialChar = true 95 | } 96 | } 97 | return hasLowerCaseChar && hasUpperCaseChar && hasNumberChar && hasSpecialChar 98 | } 99 | -------------------------------------------------------------------------------- /store/backup_restore.go: -------------------------------------------------------------------------------- 1 | package store 2 | 3 | import ( 4 | "fmt" 5 | "github.com/AlecAivazis/survey/v2" 6 | "github.com/urfave/cli/v2" 7 | "github.com/vearne/passwordbox/model" 8 | "github.com/vearne/passwordbox/resource" 9 | slog "github.com/vearne/simplelog" 10 | "io/ioutil" 11 | "os" 12 | "path/filepath" 13 | "sort" 14 | "strings" 15 | ) 16 | 17 | func RestoreItem(c *cli.Context) error { 18 | fmt.Println("--RestoreItem--") 19 | tagId := c.Int("tagId") 20 | slog.Debug("RestoreItem, tagId:%v", tagId) 21 | 22 | if tagId < 0 { // list all available backups 23 | slog.Debug("resource.DataPath:%v", resource.DataPath) 24 | items := getAllBackupItem() 25 | PrintBackups(items) 26 | return nil 27 | } 28 | // restore 29 | items := getAllBackupItem() 30 | if tagId > len(items) { 31 | slog.Error("tagId invalid") 32 | return nil 33 | } 34 | confirmRestore := false 35 | prompt := &survey.Confirm{ 36 | Message: "confirm restore?", 37 | } 38 | err := survey.AskOne(prompt, &confirmRestore) 39 | if err != nil { 40 | fmt.Printf("survey.AskOne error, %v\n", err) 41 | return err 42 | } 43 | if !confirmRestore { 44 | return nil 45 | } 46 | 47 | slog.Info("1. RestoreItem-close DB") 48 | GlobalStore.Close() 49 | // delete 50 | err = os.Remove(GlobalStore.FullPath) 51 | if err != nil { 52 | slog.Error("os.Remove:%v", GlobalStore.FullPath) 53 | return err 54 | } 55 | oldName := filepath.Join(resource.DataPath, GlobalStore.FileName+"."+items[tagId-1].Tag) 56 | newName := GlobalStore.FullPath 57 | // rename 58 | slog.Info("2. RestoreItem-rename, oldName:%v, newName:%v", oldName, newName) 59 | err = os.Rename(oldName, newName) 60 | if err != nil { 61 | slog.Error("os.Rename:%v", oldName) 62 | return err 63 | } 64 | // upload 65 | key := filepath.Join(resource.GlobalOSS.GetDirPath(), GlobalStore.FileName) 66 | slog.Info("3. RestoreItem-upload, key:%v", key) 67 | resource.GlobalOSS.UploadFile(key, GlobalStore.FullPath) 68 | 69 | slog.Info("Restore success.Please login later...") 70 | resource.LoopExit = true 71 | return nil 72 | } 73 | 74 | func getAllBackupItem() []model.BackupItem { 75 | items := make([]model.BackupItem, 0) 76 | files, err := getAllBackupFiles(resource.DataPath, GlobalStore.FileName) 77 | if err != nil { 78 | slog.Error("RestoreItem-GetAllBackupFiles, %v", err) 79 | return items 80 | } 81 | 82 | sort.Sort(sort.Reverse(sort.StringSlice(files))) 83 | counter := 1 84 | for _, fileName := range files { 85 | tempList := strings.Split(fileName, ".") 86 | if len(tempList) < 2 { 87 | continue 88 | } 89 | items = append(items, model.BackupItem{ID: counter, Tag: tempList[1]}) 90 | counter++ 91 | } 92 | return items 93 | } 94 | 95 | func getAllBackupFiles(dirPth string, prefix string) (files []string, err error) { 96 | dir, err := ioutil.ReadDir(dirPth) 97 | if err != nil { 98 | return nil, err 99 | } 100 | 101 | PthSep := string(os.PathSeparator) 102 | //suffix = strings.ToUpper(suffix) //忽略后缀匹配的大小写 103 | 104 | for _, fi := range dir { 105 | if fi.IsDir() { // 目录, 递归遍历 106 | continue 107 | } else { 108 | // 过滤指定格式 109 | ok := strings.HasPrefix(fi.Name(), prefix) 110 | if ok && fi.Name() != prefix { 111 | files = append(files, dirPth+PthSep+fi.Name()) 112 | } 113 | } 114 | } 115 | 116 | return files, nil 117 | } 118 | -------------------------------------------------------------------------------- /sc/aliyun_oss.go: -------------------------------------------------------------------------------- 1 | package sc 2 | 3 | import ( 4 | "fmt" 5 | "github.com/aliyun/aliyun-oss-go-sdk/oss" 6 | slog "github.com/vearne/simplelog" 7 | "os" 8 | "time" 9 | ) 10 | 11 | type AliOSS struct { 12 | AccessKeyId string `mapstructure:"access_key_id"` 13 | AccessKeySecret string `mapstructure:"access_key_secret"` 14 | BucketName string `mapstructure:"bucket_name"` 15 | Endpoint string `mapstructure:"endpoint"` 16 | DirPath string `mapstructure:"dir_path"` 17 | Bucket *oss.Bucket 18 | } 19 | 20 | func (s *AliOSS) Init() error { 21 | client, err := oss.New(s.Endpoint, s.AccessKeyId, s.AccessKeySecret) 22 | if err != nil { 23 | return err 24 | } 25 | s.Bucket, err = client.Bucket(s.BucketName) 26 | if err != nil { 27 | return err 28 | } 29 | return nil 30 | } 31 | 32 | func (s *AliOSS) GetDirPath() string { 33 | return s.DirPath 34 | } 35 | 36 | func (s *AliOSS) UploadFile(key string, localFilePath string) bool { 37 | err := s.Bucket.PutObjectFromFile(key, localFilePath) 38 | if err != nil { 39 | slog.Error("AliOSS.UploadFile, error:%v", err) 40 | return false 41 | } 42 | return true 43 | } 44 | 45 | func (s *AliOSS) ListKeys(prefix string) ([]string, error) { 46 | lsRes, err := s.Bucket.ListObjects(oss.Prefix(prefix)) 47 | if err != nil { 48 | slog.Error("AliOSS.ListKeys, error:%v", err) 49 | return nil, err 50 | } 51 | 52 | result := make([]string, 0) 53 | for _, object := range lsRes.Objects { 54 | result = append(result, object.Key) 55 | } 56 | return result, nil 57 | } 58 | 59 | func (s *AliOSS) DownloadFile(key string, localFilePath string) bool { 60 | err := s.Bucket.GetObjectToFile(key, localFilePath) 61 | if err != nil { 62 | slog.Error("AliOSS.DownloadFile, error:%v", err) 63 | return false 64 | } 65 | return true 66 | } 67 | 68 | func (s *AliOSS) Compare(key string, localFilePath string) (int, error) { 69 | lsRes, err := s.Bucket.ListObjects(oss.Prefix(key)) 70 | if err != nil { 71 | slog.Error("AliOSS.ListKeys, error:%v", err) 72 | return -1, err 73 | } 74 | 75 | if len(lsRes.Objects) <= 0 { 76 | return -1, fmt.Errorf("AliOSS.ListKeys, len(lsRes.Objects) <= 0") 77 | } 78 | 79 | var obj oss.ObjectProperties 80 | for _, object := range lsRes.Objects { 81 | if key == object.Key { 82 | obj = object 83 | break 84 | } 85 | } 86 | 87 | info, err := os.Stat(localFilePath) 88 | if err != nil { 89 | slog.Debug("os.Stat error, %v", err) 90 | return 1, nil 91 | } 92 | 93 | localLastModified := info.ModTime() 94 | if obj.LastModified.Unix() > localLastModified.Unix() { 95 | return 1, nil 96 | } else if obj.LastModified.Unix() == localLastModified.Unix() { 97 | return 0, nil 98 | } else { 99 | return -1, nil 100 | } 101 | 102 | } 103 | 104 | func (s *AliOSS) AdjustMTime(key string, localFilePath string) error { 105 | lsRes, err := s.Bucket.ListObjects(oss.Prefix(key)) 106 | if err != nil { 107 | return fmt.Errorf("AliOSS.ListKeys, error:%v", err) 108 | } 109 | 110 | if len(lsRes.Objects) <= 0 { 111 | return fmt.Errorf("AliOSS.ListKeys, len(lsRes.Objects) <= 0") 112 | } 113 | 114 | var obj oss.ObjectProperties 115 | for _, object := range lsRes.Objects { 116 | if key == object.Key { 117 | obj = object 118 | break 119 | } 120 | } 121 | 122 | mTime := time.Unix(obj.LastModified.Unix(), 0) 123 | err = os.Chtimes(localFilePath, time.Now(), mTime) 124 | 125 | return err 126 | } 127 | 128 | func (s *AliOSS) Delete(key string) error { 129 | err := s.Bucket.DeleteObject(key) 130 | return err 131 | } 132 | -------------------------------------------------------------------------------- /sc/qingcloud_qingstor.go: -------------------------------------------------------------------------------- 1 | package sc 2 | 3 | import ( 4 | "fmt" 5 | slog "github.com/vearne/simplelog" 6 | "github.com/yunify/qingstor-sdk-go/config" 7 | qs "github.com/yunify/qingstor-sdk-go/service" 8 | "io" 9 | "net/http" 10 | "os" 11 | "strings" 12 | "time" 13 | ) 14 | 15 | type QingStor struct { 16 | AccessKey string `mapstructure:"access_key"` 17 | SecretKey string `mapstructure:"secret_key"` 18 | BucketName string `mapstructure:"bucket_name"` 19 | Zone string `mapstructure:"zone"` 20 | DirPath string `mapstructure:"dir_path"` 21 | Bucket *qs.Bucket 22 | } 23 | 24 | func (s *QingStor) Init() error { 25 | var err error 26 | configuration, err := config.New(s.AccessKey, s.SecretKey) 27 | if err != nil { 28 | return err 29 | } 30 | qsService, err := qs.Init(configuration) 31 | if err != nil { 32 | return err 33 | } 34 | s.Bucket, err = qsService.Bucket(s.BucketName, s.Zone) 35 | if err != nil { 36 | return err 37 | } 38 | return nil 39 | } 40 | 41 | func (s *QingStor) GetDirPath() string { 42 | return s.DirPath 43 | } 44 | 45 | func (s *QingStor) UploadFile(key string, filepath string) bool { 46 | // Open file 47 | var file *os.File 48 | file, err := os.Open(filepath) 49 | if err != nil { 50 | slog.Error("QingStor.UploadFile--open file error,filepath:%v", filepath) 51 | return false 52 | } 53 | defer file.Close() 54 | 55 | // Put object 56 | oOutput, err := s.Bucket.PutObject(key, &qs.PutObjectInput{Body: file}) 57 | 58 | if qs.IntValue(oOutput.StatusCode) == http.StatusCreated { 59 | // Print the HTTP status code. 60 | // Example: 201 61 | return true 62 | } else if err != nil { 63 | // Example: QingStor Error: StatusCode 403, Code "permission_denied"... 64 | slog.Error("QingStor.UploadFile--error,filepath:%v", filepath) 65 | return false 66 | } 67 | return false 68 | } 69 | 70 | func (s *QingStor) ListKeys(prefix string) ([]string, error) { 71 | bOutput, err := s.Bucket.ListObjects(&qs.ListObjectsInput{Prefix: &s.DirPath}) 72 | if err != nil { 73 | return nil, err 74 | } 75 | result := make([]string, 0) 76 | for _, item := range bOutput.Keys { 77 | result = append(result, *item.Key) 78 | } 79 | return result, nil 80 | } 81 | 82 | func (s *QingStor) DownloadFile(key string, localFilePath string) bool { 83 | getOutput, err := s.Bucket.GetObject(key, 84 | &qs.GetObjectInput{}, 85 | ) 86 | if err != nil { 87 | slog.Error("DownloadFile error, %v", err) 88 | return false 89 | } 90 | defer getOutput.Close() 91 | f, err := os.OpenFile(localFilePath, os.O_CREATE|os.O_WRONLY, 0600) 92 | if err != nil { 93 | slog.Error("DownloadFile-open file error, %v", err) 94 | return false 95 | } 96 | defer f.Close() 97 | _, err = io.Copy(f, getOutput.Body) 98 | 99 | if err != nil { 100 | slog.Error("DownloadFile-copy error, %v", err) 101 | return false 102 | } 103 | return true 104 | } 105 | 106 | func (s *QingStor) Compare(key string, localFilePath string) (int, error) { 107 | remote, err := s.Bucket.HeadObject(key, nil) 108 | if err != nil && strings.Contains(err.Error(), "404") { 109 | return -1, nil 110 | } else if err != nil { 111 | slog.Error("Bucket.HeadObject error, %v", err) 112 | return -1, err 113 | } 114 | 115 | info, err := os.Stat(localFilePath) 116 | if err != nil { 117 | slog.Debug("os.Stat error, %v", err) 118 | return 1, nil 119 | } 120 | localLastModified := info.ModTime() 121 | 122 | slog.Debug("remote.LastModified:%v, local.LastModified:%v", 123 | (*remote.LastModified).Unix(), localLastModified.Unix()) 124 | 125 | if (*remote.LastModified).Unix() > localLastModified.Unix() { 126 | return 1, nil 127 | } else if (*remote.LastModified).Unix() == localLastModified.Unix() { 128 | return 0, nil 129 | } else { 130 | return -1, nil 131 | } 132 | 133 | } 134 | 135 | func (s *QingStor) AdjustMTime(key string, localFilePath string) error { 136 | remote, err := s.Bucket.HeadObject(key, nil) 137 | if err != nil && strings.Contains(err.Error(), "404") { 138 | return fmt.Errorf("key does't exist") 139 | } else if err != nil { 140 | return fmt.Errorf("Bucket.HeadObject error, %v", err) 141 | } 142 | 143 | mTime := time.Unix((*remote.LastModified).Unix(), 0) 144 | err = os.Chtimes(localFilePath, time.Now(), mTime) 145 | 146 | return err 147 | } 148 | 149 | func (s *QingStor) Delete(key string) error { 150 | _, err := s.Bucket.DeleteObject(key) 151 | return err 152 | } 153 | -------------------------------------------------------------------------------- /store/init.go: -------------------------------------------------------------------------------- 1 | package store 2 | 3 | import ( 4 | "crypto/aes" 5 | "database/sql" 6 | _ "github.com/mattn/go-sqlite3" 7 | "github.com/vearne/passwordbox/consts" 8 | "github.com/vearne/passwordbox/model" 9 | "github.com/vearne/passwordbox/utils" 10 | slog "github.com/vearne/simplelog" 11 | "io/ioutil" 12 | "os" 13 | "path/filepath" 14 | "strings" 15 | ) 16 | 17 | var ( 18 | GlobalStore *DatabaseStore 19 | ) 20 | 21 | func NewDatabaseStore(dataPath string, database *model.Database) *DatabaseStore { 22 | databaseName := strings.TrimSpace(database.Name) 23 | filename := utils.Sha256N(databaseName, consts.HashCount) 24 | fullpath := filepath.Join(dataPath, filename) 25 | 26 | s := DatabaseStore{} 27 | s.FileName = filename 28 | s.FullPath = fullpath 29 | s.DatabaseName = database.Name 30 | s.DataBaseIV = filename[0:aes.BlockSize] 31 | s.Key = utils.GenHMacKey([]byte(database.Password), []byte(s.DataBaseIV)) 32 | s.Hint = database.Hint 33 | s.Items = make([]*model.SimpleItem, 0) 34 | 35 | return &s 36 | } 37 | 38 | func OpenDatabaseStore(dataPath string, database *model.Database) (*DatabaseStore, error) { 39 | databaseName := strings.TrimSpace(database.Name) 40 | filename := utils.Sha256N(databaseName, consts.HashCount) 41 | fullpath := filepath.Join(dataPath, filename) 42 | 43 | s := DatabaseStore{} 44 | s.Dirty = false 45 | s.FileName = filename 46 | s.FullPath = fullpath 47 | s.DatabaseName = database.Name 48 | s.DataBaseIV = filename[0:aes.BlockSize] 49 | s.Key = utils.GenHMacKey([]byte(database.Password), []byte(s.DataBaseIV)) 50 | 51 | // copy disk file to tempfile 52 | // create temp file 53 | file, _ := ioutil.TempFile("", "*") 54 | err := file.Close() 55 | if err != nil { 56 | slog.Fatal("DatabaseStore-create temp file, %v", err) 57 | return nil, err 58 | } 59 | s.TempFile = file.Name() 60 | buff, err := ioutil.ReadFile(s.FullPath) 61 | if err != nil { 62 | slog.Error("open openDatabase error, %v", err) 63 | return nil, err 64 | } 65 | // Decrypt the entire file 66 | buff = utils.DecryptAesInCFB(buff, s.Key, []byte(s.DataBaseIV)) 67 | err = ioutil.WriteFile(s.TempFile, buff, 0600) 68 | if err != nil { 69 | slog.Error("open openDatabase error, %v", err) 70 | return nil, err 71 | } 72 | s.DB, err = sql.Open("sqlite3", s.TempFile) 73 | if err != nil { 74 | slog.Error("DatabaseStore-open db, %v", err) 75 | return nil, err 76 | } 77 | return &s, nil 78 | } 79 | 80 | type DatabaseStore struct { 81 | DatabaseName string 82 | Hint string 83 | Items []*model.SimpleItem 84 | FileName string 85 | FullPath string 86 | Key []byte 87 | DataBaseIV string 88 | DB *sql.DB 89 | TempFile string 90 | Dirty bool 91 | NeedBackup bool 92 | BackupItems []model.BackupItem 93 | } 94 | 95 | func (s *DatabaseStore) Init() error { 96 | var err error 97 | file, _ := ioutil.TempFile("", "*") 98 | err = file.Close() 99 | if err != nil { 100 | slog.Fatal("DatabaseStore-create temp file, %v", err) 101 | return err 102 | } 103 | s.TempFile = file.Name() 104 | s.DB, err = sql.Open("sqlite3", s.TempFile) 105 | if err != nil { 106 | slog.Error("DatabaseStore-open db, %v", err) 107 | return err 108 | } 109 | err = CreateTable(s.DB) 110 | if err != nil { 111 | slog.Error("DatabaseStore-operate db, %v", err) 112 | return err 113 | } 114 | err = InsertHint(s.DB, s.Hint) 115 | if err != nil { 116 | slog.Error("DatabaseStore-operate db, %v", err) 117 | return err 118 | } 119 | return nil 120 | } 121 | 122 | func (s *DatabaseStore) Close() error { 123 | var err error 124 | // close sqlite db 125 | err = s.DB.Close() 126 | if err != nil { 127 | slog.Error("close file error, %v", err) 128 | return err 129 | } 130 | // flush to disk 131 | buff, err := ioutil.ReadFile(s.TempFile) 132 | if err != nil { 133 | slog.Error("read temp file error, %v", err) 134 | return err 135 | } 136 | 137 | // Encrypt the entire file 138 | // ciphertext = AES-CFB(fileConent, key, DataBaseIV) 139 | buff = utils.EncryptAesInCFB(buff, s.Key, []byte(s.DataBaseIV)) 140 | err = ioutil.WriteFile(s.FullPath, buff, 0600) 141 | if err != nil { 142 | slog.Error("write disk file error, %v", err) 143 | return err 144 | } 145 | 146 | // remove temp file 147 | err = os.Remove(s.TempFile) 148 | if err != nil { 149 | slog.Error("remove temp file error, %v", err) 150 | return err 151 | } 152 | return nil 153 | } 154 | -------------------------------------------------------------------------------- /store/db.go: -------------------------------------------------------------------------------- 1 | package store 2 | 3 | import ( 4 | "database/sql" 5 | "fmt" 6 | "github.com/vearne/passwordbox/model" 7 | slog "github.com/vearne/simplelog" 8 | ) 9 | 10 | func CreateTable(db *sql.DB) error { 11 | var err error 12 | // table item 13 | sqlStmt := ` 14 | CREATE TABLE Item ( 15 | id INTEGER PRIMARY KEY, 16 | title TEXT, 17 | IVCiphertext TEXT NOT NULL 18 | ); 19 | ` 20 | _, err = db.Exec(sqlStmt) 21 | if err != nil { 22 | slog.Error("%q: %s", err, sqlStmt) 23 | return err 24 | } 25 | // table meta 26 | sqlStmt = ` 27 | CREATE TABLE meta ( 28 | id INTEGER PRIMARY KEY, 29 | hint TEXT 30 | ); 31 | ` 32 | _, err = db.Exec(sqlStmt) 33 | if err != nil { 34 | slog.Error("%q: %s", err, sqlStmt) 35 | return err 36 | } 37 | return nil 38 | } 39 | 40 | func InsertHint(db *sql.DB, hint string) error { 41 | tx, err := db.Begin() 42 | if err != nil { 43 | slog.Error("InsertHint, %v", err) 44 | return err 45 | } 46 | stmt, err := tx.Prepare("insert into meta(id, hint) values(?, ?)") 47 | if err != nil { 48 | slog.Error("InsertHint, %v", err) 49 | return err 50 | } 51 | defer stmt.Close() 52 | _, err = stmt.Exec(0, hint) 53 | if err != nil { 54 | slog.Error("InsertHint, %v", err) 55 | return err 56 | } 57 | return tx.Commit() 58 | } 59 | 60 | func InsertItem(db *sql.DB, item *model.SimpleItem) error { 61 | tx, err := db.Begin() 62 | if err != nil { 63 | slog.Error("InsertItem, %v", err) 64 | return err 65 | } 66 | stmt, err := tx.Prepare("INSERT INTO item (title, IVCiphertext) VALUES(?, ?)") 67 | if err != nil { 68 | slog.Error("InsertItem, %v", err) 69 | return err 70 | } 71 | defer stmt.Close() 72 | _, err = stmt.Exec(item.Title, item.IVCiphertext) 73 | if err != nil { 74 | slog.Error("InsertItem, %v", err) 75 | return err 76 | } 77 | return tx.Commit() 78 | } 79 | func UpdateItem(db *sql.DB, item *model.SimpleItem) error { 80 | tx, err := db.Begin() 81 | if err != nil { 82 | slog.Error("UpdateItem, %v", err) 83 | return err 84 | } 85 | query := "update item set title = ?, IVCiphertext = ? where id = ?" 86 | stmt, err := tx.Prepare(query) 87 | if err != nil { 88 | slog.Error("UpdateItem, %v", err) 89 | return err 90 | } 91 | defer stmt.Close() 92 | _, err = stmt.Exec(item.Title, item.IVCiphertext, item.ID) 93 | if err != nil { 94 | slog.Error("UpdateItem, %v", err) 95 | return err 96 | } 97 | return tx.Commit() 98 | } 99 | 100 | func CountItems(db *sql.DB, keyword string) (int, error) { 101 | query := fmt.Sprintf("select count(*) from item where title like %q", 102 | "%"+keyword+"%") 103 | 104 | stmt, err := db.Prepare(query) 105 | if err != nil { 106 | slog.Error("Get, %v", err) 107 | return -1, err 108 | } 109 | defer stmt.Close() 110 | var total int 111 | err = stmt.QueryRow().Scan(&total) 112 | if err != nil { 113 | slog.Error("Get, %v", err) 114 | return 0, err 115 | } 116 | return total, nil 117 | } 118 | 119 | func DeleteItem(db *sql.DB, itemId int) error { 120 | tx, err := db.Begin() 121 | if err != nil { 122 | slog.Error("UpdateItem, %v", err) 123 | return err 124 | } 125 | stmt, err := tx.Prepare("delete from item where id = ?") 126 | if err != nil { 127 | slog.Error("DeleteItem, %v", err) 128 | return err 129 | } 130 | defer stmt.Close() 131 | _, err = stmt.Exec(itemId) 132 | if err != nil { 133 | slog.Error("DeleteItem, %v", err) 134 | return err 135 | } 136 | return tx.Commit() 137 | } 138 | 139 | func Query(db *sql.DB, keyword string, pageId, pageSize int) ([]*model.SimpleItem, error) { 140 | query := "select id, title, IVCiphertext from item where title like %q limit %d, %d" 141 | query = fmt.Sprintf(query, "%"+keyword+"%", (pageId-1)*pageSize, pageSize) 142 | slog.Debug("sql:%v", query) 143 | rows, err := db.Query(query) 144 | if err != nil { 145 | slog.Error("query, %v", err) 146 | return nil, err 147 | } 148 | 149 | result := make([]*model.SimpleItem, 0) 150 | defer rows.Close() 151 | for rows.Next() { 152 | var id int 153 | var title string 154 | var IVCiphertext string 155 | err = rows.Scan(&id, &title, &IVCiphertext) 156 | if err != nil { 157 | slog.Error("query, %v", err) 158 | return nil, err 159 | } 160 | result = append(result, &model.SimpleItem{ID: id, 161 | Title: title, IVCiphertext: IVCiphertext}) 162 | } 163 | 164 | return result, nil 165 | } 166 | 167 | func GetItem(db *sql.DB, itemId int) (*model.SimpleItem, error) { 168 | stmt, err := db.Prepare("select id, title, IVCiphertext from item where id = ?") 169 | if err != nil { 170 | slog.Error("Get, %v", err) 171 | return nil, err 172 | } 173 | defer stmt.Close() 174 | item := model.SimpleItem{} 175 | err = stmt.QueryRow(itemId).Scan(&item.ID, &item.Title, &item.IVCiphertext) 176 | if err != nil { 177 | slog.Error("Get, %v", err) 178 | return nil, err 179 | } 180 | return &item, nil 181 | } 182 | 183 | func GetHint(db *sql.DB) (string, error) { 184 | stmt, err := db.Prepare("select hint from meta where id = ?") 185 | if err != nil { 186 | slog.Error("Get, %v", err) 187 | return "", err 188 | } 189 | defer stmt.Close() 190 | var hint string 191 | err = stmt.QueryRow(0).Scan(&hint) 192 | if err != nil { 193 | slog.Error("Get, %v", err) 194 | return "", err 195 | } 196 | return hint, nil 197 | } 198 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # passwordbox 2 | 3 | [![golang-ci](https://github.com/vearne/passwordbox/actions/workflows/golang-ci.yml/badge.svg)](https://github.com/vearne/passwordbox/actions/workflows/golang-ci.yml) 4 | 5 | [English README](https://github.com/vearne/passwordbox/blob/master/README_en.md) 6 | 7 | `passwordbox`是一个类似1password的密码管理工具。完全基于命令行交互执行。 8 | 9 | ### 内部实现细节 10 | 首先将每个记录项加密存储在`SQLite`的数据文件中,然后再对整个数据文件进行二次加密。 11 | 12 | 13 | ### 快速开始 14 | 15 | #### 编译 16 | ``` 17 | make build 18 | ``` 19 | #### 安装 20 | ``` 21 | make install 22 | ``` 23 | 24 | 你也可以在 [release](https://github.com/vearne/passwordbox/releases) 25 | 中找到已经编译好的文件 26 | #### 启动 27 | ``` 28 | pwbox --data=/Users/vearne 29 | ``` 30 | 31 | * --data 设置加密数据文件的存储路径 32 | 33 | 建议你为`passwordbox`设置一个别名 34 | ``` 35 | alias pwbox='pwbox --data=/Users/vearne' 36 | ``` 37 | 38 | #### 同步到对象存储 39 | 如果你希望数据文件在多个设备中共享,你还可以通过配置对象存储来实现。 40 | ##### 目前已支持 41 | 42 | * [青云](https://www.qingcloud.com/products/qingstor/) `qingstor.yaml` 43 | * [阿里云](https://cn.aliyun.com/product/oss) `oss.yaml` 44 | 45 | ``` 46 | pwbox --data=/Users/vearne --oss=/directory/qingstor.yaml 47 | ``` 48 | ``` 49 | pwbox --data=/Users/vearne --oss=/directory/oss.yaml 50 | ``` 51 | * --oss 对象存储的配置文件 (可选) 52 | 53 | ##### 注意: 54 | 1) pwbox是通过配置文件的名称来识别对象存储所属的云厂商,所以配置文件的名称是固定的 55 | 2) 为了安全,一定要把对象存储的Bucket设置为私有(只允许使用密钥进行读写) 56 | 57 | 58 | 程序启动以后,按照导引的要求创建数据库,所有的记录项都存储在数据库中 59 | ``` 60 | ─$ ./pwbox --data /tmp/ 61 | ---- login database ---- 62 | ? Please type database's name: test 63 | fullpath /tmp/6879630a7d56210d2cd2491cb99d781194689fed71d7890a8dabbcb3a678cb73 64 | ? Database is not exist. 65 | Do you like to create database now? Yes 66 | ---- create database ---- 67 | ? Please type database's name: test 68 | ? Please type password: ***** 69 | ? Please type hint[optional]: test 70 | ---- login database ---- 71 | ? Please type database's name: test 72 | fullpath /tmp/6879630a7d56210d2cd2491cb99d781194689fed71d7890a8dabbcb3a678cb73 73 | ? Please type your password: ***** 74 | Hint for database test is test 75 | ``` 76 | 登录数据库成功之后,可以执行如下的命令 77 | ##### help 78 | 获取所有的可用命令,以及它们的用法 79 | ##### add 80 | 添加一个记录项 81 | ``` 82 | test > add 83 | --AddItem-- 84 | ? Please type Item's title: google 85 | ? Please type Item's account: myaccount 86 | ? Please type Item's password: ********** 87 | ? Please type Item's comment(optional): 88 | +----+--------+-----------+------------+---------+---------------------------+ 89 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 90 | +----+--------+-----------+------------+---------+---------------------------+ 91 | | 0 | google | myaccount | mypassword | | 2020-04-15T13:43:45+08:00 | 92 | +----+--------+-----------+------------+---------+---------------------------+ 93 | AddItem-save to file 94 | --SearchItem-- 95 | total: 2 96 | pageSize: 20 currentPage: 1 97 | +----+--------+---------+----------+---------+------------+ 98 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 99 | +----+--------+---------+----------+---------+------------+ 100 | | 1 | baidu | *** | *** | *** | *** | 101 | | 2 | google | *** | *** | *** | *** | 102 | +----+--------+---------+----------+---------+------------+ 103 | ``` 104 | ##### delete 105 | ``` 106 | test1 > delete --itemId 2 107 | --DeleteItem-- 108 | +----+--------+---------------+---------------+---------+---------------------------+ 109 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 110 | +----+--------+---------------+---------------+---------+---------------------------+ 111 | | 2 | google | googleAccount | googleAccount | | 2020-04-15T13:55:25+08:00 | 112 | +----+--------+---------------+---------------+---------+---------------------------+ 113 | ? confirm delete? Yes 114 | delete item 2 success 115 | --SearchItem-- 116 | total: 1 117 | pageSize: 20 currentPage: 1 118 | +----+----------------+---------+----------+---------+------------+ 119 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 120 | +----+----------------+---------+----------+---------+------------+ 121 | | 1 | baidu account | *** | *** | *** | *** | 122 | +----+----------------+---------+----------+---------+------------+ 123 | ``` 124 | ##### modify 125 | ``` 126 | test > modify --itemId 1 127 | --ModifyItem-- 128 | If you don't want to make changes, you can just press Enter! 129 | ? Please type Item's title:["baidu"] baidu account 130 | ? Please type Item's account:["baiduAccount"] 131 | ? Please type Item's password:["*************"] 132 | ? Please type Item's comment(optional):[""] 133 | +----+---------------+--------------+---------------+---------+---------------------------+ 134 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 135 | +----+---------------+--------------+---------------+---------+---------------------------+ 136 | | 1 | baidu account | baiduAccount | cbaiduAccount | | 2020-04-15T13:17:58+08:00 | 137 | +----+---------------+--------------+---------------+---------+---------------------------+ 138 | ``` 139 | ##### search 140 | ``` 141 | test > search --pageId 1 --keyword "baidu" 142 | --SearchItem-- 143 | total: 1 144 | pageSize: 20 currentPage: 1 145 | +----+-------+---------+----------+---------+------------+ 146 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 147 | +----+-------+---------+----------+---------+------------+ 148 | | 1 | baidu | *** | *** | *** | *** | 149 | +----+-------+---------+----------+---------+------------+ 150 | ``` 151 | * `pageId` 记录项是分页显示的,每页20条数据,`pageId`是页号,从1开始 152 | * `keyword` 可以使用`keyword`来对记录项进行过滤,效果近似如下SQL语句 153 | ``` 154 | select * from item where title like "%keyword%" 155 | ``` 156 | ##### view 157 | 以明文方式查看某个记录项的账号密码等信息。 158 | 除非执行`view`命令,否则一个记录项在内存中也是加密的。 159 | ``` 160 | test1 > view --itemId 3 161 | --ViewItem-- 162 | +----+-------+---------+----------+---------+---------------------------+ 163 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 164 | +----+-------+---------+----------+---------+---------------------------+ 165 | | 3 | baidu | a3 | p3 | | 2020-04-16T10:04:47+08:00 | 166 | +----+-------+---------+----------+---------+---------------------------+ 167 | ``` 168 | 169 | #### totp 170 | 1)使用`add` 添加totp密钥 171 | ``` 172 | mytest > add 173 | --AddItem-- 174 | ? Please type Item's title: mytotp 175 | ? Please type Item's account: example.com 176 | ? Please type Item's password: ************************************************************************************************ 177 | ? Please type Item's comment(optional): 178 | +----+--------+-------------+--------------------------------------------------------------------------------------------------------------+---------+---------------------------+ 179 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 180 | +----+--------+-------------+--------------------------------------------------------------------------------------------------------------+---------+---------------------------+ 181 | | 0 | mytotp | example.com | otpauth://totp/ut:vearne?algorithm=SHA1&digits=6&issuer=ut&period=30&secret=Z5WVCNODB6HOPERMAEEKFWMK62IGRC3L | | 2024-02-19T10:46:47+08:00 | 182 | +----+--------+-------------+--------------------------------------------------------------------------------------------------------------+---------+---------------------------+ 183 | ``` 184 | 2)使用`otp`生成基于时间的一次性密钥 185 | ``` 186 | mytest > otp -itemId 1 187 | --OtpItem-- 188 | +----+--------+-------------+----------+---------+---------------------------+ 189 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 190 | +----+--------+-------------+----------+---------+---------------------------+ 191 | | 1 | mytotp | example.com | 446280 | | 2024-02-19T10:46:47+08:00 | 192 | +----+--------+-------------+----------+---------+---------------------------+ 193 | ``` 194 | 195 | ##### backup 196 | 备份 197 | ``` 198 | test > backup 199 | 2021/09/10 22:23:09 [debug] commandLine:backup 200 | Backup will be executed where it quit. 201 | ``` 202 | ##### restore 203 | 显示所有备份文件列表 204 | ``` 205 | test > restore 206 | --RestoreItem-- 207 | +----+---------------------------+ 208 | | ID | TAG | 209 | +----+---------------------------+ 210 | | 1 | 2021-09-10T22:24:34+08:00 | 211 | | 2 | 2021-09-10T22:09:09+08:00 | 212 | | 3 | 2021-09-10T21:57:03+08:00 | 213 | | 4 | 2021-09-10T19:15:30+08:00 | 214 | | 5 | 2021-09-10T18:31:27+08:00 | 215 | | 6 | 2021-09-10T17:31:25+08:00 | 216 | +----+---------------------------+ 217 | ``` 218 | 从指定的备份文件进行恢复 219 | ``` 220 | test > restore -tagId 1 221 | --RestoreItem-- 222 | ? confirm restore? Yes 223 | 2021/09/10 22:26:46 [info] 1. RestoreItem-close DB 224 | 2021/09/10 22:26:46 [info] 2. RestoreItem-rename, oldName:/tmp/6879630a7d56210d2cd2491cb99d781194689fed71d7890a8dabbcb3a678cb73.2021-09-10T22:24:34+08:00, newName:/tmp/6879630a7d56210d2cd2491cb99d781194689fed71d7890a8dabbcb3a678cb73 225 | 2021/09/10 22:26:46 [info] 3. RestoreItem-upload, key:pwbox/6879630a7d56210d2cd2491cb99d781194689fed71d7890a8dabbcb3a678cb73 226 | 2021/09/10 22:26:46 [info] Restore success.Please login later... 227 | ``` 228 | 229 | ##### quit 230 | **注意** 记住所有修改(CRUD)只有在执行`quit`命令时,才会被持久化到磁盘上。 231 | 232 | ##### modifyDB 233 | 修改数据库密码(对于之前的备份文件无效) 234 | ``` 235 | test3 > modifyDB 236 | Modify DB password 237 | 1) The length must be greater than or equal to 8 238 | 2) It must contain at least one lowercase character[a-z] 239 | 3) It must contain at least one uppercase character[A-Z] 240 | 4) It must contain at least one number[0-9] 241 | 5) It must contain at least one special character[+-=_&$#^] 242 | ? Please type Database's new password: ************** 243 | ? Please type Database's new password again: ************** 244 | 245 | 2021/09/22 14:55:25 [info] len(itemList):1 246 | test3 > quit 247 | Save and Quit 248 | ``` 249 | 250 | ### 对象存储配置文件模板 251 | 252 | #### 1. 青云 QingCloud 253 | 254 | `qingstor.yaml` 255 | 256 | ``` 257 | access_key: xxxx 258 | secret_key: xxxxx 259 | bucket_name: xxxxx 260 | zone: sh1a 261 | dir_path: pwbox 262 | ``` 263 | 264 | #### 2. 阿里云 aliyun 265 | 266 | `oss.yaml` 267 | 268 | ``` 269 | access_key_id: xxxx 270 | access_key_secret: xxxxx 271 | bucket_name: xxxxx 272 | endpoint: sh1a 273 | dir_path: pwbox 274 | ``` 275 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/AlecAivazis/survey/v2" 6 | "github.com/fatih/color" 7 | "github.com/peterh/liner" 8 | "github.com/spf13/viper" 9 | "github.com/urfave/cli/v2" 10 | "github.com/vearne/passwordbox/args" 11 | "github.com/vearne/passwordbox/consts" 12 | "github.com/vearne/passwordbox/model" 13 | "github.com/vearne/passwordbox/resource" 14 | "github.com/vearne/passwordbox/sc" 15 | "github.com/vearne/passwordbox/store" 16 | "github.com/vearne/passwordbox/utils" 17 | slog "github.com/vearne/simplelog" 18 | "os" 19 | "path/filepath" 20 | "strings" 21 | ) 22 | 23 | func main() { 24 | app := cli.NewApp() 25 | app.Name = "passwordbox" 26 | app.Version = consts.Version 27 | MasterAuthor := &cli.Author{Name: "vearne", Email: "asdwoshiaotian@gmail.com"} 28 | app.Authors = []*cli.Author{MasterAuthor} 29 | app.Copyright = "(c)2020-? vearne" 30 | app.Flags = []cli.Flag{ 31 | &cli.StringFlag{ 32 | Name: "data", 33 | Aliases: []string{"c"}, 34 | Value: ".", 35 | Usage: "Load data from `DIR`", 36 | }, 37 | &cli.StringFlag{ 38 | Name: "loglevel", 39 | Aliases: []string{"l"}, 40 | Usage: "specify log level, optional: debug|info|warn|error", 41 | Value: "info", 42 | }, 43 | &cli.IntFlag{ 44 | Name: "maxBackupFileCount", 45 | Usage: "Maximum number of backup file retained", 46 | Value: 5, 47 | }, 48 | &cli.StringFlag{ 49 | Name: "oss", 50 | Usage: `--oss /etc/qingstor.yaml 51 | specify Object Storage Service address, 52 | Note: pwbox identify cloud services by configuration file name. 53 | optional: qingstor.yaml`, 54 | }, 55 | } 56 | app.Commands = []*cli.Command{ 57 | { 58 | Name: "clear", 59 | Usage: "clear", 60 | Action: func(c *cli.Context) error { 61 | fmt.Print("\x1b[H\x1b[2J") 62 | return nil 63 | }, 64 | }, 65 | { 66 | Name: "add", 67 | Usage: "add", 68 | Action: store.AddItem, 69 | }, 70 | { 71 | Name: "delete", 72 | Usage: "delete -itemId ", 73 | Action: store.DelItem, 74 | Flags: []cli.Flag{ 75 | &cli.IntFlag{ 76 | Name: "itemId", 77 | Required: true, 78 | }, 79 | }, 80 | }, 81 | { 82 | Name: "modify", 83 | Usage: "modify -itemId ", 84 | Action: store.ModifyItem, 85 | Flags: []cli.Flag{ 86 | &cli.IntFlag{ 87 | Name: "itemId", 88 | Required: true, 89 | }, 90 | }, 91 | }, 92 | { 93 | Name: "view", 94 | Usage: "view -itemId ", 95 | Action: store.ViewItem, 96 | Flags: []cli.Flag{ 97 | &cli.IntFlag{ 98 | Name: "itemId", 99 | Required: true, 100 | }, 101 | }, 102 | }, 103 | { 104 | Name: "otp", 105 | Usage: "otp -itemId ", 106 | Action: store.OtpItem, 107 | Flags: []cli.Flag{ 108 | &cli.IntFlag{ 109 | Name: "itemId", 110 | Required: true, 111 | }, 112 | }, 113 | }, 114 | { 115 | Name: "search", 116 | Usage: "search [-pageId ] [-keyword ]", 117 | UsageText: "pageId/keyword is optional.", 118 | Action: store.SearchItem, 119 | Flags: []cli.Flag{ 120 | &cli.IntFlag{ 121 | Name: "pageId", 122 | Value: 1, 123 | }, 124 | &cli.StringFlag{ 125 | Name: "keyword", 126 | Value: "", 127 | }, 128 | }, 129 | }, 130 | { 131 | Name: "backup", 132 | Action: store.Backup, 133 | }, 134 | { 135 | Name: "restore", 136 | Usage: "restore [-tagId ]", 137 | UsageText: "Restore from backup data with specific tag.", 138 | Action: store.RestoreItem, 139 | Flags: []cli.Flag{ 140 | &cli.IntFlag{ 141 | Name: "tagId", 142 | Value: -1, 143 | }, 144 | }, 145 | }, 146 | { 147 | Name: "quit", 148 | Action: store.Quit, 149 | }, 150 | { 151 | Name: "modifyDB", 152 | Action: store.ModifyDBPassword, 153 | }, 154 | { 155 | Name: "help", 156 | Action: func(cxt *cli.Context) error { 157 | return cli.ShowAppHelp(cxt) 158 | }, 159 | }, 160 | } 161 | app.Action = MainLogic 162 | err := app.Run(os.Args) 163 | if err != nil { 164 | slog.Fatal("app run error, %v", err) 165 | } 166 | } 167 | 168 | func MainLogic(c *cli.Context) error { 169 | logLevel := c.String("loglevel") 170 | slog.Level = slog.LogMap[logLevel] 171 | 172 | maxBackupFileCount := c.Int("maxBackupFileCount") 173 | resource.MaxBackupFileCount = maxBackupFileCount 174 | if resource.MaxBackupFileCount <= 0 { 175 | resource.MaxBackupFileCount = 5 176 | } 177 | 178 | // check data directory exist? 179 | dataPath := c.String("data") 180 | if !utils.Exists(dataPath) { 181 | return cli.Exit("Data directory is not exist.", -1) 182 | } 183 | 184 | if !utils.IsDir(dataPath) { 185 | return cli.Exit("Data directory is not directory.", -1) 186 | } 187 | 188 | // datapath 189 | resource.DataPath = dataPath 190 | 191 | ossConfigFile := c.String("oss") 192 | if len(ossConfigFile) > 0 { 193 | viper.SetConfigFile(ossConfigFile) 194 | if err := viper.ReadInConfig(); err == nil { 195 | slog.Info("Using config file: %v", viper.ConfigFileUsed()) 196 | } else { 197 | slog.Fatal("can't find config file, %v", err) 198 | } 199 | 200 | ossType := extractType(ossConfigFile) 201 | switch ossType { 202 | case "qingstor": 203 | oss := sc.QingStor{} 204 | err := viper.Unmarshal(&oss) 205 | if err != nil { 206 | slog.Fatal("can't parse oss config file, %v", err) 207 | } 208 | resource.GlobalOSS = &oss 209 | case "oss": 210 | oss := sc.AliOSS{} 211 | err := viper.Unmarshal(&oss) 212 | if err != nil { 213 | slog.Fatal("can't parse oss config file, %v", err) 214 | } 215 | resource.GlobalOSS = &oss 216 | default: 217 | slog.Fatal("Unsupport Cloud service providers, %v", ossType) 218 | } 219 | 220 | // init object storage service 221 | err := resource.GlobalOSS.Init() 222 | if err != nil { 223 | slog.Fatal("GlobalOSS init error:%v", err) 224 | } 225 | // sync from oss 226 | sc.CompareAndDownloadAll() 227 | } 228 | 229 | LOGIN: 230 | fmt.Println("---- login database ----") 231 | database := "" 232 | promptDatabse := &survey.Input{ 233 | Message: "Please type database's name:", 234 | } 235 | err := survey.AskOne(promptDatabse, &database, survey.WithValidator(survey.Required)) 236 | if err != nil { 237 | fmt.Printf("survey.AskOne error, %v\n", err) 238 | } 239 | 240 | database = strings.TrimSpace(database) 241 | slog.Debug("database:%v", database) 242 | filename := utils.Sha256N(database, consts.HashCount) 243 | fullpath := filepath.Join(dataPath, filename) 244 | fmt.Println("fullpath", fullpath) 245 | slog.Debug("fullpath:%v", fullpath) 246 | if !utils.Exists(fullpath) { 247 | createFlag := false 248 | prompt := &survey.Confirm{ 249 | Message: "Database is not exist.\nDo you like to create database now?", 250 | } 251 | err = survey.AskOne(prompt, &createFlag) 252 | if err != nil { 253 | fmt.Printf("survey.AskOne error, %v\n", err) 254 | createFlag = false 255 | } 256 | 257 | if !createFlag { 258 | return nil 259 | } 260 | 261 | // ---- create database ---- 262 | err = createDatabase(dataPath) 263 | if err != nil { 264 | fmt.Printf("createDatabase error, %v\n", err) 265 | return err 266 | } 267 | goto LOGIN 268 | } 269 | 270 | password := "" 271 | promptPasswd := &survey.Password{ 272 | Message: "Please type your password:", 273 | } 274 | err = survey.AskOne(promptPasswd, &password, survey.WithValidator(survey.Required)) 275 | if err != nil { 276 | fmt.Printf("survey.AskOne error, %v\n", err) 277 | } 278 | 279 | db, err := store.OpenDatabaseStore(dataPath, &model.Database{Name: database, Password: password}) 280 | if err != nil { 281 | slog.Fatal("openDatabase error, %v", err) 282 | os.Exit(1) 283 | } 284 | store.GlobalStore = db 285 | 286 | // Even if the database name or password is wrong, sqlite3 is still successfully opened, 287 | // and the error will not be reported until you actually query. 288 | db.Hint, err = store.GetHint(db.DB) 289 | if err != nil { 290 | slog.Debug("Get Hint error, %v", err) 291 | fmt.Printf("Decrypt error, Maybe DatabaseName or Password is invalid.\n") 292 | os.Exit(2) 293 | } 294 | 295 | info := color.New(color.FgRed, color.BgGreen).SprintFunc() 296 | fmt.Printf("Hint for database %v is %v", info(db.DatabaseName), info(db.Hint)) 297 | 298 | line := liner.NewLiner() 299 | defer line.Close() 300 | 301 | msg := ` 302 | Tip: Up and down arrow keys can switch historical commands. 303 | Tip: Ctrl + A jumps to the beginning of the command. 304 | Tip: Ctrl + E jumps to the end of the command. 305 | Tip: Type help for help. 306 | ` 307 | fmt.Println(msg) 308 | // For user experience 309 | err = store.SearchItem(c) 310 | if err != nil { 311 | fmt.Printf("SearchItem error, %v\n", err) 312 | } 313 | 314 | for { 315 | commandLine, err := line.Prompt(store.GlobalStore.DatabaseName + " > ") 316 | if err != nil { 317 | slog.Error("commandLine:%v, error:%v", commandLine, err) 318 | } 319 | slog.Debug("commandLine:%v", commandLine) 320 | line.AppendHistory(commandLine) 321 | 322 | cmdArgs := args.Parse(commandLine) 323 | if len(cmdArgs) <= 0 { 324 | continue 325 | } 326 | s := []string{os.Args[0]} 327 | s = append(s, cmdArgs...) 328 | 329 | cmd := cmdArgs[0] 330 | if !utils.FindInSlice(cmd, []string{ 331 | "clear", "add", "delete", "quit", 332 | "modify", "view", "otp", "search", "modifyDB", 333 | "backup", "restore", "help"}) { 334 | fmt.Println("unknow command", cmd) 335 | continue 336 | } 337 | 338 | err = c.App.Run(s) 339 | if err != nil { 340 | fmt.Println("App.Run error", s) 341 | } 342 | 343 | if resource.LoopExit { 344 | break 345 | } 346 | } 347 | return nil 348 | } 349 | 350 | func createDatabase(dataPath string) error { 351 | fmt.Println("---- create database ----") 352 | // the questions to ask 353 | var qs = []*survey.Question{ 354 | { 355 | Name: "name", 356 | Prompt: &survey.Input{Message: "Please type database's name:"}, 357 | Validate: survey.Required, 358 | }, 359 | { 360 | Name: "password", 361 | Prompt: &survey.Password{ 362 | Message: "Please type password:", 363 | }, 364 | Validate: survey.Required, 365 | }, 366 | { 367 | Name: "hint", 368 | Prompt: &survey.Input{Message: "Please type hint:"}, 369 | Validate: survey.Required, 370 | }, 371 | } 372 | answers := model.Database{} 373 | 374 | // perform the questions 375 | err := survey.Ask(qs, &answers) 376 | if err != nil { 377 | fmt.Println("error", err) 378 | return err 379 | } 380 | 381 | st := store.NewDatabaseStore(dataPath, &answers) 382 | err = st.Init() 383 | if err != nil { 384 | slog.Error("init store error,%v", err) 385 | return err 386 | } 387 | err = st.Close() 388 | if err != nil { 389 | slog.Error("close store error,%v", err) 390 | return err 391 | } 392 | 393 | return nil 394 | } 395 | 396 | // /abc/def/qingstor.yaml 397 | func extractType(localfilepath string) string { 398 | _, filename := filepath.Split(localfilepath) 399 | itemList := strings.Split(filename, ".") 400 | return itemList[0] 401 | } 402 | -------------------------------------------------------------------------------- /README_en.md: -------------------------------------------------------------------------------- 1 | # passwordbox 2 | 3 | [![golang-ci](https://github.com/vearne/passwordbox/actions/workflows/golang-ci.yml/badge.svg)](https://github.com/vearne/passwordbox/actions/workflows/golang-ci.yml) 4 | 5 | [中文 README](https://github.com/vearne/passwordbox/blob/master/README.md) 6 | 7 | Like 1Password, passwordbox is a tool for managing passwords. 8 | 9 | ## Warning 10 | This program has not undergone rigorous security testing, there may be security risks, please use it with caution. 11 | 12 | 13 | 14 | ## Quickstart 15 | 16 | ### build 17 | ``` 18 | make build 19 | ``` 20 | ### install 21 | ``` 22 | make install 23 | ``` 24 | You can also find the compiled file in [release](https://github.com/vearne/passwordbox/releases) 25 | 26 | ### start 27 | ``` 28 | pwbox --data=/Users/vearne 29 | ``` 30 | I advise you set alias for `passwordbox` 31 | ``` 32 | alias pwbox='pwbox --data=/Users/vearne' 33 | ``` 34 | After the program starts, create the database according to the manual requirements. In `passwordbox`, all items store in a database. 35 | 36 | * `--data` set the data path of passwordbox 37 | 38 | #### Synchronize to object storage 39 | 40 | If you want data files to be Shared across multiple devices, 41 | you can also configure object storage. 42 | 43 | ##### Currently supported 44 | 45 | * [QingCloud](https://www.qingcloud.com/products/qingstor/) `qingstor.yaml` 46 | * [aliyun](https://cn.aliyun.com/product/oss) `oss.yaml` 47 | 48 | ``` 49 | pwbox --data=/Users/vearne --oss=/directory/qingstor.yaml 50 | ``` 51 | ``` 52 | pwbox --data=/Users/vearne --oss=/directory/oss.yaml 53 | ``` 54 | * --oss Object store configuration file (optional) 55 | 56 | ##### Notice: 57 | 1)Pwbox identifies the cloud vendor to which the object store belongs by the name of the configuration file. 58 | So the name of the configuration file is fixed. 59 | 2) For security, make sure that the Bucket where the object is stored is private (read and write using the key only) 60 | 61 | 62 | ``` 63 | ─$ ./pwbox --data /tmp/ 64 | ---- login database ---- 65 | ? Please type database's name: test 66 | fullpath /tmp/6879630a7d56210d2cd2491cb99d781194689fed71d7890a8dabbcb3a678cb73 67 | ? Database is not exist. 68 | Do you like to create database now? Yes 69 | ---- create database ---- 70 | ? Please type database's name: test 71 | ? Please type password: ***** 72 | ? Please type hint[optional]: test 73 | ---- login database ---- 74 | ? Please type database's name: test 75 | fullpath /tmp/6879630a7d56210d2cd2491cb99d781194689fed71d7890a8dabbcb3a678cb73 76 | ? Please type your password: ***** 77 | Hint for database test is test 78 | ``` 79 | 80 | In interactive mode, you can use the following commands. 81 | 82 | #### help 83 | Get usage details of commands 84 | #### add 85 | Add a item 86 | 87 | ``` 88 | test > add 89 | --AddItem-- 90 | ? Please type Item's title: google 91 | ? Please type Item's account: myaccount 92 | ? Please type Item's password: ********** 93 | ? Please type Item's comment(optional): 94 | +----+--------+-----------+------------+---------+---------------------------+ 95 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 96 | +----+--------+-----------+------------+---------+---------------------------+ 97 | | 0 | google | myaccount | mypassword | | 2020-04-15T13:43:45+08:00 | 98 | +----+--------+-----------+------------+---------+---------------------------+ 99 | AddItem-save to file 100 | --SearchItem-- 101 | total: 2 102 | pageSize: 20 currentPage: 1 103 | +----+--------+---------+----------+---------+------------+ 104 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 105 | +----+--------+---------+----------+---------+------------+ 106 | | 1 | baidu | *** | *** | *** | *** | 107 | | 2 | google | *** | *** | *** | *** | 108 | +----+--------+---------+----------+---------+------------+ 109 | ``` 110 | #### delete 111 | ``` 112 | test1 > delete --itemId 2 113 | --DeleteItem-- 114 | +----+--------+---------------+---------------+---------+---------------------------+ 115 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 116 | +----+--------+---------------+---------------+---------+---------------------------+ 117 | | 2 | google | googleAccount | googleAccount | | 2020-04-15T13:55:25+08:00 | 118 | +----+--------+---------------+---------------+---------+---------------------------+ 119 | ? confirm delete? Yes 120 | delete item 2 success 121 | --SearchItem-- 122 | total: 1 123 | pageSize: 20 currentPage: 1 124 | +----+----------------+---------+----------+---------+------------+ 125 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 126 | +----+----------------+---------+----------+---------+------------+ 127 | | 1 | baidu account | *** | *** | *** | *** | 128 | +----+----------------+---------+----------+---------+------------+ 129 | ``` 130 | 131 | #### modify 132 | ``` 133 | test > modify --itemId 1 134 | --ModifyItem-- 135 | If you don't want to make changes, you can just press Enter! 136 | ? Please type Item's title:["baidu"] baidu account 137 | ? Please type Item's account:["baiduAccount"] 138 | ? Please type Item's password:["*************"] 139 | ? Please type Item's comment(optional):[""] 140 | +----+---------------+--------------+---------------+---------+---------------------------+ 141 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 142 | +----+---------------+--------------+---------------+---------+---------------------------+ 143 | | 1 | baidu account | baiduAccount | cbaiduAccount | | 2020-04-15T13:17:58+08:00 | 144 | +----+---------------+--------------+---------------+---------+---------------------------+ 145 | ``` 146 | 147 | #### search 148 | 149 | ``` 150 | test > search --pageId 1 --keyword "baidu" 151 | --SearchItem-- 152 | total: 1 153 | pageSize: 20 currentPage: 1 154 | +----+-------+---------+----------+---------+------------+ 155 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 156 | +----+-------+---------+----------+---------+------------+ 157 | | 1 | baidu | *** | *** | *** | *** | 158 | +----+-------+---------+----------+---------+------------+ 159 | ``` 160 | 161 | * `pageId` Records are displayed in pages, pageId is the number of page, start from 1. 162 | * `keyword` You can use `keyword` to filter 163 | In `passwordbox`, the filter effect is like the following SQL statement 164 | ``` 165 | select * from item where title like "%keyword%" 166 | ``` 167 | #### view 168 | view account and password as plaintext. 169 | ``` 170 | test1 > view --itemId 3 171 | --ViewItem-- 172 | +----+-------+---------+----------+---------+---------------------------+ 173 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 174 | +----+-------+---------+----------+---------+---------------------------+ 175 | | 3 | t3 | a3 | p3 | | 2020-04-16T10:04:47+08:00 | 176 | +----+-------+---------+----------+---------+---------------------------+ 177 | ``` 178 | 179 | #### totp 180 | 1)use `add` to add totp key 181 | ``` 182 | mytest > add 183 | --AddItem-- 184 | ? Please type Item's title: mytotp 185 | ? Please type Item's account: example.com 186 | ? Please type Item's password: ************************************************************************************************ 187 | ? Please type Item's comment(optional): 188 | +----+--------+-------------+--------------------------------------------------------------------------------------------------------------+---------+---------------------------+ 189 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 190 | +----+--------+-------------+--------------------------------------------------------------------------------------------------------------+---------+---------------------------+ 191 | | 0 | mytotp | example.com | otpauth://totp/ut:vearne?algorithm=SHA1&digits=6&issuer=ut&period=30&secret=Z5WVCNODB6HOPERMAEEKFWMK62IGRC3L | | 2024-02-19T10:46:47+08:00 | 192 | +----+--------+-------------+--------------------------------------------------------------------------------------------------------------+---------+---------------------------+ 193 | ``` 194 | 2)generate time-based one-time password using `otp` 195 | ``` 196 | mytest > otp -itemId 1 197 | --OtpItem-- 198 | +----+--------+-------------+----------+---------+---------------------------+ 199 | | ID | TITLE | ACCOUNT | PASSWORD | COMMENT | MODIFIEDAT | 200 | +----+--------+-------------+----------+---------+---------------------------+ 201 | | 1 | mytotp | example.com | 446280 | | 2024-02-19T10:46:47+08:00 | 202 | +----+--------+-------------+----------+---------+---------------------------+ 203 | ``` 204 | 205 | ##### backup 206 | Backup 207 | ``` 208 | test > backup 209 | 2021/09/10 22:23:09 [debug] commandLine:backup 210 | Backup will be executed where it quit. 211 | ``` 212 | ##### restore 213 | Display a list of all backup files 214 | ``` 215 | test > restore 216 | --RestoreItem-- 217 | +----+---------------------------+ 218 | | ID | TAG | 219 | +----+---------------------------+ 220 | | 1 | 2021-09-10T22:24:34+08:00 | 221 | | 2 | 2021-09-10T22:09:09+08:00 | 222 | | 3 | 2021-09-10T21:57:03+08:00 | 223 | | 4 | 2021-09-10T19:15:30+08:00 | 224 | | 5 | 2021-09-10T18:31:27+08:00 | 225 | | 6 | 2021-09-10T17:31:25+08:00 | 226 | +----+---------------------------+ 227 | ``` 228 | Restore from the specified backup file 229 | ``` 230 | test > restore -tagId 1 231 | --RestoreItem-- 232 | ? confirm restore? Yes 233 | 2021/09/10 22:26:46 [info] 1. RestoreItem-close DB 234 | 2021/09/10 22:26:46 [info] 2. RestoreItem-rename, oldName:/tmp/6879630a7d56210d2cd2491cb99d781194689fed71d7890a8dabbcb3a678cb73.2021-09-10T22:24:34+08:00, newName:/tmp/6879630a7d56210d2cd2491cb99d781194689fed71d7890a8dabbcb3a678cb73 235 | 2021/09/10 22:26:46 [info] 3. RestoreItem-upload, key:pwbox/6879630a7d56210d2cd2491cb99d781194689fed71d7890a8dabbcb3a678cb73 236 | 2021/09/10 22:26:46 [info] Restore success.Please login later... 237 | ``` 238 | ##### modifyDB 239 | Modify the database password 240 | (does not take effect for the previous backup file) 241 | ``` 242 | test3 > modifyDB 243 | Modify DB password 244 | 1) The length must be greater than or equal to 8 245 | 2) It must contain at least one lowercase character[a-z] 246 | 3) It must contain at least one uppercase character[A-Z] 247 | 4) It must contain at least one number[0-9] 248 | 5) It must contain at least one special character[+-=_&$#^] 249 | ? Please type Database's new password: ************** 250 | ? Please type Database's new password again: ************** 251 | 252 | 2021/09/22 14:55:25 [info] len(itemList):1 253 | test3 > quit 254 | Save and Quit 255 | ``` 256 | 257 | 258 | #### quit 259 | **Notice:** Remember, changes will only be saved when the quit command is executed. 260 | 261 | ## Detail 262 | `passwordbox` use sqlite database as underlying storage, then encrypt sqlite data files. 263 | 264 | 265 | ### oss config template 266 | 267 | #### 1. QingCloud 268 | `qingstor.yaml` 269 | 270 | ``` 271 | access_key: xxxx 272 | secret_key: xxxxx 273 | bucket_name: xxxxx 274 | zone: sh1a 275 | dir_path: pwbox 276 | ``` 277 | 278 | #### 2. aliyun 279 | 280 | `oss.yaml` 281 | 282 | ``` 283 | access_key_id: xxxx 284 | access_key_secret: xxxxx 285 | bucket_name: xxxxx 286 | endpoint: sh1a 287 | dir_path: pwbox 288 | ``` 289 | 290 | 291 | 292 | -------------------------------------------------------------------------------- /store/item.go: -------------------------------------------------------------------------------- 1 | package store 2 | 3 | import ( 4 | "bytes" 5 | "crypto/aes" 6 | "encoding/base64" 7 | "encoding/json" 8 | "errors" 9 | "fmt" 10 | "github.com/AlecAivazis/survey/v2" 11 | "github.com/fatih/color" 12 | "github.com/olekukonko/tablewriter" 13 | "github.com/pquerna/otp" 14 | "github.com/pquerna/otp/totp" 15 | "github.com/urfave/cli/v2" 16 | "github.com/vearne/passwordbox/consts" 17 | "github.com/vearne/passwordbox/model" 18 | "github.com/vearne/passwordbox/resource" 19 | "github.com/vearne/passwordbox/sc" 20 | "github.com/vearne/passwordbox/utils" 21 | slog "github.com/vearne/simplelog" 22 | "os" 23 | "path/filepath" 24 | "reflect" 25 | "sort" 26 | "strconv" 27 | "time" 28 | ) 29 | 30 | func AddItem(c *cli.Context) error { 31 | fmt.Println("--AddItem--") 32 | var qs = []*survey.Question{ 33 | { 34 | Name: "title", 35 | Prompt: &survey.Input{Message: "Please type Item's title:"}, 36 | Validate: survey.Required, 37 | }, 38 | { 39 | Name: "account", 40 | Prompt: &survey.Input{Message: "Please type Item's account:"}, 41 | Validate: survey.Required, 42 | }, 43 | { 44 | Name: "password", 45 | Prompt: &survey.Password{ 46 | Message: "Please type Item's password:", 47 | }, 48 | Validate: survey.Required, 49 | }, 50 | { 51 | Name: "comment", 52 | Prompt: &survey.Input{ 53 | Message: "Please type Item's comment(optional):", 54 | }, 55 | }, 56 | } 57 | answers := model.DetailItem{} 58 | 59 | // perform the questions 60 | err := survey.Ask(qs, &answers) 61 | if err != nil { 62 | fmt.Printf("survey.Ask error, %v\n", err) 63 | return err 64 | } 65 | answers.ModifiedAt = time.Now().Format(time.RFC3339) 66 | PrintItems([]*model.DetailItem{&answers}) 67 | 68 | err = InsertItem(GlobalStore.DB, ChangeToSimpleItem(&answers, GlobalStore.Key)) 69 | if err != nil { 70 | fmt.Printf("InsertItem error,%v\n", err) 71 | return err 72 | } 73 | 74 | GlobalStore.Dirty = true 75 | fmt.Println("AddItem-save to file") 76 | 77 | err = SearchItem(c) 78 | if err != nil { 79 | fmt.Printf("SearchItem error,%v\n", err) 80 | return err 81 | } 82 | 83 | return nil 84 | } 85 | 86 | func DelItem(c *cli.Context) error { 87 | fmt.Println("--DeleteItem--") 88 | itemId := c.Int("itemId") 89 | 90 | item, err := GetItem(GlobalStore.DB, itemId) 91 | if err != nil { 92 | fmt.Printf("can't find %v\n", itemId) 93 | return nil 94 | } 95 | detailItem := ParseSimpleItem(item, GlobalStore.Key) 96 | PrintItems([]*model.DetailItem{detailItem}) 97 | 98 | confirmDel := false 99 | prompt := &survey.Confirm{ 100 | Message: "confirm delete?", 101 | } 102 | err = survey.AskOne(prompt, &confirmDel) 103 | if err != nil { 104 | fmt.Printf("survey.AskOne error, %v\n", err) 105 | return err 106 | } 107 | if confirmDel { 108 | GlobalStore.Dirty = true 109 | err = DeleteItem(GlobalStore.DB, itemId) 110 | if err != nil { 111 | fmt.Printf("delete item %v error, %v\n", itemId, err) 112 | } else { 113 | fmt.Printf("delete item %v success\n", itemId) 114 | } 115 | } 116 | 117 | // For user experience 118 | err = SearchItem(c) 119 | if err != nil { 120 | fmt.Printf("SearchItem error, %v\n", err) 121 | return err 122 | } 123 | return nil 124 | } 125 | 126 | func paddingStar(n int) string { 127 | buff := bytes.NewBuffer(make([]byte, 0)) 128 | for i := 0; i < n; i++ { 129 | buff.Write([]byte("*")) 130 | } 131 | return buff.String() 132 | } 133 | 134 | func ModifyItem(c *cli.Context) error { 135 | fmt.Println("--ModifyItem--") 136 | itemId := c.Int("itemId") 137 | item, err := GetItem(GlobalStore.DB, itemId) 138 | if err != nil { 139 | fmt.Printf("can't find %v\n", itemId) 140 | return nil 141 | } 142 | detailItem := ParseSimpleItem(item, GlobalStore.Key) 143 | // These are using the default foreground colors 144 | color.Red("If you don't want to make changes, you can just press Enter!") 145 | password := paddingStar(len(detailItem.Password)) 146 | var qs = []*survey.Question{ 147 | { 148 | Name: "title", 149 | Prompt: &survey.Input{Message: fmt.Sprintf("Please type Item's title:[%q]", detailItem.Title)}, 150 | }, 151 | { 152 | Name: "account", 153 | Prompt: &survey.Input{Message: fmt.Sprintf("Please type Item's account:[%q]", detailItem.Account)}, 154 | }, 155 | { 156 | Name: "password", 157 | Prompt: &survey.Password{ 158 | Message: fmt.Sprintf("Please type Item's password:[%q]", password), 159 | }, 160 | }, 161 | { 162 | Name: "comment", 163 | Prompt: &survey.Input{ 164 | Message: fmt.Sprintf("Please type Item's comment(optional):[%q]", detailItem.Comment), 165 | }, 166 | }, 167 | } 168 | answers := model.DetailItem{} 169 | 170 | // perform the questions 171 | err = survey.Ask(qs, &answers) 172 | if err != nil { 173 | slog.Error("survey error, %v", err) 174 | return err 175 | } 176 | dirty := false 177 | if len(answers.Title) > 0 { 178 | detailItem.Title = answers.Title 179 | dirty = true 180 | } 181 | if len(answers.Account) > 0 { 182 | detailItem.Account = answers.Account 183 | dirty = true 184 | } 185 | if len(answers.Password) > 0 { 186 | detailItem.Password = answers.Password 187 | dirty = true 188 | } 189 | if len(answers.Comment) > 0 { 190 | detailItem.Comment = answers.Comment 191 | dirty = true 192 | } 193 | 194 | if dirty { 195 | GlobalStore.Dirty = true 196 | detailItem.ModifiedAt = time.Now().Format(time.RFC3339) 197 | PrintItems([]*model.DetailItem{detailItem}) 198 | err = UpdateItem(GlobalStore.DB, ChangeToSimpleItem(detailItem, GlobalStore.Key)) 199 | if err != nil { 200 | fmt.Printf("UpdateItem error %v\n", err) 201 | return err 202 | } 203 | } else { 204 | color.Yellow("The item remains the same as before.") 205 | PrintItems([]*model.DetailItem{detailItem}) 206 | } 207 | return nil 208 | } 209 | 210 | func ViewItem(c *cli.Context) error { 211 | fmt.Println("--ViewItem--") 212 | itemId := c.Int("itemId") 213 | item, err := GetItem(GlobalStore.DB, itemId) 214 | if err != nil { 215 | fmt.Printf("can't find %v\n", itemId) 216 | return nil 217 | } 218 | detailItem := ParseSimpleItem(item, GlobalStore.Key) 219 | PrintItems([]*model.DetailItem{detailItem}) 220 | return nil 221 | } 222 | 223 | func OtpItem(c *cli.Context) error { 224 | fmt.Println("--OtpItem--") 225 | itemId := c.Int("itemId") 226 | item, err := GetItem(GlobalStore.DB, itemId) 227 | if err != nil { 228 | fmt.Printf("can't find %v\n", itemId) 229 | return nil 230 | } 231 | detailItem := ParseSimpleItem(item, GlobalStore.Key) 232 | key, err := otp.NewKeyFromURL(detailItem.Password) 233 | if err != nil { 234 | fmt.Printf("failed to parse url %v\n", detailItem.Password) 235 | return nil 236 | } 237 | switch key.Type() { 238 | case "totp": 239 | passcode, err := totp.GenerateCodeCustom(key.Secret(), time.Now(), totp.ValidateOpts{ 240 | Period: uint(key.Period()), 241 | Digits: key.Digits(), 242 | Algorithm: key.Algorithm(), 243 | }) 244 | if err != nil { 245 | slog.Error("generate code error, %v", err) 246 | return err 247 | } 248 | detailItem.Password = passcode 249 | PrintItems([]*model.DetailItem{detailItem}) 250 | default: 251 | fmt.Printf("unsupported otp type %v\n", key.Type()) 252 | } 253 | return nil 254 | } 255 | 256 | func SearchItem(c *cli.Context) error { 257 | fmt.Println("--SearchItem--") 258 | pageId := c.Int("pageId") 259 | keyword := c.String("keyword") 260 | slog.Debug("SearchItem, pageId:%v, keyword:%s", pageId, keyword) 261 | if pageId <= 0 { 262 | pageId = 1 263 | } 264 | result, err := Query(GlobalStore.DB, keyword, pageId, consts.PageSize) 265 | if err != nil { 266 | slog.Error("query db error, %v", err) 267 | return err 268 | } 269 | 270 | total, err := CountItems(GlobalStore.DB, keyword) 271 | if err != nil { 272 | slog.Error("query db error, %v", err) 273 | return err 274 | } 275 | fmt.Println("total:", total) 276 | fmt.Println("pageSize:", consts.PageSize, "currentPage:", pageId) 277 | PrintItems(ConvToItems(result)) 278 | return nil 279 | } 280 | 281 | func Quit(c *cli.Context) error { 282 | fmt.Println("Save and Quit") 283 | 284 | if GlobalStore.Dirty { 285 | GlobalStore.Close() 286 | sc.CompareAndUpload(GlobalStore.FileName, GlobalStore.FullPath) 287 | } 288 | 289 | if GlobalStore.NeedBackup { 290 | timeStr := time.Now().Format(time.RFC3339) 291 | key := filepath.Join(resource.GlobalOSS.GetDirPath(), GlobalStore.FileName+"."+timeStr) 292 | resource.GlobalOSS.UploadFile(key, GlobalStore.FullPath) 293 | 294 | // 保证本地和remote一致 295 | resource.GlobalOSS.DownloadFile(key, GlobalStore.FullPath+"."+timeStr) 296 | 297 | files, err := getAllBackupFiles(resource.DataPath, GlobalStore.FileName) 298 | if err != nil { 299 | slog.Error("RestoreItem-GetAllBackupFiles, %v", err) 300 | } 301 | 302 | sort.Sort(sort.Reverse(sort.StringSlice(files))) 303 | if len(files) > resource.MaxBackupFileCount { 304 | for i := resource.MaxBackupFileCount; i < len(files); i++ { 305 | // 1. remove oss file 306 | key := filepath.Join(resource.GlobalOSS.GetDirPath(), filepath.Base(files[i])) 307 | err = resource.GlobalOSS.Delete(key) 308 | if err != nil { 309 | slog.Error("remove remote backup file:%v", err) 310 | } 311 | slog.Debug("remove remote file:%v", key) 312 | // 2. remove local file 313 | slog.Debug("remove local file:%v", files[i]) 314 | err = os.Remove(files[i]) 315 | if err != nil { 316 | slog.Error("remove local backup file:%v", err) 317 | } 318 | } 319 | } 320 | } 321 | 322 | resource.LoopExit = true 323 | return nil 324 | } 325 | 326 | func ModifyDBPassword(c *cli.Context) error { 327 | fmt.Println("Modify DB password") 328 | 329 | answers := struct { 330 | Password string `survey:"password"` 331 | Password2 string `survey:"password2"` 332 | }{} 333 | 334 | flag := false 335 | for !flag { 336 | // perform the questions 337 | howtouse := `1) The length must be greater than or equal to 8 338 | 2) It must contain at least one lowercase character[a-z] 339 | 3) It must contain at least one uppercase character[A-Z] 340 | 4) It must contain at least one number[0-9] 341 | 5) It must contain at least one special character[+-=_&$#^]` 342 | color.Red(howtouse) 343 | // 1. password 344 | prompt := &survey.Password{ 345 | Message: "Please type Database's new password:", 346 | } 347 | err := survey.AskOne(prompt, &answers.Password, survey.WithValidator(PasswordComplexityRequired)) 348 | if err != nil { 349 | fmt.Printf("survey.AskOne error, %v\n", err) 350 | return err 351 | } 352 | // 2. password2 353 | prompt = &survey.Password{ 354 | Message: "Please type Database's new password again:", 355 | } 356 | err = survey.AskOne(prompt, &answers.Password2, survey.WithValidator(survey.Required)) 357 | if err != nil { 358 | fmt.Printf("survey.AskOne error, %v\n", err) 359 | return err 360 | } 361 | if answers.Password == answers.Password2 { 362 | flag = true 363 | fmt.Printf("\n") 364 | } else { 365 | fmt.Printf("The password entered 2 times is not the same!") 366 | } 367 | } 368 | 369 | oldKey := GlobalStore.Key 370 | GlobalStore.Key = utils.GenHMacKey([]byte(answers.Password), []byte(GlobalStore.DataBaseIV)) 371 | // 将所有的item重新保存 372 | itemList, err := Query(GlobalStore.DB, "", 1, 10000) 373 | if err != nil { 374 | fmt.Printf("query err, %v\n", err) 375 | 376 | return err 377 | } 378 | 379 | GlobalStore.Dirty = true 380 | fmt.Println("Use the command[quit] to make the changes take effect.") 381 | 382 | for _, item := range itemList { 383 | detailItem := ParseSimpleItem(item, oldKey) 384 | 385 | slog.Debug("id:%v, title:%v", item.ID, item.Title) 386 | detailItem.ModifiedAt = time.Now().Format(time.RFC3339) 387 | err = UpdateItem(GlobalStore.DB, ChangeToSimpleItem(detailItem, GlobalStore.Key)) 388 | if err != nil { 389 | fmt.Printf("UpdateItem error %v\n", err) 390 | return err 391 | } 392 | } 393 | return nil 394 | } 395 | 396 | func PasswordComplexityRequired(val interface{}) error { 397 | // the reflect value of the result 398 | value := reflect.ValueOf(val) 399 | 400 | if value.Kind() != reflect.String { 401 | return errors.New("string is required") 402 | } 403 | pwd := value.String() 404 | if !utils.IsSecurePassword(pwd) { 405 | return errors.New("password is too simple") 406 | } 407 | return nil 408 | } 409 | 410 | func Backup(c *cli.Context) error { 411 | GlobalStore.NeedBackup = true 412 | fmt.Println("Backup will be executed where it quit.") 413 | return nil 414 | } 415 | 416 | func ChangeToSimpleItem(answers *model.DetailItem, key []byte) *model.SimpleItem { 417 | bt, _ := json.Marshal(answers) 418 | 419 | itemIV := utils.GenRandIV() 420 | buffer := bytes.NewBuffer(make([]byte, 0)) 421 | buffer.Write(itemIV) 422 | buffer.Write([]byte(utils.EncryptAesInCFB(bt, key, itemIV))) 423 | ic := base64.StdEncoding.EncodeToString(buffer.Bytes()) 424 | item := model.SimpleItem{ID: answers.ID, Title: answers.Title, IVCiphertext: ic} 425 | return &item 426 | } 427 | 428 | func ParseSimpleItem(item *model.SimpleItem, key []byte) *model.DetailItem { 429 | result := model.DetailItem{} 430 | bt, _ := base64.StdEncoding.DecodeString(item.IVCiphertext) 431 | iv := bt[0:aes.BlockSize] 432 | plaintext := utils.DecryptAesInCFB(bt[aes.BlockSize:], key, iv) 433 | slog.Debug("ParseSimpleItem:%v", string(plaintext)) 434 | err := json.Unmarshal(plaintext, &result) 435 | if err != nil { 436 | slog.Error("json.Unmarshal DetailItem error,%v\n", err) 437 | } 438 | result.ID = item.ID 439 | result.Title = item.Title 440 | return &result 441 | } 442 | 443 | func PrintItems(items []*model.DetailItem) { 444 | table := tablewriter.NewWriter(os.Stdout) 445 | table.SetHeader([]string{"ID", "Title", "Account", 446 | "password", "Comment", "ModifiedAt"}) 447 | 448 | for _, item := range items { 449 | table.Append([]string{strconv.Itoa(item.ID), item.Title, item.Account, 450 | item.Password, item.Comment, item.ModifiedAt, 451 | }) 452 | } 453 | table.Render() // Send output 454 | } 455 | 456 | func PrintBackups(items []model.BackupItem) { 457 | table := tablewriter.NewWriter(os.Stdout) 458 | table.SetHeader([]string{"ID", "Tag"}) 459 | 460 | for _, item := range items { 461 | table.Append([]string{strconv.Itoa(item.ID), item.Tag}) 462 | } 463 | table.Render() // Send output 464 | } 465 | 466 | func ConvToItems(items []*model.SimpleItem) []*model.DetailItem { 467 | result := make([]*model.DetailItem, 0) 468 | var di *model.DetailItem 469 | for _, item := range items { 470 | di = &model.DetailItem{} 471 | di.ID = item.ID 472 | di.Title = item.Title 473 | di.Account = "***" 474 | di.Password = "***" 475 | di.Comment = "***" 476 | di.ModifiedAt = "***" 477 | result = append(result, di) 478 | } 479 | return result 480 | } 481 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 3 | cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= 4 | cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= 5 | cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= 6 | cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= 7 | cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= 8 | cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= 9 | cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= 10 | cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= 11 | cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= 12 | cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= 13 | dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= 14 | github.com/AlecAivazis/survey/v2 v2.0.7 h1:+f825XHLse/hWd2tE/V5df04WFGimk34Eyg/z35w/rc= 15 | github.com/AlecAivazis/survey/v2 v2.0.7/go.mod h1:mlizQTaPjnR4jcpwRSaSlkbsRfYFEyKgLQvYTzxxiHA= 16 | github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= 17 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 18 | github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= 19 | github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= 20 | github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= 21 | github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= 22 | github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= 23 | github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= 24 | github.com/aliyun/aliyun-oss-go-sdk v2.1.1+incompatible h1:rCOqkJYYTYM6vQH0dWkWTXAw4uKFp8+GPXcYl4Oayr8= 25 | github.com/aliyun/aliyun-oss-go-sdk v2.1.1+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= 26 | github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= 27 | github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= 28 | github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= 29 | github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f h1:ZNv7On9kyUzm7fvRZumSyy/IUiSC7AzL0I1jKKtwooA= 30 | github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= 31 | github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= 32 | github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= 33 | github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= 34 | github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= 35 | github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= 36 | github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyXcs= 37 | github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= 38 | github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= 39 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 40 | github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= 41 | github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= 42 | github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= 43 | github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= 44 | github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= 45 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= 46 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= 47 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 48 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 49 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 50 | github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= 51 | github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= 52 | github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= 53 | github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= 54 | github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= 55 | github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= 56 | github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= 57 | github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= 58 | github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= 59 | github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= 60 | github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= 61 | github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= 62 | github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= 63 | github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= 64 | github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= 65 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 66 | github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 67 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 68 | github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 69 | github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= 70 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 71 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 72 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 73 | github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 74 | github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 75 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 76 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 77 | github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= 78 | github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= 79 | github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= 80 | github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= 81 | github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= 82 | github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= 83 | github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= 84 | github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= 85 | github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 86 | github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= 87 | github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= 88 | github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= 89 | github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= 90 | github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= 91 | github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= 92 | github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= 93 | github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= 94 | github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= 95 | github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= 96 | github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= 97 | github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= 98 | github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= 99 | github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 100 | github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 101 | github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= 102 | github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= 103 | github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= 104 | github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= 105 | github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= 106 | github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= 107 | github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= 108 | github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= 109 | github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= 110 | github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDGgJGQpNflI3+MJSBhsgT5PCtzBQ= 111 | github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= 112 | github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= 113 | github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= 114 | github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= 115 | github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= 116 | github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= 117 | github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= 118 | github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= 119 | github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= 120 | github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= 121 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 122 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 123 | github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= 124 | github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= 125 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 126 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 127 | github.com/kr/pty v1.1.4 h1:5Myjjh3JY/NaAi4IsUbHADytDyl1VE1Y9PXDlL+P/VQ= 128 | github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 129 | github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= 130 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 131 | github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= 132 | github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= 133 | github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= 134 | github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= 135 | github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= 136 | github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= 137 | github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= 138 | github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= 139 | github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM= 140 | github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= 141 | github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= 142 | github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54= 143 | github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= 144 | github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U= 145 | github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= 146 | github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= 147 | github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= 148 | github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= 149 | github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= 150 | github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= 151 | github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= 152 | github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= 153 | github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= 154 | github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= 155 | github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= 156 | github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= 157 | github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= 158 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 159 | github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= 160 | github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= 161 | github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= 162 | github.com/olekukonko/tablewriter v0.0.4 h1:vHD/YYe1Wolo78koG299f7V/VAS08c6IpCLn+Ejf/w8= 163 | github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= 164 | github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= 165 | github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= 166 | github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= 167 | github.com/pengsrc/go-shared v0.2.0 h1:Ho86LhaXOYgv9FjBmIp5CO0LmaIj49H2HZhYh0+7uW8= 168 | github.com/pengsrc/go-shared v0.2.0/go.mod h1:jVblp62SafmidSkvWrXyxAme3gaTfEtWwRPGz5cpvHg= 169 | github.com/peterh/liner v1.2.0 h1:w/UPXyl5GfahFxcTOz2j9wCIHNI+pUPr2laqpojKNCg= 170 | github.com/peterh/liner v1.2.0/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= 171 | github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 172 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 173 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 174 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 175 | github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= 176 | github.com/pquerna/otp v1.4.0 h1:wZvl1TIVxKRThZIBiwOOHOGP/1+nZyWBil9Y2XNEDzg= 177 | github.com/pquerna/otp v1.4.0/go.mod h1:dkJfzwRKNiegxyNb54X/3fLwhCynbMspSyWKnvi1AEg= 178 | github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= 179 | github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= 180 | github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= 181 | github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 182 | github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= 183 | github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= 184 | github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= 185 | github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= 186 | github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= 187 | github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= 188 | github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= 189 | github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= 190 | github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 191 | github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= 192 | github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= 193 | github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= 194 | github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= 195 | github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= 196 | github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= 197 | github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= 198 | github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= 199 | github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= 200 | github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= 201 | github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= 202 | github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= 203 | github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= 204 | github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= 205 | github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= 206 | github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= 207 | github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= 208 | github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= 209 | github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= 210 | github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= 211 | github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= 212 | github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= 213 | github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= 214 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 215 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 216 | github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 217 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 218 | github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= 219 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 220 | github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= 221 | github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= 222 | github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= 223 | github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4= 224 | github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= 225 | github.com/vearne/simplelog v0.0.0-20200527094239-692fca69e8b1 h1:1Ki9RZjBEQ9R4Isd+EJs7FyPCscXJEoNaGeVWw1yoXU= 226 | github.com/vearne/simplelog v0.0.0-20200527094239-692fca69e8b1/go.mod h1:8tISO0hBcfMqG08HgFPdQ6EHevilXq5Fpd3CYfRiohk= 227 | github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= 228 | github.com/yunify/qingstor-sdk-go v2.2.15+incompatible h1:/Z0q3/eSMoPYAuRmhjWtuGSmVVciFC6hfm3yfCKuvz0= 229 | github.com/yunify/qingstor-sdk-go v2.2.15+incompatible/go.mod h1:w6wqLDQ5bBTzxGJ55581UrSwLrsTAsdo9N6yX/8d9RY= 230 | go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= 231 | go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= 232 | go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= 233 | go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= 234 | go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= 235 | go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= 236 | golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 237 | golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 238 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 239 | golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 240 | golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 241 | golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 242 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 243 | golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 244 | golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= 245 | golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= 246 | golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= 247 | golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= 248 | golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= 249 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 250 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 251 | golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 252 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 253 | golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 254 | golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 255 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 256 | golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= 257 | golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= 258 | golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= 259 | golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= 260 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 261 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 262 | golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 263 | golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 264 | golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 265 | golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 266 | golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 267 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 268 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 269 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 270 | golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 271 | golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 272 | golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= 273 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 274 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 275 | golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 276 | golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 277 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 278 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 279 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 280 | golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 281 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 282 | golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 283 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 284 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 285 | golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 286 | golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 287 | golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 288 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 289 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 290 | golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 291 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 292 | golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 293 | golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 294 | golang.org/x/sys v0.0.0-20190530182044-ad28b68e88f1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 295 | golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 296 | golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 297 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= 298 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 299 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 300 | golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 301 | golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= 302 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 303 | golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 304 | golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= 305 | golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 306 | golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 307 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 308 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 309 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 310 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 311 | golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 312 | golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 313 | golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 314 | golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 315 | golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 316 | golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 317 | golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 318 | golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 319 | golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 320 | golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 321 | golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 322 | golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 323 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 324 | google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= 325 | google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= 326 | google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= 327 | google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= 328 | google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= 329 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 330 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 331 | google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 332 | google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= 333 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 334 | google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 335 | google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 336 | google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 337 | google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 338 | google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 339 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 340 | google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= 341 | google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 342 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 343 | google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= 344 | google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= 345 | gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 346 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 347 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= 348 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 349 | gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 350 | gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= 351 | gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= 352 | gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= 353 | gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= 354 | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 355 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 356 | gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= 357 | gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 358 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 359 | honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 360 | honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 361 | honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= 362 | rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= 363 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------