Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
fdkevin0 committed Dec 9, 2021
2 parents da4b24d + 083bb55 commit 9161f27
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 11 deletions.
15 changes: 15 additions & 0 deletions .hdu-cli.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
net:
auth:
# i-HDU wifi login
#
# Manually method
# username always is your student id like 20051101
# password is what u know
# and put the file at your home directory
#
# Auto method
# hdu-cli net login --username 20051101 --password your-password
# After Testing on my Kali linux The ( -s / -d ) option seems not work correctly.
# There need further debugging.
username: 20051101
password: your-password
44 changes: 33 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,46 @@
go install github.com/hduhelp/hdu-cli@latest
```

<details>
<summary>Trouble shoot</summary>

> The Command may need root privilege
>
> and sometimes go env is not install completely on your root account (sudo mode)
>
> so try like `sudo $GOROOT/bin/go install github.com/hduhelp/hdu-cli@latest`
>
> By the way, if you follow the offical installation guide of GO, The goroot will be like /usr/local/go/
</details>
## Usage

### hdu-cli [command]
### hdu-cli [sub command]

### Available Commands:
### Available Sub Commands:

- completion generate the autocompletion script for the specified shell
- help Help about any command
- net i-hdu network auth cli
- completion
- generate the autocompletion script for the specified shell
- help
- Help about any command
- net
- i-hdu network auth cli

### Flags:

- --config string config file (default is $HOME/.hdu-cli.yaml)
- -h, --help help for hdu_cli
- -s, --save save config
- -V, --verbose show more info
- -v, --version version for hdu_cli
- --config string
- config file (default is $HOME/.hdu-cli.yaml)
- more detail see comments at [hdu-cli.yaml example](./.hdu-cli.yaml)
- -h, --help
- help for hdu_cli
- -s, --save
- save config
- -V, --verbose
- show more info
- -v, --version
- version for hdu_cli


Use "hdu_cli [command] --help" for more information about a command.
Use `hdu_cli [sub command] --help` for more information about a command.


13 changes: 13 additions & 0 deletions utils/str.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,24 @@ import (
"crypto/hmac"
"crypto/md5"
"crypto/sha1"
"encoding/base64"
"encoding/hex"
"fmt"
"io"
)

func B64encode(content string) string {
return base64.StdEncoding.EncodeToString([]byte(content))
}

func B64decode(content string) (string, error) {
data, err := base64.StdEncoding.DecodeString(content)
if err != nil {
return "", err
}
return string(data), nil
}

func Sha1(content string) string {
h := sha1.New()
h.Write([]byte(content))
Expand Down

0 comments on commit 9161f27

Please sign in to comment.