diff --git a/.cent.yaml b/.cent.yaml index cc573c3..c07c5b8 100644 --- a/.cent.yaml +++ b/.cent.yaml @@ -7,9 +7,11 @@ exclude-files: - README.md - .gitignore - .pre-commit-config.yaml + - LICENSE # Add github urls community-templates: + - https://github.com/projectdiscovery/nuclei-templates.git - https://github.com/geeknik/the-nuclei-templates - https://github.com/pikpikcu/nuclei-templates - https://github.com/panch0r3d/nuclei-templates @@ -40,6 +42,5 @@ community-templates: - https://github.com/sadnansakin/my-nuclei-templates - https://github.com/5cr1pt/templates - https://github.com/rahulkadavil/nuclei-templates - - https://github.com/Nithissh0708/Custom-Nuclei-Templates - https://github.com/shifa123/detections - https://github.com/daffainfo/my-nuclei-templates diff --git a/README.md b/README.md index e804f7b..258bb70 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,10 @@ Community edition nuclei templates, a simple tool that allows you to organize al ``` GO111MODULE=on go get -u github.com/xm1k3/cent ``` + +Or [download from releases](https://github.com/xm1k3/cent/releases) +

+ after installation run `cent init` to initialize cent with the configuration files you find [here](https://github.com/xm1k3/cent/blob/main/.cent.yaml) @@ -29,6 +33,7 @@ after installation run `cent init` to initialize cent with the configuration fil | ------- | ---------------------- | | init | Cent init configuration file | | update | Update your repository | +| version | Print cent version | # Root flags @@ -64,6 +69,7 @@ Flags: ▶ cent -h ▶ cent init -h ▶ cent update -h +▶ cent version ``` Example: @@ -71,7 +77,7 @@ Clone and insert all the community templates into the `cent-nuclei-templates` fo ``` ▶ cent -p cent-nuclei-templates -k ``` -![cent](./static/img/cent-v0.4.png) +![cent](./static/img/cent-v1.0.png) If you have updated the `cent.yaml` file by adding new folders ```yaml @@ -86,7 +92,7 @@ just do: ``` and `cent` will automatically delete all `dns` folder present in `cent-nuclei-templates` without cloning all the github repos. -![cent update](./static/img/cent-v0.4-update.png) +![cent update](./static/img/cent-update.png) Same thing with `exclude-files` ``` @@ -154,15 +160,15 @@ community-templates: ``` ## Credits -- [Alra3ees - Emad Shanab](https://twitter.com/Alra3ees) - - [Nuclei-Templates-Collection](https://github.com/emadshanab/Nuclei-Templates-Collection) -- [sec715](https://twitter.com/sec715) -- [geeknik](https://twitter.com/geeknik) - [Nuclei](https://twitter.com/pdnuclei) - [Project Discovery](https://twitter.com/pdiscoveryio) +- [sec715](https://twitter.com/sec715) +- [geeknik](https://twitter.com/geeknik) - [SYSTEM00 SECURITY](https://github.com/System00-Security) - [clarkvoss](https://github.com/clarkvoss) - [notnotnotveg](https://github.com/notnotnotveg) +- [Alra3ees - Emad Shanab](https://twitter.com/Alra3ees) + - [Nuclei-Templates-Collection](https://github.com/emadshanab/Nuclei-Templates-Collection) # License Cent is distributed under Apache-2.0 License \ No newline at end of file diff --git a/cmd/root.go b/cmd/root.go index c494c3e..f91657b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -44,11 +44,14 @@ By xm1k3`, keepfolders, _ := cmd.Flags().GetBool("keepfolders") console, _ := cmd.Flags().GetBool("console") - fmt.Println(color.CyanString("cent v0.4 started")) + fmt.Println(color.CyanString("cent started")) jobs.Start(pathFlag, keepfolders, console) jobs.RemoveEmptyFolders(path.Join(pathFlag)) jobs.UpdateRepo(path.Join(pathFlag), true, true, false) - fmt.Println(color.CyanString("cent v0.4 finished, you can find all your nuclei-templates in " + pathFlag)) + jobs.UpdateRepo(path.Join(pathFlag), true, true, false) + jobs.RemoveDuplicates(path.Join(pathFlag), console) + fmt.Println(color.YellowString("[!] Removed duplicates")) + fmt.Println(color.CyanString("cent finished, you can find all your nuclei-templates in " + pathFlag)) }, } diff --git a/cmd/version.go b/cmd/version.go new file mode 100644 index 0000000..4d73a71 --- /dev/null +++ b/cmd/version.go @@ -0,0 +1,46 @@ +/* +Copyright © 2021 xm1k3 + +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 cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// versionCmd represents the version command +var versionCmd = &cobra.Command{ + Use: "version", + Short: "Print cent version", + Long: "Print cent version", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Cent v1.0") + }, +} + +func init() { + rootCmd.AddCommand(versionCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // versionCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // versionCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} diff --git a/internal/utils/utils.go b/internal/utils/utils.go index b6a8fad..fcb1c3f 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -2,11 +2,12 @@ package utils import ( "bytes" - "fmt" "io" + "log" "net/http" "os" "os/exec" + "strings" ) func RunCommand(command string, background bool) { @@ -22,8 +23,8 @@ func RunCommand(command string, background bool) { } err := cmd.Run() if err != nil { - if background { - fmt.Println("Error running shell command: ", command, " => ", err.Error()) + if strings.Contains(command, "fdupes") { + log.Fatalln("Error running shell command: ", command, " => ", err.Error(), "\nInstall with: sudo apt-get install fdupes") } } } diff --git a/pkg/jobs/jobs.go b/pkg/jobs/jobs.go index 65e4294..46a3d8e 100644 --- a/pkg/jobs/jobs.go +++ b/pkg/jobs/jobs.go @@ -101,6 +101,10 @@ func UpdateRepo(path string, remDirs bool, remFiles bool, printOut bool) { }) } +func RemoveDuplicates(path string, console bool) { + utils.RunCommand("fdupes -d -N -r "+path, console) +} + func getDirPath(path string) string { reponame := strings.Split(path, "/")[0] endpoint := strings.TrimPrefix(path, reponame) diff --git a/static/img/cent-v0.4-update.png b/static/img/cent-update.png similarity index 100% rename from static/img/cent-v0.4-update.png rename to static/img/cent-update.png diff --git a/static/img/cent-v0.4.png b/static/img/cent-v0.4.png deleted file mode 100644 index 7b026bf..0000000 Binary files a/static/img/cent-v0.4.png and /dev/null differ diff --git a/static/img/cent-v1.0.png b/static/img/cent-v1.0.png new file mode 100644 index 0000000..073a947 Binary files /dev/null and b/static/img/cent-v1.0.png differ