felix17
2022-03-02 04:26
采纳率: 100%
浏览 22

C# 如何解码SSR?

SSR:Y24wMS5lZmFuLm1lbjo4NzUxOm9yaWdpbjpyYzQtbWQ1Omh0dHBfcG9zdDpaV1poYm1OamVYVnUvP29iZnNwYXJhbT1Nak13TnpRdGRUa3phRTR5YVdGRk9TNWtiM2R1Ykc5aFpDNXRhV055YjNOdlpuUXVZMjl0JnByb3RvcGFyYW09JnJlbWFya3M9NmFhWjVyaXZNREUmZ3JvdXA9NmFXXzZhV3RZMlBrdXBFZ0xTQkg2SzZoNVlpUzc3eUlNVEF3TUVkQzc3eUo

使用Python脚本解码出来的结果:
脚本来自:https://github.com/luvvien/ss-ssr-url-parser/blob/master/ss_ssr_decode.py
{'ip': 'cn01.efan.men', 'port': '8751', 'protocol': 'origin', 'method': 'rc4-md5', 'obfs': 'http_post', 'password': 'efanccyun'}

但是使用Python的话,每一个使用者都要去配置运行环境,这样很麻烦。

所以我想请问一下是否可以使用C#进行解码?

我尝试使用以下代码进行解码:
string SSR = "Y24wMS5lZmFuLm1lbjo4NzUxOm9yaWdpbjpyYzQtbWQ1Omh0dHBfcG9zdDpaV1poYm1OamVYVnUvP29iZnNwYXJhbT1Nak13TnpRdGRUa3phRTR5YVdGRk9TNWtiM2R1Ykc5aFpDNXRhV055YjNOdlpuUXVZMjl0JnByb3RvcGFyYW09JnJlbWFya3M9NmFhWjVyaXZNREUmZ3JvdXA9NmFXXzZhV3RZMlBrdXBFZ0xTQkg2SzZoNVlpUzc3eUlNVEF3TUVkQzc3eUo";

byte[] newBytes = Convert.FromBase64String(SSR);

string orgStr = BitConverter.ToString(newBytes);

MessageBox.Show(orgStr);

但是无法成功运行,显示:The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.”

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题