we commited on
Commit
5b3e8ad
·
1 Parent(s): 00d8ed3
Dockerfile CHANGED
@@ -12,6 +12,7 @@ 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 7860
 
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 /ggsheet.txt ggsheet.txt
16
  COPY --from=build /mydb.db mydb.db
17
  # ENV PORT=8080
18
  EXPOSE 7860
ggsheet.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ https://script.google.com/macros/s/AKfycbwGvcAkhVHiFG-eULvGuenVDssyQGdMjUB_7ijxXuyc2UMRxk8z57KHaYpScseNOWsCtw/callback?nocache_id=5
pom.xml CHANGED
@@ -45,25 +45,25 @@
45
  <groupId>org.springframework.boot</groupId>
46
  <artifactId>spring-boot-starter-web</artifactId>
47
  </dependency>
48
- <dependency>
49
- <groupId>org.springframework.boot</groupId>
50
- <artifactId>spring-boot-starter-data-jpa</artifactId>
51
- </dependency>
52
- <dependency>
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>
69
  <artifactId>spring-boot-starter-test</artifactId>
 
45
  <groupId>org.springframework.boot</groupId>
46
  <artifactId>spring-boot-starter-web</artifactId>
47
  </dependency>
48
+ <!-- <dependency>-->
49
+ <!-- <groupId>org.springframework.boot</groupId>-->
50
+ <!-- <artifactId>spring-boot-starter-data-jpa</artifactId>-->
51
+ <!-- </dependency>-->
52
+ <!-- <dependency>-->
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>
69
  <artifactId>spring-boot-starter-test</artifactId>
src/main/java/com/example/demo/DemoApplication.java CHANGED
@@ -1,7 +1,10 @@
1
  package com.example.demo;
2
 
3
  import com.example.demo.entity.User_test;
4
- import com.example.demo.repository.UserRepository;
 
 
 
5
  import org.springframework.beans.factory.annotation.Autowired;
6
  import org.springframework.boot.SpringApplication;
