From c6067e2f4a4f2aba74e273767642c4c0510a994b Mon Sep 17 00:00:00 2001 From: apple <2571583272@qq.com> Date: Sun, 15 Apr 2018 09:14:40 +0800 Subject: [PATCH] v3.3.3 --- .github/RELEASE_TEMPLATE.md | 34 +++++++ Gopkg.lock | 10 +- Gopkg.toml | 4 - build.sh | 6 +- internal/pcscommand/login.go | 13 +-- main.go | 2 +- resource_windows.syso | Bin 69350 -> 69350 bytes .../tieba/tiebautil/client_signature.go | 5 +- vendor/github.com/mars9/passwd/LICENSE | 13 --- vendor/github.com/mars9/passwd/README.md | 10 -- vendor/github.com/mars9/passwd/pass_darwin.go | 8 -- vendor/github.com/mars9/passwd/pass_linux.go | 8 -- vendor/github.com/mars9/passwd/pass_plan9.go | 36 ------- vendor/github.com/mars9/passwd/pass_unix.go | 56 ----------- .../github.com/mars9/passwd/pass_windows.go | 93 ------------------ vendor/github.com/mars9/passwd/passwd.go | 18 ---- versioninfo.json | 8 +- 17 files changed, 49 insertions(+), 275 deletions(-) create mode 100644 .github/RELEASE_TEMPLATE.md delete mode 100644 vendor/github.com/mars9/passwd/LICENSE delete mode 100644 vendor/github.com/mars9/passwd/README.md delete mode 100644 vendor/github.com/mars9/passwd/pass_darwin.go delete mode 100644 vendor/github.com/mars9/passwd/pass_linux.go delete mode 100644 vendor/github.com/mars9/passwd/pass_plan9.go delete mode 100644 vendor/github.com/mars9/passwd/pass_unix.go delete mode 100644 vendor/github.com/mars9/passwd/pass_windows.go delete mode 100644 vendor/github.com/mars9/passwd/passwd.go diff --git a/.github/RELEASE_TEMPLATE.md b/.github/RELEASE_TEMPLATE.md new file mode 100644 index 00000000..2e0645ee --- /dev/null +++ b/.github/RELEASE_TEMPLATE.md @@ -0,0 +1,34 @@ +# 更新日志: + +1. 修复若干bug. + +个人项目bug在所难免! 欢迎提 issue 和 pull request!!. + +# 下载说明 + +## 解释 CPU架构 + +|amd|arm| mips| 说明 | +|-----|----------------|------------------|------------------| +|amd64, x64 |arm64 | mips, mipsle |适用于64位CPU或操作系统的计算机| +|386, x86 |armv5, armv7 | mips64, mips64le |适用于32位CPU或操作系统的计算机| + +## 注意区别 `arm` 和 `amd`, 不要搞错了!!!! + +## 下载 + +* PC/电脑: + 请选择对应的系统 (windows, linux, darwin(苹果系统), freebsd), 对应的CPU架构 (一般情况下是 amd), 对应的CPU或操作系统位数 (详见上表), 下载. + +* 移动设备: + 请选择对应的系统(android, darwin(ios系统)), 对应的CPU架构 (一般情况下是 arm, 除了少数手机的CPU架构要选 amd, 例如联想K800, 联想K900等), 对应的CPU或操作系统位数 (详见上表), 下载. + +* mips: + 请选择对应的CPU架构, 对应的CPU或操作系统位数 (详见上表), 下载. + 需要启用fpu才可以正常运行程序, 否则可能会出现 `Illegal instruction` 错误. + +## 注意 + +相关的关键词, 均能在文件名中找到. + +文件格式均为zip压缩包格式, 切勿未解压程序就直接运行!! 程序解压之后才可以正常使用. diff --git a/Gopkg.lock b/Gopkg.lock index 04ddb215..f927ed5a 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -62,7 +62,7 @@ "tieba", "tieba/tiebautil" ] - revision = "a8bd1cf8475f7135b83c93d5f6dbf042c10185e2" + revision = "6c45d17733f14c0f2043d794558ffd61dcd3c975" [[projects]] branch = "master" @@ -82,12 +82,6 @@ packages = ["."] revision = "ae77be60afb1dcacde03767a8c37337fad28ac14" -[[projects]] - branch = "master" - name = "github.com/mars9/passwd" - packages = ["."] - revision = "0f6332435c864c4f415d566d2e5c747e51c7c24f" - [[projects]] name = "github.com/mattn/go-runewidth" packages = ["."] @@ -133,6 +127,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "ce2c6e6dc00a94139e7f3262bef86ce0dc7146b0a7e654f451b563bbea5c07ee" + inputs-digest = "1c4e9e21b2080f065ef8cd3d42caccbb7eb14bb7882367f960f878e7e56496d4" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 61be556e..7dae1d7c 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -53,10 +53,6 @@ name = "github.com/json-iterator/go" version = "1.1.2" -[[constraint]] - branch = "master" - name = "github.com/mars9/passwd" - [[constraint]] branch = "master" name = "github.com/olekukonko/tablewriter" diff --git a/build.sh b/build.sh index db1da5c4..778ef569 100644 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ name="BaiduPCS-Go" version=$1 if [ "$1" = "" ];then - version=v3.3.2 + version=v3.3.3 fi output="out/" @@ -88,8 +88,8 @@ Build $name-$version"-linux-armv7" linux arm 7 Build $name-$version"-linux-arm64" linux arm64 Build $name-$version"-linux-mips" linux mips Build $name-$version"-linux-mips64" linux mips64 -Build $name-$version"-linux-mipsel" linux mipsle -Build $name-$version"-linux-mips64el" linux mips64le +Build $name-$version"-linux-mipsle" linux mipsle +Build $name-$version"-linux-mips64le" linux mips64le # Build $name-$version"-linux-ppc64" linux ppc64 # Build $name-$version"-linux-ppc64le" linux ppc64le # Build $name-$version"-linux-s390x" linux s390x diff --git a/internal/pcscommand/login.go b/internal/pcscommand/login.go index 51d0f256..0cdea89f 100644 --- a/internal/pcscommand/login.go +++ b/internal/pcscommand/login.go @@ -7,7 +7,6 @@ import ( "github.com/iikira/BaiduPCS-Go/pcsliner" "github.com/iikira/BaiduPCS-Go/pcsutil" "github.com/iikira/BaiduPCS-Go/requester" - "github.com/mars9/passwd" "image/png" "io/ioutil" ) @@ -43,23 +42,15 @@ func RunLogin(username, password string) (bduss, ptoken, stoken string, err erro } } - line.Pause() - if password == "" { - var bp []byte - // liner 的 PasswordPrompt 不安全, 拆行之后密码就会显示出来了 - bp, err = passwd.Get("请输入密码(输入的密码无回显, 确认输入完成, 回车提交即可) > ") + fmt.Printf("请输入密码(输入的密码无回显, 确认输入完成, 回车提交即可) > ") + password, err = line.State.PasswordPrompt("") if err != nil { return } - - // 去掉回车键 - password = string(bytes.TrimRight(bp, "\r")) } - line.Resume() - var vcode, vcodestr string for_1: diff --git a/main.go b/main.go index 053d0e99..5adc0ca3 100644 --- a/main.go +++ b/main.go @@ -27,7 +27,7 @@ import ( var ( // Version 版本号 - Version = "v3.3.2" + Version = "v3.3.3" historyFilePath = pcsutil.ExecutablePathJoin("pcs_command_history.txt") reloadFn = func(c *cli.Context) error { diff --git a/resource_windows.syso b/resource_windows.syso index 9492ab276ad98036e97a9caef4fee7b169b0d48d..89e81531f367584d15da5d8bef7331b78fa128ed 100644 GIT binary patch delta 41 vcmaDhm*v@9mWC~i_c%G389Yrx-rmj47|jd-5ikq$ delta 41 wcmaDhm*v@9mWC~i_c%G37?^>Ofq`lIb56$Bj7HNhb1`mbG}_+H%^1xL01)X5?*IS* diff --git a/vendor/github.com/iikira/baidu-tools/tieba/tiebautil/client_signature.go b/vendor/github.com/iikira/baidu-tools/tieba/tiebautil/client_signature.go index 91a2c8f2..a203d7c7 100644 --- a/vendor/github.com/iikira/baidu-tools/tieba/tiebautil/client_signature.go +++ b/vendor/github.com/iikira/baidu-tools/tieba/tiebautil/client_signature.go @@ -24,7 +24,8 @@ func TiebaClientSignature(post map[string]string) { var ( bduss = post["BDUSS"] - phoneIMEIStr = strconv.FormatUint(ramdominfo.SumIMEI(bduss), 10) + model = ramdominfo.GetPhoneModel(bduss) + phoneIMEIStr = strconv.FormatUint(ramdominfo.SumIMEI(model+"_"+bduss), 10) m = md5.New() ) @@ -33,7 +34,7 @@ func TiebaClientSignature(post map[string]string) { post["_client_version"] = "7.0.0.0" post["_phone_imei"] = phoneIMEIStr post["from"] = "mini_ad_wandoujia" - post["model"] = ramdominfo.GetPhoneModel(bduss) + post["model"] = model m.Write([]byte(bduss + "_" + post["_client_version"] + "_" + post["_phone_imei"] + "_" + post["from"])) post["cuid"] = strings.ToUpper(hex.EncodeToString(m.Sum(nil))) + "|" + StringReverse(phoneIMEIStr) diff --git a/vendor/github.com/mars9/passwd/LICENSE b/vendor/github.com/mars9/passwd/LICENSE deleted file mode 100644 index 2135192f..00000000 --- a/vendor/github.com/mars9/passwd/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2013 Markus Sonderegger - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/vendor/github.com/mars9/passwd/README.md b/vendor/github.com/mars9/passwd/README.md deleted file mode 100644 index 22ebc053..00000000 --- a/vendor/github.com/mars9/passwd/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# passwd - -Let your golang programs access passwords in a secure way. - -Currently supported operating systems: - -* Mac OS X -* Linux -* Plan 9 -* Windows diff --git a/vendor/github.com/mars9/passwd/pass_darwin.go b/vendor/github.com/mars9/passwd/pass_darwin.go deleted file mode 100644 index c9d1e42f..00000000 --- a/vendor/github.com/mars9/passwd/pass_darwin.go +++ /dev/null @@ -1,8 +0,0 @@ -package passwd - -import "syscall" - -const ( - getTermios = syscall.TIOCGETA - setTermios = syscall.TIOCSETA -) diff --git a/vendor/github.com/mars9/passwd/pass_linux.go b/vendor/github.com/mars9/passwd/pass_linux.go deleted file mode 100644 index 2628b46a..00000000 --- a/vendor/github.com/mars9/passwd/pass_linux.go +++ /dev/null @@ -1,8 +0,0 @@ -package passwd - -import "syscall" - -const ( - getTermios = syscall.TCGETS - setTermios = syscall.TCSETS -) diff --git a/vendor/github.com/mars9/passwd/pass_plan9.go b/vendor/github.com/mars9/passwd/pass_plan9.go deleted file mode 100644 index 902ad78e..00000000 --- a/vendor/github.com/mars9/passwd/pass_plan9.go +++ /dev/null @@ -1,36 +0,0 @@ -package passwd - -import ( - "bufio" - "fmt" - "os" -) - -func init() { - passFunc = getPasswd -} - -func getPasswd(prompt string) ([]byte, error) { - cons, err := os.OpenFile("/dev/cons", os.O_RDWR, 0) - if err != nil { - return nil, err - } - defer cons.Close() - consctl, err := os.OpenFile("/dev/consctl", os.O_WRONLY, 0) - if err != nil { - return nil, err - } - defer consctl.Close() - - fmt.Fprint(consctl, "rawon") - defer fmt.Fprint(consctl, "rawoff") - - fmt.Fprint(cons, prompt) - r := bufio.NewReader(cons) - line, err := r.ReadBytes('\n') - if err != nil { - return nil, err - } - fmt.Fprint(cons, "\n") - return line[:len(line)-1], nil -} diff --git a/vendor/github.com/mars9/passwd/pass_unix.go b/vendor/github.com/mars9/passwd/pass_unix.go deleted file mode 100644 index 8c05f073..00000000 --- a/vendor/github.com/mars9/passwd/pass_unix.go +++ /dev/null @@ -1,56 +0,0 @@ -// +build darwin linux - -package passwd - -import ( - "bufio" - "fmt" - "os" - "syscall" - "unsafe" -) - -func init() { - passFunc = getPasswd -} - -func ioctl(fd uintptr, cmd uintptr, data *syscall.Termios) error { - if _, _, err := syscall.Syscall( - syscall.SYS_IOCTL, - fd, - cmd, - uintptr(unsafe.Pointer(data)), - ); err != 0 { - return syscall.ENOTTY - } - return nil -} - -func getPasswd(prompt string) ([]byte, error) { - tty, err := os.OpenFile("/dev/tty", os.O_RDWR, 0) - if err != nil { - return nil, err - } - defer tty.Close() - - var ostate syscall.Termios - if err = ioctl(tty.Fd(), getTermios, &ostate); err != nil { - return nil, err - } - - nstate := ostate - nstate.Lflag &^= (syscall.ECHO | syscall.ISIG) - if err = ioctl(tty.Fd(), setTermios, &nstate); err != nil { - return nil, err - } - defer ioctl(tty.Fd(), setTermios, &ostate) - - fmt.Fprint(tty, prompt) - r := bufio.NewReader(tty) - line, err := r.ReadBytes('\n') - if err != nil { - return nil, err - } - fmt.Fprint(tty, "\n") - return line[:len(line)-1], nil -} diff --git a/vendor/github.com/mars9/passwd/pass_windows.go b/vendor/github.com/mars9/passwd/pass_windows.go deleted file mode 100644 index 1e671c13..00000000 --- a/vendor/github.com/mars9/passwd/pass_windows.go +++ /dev/null @@ -1,93 +0,0 @@ -package passwd - -import ( - "bufio" - "fmt" - "os" - "syscall" - "unsafe" -) - -func init() { - passFunc = getPasswd -} - -const enableEchoInput = 0x0004 - -var ( - kernel32 syscall.Handle - getMode uintptr - setMode uintptr -) - -func initHandle() (err error) { - kernel32, err = syscall.LoadLibrary("kernel32.dll") - if err != nil { - return - } - getMode, err = syscall.GetProcAddress(kernel32, "GetConsoleMode") - if err != nil { - return - } - setMode, err = syscall.GetProcAddress(kernel32, "SetConsoleMode") - return -} - -func getConsoleMode(handle syscall.Handle, mode *uint32) error { - if _, _, err := syscall.Syscall( - getMode, - 2, - uintptr(handle), - uintptr(unsafe.Pointer(mode)), - 0, - ); err != 0 { - return fmt.Errorf("GetConsoleMode: %s", err.Error()) - } - return nil -} - -func setConsoleMode(handle syscall.Handle, mode uint32) error { - if _, _, err := syscall.Syscall( - setMode, - 2, - uintptr(handle), - uintptr(mode), - 0, - ); err != 0 { - return fmt.Errorf("SetConsoleMode: %s", err.Error()) - } - return nil -} - -func getPasswd(prompt string) ([]byte, error) { - if err := initHandle(); err != nil { - return nil, err - } - defer syscall.CloseHandle(kernel32) - - fd, err := syscall.GetStdHandle(syscall.STD_INPUT_HANDLE) - if err != nil { - return nil, err - } - - var omode uint32 - if err := getConsoleMode(fd, &omode); err != nil { - return nil, err - } - - nmode := omode - nmode &^= enableEchoInput - if err := setConsoleMode(fd, nmode); err != nil { - return nil, err - } - defer setConsoleMode(fd, omode) - - fmt.Fprint(os.Stdout, prompt) - r := bufio.NewReader(os.Stdin) - line, err := r.ReadBytes('\n') - if err != nil { - return nil, err - } - fmt.Fprint(os.Stdout, "\n") - return line[:len(line)-1], nil -} diff --git a/vendor/github.com/mars9/passwd/passwd.go b/vendor/github.com/mars9/passwd/passwd.go deleted file mode 100644 index b6a0e00c..00000000 --- a/vendor/github.com/mars9/passwd/passwd.go +++ /dev/null @@ -1,18 +0,0 @@ -package passwd - -import "errors" - -var ErrUnsupportedOS = errors.New("not supported") - -var passFunc func(prompt string) ([]byte, error) - -// Get displays a prompt to, and reads in a password from /dev/tty -// (/dev/cons). Get turns off character echoing while reading the -// password. The calling process should zero the password as soon -// as possible. -func Get(prompt string) ([]byte, error) { - if passFunc == nil { - return nil, ErrUnsupportedOS - } - return passFunc(prompt) -} diff --git a/versioninfo.json b/versioninfo.json index d7f494ff..50250cfd 100644 --- a/versioninfo.json +++ b/versioninfo.json @@ -3,13 +3,13 @@ "FileVersion": { "Major": 3, "Minor": 3, - "Patch": 2, + "Patch": 3, "Build": 0 }, "ProductVersion": { "Major": 3, "Minor": 3, - "Patch": 2, + "Patch": 3, "Build": 0 }, "FileFlagsMask": "3f", @@ -22,14 +22,14 @@ "Comments": "", "CompanyName": "iikira", "FileDescription": "百度网盘客户端", - "FileVersion": "v3.3.2", + "FileVersion": "v3.3.3", "InternalName": "", "LegalCopyright": "© 2016-2018 iikira.", "LegalTrademarks": "", "OriginalFilename": "", "PrivateBuild": "", "ProductName": "BaiduPCS-Go", - "ProductVersion": "v3.3.2", + "ProductVersion": "v3.3.3", "SpecialBuild": "" }, "VarFileInfo": {