当前位置: 首页>>代码示例>>Python>>正文


Python rtp.RTP属性代码示例

本文整理汇总了Python中scapy.layers.rtp.RTP属性的典型用法代码示例。如果您正苦于以下问题:Python rtp.RTP属性的具体用法?Python rtp.RTP怎么用?Python rtp.RTP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在scapy.layers.rtp的用法示例。


在下文中一共展示了rtp.RTP属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: voip_play3

# 需要导入模块: from scapy.layers import rtp [as 别名]
# 或者: from scapy.layers.rtp import RTP [as 别名]
def voip_play3(lst=None,**kargs):
    dsp,rd = os.popen2("sox -t .ul - -t ossdsp /dev/dsp")
    try:
        def play(pkt, dsp=dsp):
            if pkt and pkt.haslayer(UDP) and pkt.haslayer(Raw):
                dsp.write(pkt.getlayer(RTP).load)
        if lst is None:
            sniff(store=0, prn=play, **kargs)
        else:
            for p in lst:
                play(p)
    finally:
        try:
            dsp.close()
            rd.close()
        except:
            pass 
开发者ID:medbenali,项目名称:CyberScan,代码行数:19,代码来源:voip.py

示例2: voip_play3

# 需要导入模块: from scapy.layers import rtp [as 别名]
# 或者: from scapy.layers.rtp import RTP [as 别名]
def voip_play3(lst=None,**kargs):
    dsp,rd = os.popen2("sox -t .ul - -t ossdsp /dev/dsp")
    try:
        def play(pkt, dsp=dsp):
            if pkt and pkt.haslayer(UDP) and pkt.haslayer(conf.raw_layer):
                dsp.write(pkt.getlayer(RTP).load)
        if lst is None:
            sniff(store=0, prn=play, **kargs)
        else:
            for p in lst:
                play(p)
    finally:
        try:
            dsp.close()
            rd.close()
        except:
            pass 
开发者ID:theralfbrown,项目名称:smod-1,代码行数:19,代码来源:voip.py

示例3: voip_play3

# 需要导入模块: from scapy.layers import rtp [as 别名]
# 或者: from scapy.layers.rtp import RTP [as 别名]
def voip_play3(lst=None, **kargs):
    """Same than voip_play, but made to
    read and play VoIP RTP packets, without
    checking IP.

    .. seealso:: voip_play
    for basic VoIP packets
    """
    proc = subprocess.Popen(sox_base[0] + sox_base[1], stdin=subprocess.PIPE,
                            stdout=subprocess.PIPE)
    dsp, rd = proc.stdin, proc.stdout

    def play(pkt, dsp=dsp):
        if pkt and pkt.haslayer(UDP) and pkt.haslayer(RTP):
            dsp.write(pkt.getlayer(RTP).load)
    try:
        if lst is None:
            sniff(store=0, prn=play, **kargs)
        else:
            for p in lst:
                play(p)
    finally:
        try:
            dsp.close()
            rd.close()
        except Exception:
            pass 
开发者ID:secdev,项目名称:scapy,代码行数:29,代码来源:voip.py

示例4: voip_play

# 需要导入模块: from scapy.layers import rtp [as 别名]
# 或者: from scapy.layers.rtp import RTP [as 别名]
def voip_play(s1, lst=None, **kargs):
    """Play VoIP packets with RAW data that
    are either sniffed either from an IP, or
    specified as a list.

    It will play only the incoming packets !

    :param s1: The IP of the src of all VoIP packets.
    :param lst: (optional) A list of packets to load
    :type s1: string
    :type lst: list

    :Example:

    >>> voip_play("64.2.142.189")
    while calling '411@ideasip.com'

    >>> voip_play("64.2.142.189", lst)
    with list a list of packets with VoIP data
    in their RAW layer

    .. seealso:: voip_play2
    to play both the outcoming and incoming packets
    at the same time.

    .. seealso:: voip_play3
    to read RTP VoIP packets
    """

    proc = subprocess.Popen(sox_base[0] + sox_base[1], stdin=subprocess.PIPE,
                            stdout=subprocess.PIPE)
    dsp, rd = proc.stdin, proc.stdout

    def play(pkt):
        if not pkt:
            return
        if not pkt.haslayer(UDP) or not pkt.haslayer(IP):
            return
        ip = pkt.getlayer(IP)
        if s1 == ip.src:
            dsp.write(pkt.getlayer(conf.raw_layer).load[12:])
    try:
        if lst is None:
            sniff(store=0, prn=play, **kargs)
        else:
            for p in lst:
                play(p)
    finally:
        dsp.close()
        rd.close() 
开发者ID:secdev,项目名称:scapy,代码行数:52,代码来源:voip.py


注:本文中的scapy.layers.rtp.RTP属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。