-
Notifications
You must be signed in to change notification settings - Fork 545
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better eva - feat(evaluate): support check setuid files in path (#67)
* perf(capabilities): red color for add caps * perf(eva): a nice head 2 of title * feat(evaluate): support check setuid files in path * perf(eva): move call function from cli/parse to evaluate/evaluate Co-authored-by: neargle <[email protected]>
- Loading branch information
Showing
8 changed files
with
183 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,69 @@ | ||
/* | ||
Copyright 2022 The Authors of https://github.com/CDK-TEAM/CDK . | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package evaluate | ||
|
||
import ( | ||
"github.com/cdk-team/CDK/pkg/util" | ||
"github.com/cdk-team/CDK/conf" | ||
) | ||
|
||
// CallBasics is a function to call basic functions | ||
func CallBasics() { | ||
util.PrintH2("Information Gathering - System Info") | ||
BasicSysInfo() | ||
FindSidFiles() | ||
|
||
util.PrintH2("Information Gathering - Services") | ||
SearchSensitiveEnv() | ||
SearchSensitiveService() | ||
|
||
util.PrintH2("Information Gathering - Commands and Capabilities") | ||
SearchAvailableCommands() | ||
GetProcCapabilities() | ||
|
||
util.PrintH2("Information Gathering - Mounts") | ||
MountEscape() | ||
|
||
util.PrintH2("Information Gathering - Net Namespace") | ||
CheckNetNamespace() | ||
|
||
util.PrintH2("Information Gathering - Sysctl Variables") | ||
CheckRouteLocalNetworkValue() | ||
|
||
util.PrintH2("Discovery - K8s API Server") | ||
CheckK8sAnonymousLogin() | ||
|
||
util.PrintH2("Discovery - K8s Service Account") | ||
CheckPrivilegedK8sServiceAccount(conf.K8sSATokenDefaultPath) | ||
|
||
util.PrintH2("Discovery - Cloud Provider Metadata API") | ||
CheckCloudMetadataAPI() | ||
|
||
util.PrintH2("Information Gathering - DNS-Based Service Discovery") | ||
DNSBasedServiceDiscovery() | ||
} | ||
|
||
func CallAddedFunc() { | ||
util.PrintH2("Information Gathering - Sensitive Files") | ||
SearchLocalFilePath() | ||
|
||
util.PrintH2("Information Gathering - ASLR") | ||
ASLR() | ||
|
||
util.PrintH2("Information Gathering - Cgroups") | ||
DumpCgroup() | ||
} |
This file contains 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
This file contains 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
This file contains 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,48 @@ | ||
/* | ||
Copyright 2022 The Authors of https://github.com/CDK-TEAM/CDK . | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package util | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
) | ||
|
||
const Colorful = true | ||
|
||
// fmt.Printf(util.GreenBold.Sprint("\n[Information Gathering - System Info]\n")) | ||
func PrintH2(title string) { | ||
fmt.Printf(BlueBold.Sprint("\n[ ") + GreenBold.Sprint(title) + BlueBold.Sprint(" ]\n")) | ||
} | ||
|
||
func PrintItemKey(key string, color bool) { | ||
key = key + "\n" | ||
if color { | ||
log.Printf(YellowBold.Sprint(key)) | ||
} else { | ||
log.Printf(key) | ||
} | ||
} | ||
|
||
func PrintItemValue(value string, color bool) { | ||
value = "\t" + value + "\n" | ||
if color { | ||
fmt.Printf(RedBold.Sprint(value)) | ||
} else { | ||
fmt.Printf(value) | ||
} | ||
} | ||
|