From 3430daf9313b1038eb289c8f253bac7e18c32746 Mon Sep 17 00:00:00 2001 From: yutou Date: Mon, 28 Dec 2020 14:03:26 +0800 Subject: [PATCH] update --- src/com/qy/utils/SmaliUtils.java | 2 +- src/com/qy/utils/Tools.java | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/com/qy/utils/SmaliUtils.java b/src/com/qy/utils/SmaliUtils.java index 575b8d0..3c31289 100755 --- a/src/com/qy/utils/SmaliUtils.java +++ b/src/com/qy/utils/SmaliUtils.java @@ -291,7 +291,7 @@ public class SmaliUtils { System.setSecurityManager(new NoExitSecurityManager()); //Main.main(args); - apktool_234.loadClass("brut.apktool.Main").getMethod("main",String[].class).invoke(null,new Object[]{args}); + apktool_241.loadClass("brut.apktool.Main").getMethod("main",String[].class).invoke(null,new Object[]{args}); if (inter != null) { inter.smaliPath(path); } diff --git a/src/com/qy/utils/Tools.java b/src/com/qy/utils/Tools.java index d44ce61..0cc48ad 100755 --- a/src/com/qy/utils/Tools.java +++ b/src/com/qy/utils/Tools.java @@ -1,6 +1,8 @@ package com.qy.utils; import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; import java.nio.charset.StandardCharsets; import java.rmi.server.ExportException; import java.util.Random; @@ -10,6 +12,7 @@ import java.util.zip.CheckedInputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; +import org.json.JSONArray; import org.json.JSONObject; import static java.util.zip.ZipEntry.STORED; @@ -382,4 +385,32 @@ public class Tools { } return str.toString(); } + + public static void main(String[] args) throws Exception { + String url="http://192.168.137.1:8000/nas/music/favorite/add.do"; + String body="{\"md5s\":[\"4fec7b325eb3795ef8241dabcbc14a5f\",\"febbf27e0d558a2ab69ee814a6bdebfb\",\"86a2fa76cc0e6919f9869324c3b61ba3\"],\"fid\":-1,\"token\":\"PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk\"}"; + JSONObject json=new JSONObject(); + json.put("fileName","C:\\\\Users\\\\admin\\\\Music\\\\英雄联盟 - 涅槃 (Phoenix).flac"); + String tmp; + StringBuilder str=new StringBuilder(); + HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); + connection.setRequestMethod("POST"); + connection.addRequestProperty("content-type","application/json"); + connection.addRequestProperty("charset","UTF-8"); + connection.setDoOutput(true); + connection.setDoInput(true); + connection.setConnectTimeout(5 * 1000); + connection.setReadTimeout(10 * 1000); + OutputStream outputStream = connection.getOutputStream(); + + outputStream.write(json.toString().getBytes()); + outputStream.flush(); + outputStream.close(); + System.out.println(connection.getResponseCode()); + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + while ((tmp = reader.readLine()) != null) { + str.append(tmp); + } + System.out.println("[域名]" + url + " = [body]" + body.toString() + " -> [接收] " + str); + } }