Git Product home page Git Product logo

super-dollop's Introduction


Super Dollop

Super Dollop can encrypt your files and notes by your own GPG key and save them in S3 or minIO to keep them safe and portability, also you can use Super Dollop for encrypt your file quickly to print it. So with Super Dollop you'll solve your keep your notes with security problem easily with Gopher. By the way if you want to encrypt your file you can print it directly to your terminal with -p easily.

list-command print
dollop list

Requirements

  • Go `>= 1.16
  • MinIO
  • Core dependencies: gnugpg, gpgme>=1.7.0, libgpg-error

Installation

Install gnupg

sudo apt-get install gnupg

Set your environments to your terminal

.zshrc

# Environment variables for MinIO
export MINIO_ENDPOINT=127.0.0.1:9000
export MINIO_ACCESS_KEY=admin
export MINIO_SECRET_KEY=secretadmin
export MINIO_GPG_ID=GPG-ID
export MINIO_BUCKET_NAME=dollop-files

Get your MinIO container.

docker-compose.yml

version: "3"
services:
  s3:
    image: "minio/minio"
    hostname: "storage"
    restart: "no"
    volumes:
      - data:/data
    ports:
      - "9000:9000"
      - "9001:9001"
    entrypoint: ["minio", "server", "/data","--console-address",":9001"]
    networks:
      - local
volumes:
  data:

networks:
  local:
// Pull minio/mc
docker pull minio/mc

// Run pulled image with docker-compose.yml file
docker-compose up

Give first gas to Super Dollop

// clone the super-dollop repository
git clone https://github.com/jack5341/super-dollop && cd super-dollop

// try to run list command
go run . list

Usage

dollop [FLAGS] [OPTIONS]
COMMANDS:
    completion  generate the autocompletion script for the specified shell
    dec         List your all encrypted files and notes.
    enc         A brief description of your command
    help        Help about any command
    list        List your all encrypted files and notes.

Cli Schema

Commands Flags
dec -n --name
enc -f --file -n --note -p --print
list -d --delete

Feedback

If you have any feedback, please reach out to us at [email protected]

License

Apache-2.0

super-dollop's People

Contributors

ismailaki avatar jack5341 avatar theykk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

super-dollop's Issues

Can't encrypt and print anything without minIO

When I want to direct encrypt and print it see this error.

~/Desktop/Personal Projects/super-dollop master ❯ go run . enc --note=hello-world -p                                                                           21:58:58
panic: failed to connect to minio client

goroutine 1 [running]:
github.com/jack5341/super-dollop/pkg.Connect(0x1400007c058)
        /Users/nedim/Desktop/Personal Projects/super-dollop/pkg/minio.go:18 +0x208
github.com/jack5341/super-dollop/cmd.Execute()
        /Users/nedim/Desktop/Personal Projects/super-dollop/cmd/root.go:21 +0x20
main.main()
        /Users/nedim/Desktop/Personal Projects/super-dollop/main.go:13 +0x20
exit status 2```

Feedback on various issues

You should guard against file names that look like options:

cmd := exec.Command("gpg", "--decrypt", filePath)

If filePath happened to be --sign then it would be accepted as an option and you'd get the wrong results, possibly silently. Put a -- before the file name to stop option processing:

cmd := exec.Command("gpg", "--decrypt", "--", filePath)

There's a bytes.NewReader so you don't need to make an unneeded, extra copy of the user's data in memory:

var out []byte
// ...
r := strings.NewReader(string(out))

However, even better would be to stream the output of GnuPG straight into the bucket. The minio interface already takes a reader, so you could just hook up its StdoutPipe(). Set the length to -1.

Same goes for decryption: Connect minio to the GnuPG process like a pipe. This avoids the need for (badly and dangerously) creating temporary files.

Strongly consider explicitly using GnuPG's "unattended" interface via --batch and maybe --status-fd and --with-colons. That's how GnuPG is intended to be run non-interactively by other programs.

Silence is golden. Do you really need to print output when everything was successful? Consider how go build itself prints nothing on success.

panic is not an appropriate way to deal with everyday errors. Outside of OOM, regular users should never see panic messages. If PutObject fails (e.g. network error), print a useful error message. (IMHO, also it would also be better style to pass this error up to the top level, or nearly so, and let it do the printing, rather than mingling UI with your business logic. Same goes for validating command line options.)

Always exit the process with an error status when an error terminates processing. Also, check the error results! Currently there a number of ways the program may silently lose data.

