Skip to content

Commit

Permalink
update proguard. clean log.
Browse files Browse the repository at this point in the history
  • Loading branch information
KagayamaKaede committed Nov 9, 2015
1 parent eca91b1 commit 9c9b8f2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
13 changes: 5 additions & 8 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
# -dontoptimize
-dontpreverify
# -dontpreverify
-verbose
-ignorewarning

-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* #Confusion algorithm
-optimizations !code/simplification/cast
-optimizations !field/*, !class/merging/*

-allowaccessmodification
-useuniqueclassmembernames
-keepattributes *Annotation*,Exceptions,Signature,SourceFile,LineNumberTable,InnerClass,EnclosingMethod
-dontwarn android.support.**
-dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers

-dontwarn org.xbill.**
-keep class com.proxy.shadowsocksr.** { *; }
-keep class com.proxy.shadowsocksr.items.SSRProfile { *; }
-keep class com.proxy.shadowsocksr.items.GlobalProfile { *; }

# 不混淆 下面类及其子类
-keep public class * extends android.app.Fragment
Expand Down Expand Up @@ -45,7 +43,6 @@
public static final android.os.Parcelable$Creator *;
}


#不混淆Serializable的子类
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
Expand Down Expand Up @@ -117,7 +114,7 @@
}

# Keep GSON stuff
-keep class sun.misc.Unsafe { *; }
# -keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.** { *; }

# Application classes that will be serialized/deserialized over Gson
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ public void stopUDPRelayServer()
remoteChannel.connect(isaRemote);
boolean isProtected = onNeedProtectUDPListener
.onNeedProtectUDP(remoteChannel.socket());
Log.e("EXC", isProtected ? "UDP PROTECTED" : "UDP PROTECT FAILED");
if (isProtected)
{
handler = new UDPRemoteDataHandler(localAddress, remoteChannel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public class HttpSimpleObfs extends AbsObfs
public HttpSimpleObfs(String usrParamStr, String rmtIP, int rmtPort, int tcpMss)
{
super(usrParamStr, rmtIP, rmtPort, tcpMss);
obfsParam = usrParamStr == null || usrParamStr.equals("") ? "mvnrepository.com" : usrParamStr;
obfsParam = usrParamStr == null || usrParamStr.equals("") ? "mvnrepository.com" :
usrParamStr;
}

private boolean headSent = false;
Expand All @@ -30,7 +31,7 @@ public HttpSimpleObfs(String usrParamStr, String rmtIP, int rmtPort, int tcpMss)
headSent = true;
if (data.length > 64)
{
int headLen = Utils.randomInt(64)+1;
int headLen = Utils.randomInt(64) + 1;
byte[] out = encodeHead(Arrays.copyOfRange(data, 0, headLen));
byte[] end = new byte[out.length + (data.length - headLen)];
System.arraycopy(out, 0, end, 0, out.length);
Expand Down Expand Up @@ -64,17 +65,17 @@ private byte[] encodeHead(byte[] data)
//
headRecv = true;
int pos = -1;
int cnt = data.length - 5;
int cnt = data.length - 4;
// //TODO may be can...
for (int i = 214; i < cnt; i++)
for (int i = 219; i < cnt; i++)
{
if (data[i] == '\r' && data[i + 1] == '\n' &&
data[i + 2] == '\r' && data[i + 3] == '\n')
{
pos = i + 4;
}
}
if (pos == -1)
if (pos == -1 || pos==data.length)
{
return new byte[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ private int getHeadSize(byte[] buf, int dft)
data = vsp.beforeEncrypt(data);
byte[] out = new byte[firstPkg.length + data.length];
System.arraycopy(firstPkg, 0, out, 0, firstPkg.length);
Utils.bytesHexDmp("FP", firstPkg);
System.arraycopy(data, 0, out, firstPkg.length, data.length);
//
return out;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.proxy.shadowsocksr.impl.plugin.proto;

import android.util.Log;

import com.proxy.shadowsocksr.impl.Utils;

import java.nio.ByteBuffer;
Expand Down Expand Up @@ -73,7 +71,6 @@ private byte[] packData(byte[] data)
{
if (buf.length - i < 7)
{
Log.e("EXC", "TOO SHORT");
tmpBytes = Arrays.copyOfRange(buf, i, buf.length);
break;
}
Expand All @@ -82,7 +79,6 @@ private byte[] packData(byte[] data)
//
if (len < 7 || len > 8191)
{
Log.e("EXC", "TOO LONG OR SHORT");
return new byte[0];
}
//
Expand Down

0 comments on commit 9c9b8f2

Please sign in to comment.