unity打成aar上传到maven库的工具
需求:
把unity打成aar并上传到maven库
其实就是把前两个博客整合了一下
这里先说eclipse版的
package com.jinkejoy.build_aar; import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile; import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField; public class EcAarBuildUpload {
private static final String BUILD_PROJECT_PATH = "./aar-build";
private static final String UPLOAD_PROJECT_PATH = "./aar-upload"; private JFrame jFrame; private JTextField sourceText;
private JButton sourceButton;
private File sourceFile; private JTextField sdkText;
private JButton sdkButton;
private File sdkFile; private JTextField ndkText;
private JButton ndkButton;
private File ndkFile; private JTextField groupIdText;
private JTextField aarNameText;
private JTextField versionText; private JButton buildButton;
private JButton uploadButton; public static void main(String[] args) {
new EcAarBuildUpload();
} public EcAarBuildUpload() {
openFileWindow();
} private void openFileWindow() {
jFrame = new JFrame();
jFrame.setTitle("将android工程打成aar并上传到maven库");
jFrame.setBounds(500, 500, 700, 250);
jFrame.setVisible(true);
FlowLayout layout = new FlowLayout();
layout.setAlignment(FlowLayout.LEFT);
//选择文件
JLabel sourceLabel = new JLabel("工程路径:");
sourceText = new JTextField(50);
sourceButton = new JButton("浏览");
//输出路径
JLabel sdkLabel = new JLabel("本地sdk路径:");
sdkText = new JTextField(48);
sdkButton = new JButton("浏览");
//sdk
JLabel ndkLabel = new JLabel("本地ndk路径:");
ndkText = new JTextField(48);
ndkButton = new JButton("浏览");
//上传aar
JLabel groupIdLabel = new JLabel("aar前缀包名:");
groupIdText = new JTextField(54);
JLabel aarNameLabel = new JLabel("aar名称:");
aarNameText = new JTextField(56);
JLabel versionLabel = new JLabel("aar版本号:");
versionText = new JTextField(55);
buildButton = new JButton("构建aar");
uploadButton = new JButton("上传aar"); jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.setLayout(layout);
jFrame.setResizable(false);
jFrame.add(sourceLabel);
jFrame.add(sourceText);
jFrame.add(sourceButton);
jFrame.add(sdkLabel);
jFrame.add(sdkText);
jFrame.add(sdkButton);
jFrame.add(ndkLabel);
jFrame.add(ndkText);
jFrame.add(ndkButton);
jFrame.add(groupIdLabel);
jFrame.add(groupIdText);
jFrame.add(aarNameLabel);
jFrame.add(aarNameText);
jFrame.add(versionLabel);
jFrame.add(versionText);
jFrame.add(buildButton);
jFrame.add(uploadButton); chooseSourceFile();
chooseSdkFile();
chooseNdkFile(); buildAarButton();
uploadAarButton(); getCacheInput();
} private void getCacheInput() {
sourceText.setText(CacheUtils.getCacheInput("sourcePath"));
sdkText.setText(CacheUtils.getCacheInput("sdkPath"));
ndkText.setText(CacheUtils.getCacheInput("ndkPath"));
groupIdText.setText(CacheUtils.getCacheInput("groupId"));
aarNameText.setText(CacheUtils.getCacheInput("aarName"));
versionText.setText(CacheUtils.getCacheInput("version"));
} private void buildAar() {
if (checkInput()) return;
CacheUtils.cacheInput(sourceText, sdkText, ndkText, groupIdText, aarNameText, versionText);
createAsFile();
findUpdateFile(BUILD_PROJECT_PATH);
gradleBuildAar();
} private void gradleBuildAar() {
String command = "cmd /c start gradle clean assembleDebug";
File cmdPath = new File(BUILD_PROJECT_PATH);
Runtime runtime = Runtime.getRuntime();
try {
Process process = runtime.exec(command, null, cmdPath);
} catch (IOException e) {
e.printStackTrace();
}
} private void findUpdateFile(String filePath) {
File file = new File(filePath);
if (!file.exists()) {
return;
}
File[] files = file.listFiles();
for (File updateFile : files) {
if (updateFile.isDirectory()) {
findUpdateFile(updateFile.getAbsolutePath());
} else {
switch (updateFile.getName().toString()) {
case "build.gradle":
updateBuildGradle(updateFile.getAbsolutePath());
break;
case "AndroidManifest.xml":
updateManifestFile(updateFile.getAbsolutePath());
break;
case "local.properties":
updateSdkFile(updateFile.getAbsolutePath());
break;
case "UnityPlayerActivity.java":
case "UnityPlayerNativeActivity.java":
case "UnityPlayerProxyActivity.java":
updateFile.delete();
break;
}
}
}
} private void updateSdkFile(String filePath) {
try {
RandomAccessFile sdkFile = new RandomAccessFile(filePath, "rw");
String line;
long lastPoint = 0;
while ((line = sdkFile.readLine()) != null) {
final long point = sdkFile.getFilePointer();
if (line.contains("sdk.dir")) {
String s = line.substring(0);
String sdkStr = sdkText.getText().toString();
String sdkPan = sdkStr.substring(0, 1);
sdkStr = sdkStr.substring(1).replace("\\", "\\\\");
String ndkStr = sdkText.getText().toString();
String ndkPan = ndkStr.substring(0, 1);
ndkStr = ndkStr.substring(1).replace("\\", "\\\\");
String replaceStr = "sdk.dir=" + sdkPan + "\\" + sdkStr + "\n" + "ndk.dir=" + ndkPan + "\\" + ndkStr + "\n ";
String str = line.replace(s, replaceStr);
sdkFile.seek(lastPoint);
sdkFile.writeBytes(str);
}
lastPoint = point;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} private void updateManifestFile(String filePath) {
try {
RandomAccessFile manifestFile = new RandomAccessFile(filePath, "rw");
String line;
long lastPoint = 0;
while ((line = manifestFile.readLine()) != null) {
final long ponit = manifestFile.getFilePointer();
if (line.contains("<activity") && line.contains("UnityPlayerActivity") && !line.contains("<!--<activity")) {
String str = line.replace("<activity", "<!--<activity");
manifestFile.seek(lastPoint);
manifestFile.writeBytes(str);
}
if (line.contains("</activity>") && !line.contains("</activity>-->")) {
String str = line.replace("</activity>", "</activity>-->\n");
manifestFile.seek(lastPoint);
manifestFile.writeBytes(str);
}
lastPoint = ponit;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} private void updateBuildGradle(String filePath) {
try {
RandomAccessFile buildGradleFile = new RandomAccessFile(filePath, "rw");
String line;
long lastPoint = 0;
while ((line = buildGradleFile.readLine()) != null) {
final long ponit = buildGradleFile.getFilePointer();
if (line.contains("classpath 'com.android.tools.build:gradle")) {
String s = line.substring(line.indexOf("classpath"));
String str = line.replace(s, "classpath 'com.android.tools.build:gradle:2.3.0' \n");
buildGradleFile.seek(lastPoint);
buildGradleFile.writeBytes(str);
}
if (line.contains("com.android.application")) {
String str = line.replace("'com.android.application'", "'com.android.library' \n");
buildGradleFile.seek(lastPoint);
buildGradleFile.writeBytes(str);
}
if (line.contains("compileSdkVersion") && !line.contains("compileSdkVersion 25")) {
String s = line.substring(line.indexOf("compileSdkVersion")).toString();
String str = line.replace(s, "compileSdkVersion 25\n");
buildGradleFile.seek(lastPoint);
buildGradleFile.writeBytes(str);
}
if (line.contains("buildToolsVersion") && !line.contains("buildToolsVersion '25.0.2'")) {
String s = line.substring(line.indexOf("buildToolsVersion")).toString();
String str = line.replace(s, "buildToolsVersion '25.0.2'\n");
buildGradleFile.seek(lastPoint);
buildGradleFile.writeBytes(str);
}
if (line.contains("targetSdkVersion") && !line.contains("targetSdkVersion 25")) {
String s = line.substring(line.indexOf("targetSdkVersion")).toString();
String str = line.replace(s, "targetSdkVersion 25\n");
buildGradleFile.seek(lastPoint);
buildGradleFile.writeBytes(str);
}
if (line.contains("applicationId") && !line.contains("//applicationId")) {
String s = line.substring(line.indexOf("applicationId")).toString();
String str = line.replace(s, "//" + s + "\n");
buildGradleFile.seek(lastPoint);
buildGradleFile.writeBytes(str);
}
lastPoint = ponit;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} private void createAsFile() {
String sourcePath = sourceText.getText().toString();
File buildFile = new File(BUILD_PROJECT_PATH);
String buildProject = buildFile.getAbsolutePath();
//delete history
String deletePath = buildProject + "\\app\\src\\main";
FileUtils.delAllFile(deletePath);
String buildPath1 = buildProject + "\\build";
FileUtils.delFolder(buildPath1);
String buildPath2 = buildProject + "\\app\\build";
FileUtils.delFolder(buildPath2);
//assets
String assets = sourcePath + "\\assets";
String newAssets = buildProject + "\\app\\src\\main\\assets";
FileUtils.copyFolder(assets, newAssets);
//unity-classes.jar
String unity = sourcePath + "\\libs\\unity-classes.jar";
String newUnity = buildProject + "\\app\\libs\\unity-classes.jar";
FileUtils.copyFile(new File(unity), new File(newUnity));
//libs
String libs = sourcePath + "\\libs";
String jniLibs = buildProject + "\\app\\src\\main\\jniLibs";
FileUtils.copyFolder(libs, jniLibs);
File jni_unity = new File(jniLibs + "\\unity-classes.jar");
jni_unity.delete();
//res
String res = sourcePath + "\\res";
String newRes = buildProject + "\\app\\src\\main\\res";
FileUtils.copyFolder(res, newRes);
//src
String src = sourcePath + "\\src";
String java = buildProject + "\\app\\src\\main\\java";
FileUtils.copyFolder(src, java);
//AndroidManifest.xml
String manifest = sourcePath + "\\AndroidManifest.xml";
String newManifest = buildProject + "\\app\\src\\main\\AndroidManifest.xml";
FileUtils.copyFile(new File(manifest), new File(newManifest));
} private void uploadAar() {
findAarFile(BUILD_PROJECT_PATH);
gradleUpload();
} private void gradleUpload() {
String command = "cmd /c start gradlew clean uploadArchives";
File cmdPath = new File(UPLOAD_PROJECT_PATH);
Runtime runtime = Runtime.getRuntime();
try {
Process process = runtime.exec(command, null, cmdPath);
} catch (IOException e) {
e.printStackTrace();
}
} private void findAarFile(String filePath) {
File file = new File(filePath);
if (!file.exists()) {
return;
}
File[] files = file.listFiles();
for (File outputFile : files) {
if (outputFile.isDirectory()) {
findAarFile(outputFile.getAbsolutePath());
} else {
String fileName = outputFile.getName().toString();
if (fileName.endsWith(".aar")) {
File aarFile = new File("./" + fileName);
FileUtils.copyFile(outputFile, aarFile);
CacheUtils.cacheAar(aarFile.getAbsolutePath());
}
}
}
} private boolean checkInput() {
if ("".equals(sourceText.getText().toString())) {
JOptionPane.showMessageDialog(jFrame, "请输入源工程文件路径");
return true;
}
if ("".equals(sdkText.getText().toString())) {
JOptionPane.showMessageDialog(jFrame, "请输入本地sdk路径");
return true;
}
if ("".equals(ndkText.getText().toString())) {
JOptionPane.showMessageDialog(jFrame, "请输入本地ndk路径");
return true;
}
if ("".equals(groupIdText.getText().toString())) {
JOptionPane.showMessageDialog(jFrame, "请输入aar前缀包名");
return true;
}
if ("".equals(aarNameText.getText().toString())) {
JOptionPane.showMessageDialog(jFrame, "请输入aar名称");
return true;
}
if ("".equals(versionText.getText().toString())) {
JOptionPane.showMessageDialog(jFrame, "请输入aar版本号");
return true;
}
return false;
} private void buildAarButton() {
buildButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
buildAar();
}
});
} private void uploadAarButton() {
uploadButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
uploadAar();
}
});
} private void chooseSourceFile() {
sourceButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.showDialog(new JLabel(), "选择");
sourceFile = chooser.getSelectedFile();
sourceText.setText(sourceFile.getAbsolutePath().toString());
}
});
} private void chooseSdkFile() {
sdkButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.showDialog(new JLabel(), "选择");
sdkFile = chooser.getSelectedFile();
sdkText.setText(sdkFile.getAbsolutePath().toString());
}
});
} private void chooseNdkFile() {
ndkButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.showDialog(new JLabel(), "选择");
ndkFile = chooser.getSelectedFile();
ndkText.setText(ndkFile.getAbsolutePath().toString());
}
});
}
}
package com.jinkejoy.build_aar; import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties; import javax.swing.JTextField; public class CacheUtils {
private static final String CACHE_PATH = "./cache-input.properties";
private static final String AAR_PATH = "./aar-path.properties"; public static void cacheInput(JTextField sourceText, JTextField sdkText, JTextField ndkText,
JTextField groupIdText, JTextField aarNameText, JTextField versionText) {
String cache = "sourcePath=" + sourceText.getText().toString().replace("\\", "\\\\") + "\n" +
"sdkPath=" + sdkText.getText().toString().replace("\\", "\\\\") + "\n" +
"ndkPath=" + ndkText.getText().toString().replace("\\", "\\\\") + "\n" +
"groupId=" + groupIdText.getText().toString().replace("\\", "\\\\") + "\n" +
"aarName=" + aarNameText.getText().toString().replace("\\", "\\\\") + "\n" +
"version=" + versionText.getText().toString().replace("\\", "\\\\");
File cacheFile = new File(CACHE_PATH);
if (!cacheFile.exists()) {
try {
cacheFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
FileOutputStream fop = new FileOutputStream(cacheFile);
fop.write(cache.getBytes());
fop.flush();
fop.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} public static void cacheAar(String aarPath) {
String cache = "aarPath=" + aarPath.replace("\\", "\\\\");
File cacheFile = new File(AAR_PATH);
if (!cacheFile.exists()) {
try {
cacheFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
FileOutputStream fop = new FileOutputStream(cacheFile);
fop.write(cache.getBytes());
fop.flush();
fop.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} public static String getCacheInput(String key) {
File cacheFile = new File(CACHE_PATH);
if (cacheFile.exists()) {
try {
FileInputStream fip = new FileInputStream(cacheFile);
Properties properties = new Properties();
properties.load(fip);
Iterator<Map.Entry<Object, Object>> iterator = properties.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<Object, Object> entry = iterator.next();
if (key.equals(entry.getKey().toString())) {
return entry.getValue().toString();
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
return "";
}
}
package com.jinkejoy.build_aar; import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel; public class FileUtils {
public static boolean delAllFile(String path) {
boolean flag = false;
File file = new File(path);
if (!file.exists()) {
return flag;
}
if (!file.isDirectory()) {
return flag;
}
String[] tempList = file.list();
File temp = null;
for (int i = 0; i < tempList.length; i++) {
if (path.endsWith(File.separator)) {
temp = new File(path + tempList[i]);
} else {
temp = new File(path + File.separator + tempList[i]);
}
if (temp.isFile()) {
temp.delete();
}
if (temp.isDirectory()) {
delAllFile(path + "/" + tempList[i]);//先删除文件夹里面的文件
delFolder(path + "/" + tempList[i]);//再删除空文件夹
flag = true;
}
}
return flag;
} public static void delFolder(String folderPath) {
try {
delAllFile(folderPath); //删除完里面所有内容
String filePath = folderPath;
filePath = filePath.toString();
java.io.File myFilePath = new java.io.File(filePath);
myFilePath.delete(); //删除空文件夹
} catch (Exception e) {
e.printStackTrace();
}
} public static void copyFile(File source, File dest) {
FileChannel inputChannel = null;
FileChannel outputChannel = null;
try {
inputChannel = new FileInputStream(source).getChannel();
outputChannel = new FileOutputStream(dest).getChannel();
outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
inputChannel.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
outputChannel.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} public static void copyFolder(String oldPath, String newPath) {
try {
// 如果文件夹不存在,则建立新文件夹
(new File(newPath)).mkdirs();
// 读取整个文件夹的内容到file字符串数组,下面设置一个游标i,不停地向下移开始读这个数组
File filelist = new File(oldPath);
String[] file = filelist.list();
// 要注意,这个temp仅仅是一个临时文件指针
// 整个程序并没有创建临时文件
File temp = null;
for (int i = 0; i < file.length; i++) {
// 如果oldPath以路径分隔符/或者\结尾,那么则oldPath/文件名就可以了
// 否则要自己oldPath后面补个路径分隔符再加文件名
// 谁知道你传递过来的参数是f:/a还是f:/a/啊?
if (oldPath.endsWith(File.separator)) {
temp = new File(oldPath + file[i]);
} else {
temp = new File(oldPath + File.separator + file[i]);
} // 如果游标遇到文件
if (temp.isFile()) {
FileInputStream input = new FileInputStream(temp);
// 复制并且改名
FileOutputStream output = new FileOutputStream(newPath
+ "/" + (temp.getName()).toString());
byte[] bufferarray = new byte[1024 * 64];
int prereadlength;
while ((prereadlength = input.read(bufferarray)) != -1) {
output.write(bufferarray, 0, prereadlength);
}
output.flush();
output.close();
input.close();
}
// 如果游标遇到文件夹
if (temp.isDirectory()) {
copyFolder(oldPath + "/" + file[i], newPath + "/" + file[i]);
}
}
} catch (Exception e) {
System.out.println("复制整个文件夹内容操作出错");
}
}
}
效果图
备注:有时候会出现渲染加载不出来的问题,可以修改下布局的创建顺序,改为创建一个控件就马上加载
unity打成aar上传到maven库的工具的更多相关文章
- aar上传maven库工具
需求:本地aar文件上传到maven库 参考我之前的博客gradle上传本地文件到远程maven库(nexus服务器) 下面是java图形化工具代码 package com.jinkejoy.buil ...
- 用eclipse怎样将本地的项目打成jar包上传到maven仓库
使用maven的项目中,有时需要把本地的项目打成jar包上传到mevan仓库. 操作如下: 前提:pom文件中配置好远程库的地址,否则会报错 1.将maven 中的settings文件配置好用户名和密 ...
- Maven系列(二) -- 将开源库上传到maven仓库私服
前言 之前简单说了下Maven的搭建,现在跟大家说一下如何将自己的aar传到我们新搭建的maven仓库里面,接下来我们就从最基本的新建一个library开始讲述整个流程,话不多说,让我们把愉快的开始吧 ...
- Github开源Java项目(Disconf)上传到Maven Central Repository方法详细介绍
最近我做了一个开源项目 Disconf:Distributed Configuration Management Platform(分布式配置管理平台) ,简单来说,就是为所有业务平台系统管理配置文件 ...
- 多个module实体类集合打一个jar包并上传至远程库
本章内容主要分享多个module中的实体类集合生成到一个jar包中,并且发布到远程库:这里采用maven-assembly-plugin插件的功能来操作打包,内容不长却贴近实战切值得拥有,主要节点内容 ...
- DropzoneJS 可以拖拽上传的js库
介绍 可以拖拽上传的 js库 网址 http://www.dropzonejs.com/ 同类类库 1.jquery.fileupload http://blueimp.github.io/jQu ...
- Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):1、JIRA账号注册
文章目录: Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):1.JIRA账号注册 Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):2.PGP ...
- Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):2、PGP下载安装与密钥生成发布
文章目录: Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):1.JIRA账号注册 Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):2.PGP ...
- Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):3、Maven独立插件安装与settings.xml配置
文章目录: Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):1.JIRA账号注册 Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):2.PGP ...
随机推荐
- MVVM 简介
转:https://objccn.io/issue-13-1/ 所以,MVVM 到底是什么?与其专注于说明 MVVM 的来历,不如让我们看一个典型的 iOS 是如何构建的,并从那里了解 MVVM: 我 ...
- Walle,一个开源的web代码发布管理系统
前言 Walle 一个web部署系统工具,可能也是个持续发布工具,配置简单.功能完善.界面流畅.开箱即用!支持git.svn版本管理,支持各种web代码发布,静态的HTML,动态PHP,需要编译的JA ...
- ionic3 打包报错[ERROR] An error occurred while running cordova prepare (exit code 1):
解决办法:删除并重新添加平台以使用以下命令解决问题: cordova platform rm ios cordova platform add ios 如果执行 ionic cordova build ...
- linux命令中的参数前的一横(-)和两横(--)的区别
在解释这些区别之前我们先了解一下有关linux的背景知识,这个需要大家先认真看完就会对这些区别有更深入的了解,对linux也有更深的了解. 关于System V和BSD风格以及他们与Linux的关系: ...
- xampp 安装以及相关问题
1.安装xampp 说明:xampp集成了mysql,Apache,php,360软件里面就有 2.mysql端口被占用. 如果电脑上已安装MySql数据库,还想用XAM ...
- kali linux 信息收集(Kismet)
1.kismet工具,是一个无线扫描工具,该工具通过测量周围的无线信号,可以扫描到周围附近所用可用的Ap,以及信道等信息.同时还可以捕获网络中的数据包到一个文件中.这样可以方便分析数据包.下面我将详细 ...
- kali访问宿主机Web页面解决方案
1.首先安装好PHPDVWA测试平台,将等级设置成low,kali中自带了python2.7.为了不再宿主机中修改python3.6,所以要利用kali来模访问宿主机中的Web页面.如果不进行配置修改 ...
- PyCharm里面执行代码没问题,Jenkins执行时找不到第三方库
在PyCharm里面代码执行没问题 本地cmd执行也没问题 Jenkins执行时报错 原因是第三方库是用PyCharm安装的,后来在Jenkins服务器上用pip装好第三方库后,就可以执行了 再执行 ...
- Python数据类型之字符串
一:概述 Python中的字符串的一些概念 可以看作是字符的集合,在数据类型里没有单个字符的数据类型,可以用单个字符表示的一个字符串数据类型 字符串是一种不可变的序列类型,单个字符从左到右按照顺序排列 ...
- Python自定义-分页器
Python自定义-分页器 分页功能在每个网站都是必要的,对于分页来说,其实就是根据用户的输入计算出应该在数据库表中的起始位置. 1.设定每页显示数据条数 2.用户输入页码(第一页.第二页...) 3 ...