lost and found ( for me ? )

python-dpkt

[ what’s python-dpkt ? ]

python-dpkt is packet creation python modules.
# tail -1 /etc/lsb-release
DISTRIB_DESCRIPTION="Ubuntu 11.04"

install python-dpkt w/ apt-get command
# apt-cache search python-dpkt
python-dpkt - Python packet creation / parsing module

# apt-get install python-dpkt

sample scripts will be installed into /usr/share/doc/python-dpkt/examples directory.
# dpkg -L python-dpkt | egrep examples
/usr/share/doc/python-dpkt/examples
/usr/share/doc/python-dpkt/examples/dhcprequest.py
/usr/share/doc/python-dpkt/examples/dnsping.py
/usr/share/doc/python-dpkt/examples/nbtping.py
/usr/share/doc/python-dpkt/examples/ping.py

python modules will be installed into /usr/share/pyshared/dpkt directory.
# dpkg -L python-dpkt | egrep "pyshared/dpkt" | awk -F \/ '{print $6}'

aim.py
crc32c.py
ah.py
rx.py
gre.py
rtp.py
tpkt.py
sctp.py
icmp.py
ppp.py
__init__.py
rip.py
rfb.py
mrt.py
gzip.py
h225.py
tftp.py
tns.py
dhcp.py
arp.py
smb.py
stun.py
telnet.py
loopback.py
rpc.py
netbios.py
cdp.py
dns.py
ip.py
dpkt.py
ospf.py
diameter.py
pcap.py
tcp.py
qq.py
dtp.py
pmap.py
udp.py
stp.py
pppoe.py
sll.py
ipx.py
ethernet.py
sccp.py
netflow.py
asn1.py
yahoo.py
bgp.py
sip.py
http.py
ip6.py
igmp.py
vrrp.py
ntp.py
pim.py
hsrp.py
icmp6.py
esp.py
radius.py
ssl.py


[ Let’s send ping packets using sample script called ping.py ]

send ping packets w/ /usr/share/doc/python-dpkt/examples/ping.py.
# cp /usr/share/doc/python-dpkt/examples/ping.py .

usage : ping.py targetIP

python-dpkt machine : 192.168.10.14
target IP : 192.168.10.15
# python ping.py 192.168.10.15
PING 192.168.10.15: 12 data bytes
20 bytes from 192.168.10.15: icmp_seq=0 ip_id=61922 ttl=64 time=6.614 ms
20 bytes from 192.168.10.15: icmp_seq=1 ip_id=61923 ttl=64 time=0.600 ms
20 bytes from 192.168.10.15: icmp_seq=2 ip_id=61924 ttl=64 time=0.425 ms

capture data on target machine ( 192.168.10.15 )
# tshark -i br0 icmp
Capturing on br0
 0.000000 192.168.10.14 -> 192.168.10.15 ICMP Echo (ping) request  (id=0x3a4e, seq(be/le)=34/8704, ttl=64)
 0.000023 192.168.10.15 -> 192.168.10.14 ICMP Echo (ping) reply    (id=0x3a4e, seq(be/le)=34/8704, ttl=64)
 1.001911 192.168.10.14 -> 192.168.10.15 ICMP Echo (ping) request  (id=0x8115, seq(be/le)=35/8960, ttl=64)
 1.001930 192.168.10.15 -> 192.168.10.14 ICMP Echo (ping) reply    (id=0x8115, seq(be/le)=35/8960, ttl=64)
 2.003821 192.168.10.14 -> 192.168.10.15 ICMP Echo (ping) request  (id=0xa25d, seq(be/le)=36/9216, ttl=64)
 2.003838 192.168.10.15 -> 192.168.10.14 ICMP Echo (ping) reply    (id=0xa25d, seq(be/le)=36/9216, ttl=64)
^C6 packets captured

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.