项目所用物品
硬件组件sudo apt-get update
sudo apt-getinstall -y tcpdump iw python3-dev python3-pip libjpeg8-dev zlib1g-dev libffi-dev python3-numpy
sudo pip3 install--upgrade pip
安装rpi-security服务,重新加载systemd配置并启用服务:sudo pip3 install https://github.com/FutureSharks/rpi-security/archive/master.zip
sudo systemctl daemon-reload
sudo systemctl enable rpi-security.service
在/etc/rpi-security.conf文件中添加你的MAC地址、Telegram机器人API密钥以及任何其他需要更改的配置。sudosystemctlstartrpi-security.service
你需要至少向Telegram机器人发送一条消息,以便服务能够保存你的Telegram chat_id。发送/status命令即可。rpi-security作为服务运行,并将日志记录到syslog中。要查看日志,请检查 /var/log/syslog。还有一个调试选项,它将日志输出到stdout:root@raspberrypi:~# iw phy phy0 interface add mon0 type monitor
root@raspberrypi:~# ifconfig mon0 up
root@raspberrypi:~# rpi-security.py -d
2016-05-2814:43:30 DEBUG rpi-security.py:73 MainThread State file read: /var/lib/rpi-security/state.yaml
2016-05-2814:43:30 DEBUG rpi-security.py:44 MainThread Calculated network:192.168.178.0/24
2016-05-2814:43:41 INFO rpi-security.py:214 monitor_alarm_state thread running
2016-05-2814:43:41 INFO rpi-security.py:196 capture_packets thread running
2016-05-2814:43:41 INFO rpi-security.py:259 telegram_bot thread running
2016-05-2814:43:41 INFO rpi-security.py:154 process_photos thread running
2016-05-2814:43:43 INFO rpi-security.py:392 MainThread rpi-security running
2016-05-2814:43:43 INFO rpi-security.py:112 MainThread Telegram message Sent:"rpi-security running"
2016-05-2814:44:29 DEBUG rpi-security.py:191 capture_packets Packet detected from aa:aa:aa:bb:bb:bb
2016-05-2814:44:29 DEBUG rpi-security.py:191 capture_packets Packet detected from aa:aa:aa:bb:bb:bb
2016-05-2814:44:48 DEBUG rpi-security.py:280 Dummy-1 Motion detected but current_state is: disarmed
这就是Raspberry Pi A+模型所需要的全部内容。这显示了我的无线局域网网络设备布局:root@raspberrypi:~# iw dev
phy#0
Interfacemon0
ifindex4
wdev0x3
addr00:0f:60:08:9c:01
typemonitor
Interfacewlan0
ifindex2
wdev0x1
addr00:0f:60:08:9c:01
typemanaged
channel1 (2412 MHz), width: 40 MHz, center1: 2422 MHz
你可能会遇到具有不同名称的接口,只需在/etc/rpi-security.conf 文件中更改 network_interface 参数,并同时更改 rpi-security.service 中对 mon0 的引用即可。echo'*/20 * * * * root /usr/bin/host api.telegram.org > /dev/null 2>1 || (/usr/bin/logger "Rebooting due to connectivity issue"; /sbin/shutdown -r now)' > /etc/cron.d/reboot-on-connection-failure
自定义部件和外壳硬件详情作者: 树莓派开发者, 来源:面包板社区
链接: https://mbb.eet-china.com/blog/uid-me-4034091.html
版权声明:本文为博主原创,未经本人允许,禁止转载!
文章评论(0条评论)
登录后参与讨论