|
@@ -1,9 +1,6 @@
|
|
|
package org.example;
|
|
|
|
|
|
-import com.aliyun.openservices.aliyun.log.producer.LogProducer;
|
|
|
-import com.aliyun.openservices.aliyun.log.producer.Producer;
|
|
|
-import com.aliyun.openservices.aliyun.log.producer.ProducerConfig;
|
|
|
-import com.aliyun.openservices.aliyun.log.producer.ProjectConfig;
|
|
|
+import com.beust.jcommander.JCommander;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import lombok.SneakyThrows;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
@@ -14,12 +11,17 @@ import org.apache.hc.core5.http.ContentType;
|
|
|
import org.apache.hc.core5.http.Header;
|
|
|
import org.apache.hc.core5.http.io.entity.StringEntity;
|
|
|
import org.apache.hc.core5.http.message.BasicHeader;
|
|
|
+import org.example.user.Lyl;
|
|
|
+import org.example.user.RequestInfo;
|
|
|
+import org.example.user.UserInfo;
|
|
|
+import org.example.user.Zyx;
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Random;
|
|
|
|
|
|
-// 10 8,18 * * mon,tue,wed,thu,fri /opt/jdk1.8.0_211/bin/java -jar /home/zyx/jar/app.jar
|
|
|
+// 10 8,18 * * mon,tue,wed,thu,fri /opt/jdk1.8.0_211/bin/java -jar /home/zyx/jar/app.jar --zyx --lyl
|
|
|
public class Daka {
|
|
|
|
|
|
private static AliyunLogger logger = new AliyunLogger();
|
|
@@ -38,6 +40,11 @@ public class Daka {
|
|
|
@SneakyThrows
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
+ var argv = new Argv();
|
|
|
+ JCommander.newBuilder()
|
|
|
+ .addObject(argv)
|
|
|
+ .build()
|
|
|
+ .parse(args);
|
|
|
|
|
|
|
|
|
String publicKeyStr = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQChDzcjw/rWgFwnxunbKp7/4e8w\n" +
|
|
@@ -45,14 +52,27 @@ public class Daka {
|
|
|
"Vx1uOH/2U378fscEESEG8XDqll0GCfB1/TjKI2aitVSzXOtRs8kYgGU78f7VmDNg\n" +
|
|
|
"XIlk3gdhnzh+uoEQywIDAQAB";
|
|
|
|
|
|
- byte[] sendTime = RsaUtil.encryptByPublicKey((System.currentTimeMillis() + "").getBytes(), publicKeyStr);
|
|
|
-
|
|
|
|
|
|
BASE64Encoder encoder = new BASE64Encoder();
|
|
|
|
|
|
try (CloseableHttpClient client = HttpClients.createDefault()) {
|
|
|
- String jsessionid = getLoginCookie(client, encoder.encode(sendTime));
|
|
|
- daka(client, jsessionid);
|
|
|
+
|
|
|
+ var arrayList = new ArrayList<UserInfo>();
|
|
|
+ if (argv.lyl) {
|
|
|
+ arrayList.add(new Lyl());
|
|
|
+ }
|
|
|
+ if (argv.zyx) {
|
|
|
+ arrayList.add(new Zyx());
|
|
|
+ }
|
|
|
+
|
|
|
+ for (UserInfo userInfo : arrayList) {
|
|
|
+ var requestInfo = userInfo.getRequestInfo();
|
|
|
+ byte[] sendTime = RsaUtil.encryptByPublicKey((System.currentTimeMillis() + "").getBytes(), publicKeyStr);
|
|
|
+ requestInfo.setSendTime(encoder.encode(sendTime));
|
|
|
+ String jsessionid = getLoginCookie(client, requestInfo);
|
|
|
+ daka(client, jsessionid);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -80,16 +100,16 @@ public class Daka {
|
|
|
}
|
|
|
|
|
|
@SneakyThrows
|
|
|
- private static String getLoginCookie(CloseableHttpClient client, String sendTime) {
|
|
|
+ private static String getLoginCookie(CloseableHttpClient client, RequestInfo requestInfo) {
|
|
|
HttpPost httpPost = new HttpPost("http://oa.sxtvs.com/seeyon/rest/m3/login/verification");
|
|
|
|
|
|
httpPost.setHeaders(new BasicHeader("Content-Type", "application/json;charset=UTF-8"));
|
|
|
httpPost.setHeaders(new BasicHeader("User-Agent", "seeyon-m3/4.2.4"));
|
|
|
httpPost.setHeaders(new BasicHeader("accessm3-scheme", "http"));
|
|
|
httpPost.setHeaders(new BasicHeader("sendtime", String.valueOf(System.currentTimeMillis() / 1000)));
|
|
|
-
|
|
|
- StringEntity entity = new StringEntity("{\"deviceCode\":\"66361943-4EBB-4474-82E1-371CD3C2F768\",\"password\":\"qwjZCXeZeUZBWcH/zHOqWQ==\",\"client\":\"iphone\",\"login_mobliephone\":\"rSF3HKzE2Q2wAcJCP6ib+g==\",\"deviceID\":\"Y04KaZ0081eL5uBHOLHzLjkw7wZDnqXJKWOszrzQV1hy6VAHCUCirUWSdZ\n" +
|
|
|
- "KxDosJUcvmCYTI2Rytqm62MzTFFYe3HZZUM+k55iYnzwWnpPfdHWTnAi4u+Cyb0VcIVGOBjeq7sVO/ugAq0jngW/nQHAxKnLdD2ynzj0i07eS25h4=\",\"timezone\":\"GMT+08:00\",\"sendTime\":\"" + sendTime + "\",\"name\":\"rSF3HKzE2Q2wAcJCP6ib+g==\"}", ContentType.APPLICATION_JSON);
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ String json = objectMapper.writeValueAsString(requestInfo);
|
|
|
+ StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
|
|
|
httpPost.setEntity(entity);
|
|
|
|
|
|
return client.execute(httpPost, response -> {
|