!85 SCP函数新增

Merge pull request !85 from 宋帮诚晋/master
This commit is contained in:
宋帮诚晋 2022-11-16 09:46:37 +00:00 committed by Gitee
commit a936176553
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 21 additions and 3 deletions

View File

@ -1 +1,4 @@
2022/11/16 17:01:43 检测为liunx系统
2022/11/16 17:41:37 检测为liunx系统
2022/11/16 17:41:37 frameWork sure
2022/11/16 17:41:37 ssh connect succ

BIN
main

Binary file not shown.

View File

@ -7,7 +7,9 @@ import(
"main/src/genmai/RemoteCheck"
"strings"
"strconv"
// "log"
)
var RequestsWeb string
var RequestsSystem string
var RequestsKernel string
@ -15,6 +17,7 @@ var RequestsBaseLine string
var Num int
var RequestsIP string
var PoolStatNums int
func ParameterParser(sSystem string,sKernel string,sWeb string,sBaseLine string,sAll string,PoolStatNum int,ParserNum int,Update string ,IP string){
if sSystem!="false"{
@ -137,6 +140,7 @@ func ParameterParser(sSystem string,sKernel string,sWeb string,sBaseLine string,
Pool.CoprogramPool(Num,RequestsSystem,RequestsKernel,RequestsWeb,RequestsBaseLine,PoolStatNums,RequestsIP)
}
//远程参数解析
func RemoteArgParser(SSHHost string,SSHUser string,SSHPassword string)(checkResult string){
if SSHHost !="false" && SSHUser !="false" &&SSHPassword !="false"{
@ -144,7 +148,8 @@ func RemoteArgParser(SSHHost string,SSHUser string,SSHPassword string)(checkResu
if SSHHostCheck !="true"{
fmt.Println("host错误")
}else{
command:="id"
//解析远程连接的架构
command:="whoami"
result:=RemoteCheck.SSHConnect(SSHHost,SSHUser,SSHPassword,command)
checkResult=strconv.FormatBool(strings.Contains(result, "root"))
}

View File

@ -0,0 +1,11 @@
package RemoteCheck
import(
"log"
)
func SCPFile(){
log.Println("SCP File success")
}

View File

@ -81,8 +81,7 @@ func SSHConnect(SSHHost string,SSHUser string, SSHPassword string,command string
}
log.Println("命令输出:",string(combo))
log.Println("ssh connect succ")
defer session.Close()
result=string(combo)
return result