-
Notifications
You must be signed in to change notification settings - Fork 1
Tsv output, good shit #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f3cd4eb
binary now spits out a tsv file for tracker purposes, im awesome
thankgod4rob 036967a
hi
thankgod4rob 242e6e3
tsv fix
thankgod4rob 366e054
ameya is picky
thankgod4rob 0319efc
combined os name and version + moved the order of execution
thankgod4rob 4343f68
combined tcp and udp
thankgod4rob a8e2565
added os conf
thankgod4rob e5db6e6
user format
thankgod4rob 0da6276
file structure change
thankgod4rob b14110d
real push, the last one was fake
thankgod4rob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| #ide stuff | ||
| *.idea | ||
| .idea/ | ||
|
|
||
| # Binaries for programs and plugins | ||
| *.exe | ||
| *.exe~ | ||
|
|
||
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package triage | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
| "os/exec" | ||
| "strings" | ||
| ) | ||
|
|
||
| func getDomainInfo() string { | ||
| // Check 1: sssd.conf | ||
| content, err := os.ReadFile("/etc/sssd/sssd.conf") | ||
| if err == nil { | ||
| fmt.Println("sssd.conf") | ||
| return strings.TrimSpace(string(content)) + "\t" | ||
| } | ||
|
|
||
| // Check 2: realm list (if available) | ||
| out, err := exec.Command("realm", "list").Output() | ||
| if err == nil && len(out) > 0 { | ||
| return strings.TrimSpace(string(out)) + "\t" | ||
| } | ||
|
|
||
| return "Not Domain Jointed" + "\t" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| package triage | ||
|
|
||
| import ( | ||
| "os/exec" | ||
| "strings" | ||
| ) | ||
|
|
||
| func getDomainInfo() string { | ||
| out, err := exec.Command("wmic", "computersystem", "get", "domain").Output() | ||
| if err != nil { | ||
| return "Not Domain Joined" + "\t" | ||
| } | ||
|
|
||
| lines := strings.Split(strings.TrimSpace(string(out)), "\n") | ||
| for _, line := range lines { | ||
| line = strings.TrimSpace(line) | ||
| if line == "" || line == "Domain" { | ||
| continue | ||
| } | ||
| if line == "WORKGROUP" { | ||
| return "Not Domain Joined" + "\t" | ||
| } | ||
| return line + "\t" | ||
| } | ||
|
|
||
| return "Not Domain Joined" + "\t" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,22 @@ | ||
| package triage | ||
|
|
||
| import "github.com/UT-CTF/landschaft/util" | ||
| import ( | ||
| "strings" | ||
|
|
||
| func runFirewallTriage() { | ||
| util.RunAndPrintScript("triage/firewall.sh") | ||
| "github.com/UT-CTF/landschaft/util" | ||
| ) | ||
|
|
||
| func runFirewallTriage() string { | ||
| result := util.RunAndPrintScript("triage/firewall.sh") | ||
| result = strings.ReplaceAll(result, "\n", " ") | ||
| result = strings.ReplaceAll(result, "\r", "") | ||
| result = strings.Join(strings.Fields(result), " ") | ||
| result = strings.ReplaceAll(result, "=", "") | ||
| result += "\t" | ||
|
|
||
| if strings.Contains(result, "No supported firewall") { | ||
| result = "No Firewall!\t" | ||
| } | ||
|
|
||
| return result | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,96 @@ | ||
| package triage | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "strings" | ||
|
|
||
| "github.com/UT-CTF/landschaft/util" | ||
| ) | ||
|
|
||
| func runFirewallTriage() { | ||
| util.RunAndPrintScript("triage/firewall.ps1") | ||
| func runFirewallTriage() string { | ||
| result := parseFirewall(util.RunAndPrintScript("triage/firewall.ps1")) + "\t" | ||
| return result | ||
| } | ||
|
|
||
| func parseFirewall(result string) string { | ||
| lines := strings.Split(result, "\n") | ||
|
|
||
| type iface struct { | ||
| name string | ||
| alias string | ||
| category string | ||
| } | ||
|
|
||
| var interfaces []iface | ||
| profileEnabled := make(map[string]bool) | ||
| profileState := make(map[string]string) | ||
| profilePolicy := make(map[string]string) | ||
| currentProfile := "" | ||
|
|
||
| for _, line := range lines { | ||
| trimmed := strings.TrimSpace(line) | ||
|
|
||
| if strings.HasPrefix(trimmed, "Name") || strings.HasPrefix(trimmed, "----") || trimmed == "" || strings.HasPrefix(trimmed, "Interfaces:") { | ||
| continue | ||
| } | ||
|
|
||
| fields := strings.Fields(trimmed) | ||
|
|
||
| if strings.HasPrefix(trimmed, "Profile:") { | ||
| parts := strings.Split(trimmed, " - ") | ||
| profileName := strings.TrimSpace(strings.TrimPrefix(parts[0], "Profile:")) | ||
| if len(parts) > 1 { | ||
| profileEnabled[profileName] = strings.TrimSpace(parts[1]) == "Enabled" | ||
| } | ||
| continue | ||
| } | ||
|
|
||
| if strings.HasSuffix(trimmed, "Profile Settings:") { | ||
| currentProfile = strings.TrimSuffix(trimmed, " Profile Settings:") | ||
| continue | ||
| } | ||
|
|
||
| if currentProfile != "" { | ||
| if strings.HasPrefix(trimmed, "State") { | ||
| profileState[currentProfile] = strings.TrimSpace(strings.TrimPrefix(trimmed, "State")) | ||
| continue | ||
| } | ||
| if strings.HasPrefix(trimmed, "Firewall Policy") { | ||
| profilePolicy[currentProfile] = strings.TrimSpace(strings.TrimPrefix(trimmed, "Firewall Policy")) | ||
| continue | ||
| } | ||
| } | ||
|
|
||
| // interface line - last field is category, second to last is alias, rest is name | ||
| if len(fields) >= 3 { | ||
| category := fields[len(fields)-1] | ||
| alias := fields[len(fields)-2] | ||
| name := strings.Join(fields[:len(fields)-2], " ") | ||
| interfaces = append(interfaces, iface{name, alias, category}) | ||
| } | ||
| } | ||
|
|
||
| var parts []string | ||
| for _, i := range interfaces { | ||
| enabled := "Disabled" | ||
| check := false | ||
| if profileEnabled[i.category] { | ||
| enabled = "Enabled" | ||
| check = true | ||
| } | ||
| state := profileState[i.category] | ||
| policy := profilePolicy[i.category] | ||
|
|
||
| if check { | ||
| parts = append(parts, fmt.Sprintf("%s - %s \n\t%s - %s \n\tState %s \n\tFirewall Policy: %s", | ||
| i.name, i.alias, i.category, enabled, state, policy)) | ||
| } else { | ||
| parts = append(parts, fmt.Sprintf("%s - %s \n\t%s - %s", | ||
| i.name, i.alias, i.category, enabled)) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| return "\"" + strings.Join(parts, "\n\n ") + "\"" | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.