From 7d8ee102a36d5ba72f6e4d91ed37a68e5d44221e Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Mon, 18 Aug 2014 15:58:06 +0200 Subject: [PATCH 1/3] Assignment before use (if Enumerate fails) --- bin/packages/Paste.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/packages/Paste.py b/bin/packages/Paste.py index f8c6dffa..2d9b5790 100755 --- a/bin/packages/Paste.py +++ b/bin/packages/Paste.py @@ -117,6 +117,7 @@ class Paste(object): if self.p_nb_lines is None or self.p_max_length_line is None: max_length_line = 0 f = self.get_p_content_as_file() + line_id = 0 for line_id, line in enumerate(f): length = len(line) if length >= max_length_line: From e8fcea6cd601f0f60f48d219d7c2abd701d2e112 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Mon, 18 Aug 2014 16:17:36 +0200 Subject: [PATCH 2/3] Remove undeclared variable --- bin/ZMQ_Sub_Urls.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/ZMQ_Sub_Urls.py b/bin/ZMQ_Sub_Urls.py index 1ba8f892..89b556a4 100755 --- a/bin/ZMQ_Sub_Urls.py +++ b/bin/ZMQ_Sub_Urls.py @@ -109,12 +109,11 @@ def main(): if cc is not None and cc != "EU": print hostl, asn, cc, pycountry.countries.get(alpha2=cc).name if cc == cc_critical: - # FIXME: That's going to fail. - publisher.warning('{0};{1};{2};{3};{4}'.format("Url", PST.p_source, PST.p_date, PST.p_name, "Detected " + str(A_values[0]) + " " + hostl + " " + cc)) + publisher.warning('{0};{1};{2};{3};{4}'.format("Url", PST.p_source, PST.p_date, PST.p_name, "Detected " + hostl + " " + cc)) else: print hostl, asn, cc - A_values = lib_refine.checking_A_record(r_serv2, domains_list) + A_values = lib_refine.checking_A_record(r_serv2, domains_list) if A_values[0] >= 1: PST.__setattr__(channel, A_values) PST.save_attribute_redis(r_serv1, channel, (A_values[0], list(A_values[1]))) From 1d64dc44c8f006edb54f54d605496b4475d1de44 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Wed, 20 Aug 2014 10:22:33 +0200 Subject: [PATCH 3/3] MIME type guessing - removed one duplicate call to libmagic --- bin/packages/Paste.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bin/packages/Paste.py b/bin/packages/Paste.py index 2d9b5790..fddae0f9 100755 --- a/bin/packages/Paste.py +++ b/bin/packages/Paste.py @@ -134,10 +134,7 @@ class Paste(object): :Example: PST._set_p_encoding() """ - try: - return magic.Magic(mime_encoding=True).from_buffer(self.get_p_content()) - except magic.MagicException: - pass + return self.p_mime def _set_p_hash_kind(self, hashkind): """