-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from PabloCamp0s/main
Support both python3 (C300X) and python2 (C100X)
- Loading branch information
Showing
4 changed files
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
#!/bin/sh | ||
|
||
python="$( [ -x '/usr/bin/python' ] && echo '/usr/bin/python' || echo '/usr/bin/python3')" | ||
if [ -n "${MQTT_USER}" ]; then | ||
/usr/sbin/tcpdump -i lo -U not udp and not icmp and not port 5007 and not port 5060 and not port 20000 and not dst port 30006 -A -q -l 2>&1 | /usr/bin/python3 /home/root/filter.py | /usr/bin/mosquitto_pub -l -h ${MQTT_HOST} -p ${MQTT_PORT} -u ${MQTT_USER} -P ${MQTT_PASS} -t ${TOPIC_DUMP} | ||
/usr/sbin/tcpdump -i lo -U not udp and not icmp and not port 5007 and not port 5060 and not port 20000 and not dst port 30006 -A -q -l 2>&1 | "${python}" /home/root/filter.py | /usr/bin/mosquitto_pub -l -h ${MQTT_HOST} -p ${MQTT_PORT} -u ${MQTT_USER} -P ${MQTT_PASS} -t ${TOPIC_DUMP} | ||
elif [ -n "${MQTT_CAFILE}" ]; then | ||
/usr/sbin/tcpdump -i lo -U not udp and not icmp and not port 5007 and not port 5060 and not port 20000 and not dst port 30006 -A -q -l 2>&1 | /usr/bin/python3 /home/root/filter.py | /usr/bin/mosquitto_pub -l -h ${MQTT_HOST} -p ${MQTT_PORT} -t ${TOPIC_DUMP} --cafile ${MQTT_CAFILE} --cert ${MQTT_CERTFILE} --key ${MQTT_KEYFILE} | ||
/usr/sbin/tcpdump -i lo -U not udp and not icmp and not port 5007 and not port 5060 and not port 20000 and not dst port 30006 -A -q -l 2>&1 | "${python}" /home/root/filter.py | /usr/bin/mosquitto_pub -l -h ${MQTT_HOST} -p ${MQTT_PORT} -t ${TOPIC_DUMP} --cafile ${MQTT_CAFILE} --cert ${MQTT_CERTFILE} --key ${MQTT_KEYFILE} | ||
else | ||
/usr/sbin/tcpdump -i lo -U not udp and not icmp and not port 5007 and not port 5060 and not port 20000 and not dst port 30006 -A -q -l 2>&1 | /usr/bin/python3 /home/root/filter.py | /usr/bin/mosquitto_pub -l -h ${MQTT_HOST} -p ${MQTT_PORT} -t ${TOPIC_DUMP} | ||
/usr/sbin/tcpdump -i lo -U not udp and not icmp and not port 5007 and not port 5060 and not port 20000 and not dst port 30006 -A -q -l 2>&1 | "${python}" /home/root/filter.py | /usr/bin/mosquitto_pub -l -h ${MQTT_HOST} -p ${MQTT_PORT} -t ${TOPIC_DUMP} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
from __future__ import print_function | ||
import sys | ||
import time | ||
|
||
|