ConfuserEx icon indicating copy to clipboard operation
ConfuserEx copied to clipboard

not working as expected

Open Json-WB opened this issue 7 years ago • 12 comments

net framework 4 confuserEX v 1.0.0

it does not work with below code and return nothing from Json !! although the code itself is working fine after normal compiling ...

JavaScriptSerializer Json = new JavaScriptSerializer(); Elements = Json.Deserialize<Elements>(JsonData);

Json-WB avatar Aug 30 '18 08:08 Json-WB

There is a severe lack of details here.

Please specify what your settings for the obfuscation are. Please also add some more details regarding what Elements and JsonData contains. It would also help if you could provide me with the actual assembly you are trying to obfuscate for analysis.

In the mean time you can also try my fork of ConfuserEx. It contains lots of bug fixes. You find the latest version here: ConfuserEx - AppVeyor.

mkaring avatar Sep 02 '18 17:09 mkaring

thanks for response

unfortunately, it doesn't work with new version too...

the setting of obfuscation is 'normal' without any additional option but generally it doesn't work with any config

the problem happened with the class below :

class Val { private string givenToken; private wholeTokenElement TokenElement;

public string accessToken;
public string expires;
public string expires_in;
public string email;
public string idToken;
public string userId;
public string displayName;
public string familyName;
public string givenName;
public string imageUrl;

public Val(string TheToken)
{
    givenToken = TheToken;
    GetWholeTokenElement(givenToken);

}

class wholeTokenElement
{
    public string accessToken;
    public string expires;
    public string expires_in;
    public string email;
    public string idToken;
    public string userId;
    public string displayName;
    public string familyName;
    public string givenName;
    public string imageUrl;
}

private void GetWholeTokenElement(string givenToken)
{
    JavaScriptSerializer Json = new JavaScriptSerializer();
    TokenElement = Json.Deserialize<wholeTokenElement>(givenToken);
    accessToken = TokenElement.accessToken;
    expires = TokenElement.expires;
    expires_in = TokenElement.expires_in;
    email = TokenElement.email;
    idToken = TokenElement.idToken;
    userId = TokenElement.userId;
    displayName = TokenElement.displayName;
    familyName = TokenElement.familyName;
    givenName = TokenElement.givenName;
    imageUrl = TokenElement.imageUrl;
}

}

when I gave it Json like below:

{'accessToken':'hfhffggfddhhdh','expires':1535545491,'expires_in':3597,'email':'[email protected]','idToken':'yytytytytytyytytyty','userId':'8776655','displayName':'JB','familyName':'JB','givenName':'JB','imageUrl':'http://WebPath.NET/File.Jpg'}

it just return nothing after obfuscating the code!!

thanks in advance

Json-WB avatar Sep 04 '18 13:09 Json-WB

I guess the source of the problem is that you are referencing the private nested class as deserialization target. I'll look into that issue as soon as I can.

mkaring avatar Sep 04 '18 14:09 mkaring

I separated the classes and the problem still exist... thanks in advance for your efforts

Json-WB avatar Sep 04 '18 15:09 Json-WB

You are using the very old JSON serialisation that is part of .NET. The documentation suggests using Json.NET. Is that a option for you? Json.NET is properly supported by ConfuserEx.

I'll work on supporting the old serializer. But that may take some time.

mkaring avatar Sep 04 '18 16:09 mkaring

used it, but it doesn't work also, the same issue!

Json-WB avatar Sep 04 '18 16:09 Json-WB

@Json-WB don't select Renaming protection. It should work as expected (:

XenocodeRCE avatar Sep 05 '18 14:09 XenocodeRCE

@XenocodeRCE I did not use this option at all!

Json-WB avatar Sep 06 '18 07:09 Json-WB

@Json-WB Renaming is part of the "normal" preset. You can explicitly remove it by adding a new line in the configuration where you selected "normal". Choose "Remove" in the first combo box and "rename" in the second. That will disable the renaming.

The other alternative is add the attribute

[System.Reflection.Obfuscate(Exclude = false, Feature = "-rename")]

to the wholeTokenElement class or to every field in this class.

mkaring avatar Sep 06 '18 08:09 mkaring

Wow, it's working with removing the rename from configuration but not working with attribute ... and after all this make ConfuserEx lose one of its feature !

Json-WB avatar Sep 06 '18 11:09 Json-WB

You also have the [Serializable] attribute for JSON specific data ... not sure if ConfuserEx handle it

XenocodeRCE avatar Sep 08 '18 17:09 XenocodeRCE

The [Serializable] attribute works. So does using JSON.net with explicit attributes that mark the names of the fields in the json file.

mkaring avatar Sep 08 '18 22:09 mkaring