|
发现一个视频APP,觉得片源不错,想下载下来看看,首先想到的就是用flidder或者anyproxy
这里使用anyproxy,因为可以二次开发。
但是抓取完后,发现数据全是加密的

既然加密,那就没办法,必须去反编译,看看怎么加密
解压APK后,发现居然是360加壳的。先脱壳
网上很多脱壳方法,exposed+fdex2是不错的。解压出来是:

虽然dex都dump出来了,但发现有一个dex没法打开。用010修改一下文件头就可以用了。
使用jd-gui开始分析。接口加密,当然就很容易找到request相关的类


从以上代码发现:
APP随机生成一个aesKey,然后再用RAS加密一次得到key,用aesKey进行AES/CBC/PKCS7Padding加密得到body。
虽然在接口里,能看到加密后的key,但是因为RSA是不对称加密,本地也没有存储私钥,因此本地也就无法解密,无法查看到原始加密字符串是什么。
那就只能通过exposed hook来查看原始内容是什么了。
既然找到了加密方法是cryptoAESKey,cryptoBody。那么可以写方法如下:

然后就可以看到原始值是什么了:
{
"currentPage": 1,
"pageSize": 5,
"data": 1
}
后面,就可以自己构造数据,进行提交获取数据啦。
小结:
从逆向看代码安全
1. APK本身要混淆加壳
2. 接口安全:Rsa+aes,aes的key通过rsa加密传输,只有客户端本身(客户端本身没法解,但知道rsa加密前的值)和服务端可以解出来。
3. 关键加密代码放在so库里。一些关键的库,可以做签名检验。
<hr/>procedure Tchardatafrm.FormResize(Sender: TObject);
begin
Chart2.Width:=Panel2.Width div 2;
Chart1.Width:=Chart2.Width;
Panel3.Height:= Height div 2;
end;
procedure Tchardatafrm.startThread(itype: Integer);
begin
FTYpe:= itype;
loadconfig;
PostThread:=TPostThread.Create(cxSpinEdit1.Value,itype,Handle,cxSpinEdit2.Value,cxSpinEdit3.Value,FCurBankUser);
{
if itype = 0 then
RichEdit1.Text:= &#39;&#34;3,6,9&#34;,&#34;1,4,7&#34;,&#34;2,5,8&#34;&#39;;
if itype = 1 then
RichEdit1.Text:= &#39;&#34;1,5,6&#34;,&#34;2,3,4&#34;,&#34;7,8,9&#34;&#39;;
if itype = 2 then
RichEdit1.Text:= &#39;&#34;1,6,10&#34;,&#34;2,7,9&#34;,&#34;3,4,8&#34;&#39;;
if itype = 3 then
RichEdit1.Text:= &#39;&#34;3,5,7&#34;,&#34;1,2,6&#34;,&#34;4,9,10&#34;&#39;;
}
end;
procedure Tchardatafrm.FormShow(Sender: TObject);
begin
downIndex[0][0]:=0;
downIndex[0][1]:=0;
downIndex[0][2]:=0;
downIndex[1][0]:=0;
downIndex[1][1]:=0;
downIndex[1][2]:=0;
downIndex[2][0]:=0;
downIndex[2][1]:=0;
downIndex[2][2]:=0;
downIndex[3][0]:=0;
downIndex[3][1]:=0;
downIndex[3][2]:=0;
downIndex[4][0]:=0;
downIndex[4][1]:=0;
downIndex[4][2]:=0;
Chart2.Width:=Panel2.Width div 2;
Chart1.Width:=Chart2.Width;
Panel3.Height:= Height div 2;
{$IFDEF VER2}
drawnumber:=TStringList.Create;
drawnumber.Add(&#39;0&#39;);
drawnumber.Add(&#39;0&#39;);
drawnumber.Add(&#39;0&#39;);
drawnumber.Add(&#39;0&#39;);
drawnumber.Add(&#39;0&#39;);
startThread(0);
{$ENDIF}
{$IFDEF ADMIN}
{Label2.Visible:=True;
cxSpinEdit2.Visible:=True;
Label3.Visible:=True;
cxSpinEdit3.Visible:=True;
Button2.Visible:=True;
Button4.Visible:=True;
Button6.Visible:=True;
Button5.Visible:=True;
}
{$ENDIF}
end;
procedure Tchardatafrm.saveconfig;
var
ifile:TIniFile;
begin
cxTextEdit1.Properties.OnEditValueChanged:=nil;
cxTextEdit2.Properties.OnEditValueChanged:=nil;
cxTextEdit3.Properties.OnEditValueChanged:=nil;
cxTextEdit4.Properties.OnEditValueChanged:=nil;
cxSpinEdit1.Properties.OnEditValueChanged:=nil;
cxTextEdit6.Properties.OnEditValueChanged:=nil;
cxTextEdit7.Properties.OnEditValueChanged:=nil;
cxTextEdit8.Properties.OnEditValueChanged:=nil;
Edit3.OnChange:=nil;
Edit4.OnChange:=nil;
Edit5.OnChange:=nil;
CheckBox3.OnClick:=nil;
CheckBox4.OnClick:=nil;
CheckBox2.OnClick:=nil;
cxTextEdit1.PostEditValue;
cxTextEdit2.PostEditValue;
cxTextEdit3.PostEditValue;
cxTextEdit4.PostEditValue;
cxTextEdit5.PostEditValue;
ifile:=TIniFile.Create(GetCurrentDir+&#39;\cfg.ini&#39;);
try
ifile.WriteString(&#39;cfg&#39;,&#39;user&#39;+inttostr(FTYpe),cxTextEdit4.Text);
ifile.WriteString(&#39;cfg&#39;,&#39;listion1&#39;+inttostr(FTYpe),cxTextEdit1.Text);
ifile.WriteString(&#39;cfg&#39;,&#39;listion2&#39;+inttostr(FTYpe),cxTextEdit2.Text);
ifile.WriteString(&#39;cfg&#39;,&#39;listion3&#39;+inttostr(FTYpe),cxTextEdit3.Text);
ifile.WriteString(&#39;cfg&#39;,&#39;downtext1&#39;+inttostr(FTYpe),cxTextEdit7.Text);
ifile.WriteString(&#39;cfg&#39;,&#39;downtext2&#39;+inttostr(FTYpe),cxTextEdit6.Text);
ifile.WriteString(&#39;cfg&#39;,&#39;downtext3&#39;+inttostr(FTYpe),cxTextEdit8.Text);
ifile.WriteString(&#39;cfg&#39;,&#39;caseFlag1&#39;+inttostr(FTYpe),Edit3.Text);
ifile.WriteString(&#39;cfg&#39;,&#39;caseFlag2&#39;+inttostr(FTYpe),Edit4.Text);
ifile.WriteString(&#39;cfg&#39;,&#39;caseFlag3&#39;+inttostr(FTYpe),Edit5.Text);
ifile.WriteString(&#39;cfg&#39;,&#39;startdate&#39;+inttostr(FTYpe),cxSpinEdit2.Text);
ifile.WriteString(&#39;cfg&#39;,&#39;enddate&#39;+inttostr(FTYpe),cxSpinEdit3.Text);
ifile.WriteString(&#39;cfg&#39;,&#39;listion99&#39;+inttostr(FTYpe),cxTextEdit5.Text);
ifile.WriteString(&#39;cfg&#39;,&#39;look&#39;+inttostr(FTYpe),cxSpinEdit1.Text);
if PostThread <>nil then
PostThread.Flimite:= cxSpinEdit1.Value;
if CheckBox2.Checked then
ifile.WriteInteger(&#39;cfg&#39;,&#39;notecheck2&#39;+inttostr(FTYpe),1)
else
ifile.WriteInteger(&#39;cfg&#39;,&#39;notecheck2&#39;+inttostr(FTYpe),0);
if CheckBox3.Checked then
ifile.WriteInteger(&#39;cfg&#39;,&#39;notecheck3&#39;+inttostr(FTYpe),1)
else
ifile.WriteInteger(&#39;cfg&#39;,&#39;notecheck3&#39;+inttostr(FTYpe),0);
if CheckBox4.Checked then
ifile.WriteInteger(&#39;cfg&#39;,&#39;notecheck4&#39;+inttostr(FTYpe),1)
else
ifile.WriteInteger(&#39;cfg&#39;,&#39;notecheck4&#39;+inttostr(FTYpe),0);
finally
ifile.Free;
cxTextEdit1.Properties.OnEditValueChanged:= cxTextEdit1PropertiesEditValueChanged;
cxTextEdit2.Properties.OnEditValueChanged:= cxTextEdit1PropertiesEditValueChanged;
cxTextEdit3.Properties.OnEditValueChanged:= cxTextEdit1PropertiesEditValueChanged;
cxTextEdit4.Properties.OnEditValueChanged:= cxTextEdit1PropertiesEditValueChanged;
cxSpinEdit1.Properties.OnEditValueChanged:= cxSpinEdit1PropertiesEditValueChanged;
CheckBox2.OnClick:= CheckBox3Click;
CheckBox3.OnClick:= CheckBox3Click;
CheckBox4.OnClick:= CheckBox3Click;
cxTextEdit6.Properties.OnEditValueChanged:=cxTextEdit6PropertiesEditValueChanged;
cxTextEdit7.Properties.OnEditValueChanged:=cxTextEdit6PropertiesEditValueChanged;
cxTextEdit8.Properties.OnEditValueChanged:=cxTextEdit6PropertiesEditValueChanged;
Edit3.OnChange:=Edit3Change;
Edit4.OnChange:=Edit4Change;
Edit5.OnChange:=Edit5Change;
end;
end;
procedure Tchardatafrm.cxTextEdit1PropertiesEditValueChanged(
Sender: TObject);
begin
saveconfig;
end;
procedure Tchardatafrm.loadconfig;
var
ifile:TIniFile;
begin
cxTextEdit1.Properties.OnEditValueChanged:=nil;
cxTextEdit2.Properties.OnEditValueChanged:=nil;
cxTextEdit3.Properties.OnEditValueChanged:=nil;
cxTextEdit4.Properties.OnEditValueChanged:=nil;
cxTextEdit5.Properties.OnEditValueChanged:=nil;
cxTextEdit6.Properties.OnEditValueChanged:=nil;
cxTextEdit7.Properties.OnEditValueChanged:=nil;
cxTextEdit8.Properties.OnEditValueChanged:=nil;
cxSpinEdit2.Properties.OnEditValueChanged:=nil;
cxSpinEdit3.Properties.OnEditValueChanged:=nil;
Edit3.OnChange:=nil;
Edit4.OnChange:=nil;
Edit5.OnChange:=nil;
CheckBox3.OnClick:=nil;
CheckBox4.OnClick:=nil;
CheckBox2.OnClick:=nil;
cxSpinEdit1.Properties.OnEditValueChanged:= nil;
ifile:=TIniFile.Create(GetCurrentDir+&#39;\cfg.ini&#39;);
try
cxTextEdit4.Text:= ifile.ReadString(&#39;cfg&#39;,&#39;user&#39;+inttostr(FTYpe),&#39;&#39;) ;
cxTextEdit1.Text:=ifile.ReadString(&#39;cfg&#39;,&#39;listion1&#39;+inttostr(FTYpe),&#39;&#39;);
cxTextEdit2.Text:=ifile.ReadString(&#39;cfg&#39;,&#39;listion2&#39;+inttostr(FTYpe),&#39;&#39;);
cxTextEdit3.Text:=ifile.ReadString(&#39;cfg&#39;,&#39;listion3&#39;+inttostr(FTYpe),&#39;&#39;);
cxTextEdit5.Text:=ifile.ReadString(&#39;cfg&#39;,&#39;listion99&#39;+inttostr(FTYpe),&#39;&#39;);
cxTextEdit7.Text:=ifile.ReadString(&#39;cfg&#39;,&#39;downtext1&#39;+inttostr(FTYpe),&#39;&#39;);
cxTextEdit6.Text:=ifile.ReadString(&#39;cfg&#39;,&#39;downtext2&#39;+inttostr(FTYpe),&#39;&#39;);
cxTextEdit8.Text:=ifile.ReadString(&#39;cfg&#39;,&#39;downtext3&#39;+inttostr(FTYpe),&#39;&#39;);
cxSpinEdit2.Text:=ifile.ReadString(&#39;cfg&#39;,&#39;startdate&#39;+inttostr(FTYpe),&#39;&#39;);
cxSpinEdit3.Text:=ifile.ReadString(&#39;cfg&#39;,&#39;enddate&#39;+inttostr(FTYpe),&#39;&#39;);
cxSpinEdit1.Text:= ifile.ReadString(&#39;cfg&#39;,&#39;look&#39;+inttostr(FTYpe),&#39;10&#39;);
cxSpinEdit1.PostEditValue;
Edit3.Text:= ifile.ReadString(&#39;cfg&#39;,&#39;caseFlag1&#39;+inttostr(FTYpe),&#39;&#39;);
Edit4.Text:= ifile.ReadString(&#39;cfg&#39;,&#39;caseFlag2&#39;+inttostr(FTYpe),&#39;&#39;);
Edit5.Text:= ifile.ReadString(&#39;cfg&#39;,&#39;caseFlag3&#39;+inttostr(FTYpe),&#39;&#39;);
if ifile.ReadInteger(&#39;cfg&#39;,&#39;notecheck2&#39;+inttostr(FTYpe),0)=0 then
CheckBox2.Checked:=false
else
CheckBox2.Checked:=True;
if ifile.ReadInteger(&#39;cfg&#39;,&#39;notecheck3&#39;+inttostr(FTYpe),0)=0 then
CheckBox3.Checked:=false
else
CheckBox3.Checked:=True;
if ifile.ReadInteger(&#39;cfg&#39;,&#39;notecheck4&#39;+inttostr(FTYpe),0)=0 then
CheckBox4.Checked:=false
else
CheckBox4.Checked:=True;
finally
ifile.Free;
cxTextEdit1.Properties.OnEditValueChanged:= cxTextEdit1PropertiesEditValueChanged;
cxTextEdit2.Properties.OnEditValueChanged:= cxTextEdit1PropertiesEditValueChanged;
cxTextEdit3.Properties.OnEditValueChanged:= cxTextEdit1PropertiesEditValueChanged;
cxTextEdit4.Properties.OnEditValueChanged:= cxTextEdit1PropertiesEditValueChanged;
cxTextEdit5.Properties.OnEditValueChanged:=cxTextEdit1PropertiesEditValueChanged;
CheckBox2.OnClick:= CheckBox3Click;
CheckBox3.OnClick:= CheckBox3Click;
CheckBox4.OnClick:= CheckBox3Click;
cxTextEdit6.Properties.OnEditValueChanged:=cxTextEdit6PropertiesEditValueChanged;
cxTextEdit7.Properties.OnEditValueChanged:=cxTextEdit6PropertiesEditValueChanged;
cxTextEdit8.Properties.OnEditValueChanged:=cxTextEdit6PropertiesEditValueChanged;
cxSpinEdit2.Properties.OnEditValueChanged:=cxSpinEdit2PropertiesEditValueChanged;
cxSpinEdit3.Properties.OnEditValueChanged:=cxSpinEdit3PropertiesEditValueChanged; |
|