MCPcopy Create free account
hub / github.com/secdev/scapy / lazy_init

Method lazy_init

scapy/modules/p0fv2.py:58–86  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

56 # self.ttl_range=[255]
57
58 def lazy_init(self):
59 try:
60 f = open(self.filename)
61 except IOError:
62 warning("Can't open base %s", self.filename)
63 return
64 try:
65 self.base = []
66 for line in f:
67 if line[0] in ["#", "\n"]:
68 continue
69 line = tuple(line.split(":"))
70 if len(line) < 8:
71 continue
72
73 def a2i(x):
74 if x.isdigit():
75 return int(x)
76 return x
77 li = [a2i(e) for e in line[1:4]]
78 # if li[0] not in self.ttl_range:
79 # self.ttl_range.append(li[0])
80 # self.ttl_range.sort()
81 self.base.append((line[0], li[0], li[1], li[2], line[4],
82 line[5], line[6], line[7][:-1]))
83 except Exception:
84 warning("Can't parse p0f database (new p0f version ?)")
85 self.base = None
86 f.close()
87
88
89p0f_kdb, p0fa_kdb, p0fr_kdb, p0fo_kdb = None, None, None, None

Callers

nothing calls this directly

Calls 3

warningFunction · 0.90
appendMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected