Skip to content

Commit

Permalink
obfuscation detector needs to consider nested java classes and numeri…
Browse files Browse the repository at this point in the history
…c names.
  • Loading branch information
Atsushi Eno committed Oct 17, 2012
1 parent 2358d6d commit 8bc7d73
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions JavaPackage.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public void appendToDocument (Document doc, Element parent)
Collections.sort (classes);
for (int i = 0; i < classes.size (); i++) {
String name = classes.get (i).getName ();
int idx = name.lastIndexOf ('.');
int idx = name.lastIndexOf ('$');
idx = idx < 0 ? name.lastIndexOf ('.') : idx;
String body = idx < 0 ? name : name.substring (idx + 1);
if (isObfuscatedName (body))
classes.get (i).setObfuscated (true);
Expand All @@ -76,7 +77,7 @@ public void appendToDocument (Document doc, Element parent)
static boolean isObfuscatedName (String name)
{
for (char c : name.toCharArray ())
if (c != '$' && (c < 'a' || 'z' < c))
if (c != '$' && (c < 'a' || 'z' < c) && (c < '0' || '9' < c))
return false;
return true;
}
Expand Down

0 comments on commit 8bc7d73

Please sign in to comment.