Skip to content
This repository has been archived by the owner on Jan 27, 2019. It is now read-only.

not working as expected #674

Open
Json-WB opened this issue Aug 30, 2018 · 12 comments
Open

not working as expected #674

Json-WB opened this issue Aug 30, 2018 · 12 comments

Comments

@Json-WB
Copy link

Json-WB commented Aug 30, 2018

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(JsonData);

@mkaring
Copy link

mkaring commented Sep 2, 2018

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.

@Json-WB
Copy link
Author

Json-WB commented Sep 4, 2018

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

@mkaring
Copy link

mkaring commented Sep 4, 2018

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.

@Json-WB
Copy link
Author

Json-WB commented Sep 4, 2018

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

@mkaring
Copy link

mkaring commented Sep 4, 2018

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.

@Json-WB
Copy link
Author

Json-WB commented Sep 4, 2018

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

@XenocodeRCE
Copy link
Contributor

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

@Json-WB
Copy link
Author

Json-WB commented Sep 6, 2018

@XenocodeRCE I did not use this option at all!

@mkaring
Copy link

mkaring commented Sep 6, 2018

@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.

@Json-WB
Copy link
Author

Json-WB commented Sep 6, 2018

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 !

@XenocodeRCE
Copy link
Contributor

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

@mkaring
Copy link

mkaring commented Sep 8, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants