开发者

Base64 encoded modifying just printable char

开发者 https://www.devze.com 2023-04-13 03:49 出处:网络
I have a base64 string that contains not printable chars. I want to modify just the printable one. But i can\'t use base64 -d because I will lost the not printable ones.

I have a base64 string that contains not printable chars.

I want to modify just the printable one. But i can't use base64 -d because I will lost the not printable ones.

Is that a command that allow me to do that?

Example, if I do

echo "base64 string" | base64 -d | od -c 

I obtain

0000000 004 002 254 334   0 202 003 362  \f  \0   0 202 003 354   0 202
0000020 003 350 002 002 006 021   0   -   0   )   0 036 002 004   A 343
0000040 271   |开发者_如何学Python 002 003  \0 352 233 002 002 021 340 002 002  \0 232 002
0000060 001   . 004 006  \0  \f   ) 346 353 323  \f  \a   J   0   0   6
0000100   0   6

etc...

let's say I want to modify just the J 0 0 with J 0 1...I can do this?

UPDATE:

For the moment the solution was in convert and output the base64 decode into a file and then edit it with an HEX Editor.

So if you know some command line HEX Editor native included in linux please tell me


When I try it on my system I get

base64: invalid input

Since you want printable characters only, I'm suspecting that what you want is a base64 encoded string.

If so, you should skipe the -d option:

echo "base64 string" | base64 | od -c

If you really want to change some characters into others, you could use the tr (translate) command:

From man tr:

tr - translate or delete characters

0

精彩评论

暂无评论...
验证码 换一张
取 消