找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 9473|回复: 16

关于NOKIA EA0326GMP的研究

[复制链接]
发表于 2024-3-28 14:37 | 显示全部楼层 |阅读模式
首先要感谢诺基亚贝尔 EA0326GMP 免拆开启SSH-无线路由器硬件改造以及故障维修-恩山无线论坛 (right.com.cn)的作者@love0001238 为我们提供了EA0326GMP的免拆开ssh的配置文件,这样我就省的拆机可以直接在系统中进行研究了
相信各位也看到过我写的其他机型的研究过程,有的是从无到有,有的是从有到懂,我都希望把整个过程提供给大家,共同学习
先来看看机子的外观,是个比较少见的不对称天线


下来就开始,根据love0001238提供的配置文件直接恢复后打开ssh,那么首先就是要看执行备份和恢复配置的网页是怎么样的
这个机型它采用lighttp,指向了/www/web/WEBCGI/prog.fcgi,这里可以看到实际上是指向了/usr/bin/prog.cgi


那么就先把它拉出来用IDA分析一下


这里大概能看出来它的流程是先用sysupgrade正常的生成一个未加密备份到/var/backup_tmp.tar.gz,然后再通过mkconfig把它加密成/var/backup.tar.gz,最后调用下载和删除这两个文件
那么就追踪到了mkconfig这个指令,再去追踪到/bin/mkconfig,看看它到底是怎么一个加密过程


果然实际加密是在这里进行的,通过openssl和seama进行了加密和封装,那么到底加密的时候用的password是什么呢,这里提到一个meta_data的变量
又接着meta_data查到了get_meta_data这个函数,存在于libcommon.so里


对于汇编我一点也不擅长,十几年前学的到现在已经基本上不会了,但是配合mkconfig的说明,隐约觉得是跟机型和版本有关的一个参数
那么我就来测试一下吧,我通过指定一个keke1023作为meta_data来加密一个我自己sysupgrade备份的普通备份,mkconfig -a enca -m 'keke1023' -i /var/backup_tmp.tar.gz -o /var/backup.tar.gz然后拖出来跟系统自身加密的备份做一对比


结果很明显了,你所指定的meta_data就会直接被写入到文件开头,那么反推出来系统自身的meta_data就是‘EA0326GMP_3FE79221BAAA’,这个值也是有来由的
/etc/ahsapg/mtd_andlink_store.cfg里有这么一段

#[Version]
FirmVersion=EA0326GMP
SWVersion=NSB0326GMP10t01
HWVserion=3FE79221BAAA
AhsapdVersion=1.4.0

正好就是FirmVersion和HWVserion的拼接
我就测试用mkconfig来解密一个系统的备份配置mkconfig -a de-enca -m 'EA0326GMP_3FE79221BAAA' -i /var/EA0326GMP_SSH.tar.gz -o /var/EA0326GMP_SSH_dec.tar.gz


就变回一个正常可以访问的tar.gz了,到这里,关于配置文件的方面就研究清楚了,虽然不是通过汇编直接明白meta_data的来源,但也算是偷懒解决了
下来就继续研究机子的dts,因为要做固件适配,至少得知道led和button的gpio
本来想直接opkg装一个gpiod来查看的,但是系统并没有opkg,我就从gpiod-tools_1.4.4-1_aarch64_cortex-a53.ipk解压出来的6个gpio*可执行文件,上传到/usr/bin并且chmod +x
再从libgpiod_1.4.4-1_aarch64_cortex-a53.ipk解压出libgpiod.so.2.1.4上传至/usr/lib,并且chmod +x然后ln -s /usr/lib/libgpiod.so.2.1.4 /usr/lib/libgpiod.so.2,就可以运行gpio*这几个可执行文件了


led是456789,button是0和1,再去备份的ubi分区找到d00dfeed来剪切出dtb文件,转回dts看看


