add last id
This commit is contained in:
parent
eacb662498
commit
f033ba3fde
1 changed files with 10 additions and 3 deletions
13
main.go
13
main.go
|
@ -50,6 +50,7 @@ func main() {
|
|||
var host string
|
||||
var reason string
|
||||
var filter string
|
||||
var lastId string
|
||||
|
||||
flag.StringVar(&command, "command", "", "Command to execute: index, reject, collect, serve, audit")
|
||||
flag.StringVar(&url, "url", "", "Url to index hosts")
|
||||
|
@ -57,9 +58,15 @@ func main() {
|
|||
flag.StringVar(&host, "host", "", "Host to reject")
|
||||
flag.StringVar(&reason, "reject-reason", "", "Reject reason (optional)")
|
||||
flag.StringVar(&filter, "filter", "", "filter for audit")
|
||||
flag.StringVar(&lastId, "last-id", "", "last id")
|
||||
|
||||
flag.Parse()
|
||||
fmt.Println(command, host)
|
||||
|
||||
start, err := strconv.Atoi(lastId)
|
||||
if err != nil {
|
||||
start = 0
|
||||
}
|
||||
|
||||
switch command {
|
||||
case "index":
|
||||
|
@ -69,7 +76,7 @@ func main() {
|
|||
case "collect":
|
||||
collect()
|
||||
case "audit":
|
||||
audit(filter)
|
||||
audit(filter, start)
|
||||
case "serve":
|
||||
default:
|
||||
serve()
|
||||
|
@ -144,7 +151,7 @@ func collect() {
|
|||
}
|
||||
}
|
||||
|
||||
func audit(filter string) {
|
||||
func audit(filter string, start int) {
|
||||
db := connectDB()
|
||||
defer db.Close()
|
||||
|
||||
|
@ -153,7 +160,7 @@ func audit(filter string) {
|
|||
return
|
||||
}
|
||||
|
||||
hosts, err := getHosts(db, 0, 10000, "", "", "url")
|
||||
hosts, err := getHosts(db, start, 10000, "", "", "url")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue