ncat修复

This commit is contained in:
“lushunming” 2024-09-16 09:10:52 +08:00
parent 2cdf7cbd19
commit 5f7e292f98
11 changed files with 106 additions and 105 deletions

View File

@ -67,6 +67,7 @@ dependencies {
implementation 'androidx.core:core-ktx:1.10.1'
testImplementation "io.github.dokar3:quickjs-kt-jvm:1.0.0-alpha13"
testImplementation 'org.nanohttpd:nanohttpd:2.3.1'
implementation 'commons-codec:commons-codec:1.17.1'
// Required -- JUnit 4 framework
testImplementation 'junit:junit:4.12'
@ -77,7 +78,6 @@ dependencies {
//implementation 'wang.harlon.quickjs:wrapper-java:1.0.0'
// implementation(ext: 'aar', name: 'quickjs', group: 'fongmi', version: 'release')
// api 'wang.harlon.quickjs:wrapper-android:2.0.0'
implementation 'cn.hutool:hutool-all:5.8.26'
}

View File

@ -243,7 +243,7 @@ public class ChangZhang extends Spider {
String kc8a64 = "336460fdcb76a597";
String iv = "1234567890983456";
return AESEncryption.decrypt(data, kc8a64, iv);
return AESEncryption.decrypt(data, kc8a64, iv,AESEncryption.CBC_PKCS_7_PADDING);
}
;

View File

@ -1,32 +1,19 @@
package com.github.catvod.spider;
import cn.hutool.core.codec.Base64;
import cn.hutool.crypto.Mode;
import cn.hutool.crypto.Padding;
import cn.hutool.crypto.symmetric.AES;
import com.github.catvod.bean.Class;
import com.github.catvod.bean.Result;
import com.github.catvod.bean.Vod;
import com.github.catvod.crawler.Spider;
import com.github.catvod.net.OkHttp;
import com.github.catvod.utils.AESEncryption;
import com.github.catvod.utils.Util;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -191,12 +178,7 @@ public class NCat extends Spider {
try {
String encryptedKey = "VNF9aVQF!G*0ux@2hAigUeH3";
byte[] keyBytes = encryptedKey.getBytes(Charset.defaultCharset());
byte[] encryptedBytes = Base64.decode(encryptedData);
AES aes = StringUtils.isAllBlank(iv) ? new AES(Mode.ECB, Padding.PKCS5Padding, keyBytes) : new AES(Mode.ECB, Padding.PKCS5Padding, keyBytes, iv.getBytes(Charset.defaultCharset()));
byte[] decryptedBytes = aes.decrypt(encryptedBytes);
return new String(decryptedBytes, Charset.defaultCharset());
return AESEncryption.decrypt(encryptedData, encryptedKey, iv,AESEncryption.ECB_PKCS_7_PADDING);
} catch (Exception e) {
e.printStackTrace();
return "123456";

View File

@ -1,11 +1,16 @@
package com.github.catvod.spider;
import static com.github.catvod.utils.AESEncryption.CBC_PKCS_7_PADDING;
import android.content.Context;
import com.github.catvod.bean.Class;
import com.github.catvod.bean.Result;
import com.github.catvod.bean.Vod;
import com.github.catvod.crawler.Spider;
import com.github.catvod.net.OkHttp;
import com.github.catvod.utils.AESEncryption;
import com.github.catvod.utils.Json;
import com.github.catvod.utils.Util;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
@ -23,16 +28,18 @@ import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class W55Movie extends Spider {
private static final String siteUrl = "https://55flix.com";
private static String siteUrl = "https://55flix.com";
private static final String cateUrl = siteUrl + "/index.php/api/vod";
private static final String detailUrl = siteUrl + "/voddetail/";
private static final String playUrl = siteUrl + "/vodplay/";
private static final String searchUrl = siteUrl + "/vodsearch/page/1/wd/";
private static String detailUrl = siteUrl + "/voddetail/";
private static String playUrl = siteUrl + "/vodplay/";
private static String searchUrl = siteUrl + "/vodsearch/page/1/wd/";
private HashMap<String, String> getHeaders() {
HashMap<String, String> headers = new HashMap<>();
@ -40,12 +47,26 @@ public class W55Movie extends Spider {
return headers;
}
@Override
public void init(Context context, String extend) throws Exception {
super.init(context, extend);
Document doc = Jsoup.parse(OkHttp.string(extend));
String data = doc.select("#domainData").attr("data-info");
String info = Util.base64Decode(data);
Map<String, Object> json = Json.parseSafe(info, Map.class);
siteUrl = "https://" + json.get("site_main").toString();
detailUrl = siteUrl + "/voddetail/";
playUrl = siteUrl + "/vodplay/";
searchUrl = siteUrl + "/vodsearch/page/1/wd/";
}
@Override
public String homeContent(boolean filter) throws Exception {
List<Vod> list = new ArrayList<>();
List<Class> classes = new ArrayList<>();
String[] typeIdList = {"/label/netflix/page/","/vodshow/1","/vodshow/2","/vodshow/124","/vodshow/4","/vodshow/3"};
String[] typeNameList = {"Netflix","电影","连续剧","福利","动漫","综艺"};
String[] typeIdList = {"/label/netflix", "/vodshow/1", "/vodshow/2", "/vodshow/124", "/vodshow/4", "/vodshow/3"};
String[] typeNameList = {"Netflix", "电影", "连续剧", "福利", "动漫", "综艺"};
for (int i = 0; i < typeNameList.length; i++) {
classes.add(new Class(typeIdList[i], typeNameList[i]));
}
@ -95,9 +116,9 @@ public class W55Movie extends Spider {
@Override
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
List<Vod> list = new ArrayList<>();
if (tid.startsWith("/label/")){
if (tid.startsWith("/label/")) {
tid = tid + pg + ".html";
}else {
} else {
tid = tid + "--------" + pg + "---.html";
}
String target = siteUrl + tid;
@ -147,9 +168,9 @@ public class W55Movie extends Spider {
String liUrl = "";
for (int i1 = 0; i1 < li.size(); i1++) {
if (!"".equals(liUrl)) {
liUrl = liUrl + "#" + li.get(i1).text() + "$" + li.get(i1).attr("href").replace("/vodplay/","");
liUrl = liUrl + "#" + li.get(i1).text() + "$" + li.get(i1).attr("href").replace("/vodplay/", "");
} else {
liUrl = liUrl + li.get(i1).text() + "$" + li.get(i1).attr("href").replace("/vodplay/","");
liUrl = liUrl + li.get(i1).text() + "$" + li.get(i1).attr("href").replace("/vodplay/", "");
}
}
if (!"".equals(PlayUrl)) {
@ -192,6 +213,9 @@ public class W55Movie extends Spider {
return Result.string(list);
}
private static final String keyString = "a67e9a3a85049339";
private static final String ivString = "86ad9b37cc9f5b9501b3cecc7dc6377c";
@Override
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
String target = playUrl.concat(id);
@ -206,14 +230,14 @@ public class W55Movie extends Spider {
url = matcher.group(1);
url_next = matcher.group(2);
}
String encrytStr =url;// "{\"url\":\"" + url + "\",\"next_url\":\"" + url_next + "\"}";
String encrytStr = url;// "{\"url\":\"" + url + "\",\"next_url\":\"" + url_next + "\"}";
// 加密
String encrypt = AESEncryption.encrypt(encrytStr);
String encrypt = AESEncryption.encrypt(encrytStr, keyString, ivString,CBC_PKCS_7_PADDING);
String encodeURI = AESEncryption.encodeURIComponent(encrypt);
// 请求获取url
String data = OkHttp.string("https://player.ddzyku.com:3653/get_url_v2?data=" + encodeURI);
// 解密
String decrypted = AESEncryption.decrypt(data);
String decrypted = AESEncryption.decrypt(data, keyString, ivString,CBC_PKCS_7_PADDING);
Gson gson = new Gson();
JsonObject jsonObject = gson.fromJson(decrypted, JsonObject.class);
JsonObject dataObject = jsonObject.getAsJsonObject("data");

View File

@ -2,6 +2,8 @@ package com.github.catvod.utils;
import android.util.Base64;
import org.apache.commons.lang3.StringUtils;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.Charset;
@ -13,10 +15,11 @@ import javax.crypto.spec.SecretKeySpec;
public class AESEncryption {
private static final String keyString = "a67e9a3a85049339";
private static final String ivString = "86ad9b37cc9f5b9501b3cecc7dc6377c";
public static String encrypt(String word) {
public static final String CBC_PKCS_7_PADDING = "AES/CBC/PKCS7Padding";
public static final String ECB_PKCS_7_PADDING = "AES/ECB/PKCS5Padding";
public static String encrypt(String word, String keyString, String ivString,String trans) {
try {
byte[] keyBytes = keyString.getBytes("UTF-8");
SecretKeySpec keySpec = new SecretKeySpec(keyBytes, "AES");
@ -24,19 +27,25 @@ public class AESEncryption {
byte[] ivBytes = hexStringToByteArray(ivString);
IvParameterSpec ivSpec = new IvParameterSpec(ivBytes);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
Cipher cipher = Cipher.getInstance(trans);
if(StringUtils.isAllBlank(ivString)){
cipher.init(Cipher.ENCRYPT_MODE, keySpec);
}else{
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
}
byte[] encrypted = cipher.doFinal(word.getBytes("UTF-8"));
return Base64.encodeToString(encrypted, Base64.DEFAULT);
return org.apache.commons.codec.binary.Base64.encodeBase64String(encrypted);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static String decrypt(String word) {
public static String decrypt(String word,String keyString,String ivString,String trans) {
try {
byte[] keyBytes = keyString.getBytes("UTF-8");
SecretKeySpec keySpec = new SecretKeySpec(keyBytes, "AES");
@ -44,10 +53,15 @@ public class AESEncryption {
byte[] ivBytes = hexStringToByteArray(ivString);
IvParameterSpec ivSpec = new IvParameterSpec(ivBytes);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
Cipher cipher = Cipher.getInstance(trans);
if(StringUtils.isAllBlank(ivString)){
cipher.init(Cipher.DECRYPT_MODE, keySpec);
byte[] decoded = Base64.decode(word, Base64.DEFAULT);
}else{
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
}
byte[] decoded = org.apache.commons.codec.binary.Base64.decodeBase64(word);
byte[] decrypted = cipher.doFinal(decoded);
return new String(decrypted, "UTF-8");
@ -57,26 +71,7 @@ public class AESEncryption {
}
}
public static String decrypt(String word,String key,String iv) {
try {
byte[] keyBytes = key.getBytes("UTF-8");
SecretKeySpec keySpec = new SecretKeySpec(keyBytes, "AES");
byte[] ivBytes = iv.getBytes("UTF-8");
IvParameterSpec ivSpec = new IvParameterSpec(ivBytes);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
byte[] decoded = Base64.decode(word, Base64.DEFAULT);
byte[] decrypted = cipher.doFinal(decoded);
return new String(decrypted, Charset.defaultCharset());
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
private static byte[] hexStringToByteArray(String hexString) {
int len = hexString.length();

View File

@ -28,7 +28,7 @@ public class W55MovieTest {
mockContext = RuntimeEnvironment.application;
Init.init(mockContext);
spider = new W55Movie();
spider.init(mockContext, "");
spider.init(mockContext, "https://jlghjy.com/");
}
@org.junit.Test
@ -65,7 +65,7 @@ public class W55MovieTest {
@org.junit.Test
public void detailContent() throws Exception {
String content = spider.detailContent(Arrays.asList("472585.html"));
String content = spider.detailContent(Arrays.asList("489833.html"));
JsonObject map = Json.safeObject(content);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
System.out.println("detailContent--" + gson.toJson(map));

Binary file not shown.

View File

@ -1 +1 @@
01a5f6374ea24987cd0598188079d504
97267a31afae36f108e1065bddc72c23

View File

@ -1,5 +1,5 @@
{
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;01a5f6374ea24987cd0598188079d504",
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;97267a31afae36f108e1065bddc72c23",
"lives": [
{
"name": "直播ipv6",
@ -51,7 +51,8 @@
"searchable": 1,
"changeable": 1,
"ext": {}
},{
},
{
"key": "XuanFeng",
"name": "旋风影视",
"type": 3,
@ -102,7 +103,8 @@
"type": 3,
"api": "csp_W55Movie",
"searchable": 0,
"filterable": 1
"filterable": 1,
"ext": "https://jlghjy.com/"
},
{
"key": "DaGongRen",
@ -120,7 +122,6 @@
"searchable": 0,
"filterable": 1
},
{
"key": "NGkt",
"name": "瓜瓜",
@ -130,7 +131,6 @@
"filterable": 0,
"ext": {}
},
{
"key": "JustLive",
"name": "JustLive直播",
@ -149,7 +149,7 @@
},
{
"key": "ikanbot",
"name":"爱看机器人",
"name": "爱看机器人",
"type": 3,
"api": "csp_Ikanbot",
"searchable": 1,
@ -201,7 +201,7 @@
},
{
"key": "newvision",
"name":"(js)新视觉影院(不稳定)",
"name": "(js)新视觉影院(不稳定)",
"api": "https://androidcatvodspider.pages.dev/json/js/newvision.js",
"timeout": 30,
"ext": {
@ -212,7 +212,7 @@
},
{
"key": "kankan70",
"name":"(js)70看看┃📺",
"name": "(js)70看看┃📺",
"api": "https://androidcatvodspider.pages.dev/json/js/kankan70.js",
"timeout": 30,
"ext": {
@ -223,7 +223,7 @@
},
{
"key": "jpyy",
"name":"(js)金牌影院",
"name": "(js)金牌影院",
"api": "https://androidcatvodspider.pages.dev/json/js/jpyy.js",
"timeout": 30,
"ext": {
@ -234,7 +234,7 @@
},
{
"key": "jpyy2",
"name":"(js)金牌影院",
"name": "(js)金牌影院",
"api": "https://androidcatvodspider.pages.dev/json/js/jpyy2.js",
"timeout": 30,
"ext": {
@ -245,7 +245,7 @@
},
{
"key": "tiantian",
"name":"(js)天天影视┃⛄",
"name": "(js)天天影视┃⛄",
"api": "https://androidcatvodspider.pages.dev/json/js/tiantian.js",
"timeout": 30,
"ext": {
@ -256,7 +256,7 @@
},
{
"key": "xb6v",
"name":"(js)磁力新6V┃🧲",
"name": "(js)磁力新6V┃🧲",
"api": "https://androidcatvodspider.pages.dev/json/js/xb6v.js",
"timeout": 30,
"ext": {
@ -267,7 +267,7 @@
},
{
"key": "mp4movie",
"name":"(js)Mp4电影┃🍚",
"name": "(js)Mp4电影┃🍚",
"api": "https://androidcatvodspider.pages.dev/json/js/mp4movie.js",
"timeout": 30,
"ext": {
@ -278,7 +278,7 @@
},
{
"key": "jianpian",
"name":"(js)荐片┃🌼",
"name": "(js)荐片┃🌼",
"api": "https://androidcatvodspider.pages.dev/json/js/jianpian.js",
"timeout": 30,
"ext": {
@ -289,7 +289,7 @@
},
{
"key": "alipansou",
"name":"(js)阿里猫狸┃😸",
"name": "(js)阿里猫狸┃😸",
"api": "https://androidcatvodspider.pages.dev/json/js/alipansou.js",
"timeout": 30,
"ext": {
@ -302,7 +302,7 @@
},
{
"key": "huya",
"name":"(js)虎牙直播┃🐯",
"name": "(js)虎牙直播┃🐯",
"api": "https://androidcatvodspider.pages.dev/json/js/huya.js",
"timeout": 30,
"ext": {
@ -313,7 +313,7 @@
},
{
"key": "star",
"name":"(js)星视界┃墙☄️",
"name": "(js)星视界┃墙☄️",
"api": "https://androidcatvodspider.pages.dev/json/js/star.js",
"timeout": 30,
"ext": {
@ -324,7 +324,7 @@
},
{
"key": "nivod",
"name":"(js)泥视频┃墙👑",
"name": "(js)泥视频┃墙👑",
"api": "https://androidcatvodspider.pages.dev/json/js/nivod.js",
"timeout": 30,
"ext": {
@ -336,7 +336,7 @@
},
{
"key": "aiyingshi",
"name":"(js)爱影视┃🚀",
"name": "(js)爱影视┃🚀",
"api": "https://androidcatvodspider.pages.dev/json/js/aiyingshi.js",
"timeout": 30,
"ext": {
@ -347,7 +347,7 @@
},
{
"key": "sp360",
"name":"(js)360影视┃🥎",
"name": "(js)360影视┃🥎",
"api": "https://androidcatvodspider.pages.dev/json/js/sp360.js",
"timeout": 30,
"ext": {
@ -358,7 +358,7 @@
},
{
"key": "mxanime",
"name":"(js)MX动漫┃🍒",
"name": "(js)MX动漫┃🍒",
"api": "https://androidcatvodspider.pages.dev/json/js/mxanime.js",
"timeout": 30,
"ext": {
@ -369,7 +369,7 @@
},
{
"key": "cntv",
"name":"(js)中央影视┃🤵‍♂️",
"name": "(js)中央影视┃🤵‍♂️",
"api": "https://androidcatvodspider.pages.dev/json/js/cntv.js",
"timeout": 30,
"ext": {
@ -380,7 +380,7 @@
},
{
"key": "douban",
"name":"(js)豆瓣┃🍥",
"name": "(js)豆瓣┃🍥",
"api": "https://androidcatvodspider.pages.dev/json/js/douban.js",
"timeout": 30,
"ext": {
@ -391,7 +391,7 @@
},
{
"key": "pan_search",
"name":"(js)阿里盘搜┃🗂️",
"name": "(js)阿里盘搜┃🗂️",
"api": "https://androidcatvodspider.pages.dev/json/js/pan_search.js",
"timeout": 30,
"ext": {
@ -404,7 +404,7 @@
},
{
"key": "bilibili",
"name":"(js)哔哩哔哩┃🏰",
"name": "(js)哔哩哔哩┃🏰",
"api": "https://androidcatvodspider.pages.dev/json/js/bilibili.js",
"timeout": 30,
"ext": {
@ -416,7 +416,7 @@
},
{
"key": "changzhang",
"name":"(js)厂长直连┃🏭️",
"name": "(js)厂长直连┃🏭️",
"api": "https://androidcatvodspider.pages.dev/json/js/changzhang.js",
"timeout": 30,
"ext": {
@ -429,7 +429,7 @@
},
{
"key": "wogg",
"name":"(js)阿里玩偶┃💂",
"name": "(js)阿里玩偶┃💂",
"api": "https://androidcatvodspider.pages.dev/json/js/wogg.js",
"timeout": 30,
"ext": {
@ -442,7 +442,7 @@
},
{
"key": "nangua",
"name":"(js)南瓜影视┃🎃",
"name": "(js)南瓜影视┃🎃",
"api": "https://androidcatvodspider.pages.dev/json/js/nangua.js",
"timeout": 30,
"ext": {
@ -453,7 +453,7 @@
},
{
"key": "aliyunpanshare",
"name":"(js)阿里云盘分享┃🥏‍",
"name": "(js)阿里云盘分享┃🥏‍",
"api": "https://androidcatvodspider.pages.dev/json/js/aliyunpanshare.js",
"timeout": 30,
"ext": {
@ -466,7 +466,7 @@
},
{
"key": "dubo",
"name":"(js)独播影视┃🛶",
"name": "(js)独播影视┃🛶",
"api": "https://androidcatvodspider.pages.dev/json/js/dubo.js",
"timeout": 30,
"ext": {
@ -477,7 +477,7 @@
},
{
"key": "haiwaikan",
"name":"(js)海外看┃☕墙",
"name": "(js)海外看┃☕墙",
"api": "https://androidcatvodspider.pages.dev/json/js/haiwaikan.js",
"timeout": 30,
"ext": {
@ -488,7 +488,7 @@
},
{
"key": "dygangs",
"name":"(js)电影港┃🏖️",
"name": "(js)电影港┃🏖️",
"api": "https://androidcatvodspider.pages.dev/json/js/dygangs.js",
"timeout": 30,
"ext": {
@ -499,7 +499,7 @@
},
{
"key": "cilixiong",
"name":"(js)磁力熊┃🐻",
"name": "(js)磁力熊┃🐻",
"api": "https://androidcatvodspider.pages.dev/json/js/cilixiong.js",
"timeout": 30,
"ext": {
@ -510,7 +510,7 @@
},
{
"key": "lovemovie",
"name":"(js)爱情电影网┃💕",
"name": "(js)爱情电影网┃💕",
"api": "https://androidcatvodspider.pages.dev/json/js/lovemovie.js",
"timeout": 30,
"ext": {
@ -521,7 +521,7 @@
},
{
"key": "gitcafe",
"name":"(js)阿里纸条┃🦊",
"name": "(js)阿里纸条┃🦊",
"api": "https://androidcatvodspider.pages.dev/json/js/gitcafe.js",
"timeout": 30,
"ext": {
@ -534,7 +534,7 @@
},
{
"key": "kuaikan",
"name":"(js)快看视频┃🛥︎",
"name": "(js)快看视频┃🛥︎",
"api": "https://androidcatvodspider.pages.dev/json/js/kuaikan.js",
"timeout": 30,
"ext": {

View File

@ -1,5 +1,5 @@
{
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;01a5f6374ea24987cd0598188079d504",
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;97267a31afae36f108e1065bddc72c23",
"lives": [
{
"name": "直播ipv6",

View File

@ -1,5 +1,5 @@
{
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;01a5f6374ea24987cd0598188079d504",
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;97267a31afae36f108e1065bddc72c23",
"lives": [
{
"name": "直播ipv6",