7
  import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -50,6 +53,9 @@ 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 {
@@ -64,13 +70,100 @@ public class DemoApplication {
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();
@@ -298,10 +391,15 @@ public class DemoApplication {
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();
 
1
  package com.example.demo;
2
 
3
  import com.example.demo.entity.User_test;
4
+ import org.apache.http.HttpEntity;
5
+ import org.apache.http.client.entity.UrlEncodedFormEntity;
6
+ import org.apache.http.client.methods.HttpGet;
7
+ import org.apache.http.message.BasicNameValuePair;
8
  import org.springframework.beans.factory.annotation.Autowired;
9
  import org.springframework.boot.SpringApplication;
10
  import org.springframework.boot.autoconfigure.SpringBootApplication;
 
53
  import org.apache.http.util.EntityUtils;
54
  import tqtk.Utils.Doc_file_kieu_txt;
55
 
56
+ import javax.servlet.http.HttpServletResponse;
57
+ import java.io.InputStream;
58
+
59
  @SpringBootApplication
60
  @RestController
61
  public class DemoApplication {
 
70
  context = SpringApplication.run(DemoApplication.class, args);
71
  }
72
 
73
+ public static int index = 0;
74
+
75
+ @GetMapping("getFile")
76
+ public void getFile(HttpServletResponse response) throws IOException {
77
+
78
+ List<String> lists = Doc_file_kieu_txt.readFile("urls.txt");
79
+
80
+ index = ++index % lists.size();
81
+
82
+ response.setHeader("Pragma", "no-cache");
83
+ response.setHeader("Cache-Control", "no-cache");
84
+
85
+ HttpClient httpClient = new DefaultHttpClient();
86
+ try {
87
+ HttpPost get = new HttpPost(lists.get(index));
88
+
89
+ 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");
90
+
91
+ 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");
92
+ get.setHeader("Sec-Fetch-Dest", "empty");
93
+ get.setHeader("Sec-Fetch-Mode", "cors");
94
+ get.setHeader("Sec-Fetch-Site", "same-origin");
95
+ get.setHeader("X-Same-Domain", "1");
96
+
97
+ CloseableHttpResponse Cresponse = (CloseableHttpResponse) httpClient.execute(get);
98
+ int s = Cresponse.getStatusLine().getStatusCode();
99
+ Cresponse.getEntity().getContent().transferTo(response.getOutputStream());
100
+ } catch (IOException ex) {
101
+ ex.getMessage();
102
+ }
103
+
104
+ }
105
+
106
+ public static int countOk = 0 ;
107
+ @GetMapping("count_ok")
108
+ public String getOK() throws IOException {
109
+ return Integer.toString(countOk);
110
+ }
111
+
112
+ @GetMapping("start_spam2")
113
+ public String startSpam2() throws IOException {
114
+ new Thread() {
115
+ @Override
116
+ public void run() {
117
+ while (true) {
118
+ HttpClient httpClient = new DefaultHttpClient();
119
+ try {
120
+ HttpGet get = new HttpGet("https://lisatthu35-java-test-bw.hf.space/getFile");
121
+
122
+ 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");
123
+
124
+ 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");
125
+ get.setHeader("Sec-Fetch-Dest", "empty");
126
+ get.setHeader("Sec-Fetch-Mode", "cors");
127
+ get.setHeader("Sec-Fetch-Site", "same-origin");
128
+ get.setHeader("X-Same-Domain", "1");
129
+
130
+ CloseableHttpResponse Cresponse = (CloseableHttpResponse) httpClient.execute(get);
131
+ int s = Cresponse.getStatusLine().getStatusCode();
132
+ if(s==200){
133
+ InputStream inputStream = Cresponse.getEntity().getContent();
134
+ long contentLength = Cresponse.getEntity().getContentLength();
135
+ byte[] buffer = new byte[4096];
136
+ int bytesRead;
137
+ long totalBytesRead = 0;
138
+ while ((bytesRead = inputStream.read(buffer)) != -1) {
139
+ totalBytesRead += bytesRead;
140
+ if (totalBytesRead == contentLength) {
141
+ break;
142
+ }
143
+ }
144
+ countOk++;
145
+ }
146
+ } catch (IOException ex) {
147
+ ex.getMessage();
148
+ }
149
+ try {
150
+ Thread.sleep(4000);
151
+ } catch (InterruptedException ex) {
152
+ Logger.getLogger(DemoApplication.class.getName()).log(Level.SEVERE, null, ex);
153
+ }
154
+ }
155
+ }
156
+ }.start();
157
+ return "ok";
158
+ }
159
+
160
  @GetMapping("start_spam")
161
  public String startSpam() throws IOException {
162
  LocalTime now = LocalTime.now();
163
  new Thread() {
164
  @Override
165
  public void run() {
166
+ List<String> lists = Doc_file_kieu_txt.readFile("ggsheet.txt");
167
  int i = 0;
168
  while (true) {
169
  i = ++i % lists.size();
 
391
  get.setHeader("Sec-Fetch-Mode", "cors");
392
  get.setHeader("Sec-Fetch-Site", "same-origin");
393
  get.setHeader("X-Same-Domain", "1");
394
+ List<NameValuePair> pa = new ArrayList<>();
395
+ pa.add(new BasicNameValuePair("request", "[\"call1\",\"[]\",null,[0],null,null,1,0]"));
396
+
397
+ HttpEntity httpEntity = new UrlEncodedFormEntity(pa, "UTF-8");
398
+ get.setEntity(httpEntity);
399
 
400
  CloseableHttpResponse Cresponse = (CloseableHttpResponse) httpClient.execute(get);
401
  int s = Cresponse.getStatusLine().getStatusCode();
402
+ // Util.writeFile(LocalTime.now().format(formatter) + " status " + s, "/log.txt");
403
  return;
404
  } catch (IOException ex) {
405
  ex.getMessage();
src/main/java/com/example/demo/Test.java CHANGED
@@ -1,7 +1,6 @@
1
  package com.example.demo;
2
 
3
  import com.example.demo.entity.User_test;
4
- import com.example.demo.repository.UserRepository;
5
  import com.fasterxml.jackson.databind.DeserializationFeature;
6
  import com.fasterxml.jackson.databind.ObjectMapper;
7
  import java.io.BufferedInputStream;
 
1
  package com.example.demo;
2
 
3
  import com.example.demo.entity.User_test;
 
4
  import com.fasterxml.jackson.databind.DeserializationFeature;
5
  import com.fasterxml.jackson.databind.ObjectMapper;
6
  import java.io.BufferedInputStream;
src/main/java/com/example/demo/entity/User.java DELETED
@@ -1,44 +0,0 @@
1
- package com.example.demo.entity;
2
-
3
- import javax.persistence.*;
4
- import java.io.Serializable;
5
-
6
- @Entity
7
- @Table(name = "users")
8
- public class User implements Serializable {
9
-
10
- @Id
11
- @SequenceGenerator(name = "sequenceGenerator", sequenceName = "sequence_name_user", allocationSize = 1, initialValue = 1)
12
- @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
13
- private Long id;
14
-
15
- @Column(name = "first_name", length = 50)
16
- private String firstName;
17
-
18
- @Column(name = "last_name", length = 50)
19
- private String lastName;
20
-
21
- public Long getId() {
22
- return id;
23
- }
24
-
25
- public void setId(Long id) {
26
- this.id = id;
27
- }
28
-
29
- public String getFirstName() {
30
- return firstName;
31
- }
32
-
33
- public void setFirstName(String firstName) {
34
- this.firstName = firstName;
35
- }
36
-
37
- public String getLastName() {
38
- return lastName;
39
- }
40
-
41
- public void setLastName(String lastName) {
42
- this.lastName = lastName;
43
- }
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/main/java/com/example/demo/repository/UserRepository.java DELETED
@@ -1,9 +0,0 @@
1
- package com.example.demo.repository;
2
-
3
- import com.example.demo.entity.User;
4
- import org.springframework.data.jpa.repository.JpaRepository;
5
- import org.springframework.stereotype.Repository;
6
-
7
- @Repository
8
- public interface UserRepository extends JpaRepository<User, Long> {
9
- }
 
 
 
 
 
 
 
 
 
 
src/main/java/com/sqlite/config/DBConfig.java CHANGED
@@ -6,7 +6,7 @@ import org.springframework.boot.jdbc.DataSourceBuilder;
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() {
 
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() {
src/main/java/com/sqlite/config/DBInitializeConfig.java CHANGED
@@ -10,7 +10,7 @@ import javax.sql.DataSource;
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
 
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
src/main/java/com/sqlite/config/SQLiteDialect.java DELETED
@@ -1,155 +0,0 @@
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/resources/application.properties CHANGED
@@ -1,9 +1,9 @@
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
9
  server.port=7860
 
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
9
  server.port=7860