pull/41/head
xSmurf 8 years ago
parent f750840b23
commit 2e6f98e410

@ -28,7 +28,7 @@ func (ob *dbusObject) isEnabled() (bool, error) {
func (ob *dbusObject) listRules() ([]sgfw.DbusRule, error) {
rules := []sgfw.DbusRule{}
err := ob.Call("com.subgraph.Firewall.ListRules", 0).Store(&rules);
err := ob.Call("com.subgraph.Firewall.ListRules", 0).Store(&rules)
if err != nil {
return nil, err
}

@ -111,9 +111,9 @@ func (rr *ruleRow) update() {
func getVerbText(rule *sgfw.DbusRule) string {
if sgfw.RuleAction(rule.Verb) == sgfw.RULE_ACTION_ALLOW {
return sgfw.RuleActionString[sgfw.RULE_ACTION_ALLOW]+ ":"
return sgfw.RuleActionString[sgfw.RULE_ACTION_ALLOW] + ":"
}
return sgfw.RuleActionString[sgfw.RULE_ACTION_DENY]+ ":"
return sgfw.RuleActionString[sgfw.RULE_ACTION_DENY] + ":"
}
func getTargetText(rule *sgfw.DbusRule) string {

@ -6,7 +6,7 @@ import (
const (
STR_REDACTED = "[redacted]"
STR_UNKNOWN = "[uknown]"
STR_UNKNOWN = "[uknown]"
)
type RuleAction uint16
@ -16,13 +16,13 @@ const (
RULE_ACTION_ALLOW
)
var RuleActionString = map[RuleAction]string {
RULE_ACTION_DENY: "DENY",
var RuleActionString = map[RuleAction]string{
RULE_ACTION_DENY: "DENY",
RULE_ACTION_ALLOW: "ALLOW",
}
var RuleActionValue = map[string]RuleAction {
"DENY": RULE_ACTION_DENY,
var RuleActionValue = map[string]RuleAction{
"DENY": RULE_ACTION_DENY,
"ALLOW": RULE_ACTION_ALLOW,
}
@ -34,39 +34,38 @@ const (
RULE_MODE_SYSTEM
)
var RuleModeString = map[RuleMode]string {
RULE_MODE_SESSION: "SESSION",
var RuleModeString = map[RuleMode]string{
RULE_MODE_SESSION: "SESSION",
RULE_MODE_PERMANENT: "PERMANENT",
RULE_MODE_SYSTEM: "SYSTEM",
RULE_MODE_SYSTEM: "SYSTEM",
}
var RuleModeValue = map[string]RuleMode {
"SESSION": RULE_MODE_SESSION,
var RuleModeValue = map[string]RuleMode{
"SESSION": RULE_MODE_SESSION,
"PERMANENT": RULE_MODE_PERMANENT,
"SYSTEM": RULE_MODE_SYSTEM,
"SYSTEM": RULE_MODE_SYSTEM,
}
type FilterScope uint16
const (
APPLY_ONCE FilterScope = iota
APPLY_SESSION
APPLY_FOREVER
)
var FilterScopeString = map[FilterScope]string {
APPLY_ONCE: "ONCE",
var FilterScopeString = map[FilterScope]string{
APPLY_ONCE: "ONCE",
APPLY_SESSION: "SESSION",
APPLY_FOREVER: "FOREVER",
}
var FilterScopeValue = map[string]FilterScope {
"ONCE": APPLY_ONCE,
var FilterScopeValue = map[string]FilterScope{
"ONCE": APPLY_ONCE,
"SESSION": APPLY_SESSION,
"FOREVER": APPLY_FOREVER,
}
func GetFilterScopeString(scope FilterScope) string {
if val, ok := FilterScopeString[scope]; ok {
return val
@ -91,14 +90,14 @@ const (
)
var FilterResultString = map[FilterResult]string{
FILTER_DENY: "DENY",
FILTER_ALLOW: "ALLOW",
FILTER_DENY: "DENY",
FILTER_ALLOW: "ALLOW",
FILTER_PROMPT: "PROMPT",
}
var FilterResultValue = map[string]FilterResult {
"DENY": FILTER_DENY,
"ALLOW": FILTER_ALLOW,
var FilterResultValue = map[string]FilterResult{
"DENY": FILTER_DENY,
"ALLOW": FILTER_ALLOW,
"PROMPT": FILTER_PROMPT,
}

@ -247,7 +247,7 @@ func printPacket(pkt *nfqueue.Packet, hostname string, pinfo *procsnitch.Info) s
if name == "" {
name = pkt.Dst.String()
}
if (pinfo == nil) {
if pinfo == nil {
return fmt.Sprintf("(%s %s:%d -> %s:%d)", proto, pkt.Src, pkt.SrcPort, name, pkt.DstPort)
} else {
return fmt.Sprintf("%s %s %s:%d -> %s:%d", pinfo.ExePath, proto, pkt.Src, pkt.SrcPort, name, pkt.DstPort)

Loading…
Cancel
Save