Various changes.

This commit is contained in:
Matt Burchett 2019-01-14 12:31:46 -06:00
parent d62f45cc10
commit 43ed2ea438
3 changed files with 7 additions and 4 deletions

View File

@ -1,11 +1,13 @@
package model
// Results is for DNS results
type Results struct {
IP string `json:"ip"`
Hostname string `json:"hostname"`
TXT string `json:"TXT`
TXT string `json:"TXT"`
}
// UniqResults is for Unique DNS Results
type UniqResults struct {
IP string `json:"ip"`
Hostname string `json:"hostname"`

View File

@ -28,6 +28,7 @@ func lookupName(fqdn, serverAddr string) (string, error) {
return "", errors.New("no A record returned")
}
// PerformZoneTransfer performs zone transfers and gathers a list from config.Domains
func PerformZoneTransfer(config config.Config) []string {
data := make([]string, 0)
@ -46,7 +47,6 @@ func PerformZoneTransfer(config config.Config) []string {
var ip, hostname, txt string
switch v := a.(type) {
case *dns.TXT:
txt = string(v.Txt[0])
hostname = v.Hdr.Name
cip, err := lookupName(strings.TrimRight(v.Hdr.Name, "."), server)
if err != nil || cip == "" {

View File

@ -7,6 +7,7 @@ import (
"git.linuxrocker.com/mattburchett/go_tab-magic/pkg/config"
)
// CreateShellAliases will create shell aliases and fmt.Println them
func CreateShellAliases(data []string, username string, config config.Config) {
for _, i := range data {
splitStrings := strings.Split(i, " ")
@ -40,7 +41,7 @@ func CreateShellAliases(data []string, username string, config config.Config) {
for _, i := range txtSplit {
if strings.Contains(i, "SSH_PORT") {
port := strings.TrimLeft(i, "SSH_PORT=")
port := strings.TrimPrefix(i, "SSH_PORT=")
racOpts = fmt.Sprintf("-AXt -p %v -l", port)
} else if strings.Contains(i, "OS_FAMILY") {
osFamily := strings.Split(i, "=")
@ -58,7 +59,7 @@ func CreateShellAliases(data []string, username string, config config.Config) {
sudo = ""
}
} else if strings.Contains(i, "REMOTE_USER") {
user := strings.TrimLeft(i, "REMOTE_USER=")
user := strings.TrimPrefix(i, "REMOTE_USER=")
remoteUser = user
}
}