├── example_DIR_815 ├── install.sh ├── README.md └── fmk.sh /example_DIR_815: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/N1nEmAn/fmk-fast/HEAD/example_DIR_815 -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Color codes 4 | RED='\033[0;31m' 5 | YELLOW='\033[1;33m' 6 | GREEN='\033[0;32m' 7 | END='\033[0m' 8 | 9 | # Check if debug mode is enabled 10 | DEBUG=false 11 | if [ "$1" == "-d" ]; then 12 | DEBUG=true 13 | shift 14 | fi 15 | 16 | # Define variables 17 | BIN_PATH="/usr/bin/fmk" 18 | SCRIPT_PATH="$(pwd)/fmk.sh" 19 | 20 | # Check if the script file exists 21 | if [ ! -f "$SCRIPT_PATH" ]; then 22 | echo -e "${RED}[-]${END} Script file fmk.sh not found in the current directory." 23 | exit 1 24 | fi 25 | 26 | # Install the script to /usr/bin 27 | if $DEBUG; then 28 | sudo cp "$SCRIPT_PATH" "$BIN_PATH" 29 | sudo chmod +x "$BIN_PATH" 30 | else 31 | sudo cp "$SCRIPT_PATH" "$BIN_PATH" >/dev/null 32 | sudo chmod +x "$BIN_PATH" >/dev/null 33 | fi 34 | 35 | if [ $? -ne 0 ]; then 36 | echo -e "${RED}[-]${END} Failed to install the script to /usr/bin." 37 | exit 1 38 | fi 39 | 40 | echo -e "${GREEN}[+]${END} The script has been installed to /usr/bin as 'fmk'. You can now use the 'fmk' command from any directory." 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Firmware Mod Kit FAST Usage Guide 2 | 3 | ![Platform](https://img.shields.io/badge/platform-Linux-blueviolet) 4 | ![Forks](https://img.shields.io/github/forks/N1nEmAn/fmk-fast) 5 | ![Stars](https://img.shields.io/github/stars/N1nEmAn/fmk-fast) 6 | ![fff](https://github.com/user-attachments/assets/674f700c-c86c-47fb-bec8-0dadf79c5782) 7 | 8 | 9 | - **🚀 Quick and Easy Firmware Extraction**: This tool allows you to use the Firmware Mod Kit (FMK) for firmware extraction with ease. 10 | - **🔧 No Configuration Needed**: No need to worry about GCC, binwalk, or Python version incompatibilities. 11 | - **📦 Ready to Use Out of the Box**: Start extracting firmware immediately without any setup hassles. 12 | - **⚡ Efficient Extraction**: Quickly extract kernel images, file systems, and more from your firmware. 13 | - **⭐ Star Us on GitHub**: If you find this tool useful, please give us a star! 14 | 15 | ## Why I Created It 16 | 17 | The motivation for creating this tool stemmed from my personal experiences with the original Firmware Mod Kit (FMK). Despite its potential, the original FMK often failed to work for me due to various compatibility issues. 18 | 19 | In my quest for a solution, I discovered a reliable Docker image from the repository bnzm5270/firmware-mod-kit. This image worked well initially and served as a valuable reference point. 20 | 21 | To ensure greater stability and control, I decided to adapt and copy the Docker setup to my own Docker account. This adaptation was crucial in creating a more reliable and user-friendly tool. 22 | 23 | I deeply appreciate the original work done by bnzm5270, which laid the foundation for this project. Without their contributions, this tool would not have been possible. 🙏 24 | 25 | ## Dependencies 26 | 27 | This project relies on Docker for firmware extraction. Install Docker based on your operating system: 28 | 29 | ### Ubuntu 30 | 31 | ```bash 32 | sudo apt update 33 | sudo apt install docker.io 34 | sudo systemctl start docker 35 | sudo systemctl enable docker 36 | ``` 37 | 38 | ### macOS 39 | 40 | Download and install Docker Desktop from the [Docker website](https://www.docker.com/products/docker-desktop). 41 | 42 | ### Arch Linux 43 | 44 | ```bash 45 | sudo pacman -S docker 46 | sudo systemctl start docker 47 | sudo systemctl enable docker 48 | ``` 49 | 50 | ## Installation 51 | 52 | 1. **Clone the repository** 53 | 54 | ```bash 55 | git clone https://github.com/N1nEmAn/firmware-mod-kit-fast.git 56 | cd firmware-mod-kit-fast 57 | ``` 58 | 59 | 2. **Run the installation script** 60 | 61 | To install the `fmk` tool to `/usr/bin`, run: 62 | 63 | ```bash 64 | ./install.sh 65 | ``` 66 | 67 | This will create a `fmk` command for easy use. 68 | 69 | ## Usage 70 | 71 | **Extract firmware** 72 | 73 | The first time Docker is used, it may take some time to download the required Docker image. Once downloaded, firmware extraction will be faster. Use the following command to extract firmware: 74 | 75 | ```bash 76 | fmk example_DIR_815 77 | ``` 78 | 79 | Here, `example_DIR_815` should be replaced with the actual firmware path. 80 | 81 | **Debug Mode** 82 | 83 | To enable debugging output, use the `-d` flag. This will provide detailed logs and help troubleshoot any issues: 84 | 85 | ```bash 86 | fmk -d example_DIR_815 87 | ``` 88 | 89 | **Note**: If the `fmk` command fails, try running it with `sudo`: 90 | 91 | ```bash 92 | sudo fmk example_DIR_815 93 | ``` 94 | 95 | ## Example 96 | 97 | ```bash 98 | # Clone the repository 99 | git clone https://github.com/N1nEmAn/firmware-mod-kit-fast.git 100 | cd firmware-mod-kit-fast 101 | 102 | # Run the installation script 103 | ./install.sh 104 | 105 | # Extract firmware 106 | fmk example_DIR_815 107 | 108 | # Extract firmware with debugging output 109 | fmk -d example_DIR_815 110 | 111 | # Build firmware 112 | fmk -b your_folder 113 | 114 | ``` 115 | -------------------------------------------------------------------------------- /fmk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Color codes 4 | RED='\033[0;31m' 5 | YELLOW='\033[1;33m' 6 | GREEN='\033[0;32m' 7 | END='\033[0m' 8 | 9 | # Check if debug mode is enabled 10 | DEBUG=false 11 | if [ "$1" == "-d" ]; then 12 | DEBUG=true 13 | shift 14 | fi 15 | 16 | # Check if build mode is enabled with the -b flag 17 | BUILD_MODE=false 18 | PARAM_FOLDER="" 19 | 20 | if [ "$1" == "-b" ]; then 21 | BUILD_MODE=true 22 | shift 23 | PARAM_FOLDER=$1 24 | shift 25 | fi 26 | 27 | # Check if the firmware file path or folder is provided 28 | if [ -z "$1" ] && [ "$BUILD_MODE" = false ]; then 29 | echo -e "${RED}[-]${END} Please provide the firmware file path or use the -b flag with a folder path." 30 | echo -e "${YELLOW}[*]${END} Usage: $0 [-d] | -b " 31 | docker rm -f $CONTAINER_NAME && exit 0 32 | fi 33 | 34 | # CONTAINER_NAME="firmware_mod_kit_container" 35 | randc=$(head /dev/urandom | tr -dc a-f0-9 | head -c 8) 36 | CONTAINER_NAME="fmkfast_$randc" 37 | LOCAL_FOLDER=$(pwd) 38 | TO_ANA_BIN="to_ana_bin_$randc" 39 | 40 | # Start Docker container 41 | echo -e "${YELLOW}[*]${END} Starting Docker container..." 42 | if $DEBUG; then 43 | docker run -itd --name $CONTAINER_NAME --rm n1neman/fmk 44 | else 45 | docker run -itd --name $CONTAINER_NAME --rm n1neman/fmk >/dev/null 46 | fi 47 | 48 | if [ $? -ne 0 ]; then 49 | echo -e "${RED}[-]${END} Failed to start Docker container." 50 | docker rm -f $CONTAINER_NAME && exit 1 51 | fi 52 | 53 | # If BUILD_MODE is enabled, copy the specified folder and build the new firmware 54 | if $BUILD_MODE; then 55 | if [ -d "$PARAM_FOLDER" ]; then 56 | echo -e "${YELLOW}[*]${END} Copying folder '$PARAM_FOLDER' to Docker container..." 57 | docker cp "$PARAM_FOLDER" "$CONTAINER_NAME:/firmware-mod-kit/fmk" 58 | 59 | echo -e "${YELLOW}[*]${END} Building new firmware from '$PARAM_FOLDER'..." 60 | docker exec -it $CONTAINER_NAME bash -c "cd /firmware-mod-kit && ./build-firmware.sh" 61 | 62 | if [ $? -eq 0 ]; then 63 | echo -e "${GREEN}[+]${END} Firmware built successfully." 64 | docker cp "$CONTAINER_NAME:/firmware-mod-kit/fmk/new-firmware.bin" "$LOCAL_FOLDER" 65 | echo -e "${GREEN}[+]${END} New firmware copied to the host machine." 66 | else 67 | echo -e "${RED}[-]${END} Firmware build failed." 68 | fi 69 | 70 | docker stop $CONTAINER_NAME 71 | docker rm -f $CONTAINER_NAME && exit 0 72 | exit 1 73 | else 74 | echo -e "${RED}[-]${END} Provided folder '$PARAM_FOLDER' does not exist." 75 | docker stop $CONTAINER_NAME 76 | docker rm -f $CONTAINER_NAME && exit 1 77 | exit 1 78 | fi 79 | fi 80 | 81 | # Normal extraction mode 82 | FIRMWARE_FILE=$1 83 | FIRMWARE_FILE=${FIRMWARE_FILE#./} 84 | echo -e "${YELLOW}[*]${END} Extracting firmware from '$FIRMWARE_FILE'..." 85 | 86 | # Copy firmware file to temporary file 87 | cp "$FIRMWARE_FILE" "$TO_ANA_BIN" 88 | 89 | # Copy firmware file to Docker container 90 | if $DEBUG; then 91 | docker cp "$TO_ANA_BIN" "$CONTAINER_NAME:/firmware-mod-kit/" 92 | else 93 | docker cp "$TO_ANA_BIN" "$CONTAINER_NAME:/firmware-mod-kit/" >/dev/null 94 | fi 95 | 96 | if [ $? -ne 0 ]; then 97 | echo -e "${RED}[-]${END} Failed to copy firmware file to Docker container." 98 | docker rm -f $CONTAINER_NAME 99 | rm "$TO_ANA_BIN" 100 | docker rm -f $CONTAINER_NAME && exit 1 101 | fi 102 | 103 | # Extract firmware file in Docker container 104 | if $DEBUG; then 105 | docker exec -it $CONTAINER_NAME bash -c "cd /firmware-mod-kit && ./extract-firmware.sh $TO_ANA_BIN" 106 | else 107 | docker exec -it $CONTAINER_NAME bash -c "cd /firmware-mod-kit && ./extract-firmware.sh $TO_ANA_BIN" >/dev/null 108 | fi 109 | 110 | if [ $? -eq 0 ]; then 111 | echo -e "${GREEN}[+]${END} Firmware extracted successfully." 112 | docker cp "$CONTAINER_NAME:/firmware-mod-kit/fmk" "$LOCAL_FOLDER/fmk_$FIRMWARE_FILE" >>/dev/null 113 | echo -e "${GREEN}[+]${END} '${YELLOW}fmk_$FIRMWARE_FILE${END}' folder copied to the host machine." 114 | else 115 | echo -e "${RED}[-]${END} Firmware extraction failed." 116 | fi 117 | 118 | # Clean up 119 | docker rm -f $CONTAINER_NAME >>/dev/null 120 | rm "$TO_ANA_BIN" 121 | --------------------------------------------------------------------------------