Progress...

This commit is contained in:
Cameron Thompson
2024-04-21 14:43:44 -04:00
parent 4a7aac1464
commit c395467364
10 changed files with 166 additions and 174 deletions

View File

@@ -1,7 +0,0 @@
#!/bin/bash
#Path
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:opt/bin:/opt/sbin:/usrdata/root/bin
#Post-login execution
start_menu.sh

View File

@@ -1,101 +0,0 @@
#!/bin/sh
# Configuration
DEVICE_FILE="/dev/smd7"
ICCID_FILE="/path/to/iccid_master_file" # Path to the ICCID-APN-IPType master file
TMP_DIR="/tmp"
TIMEOUT=4
# Start listening to device file
start_listening() {
cat "$DEVICE_FILE" > "$TMP_DIR/device_readout" &
CAT_PID=$!
}
# Send AT command
send_at_command() {
local command=$1
echo -e "${command}\r" > "$DEVICE_FILE"
}
# Wait for and process response
wait_for_response() {
local start_time=$(date +%s)
local current_time
local elapsed_time
while true; do
if grep -q "OK" "$TMP_DIR/device_readout" || grep -q "ERROR" "$TMP_DIR/device_readout"; then
RESPONSE=$(cat "$TMP_DIR/device_readout")
echo "Response received: $RESPONSE"
return 0
fi
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [ "$elapsed_time" -ge "$TIMEOUT" ]; then
echo "Error: Response timed out."
return 1
fi
sleep 1
done
}
# Cleanup function
cleanup() {
kill "$CAT_PID"
wait "$CAT_PID" 2>/dev/null
rm -f "$TMP_DIR/device_readout"
}
# Function to send AT command and wait for response
send_and_wait() {
send_at_command "$1"
wait_for_response
}
# Function to update the APN
update_apn() {
local slot=$1
local apn=$2
local iptype=$3
send_and_wait "AT+CGDCONT=$slot,\"$iptype\",\"$apn\""
if [ $? -eq 0 ]; then
echo "APN updated successfully."
else
echo "Failed to update APN."
fi
}
# Main Execution
if [ -c "$DEVICE_FILE" ]; then
start_listening
# Get ICCID
send_and_wait "AT+CCID"
ICCID=$(echo "$RESPONSE" | grep "+CCID" | cut -d ':' -f2 | tr -d '[:space:]')
echo "ICCID: $ICCID"
# Check ICCID in master file
if grep -q "$ICCID" "$ICCID_FILE"; then
APN=$(grep "$ICCID" "$ICCID_FILE" | cut -d ',' -f2)
IP_TYPE=$(grep "$ICCID" "$ICCID_FILE" | cut -d ',' -f3)
IP_TYPE=${IP_TYPE:-"IPV4V6"} # Default to IPV4V6 if not specified
# Get current APN settings
send_and_wait "AT+CGDCONT?"
CURRENT_APN=$(echo "$RESPONSE" | grep "+CGDCONT: 1" | cut -d ',' -f3 | tr -d '"')
# Compare and update APN if necessary
if [ "$APN" != "$CURRENT_APN" ]; then
update_apn 1 "$APN" "$IP_TYPE"
else
echo "No APN update needed."
fi
else
echo "ICCID not found in the master file."
fi
cleanup
else
echo "Error: Device $DEVICE_FILE does not exist or is not a character special file."
fi

View File

@@ -1,21 +0,0 @@
edit_iccid_file() {
local iccid_file="/path/to/iccid_master_file" # Path to the ICCID-APN-IPType master file
echo "Enter ICCID to add or edit:"
read iccid
echo "Enter APN for $iccid:"
read apn
echo "Enter IP Type (IPV4, IPV6, IPV4V6) for $iccid [Default: IPV4V6]:"
read iptype
iptype=${iptype:-"IPV4V6"} # Default to IPV4V6 if not specified
# Check if ICCID already exists
if grep -q "$iccid" "$iccid_file"; then
# Update existing ICCID's APN and IP Type
sed -i "/$iccid/c\\$iccid,$apn,$iptype" "$iccid_file"
else
# Add new ICCID, APN, and IP Type
echo "$iccid,$apn,$iptype" >> "$iccid_file"
fi
echo "ICCID file updated."
}

