diff --git a/README.md b/README.md index 535d856..f19fe60 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ You can send the Telegram bot commands that trigger certain actions. The application is written in python 3 and large parts of the functionality are provided by the following pip packages: - [picamera](https://github.com/waveform80/picamera) - - [kamene](https://github.com/phaethon/kamene) + - [scapy](https://github.com/secdev/scapy) - [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) - [opencv-python](https://github.com/skvark/opencv-python) @@ -101,7 +101,7 @@ Install open-cv and rpi-security: ```console sudo pip3 install opencv-contrib-python opencv-contrib-python-headless -sudo pip3 install --no-binary :all: https://github.com/FutureSharks/rpi-security/archive/1.3.zip +sudo pip3 install --no-binary :all: https://github.com/FutureSharks/rpi-security/archive/1.4.zip ``` Reload systemd configuration and enable the service: diff --git a/rpisec/rpis_security.py b/rpisec/rpis_security.py index 6926255..43433b1 100644 --- a/rpisec/rpis_security.py +++ b/rpisec/rpis_security.py @@ -6,12 +6,12 @@ import yaml import logging -logging.getLogger("kamene.runtime").setLevel(logging.ERROR) +logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from configparser import SafeConfigParser from netaddr import IPNetwork from netifaces import ifaddresses -from kamene.all import srp, Ether, ARP +from scapy.all import srp, Ether, ARP from telegram import Bot as TelegramBot from .exit_clean import exit_error from .rpis_state import RpisState diff --git a/rpisec/threads/capture_packets.py b/rpisec/threads/capture_packets.py index dcd1031..bf60b61 100644 --- a/rpisec/threads/capture_packets.py +++ b/rpisec/threads/capture_packets.py @@ -2,10 +2,10 @@ import _thread import logging -from kamene.all import sniff -from kamene.all import conf as kamene_conf -kamene_conf.promisc=0 -kamene_conf.sniff_promisc=0 +from scapy.all import sniff +from scapy.all import conf as scapy_conf +scapy_conf.promisc=0 +scapy_conf.sniff_promisc=0 logger = logging.getLogger() @@ -13,10 +13,10 @@ def capture_packets(rpis): """ - This function uses kamene to sniff packets for our MAC addresses and updates + This function uses scapy to sniff packets for our MAC addresses and updates the alarm state when packets are detected. """ - logging.getLogger("kamene.runtime").setLevel(logging.ERROR) + logging.getLogger("scapy.runtime").setLevel(logging.ERROR) def update_time(packet): packet_mac = set(rpis.mac_addresses) & set([packet[0].addr2, packet[0].addr3]) packet_mac_str = list(packet_mac)[0] @@ -36,5 +36,5 @@ def calculate_filter(mac_addresses): try: sniff(iface=rpis.network_interface, store=0, prn=update_time, filter=calculate_filter(rpis.mac_addresses)) except Exception as e: - logger.error('kamene failed to sniff packets with error {0}'.format(repr(e))) + logger.error('scapy failed to sniff packets with error {0}'.format(repr(e))) _thread.interrupt_main() diff --git a/setup.py b/setup.py index df2caba..876975c 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name = 'rpi-security', - version = '1.3', + version = '1.4', author = 'Max Williams', author_email = 'futuresharks@gmail.com', url = 'https://github.com/FutureSharks/rpi-security', @@ -20,9 +20,9 @@ ('/var/lib/rpi-security', ['etc/data.yaml']) ], install_requires = [ - 'python-telegram-bot', - 'picamera', - 'imutils', + 'python-telegram-bot==12.2.0', + 'picamera==1.13', + 'imutils==0.5.2', 'numpy', 'configparser', 'requests', @@ -30,8 +30,8 @@ 'netaddr', 'netifaces', 'pyyaml', - 'kamene', - 'Pillow', + 'scapy==2.4.3', + 'Pillow==6.2.1', 'opencv-contrib-python', 'opencv-contrib-python-headless', ],