windows下PHP批量生成打包android程序APK-渠道txt植入apk文件
服务器安装php环境
下载 android-sdk-windows 下载JDK
1.打开zip支持 c:/windows/php.ini ,打开 exec
2.apk 支持
mime添加 .apk application/vnd.android.package-archive
3.安装javaSDK(要和android的编辑版本一致)
4.编辑IIS绑定权限(www:www) ,目录没有权限会导致生成失败
5.配置两个虚拟主机
A:down.coolaj.cn 用于下载
B:make.cookaj.cn 用于制作签名
6. down的index.php
<?php
/*
* Created on 2012-5-21
* coolaj.cn
*/ // var_dump($id); function cocode() { foreach($_GET as $k=>$v){
$id = $k;
break;
}
if($_GET['u']){
$id=$_GET['u'];
}
if(is_numeric($id)){
return $id;
}elseif ($id && preg_match('/^U/', $id)) {
$id = base64_decode(substr($id,1).'=')>>2;
return $id;
}
} $id = cocode(); if(file_exists('bbshenqi'.$id.".apk") || empty($id)){
if(empty($id)){
header('Location: http://www.coolaj.cn/bbshenqi.apk');
exit;
}
header('Location: http://down.coolaj.cn/bbshenqi'.$id.'.apk');
}else{
$cc =file_get_contents("http://make.coolaj.cn/makeapk.php?apkname=".$id.'&r=简单加密');
if($cc == 'ok'){
if(file_exists('bbshenqi'.$id.".apk")){
echo '<meta http-equiv="content-type" content="text/html; charset=gbk" />';
echo '<a href="http://down.coolaj.cn/bbshenqi'.$id.'.apk">生成失败,点击重试</a>';
exit;
}
header('Location: http://down.coolaj.cn/bbshenqi'.$id.'.apk');
}
} ?>
7.makeapk.php
<?php
set_time_limit(0);
function zip($dir,$filename,$missfile=array(),$addfromString=array()){
if(!file_exists($dir) || !is_dir($dir)){
die(' can not exists dir '.$dir);
}
if(strtolower(end(explode('.',$filename))) != 'zip'){
die('only Support zip files');
}
$dir = str_replace('\\','/',$dir);
$filename = str_replace('\\','/',$filename);
if(file_exists($filename)){
die('the zip file '.$filename.' has exists !');
}
$files = array();
getfiles($dir,$files);
if(empty($files)){
die(' the dir is empty');
} $zip = new ZipArchive;
$res = $zip->open($filename, ZipArchive::CREATE);
if ($res === TRUE) {
foreach($files as $v){
if(!in_array(str_replace($dir.'/','',$v),$missfile)){
$zip->addFile($v,str_replace($dir.'/','',$v));
//$zip->addFile($v,str_replace($dir.'/','./',$v));
}
}
if(!empty($addfromString)){
foreach($addfromString as $v){
$zip->addFromString($v[0],$v[1]);
}
}
$zip->close();
//echo 'unsigin apk ok!<br>';
} else {
echo 'failed';
}
} function getfiles($dir,&$files=array()){
if(!file_exists($dir) || !is_dir($dir)){return;}
if(substr($dir,-1)=='/'){
$dir = substr($dir,0,strlen($dir)-1);
}
$_files = scandir($dir);
foreach($_files as $v){
if($v != '.' && $v!='..'){
if(is_dir($dir.'/'.$v)){
getfiles($dir.'/'.$v,$files);
}else{
$files[] = $dir.'/'.$v;
}
}
}
return $files;
} function file_content_replace($filename, $search, $replace){
$string = file_get_contents($filename);
$new_string = str_replace($search, $replace, $string);
if($string !=$new_string) file_put_contents($filename, $new_string);
} function goapk ($file){
exec("del bbshenqi.zip");
exec("del bbshenqi.apk");
exec("del gosign.bat");
exec("del D:\android\apk\bbshenqi\assets\unionid.txt");
exec("copy /Y demo.bat gosign.bat");
file_content_replace("gosign.bat","00000.apk",$file.'.apk');
exec('echo '.$file.'>D:\android\apk\bbshenqi\assets\unionid.txt');
zip("bbshenqi", "bbshenqi.zip");
exec("copy /Y bbshenqi.zip bbshenqi.apk");
exec("gosign.bat");
}
if($_GET['apkname']){
$name = $_GET['apkname'];
$r= $_GET['r'];
if($r=='yourpass'){
goapk($name);
echo 'ok';
} }
exit; ?>
8.demo.bat
"C:/Program Files/Java/jdk1.6.0_45/bin/jarsigner" -verbose -keystore key.keystore -storepass yourpass -storetype jks -sigfile CERT -signedjar bbshenqi_signed.apk bbshenqi.apk key.keystore
"D:\android\android-sdk-windows\tools\zipalign" -v 4 bbshenqi_signed.apk d:\apk\bbshenqi00000.apk
del bbshenqi_signed.apk
del bbshenqi.apk
windows下PHP批量生成打包android程序APK-渠道txt植入apk文件的更多相关文章
- windows下使用adb工具查看android程序cpu和内存消耗情况
在实际的开发当中,尤其软件运行在一个硬件设备比较差的环境下,对软件占用资源大的问题是开发者们必须要解决的问题,系统比较卡.觉得应该看看程序的cpu和内存消耗 一直以来都在windows下编程,已经习惯 ...
- MAC下配置gradle用eclipse 打包android程序
1.下载gradle binhttp://gradle.org/gradle-download/ 2.配置gradle,http://www.douban.com/note/311599602/htt ...
- Windows下将ImageMagick移植到Android平台
Windows下将ImageMagick移植到Android平台 原文链接 http://www.pedant.cn/2014/06/18/imagemagick-ported-android/ I ...
- 用Ant手动打包android程序,android分包机制解决65536方法过多异常
Android利用ant手动打包 首先我们要给自己的IDE eclispe配置ant,默认的eclipse是集成了ant构建工具的,但是google提供的Android集成开发工具ADT,里面封装了E ...
- windows下如何批量修改文件名
windows下如何批量修改文件名 一.总结 一句话总结:就是用excel生成了多条修改文件名的dos命令然后执行,比较核心的就是把图片名称导入excel 将图片名称导入excel---编写如下DOS ...
- Windows 下使用OpenSSL生成RSA公钥和私钥
Windows 下使用OpenSSL生成RSA公钥和私钥 (1)下载OpenSSL 可到该地址下载OpenSSL: https://www.openssl.org/source/(https://ww ...
- sencha touch 扩展篇之将sencha touch打包成安装程序(下)- 使用phonegap打包安装程序
这讲我们来讲解下如何使用phonegapa创建项目环境并通过她们将sencha touch打包成app,这里我们只讲解打包android的apk,打包ios的过程有点类似,但是需要在mac环境 ...
- Windows 下使用 mingw+msys 交叉编译 Android Unity Mono
对于没有升级到 Unity5.4的用户,发布安卓版本都会有对 C# 脚本进行加密的需求,我们项目在裸奔了很长时间后,决定开始做这件事. 网上查看了很多资料,我很希望直接在 windows 下编译而不去 ...
- windows下Qt5.1.0配置android环境搭建 good
1.首先下载好需要配置的软件: 1>Qt 5.1.0 for Android (Windows 32-bit, 716 MB)(Info)下载地址: http://qt-project.org/ ...
随机推荐
- VIM 代码折叠
VIM 代码折叠 VIM代码折叠方式可以用"foldmethod"选项来设置,如: set foldmethod=indent 有6种方式来折叠代码 1. manual //手工定 ...
- ImportError: No module named MySQLdb
ImportError: No module named MySQLdb 该错误是源于我们没有安装Python连接MySQL所需的MySQLdb库而引起. python3.5下的解决方法ubuntu系 ...
- checkbox --jquery
<input type="checkbox" value="2" class="ace ace-checkbox-2" id='ass ...
- Supercell only provide the best games for players
Supercell only provide the best games for players Supercell start to change all, Supercell's first t ...
- java集合-- arraylist小员工项目
import java.io.*; import java.util.ArrayList; public class Emexe { public static void main(String[] ...
- OC测试错误整理
3. NSDictionary *dict = [NSDictionary dictionaryWithObject:@"a value" forKey:@"aKey&q ...
- Rhel6-puppet集中配置管理系统配置文档
puppet 是一个配置管理工具, 典型的, puppet 是一个 C/S 结构, 当然,这里的 C 可以有很多,因 此,也可以说是一个星型结构. 所有的 puppet 客户端同一个服务器端的 pup ...
- 安装EditPlus
生成注册码:http://www.jb51.net/tools/editplus/ 862C2-DABE8-E30AA-CCE33-65E69
- 获取本地soapUI项目路径
def projectDir = ${projectDir}
- Spring使用——环境部署和配置问题总结
众所周知,spring是Java中一个非常非常重要的框架,主要提供了依赖注入DI,和切面编程AOP.我多年前做过一段时间的Java,不过那时候项目中没有用Spring,所以一直也没有特别注意,最近看了 ...