- added completion (rlcompleter) and history support

This commit is contained in:
pbi 2003-04-14 11:53:28 +00:00
parent 7bf5896e6b
commit 2392719a69
1 changed files with 15 additions and 5 deletions

View File

@ -22,6 +22,9 @@
# #
# $Log: scapy.py,v $ # $Log: scapy.py,v $
# Revision 0.9.9.13 2003/04/14 13:53:28 pbi
# - added completion (rlcompleter) and history support
#
# Revision 0.9.9.12 2003/04/14 10:05:42 pbi # Revision 0.9.9.12 2003/04/14 10:05:42 pbi
# - bugfixed the close() method of some supersockets # - bugfixed the close() method of some supersockets
# #
@ -139,7 +142,7 @@
from __future__ import generators from __future__ import generators
RCSID="$Id: scapy.py,v 0.9.9.12 2003/04/14 10:05:42 pbi Exp $" RCSID="$Id: scapy.py,v 0.9.9.13 2003/04/14 13:53:28 pbi Exp $"
VERSION = RCSID.split()[2]+"beta" VERSION = RCSID.split()[2]+"beta"
@ -169,6 +172,10 @@ if __name__ == "__main__":
import scapy import scapy
__builtins__.__dict__.update(scapy.__dict__) __builtins__.__dict__.update(scapy.__dict__)
import rlcompleter,readline
readline.parse_and_bind("tab: complete")
session=None session=None
session_name="" session_name=""
@ -214,9 +221,8 @@ if __name__ == "__main__":
else: else:
session={"conf": scapy.conf} session={"conf": scapy.conf}
if iface is not None: if scapy.conf.histfile:
pass readline.read_history_file(scapy.conf.histfile)
code.interact(banner = "Welcome to Scapy (%s)"%VERSION, local=session) code.interact(banner = "Welcome to Scapy (%s)"%VERSION, local=session)
@ -238,6 +244,9 @@ if __name__ == "__main__":
cPickle.dump(session, f) cPickle.dump(session, f)
f.close() f.close()
if scapy.conf.histfile:
readline.write_history_file(scapy.conf.histfile)
sys.exit() sys.exit()
################## ##################
@ -3117,6 +3126,7 @@ filter : bpf filter added to every sniffing socket to exclude traffic from analy
L3socket = L3PacketSocket L3socket = L3PacketSocket
L2socket = L2Socket L2socket = L2Socket
L2listen = L2ListenSocket L2listen = L2ListenSocket
histfile = os.path.join(os.environ["HOME"], ".scapy_history")
conf=Conf() conf=Conf()