也是从主控直接引出wan口,剩下lan口通过p6到mt7531
好了,大功告成,可以去编译FIP和固件啦,希望对大家有所启发~

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我的恩山、我的无线 The best wifi forum is right here.
发表于 2024-3-28 15:03 | 显示全部楼层
沙发,为大佬点赞
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2024-3-28 18:21 来自手机 | 显示全部楼层
牛逼的逆向解密过程
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2024-3-28 18:32 | 显示全部楼层
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2024-3-28 19:57 | 显示全部楼层
下面这段提取出来的的是dtb信息吗?我看跟其他型号的格式差别很大
  1. {
  2.         compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
  3.         interrupt-parent = <0x00000001>;
  4.         #address-cells = <0x00000001>;
  5.         #size-cells = <0x00000001>;
  6.         model = "mt7981-rfb";
  7.         cpus {
  8.                 #address-cells = <0x00000001>;
  9.                 #size-cells = <0x00000000>;
  10.                 cpu@0 {
  11.                         device_type = "cpu";
  12.                         compatible = "arm,cortex-a53";
  13.                         reg = <0x00000000>;
  14.                 };
  15.                 cpu@1 {
  16.                         device_type = "cpu";
  17.                         compatible = "arm,cortex-a53";
  18.                         reg = <0x00000001>;
  19.                 };
  20.         };
  21.         gpt_dummy20m {
  22.                 compatible = "fixed-clock";
  23.                 clock-frequency = <0x00c65d40>;
  24.                 #clock-cells = <0x00000000>;
  25.                 u-boot,dm-pre-reloc;
  26.                 phandle = <0x00000002>;
  27.         };
  28.         timer {
  29.                 compatible = "arm,armv8-timer";
  30.                 interrupt-parent = <0x00000001>;
  31.                 clock-frequency = <0x00c65d40>;
  32.                 interrupts = <0x00000001 0x0000000d 0x00000008 0x00000001 0x0000000e 0x00000008 0x00000001 0x0000000b 0x00000008 0x00000001 0x0000000a 0x00000008>;
  33.                 arm,cpu-registers-not-fw-configured;
  34.         };
  35.         timer@10008000 {
  36.                 compatible = "mediatek,mt7986-timer";
  37.                 reg = <0x10008000 0x00001000>;
  38.                 interrupts = <0x00000000 0x00000082 0x00000004>;
  39.                 clocks = <0x00000002>;
  40.                 clock-names = "gpt-clk";
  41.                 u-boot,dm-pre-reloc;
  42.         };
  43.         watchdog@1001c000 {
  44.                 compatible = "mediatek,mt7986-wdt";
  45.                 reg = <0x1001c000 0x00001000>;
  46.                 interrupts = <0x00000000 0x0000006e 0x00000004>;
  47.                 #reset-cells = <0x00000001>;
  48.                 status = "disabled";
  49.         };
  50.         interrupt-controller@c000000 {
  51.                 compatible = "arm,gic-v3";
  52.                 #interrupt-cells = <0x00000003>;
  53.                 interrupt-parent = <0x00000001>;
  54.                 interrupt-controller;
  55.                 reg = <0x0c000000 0x00040000 0x0c080000 0x00200000>;
  56.                 interrupts = <0x00000001 0x00000009 0x00000004>;
  57.                 phandle = <0x00000001>;
  58.         };
  59.         apmixedsys@1001e000 {
  60.                 compatible = "mediatek,mt7981-fixed-plls";
  61.                 reg = <0x1001e000 0x00001000>;
  62.                 #clock-cells = <0x00000001>;
  63.                 u-boot,dm-pre-reloc;
  64.                 phandle = <0x00000003>;
  65.         };
  66.         topckgen@1001b000 {
  67.                 compatible = "mediatek,mt7981-topckgen";
  68.                 reg = <0x1001b000 0x00001000>;
  69.                 clock-parent = <0x00000003>;
  70.                 #clock-cells = <0x00000001>;
  71.                 u-boot,dm-pre-reloc;
  72.                 phandle = <0x00000005>;
  73.         };
  74.         infracfg_ao@10001000 {
  75.                 compatible = "mediatek,mt7981-infracfg_ao";
  76.                 reg = <0x10001000 0x00000080>;
  77.                 clock-parent = <0x00000004>;
  78.                 #clock-cells = <0x00000001>;
  79.                 u-boot,dm-pre-reloc;
  80.                 phandle = <0x00000006>;
  81.         };
  82.         infracfg@10001000 {
  83.                 compatible = "mediatek,mt7981-infracfg";
  84.                 reg = <0x10001000 0x00000030>;
  85.                 clock-parent = <0x00000005>;
  86.                 #clock-cells = <0x00000001>;
  87.                 u-boot,dm-pre-reloc;
  88.                 phandle = <0x00000004>;
  89.         };
  90.         pinctrl@11d00000 {
  91.                 compatible = "mediatek,mt7981-pinctrl";
  92.                 reg = <0x11d00000 0x00001000 0x11c00000 0x00001000 0x11c10000 0x00001000 0x11d20000 0x00001000 0x11e00000 0x00001000 0x11e20000 0x00001000 0x11f00000 0x00001000 0x11f10000 0x00001000 0x1000b000 0x00001000>;
  93.                 reg-names = "gpio_base", "iocfg_rt_base", "iocfg_rm_base", "iocfg_rb_base", "iocfg_lb_base", "iocfg_bl_base", "iocfg_tm_base", "iocfg_tl_base", "eint";
  94.                 gpio-controller {
  95.                         gpio-controller;
  96.                         #gpio-cells = <0x00000002>;
  97.                         phandle = <0x0000000b>;
  98.                 };
  99.                 spi0-pins-func-1 {
  100.                         phandle = <0x0000000c>;
  101.                         mux {
  102.                                 function = "flash";
  103.                                 groups = "spi0", "spi0_wp_hold";
  104.                         };
  105.                         conf-pu {
  106.                                 pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
  107.                                 drive-strength = <0x00000008>;
  108.                                 bias-pull-up = <0x00000067>;
  109.                         };
  110.                         conf-pd {
  111.                                 pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
  112.                                 drive-strength = <0x00000008>;
  113.                                 bias-pull-down = <0x00000067>;
  114.                         };
  115.                 };
  116.                 spi1-pins-func-1 {
  117.                         mux {
  118.                                 function = "spi";
  119.                                 groups = "spi1_1";
  120.                         };
  121.                 };
  122.                 spi1-pins-func-3 {
  123.                         phandle = <0x00000008>;
  124.                         mux {
  125.                                 function = "uart";
  126.                                 groups = "uart1_2";
  127.                         };
  128.                 };
  129.                 one-pwm-pins {
  130.                         mux {
  131.                                 function = "pwm";
  132.                                 groups = "pwm0_1";
  133.                         };
  134.                 };
  135.                 two-pwm-pins {
  136.                         phandle = <0x00000007>;
  137.                         mux {
  138.                                 function = "pwm";
  139.                                 groups = "pwm0_1", "pwm1_0";
  140.                         };
  141.                 };
  142.                 three-pwm-pins {
  143.                         mux {
  144.                                 function = "pwm";
  145.                                 groups = "pwm0_1", "pwm1_0", "pwm2";
  146.                         };
  147.                 };
  148.         };
  149.         pwm@10048000 {
  150.                 compatible = "mediatek,mt7981-pwm";
  151.                 reg = <0x10048000 0x00001000>;
  152.                 #clock-cells = <0x00000001>;
  153.                 #pwm-cells = <0x00000002>;
  154.                 interrupts = <0x00000000 0x00000089 0x00000004>;
  155.                 clocks = <0x00000004 0x00000005 0x00000006 0x0000002d 0x00000006 0x00000003 0x00000006 0x00000004 0x00000006 0x00000004>;
  156.                 assigned-clocks = <0x00000005 0x00000051>;
  157.                 assigned-clock-parents = <0x00000005 0x00000000>;
  158.                 clock-names = "top", "main", "pwm1", "pwm2", "pwm3";
  159.                 status = "okay";
  160.                 pinctrl-names = "default";
  161.                 pinctrl-0 = <0x00000007>;
  162.         };
  163.         serial@11002000 {
  164.                 compatible = "mediatek,hsuart";
  165.                 reg = <0x11002000 0x00000400>;
  166.                 interrupts = <0x00000000 0x0000007b 0x00000004>;
  167.                 clocks = <0x00000006 0x00000012>;
  168.                 assigned-clocks = <0x00000005 0x00000050 0x00000006 0x00000025>;
  169.                 assigned-clock-parents = <0x00000005 0x00000000 0x00000004 0x00000001>;
  170.                 mediatek,force-highspeed;
  171.                 status = "okay";
  172.                 u-boot,dm-pre-reloc;
  173.         };
  174.         serial@11003000 {
  175.                 compatible = "mediatek,hsuart";
  176.                 reg = <0x11003000 0x00000400>;
  177.                 interrupts = <0x00000000 0x0000007c 0x00000004>;
  178.                 clocks = <0x00000006 0x00000013>;
  179.                 assigned-clocks = <0x00000005 0x00000050 0x00000006 0x00000026>;
  180.                 assigned-clock-parents = <0x00000005 0x00000000 0x00000004 0x00000001>;
  181.                 mediatek,force-highspeed;
  182.                 status = "disabled";
  183.                 pinctrl-names = "default";
  184.                 pinctrl-0 = <0x00000008>;
  185.         };
  186.         serial@11004000 {
  187.                 compatible = "mediatek,hsuart";
  188.                 reg = <0x11004000 0x00000400>;
  189.                 interrupts = <0x00000000 0x0000007c 0x00000004>;
  190.                 clocks = <0x00000006 0x00000014>;
  191.                 assigned-clocks = <0x00000005 0x00000050 0x00000006 0x00000027>;
  192.                 assigned-clock-parents = <0x00000005 0x00000000 0x00000004 0x00000001>;
  193.                 mediatek,force-highspeed;
  194.                 status = "disabled";
  195.         };
  196.         snand@11005000 {
  197.                 compatible = "mediatek,mt7986-snand";
  198.                 reg = <0x11005000 0x00001000 0x11006000 0x00001000>;
  199.                 reg-names = "nfi", "ecc";
  200.                 clocks = <0x00000006 0x00000018 0x00000006 0x00000017 0x00000006 0x00000019>;
  201.                 clock-names = "pad_clk", "nfi_clk", "nfi_hclk";
  202.                 assigned-clocks = <0x00000005 0x0000004d 0x00000005 0x0000004c>;
  203.                 assigned-clock-parents = <0x00000005 0x00000006 0x00000005 0x00000006>;
  204.                 status = "disabled";
  205.         };
  206.         syscon@15000000 {
  207.                 compatible = "mediatek,mt7981-ethsys", "syscon";
  208.                 reg = <0x15000000 0x00001000>;
  209.                 clock-parent = <0x00000005>;
  210.                 #clock-cells = <0x00000001>;
  211.                 #reset-cells = <0x00000001>;
  212.                 phandle = <0x00000009>;
  213.         };
  214.         ethernet@15100000 {
  215.                 compatible = "mediatek,mt7981-eth", "syscon";
  216.                 reg = <0x15100000 0x00020000>;
  217.                 resets = <0x00000009 0x00000006>;
  218.                 reset-names = "fe";
  219.                 mediatek,ethsys = <0x00000009>;
  220.                 mediatek,sgmiisys = <0x0000000a>;
  221.                 #address-cells = <0x00000001>;
  222.                 #size-cells = <0x00000000>;
  223.                 status = "okay";
  224.                 mediatek,gmac-id = <0x00000000>;
  225.                 phy-mode = "sgmii";
  226.                 mediatek,switch = "mt7531";
  227.                 reset-gpios = <0x0000000b 0x00000027 0x00000000>;
  228.                 fixed-link {
  229.                         speed = <0x000003e8>;
  230.                         full-duplex;
  231.                 };
  232.         };
  233.         syscon@10060000 {
  234.                 compatible = "mediatek,mt7986-sgmiisys", "syscon";
  235.                 reg = <0x10060000 0x00001000>;
  236.                 pn_swap;
  237.                 #clock-cells = <0x00000001>;
  238.                 phandle = <0x0000000a>;
  239.         };
  240.         syscon@10070000 {
  241.                 compatible = "mediatek,mt7986-sgmiisys", "syscon";
  242.                 reg = <0x10070000 0x00001000>;
  243.                 #clock-cells = <0x00000001>;
  244.         };
  245.         spi@1100a000 {
  246.                 compatible = "mediatek,ipm-spi";
  247.                 reg = <0x1100a000 0x00000100>;
  248.                 clocks = <0x00000006 0x0000001a 0x00000005 0x0000004e>;
  249.                 assigned-clocks = <0x00000005 0x0000004e 0x00000004 0x00000028>;
  250.                 assigned-clock-parents = <0x00000005 0x00000002 0x00000005 0x00000002>;
  251.                 clock-names = "sel-clk", "spi-clk";
  252.                 interrupts = <0x00000000 0x0000008c 0x00000004>;
  253.                 status = "okay";
  254.                 #address-cells = <0x00000001>;
  255.                 #size-cells = <0x00000000>;
  256.                 pinctrl-names = "default";
  257.                 pinctrl-0 = <0x0000000c>;
  258.                 must_tx;
  259.                 enhance_timing;
  260.                 dma_ext;
  261.                 ipm_design;
  262.                 support_quad;
  263.                 tick_dly = <0x00000002>;
  264.                 sample_sel = <0x00000000>;
  265.                 spi_nand@0 {
  266.                         compatible = "spi-nand";
  267.                         reg = <0x00000000>;
  268.                         spi-max-frequency = <0x03197500>;
  269.                 };
  270.         };
  271.         spi@1100b000 {
  272.                 compatible = "mediatek,ipm-spi";
  273.                 reg = <0x1100b000 0x00000100>;
  274.                 interrupts = <0x00000000 0x0000008d 0x00000004>;
  275.                 status = "disabled";
  276.         };
  277.         spi@11009000 {
  278.                 compatible = "mediatek,ipm-spi";
  279.                 reg = <0x11009000 0x00000100>;
  280.                 clocks = <0x00000006 0x0000001a 0x00000005 0x0000004e>;
  281.                 assigned-clocks = <0x00000005 0x0000004e 0x00000004 0x00000028>;
  282.                 assigned-clock-parents = <0x00000005 0x00000002 0x00000005 0x00000002>;
  283.                 clock-names = "sel-clk", "spi-clk";
  284.                 interrupts = <0x00000000 0x0000008e 0x00000004>;
  285.                 status = "disabled";
  286.         };
  287.         mmc@11230000 {
  288.                 compatible = "mediatek,mt7981-mmc";
  289.                 reg = <0x11230000 0x00001000 0x11c20000 0x00001000>;
  290.                 interrupts = <0x00000000 0x0000008f 0x00000004>;
  291.                 clocks = <0x00000005 0x00000034 0x00000005 0x00000033 0x00000006 0x0000001f>;
  292.                 assigned-clocks = <0x00000005 0x00000055 0x00000005 0x00000054>;
  293.                 assigned-clock-parents = <0x00000005 0x0000001c 0x00000005 0x00000002>;
  294.                 clock-names = "source", "hclk", "source_cg";
  295.                 status = "disabled";
  296.         };
  297.         chosen {
  298.                 stdout-path = "/serial@11002000";
  299.                 tick-timer = "/timer@10008000";
  300.         };
  301.         memory@40000000 {
  302.                 device_type = "memory";
  303.                 reg = <0x40000000 0x10000000>;
  304.         };
  305. };