View File

@@ -1,142 +0,0 @@
#!/bin/bash
CONFIG_FILE="/etc/data/mobileap_cfg.xml"
# Display Messages in Colors
display_green() {
echo -e "\033[0;32m$1\033[0m"
}
display_red() {
echo -e "\033[0;31m$1\033[0m"
}
# Check and Install xml binary if not present
check_and_install_xml() {
if [ ! -f "/opt/bin/xml" ]; then
echo "xml binary not found. Attempting to install xmlstarlet..."
opkg update
opkg install xmlstarlet
# Verify installation
if [ ! -f "/opt/bin/xml" ]; then
echo "Failed to install xmlstarlet. Exiting..."
exit 1
fi
fi
echo "xml binary is available."
}
# Edit XML Value
edit_xml_value() {
local node="$1"
local new_value="$2"
/opt/bin/xml ed -L -u "$node" -v "$new_value" "$CONFIG_FILE"
}
# Get Current XML Value
get_current_value() {
/opt/bin/xml sel -t -v "$1" "$CONFIG_FILE"
}
# Enable/Disable Menu
enable_disable_menu() {
local node="$1"
local current_value=$(get_current_value "$node")
echo "Current status: $([ "$current_value" == "1" ] && echo "Enabled" || echo "Disabled")"
echo "1. Enable"
echo "2. Disable"
read -p "Choose an option to toggle (1-2): " choice
local new_value="$([ "$choice" == "1" ] && echo "1" || echo "0")"
edit_xml_value "$node" "$new_value"
display_green "After making changes, please reboot to have them take effect."
}
# Edit Simple Value
edit_simple_value() {
local node="$1"
local description="$2"
local current=$(get_current_value "$node")
echo "Current $description: $current"
read -p "Enter new $description: " new_value
edit_xml_value "$node" "$new_value"
display_green "After making changes, please reboot to have them take effect."
}
# Edit DHCP IP Range
edit_dhcp_range() {
local start_ip=$(get_current_value "//MobileAPLanCfg/DHCPCfg/StartIP")
local end_ip=$(get_current_value "//MobileAPLanCfg/DHCPCfg/EndIP")
echo "Current Start IP: $start_ip"
echo "Current End IP: $end_ip"
read -p "Enter new Start IP: " new_start_ip
read -p "Enter new End IP: " new_end_ip
edit_xml_value "//MobileAPLanCfg/DHCPCfg/StartIP" "$new_start_ip"
edit_xml_value "//MobileAPLanCfg/DHCPCfg/EndIP" "$new_end_ip"
display_green "After making changes, please reboot to have them take effect."
}
# Reboot the system
reboot_system() {
echo "Rebooting system..."
atcmd 'AT+CFUN=1,1' # Ensure this command is correct for your system
echo "System reboot initiated. Good luck."
}
# Main Menu
main_menu() {
while true; do
clear
display_red "Warning, these changes can break access over the network. Know what you are doing, and be prepared to use ADB to fix this just in case."
echo "Configuration Menu"
echo "------------------"
display_green "1. Edit Gateway IPV4 Address"
display_green "2. Edit Gateway URL"
display_green "3. Edit LAN DHCP Start/End Range"
display_green "4. Edit LAN Subnet Mask"
display_green "5. Edit DHCPv6 Base address"
display_green "6. Toggle IPv4 NAT"
display_green "7. Toggle IPv6 NAT"
display_green "8. Toggle DHCP Server"
display_green "9. Toggle DHCPv4"
display_green "10. Toggle DHCPv6"
display_green "11. Toggle WAN Autoconnect"
display_green "12. Toggle WAN AutoReconnect"
display_green "13. Toggle Roaming"
display_green "14. Toggle WAN DNSv4 Passthrough"
display_green "15. Toggle WAN DNSv6 Passthrough"
display_green "16. Toggle IPPT NAT/Ability to access gateway while in IPPT mode"
display_green "17. Toggle UPnP"
display_green "18. Reboot System"
display_green "19. Exit"
echo
read -p "Select an option (1-19): " option
case "$option" in
1) edit_simple_value "//MobileAPLanCfg/APIPAddr" "Gateway IPV4 Address";;
2) edit_simple_value "//MobileAPLanCfg/GatewayURL" "Gateway URL";;
3) edit_dhcp_range;;
4) edit_simple_value "//MobileAPLanCfg/SubNetMask" "LAN Subnet Mask";;
5) edit_simple_value "//MobileAPLanCfg/ULAIPv6BaseAddr" "DHCPv6 Base Address";;
6) enable_disable_menu "//MobileAPNatCfg/IPv4NATDisable";;
7) enable_disable_menu "//MobileAPNatv6Cfg/EnableIPv6NAT";;
8) enable_disable_menu "//MobileAPLanCfg/EnableDHCPServer";;
9) enable_disable_menu "//MobileAPLanCfg/EnableIPV4";;
10) enable_disable_menu "//MobileAPLanCfg/EnableIPV6";;
11) enable_disable_menu "//MobileAPWanCfg/AutoConnect";;
12) enable_disable_menu "//MobileAPWanCfg/ReConnect";;
13) enable_disable_menu "//MobileAPWanCfg/Roaming";;
14) enable_disable_menu "//Dhcpv4Cfg/EnableDhcpv4Dns";;
15) enable_disable_menu "//Dhcpv6Cfg/EnableDhcpv6Dns";;
16) enable_disable_menu "//IPPassthroughFeatureWithNAT";;
17) enable_disable_menu "//MobileAPSrvcCfg/UPnP";;
18) reboot_system;;
19) break;;
*) echo "Invalid option. Please try again.";;
esac
done
}
# Start by checking and installing xml if necessary, then mount filesystem as rw and run the menu
mount -o remount,rw /
check_and_install_xml
main_menu

