Skip to content
Snippets Groups Projects
Commit a485408f authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Fixed req_id format

Fixed Recon id in catmap
Fixed isoformat calling on None
Shortened validation error message
Fixed rejecting of Test messages
parent 845d9804
No related branches found
No related tags found
No related merge requests found
...@@ -102,7 +102,7 @@ class Error(Exception): ...@@ -102,7 +102,7 @@ class Error(Exception):
if self.method is not None: if self.method is not None:
out.append(" in %s" % self.method) out.append(" in %s" % self.method)
if self.req_id is not None: if self.req_id is not None:
out.append("(%8x)" % self.req_id) out.append("(%08x)" % self.req_id)
if self.message is not None: if self.message is not None:
out.append(": %s" % self.message) out.append(": %s" % self.message)
if self.excval is not None: if self.excval is not None:
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"Malware.Spyware" : 204, "Malware.Spyware" : 204,
"Malware.Dialer" : 205, "Malware.Dialer" : 205,
"Malware.Rootkit" : 206, "Malware.Rootkit" : 206,
"Recon.Scanning" : 3, "Recon" : 300,
"Recon.Scanning" : 301, "Recon.Scanning" : 301,
"Recon.Sniffing" : 302, "Recon.Sniffing" : 302,
"Recon.SocialEngineering" : 303, "Recon.SocialEngineering" : 303,
......
...@@ -134,7 +134,7 @@ class LogRequestFilter(logging.Filter): ...@@ -134,7 +134,7 @@ class LogRequestFilter(logging.Filter):
def filter(self, record): def filter(self, record):
if self.req.env: if self.req.env:
record.req_preamble = "%8x/%s: " % (self.req.req_id or 0, self.req.path) record.req_preamble = "%08x/%s: " % (self.req.req_id or 0, self.req.path)
else: else:
record.req_preamble = "" record.req_preamble = ""
return True return True
...@@ -176,7 +176,7 @@ class Client(namedtuple("ClientTuple", ...@@ -176,7 +176,7 @@ class Client(namedtuple("ClientTuple",
"%s(id=%i, registered=%s, requestor=\"%s\", hostname=\"%s\", " "%s(id=%i, registered=%s, requestor=\"%s\", hostname=\"%s\", "
"service=\"%s\", note=\"%s\", identity=\"%s\", secret=%s, " "service=\"%s\", note=\"%s\", identity=\"%s\", secret=%s, "
"read=%i, debug=%i, write=%i, test=%i)") % ( "read=%i, debug=%i, write=%i, test=%i)") % (
type(self).__name__, self.id, self.registered.isoformat(), type(self).__name__, self.id, self.registered,
self.requestor, self.hostname, self.service, self.note, self.requestor, self.hostname, self.service, self.note,
self.identity, "..." if self.secret is not None else "None", self.identity, "..." if self.secret is not None else "None",
self.read, self.debug, self.write, self.test) self.read, self.debug, self.write, self.test)
...@@ -371,11 +371,10 @@ class JSONSchemaValidator(NoValidator): ...@@ -371,11 +371,10 @@ class JSONSchemaValidator(NoValidator):
res = [] res = []
for error in sorted(self.validator.iter_errors(event), key=sortkey): for error in sorted(self.validator.iter_errors(event), key=sortkey):
res.append( res.append(
"Validation error: key \"%s\", value \"%s\", expected - %s, error message - %s\n" % ( "Validation error: key \"%s\", value \"%s\", expected - %s" % (
u"/".join(str(v) for v in error.path), u"/".join(str(v) for v in error.path),
error.instance, error.instance,
error.schema.get('description', 'no additional info'), error.schema.get('description', 'no additional info')))
error.message))
return res return res
...@@ -844,6 +843,7 @@ class WardenHandler(ObjectReq): ...@@ -844,6 +843,7 @@ class WardenHandler(ObjectReq):
if self.req.client.test and not 'Test' in event.get('Category', []): if self.req.client.test and not 'Test' in event.get('Category', []):
errs[i] = ["You're allowed to send only messages, containing \"Test\" among categories."] errs[i] = ["You're allowed to send only messages, containing \"Test\" among categories."]
continue
db_errs = self.db.store_event(self.req.client, event) db_errs = self.db.store_event(self.req.client, event)
if db_errs: if db_errs:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment