commit 66e5ee2148cf27d9cb6366fc5d2c88c383df2851 Author: PrincessPi3 Date: Sun May 18 16:34:01 2025 -0600 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..237f0d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +live-roms/* \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..121f3dd --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# Sillyfilly-espdumper +silly little thing to dump any memory and flash regions from esp chips +needs [esp-idf-tools](https://github.com/PrincessPi3/esp-idf-tools) + +just edit the file for your specifications +### config file format: +name start(hex) length(hex) +one per line, no underscores in the hex + +example: +``` +ROM0 0x40000000 0x4FFFF +Peripherals-1 0x600C0000 0xFFF +```` \ No newline at end of file diff --git a/config/ESP32-C5-Full-Named-Dump.conf b/config/ESP32-C5-Full-Named-Dump.conf new file mode 100644 index 0000000..841ba18 --- /dev/null +++ b/config/ESP32-C5-Full-Named-Dump.conf @@ -0,0 +1,7 @@ +LP-Memory 0x50000000 0x3FFF +Peripherals-1 0x600C0000 0xFFFF +ROM 0x40000000 0x4FFFF +HP-Memory 0x40800000 0x7FFFF +Peripherals-0 0x60000000 0xBFFFF +Cache-MMU-External-Memory 0x41000000 0xFFFFFF +CPU-Sub-System 0x20000000 0xFFFFFF diff --git a/espdump.sh b/espdump.sh new file mode 100644 index 0000000..cac6565 --- /dev/null +++ b/espdump.sh @@ -0,0 +1,72 @@ +#!/bin/bash +datestamp=$(date "+%d%m%y%H%M%S") +chip="esp32c5" +file_prefix=esp32c5-devkitc-1-stub +out_dir="./live-roms/$file_prefix-$datestamp" +stub=False # True/False case sensitive +args_file="./config/ESP32-C5-Full-Named-Dump.conf" +log_file="$out_dir/log-$file_prefix-$datestamp.txt" +tmp_file="./.dump_rom_tmp.tmp" +start_header="Starting dump from chip: $chip\n\ton port: $ESPPORT\n\tat: $ESPBAUD baud\n\tto directory: $out_dir\ntwith log file: $log_file\n" + +mkdir $out_dir + +if [ "$stub" != "False" ]; then + stubby='--no-stub' +fi + + +echo -e "\n=====================" +echo -e $start_header + +echo -e $start_header >> $log_file + +echo -e "Running chipinfo, appending to $log_file" +echo -e "Chipinfo:" +chipinfo >> $log_file + + +# usage +# dump_section name start_address length +# name is a string +# start_address in hex with no _s +# length in hex with no _s +dump_section () { + file_name="$out_dir/$file_prefix-$chip-$1-$2-$3-$datestamp.bin" + command="esptool.py $stubby --baud $ESPBAUD --port $ESPPORT --chip $chip dump_mem $2 $3 $file_name" + + header="$1 starting: $2 length: $3 on $chip stub: $stub\n\nRunning: $command" + + echo -e "\nDumping Section:\n$header\n\nPlease wait..." + + echo -e $header >> $log_file + echo -e " File: $file_name" >> $log_file + echo -e " $command" >> $log_file + + eval "$command" + return_status=$? + + if [ $return_status -ne 0 ]; then + echo -e "\tERROR: return status $return_status dump:" >> $log_file + cat $tmp_file >> $log_file + echo -e "ERROR: dump failed. check $log_file" + echo -e "esptool output:" + cat $tmp_file + rm $tmp_file + exit + fi + + checksum=$(sha256sum $file_name) + echo -e " sha256sum: $checksum" >> $log_file + echo -e " Sucess\n===\n" >> $log_file + echo -e "Successfully dumped\nsha256sum: $checksum\n continuing..." +} + +cat $args_file | \ + while read args; do + dump_section `echo $args` + done + +sha256sum $out_dir/* >> $out_dir/sha256sum.txt + +echo -e "\nDone :3" diff --git a/run_dump_and_notify.sh b/run_dump_and_notify.sh new file mode 100644 index 0000000..e7b9302 --- /dev/null +++ b/run_dump_and_notify.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# chipinfo > ESP32-C5-DevKitC-1-chipinfo-`date +%s`.txt +bash ./espdump.sh +bash /home/princesspi/scripts/webhook.sh "espdump finished lol exitcode: $?" tagme +# sudo shutdown -r +5 +# unset ESPIDFTOOLS_INSTALLDIR +# unset IDF_PATH +# unset ESP_IDF_VERSION +# unset IDF_PYTHON_ENV_PATH +# unset OPENOCD_SCRIPTS +# unset ESP_ROM_ELF_DIR +# unset IDF_DEACTIVATE_FILE_PATH +# unset IDF_TOOLS_INSTALL_CMD +# unset IDF_TOOLS_EXPORT_CMD +# unset ESPPORT +# unset ESPBAUD +# unset ESPTARGET +# echo bash /home/princesspi/esp/esp-idf-tools/esp-idf-tools-cmd.sh nr +# bash /home/princesspi/scripts/webhook.sh "esp reinstall nuke finished, rebooting" taGME