View File

@@ -1,51 +0,0 @@
#!/bin/bash
# Define executable files path
EXE=/usrdata/root/bin
# Display Messages in Colors
display_green() {
echo -e "\033[0;32m$1\033[0m"
}
display_red() {
echo -e "\033[0;31m$1\033[0m"
}
main_menu() {
while true; do
display_green "Welcome to iamromulan's Simple Console Menu"
display_green "Select an option:"
echo "------------------"
display_green "1. QCMAP Settings"
display_green "2. Change simpleadmin (admin) password"
display_green "3. Change root password (shell/ssh/console)"
display_green "4. Open File Browser/Editor (mc)"
display_green "5. View Used/Available space"
display_green "6. Open Task Manager/View CPU Load"
display_green "7. Run speedtest.net test"
display_green "8. Run fast.com test (30Mbps max)"
display_green "9. Get and run the Toolkit"
display_green "10. Get and run the Development/unstable Toolkit"
display_green "11. Exit (Enter Root Shell)"
echo
read -p "Select an option (1-11): " option
case "$option" in
1) $EXE/ap_settings ;;
2) $EXE/simplepasswd ;;
3) passwd ;;
4) mc ;;
5) dfc ;;
6) htop ;;
7) $EXE/speedtest ;;
8) $EXE/fast ;;
9) cd /tmp && wget -O RMxxx_rgmii_toolkit.sh https://raw.githubusercontent.com/iamromulan/quectel-rgmii-toolkit/main/RMxxx_rgmii_toolkit.sh && chmod +x RMxxx_rgmii_toolkit.sh && ./RMxxx_rgmii_toolkit.sh && cd / ;;
10) cd /tmp && wget -O RMxxx_rgmii_toolkit.sh https://raw.githubusercontent.com/iamromulan/quectel-rgmii-toolkit/development/RMxxx_rgmii_toolkit.sh && chmod +x RMxxx_rgmii_toolkit.sh && ./RMxxx_rgmii_toolkit.sh && cd / ;;
11) break ;;
*) echo "Invalid option. Please try again." ;;
esac
done
}
main_menu

View File

