- cmd/serve.go: starts scheduler, optionally starts Telegram bot with --telegram flag - cmd/schedule.go: add/list/remove/run subcommands for scheduled scan job CRUD - pkg/scheduler/: gocron v2 based scheduler with DB-backed jobs and scan execution - pkg/storage/scheduled_jobs.go: scheduled_jobs table CRUD with tests - Remove serve and schedule stubs from cmd/stubs.go Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22 lines
524 B
Go
22 lines
524 B
Go
package scheduler
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/salvacybersec/keyhunter/pkg/engine/sources"
|
|
)
|
|
|
|
// selectSchedulerSource returns the appropriate Source for a scheduled scan path.
|
|
// Only file and directory paths are supported (same as bot scans).
|
|
func selectSchedulerSource(path string) (sources.Source, error) {
|
|
info, err := os.Stat(path)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("stat %q: %w", path, err)
|
|
}
|
|
if info.IsDir() {
|
|
return sources.NewDirSource(path), nil
|
|
}
|
|
return sources.NewFileSource(path), nil
|
|
}
|