Skip to content

Commit 6115c03

Browse files
authored
Switch back to scapy, pin some package versions, create new release (#49)
* switch back to scapy * pin some package versions and create new release * fix this version * misc changes
2 parents 2ddb2ab + 8449443 commit 6115c03

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ You can send the Telegram bot commands that trigger certain actions.
7575
The application is written in python 3 and large parts of the functionality are provided by the following pip packages:
7676

7777
- [picamera](https://github.com/waveform80/picamera)
78-
- [kamene](https://github.com/phaethon/kamene)
78+
- [scapy](https://github.com/secdev/scapy)
7979
- [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot)
8080
- [opencv-python](https://github.com/skvark/opencv-python)
8181

@@ -101,7 +101,7 @@ Install open-cv and rpi-security:
101101

102102
```console
103103
sudo pip3 install opencv-contrib-python opencv-contrib-python-headless
104-
sudo pip3 install --no-binary :all: https://github.com/FutureSharks/rpi-security/archive/1.3.zip
104+
sudo pip3 install --no-binary :all: https://github.com/FutureSharks/rpi-security/archive/1.4.zip
105105
```
106106

107107
Reload systemd configuration and enable the service:

rpisec/rpis_security.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
import yaml
77
import logging
88

9-
logging.getLogger("kamene.runtime").setLevel(logging.ERROR)
9+
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
1010

1111
from configparser import SafeConfigParser
1212
from netaddr import IPNetwork
1313
from netifaces import ifaddresses
14-
from kamene.all import srp, Ether, ARP
14+
from scapy.all import srp, Ether, ARP
1515
from telegram import Bot as TelegramBot
1616
from .exit_clean import exit_error
1717
from .rpis_state import RpisState

rpisec/threads/capture_packets.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
import _thread
44
import logging
5-
from kamene.all import sniff
6-
from kamene.all import conf as kamene_conf
7-
kamene_conf.promisc=0
8-
kamene_conf.sniff_promisc=0
5+
from scapy.all import sniff
6+
from scapy.all import conf as scapy_conf
7+
scapy_conf.promisc=0
8+
scapy_conf.sniff_promisc=0
99

1010

1111
logger = logging.getLogger()
1212

1313

1414
def capture_packets(rpis):
1515
"""
16-
This function uses kamene to sniff packets for our MAC addresses and updates
16+
This function uses scapy to sniff packets for our MAC addresses and updates
1717
the alarm state when packets are detected.
1818
"""
19-
logging.getLogger("kamene.runtime").setLevel(logging.ERROR)
19+
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
2020
def update_time(packet):
2121
packet_mac = set(rpis.mac_addresses) & set([packet[0].addr2, packet[0].addr3])
2222
packet_mac_str = list(packet_mac)[0]
@@ -36,5 +36,5 @@ def calculate_filter(mac_addresses):
3636
try:
3737
sniff(iface=rpis.network_interface, store=0, prn=update_time, filter=calculate_filter(rpis.mac_addresses))
3838
except Exception as e:
39-
logger.error('kamene failed to sniff packets with error {0}'.format(repr(e)))
39+
logger.error('scapy failed to sniff packets with error {0}'.format(repr(e)))
4040
_thread.interrupt_main()

setup.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name = 'rpi-security',
5-
version = '1.3',
5+
version = '1.4',
66
author = 'Max Williams',
77
author_email = 'futuresharks@gmail.com',
88
url = 'https://github.com/FutureSharks/rpi-security',
@@ -20,18 +20,18 @@
2020
('/var/lib/rpi-security', ['etc/data.yaml'])
2121
],
2222
install_requires = [
23-
'python-telegram-bot',
24-
'picamera',
25-
'imutils',
23+
'python-telegram-bot==12.2.0',
24+
'picamera==1.13',
25+
'imutils==0.5.2',
2626
'numpy',
2727
'configparser',
2828
'requests',
2929
'requests[security]',
3030
'netaddr',
3131
'netifaces',
3232
'pyyaml',
33-
'kamene',
34-
'Pillow',
33+
'scapy==2.4.3',
34+
'Pillow==6.2.1',
3535
'opencv-contrib-python',
3636
'opencv-contrib-python-headless',
3737
],

0 commit comments

Comments
 (0)