Python搜索隐藏的蓝牙

之前的有几篇是在蓝牙开启并且开发放检测才能搜索的到
现在我们打开蓝牙,设置为不能被检测到重新搜索蓝牙

先大致说一下思路
蓝牙的mac地址和开启蓝牙的主机的mac地址很类似
对于iphone而言,蓝牙的mac地址是主机网卡的mac地址加1
对于华为手机而言,比如我的手机的无线网卡mac地址为0c:8f:ff:e0:cc:31
而我的手机上蓝牙的mac地址为0c:8f:ff:e0:c1:e1

所以你先获取无线网卡的mac地址
然后给无线网卡的mac地址加上一特定的数就得到蓝牙的mac地址
根据特定的蓝牙mac地址我们就可以发出一个设备名称的查询请求
这时蓝牙自动会回复我们的
然后就得到了该mac地址蓝牙的设备名称

/////////////////////////////////////////////////////
获取无线网卡的mac地址
在这里只根据mac地址的前6位查找

在此之前你需要将网卡设置为混杂模式
airmon-ng start wlan0

#!/usr/bin/python
# -*- coding: utf-8 -*-

from scapy.all import *

def wifiPrint(pkt):
    iPhone_OUI = '0C:8F:FF'
    if pkt.haslayer(Dot11):
        wifiMAC = pkt.getlayer(Dot11).addr2
        if iPhone_OUI == wifiMAC[:8]:
            print '[*] Detected iPhone MAC: ' + wifiMAC

conf.iface = 'wlan0mon'
sniff(prn=wifiPrint)

开始推算出蓝牙
因为不同的手机其网卡mac地址和蓝牙mac关系不一样
所以在此你自己算一下
用主机的网卡的mac地址减去蓝牙的mac地址
然后填在下面这段程序的AAAAA处

def retBtAddr(addr):
    btAddr=str(hex(int(addr.replace(':', ''), 16) + AAAAA))[2:]
    btAddr=btAddr[0:2]+":"+btAddr[2:4]+":"+btAddr[4:6]+":"+\
    btAddr[6:8]+":"+btAddr[8:10]+":"+btAddr[10:12]
    return btAddr

//////////////////////////////////////////////////////////////

完整代码如下
不要全复制,找我上面的改
#!/usr/bin/python
# -*- coding: utf-8 -*-

from scapy.all import *
from bluetooth import *


def retBtAddr(addr):
    btAddr=str(hex(int(addr.replace(':', ''), 16) + 1))[2:]
    btAddr=btAddr[0:2]+":"+btAddr[2:4]+":"+btAddr[4:6]+":"+\
    btAddr[6:8]+":"+btAddr[8:10]+":"+btAddr[10:12]
    return btAddr

def checkBluetooth(btAddr):
    btName = lookup_name(btAddr)
    if btName:
        print '[+] Detected Bluetooth Device: ' + btName
    else:
        print '[-] Failed to Detect Bluetooth Device.'


def wifiPrint(pkt):
    iPhone_OUI = '0C:8F:FF'
    if pkt.haslayer(Dot11):
        wifiMAC = pkt.getlayer(Dot11).addr2
        if iPhone_OUI == wifiMAC[:8]:
            print '[*] Detected iPhone MAC: ' + wifiMAC
            btAddr = retBtAddr(wifiMAC)
            print '[+] Testing Bluetooth MAC: ' + btAddr
            checkBluetooth(btAddr)

conf.iface = 'mon0'
sniff(prn=wifiPrint)

////////////////////////////////////////////
最后如何查看手机的蓝牙的mac地址和无线网卡的mac地址

设置---关于手机---状态消息

里面就有你的手机IP地址
无线网卡的mac地址
蓝牙mac地址
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值