复制代码

点评

是的,但它不是具体机型的,它相当于是一个公版,是这一类机型共有的基础内容  详情 回复 发表于 2024-3-28 20:11
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2024-3-28 20:11 | 显示全部楼层
460418589 发表于 2024-3-28 19:57
下面这段提取出来的的是dtb信息吗?我看跟其他型号的格式差别很大

是的,但它不是具体机型的,它相当于是一个公版,是这一类机型共有的基础内容
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2024-4-1 21:01 | 显示全部楼层
支持楼主这种研究态度,希望加把力,把我的那台mr3000d-ciq新版也早日研究出来。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2024-4-8 09:47 | 显示全部楼层
牛逼的不要不要的,技术贴
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2024-4-8 16:01 | 显示全部楼层
这真太6了,向您学习
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2024-4-10 22:17 | 显示全部楼层
太牛了 。SSH文件上传后点恢复吗   
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2024-4-10 23:48 | 显示全部楼层
差生 在看了一遍  默默流泪远去
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2024-4-11 07:55 | 显示全部楼层
luoluo788 发表于 2024-4-10 23:48
差生 在看了一遍  默默流泪远去

还有另外两篇不同机型的也可以看看~会有启发的
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2024-4-11 10:26 | 显示全部楼层
6666啊。这个论坛就是牛人多。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2024-4-11 10:55 | 显示全部楼层
太牛了,,技术大佬
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2024-4-16 11:40 | 显示全部楼层
可以可以,帖子很有用
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-27 15:17

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表