@@ -1,99 +0,0 @@
#!/bin/bash
# Check if /usrdata/socat-at-bridge/atcmd exists
if [ -f "/usrdata/socat-at-bridge/atcmd" ]; then
# Read the serial number
serial_number=$(/usrdata/socat-at-bridge/atcmd 'AT+EGMR=0,5' | grep '+EGMR:' | cut -d '"' -f2)
# Read the firmware revision
firmware_revision=$(/usrdata/socat-at-bridge/atcmd 'AT+CGMR' | grep -o 'RM[0-9A-Z]*' | head -1)
else
serial_number="UNKNOWN"
firmware_revision="UNKNOWN"
fi
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
echo "=============================================================="
# Start your Actual echo output here, 17 lines omitted for mobile compatibility. ttyd font needs to be size 25.
# Echo "Logo"
echo " .%+: "
echo " .*@@@-. "
echo " :@@@@- "
echo " @@@@#. "
echo " -@@@@#. "
echo " :. %@@@@: -# "
echo " .+- #@@@@%.+@- "
echo " .#- . +@@@@# #@- "
echo " -@*@*@% @@@@@::@@= "
echo ".+%@@@@@@@@@%=. =@@@@# #@@- .. "
echo " .@@@@@: :@@@@@ =@@@..%= "
echo " -::@-.+. @@@@@.=@@@- =@- "
echo " .@- .@@@@@:.@@@* @@. "
echo " .%- -@@@@@:=@@@@ @@# "
echo " .#- .%@@@@@@#. +@@@@@.#@@@@ @@@."
echo " .*- .@@@@@@@@@@=. @@@@@@ @@@@@ @@@:"
echo " :. .%@@@@@@@@@@@%. .@@@@@+:@@@@@ @@@-"
echo " -@@@@@@@@@@@@@@@..@@@@@@.-@@@@@ .@@@-"
echo " -@@@@@@@@@@%. .@@@@@@. @@@@@+ =@@@="
echo " =@@@@@@@@* .@@@@@@. @@@@@@..@@@@-"
echo " #@@@@@@@@-*@@@@@%..@@@@@@+ #@@@@-"
echo " @@@@@@:.-@@@@@@. @@@@@@= %@@@@@."
echo " .@@@@. *@@@@@@- .+@@@@@@-.@@@@@@+ "
echo " %@@. =@@@@@*. +@@@@@@%.-@@@@@@% "
echo " .@@ .@@@@@= :@@@@@@@@..@@@@@@@= "
echo " =@.+@@@@@. -@@@@@@@*.:@@@@@@@*. "
echo " %.*@@@@= .@@@@@@@-.:@@@@@@@+. "
echo " ..@@@@= .@@@@@@: #@@@@@@@: "
echo " .@@@@ +@@@@..%@@@@@+. "
echo " .@@@. @@@@.:@@@@+. "
echo " @@@. @@@. @@@* .@. "
echo " :@@@ %@@..@@#. *@ "
echo " -*: .@@* :@@. @@. -..@@ "
echo " =@@@@@@.*@- :@% @* =@:=@# "
echo " .@@@-+@@@@:%@..%- ...@%:@@: "
echo " .@@. @@-%@: .%@@*@@%. "
echo " :@@ :+ *@ *@@#*@@@. "
echo " =@@@.@@@@ "
echo " .*@@@:=@@@@: "
echo " .@@@@:.@@@@@: "
echo " .@@@@#.-@@@@@. "
echo " #@@@@: =@@@@@- "
echo " .@@@@@..@@@@@@* "
echo " -@@@@@. @@@@@@#. "
echo " -@@@@@ @@@@@@% "
echo " @@@@@. #@@@@@@. "
echo " :@@@@# =@@@@@@% "
echo " @@@@@: @@@@@@@: "
echo " *@@@@ @@@@@@@. "
echo " .@@@@ @@@@@@@ "
echo " #@@@. @@@@@@* "
echo " @@@# @@@@@@@ "
echo " .@@+=@@@@@@. "
echo " *@@@@@@ "
echo " :@@@@@= "
echo " .@@@@@@. "
echo " :@@@@@*. "
echo " .=@@@@@- "
echo " :+##+. "
echo "=============================================================="
echo "TTYd session file by iamromulan v1.1"
echo "Firmware Revision: $firmware_revision"
echo "Serial Number: $serial_number"
echo "=============================================================="
# Start a login session
exec /bin/login