Read more...
import pcs
from pcs.packets.ethernet import *
from pcs.packets.ipv4 import *
from pcs.packets.tcp import *
def main():
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-i", "--interface",
dest="interface", default=None,
help="Which interface to use for testing.")
(options, args) = parser.parse_args()
sniffer = pcs.PcapConnector(options.interface)
while 1:
rawPacket = sniffer.read()
etherPacket = ethernet(rawPacket)
if type(etherPacket.data) == ipv4:
ipv4Packet = ipv4(etherPacket.data.getbytes())
if type(ipv4Packet.data) == tcp:
tcpPacket = tcp(ipv4Packet.data.getbytes())
print etherPacket.data.data
print ipv4Packet.data
print tcpPacket
print '-------------------------------------'
Tuesday, May 5, 2009
Issues with PCS
Not sure why the below code doesn't print out the same values three times...
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
-
▼
2009
(96)
-
▼
May
(26)
- Logic Validation
- IP and Port Representation
- Oh.
- Rejected Email
- Memorial Day
- Logging Framework Change
- Logging Framework
- Further thoughts on design
- Not Just OS X
- I Love X
- PCS-Current
- Wireshark Behavior
- Wireshark Strangeness
- Structure
- Adding functionality to PCS
- Real Coding Begins!
- Worthwhile Note
- More PCS Issues, Bugreport
- Attempted to update to PCS from Hg
- Finally!
- Back Home
- Moving Back Home
- Issues with PCS
- Playing around with PCS
- Installing PCS and Pyrex on a Mac
- Some Time to Work...
-
▼
May
(26)
No comments:
Post a Comment