Skip to content

Commit

Permalink
Ready for v1.0
Browse files Browse the repository at this point in the history
- cent now removes duplicated templates!
- Better performance
- cent version command added
  • Loading branch information
xm1k3 committed Aug 3, 2021
1 parent 0968874 commit 904c952
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .cent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
<br><br>

after installation run `cent init` to initialize cent with the configuration files you find [here](https://github.com/xm1k3/cent/blob/main/.cent.yaml)


Expand All @@ -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

Expand Down Expand Up @@ -64,14 +69,15 @@ Flags:
▶ cent -h
▶ cent init -h
▶ cent update -h
▶ cent version
```
Example:

Clone and insert all the community templates into the `cent-nuclei-templates` folder
```
▶ 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
Expand All @@ -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`
```
Expand Down Expand Up @@ -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
7 changes: 5 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
},
}

Expand Down
46 changes: 46 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -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")
}
7 changes: 4 additions & 3 deletions internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package utils

import (
"bytes"
"fmt"
"io"
"log"
"net/http"
"os"
"os/exec"
"strings"
)

func RunCommand(command string, background bool) {
Expand All @@ -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")
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/jobs/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
File renamed without changes
Binary file removed static/img/cent-v0.4.png
Binary file not shown.
Binary file added static/img/cent-v1.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 904c952

Please sign in to comment.