Python socket.BTPROTO_L2CAP() Examples

The following are code examples for showing how to use socket.BTPROTO_L2CAP(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the ones you don't like. You can also save this page to your account.

Example 1
Project: CyberScan   Author: medbenali   File: bluetooth.py    (license) View Source Project 5 votes vote down vote up
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 
Example 2
Project: hostapd-mana   Author: adde88   File: bluetooth.py    (license) View Source Project 5 votes vote down vote up
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 
Example 3
Project: CVE-2016-6366   Author: RiskSense-Ops   File: bluetooth.py    (license) View Source Project 5 votes vote down vote up
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 
Example 4
Project: hakkuframework   Author: 4shadoww   File: bluetooth.py    (license) View Source Project 5 votes vote down vote up
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 
Example 5
Project: trex-http-proxy   Author: alwye   File: bluetooth.py    (license) View Source Project 5 votes vote down vote up
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 
Example 6
Project: trex-http-proxy   Author: alwye   File: bluetooth.py    (license) View Source Project 5 votes vote down vote up
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 
Example 7
Project: scapy-bpf   Author: guedou   File: bluetooth.py    (license) View Source Project 5 votes vote down vote up
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 
Example 8
Project: sslstrip-hsts-openwrt   Author: adde88   File: bluetooth.py    (license) View Source Project 5 votes vote down vote up
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 
Example 9
Project: scapy-radio   Author: BastilleResearch   File: bluetooth.py    (license) View Source Project 5 votes vote down vote up
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 
Example 10
Project: isf   Author: w3h   File: bluetooth.py    (license) View Source Project 5 votes vote down vote up
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 
Example 11
Project: scapy-vxlan   Author: p4lang   File: bluetooth.py    (license) View Source Project 5 votes vote down vote up
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 
Example 12
Project: derplearning   Author: John-Ellis   File: dualshock4.py    (license) View Source Project 5 votes vote down vote up
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 
Example 13
Project: PyQYT   Author: collinsctk   File: bluetooth.py    (license) View Source Project 5 votes vote down vote up
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