Never print errors on standard output, especially if the user is expecting their data on standard output. Combined with the lack of error exit status, this is a recipe for disaster. If something fails, the user will never see the error, nor have any way to know it failed. Instead they'll quietly have the wrong data. This is a programming cardinal sin.

Get more comfortable with byte slices, []byte. There are lots of needless, and even incorrect, string conversions. For instance:

fmt.Println(string(data))

Just do this instead:

os.Stdout.Write(data)

Not only is it more efficient, it doesn't append a spurious newline to the user's data. Also check the error!

`dec` command need to refactor

I am working on branch version/3.0

command dec should include 3 flag store ,filename and download. --store command is specify to target encrypted file is in minIO or on local machine. MinIO should be connected just while user using related flag. I use 2 encryption method at here GPG and AES256 you can take input for recognise is it GPG or AES256.

To do List

  • --store flag initialised variable should be false [boolean]
  • --filename is for specify where is the target file. [string] (required)
  • while user want to download his decrypted file, should be possible to download file to current path with --download flag if user didn't use this flag just print it to terminal. [string]

Windows build doesn't work

Hi there. As stated, here's what happens when you start the binary under Windows 10 x64:

panic: Endpoint:  does not follow ip address or domain name standards.

goroutine 1 [running]:
github.com/jack5341/super-dollop/pkg.Connect()
        /home/runner/work/super-dollop/super-dollop/pkg/minio.go:18 +0xa7
github.com/jack5341/super-dollop/cmd.Execute()
        /home/runner/work/super-dollop/super-dollop/cmd/root.go:21 +0x19
main.main()
        /home/runner/work/super-dollop/super-dollop/main.go:8 +0x17

This flag is already taken

When I try to add a new flag to cli your project give me:

panic: unable to redefine 'n' shorthand in "super-dollop" flagset: it's already used for "name" flag     │ 
                                                                                                         │ jack5341@jack5341  ~  
goroutine 1 [running]:                                                                                   │ jack5341@jack5341  ~  clear
github.com/spf13/pflag.(*FlagSet).AddFlag(0xc0000ba100, 0xc0001cd680)                                    │                                                                                                         
        /home/jack5341/Nedim-Akar/Workspace/super-dollop/vendor/github.com/spf13/pflag/flag.go:874 +0x6f0│ jack5341@jack5341  ~  ws                
github.com/spf13/pflag.(*FlagSet).VarPF(0xc0000ba100, 0x8f4ce0, 0xc000073dd0, 0x85cffa, 0x4, 0x85c6bf, 0x│ jack5341@jack5341  ~/Nedim-Akar/Workspace  clear
1, 0x864431, 0x16, 0xc000073dd0)                                                                         │                                                                                                         
        /home/jack5341/Nedim-Akar/Workspace/super-dollop/vendor/github.com/spf13/pflag/flag.go:831 +0x10b│ jack5341@jack5341  ~/Nedim-Akar/Workspace  ls   
github.com/spf13/pflag.(*FlagSet).VarP(...)                                                              │playground  super-dollop
        /home/jack5341/Nedim-Akar/Workspace/super-dollop/vendor/github.com/spf13/pflag/flag.go:837       │ jack5341@jack5341  ~/Nedim-Akar/Workspace  cd playground 
github.com/spf13/pflag.(*FlagSet).StringVarP(0xc0000ba100, 0xc000073dd0, 0x85cffa, 0x4, 0x85c6bf, 0x1, 0x│ jack5341@jack5341  ~/Nedim-Akar/Workspace/playground  clear        
0, 0x0, 0x864431, 0x16)                                                                                  │                                                                                                         
        /home/jack5341/Nedim-Akar/Workspace/super-dollop/vendor/github.com/spf13/pflag/string.go:42 +0xad│ jack5341@jack5341  ~/Nedim-Akar/Workspace/playground  docker-compose up      
github.com/spf13/pflag.(*FlagSet).StringP(...)                                                           │Starting playground_s3_1 ... done
        /home/jack5341/Nedim-Akar/Workspace/super-dollop/vendor/github.com/spf13/pflag/string.go:67      │Attaching to playground_s3_1
github.com/super-dollop/cmd.init.1()                                                                     │s3_1  | 
        /home/jack5341/Nedim-Akar/Workspace/super-dollop/cmd/encrypt.go:45 +0x134                        │s3_1  |  You are running an older version of MinIO released 2 days ago 
exit status 2                                                                                            │s3_1  |  Update: Run `mc admin update` 

System Information;

  • Ubuntu 20.04.3 LTS x86_64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.