|
@@ -68,7 +68,7 @@ func simpleBanToSignal(targetIP string, reason string, expirationStr string, act
|
|
banApp.EndIp = types.IP2Int(parsedIP)
|
|
banApp.EndIp = types.IP2Int(parsedIP)
|
|
}
|
|
}
|
|
|
|
|
|
- var banApps = make([]types.BanApplication, 1)
|
|
|
|
|
|
+ var banApps = make([]types.BanApplication, 0)
|
|
banApps = append(banApps, banApp)
|
|
banApps = append(banApps, banApp)
|
|
signalOcc = types.SignalOccurence{
|
|
signalOcc = types.SignalOccurence{
|
|
Scenario: reason,
|
|
Scenario: reason,
|
|
@@ -94,7 +94,7 @@ func BanList() error {
|
|
}
|
|
}
|
|
ret, err := outputCTX.ReadAT(at)
|
|
ret, err := outputCTX.ReadAT(at)
|
|
if err != nil {
|
|
if err != nil {
|
|
- return fmt.Errorf("unable to get records from sqlite : %v", err)
|
|
|
|
|
|
+ return fmt.Errorf("unable to get records from Database : %v", err)
|
|
}
|
|
}
|
|
if config.output == "raw" {
|
|
if config.output == "raw" {
|
|
fmt.Printf("source,ip,reason,bans,action,country,as,events_count,expiration\n")
|
|
fmt.Printf("source,ip,reason,bans,action,country,as,events_count,expiration\n")
|
|
@@ -167,7 +167,7 @@ func BanAdd(target string, duration string, reason string, action string) error
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
- log.Infof("%s %s for %s (%s)", action, target, duration, reason)
|
|
|
|
|
|
+ log.Infof("Wrote ban to database.")
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
@@ -225,7 +225,7 @@ cscli ban add range 1.2.3.0/24 24h "the whole range"`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
reason := strings.Join(args[2:], " ")
|
|
reason := strings.Join(args[2:], " ")
|
|
if err := BanAdd(args[0], args[1], reason, remediationType); err != nil {
|
|
if err := BanAdd(args[0], args[1], reason, remediationType); err != nil {
|
|
- log.Fatalf("failed to add ban to sqlite : %v", err)
|
|
|
|
|
|
+ log.Fatalf("failed to add ban to database : %v", err)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
}
|
|
}
|
|
@@ -239,7 +239,7 @@ cscli ban add range 1.2.3.0/24 24h "the whole range"`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
reason := strings.Join(args[2:], " ")
|
|
reason := strings.Join(args[2:], " ")
|
|
if err := BanAdd(args[0], args[1], reason, remediationType); err != nil {
|
|
if err := BanAdd(args[0], args[1], reason, remediationType); err != nil {
|
|
- log.Fatalf("failed to add ban to sqlite : %v", err)
|
|
|
|
|
|
+ log.Fatalf("failed to add ban to database : %v", err)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
}
|
|
}
|