-
Notifications
You must be signed in to change notification settings - Fork 28
/
stats
109 lines (101 loc) · 3.35 KB
/
stats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# stats
# KD4Z
# Version: 4.46
# displays stats of various items
clear
. ~/md380tools-vm/strings
EXCLUDEIDS=~/exclude.ids
EXCLUDECOUNTRIES=~/exclude.countries
INCLUDEIDS=~/include.ids
INCLUDECOUNTRIES=~/include.countries
MERGECONFIG=~/md380tools-vm/mergeconfig
FILTERDISABLESEMA=~/filter.disable
FINALALTERNATE=~/alternate_strippedCSV.final
HDSTATICFILE=~/users.csv
FILESTATIC=~/static.users
USERBIN=~/user.bin
echo -e "Collecting information..."
ipin=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
up=$(/usr/bin/uptime)
countHD=$(wc --lines $HDSTATICFILE | cut -d" " -f1)
sizeHD=$(ls -l $HDSTATICFILE | cut -d" " -f5)
countalter=$(wc --lines $FINALALTERNATE | cut -d" " -f1)
if [ -f $USERBIN ]; then
userbinsize=$(ls -l $USERBIN | awk '{print $5,$6,$7,$8,$9}')
countall=$(wc --lines $USERBIN | cut -d" " -f1)
else
userbinsize="Not present"
fi
if [ -f ~/firmware-noGPS.bin ]; then
fwnogps=$(ls -l ~/firmware-noGPS.bin | awk '{print $5,$6,$7,$8,$9}')
else
fwnogps="Not present"
fi
if [ -f ~/firmware-GPS.bin ]; then
fwgps=$(ls -l ~/firmware-GPS.bin | awk '{print $5,$6,$7,$8,$9}')
else
fwgps="Not present"
fi
if [ -f ~/firmware-OLD.bin ]; then
fwold=$(ls -l ~/firmware-OLD.bin | awk '{print $5,$6,$7,$8,$9}')
else
fwold="Not present"
fi
clear
echo -e ""
echo -e "${WHITE}KD4Z Toolkit Stats${NC}"
echo -e ""
echo -e "${GREEN} IP Address : ${YELLOW}${ipin}"
echo -e "${GREEN} Host Uptime :${YELLOW}${up}"
echo -e ""
echo -e "${WHITE}Last build${NC}"
echo -e "${GREEN} Firmware Bin : ${YELLOW}${fwnogps} ${WHITE}(flash)"
echo -e "${GREEN} Firmware Bin GPS : ${YELLOW}${fwgps} ${WHITE}(flashgps)"
echo -e "${GREEN} Firmware OLD : ${YELLOW}${fwold} ${WHITE}(flashold)"
echo -e ""
echo -e "${WHITE}Contact Data${NC}"
echo -e "${GREEN} radioId.net count: ${YELLOW}${countHD} ${GREEN}(${sizeHD} bytes)"
if [ -f $FINALALTERNATE ]; then
sizealter=$(ls -l $FINALALTERNATE | cut -d" " -f5)
echo -e "${GREEN} Alternate count : ${YELLOW}${countalter} ${GREEN}(${sizealter} bytes)"
fi
if [ -f $FILESTATIC ]; then
countstatic=$(wc --lines $FILESTATIC | cut -d" " -f1)
sizestatic=$(ls -l $FILESTATIC | cut -d" " -f5)
echo -e "${GREEN} Static users : ${YELLOW}${countstatic} ${GREEN}(${sizestatic} bytes)"
fi
echo -e "${GREEN} user.bin file : ${YELLOW}${userbinsize} ${WHITE}(flashdb)"
echo -e "${GREEN} user.bin count : ${YELLOW}${countall} "
echo -e ""
MERGECONFIG=~/md380tools-vm/mergeconfig
if [ -f $MERGECONFIG ]; then
echo -e "${WHITE}Contact Filter was Enabled during last run${NC}"
echo -e -n "${YELLOW}"
countfilter=$(wc --lines $MERGECONFIG | cut -d" " -f1)
if (( countfilter < 10 )); then
if [ -f $INCLUDEIDS ]; then
echo -e -n "${GREEN} Include DMR IDs: ${YELLOW}"
awk -F" " 'length($1) {printf " %s,",$1}' $INCLUDEIDS
echo -e ""
fi
if [ -f $INCLUDECOUNTRIES ]; then
echo -e -n "${GREEN} Include Countries: ${YELLOW}"
awk -F" " 'length($1) {printf "%s,",$1}' $INCLUDECOUNTRIES
echo -e ""
fi
if [ -f $EXCLUDEIDS ]; then
echo -e -n "${GREEN} Exclude DMR IDs: ${YELLOW}"
awk -F" " 'length($1) {printf " %s,",$1}' $EXCLUDEIDS
echo -e ""
fi
if [ -f $EXCLUDECOUNTRIES ]; then
echo -e -n "${GREEN} Exclude Countries: ${YELLOW}"
awk -F" " 'length($1) {printf "%s,",$1}' $EXCLUDECOUNTRIES
echo -e ""
fi
fi
fi
echo -e "${NC}"
echo -e ""
echo -e "${YELLOW} menu${NC}\t\t-- Back to main menu "
echo -e ""