简体   繁体   English

这些符号在反编译代码中是什么

[英]What are these symbols in a decompiled code

I decompiled an executable and cant understand what are these symbols in the source code (C#). 我反编译了一个可执行文件,无法理解源代码(C#)中的这些符号是什么。 I would paste source examples here but as I tried pasting, the special characters in the decompiled source are not printable here in this editor. 我会在这里粘贴源代码示例,但是当我尝试粘贴时,反编译源中的特殊字符在此编辑器中不可打印。 So i'm taking few snip images and pasting links here so anyone can see, so examples are: 所以我在这里拍摄几张剪辑图片和粘贴链接,所以任何人都可以看到,所以示例如下:

图片1

图2

图3

what I am guessing is that this source code is obfuscated right? 我猜的是这个源代码被混淆了吗? And that these symbols are OK to exist in the MSIL, but when translated as is in C#, they make for illegal characters. 并且这些符号可以存在于MSIL中,但是当在C#中进行翻译时,它们会产生非法字符。 Is that right? 那正确吗? Any suggestions on how do I get past this, like do a replace-all on this stuff? 关于如何解决这个问题的任何建议,比如对这些东西进行替换?

MSIL has very lax rules for what is allowed as an identifier name. MSIL对于允许作为标识符名称的内容有非常宽松的规则。 Obsfuscators intentionally choose chars which C# cannot represent so you can't roundtrip to C#. 混淆器故意选择C#无法表示的字符,因此您无法往返C#。

You can decompile to IL however and be able to compile the project. 但是,您可以反编译为IL并能够编译项目。

Also look at C#'s unicode identifiers . 另请查看C#的unicode标识符 You can have unicode escape code inside of C# identifiers which is surprising to many. 您可以在C#标识符中包含unicode转义码,这对许多人来说都是令人惊讶的。 Example: 例:

class @class
{
   public static void @static(bool @bool) {
      if (@bool)
         System.Console.WriteLine("true");
      else
         System.Console.WriteLine("false");
   }   
}
class Class1
{
   static void M() {
      cl\u0061ss.st\u0061tic(true);
   }
}

You could look at the file with a hex editor, figure out the 'rules' of these values, and then you might be able to write yourself a program that would convert them to ascii representations with some prefix - ie, obs_627 or whatever. 您可以使用十六进制编辑器查看该文件,找出这些值的“规则”,然后您可以自己编写一个程序,将它们转换为具有一些前缀的ascii表示 - 即obs_627或其他。

Of course you can only change names which will be referred to only from within the codebase you are changing. 当然,您只能更改仅在您要更改的代码库中引用的名称。 Any external linkage to these special names, or internal use of whatever the equivalent of reflection is, would break. 与这些特殊名称的任何外部联系,或任何相当于反射的内部使用都会破坏。 If there's reason to expect either of these are the case, then it would be a wasted effort. 如果有理由期待其中任何一种都是这种情况,那么这将是一种浪费的努力。

These are from the old MS-DOS ANSI character set. 这些来自旧的MS-DOS ANSI字符集。

The first example you posted contains ASCII line drawing characters. 您发布的第一个示例包含ASCII线条绘制字符。 IIRC, they started around 172 decimal (0xAC hex) or so. IIRC,他们开始大约172十进制(0xAC十六进制)左右。

The second and third contain ASCII characters between 1 and 31 decimal (0x01-0x1F in hex notation). 第二个和第三个包含1到31个十进制之间的ASCII字符(十六进制表示法为0x01-0x1F)。

You can't copy and paste them because the characters displayed don't exist in most modern fonts. 您无法复制和粘贴它们,因为大多数现代字体中不存在显示的字符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM