mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-26 13:15:47 +00:00
* Added initial catalog interface implementation * Added OpenFile to Catalog + disk catalog implementation * Fixed merge issues Co-authored-by: sandeep <sandeep@projectdiscovery.io>
26 lines
659 B
Go
26 lines
659 B
Go
package disk
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
// DiskCatalog is a template catalog helper implementation based on disk
|
|
type DiskCatalog struct {
|
|
templatesDirectory string
|
|
}
|
|
|
|
// NewCatalog creates a new Catalog structure using provided input items
|
|
// using disk based items
|
|
func NewCatalog(directory string) *DiskCatalog {
|
|
catalog := &DiskCatalog{templatesDirectory: directory}
|
|
return catalog
|
|
}
|
|
|
|
// OpenFile opens a file and returns an io.ReadCloser to the file.
|
|
// It is used to read template and payload files based on catalog responses.
|
|
func (d *DiskCatalog) OpenFile(filename string) (io.ReadCloser, error) {
|
|
file, err := os.Open(filename)
|
|
return file, err
|
|
}
|