Python socket 模块,BTPROTO_L2CAP 实例源码

我们从Python开源项目中,提取了以下13个代码示例,用于说明如何使用socket.BTPROTO_L2CAP

项目:CyberScan    作者:medbenali    | 项目源码 | 文件源码
def __init__(self, peer):
        s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW,
                          socket.BTPROTO_L2CAP)
        s.connect((peer,0))

        self.ins = self.outs = s
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def __init__(self, peer):
        s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW,
                          socket.BTPROTO_L2CAP)
        s.connect((peer,0))

        self.ins = self.outs = s
项目:CVE-2016-6366    作者:RiskSense-Ops    | 项目源码 | 文件源码
def __init__(self, peer):
        s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW,
                          socket.BTPROTO_L2CAP)
        s.connect((peer,0))

        self.ins = self.outs = s
项目:hakkuframework    作者:4shadoww    | 项目源码 | 文件源码
def __init__(self, peer):
        s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW,
                          socket.BTPROTO_L2CAP)
        s.connect((peer,0))

        self.ins = self.outs = s
项目:trex-http-proxy    作者:alwye    | 项目源码 | 文件源码
def __init__(self, peer):
        s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW,
                          socket.BTPROTO_L2CAP)
        s.connect((peer,0))

        self.ins = self.outs = s
项目:trex-http-proxy    作者:alwye    | 项目源码 | 文件源码
def __init__(self, peer):
        s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW,
                          socket.BTPROTO_L2CAP)
        s.connect((peer,0))

        self.ins = self.outs = s
项目:scapy-bpf    作者:guedou    | 项目源码 | 文件源码
def __init__(self, peer):
        s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW,
                          socket.BTPROTO_L2CAP)
        s.connect((peer,0))

        self.ins = self.outs = s
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def __init__(self, peer):
        s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW,
                          socket.BTPROTO_L2CAP)
        s.connect((peer,0))

        self.ins = self.outs = s
项目:scapy-radio    作者:BastilleResearch    | 项目源码 | 文件源码
def __init__(self, peer):
        s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW,
                          socket.BTPROTO_L2CAP)
        s.connect((peer,0))

        self.ins = self.outs = s
项目:isf    作者:w3h    | 项目源码 | 文件源码
def __init__(self, peer):
        s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW,
                          socket.BTPROTO_L2CAP)
        s.connect((peer,0))

        self.ins = self.outs = s
项目:scapy-vxlan    作者:p4lang    | 项目源码 | 文件源码
def __init__(self, peer):
        s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW,
                          socket.BTPROTO_L2CAP)
        s.connect((peer,0))

        self.ins = self.outs = s
项目:derplearning    作者:John-Ellis    | 项目源码 | 文件源码
def __init__(self, config, full_config):
        super(Dualshock4, self).__init__(config, full_config)

        # bluetooth control socket
        self.report_id = 0x11
        self.report_size = 79
        self.ctrl_socket = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_SEQPACKET,
                                         socket.BTPROTO_L2CAP)
        self.intr_socket = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_SEQPACKET,
                                         socket.BTPROTO_L2CAP)

        # Prepare packet
        self.packet = bytearray(79)
        self.packet[0] = 0x52
        self.packet[1] = self.report_id
        self.packet[2] = 0x80
        self.packet[4] = 0xFF

        # The deadzone of the analog sticks to ignore them
        self.deadzone = self.config['deadzone']        
        self.left_analog_active = False
        self.right_analog_active = False
        self.left_trigger_active = False
        self.right_trigger_active = False
        self.up_active = False
        self.down_active = False
        self.left_active = False
        self.right_active = False

        n_attemps = 5
        for attempt in range(n_attemps):
            print("Attempt %i of %i" % (attempt + 1, n_attemps), end='\r')
            cmd = ["hcitool", "scan", "--flush"]
            res = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf8")
            for _, address, name in [l.split("\t") for l in res.splitlines()[1:]]:
                if name == "Wireless Controller":
                    self.ctrl_socket.connect((address, 0x11))
                    self.intr_socket.connect((address, 0x13))
                    self.intr_socket.setblocking(False)
                    self.ready = True
                    return
项目:PyQYT    作者:collinsctk    | 项目源码 | 文件源码
def __init__(self, peer):
        s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW,
                          socket.BTPROTO_L2CAP)
        s.connect((peer,0))

        self.ins = self.outs = s