Replies: 3 comments 5 replies
-
|
Firmware seems to be downloaded by dimclient and then it calls firmd with the following parameters Meaning of these parameters is as follows |
Beta Was this translation helpful? Give feedback.
-
|
This is an example script that can be put somewhere in #!/bin/sh
#
# This script acts as a proxy for firmd
#
# Created by: itsyourap
# Date: 2024-11-09
#
# Store the current time in the format YYYYMMDD_HHMMSS
current_time=$(date +"%Y%m%d_%H%M%S")
# Check if firmd.log exists; if not, create it
log_file="/flash2/firmd/firmd.log"
if [[ ! -f "$log_file" ]]; then
mkdir -p /flash2/firmd/
touch "$log_file"
fi
# Append the current time and all arguments to the log file
echo "$current_time - Arguments: $*" >> "$log_file"
# Add a new line at the end for readability
echo "" >> "$log_file"
# Create a folder with the current time as the folder name
# and copy all /tmp/tr69* files into it
new_folder="/flash2/firmd/$current_time"
mkdir -p "$new_folder"
cp /tmp/tr69* "$new_folder" 2>/dev/null
# Check for "-f" argument and copy specified file to our folder if provided
for i in "$@"; do
if [[ "$i" == "-f" ]]; then
# Get the argument following "-f" as the file location
file_location="$2"
if [[ -f "$file_location" ]]; then
cp "$file_location" "$new_folder"
else
echo "File not found: $file_location" >> "$log_file"
fi
break
fi
doneHere is an example script to do the changes in #!/bin/sh
#
# This script is used to replace the `UPGRADE_PROGRAM` in `environment` table in `/tmp/system.db`
#
# Created by: itsyourap
# Date: 2024-11-09
#
# SQL command to update the value for the UPGRADE_PROGRAM entry
sqlite3 "/tmp/system.db" <<EOF
UPDATE environment
SET value = '/flash2/scripts/firmd.sh'
WHERE name = 'UPGRADE_PROGRAM';
EOFYou can use the |
Beta Was this translation helpful? Give feedback.
-
|
How to run this new script? Please explain the full process as earlier. If possible. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There is a
UPGRADE_PROGRAMinenvironmenttable in/tmp/system.db. We can modify it to capture the JF firmware updates (both the URL as well as the image).TODO:
/flash2that does the following:-/tmp/tr69*files in/flash2/flash2chmodUPGRADE_PROGRAMto the script locationThis will give us the firmware and also the persistent firmware link in the TR069 logs.
Also, you can prevent auto firmware upgradation using this method.
Also we have to use this in combination with #45 to make sure the
UPGRADE_PROGRAMgets modified on every boot as mentioned here.I will make and post the script soon.
EDIT: I have commented the script here
Beta Was this translation helpful? Give feedback.
All reactions