From 51765faf796551efa327b178a0223b353c66bd66 Mon Sep 17 00:00:00 2001 From: Phil <phil@secdev.org> Date: Sun, 10 Aug 2008 19:17:49 +0200 Subject: [PATCH] Changed ls() to take advantage of conf.layers --- scapy/packet.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scapy/packet.py b/scapy/packet.py index 7029a463..92fca3a5 100644 --- a/scapy/packet.py +++ b/scapy/packet.py @@ -1098,13 +1098,13 @@ def split_layers(lower, upper, __fval=None, **fval): def ls(obj=None): """List available layers, or infos on a given layer""" if obj is None: + import __builtin__ all = __builtin__.__dict__.copy() all.update(globals()) - objlst = filter(lambda (n,o): isinstance(o,type) and issubclass(o,Packet), all.items()) - objlst.sort(lambda x,y:cmp(x[0],y[0])) - for n,o in objlst: - print "%-10s : %s" %(n,o.name) + objlst = sorted(conf.layers, key=lambda x:x.__name__) + for o in objlst: + print "%-10s : %s" %(o.__name__,o.name) else: if isinstance(obj, type) and issubclass(obj, Packet): for f in obj.fields_desc: -- GitLab