Ubuntu 20.04编译安装 spooftooph
Posted 修不好的BUG
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu 20.04编译安装 spooftooph相关的知识,希望对你有一定的参考价值。
Ubuntu 20.04 编译安装spooftooph
从kali gitlab仓库下载spooftooph源码
链接: https://gitlab.com/kalilinux/packages/spooftooph.
复制链接,然后使用git 下载(wget、迅雷、浏览器都行)。
git clone https://gitlab.com/kalilinux/packages/spooftooph.git
root@ubuntu:~# git clone https://gitlab.com/kalilinux/packages/spooftooph.git
Cloning into 'spooftooph'...
remote: Enumerating objects: 101, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 101 (delta 7), reused 0 (delta 0), pack-reused 81
Receiving objects: 100% (101/101), 45.31 KiB | 75.00 KiB/s, done.
Resolving deltas: 100% (31/31), done.
root@ubuntu:~# ls
snap spooftooph
root@ubuntu:~# cd spooftooph/
root@ubuntu:~/spooftooph# ls
bdaddr.c CHANGELOG dev_class.c namelist.c oui.h spooftooph.c
btdev.h debian makefile oui.c README
root@ubuntu:~/spooftooph#
编译并安装spoorftooph
root@ubuntu:~/spooftooph# make
gcc -lbluetooth -lncurses -pthread dev_class.c namelist.c spooftooph.c bdaddr.c oui.c -o spooftooph
spooftooph.c:35:10: fatal error: bluetooth/bluetooth.h: No such file or directory
35 | #include <bluetooth/bluetooth.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
bdaddr.c:36:10: fatal error: bluetooth/bluetooth.h: No such file or directory
36 | #include <bluetooth/bluetooth.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [makefile:12: spooftooph] Error 1
出现错误,缺少头文件 bluetooth.h
sudo apt install libbluetooth-dev
然后进入/usr/include/bluetooth目录,查看是不是有了头文件。
root@ubuntu:/usr/include/bluetooth# ls
bluetooth.h cmtp.h hci_lib.h l2cap.h sco.h sdp_lib.h
bnep.h hci.h hidp.h rfcomm.h sdp.h
然后再次编译spoorftooph,发现有很多未定义错误
...
bdaddr.c:(.text+0x952): undefined reference to `hci_open_dev'
/usr/bin/ld: bdaddr.c:(.text+0x9be): undefined reference to `hci_devinfo'
/usr/bin/ld: bdaddr.c:(.text+0xa0b): undefined reference to `hci_close_dev'
/usr/bin/ld: bdaddr.c:(.text+0xa31): undefined reference to `hci_read_local_version'
/usr/bin/ld: bdaddr.c:(.text+0xa7e): undefined reference to `hci_close_dev'
/usr/bin/ld: bdaddr.c:(.text+0xaef): undefined reference to `hci_read_bd_addr'
/usr/bin/ld: bdaddr.c:(.text+0xb3c): undefined reference to `hci_close_dev'
/usr/bin/ld: bdaddr.c:(.text+0xb7e): undefined reference to `bt_compidtostr'
/usr/bin/ld: bdaddr.c:(.text+0xbaa): undefined reference to `ba2oui'
/usr/bin/ld: bdaddr.c:(.text+0xbd3): undefined reference to `ba2str'
/usr/bin/ld: bdaddr.c:(.text+0xc44): undefined reference to `str2ba'
/usr/bin/ld: bdaddr.c:(.text+0xc98): undefined reference to `hci_close_dev'
/usr/bin/ld: bdaddr.c:(.text+0xcfb): undefined reference to `ba2oui'
/usr/bin/ld: bdaddr.c:(.text+0xd24): undefined reference to `ba2str'
/usr/bin/ld: bdaddr.c:(.text+0xde7): undefined reference to `hci_close_dev'
/usr/bin/ld: bdaddr.c:(.text+0xea9): undefined reference to `hci_close_dev'
/usr/bin/ld: bdaddr.c:(.text+0xef2): undefined reference to `hci_close_dev'
collect2: error: ld returned 1 exit status
make: *** [makefile:12: spooftooph] Error 1
这是因为makefile中把lib库引用放到源文件前面了,只要修改一下makefile,或者直接使用gcc编译就可以了。
gcc dev_class.c namelist.c spooftooph.c bdaddr.c oui.c -o spooftooph -lbluetooth -lncurses -pthread
然后就会发现当前目录下多出了一个spoorftooph可执行文件
root@ubuntu:~/spooftooph# ls
bdaddr.c CHANGELOG dev_class.c namelist.c oui.h spooftooph
btdev.h debian makefile oui.c README spooftooph.c
执行一下试试:
root@ubuntu:~/spooftooph# ./spooftooph
spooftooph v0.5.2 by JP Dunning (.ronin)
<www.hackfromacave.com>
(c) 2009-2012 Shadow Cave LLC.
NAME
spooftooph
SYNOPSIS
spooftooph -i dev [-mstu] [-nac]|[-R]|[-r file] [-w file]
DESCRIPTION
-a <address> : Specify new BD_ADDR
-b <num_lines> : Number of Bluetooth profiles to display per page
-B : Disable banner for smaller screens (like phones)
-c <class> : Specify new CLASS
-h : Help
-i <dev> : Specify interface
-m : Specify multiple interfaces during selection
-n <name> : Specify new NAME
-r <file> : Read in CSV logfile
-R : Assign random NAME, CLASS, and ADDR
-s : Scan for devices in local area
-t <time> : Time interval to clone device in range
-u : USB delay. Interactive delay for reinitializing interface
-w <file> : Write to CSV logfile
(Useful in Virtualized environment when USB must be passed through.)
这样就大功告成了。
或者安装到bin目录
sudo make install
以上是关于Ubuntu 20.04编译安装 spooftooph的主要内容,如果未能解决你的问题,请参考以下文章
记录ubuntu20.04成功编译安装opencv4 c++环境
记录ubuntu20.04成功编译安装opencv4 c++环境
Ubuntu 20.04下源码编译安装ROS 2 Foxy Fitzroy