removed unnecessary console links and ttl files
This commit is contained in:
31
simpleadmin/script/sms.sh
Normal file
31
simpleadmin/script/sms.sh
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Check if the required parameters are provided
|
||||||
|
if [ "$#" -ne 2 ]; then
|
||||||
|
echo "Usage: $0 <phone_number> <message>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Assign the provided parameters to variables
|
||||||
|
phone_number="$1"
|
||||||
|
message="$2"
|
||||||
|
|
||||||
|
# Send the AT command to set the message format to text mode
|
||||||
|
echo -ne "AT+CMGF=1\r" > microcom /dev/ttyOUT2
|
||||||
|
sleep 1
|
||||||
|
echo -ne "AT+CNMI=2,1\r" > microcom /dev/ttyOUT2
|
||||||
|
sleep 1
|
||||||
|
echo -ne 'AT+CMGS="09938931024"\r' > microcom /dev/ttyOUT2
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Send the message
|
||||||
|
echo -ne "$message" > microcom /dev/ttyOUT2
|
||||||
|
echo -ne "\032" > microcom /dev/ttyOUT2
|
||||||
|
|
||||||
|
# Wait for the response
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Capture and output the response
|
||||||
|
runcmd=$(microcom /dev/ttyOUT2)
|
||||||
|
# echo "Content-type: text/plain"
|
||||||
|
echo "$runcmd"
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Check iptables for ttlvalue
|
|
||||||
ttlvalue=$(iptables -t mangle -vnL | awk '/TTL/ {print $13; exit}')
|
|
||||||
ttlenabled=true;
|
|
||||||
|
|
||||||
# Set Variables
|
|
||||||
if [ -z "${ttlvalue}" ]; then
|
|
||||||
ttlvalue=0
|
|
||||||
ttlenabled=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Content-type: text/json"
|
|
||||||
echo ""
|
|
||||||
cat <<EOT
|
|
||||||
{
|
|
||||||
"isEnabled": $ttlenabled,
|
|
||||||
"ttl": $ttlvalue
|
|
||||||
}
|
|
||||||
EOT
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Get query
|
|
||||||
QUERY_STRING=$(echo "${QUERY_STRING}" | sed 's/;//g')
|
|
||||||
|
|
||||||
if [ "${QUERY_STRING}" ]; then
|
|
||||||
|
|
||||||
export IFS="&"
|
|
||||||
for cmd in ${QUERY_STRING}; do
|
|
||||||
|
|
||||||
if [ "$(echo $cmd | grep '=')" ]; then
|
|
||||||
key=$(echo $cmd | awk -F '=' '{print $1}')
|
|
||||||
value=$(echo $cmd | awk -F '=' '{print $2}')
|
|
||||||
eval $key=$value
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
setTTL=$(printf '%b\n' "${ttlvalue//%/\\x}")
|
|
||||||
|
|
||||||
if [ -n "${setTTL}" ]; then
|
|
||||||
# Stop Service To Remove Rules
|
|
||||||
/usrdata/simplefirewall/ttl-override stop
|
|
||||||
|
|
||||||
# Check iptables is still set
|
|
||||||
ttlcheck=$(iptables -t mangle -vnL | grep TTL | awk '{print $13}')
|
|
||||||
|
|
||||||
# If TTL is still set manually remove values
|
|
||||||
if [ !-z "${ttlcheck}" ]; then
|
|
||||||
iptables -t mangle -D POSTROUTING -o rmnet+ -j TTL --ttl-set ${ttlcheck} &>/dev/null || true
|
|
||||||
ip6tables -t mangle -D POSTROUTING -o rmnet+ -j HL --hl-set ${ttlcheck} &>/dev/null || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Echo TTL to file
|
|
||||||
echo $setTTL > /usrdata/simplefirewall/ttlvalue
|
|
||||||
|
|
||||||
# Set Start Service
|
|
||||||
/usrdata/simplefirewall/ttl-override start
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check iptables for ttlvalue
|
|
||||||
ttlvalue=$(iptables -t mangle -vnL | grep TTL | awk '{print $13}')
|
|
||||||
ttlenabled=true;
|
|
||||||
|
|
||||||
# Set Variables
|
|
||||||
if [ -z "${ttlvalue}" ]; then
|
|
||||||
ttlvalue=0
|
|
||||||
ttlenabled=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Content-type: text/json"
|
|
||||||
echo ""
|
|
||||||
cat <<EOT
|
|
||||||
{
|
|
||||||
"isEnabled": $ttlenabled,
|
|
||||||
"ttl": $ttlvalue
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user