Spaces:
Sleeping
Sleeping
we
commited on
Commit
·
d7c74f7
1
Parent(s):
025f1a2
- Dockerfile +2 -2
- log.txt +1 -0
- mydb.db +0 -0
- nbactions.xml +55 -0
- pom-b.xml +10 -0
- pom.xml +25 -2
- src/main/java/com/example/demo/DemoApplication.java +116 -37
- src/main/java/com/sqlite/config/DBConfig.java +18 -0
- src/main/java/com/sqlite/config/DBInitializeConfig.java +47 -0
- src/main/java/com/sqlite/config/MvcConfig.java +37 -0
- src/main/java/com/sqlite/config/SQLiteDialect.java +155 -0
- src/main/java/tqtk/Utils/Doc_file_kieu_txt.java +3 -1
- src/main/java/tqtk/Utils/Util.java +25 -2
- src/main/java/tqtk/XuLy/Worker.java +7 -2
- src/main/resources/application.properties +6 -8
- urls.txt +1 -0
Dockerfile
CHANGED
@@ -11,8 +11,8 @@ RUN mvn clean package -DskipTests
|
|
11 |
FROM openjdk:11-jdk-slim
|
12 |
COPY --from=build /target/demo-0.0.1-SNAPSHOT.jar demo.jar
|
13 |
COPY --from=build /user.properties user.properties
|
14 |
-
COPY --from=build /
|
15 |
-
COPY --from=build /
|
16 |
# ENV PORT=8080
|
17 |
EXPOSE 8081
|
18 |
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-jar","demo.jar"]
|
|
|
11 |
FROM openjdk:11-jdk-slim
|
12 |
COPY --from=build /target/demo-0.0.1-SNAPSHOT.jar demo.jar
|
13 |
COPY --from=build /user.properties user.properties
|
14 |
+
COPY --from=build /urls.txt urls.txt
|
15 |
+
COPY --from=build /mydb.db mydb.db
|
16 |
# ENV PORT=8080
|
17 |
EXPOSE 8081
|
18 |
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-jar","demo.jar"]
|
log.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
22:45:49 status 200
|
mydb.db
ADDED
Binary file (5.12 kB). View file
|
|
nbactions.xml
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<actions>
|
3 |
+
<action>
|
4 |
+
<actionName>run</actionName>
|
5 |
+
<packagings>
|
6 |
+
<packaging>jar</packaging>
|
7 |
+
</packagings>
|
8 |
+
<goals>
|
9 |
+
<goal>process-classes</goal>
|
10 |
+
<goal>org.codehaus.mojo:exec-maven-plugin:3.0.0:exec</goal>
|
11 |
+
</goals>
|
12 |
+
<properties>
|
13 |
+
<exec.vmArgs></exec.vmArgs>
|
14 |
+
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
|
15 |
+
<exec.appArgs></exec.appArgs>
|
16 |
+
<exec.mainClass>com.example.demo.DemoApplication</exec.mainClass>
|
17 |
+
<exec.executable>java</exec.executable>
|
18 |
+
</properties>
|
19 |
+
</action>
|
20 |
+
<action>
|
21 |
+
<actionName>debug</actionName>
|
22 |
+
<packagings>
|
23 |
+
<packaging>jar</packaging>
|
24 |
+
</packagings>
|
25 |
+
<goals>
|
26 |
+
<goal>process-classes</goal>
|
27 |
+
<goal>org.codehaus.mojo:exec-maven-plugin:3.0.0:exec</goal>
|
28 |
+
</goals>
|
29 |
+
<properties>
|
30 |
+
<exec.vmArgs>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</exec.vmArgs>
|
31 |
+
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
|
32 |
+
<exec.appArgs></exec.appArgs>
|
33 |
+
<exec.mainClass>com.example.demo.DemoApplication</exec.mainClass>
|
34 |
+
<exec.executable>java</exec.executable>
|
35 |
+
<jpda.listen>true</jpda.listen>
|
36 |
+
</properties>
|
37 |
+
</action>
|
38 |
+
<action>
|
39 |
+
<actionName>profile</actionName>
|
40 |
+
<packagings>
|
41 |
+
<packaging>jar</packaging>
|
42 |
+
</packagings>
|
43 |
+
<goals>
|
44 |
+
<goal>process-classes</goal>
|
45 |
+
<goal>org.codehaus.mojo:exec-maven-plugin:3.0.0:exec</goal>
|
46 |
+
</goals>
|
47 |
+
<properties>
|
48 |
+
<exec.vmArgs></exec.vmArgs>
|
49 |
+
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
|
50 |
+
<exec.mainClass>com.example.demo.DemoApplication</exec.mainClass>
|
51 |
+
<exec.executable>java</exec.executable>
|
52 |
+
<exec.appArgs></exec.appArgs>
|
53 |
+
</properties>
|
54 |
+
</action>
|
55 |
+
</actions>
|
pom-b.xml
CHANGED
@@ -53,6 +53,16 @@
|
|
53 |
<groupId>org.postgresql</groupId>
|
54 |
<artifactId>postgresql</artifactId>
|
55 |
<scope>runtime</scope>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
</dependency>
|
57 |
<dependency>
|
58 |
<groupId>org.springframework.boot</groupId>
|
|
|
53 |
<groupId>org.postgresql</groupId>
|
54 |
<artifactId>postgresql</artifactId>
|
55 |
<scope>runtime</scope>
|
56 |
+
</dependency>
|
57 |
+
<dependency>
|
58 |
+
<groupId>org.xerial</groupId>
|
59 |
+
<artifactId>sqlite-jdbc</artifactId>
|
60 |
+
<version>3.7.2</version>
|
61 |
+
</dependency>
|
62 |
+
<dependency>
|
63 |
+
<groupId>com.h2database</groupId>
|
64 |
+
<artifactId>h2</artifactId>
|
65 |
+
<scope>compile</scope>
|
66 |
</dependency>
|
67 |
<dependency>
|
68 |
<groupId>org.springframework.boot</groupId>
|
pom.xml
CHANGED
@@ -54,6 +54,16 @@
|
|
54 |
<artifactId>postgresql</artifactId>
|
55 |
<scope>runtime</scope>
|
56 |
</dependency>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
<dependency>
|
58 |
<groupId>org.springframework.boot</groupId>
|
59 |
<artifactId>spring-boot-starter-test</artifactId>
|
@@ -65,10 +75,23 @@
|
|
65 |
<artifactId>json-simple</artifactId>
|
66 |
<version>1.1.1</version>
|
67 |
</dependency>
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
<groupId>org.apache.httpcomponents</groupId>
|
70 |
<artifactId>httpcore</artifactId>
|
71 |
-
<version>4.
|
72 |
</dependency>
|
73 |
|
74 |
</dependencies>
|
|
|
54 |
<artifactId>postgresql</artifactId>
|
55 |
<scope>runtime</scope>
|
56 |
</dependency>
|
57 |
+
<dependency>
|
58 |
+
<groupId>org.xerial</groupId>
|
59 |
+
<artifactId>sqlite-jdbc</artifactId>
|
60 |
+
<version>3.7.2</version>
|
61 |
+
</dependency>
|
62 |
+
<dependency>
|
63 |
+
<groupId>com.h2database</groupId>
|
64 |
+
<artifactId>h2</artifactId>
|
65 |
+
<scope>compile</scope>
|
66 |
+
</dependency>
|
67 |
<dependency>
|
68 |
<groupId>org.springframework.boot</groupId>
|
69 |
<artifactId>spring-boot-starter-test</artifactId>
|
|
|
75 |
<artifactId>json-simple</artifactId>
|
76 |
<version>1.1.1</version>
|
77 |
</dependency>
|
78 |
+
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
|
79 |
+
<dependency>
|
80 |
+
<groupId>org.apache.httpcomponents</groupId>
|
81 |
+
<artifactId>httpclient</artifactId>
|
82 |
+
<version>4.5.13</version>
|
83 |
+
</dependency>
|
84 |
+
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
|
85 |
+
<dependency>
|
86 |
+
<groupId>org.apache.httpcomponents</groupId>
|
87 |
+
<artifactId>httpmime</artifactId>
|
88 |
+
<version>4.5.12</version>
|
89 |
+
</dependency>
|
90 |
+
|
91 |
+
<dependency>
|
92 |
<groupId>org.apache.httpcomponents</groupId>
|
93 |
<artifactId>httpcore</artifactId>
|
94 |
+
<version>4.4.14</version>
|
95 |
</dependency>
|
96 |
|
97 |
</dependencies>
|
src/main/java/com/example/demo/DemoApplication.java
CHANGED
@@ -25,6 +25,8 @@ import java.io.OutputStreamWriter;
|
|
25 |
import java.io.Writer;
|
26 |
import java.net.URL;
|
27 |
import java.net.UnknownHostException;
|
|
|
|
|
28 |
import java.util.List;
|
29 |
import java.util.logging.Level;
|
30 |
import java.util.logging.Logger;
|
@@ -39,6 +41,15 @@ import tqtk.XuLy.XuLyPacket;
|
|
39 |
import tqtk.XuLy.login.LayThongTinSession;
|
40 |
import java.util.ArrayList;
|
41 |
import java.util.Collections;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
@SpringBootApplication
|
43 |
@RestController
|
44 |
public class DemoApplication {
|
@@ -46,11 +57,52 @@ public class DemoApplication {
|
|
46 |
public static int count = 0;
|
47 |
|
48 |
public static ApplicationContext context;
|
|
|
49 |
|
50 |
public static void main(String[] args) {
|
|
|
51 |
context = SpringApplication.run(DemoApplication.class, args);
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
@GetMapping("exit")
|
55 |
public String getExit() throws IOException {
|
56 |
List<SessionEntity> ss = Tqtk.listSession;
|
@@ -79,49 +131,47 @@ public class DemoApplication {
|
|
79 |
}
|
80 |
return "ok";
|
81 |
}
|
82 |
-
|
83 |
-
|
84 |
public String cronjob_78184() throws Exception {
|
85 |
return "cronjob.de";
|
86 |
}
|
87 |
-
|
88 |
@RequestMapping(value = "/stopAll", method = RequestMethod.GET)
|
89 |
@ResponseBody
|
90 |
public String stopAll() throws IOException, UnknownHostException, InterruptedException, Exception {
|
91 |
try {
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
} catch (Exception e) {
|
99 |
-
|
100 |
}
|
101 |
return "ok";
|
102 |
}
|
103 |
-
|
104 |
-
|
105 |
-
@RequestMapping(value = "/resumeAll", method = RequestMethod.GET)
|
106 |
@ResponseBody
|
107 |
public String resumeAll() throws IOException, UnknownHostException, InterruptedException, Exception {
|
108 |
try {
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
} catch (Exception e) {
|
120 |
-
|
121 |
}
|
122 |
return "ok";
|
123 |
}
|
124 |
-
|
125 |
|
126 |
@RequestMapping(value = "/updateInfo", method = RequestMethod.GET)
|
127 |
@ResponseBody
|
@@ -145,6 +195,12 @@ public class DemoApplication {
|
|
145 |
}
|
146 |
return "not-ok";
|
147 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
@RequestMapping(value = "/sendcmd1", method = RequestMethod.POST)
|
150 |
@ResponseBody
|
@@ -199,20 +255,20 @@ public class DemoApplication {
|
|
199 |
@GetMapping("setSessionId")
|
200 |
public String setSessionId(@RequestParam(value = "id", required = true) String id,
|
201 |
@RequestParam(value = "session", required = true) String session) throws Exception {
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
} catch (Exception e) {
|
213 |
-
|
214 |
}
|
215 |
-
|
216 |
return "not-ok";
|
217 |
}
|
218 |
|
@@ -229,6 +285,29 @@ public class DemoApplication {
|
|
229 |
|
230 |
}
|
231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
public String executeCommand(String command) {
|
233 |
|
234 |
StringBuffer output = new StringBuffer();
|
|
|
25 |
import java.io.Writer;
|
26 |
import java.net.URL;
|
27 |
import java.net.UnknownHostException;
|
28 |
+
import java.time.LocalTime;
|
29 |
+
import java.time.format.DateTimeFormatter;
|
30 |
import java.util.List;
|
31 |
import java.util.logging.Level;
|
32 |
import java.util.logging.Logger;
|
|
|
41 |
import tqtk.XuLy.login.LayThongTinSession;
|
42 |
import java.util.ArrayList;
|
43 |
import java.util.Collections;
|
44 |
+
import org.apache.http.HttpResponse;
|
45 |
+
import org.apache.http.NameValuePair;
|
46 |
+
import org.apache.http.client.HttpClient;
|
47 |
+
import org.apache.http.client.methods.CloseableHttpResponse;
|
48 |
+
import org.apache.http.client.methods.HttpPost;
|
49 |
+
import org.apache.http.impl.client.DefaultHttpClient;
|
50 |
+
import org.apache.http.util.EntityUtils;
|
51 |
+
import tqtk.Utils.Doc_file_kieu_txt;
|
52 |
+
|
53 |
@SpringBootApplication
|
54 |
@RestController
|
55 |
public class DemoApplication {
|
|
|
57 |
public static int count = 0;
|
58 |
|
59 |
public static ApplicationContext context;
|
60 |
+
static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
|
61 |
|
62 |
public static void main(String[] args) {
|
63 |
+
|
64 |
context = SpringApplication.run(DemoApplication.class, args);
|
65 |
}
|
66 |
|
67 |
+
@GetMapping("start_spam")
|
68 |
+
public String startSpam() throws IOException {
|
69 |
+
LocalTime now = LocalTime.now();
|
70 |
+
new Thread() {
|
71 |
+
@Override
|
72 |
+
public void run() {
|
73 |
+
List<String> lists = Doc_file_kieu_txt.readFile("urls.txt");
|
74 |
+
int i = 0;
|
75 |
+
while (true) {
|
76 |
+
i = ++i % lists.size();
|
77 |
+
spam(lists.get(i));
|
78 |
+
try {
|
79 |
+
Thread.sleep(4000);
|
80 |
+
} catch (InterruptedException ex) {
|
81 |
+
Logger.getLogger(DemoApplication.class.getName()).log(Level.SEVERE, null, ex);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
}.start();
|
86 |
+
return "ok";
|
87 |
+
}
|
88 |
+
|
89 |
+
@GetMapping("stop_spam")
|
90 |
+
public String stopSpam() throws IOException {
|
91 |
+
List<SessionEntity> ss = Tqtk.listSession;
|
92 |
+
for (int i = 0; i < ss.size(); ++i) {
|
93 |
+
ss.get(i).getSocket().close();
|
94 |
+
}
|
95 |
+
SpringApplication.exit(context);
|
96 |
+
return "exit";
|
97 |
+
}
|
98 |
+
|
99 |
+
@GetMapping("doc_log")
|
100 |
+
public String readLog() throws IOException {
|
101 |
+
List arrayList = Doc_file_kieu_txt.readFile("log.txt");
|
102 |
+
String str = String.join("\n", arrayList);
|
103 |
+
return str;
|
104 |
+
}
|
105 |
+
|
106 |
@GetMapping("exit")
|
107 |
public String getExit() throws IOException {
|
108 |
List<SessionEntity> ss = Tqtk.listSession;
|
|
|
131 |
}
|
132 |
return "ok";
|
133 |
}
|
134 |
+
|
135 |
+
@GetMapping("cronjob_78184.html")
|
136 |
public String cronjob_78184() throws Exception {
|
137 |
return "cronjob.de";
|
138 |
}
|
139 |
+
|
140 |
@RequestMapping(value = "/stopAll", method = RequestMethod.GET)
|
141 |
@ResponseBody
|
142 |
public String stopAll() throws IOException, UnknownHostException, InterruptedException, Exception {
|
143 |
try {
|
144 |
+
|
145 |
+
for (int i = 0; i < Tqtk.listWorker.size(); ++i) {
|
146 |
+
synchronized (Tqtk.listWorker.get(i).lock) {
|
147 |
+
Tqtk.listWorker.get(i).isStop = true;
|
148 |
+
}
|
149 |
+
}
|
150 |
} catch (Exception e) {
|
151 |
+
return "not-ok";
|
152 |
}
|
153 |
return "ok";
|
154 |
}
|
155 |
+
|
156 |
+
@RequestMapping(value = "/resumeAll", method = RequestMethod.GET)
|
|
|
157 |
@ResponseBody
|
158 |
public String resumeAll() throws IOException, UnknownHostException, InterruptedException, Exception {
|
159 |
try {
|
160 |
+
Tqtk.listSession = new ArrayList<>();
|
161 |
+
Tqtk.listSession = Collections.synchronizedList(Tqtk.listSession);
|
162 |
+
for (int i = 0; i < Tqtk.listWorker.size(); ++i) {
|
163 |
+
synchronized (Tqtk.listWorker.get(i).lock) {
|
164 |
+
Tqtk.listWorker.get(i).setSs(Tqtk.listSession.get(i));
|
165 |
+
Tqtk.listWorker.get(i).createSocket(Tqtk.listSession.get(i));
|
166 |
+
Tqtk.listWorker.get(i).isStop = false;
|
167 |
+
Tqtk.listWorker.get(i).lock.notify();
|
168 |
+
}
|
169 |
+
}
|
170 |
} catch (Exception e) {
|
171 |
+
return e.getMessage();
|
172 |
}
|
173 |
return "ok";
|
174 |
}
|
|
|
175 |
|
176 |
@RequestMapping(value = "/updateInfo", method = RequestMethod.GET)
|
177 |
@ResponseBody
|
|
|
195 |
}
|
196 |
return "not-ok";
|
197 |
}
|
198 |
+
|
199 |
+
@RequestMapping(value = "/githook", method = RequestMethod.POST)
|
200 |
+
public String githook() throws IOException, UnknownHostException, InterruptedException {
|
201 |
+
|
202 |
+
return "ok";
|
203 |
+
}
|
204 |
|
205 |
@RequestMapping(value = "/sendcmd1", method = RequestMethod.POST)
|
206 |
@ResponseBody
|
|
|
255 |
@GetMapping("setSessionId")
|
256 |
public String setSessionId(@RequestParam(value = "id", required = true) String id,
|
257 |
@RequestParam(value = "session", required = true) String session) throws Exception {
|
258 |
+
|
259 |
+
try {
|
260 |
+
|
261 |
+
for (int i = 0; i < Tqtk.listWorker.size(); ++i) {
|
262 |
+
if (id.equals(Tqtk.listWorker.get(i).getSs().getUserId())) {
|
263 |
+
|
264 |
+
Tqtk.listWorker.get(i).getSs().setSessionKey(session);
|
265 |
+
return "ok";
|
266 |
+
}
|
267 |
+
}
|
268 |
} catch (Exception e) {
|
269 |
+
return e.getMessage();
|
270 |
}
|
271 |
+
|
272 |
return "not-ok";
|
273 |
}
|
274 |
|
|
|
285 |
|
286 |
}
|
287 |
|
288 |
+
public static void spam(String url) {
|
289 |
+
String response;
|
290 |
+
HttpClient httpClient = new DefaultHttpClient();
|
291 |
+
try {
|
292 |
+
HttpPost get = new HttpPost(url);
|
293 |
+
|
294 |
+
get.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36");
|
295 |
+
|
296 |
+
get.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
|
297 |
+
get.setHeader("Sec-Fetch-Dest", "empty");
|
298 |
+
get.setHeader("Sec-Fetch-Mode", "cors");
|
299 |
+
get.setHeader("Sec-Fetch-Site", "same-origin");
|
300 |
+
get.setHeader("X-Same-Domain", "1");
|
301 |
+
|
302 |
+
CloseableHttpResponse Cresponse = (CloseableHttpResponse) httpClient.execute(get);
|
303 |
+
int s = Cresponse.getStatusLine().getStatusCode();
|
304 |
+
Util.writeFile(LocalTime.now().format(formatter) + " status " + s, "/log.txt");
|
305 |
+
return;
|
306 |
+
} catch (IOException ex) {
|
307 |
+
ex.getMessage();
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
public String executeCommand(String command) {
|
312 |
|
313 |
StringBuffer output = new StringBuffer();
|
src/main/java/com/sqlite/config/DBConfig.java
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
package com.sqlite.config;
|
2 |
+
|
3 |
+
import javax.sql.DataSource;
|
4 |
+
import org.springframework.boot.jdbc.DataSourceBuilder;
|
5 |
+
|
6 |
+
import org.springframework.context.annotation.Bean;
|
7 |
+
import org.springframework.context.annotation.Configuration;
|
8 |
+
|
9 |
+
@Configuration
|
10 |
+
public class DBConfig {
|
11 |
+
@Bean
|
12 |
+
public DataSource dataSource() {
|
13 |
+
DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
|
14 |
+
dataSourceBuilder.driverClassName("org.sqlite.JDBC");
|
15 |
+
dataSourceBuilder.url("jdbc:sqlite:mydb.db");
|
16 |
+
return dataSourceBuilder.build();
|
17 |
+
}
|
18 |
+
}
|
src/main/java/com/sqlite/config/DBInitializeConfig.java
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
package com.sqlite.config;
|
2 |
+
|
3 |
+
import java.sql.Connection;
|
4 |
+
import java.sql.SQLException;
|
5 |
+
import java.sql.Statement;
|
6 |
+
|
7 |
+
import javax.annotation.PostConstruct;
|
8 |
+
import javax.sql.DataSource;
|
9 |
+
|
10 |
+
import org.springframework.beans.factory.annotation.Autowired;
|
11 |
+
import org.springframework.context.annotation.Configuration;
|
12 |
+
|
13 |
+
@Configuration
|
14 |
+
public class DBInitializeConfig {
|
15 |
+
|
16 |
+
@Autowired
|
17 |
+
private DataSource dataSource;
|
18 |
+
|
19 |
+
@PostConstruct
|
20 |
+
public void initialize() {
|
21 |
+
// try {
|
22 |
+
// Connection connection = dataSource.getConnection();
|
23 |
+
// Statement statement = connection.createStatement();
|
24 |
+
// statement.execute("DROP TABLE IF EXISTS UserLogin");
|
25 |
+
// statement.executeUpdate(
|
26 |
+
// "CREATE TABLE UserLogin("
|
27 |
+
// + "id INTEGER Primary key, "
|
28 |
+
// + "userName varchar(30) not null,"
|
29 |
+
// + "password varchar(30) not null,"
|
30 |
+
// + "firstName varchar(30) not null, "
|
31 |
+
// + "lastName varchar(30) not null,"
|
32 |
+
// + "email varchar(100) not null,"
|
33 |
+
// + "mobile varchar(30) not null)"
|
34 |
+
// );
|
35 |
+
// statement.executeUpdate(
|
36 |
+
// "INSERT INTO UserLogin "
|
37 |
+
// + "(userName,password,firstName,lastName,email,mobile) "
|
38 |
+
// + "VALUES " + "('bharat0126','dbase123','Bharat','Verma',"
|
39 |
+
// + " '[email protected]','8861456151')"
|
40 |
+
// );
|
41 |
+
// statement.close();
|
42 |
+
// connection.close();
|
43 |
+
// } catch (SQLException e) {
|
44 |
+
// e.printStackTrace();
|
45 |
+
// }
|
46 |
+
}
|
47 |
+
}
|
src/main/java/com/sqlite/config/MvcConfig.java
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* To change this license header, choose License Headers in Project Properties.
|
3 |
+
* To change this template file, choose Tools | Templates
|
4 |
+
* and open the template in the editor.
|
5 |
+
*/
|
6 |
+
package com.sqlite.config;
|
7 |
+
|
8 |
+
import java.util.List;
|
9 |
+
import org.springframework.context.annotation.Configuration;
|
10 |
+
import org.springframework.format.FormatterRegistry;
|
11 |
+
import org.springframework.http.converter.HttpMessageConverter;
|
12 |
+
import org.springframework.validation.MessageCodesResolver;
|
13 |
+
import org.springframework.validation.Validator;
|
14 |
+
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
15 |
+
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
|
16 |
+
import org.springframework.web.servlet.HandlerExceptionResolver;
|
17 |
+
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
|
18 |
+
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
|
19 |
+
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
20 |
+
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
|
21 |
+
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
22 |
+
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
23 |
+
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
|
24 |
+
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
25 |
+
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
26 |
+
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
|
27 |
+
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
28 |
+
|
29 |
+
|
30 |
+
public class MvcConfig {
|
31 |
+
|
32 |
+
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
|
37 |
+
}
|
src/main/java/com/sqlite/config/SQLiteDialect.java
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
package com.sqlite.config;
|
2 |
+
|
3 |
+
import java.sql.Types;
|
4 |
+
|
5 |
+
import org.hibernate.dialect.Dialect;
|
6 |
+
import org.hibernate.dialect.function.SQLFunctionTemplate;
|
7 |
+
import org.hibernate.dialect.function.StandardSQLFunction;
|
8 |
+
import org.hibernate.dialect.function.VarArgsSQLFunction;
|
9 |
+
import org.hibernate.type.StringType;
|
10 |
+
|
11 |
+
public class SQLiteDialect extends Dialect {
|
12 |
+
public SQLiteDialect() {
|
13 |
+
registerColumnType(Types.BIT, "integer");
|
14 |
+
registerColumnType(Types.TINYINT, "tinyint");
|
15 |
+
registerColumnType(Types.SMALLINT, "smallint");
|
16 |
+
registerColumnType(Types.INTEGER, "integer");
|
17 |
+
registerColumnType(Types.BIGINT, "bigint");
|
18 |
+
registerColumnType(Types.FLOAT, "float");
|
19 |
+
registerColumnType(Types.REAL, "real");
|
20 |
+
registerColumnType(Types.DOUBLE, "double");
|
21 |
+
registerColumnType(Types.NUMERIC, "numeric");
|
22 |
+
registerColumnType(Types.DECIMAL, "decimal");
|
23 |
+
registerColumnType(Types.CHAR, "char");
|
24 |
+
registerColumnType(Types.VARCHAR, "varchar");
|
25 |
+
registerColumnType(Types.LONGVARCHAR, "longvarchar");
|
26 |
+
registerColumnType(Types.DATE, "date");
|
27 |
+
registerColumnType(Types.TIME, "time");
|
28 |
+
registerColumnType(Types.TIMESTAMP, "timestamp");
|
29 |
+
registerColumnType(Types.BINARY, "blob");
|
30 |
+
registerColumnType(Types.VARBINARY, "blob");
|
31 |
+
registerColumnType(Types.LONGVARBINARY, "blob");
|
32 |
+
// registerColumnType(Types.NULL, "null");
|
33 |
+
registerColumnType(Types.BLOB, "blob");
|
34 |
+
registerColumnType(Types.CLOB, "clob");
|
35 |
+
registerColumnType(Types.BOOLEAN, "integer");
|
36 |
+
|
37 |
+
registerFunction( "concat", new VarArgsSQLFunction(StringType.INSTANCE, "", "||", "") );
|
38 |
+
registerFunction( "mod", new SQLFunctionTemplate( StringType.INSTANCE, "?1 % ?2" ) );
|
39 |
+
registerFunction( "substr", new StandardSQLFunction("substr", StringType.INSTANCE) );
|
40 |
+
registerFunction( "substring", new StandardSQLFunction( "substr", StringType.INSTANCE) );
|
41 |
+
}
|
42 |
+
|
43 |
+
public boolean supportsIdentityColumns() {
|
44 |
+
return true;
|
45 |
+
}
|
46 |
+
|
47 |
+
/*
|
48 |
+
public boolean supportsInsertSelectIdentity() {
|
49 |
+
return true; // As specify in NHibernate dialect
|
50 |
+
}
|
51 |
+
*/
|
52 |
+
|
53 |
+
public boolean hasDataTypeInIdentityColumn() {
|
54 |
+
return false; // As specify in NHibernate dialect
|
55 |
+
}
|
56 |
+
|
57 |
+
/*
|
58 |
+
public String appendIdentitySelectToInsert(String insertString) {
|
59 |
+
return new StringBuffer(insertString.length()+30). // As specify in NHibernate dialect
|
60 |
+
append(insertString).
|
61 |
+
append("; ").append(getIdentitySelectString()).
|
62 |
+
toString();
|
63 |
+
}
|
64 |
+
*/
|
65 |
+
|
66 |
+
public String getIdentityColumnString() {
|
67 |
+
// return "integer primary key autoincrement";
|
68 |
+
return "integer";
|
69 |
+
}
|
70 |
+
|
71 |
+
public String getIdentitySelectString() {
|
72 |
+
return "select last_insert_rowid()";
|
73 |
+
}
|
74 |
+
|
75 |
+
public boolean supportsLimit() {
|
76 |
+
return true;
|
77 |
+
}
|
78 |
+
|
79 |
+
protected String getLimitString(String query, boolean hasOffset) {
|
80 |
+
return new StringBuffer(query.length()+20).
|
81 |
+
append(query).
|
82 |
+
append(hasOffset ? " limit ? offset ?" : " limit ?").
|
83 |
+
toString();
|
84 |
+
}
|
85 |
+
|
86 |
+
public boolean supportsTemporaryTables() {
|
87 |
+
return true;
|
88 |
+
}
|
89 |
+
|
90 |
+
public String getCreateTemporaryTableString() {
|
91 |
+
return "create temporary table if not exists";
|
92 |
+
}
|
93 |
+
|
94 |
+
public boolean dropTemporaryTableAfterUse() {
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
|
98 |
+
public boolean supportsCurrentTimestampSelection() {
|
99 |
+
return true;
|
100 |
+
}
|
101 |
+
|
102 |
+
public boolean isCurrentTimestampSelectStringCallable() {
|
103 |
+
return false;
|
104 |
+
}
|
105 |
+
|
106 |
+
public String getCurrentTimestampSelectString() {
|
107 |
+
return "select current_timestamp";
|
108 |
+
}
|
109 |
+
|
110 |
+
public boolean supportsUnionAll() {
|
111 |
+
return true;
|
112 |
+
}
|
113 |
+
|
114 |
+
public boolean hasAlterTable() {
|
115 |
+
return false; // As specify in NHibernate dialect
|
116 |
+
}
|
117 |
+
|
118 |
+
public boolean dropConstraints() {
|
119 |
+
return false;
|
120 |
+
}
|
121 |
+
|
122 |
+
public String getAddColumnString() {
|
123 |
+
return "add column";
|
124 |
+
}
|
125 |
+
|
126 |
+
public String getForUpdateString() {
|
127 |
+
return "";
|
128 |
+
}
|
129 |
+
|
130 |
+
public boolean supportsOuterJoinForUpdate() {
|
131 |
+
return false;
|
132 |
+
}
|
133 |
+
|
134 |
+
public String getDropForeignKeyString() {
|
135 |
+
throw new UnsupportedOperationException("No drop foreign key syntax supported by SQLiteDialect");
|
136 |
+
}
|
137 |
+
|
138 |
+
public String getAddForeignKeyConstraintString(String constraintName,
|
139 |
+
String[] foreignKey, String referencedTable, String[] primaryKey,
|
140 |
+
boolean referencesPrimaryKey) {
|
141 |
+
throw new UnsupportedOperationException("No add foreign key syntax supported by SQLiteDialect");
|
142 |
+
}
|
143 |
+
|
144 |
+
public String getAddPrimaryKeyConstraintString(String constraintName) {
|
145 |
+
throw new UnsupportedOperationException("No add primary key syntax supported by SQLiteDialect");
|
146 |
+
}
|
147 |
+
|
148 |
+
public boolean supportsIfExistsBeforeTableName() {
|
149 |
+
return true;
|
150 |
+
}
|
151 |
+
|
152 |
+
public boolean supportsCascadeDelete() {
|
153 |
+
return false;
|
154 |
+
}
|
155 |
+
}
|
src/main/java/tqtk/Utils/Doc_file_kieu_txt.java
CHANGED
@@ -26,7 +26,9 @@ public class Doc_file_kieu_txt {
|
|
26 |
br = new BufferedReader(new FileReader(path));
|
27 |
|
28 |
while ((read = br.readLine()) != null) {
|
29 |
-
|
|
|
|
|
30 |
}
|
31 |
return lists;
|
32 |
|
|
|
26 |
br = new BufferedReader(new FileReader(path));
|
27 |
|
28 |
while ((read = br.readLine()) != null) {
|
29 |
+
if (!Util.isBlank(read)) {
|
30 |
+
lists.add(read);
|
31 |
+
}
|
32 |
}
|
33 |
return lists;
|
34 |
|
src/main/java/tqtk/Utils/Util.java
CHANGED
@@ -9,8 +9,10 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
9 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
10 |
import java.io.BufferedInputStream;
|
11 |
import java.io.BufferedReader;
|
|
|
12 |
import java.io.DataOutputStream;
|
13 |
import java.io.FileInputStream;
|
|
|
14 |
import java.io.FileReader;
|
15 |
import java.io.IOException;
|
16 |
import java.io.InputStream;
|
@@ -34,6 +36,8 @@ import javax.net.ssl.HttpsURLConnection;
|
|
34 |
import org.apache.commons.lang3.StringUtils;
|
35 |
import tqtk.Entity.SessionEntity;
|
36 |
import java.io.FileReader;
|
|
|
|
|
37 |
import java.util.Iterator;
|
38 |
import java.util.regex.Matcher;
|
39 |
import java.util.regex.Pattern;
|
@@ -56,6 +60,25 @@ public class Util {
|
|
56 |
msCookieManager = new CookieManager();
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
public void setCookie(CookieManager msCookieManager) {
|
60 |
CookieHandler.setDefault(msCookieManager);
|
61 |
}
|
@@ -377,7 +400,7 @@ public class Util {
|
|
377 |
JSONParser jsonParser = new JSONParser();
|
378 |
JSONObject jSONObjecttemp = null;
|
379 |
String x = "/" + file_name;
|
380 |
-
try (FileReader reader = new FileReader(x)) {
|
381 |
//Read JSON file
|
382 |
jSONObject = (org.json.simple.JSONObject) jsonParser.parse(reader);
|
383 |
|
@@ -809,7 +832,7 @@ public class Util {
|
|
809 |
public static boolean checkIdRunUyPhai(String id) throws Exception {
|
810 |
boolean rs = false;
|
811 |
try {
|
812 |
-
final URL obj = new URL("http://subsixcyber13.pythonanywhere.com/check-uy-phai?id="+id);
|
813 |
// Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("0.0.0.0", 1080));
|
814 |
HttpURLConnection con;
|
815 |
if (obj.getProtocol().equals("http")) {
|
|
|
9 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
10 |
import java.io.BufferedInputStream;
|
11 |
import java.io.BufferedReader;
|
12 |
+
import java.io.BufferedWriter;
|
13 |
import java.io.DataOutputStream;
|
14 |
import java.io.FileInputStream;
|
15 |
+
import java.io.FileNotFoundException;
|
16 |
import java.io.FileReader;
|
17 |
import java.io.IOException;
|
18 |
import java.io.InputStream;
|
|
|
36 |
import org.apache.commons.lang3.StringUtils;
|
37 |
import tqtk.Entity.SessionEntity;
|
38 |
import java.io.FileReader;
|
39 |
+
import java.io.FileWriter;
|
40 |
+
import java.io.PrintWriter;
|
41 |
import java.util.Iterator;
|
42 |
import java.util.regex.Matcher;
|
43 |
import java.util.regex.Pattern;
|
|
|
60 |
msCookieManager = new CookieManager();
|
61 |
}
|
62 |
|
63 |
+
public static boolean isBlank(String s) {
|
64 |
+
return s == null || s.trim().length() == 0;
|
65 |
+
}
|
66 |
+
|
67 |
+
public static synchronized void writeFile(final String content, final String name) throws FileNotFoundException, UnsupportedEncodingException, IOException {
|
68 |
+
PrintWriter out = null;
|
69 |
+
try {
|
70 |
+
// out = new PrintWriter(new BufferedWriter(new FileWriter(System.getProperty("user.dir") + "\\" + name, true)));
|
71 |
+
out = new PrintWriter(new BufferedWriter(new FileWriter( name, true)));
|
72 |
+
out.println(content);
|
73 |
+
} catch (IOException e) {
|
74 |
+
throw e;
|
75 |
+
} finally {
|
76 |
+
if (out != null) {
|
77 |
+
out.close();
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
public void setCookie(CookieManager msCookieManager) {
|
83 |
CookieHandler.setDefault(msCookieManager);
|
84 |
}
|
|
|
400 |
JSONParser jsonParser = new JSONParser();
|
401 |
JSONObject jSONObjecttemp = null;
|
402 |
String x = "/" + file_name;
|
403 |
+
try ( FileReader reader = new FileReader(x)) {
|
404 |
//Read JSON file
|
405 |
jSONObject = (org.json.simple.JSONObject) jsonParser.parse(reader);
|
406 |
|
|
|
832 |
public static boolean checkIdRunUyPhai(String id) throws Exception {
|
833 |
boolean rs = false;
|
834 |
try {
|
835 |
+
final URL obj = new URL("http://subsixcyber13.pythonanywhere.com/check-uy-phai?id=" + id);
|
836 |
// Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("0.0.0.0", 1080));
|
837 |
HttpURLConnection con;
|
838 |
if (obj.getProtocol().equals("http")) {
|
src/main/java/tqtk/XuLy/Worker.java
CHANGED
@@ -1150,7 +1150,7 @@ public class Worker extends Thread {
|
|
1150 |
if (Chinhchien == 1) {
|
1151 |
Chinhchien = 0;
|
1152 |
List<String> list1 = new ArrayList<>();
|
1153 |
-
list1.add(0, "
|
1154 |
list1.add(1, "0");
|
1155 |
|
1156 |
try {
|
@@ -1856,7 +1856,12 @@ public class Worker extends Thread {
|
|
1856 |
NhanThuong();
|
1857 |
GianKhoan();
|
1858 |
GianKhoan();
|
1859 |
-
|
|
|
|
|
|
|
|
|
|
|
1860 |
ThuThue();
|
1861 |
|
1862 |
ChiemMo();
|
|
|
1150 |
if (Chinhchien == 1) {
|
1151 |
Chinhchien = 0;
|
1152 |
List<String> list1 = new ArrayList<>();
|
1153 |
+
list1.add(0, "5708");
|
1154 |
list1.add(1, "0");
|
1155 |
|
1156 |
try {
|
|
|
1856 |
NhanThuong();
|
1857 |
GianKhoan();
|
1858 |
GianKhoan();
|
1859 |
+
|
1860 |
+
if (!ss.getUserId().equals("2301252106191710") && !ss.getUserId().equals("2301252112453620")) {
|
1861 |
+
FarmDoLv60();
|
1862 |
+
}
|
1863 |
+
|
1864 |
+
|
1865 |
ThuThue();
|
1866 |
|
1867 |
ChiemMo();
|
src/main/resources/application.properties
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
server.tomcat.accesslog.enabled=true
|
2 |
|
3 |
-
spring.
|
4 |
-
spring.jpa.
|
5 |
-
spring.jpa.hibernate.
|
6 |
-
|
7 |
-
spring.
|
8 |
-
spring.
|
9 |
-
spring.datasource.password=HnrVi6LMZ0zJXZcibSCQrdUiYZihAQK4
|
10 |
-
spring.datasource.driver-class-name=org.postgresql.Driver
|
|
|
1 |
server.tomcat.accesslog.enabled=true
|
2 |
|
3 |
+
spring.profiles.active=dev
|
4 |
+
spring.jpa.database-platform=com.sqlite.config.SQLiteDialect
|
5 |
+
#spring.jpa.hibernate.ddl-auto=create-drop
|
6 |
+
spring.jpa.hibernate.ddl-auto=create
|
7 |
+
spring.jpa.show-sql=true
|
8 |
+
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.EJB3NamingStrategy
|
|
|
|
urls.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
|