Commit 3f3b8850 by 浔阳陌客

2022-04-04 3

parent d29b7f6f
package public
const Region_nb = "宁波"
const Region_zz = "郑州"
const Dept_jishu = "技术部门"
const Dept_chanpin = "产品部门"
......@@ -80,6 +80,9 @@ func GetHostnamePart(hostname string) ([]string, error) {
}
return n, nil
}
func GetIPFromInterface() {
}
// 判断计算机是否在zhiweireach中
func Zhiweireach() bool {
......
......@@ -490,6 +490,16 @@ func GetIPFromNslookup() string {
result, _ := PSCommandOutputNoSplit(cmd)
return strings.TrimSpace(result)
}
func GetMultiIPFromNslookup() []string {
// 根据登录的服务器作为DNS的解析变量
// 在域中,为主控
// 在工作组中,为本机
// 因此可以可以机器简单的方式获取到本机IP
cmd := fmt.Sprintf("(Resolve-DnsName $env:computername -server %s -Type A).IPAddress", User_logonserver)
result, _ := PSCommandOutputNoSplit(cmd)
result = strings.TrimSpace(result)
return strings.Split(result, "\n")
}
func GetMacaddressFromIP(ip string) string {
cmd := fmt.Sprintf("(Get-NetAdapter -InterfaceIndex (Get-NetIPAddress -IPAddress %s).InterfaceIndex ).MacAddress", ip)
result, _ := PSCommandOutputNoSplit(cmd)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment