Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8037

General • Re: Procedure for protecting "data" on Pico 2

$
0
0
I am not convinced that's enough obfuscation to hide secrets using MicroPython. I haven't built a full MicroPython to test but I believe the bytecode generated should be the same whether included in a full build as it is from using 'mpy-cross' to create a '.mpy' file.
I just constructed a test and found the way the list is stored in bytecode will allow it to be display as characters in HEXDUMP -C as you found.

Code:

#------------------------------------------------------------------------# RECOMPOSE(LIST) - Recreate the string decomposed from DECOMPOSE(STRING)def recompose(eval_list): # Input must be of type LIST     rtn=""    for c in eval_list:        rtn=rtn+chr(c)        return rtn#------------------------------------------------------------------------# Main Line# Set Parametersfrom_email=recompose([112,97,117,108,64,115,111,109,101,100,111,109,97,105,110,46,99,111,109])to_email= from_emailprint(to_email)email_pass=recompose([49,50,51,52,115,111,109,101,70,97,110,99,121,80,97,115,115,119,111,114,100,33,64,42,35])print(email_pass)
Dump from .mpy

Code:

$ hexdump -C uPy_test.mpy00000000  4d 06 00 1f 0a 00 1a 2e  2f 75 50 79 5f 74 65 73  |M......./uPy_tes|00000010  74 2e 70 79 00 0f 12 72  65 63 6f 6d 70 6f 73 65  |t.py...recompose|00000020  00 03 14 66 72 6f 6d 5f  65 6d 61 69 6c 00 10 74  |...from_email..t|00000030  6f 5f 65 6d 61 69 6c 00  81 77 14 65 6d 61 69 6c  |o_email..w.email|00000040  5f 70 61 73 73 00 12 65  76 61 6c 5f 6c 69 73 74  |_pass..eval_list|00000050  00 81 09 8a 7c c8 10 18  01 60 84 0c 1f 1f 21 24  |....|....`....!$|00000060  27 1f 1f 2b 32 00 16 02  11 02 22 80 70 22 80 61  |'..+2.....".p".a|00000070  22 80 75 22 80 6c 22 80  40 22 80 73 22 80 6f 22  |".u".l".@".s".o"|00000080  80 6d 22 80 65 22 80 64  22 80 6f 22 80 6d 22 80  |.m".e".d".o".m".|00000090  61 22 80 69 22 80 6e ae  22 80 63 22 80 6f 22 80  |a".i".n.".c".o".|000000a0  6d 2b 13 34 01 16 04 11  04 16 05 11 06 11 05 34  |m+.4...........4|000000b0  01 59 11 02 22 31 22 32  22 33 22 34 22 80 73 22  |.Y.."1"2"3"4".s"|000000c0  80 6f 22 80 6d 22 80 65  22 80 46 22 80 61 22 80  |.o".m".e".F".a".|000000d0  6e 22 80 63 22 80 79 22  80 50 22 80 61 22 80 73  |n".c".y".P".a".s|000000e0  22 80 73 22 80 77 22 80  6f 22 80 72 22 80 64 a1  |".s".w".o".r".d.|000000f0  22 80 40 aa a3 2b 19 34  01 16 07 11 06 11 07 34  |".@..+.4.......4|00000100  01 59 51 63 01 81 68 49  0e 02 08 60 20 23 25 4a  |.YQc..hI...` #%J|00000110  10 03 c1 b0 5f 4b 0b c2  b1 12 09 b2 34 01 f2 c1  |...._K......4...|00000120  42 33 b1 63                                       |B3.c|00000124
So I thank you for exposing some holes in my approach especially wrt to uPython. I'll be updating my GIT repo.

Statistics: Posted by DS256 — Thu Apr 10, 2025 8:30 pm



Viewing all articles
Browse latest Browse all 8037

Trending Articles