百度贴吧sign整理

package com.baidu.tbadk.f;

import android.os.Build;
import android.text.TextUtils;
import com.baidu.adp.framework.a.d;
import com.baidu.adp.framework.message.HttpMessage;
import com.baidu.adp.framework.task.HttpMessageTask;
import com.baidu.adp.framework.task.HttpMessageTask.HTTP_METHOD;
import com.baidu.adp.lib.stats.p;
import com.baidu.adp.lib.util.z;
import com.baidu.tbadk.TbConfig;
import com.baidu.tbadk.core.TbadkCoreApplication;
import com.baidu.tbadk.core.util.ao;
import com.baidu.tbadk.core.util.ap;
import com.baidu.tbadk.core.util.httpNet.h;
import com.baidu.tbadk.task.TbHttpMessageTask;
import java.util.List;
import java.util.Map.Entry;

public class a
extends d
{
public a(int paramInt)
{
super(paramInt);
}

private void a(HttpMessage paramHttpMessage, TbHttpMessageTask paramTbHttpMessageTask)
{
if (paramTbHttpMessageTask.isFromCDN()) {
paramHttpMessage.removeAllParams();
}
do
{
return;
if (paramTbHttpMessageTask.isUseCurrentBDUSS()) {
c(paramHttpMessage);
}
if (paramTbHttpMessageTask.isNeedAddCommenParam()) {
c(paramHttpMessage, paramTbHttpMessageTask);
}
e(paramHttpMessage);
} while ((paramTbHttpMessageTask.getMethod() != HttpMessageTask.HTTP_METHOD.POST) || (!paramTbHttpMessageTask.isBaiduServer()));
d(paramHttpMessage);
}

private void b(HttpMessage paramHttpMessage, TbHttpMessageTask paramTbHttpMessageTask)
{
if (((paramTbHttpMessageTask.isNeedGzip()) && (!paramTbHttpMessageTask.isBDImage())) || (paramTbHttpMessageTask.isFromCDN())) {
paramHttpMessage.addHeader(“Accept-Encoding”, “gzip”);
}
paramHttpMessage.addHeader(“Charset”, “UTF-8”);
paramHttpMessage.addHeader(“User-Agent”, “bdtb for Android ” + TbConfig.getVersion());
if (!TextUtils.isEmpty(TbadkCoreApplication.getCurrentAccount())) {
paramHttpMessage.addHeader(“client_user_token”, TbadkCoreApplication.getCurrentAccount());
}
String str1 = p.eL();
if (!TextUtils.isEmpty(str1)) {
paramHttpMessage.addHeader(“sid”, str1);
}
String str2 = h.getNetType();
if (!TextUtils.isEmpty(str2)) {
paramHttpMessage.addHeader(“net”, str2);
}
}

private void c(HttpMessage paramHttpMessage)
{
String str = TbadkCoreApplication.getCurrentBduss();
if (str != null) {
paramHttpMessage.addParam(“BDUSS”, str);
}
}

private void c(HttpMessage paramHttpMessage, TbHttpMessageTask paramTbHttpMessageTask)
{
paramHttpMessage.addParam(“_client_type”, “2”);
if (!TbadkCoreApplication.getInst().isOfficial()) {
paramHttpMessage.addParam(“apid”, “sw”);
}
paramHttpMessage.addParam(“_client_version”, TbConfig.getVersion());
if (TbadkCoreApplication.getInst().getImei() != null) {
paramHttpMessage.addParam(“_phone_imei”, TbadkCoreApplication.getInst().getImei());
}
String str1 = TbadkCoreApplication.getClientId();
if (str1 != null) {
paramHttpMessage.addParam(“_client_id”, str1);
}
String str2 = TbadkCoreApplication.getFrom();
if ((str2 != null) && (str2.length() > 0)) {
paramHttpMessage.addParam(“from”, str2);
}
String str3 = h.getNetType();
String str4;
if (str3 != null)
{
str4 = com.baidu.tbadk.coreExtra.a.a.rr().rt();
if (!”3″.equalsIgnoreCase(str3)) {
break label231;
}
if (TbadkCoreApplication.getInst().getKeepaliveWifi() == 1) {
str4 = str4 + “ka=open”;
}
}
for (;;)
{
paramHttpMessage.addHeader(“Cookie”, str4);
if (paramTbHttpMessageTask.isNeedTbs()) {
paramHttpMessage.addParam(“tbs”, TbadkCoreApplication.getInst().getTbs());
}
paramHttpMessage.addParam(“cuid”, TbadkCoreApplication.getInst().getCuid());
paramHttpMessage.addParam(“timestamp”, Long.toString(System.currentTimeMillis()));
paramHttpMessage.addParam(“model”, Build.MODEL);
return;
label231:
if (TbadkCoreApplication.getInst().getKeepaliveNonWifi() == 1) {
str4 = str4 + “ka=open”;
}
}
}

private void d(HttpMessage paramHttpMessage)
{
StringBuffer localStringBuffer = new StringBuffer(1024);
List localList = paramHttpMessage.encodeInBackGround();
int i = 0;
if ((localList == null) || (i >= localList.size()))
{
localStringBuffer.append(“tiebaclient!!!”);
paramHttpMessage.addParam(“sign”, z.toMd5(localStringBuffer.toString()));
return;
}
Map.Entry localEntry = (Map.Entry)localList.get(i);
if (localEntry == null) {}
for (;;)
{
i++;
break;
String str = (String)localEntry.getKey();
Object localObject = localEntry.getValue();
if ((localObject instanceof String))
{
localStringBuffer.append(str + “=”);
localStringBuffer.append(localObject);
}
}
}

private void e(HttpMessage paramHttpMessage)
{
ap localap = ao.pp();
if (localap != null)
{
paramHttpMessage.addParam(“stTime”, String.valueOf(localap.mTime));
paramHttpMessage.addParam(“stSize”, String.valueOf(localap.mSize));
paramHttpMessage.addParam(“stTimesNum”, String.valueOf(localap.Jb));
paramHttpMessage.addParam(“stMode”, String.valueOf(localap.mMode));
paramHttpMessage.addParam(“stMethod”, String.valueOf(localap.Ja));
}
int i = ao.bS(0);
if ((i == 0) && (localap != null)) {
i = localap.Jb;
}
paramHttpMessage.addParam(“stErrorNums”, String.valueOf(i));
}

public HttpMessage d(HttpMessage paramHttpMessage, HttpMessageTask paramHttpMessageTask)
{
if ((paramHttpMessageTask == null) || (!(paramHttpMessageTask instanceof TbHttpMessageTask))) {
return paramHttpMessage;
}
TbHttpMessageTask localTbHttpMessageTask = (TbHttpMessageTask)paramHttpMessageTask;
a(paramHttpMessage, localTbHttpMessageTask);
b(paramHttpMessage, localTbHttpMessageTask);
return paramHttpMessage;
}
}
/* Location: C:\Users\Administrator\Downloads\APK\dex2\classes_dex2jar.jar
* Qualified Name: com.baidu.tbadk.f.a
* JD-Core Version: 0.7.0.1
*/

点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.