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


Python TCP.flags方法代码示例

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


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

示例1: p0f_selectdb

# 需要导入模块: from scapy.layers.inet import TCP [as 别名]
# 或者: from scapy.layers.inet.TCP import flags [as 别名]
def p0f_selectdb(flags):
    # tested flags: S, R, A
    if flags & 0x16 == 0x2:
        # SYN
        return p0f_kdb
    elif flags & 0x16 == 0x12:
        # SYN/ACK
        return p0fa_kdb
    elif flags & 0x16 in [ 0x4, 0x14 ]:
        # RST RST/ACK
        return p0fr_kdb
    elif flags & 0x16 == 0x10:
        # ACK
        return p0fo_kdb
    else:
        return None 
开发者ID:medbenali,项目名称:CyberScan,代码行数:18,代码来源:p0f.py

示例2: prnp0f

# 需要导入模块: from scapy.layers.inet import TCP [as 别名]
# 或者: from scapy.layers.inet.TCP import flags [as 别名]
def prnp0f(pkt):
    # we should print which DB we use
    try:
        r = p0f(pkt)
    except:
        return
    if r == []:
        r = ("UNKNOWN", "[" + ":".join(map(str, packet2p0f(pkt)[1])) + ":?:?]", None)
    else:
        r = r[0]
    uptime = None
    try:
        uptime = pkt2uptime(pkt)
    except:
        pass
    if uptime == 0:
        uptime = None
    res = pkt.sprintf("%IP.src%:%TCP.sport% - " + r[0] + " " + r[1])
    if uptime is not None:
        res += pkt.sprintf(" (up: " + str(uptime/3600) + " hrs)\n  -> %IP.dst%:%TCP.dport% (%TCP.flags%)")
    else:
        res += pkt.sprintf("\n  -> %IP.dst%:%TCP.dport% (%TCP.flags%)")
    if r[2] is not None:
        res += " (distance " + str(r[2]) + ")"
    print res 
开发者ID:medbenali,项目名称:CyberScan,代码行数:27,代码来源:p0f.py

示例3: p0f_selectdb

# 需要导入模块: from scapy.layers.inet import TCP [as 别名]
# 或者: from scapy.layers.inet.TCP import flags [as 别名]
def p0f_selectdb(flags):
    # tested flags: S, R, A
    if flags & 0x16 == 0x2:
        # SYN
        return p0f_kdb
    elif flags & 0x16 == 0x12:
        # SYN/ACK
        return p0fa_kdb
    elif flags & 0x16 in [0x4, 0x14]:
        # RST RST/ACK
        return p0fr_kdb
    elif flags & 0x16 == 0x10:
        # ACK
        return p0fo_kdb
    else:
        return None 
开发者ID:secdev,项目名称:scapy,代码行数:18,代码来源:p0f.py

示例4: p0f_selectdb

# 需要导入模块: from scapy.layers.inet import TCP [as 别名]
# 或者: from scapy.layers.inet.TCP import flags [as 别名]
def p0f_selectdb(flags):
    # tested flags: S, R, A
    if flags & 0x16 == 0x2:
        # SYN
        return p0f_kdb
    elif flags & 0x16 == 0x12:
        # SYN/ACK
        return p0fa_kdb
    elif flags & 0x16 in [ 0x4, 0x14 ]:
        # RST RST/ACK
        return p0fr_kdb
#    elif flags & 0x16 == 0x10:
        # ACK
#        return p0fo_kdb
    else:
        return None 
开发者ID:entynetproject,项目名称:arissploit,代码行数:18,代码来源:p0f.py

示例5: prnp0f

# 需要导入模块: from scapy.layers.inet import TCP [as 别名]
# 或者: from scapy.layers.inet.TCP import flags [as 别名]
def prnp0f(pkt):
    # we should print which DB we use
    try:
        r = p0f(pkt)
    except:
        return
    if r == []:
        r = ("UNKNOWN", "[" + ":".join([ str(i) for i in packet2p0f(pkt)[1]]) + ":?:?]", None)
    else:
        r = r[0]
    uptime = None
    try:
        uptime = pkt2uptime(pkt)
    except:
        pass
    if uptime == 0:
        uptime = None
    res = pkt.sprintf("%IP.src%:%TCP.sport% - " + r[0] + " " + r[1])
    if uptime is not None:
        res += pkt.sprintf(" (up: " + str(uptime//3600) + " hrs)\n  -> %IP.dst%:%TCP.dport% (%TCP.flags%)")
    else:
        res += pkt.sprintf("\n  -> %IP.dst%:%TCP.dport% (%TCP.flags%)")
    if r[2] is not None:
        res += " (distance " + str(r[2]) + ")"
    print(res) 
开发者ID:entynetproject,项目名称:arissploit,代码行数:27,代码来源:p0f.py

示例6: prnp0f

# 需要导入模块: from scapy.layers.inet import TCP [as 别名]
# 或者: from scapy.layers.inet.TCP import flags [as 别名]
def prnp0f(pkt):
    """Calls p0f and returns a user-friendly output"""
    # we should print which DB we use
    try:
        r = p0f(pkt)
    except Exception:
        return
    if r == []:
        r = ("UNKNOWN", "[" + ":".join(map(str, packet2p0f(pkt)[1])) + ":?:?]", None)  # noqa: E501
    else:
        r = r[0]
    uptime = None
    try:
        uptime = pkt2uptime(pkt)
    except Exception:
        pass
    if uptime == 0:
        uptime = None
    res = pkt.sprintf("%IP.src%:%TCP.sport% - " + r[0] + " " + r[1])
    if uptime is not None:
        res += pkt.sprintf(" (up: " + str(uptime / 3600) + " hrs)\n  -> %IP.dst%:%TCP.dport% (%TCP.flags%)")  # noqa: E501
    else:
        res += pkt.sprintf("\n  -> %IP.dst%:%TCP.dport% (%TCP.flags%)")
    if r[2] is not None:
        res += " (distance " + str(r[2]) + ")"
    print(res) 
开发者ID:secdev,项目名称:scapy,代码行数:28,代码来源:p0f.py


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