Skip to content

Commit 083bb55

Browse files
authored
Merge pull request #1 from hduhelp/eson_dev
EsonDev PR
2 parents 79d6ec0 + 3ea24e2 commit 083bb55

File tree

3 files changed

+61
-11
lines changed

3 files changed

+61
-11
lines changed

.hdu-cli.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
net:
2+
auth:
3+
# i-HDU wifi login
4+
#
5+
# Manually method
6+
# username always is your student id like 20051101
7+
# password is what u know
8+
# and put the file at your home directory
9+
#
10+
# Auto method
11+
# hdu-cli net login --username 20051101 --password your-password
12+
# After Testing on my Kali linux The ( -s / -d ) option seems not work correctly.
13+
# There need further debugging.
14+
username: 20051101
15+
password: your-password

README.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,46 @@
66
go install github.com/hduhelp/hdu-cli@latest
77
```
88

9+
<details>
10+
<summary>Trouble shoot</summary>
11+
12+
> The Command may need root privilege
13+
>
14+
> and sometimes go env is not install completely on your root account (sudo mode)
15+
>
16+
> so try like `sudo $GOROOT/bin/go install github.com/hduhelp/hdu-cli@latest`
17+
>
18+
> By the way, if you follow the offical installation guide of GO, The goroot will be like /usr/local/go/
19+
</details>
20+
921
## Usage
1022

11-
### hdu-cli [command]
23+
### hdu-cli [sub command]
1224

13-
### Available Commands:
25+
### Available Sub Commands:
1426

15-
- completion generate the autocompletion script for the specified shell
16-
- help Help about any command
17-
- net i-hdu network auth cli
27+
- completion
28+
- generate the autocompletion script for the specified shell
29+
- help
30+
- Help about any command
31+
- net
32+
- i-hdu network auth cli
1833

1934
### Flags:
2035

21-
- --config string config file (default is $HOME/.hdu-cli.yaml)
22-
- -h, --help help for hdu_cli
23-
- -s, --save save config
24-
- -V, --verbose show more info
25-
- -v, --version version for hdu_cli
36+
- --config string
37+
- config file (default is $HOME/.hdu-cli.yaml)
38+
- more detail see comments at [hdu-cli.yaml example](./.hdu-cli.yaml)
39+
- -h, --help
40+
- help for hdu_cli
41+
- -s, --save
42+
- save config
43+
- -V, --verbose
44+
- show more info
45+
- -v, --version
46+
- version for hdu_cli
47+
2648

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

2951

utils/str.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,24 @@ import (
44
"crypto/hmac"
55
"crypto/md5"
66
"crypto/sha1"
7+
"encoding/base64"
78
"encoding/hex"
89
"fmt"
910
"io"
1011
)
1112

13+
func B64encode(content string) string {
14+
return base64.StdEncoding.EncodeToString([]byte(content))
15+
}
16+
17+
func B64decode(content string) (string, error) {
18+
data, err := base64.StdEncoding.DecodeString(content)
19+
if err != nil {
20+
return "", err
21+
}
22+
return string(data), nil
23+
}
24+
1225
func Sha1(content string) string {
1326
h := sha1.New()
1427
h.Write([]byte(content))

0 commit comments

Comments
 (0)