mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-12-02 10:47:18 +00:00
Merge pull request #18 from adulau/master
Fix one assignment before use and remove duplicate call to libmagic
This commit is contained in:
commit
a84ffc9ef7
2 changed files with 4 additions and 7 deletions
|
@ -109,12 +109,11 @@ def main():
|
||||||
if cc is not None and cc != "EU":
|
if cc is not None and cc != "EU":
|
||||||
print hostl, asn, cc, pycountry.countries.get(alpha2=cc).name
|
print hostl, asn, cc, pycountry.countries.get(alpha2=cc).name
|
||||||
if cc == cc_critical:
|
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 " + hostl + " " + cc))
|
||||||
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))
|
|
||||||
else:
|
else:
|
||||||
print hostl, asn, cc
|
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:
|
if A_values[0] >= 1:
|
||||||
PST.__setattr__(channel, A_values)
|
PST.__setattr__(channel, A_values)
|
||||||
PST.save_attribute_redis(r_serv1, channel, (A_values[0], list(A_values[1])))
|
PST.save_attribute_redis(r_serv1, channel, (A_values[0], list(A_values[1])))
|
||||||
|
|
|
@ -117,6 +117,7 @@ class Paste(object):
|
||||||
if self.p_nb_lines is None or self.p_max_length_line is None:
|
if self.p_nb_lines is None or self.p_max_length_line is None:
|
||||||
max_length_line = 0
|
max_length_line = 0
|
||||||
f = self.get_p_content_as_file()
|
f = self.get_p_content_as_file()
|
||||||
|
line_id = 0
|
||||||
for line_id, line in enumerate(f):
|
for line_id, line in enumerate(f):
|
||||||
length = len(line)
|
length = len(line)
|
||||||
if length >= max_length_line:
|
if length >= max_length_line:
|
||||||
|
@ -133,10 +134,7 @@ class Paste(object):
|
||||||
:Example: PST._set_p_encoding()
|
:Example: PST._set_p_encoding()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
return self.p_mime
|
||||||
return magic.Magic(mime_encoding=True).from_buffer(self.get_p_content())
|
|
||||||
except magic.MagicException:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _set_p_hash_kind(self, hashkind):
|
def _set_p_hash_kind(self, hashkind):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue