Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

pylibpcap: python module for libpcap

#!/usr/bin/env python2
import pcap
import sys
import string
import time
import socket
import struct
protocols={socket.IPPROTO_TCP:'tcp',
           socket.IPPROTO_UDP:'udp',
           socket.IPPROTO_ICMP:'icmp'}
def decode_ip_packet(s):
  d={}
  d['version']=(ord(s[0]) & 0xf0) >> 4
  d['header_len']=ord(s[0]) & 0x0f
  d['tos']=ord(s[1])
  d['total_len']=socket.ntohs(struct.unpack('H',s[2:4])[0])
  d['id']=socket.ntohs(struct.unpack('H',s[4:6])[0])
  d['flags']=(ord(s[6]) & 0xe0) >> 5
  d['fragment_offset']=socket.ntohs(struct.unpack('H',s[6:8])[0] & 0x1f)
  d['ttl']=ord(s[8])
  d['protocol']=ord(s[9])
  d['checksum']=socket.ntohs(struct.unpack('H',s[10:12])[0])
  d['source_address']=pcap.ntoa(struct.unpack('i',s[12:16])[0])
  d['destination_address']=pcap.ntoa(struct.unpack('i',s[16:20])[0])
  if d['header_len']>5:
    d['options']=s[20:4*(d['header_len']-5)]
  else:
    d['options']=None
  d['data']=s[4*d['header_len']:]
  return d
def dumphex(s):
  bytes = map(lambda x: '%.2x' % x, map(ord, s))
  for i in xrange(0,len(bytes)/16):
    print '    %s' % string.join(bytes[i*16:(i+1)*16],' ')
  print '    %s' % string.join(bytes[(i+1)*16:],' ')
   
def print_packet(pktlen, data, timestamp):
  if not data:
    return
  if data[12:14]=='\x08\x00':
    decoded=decode_ip_packet(data[14:])
    print '\n%s.%f %s > %s' % (time.strftime('%H:%M',
                                    &nbs


Ïà¹ØÎĵµ£º

ÔÚLinuxϵͳÉÏʵÏÖÓÃPythonÔ¶³Ì·ÃÎÊOracleÊý¾Ý¿â

1¡¢ÏÂÔØoracleÈí¼þ
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html
oracle-instantclient-basic-10.2.0.4-1.i386.rpm
oracle-instantclient-sqlplus-10.2.0.4-1.i386.rpm
oracle-instantclient-devel-10.2.0.4-1.i386.rpm
2¡¢°²×°rpm°ü
rpm -ivh oracle-instantclient-basic-10.2.0.4 ......

´®¿ÚͨѶµÄpythonÄ£¿é——pySerial

pySerial
Overview
This module encapsulates the access for the serial port. It provides backends for Python running on Windows, Linux, BSD (possibly any POSIX compliant system), Jython and IronPython (.NET and Mono). The module named "serial" automatically selects the appropriate backend.
It is re ......

Python ´®¿ÚÉ豸ӦÓÃ

1. Python ´®¿ÚÉ豸ӦÓÃ
¼òÊö
 
1.1. Ïß³ÌÂÖѰ
 
·ç³¾ÎÞÏÞ <tianyu263@163.com>
-- ·ÖÏí
¾ÍÊÇ´ò¿ª´®¿Úºó£¬Æô¶¯Ò»¸öÏß³ÌÀ´¼àÌý´®¿ÚÊý¾ÝµÄ½øÈ룬ÓÐÊý¾Ýʱ£¬¾Í×öÊý¾ÝµÄ´¦Àí£¨Ò²¿ÉÒÔ·¢ËÍÒ»¸öʼþ£¬²¢Ð¯´ø½ÓÊÕµ½µÄÊý¾Ý£©¡£
 
Toggle line numbers
1
2 #coding=gb18030
3
4 i ......

PythonÍøÂç×¥°ü¿â pypcap

Ethereal ×Ô´øÐí¶àЭÒéµÄ decoder,¼òµ¥,Ò×ÓÃ,»ùÓÚwinpcapµÄÒ»¸ö¿ªÔ´µÄÈí¼þ.µ«ÊÇËüµÄ¼Ü¹¹²¢²»Áé»î,ÈçºÎÄãÒª¼ÓÈëÒ»¸ö×Ô¼º¶¨ÒåµÄµÄ½âÂëÆ÷,µÃÈ¥ÐÞ¸Ä EtherealµÄ´úÂë,ÔÙÖØÐ±àÒë,ºÜ·³Ëö.¶ÔÓÚÒ»°ãµÄÃ÷ÎÄ Ð­Òé,ûÓÐʲôÎÊÌâ,µ«ÊǶÔÓÚ¼ÓÃÜЭÒé,±ÈÈçÍøÂçÓÎÏ·,¿Í»§¶Ë³ÌÐòÒ»°ã»áÔÚ¸ÕÁ¬½ÓÉϵÄʱºò,·¢ËÍÒ»¸öËæ»úÃÜÔ¿,¶øºóµÄ±¨Îͼ»áÓÃÕ⸠......

pythonѧϰ±Ê¼Ç——pcap×¥°ü

½ñÌì¿´¿´ÈçºÎÓÃpythonʵÏÖ×¥°ü¡£
    ÒÔǰÎÒÃÇÔøÓùýwinpcapʵÏÖ×¥°ü£¬Æäʵ½ñÌìÎÒÃÇ»¹ÊÇÓÃËü£¬Ö»²»¹ýÊÇËüÔÚpythonϵÄÄ£¿é£¬ÔÚÓÃ֮ǰÎÒÃDZØÐëÏÈÏÂÔØÁ½¸ö¿â£¬pcap¿âºÍdpkt¿â£¬Õâ¸ö¿ÉÒÔÔÚGoogle codeÀïºÜÈÝÒ×ÕÒµ½£¬ÐèҪעÒâµÄÊÇpcapÖ»Ö§³Öµ½python2.5 £¬ËùÒÔÎÒÃÇÒªÓÃ2.5À´±àд¡£
    °²×°ÍêÁ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