Compare commits
4 Commits
main
...
e65e48f479
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e65e48f479 | ||
|
|
f12cba08fb | ||
|
|
a276e91f23 | ||
|
|
cfb3faa4c7 |
63
src/test_scan_android/Activity1.java
Normal file
63
src/test_scan_android/Activity1.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity10.java
Normal file
63
src/test_scan_android/Activity10.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity11.java
Normal file
63
src/test_scan_android/Activity11.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity12.java
Normal file
63
src/test_scan_android/Activity12.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity13.java
Normal file
63
src/test_scan_android/Activity13.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity14.java
Normal file
63
src/test_scan_android/Activity14.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity15.java
Normal file
63
src/test_scan_android/Activity15.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity16.java
Normal file
63
src/test_scan_android/Activity16.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity17.java
Normal file
63
src/test_scan_android/Activity17.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity18.java
Normal file
63
src/test_scan_android/Activity18.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity19.java
Normal file
63
src/test_scan_android/Activity19.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity2.java
Normal file
63
src/test_scan_android/Activity2.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity20.java
Normal file
63
src/test_scan_android/Activity20.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity21.java
Normal file
63
src/test_scan_android/Activity21.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity22.java
Normal file
63
src/test_scan_android/Activity22.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity23.java
Normal file
63
src/test_scan_android/Activity23.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity24.java
Normal file
63
src/test_scan_android/Activity24.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity25.java
Normal file
63
src/test_scan_android/Activity25.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity26.java
Normal file
63
src/test_scan_android/Activity26.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity27.java
Normal file
63
src/test_scan_android/Activity27.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity28.java
Normal file
63
src/test_scan_android/Activity28.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity29.java
Normal file
63
src/test_scan_android/Activity29.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity3.java
Normal file
63
src/test_scan_android/Activity3.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity30.java
Normal file
63
src/test_scan_android/Activity30.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity4.java
Normal file
63
src/test_scan_android/Activity4.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity5.java
Normal file
63
src/test_scan_android/Activity5.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity6.java
Normal file
63
src/test_scan_android/Activity6.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity7.java
Normal file
63
src/test_scan_android/Activity7.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity8.java
Normal file
63
src/test_scan_android/Activity8.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
63
src/test_scan_android/Activity9.java
Normal file
63
src/test_scan_android/Activity9.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
19
src/test_scan_round2/service_1.rs
Normal file
19
src/test_scan_round2/service_1.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use std::io::{self, Read, Write};
|
||||
use std::net::TcpListener;
|
||||
use std::fs::File;
|
||||
use std::process::Command;
|
||||
|
||||
fn handle_connection(mut stream: std::net::TcpStream) -> io::Result<()> {
|
||||
let mut buffer = [0; 1024];
|
||||
stream.read(&mut buffer)?;
|
||||
let response = "HTTP/1.1 200 OK\r\n\r\nHello";
|
||||
stream.write_all(response.as_bytes())
|
||||
}
|
||||
|
||||
fn main() -> io::Result<()> {
|
||||
let listener = TcpListener::bind("127.0.0.1:8080")?;
|
||||
for stream in listener.incoming() {
|
||||
handle_connection(stream?)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
19
src/test_scan_round2/service_2.rs
Normal file
19
src/test_scan_round2/service_2.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use std::io::{self, Read, Write};
|
||||
use std::net::TcpListener;
|
||||
use std::fs::File;
|
||||
use std::process::Command;
|
||||
|
||||
fn handle_connection(mut stream: std::net::TcpStream) -> io::Result<()> {
|
||||
let mut buffer = [0; 1024];
|
||||
stream.read(&mut buffer)?;
|
||||
let response = "HTTP/1.1 200 OK\r\n\r\nHello";
|
||||
stream.write_all(response.as_bytes())
|
||||
}
|
||||
|
||||
fn main() -> io::Result<()> {
|
||||
let listener = TcpListener::bind("127.0.0.1:8080")?;
|
||||
for stream in listener.incoming() {
|
||||
handle_connection(stream?)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
19
src/test_scan_round2/service_3.rs
Normal file
19
src/test_scan_round2/service_3.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use std::io::{self, Read, Write};
|
||||
use std::net::TcpListener;
|
||||
use std::fs::File;
|
||||
use std::process::Command;
|
||||
|
||||
fn handle_connection(mut stream: std::net::TcpStream) -> io::Result<()> {
|
||||
let mut buffer = [0; 1024];
|
||||
stream.read(&mut buffer)?;
|
||||
let response = "HTTP/1.1 200 OK\r\n\r\nHello";
|
||||
stream.write_all(response.as_bytes())
|
||||
}
|
||||
|
||||
fn main() -> io::Result<()> {
|
||||
let listener = TcpListener::bind("127.0.0.1:8080")?;
|
||||
for stream in listener.incoming() {
|
||||
handle_connection(stream?)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
19
src/test_scan_round2/service_4.rs
Normal file
19
src/test_scan_round2/service_4.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use std::io::{self, Read, Write};
|
||||
use std::net::TcpListener;
|
||||
use std::fs::File;
|
||||
use std::process::Command;
|
||||
|
||||
fn handle_connection(mut stream: std::net::TcpStream) -> io::Result<()> {
|
||||
let mut buffer = [0; 1024];
|
||||
stream.read(&mut buffer)?;
|
||||
let response = "HTTP/1.1 200 OK\r\n\r\nHello";
|
||||
stream.write_all(response.as_bytes())
|
||||
}
|
||||
|
||||
fn main() -> io::Result<()> {
|
||||
let listener = TcpListener::bind("127.0.0.1:8080")?;
|
||||
for stream in listener.incoming() {
|
||||
handle_connection(stream?)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
50
src/test_scan_rust/module_1.rs
Normal file
50
src/test_scan_rust/module_1.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_10.rs
Normal file
50
src/test_scan_rust/module_10.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_11.rs
Normal file
50
src/test_scan_rust/module_11.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_12.rs
Normal file
50
src/test_scan_rust/module_12.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_13.rs
Normal file
50
src/test_scan_rust/module_13.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_14.rs
Normal file
50
src/test_scan_rust/module_14.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_15.rs
Normal file
50
src/test_scan_rust/module_15.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_16.rs
Normal file
50
src/test_scan_rust/module_16.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_17.rs
Normal file
50
src/test_scan_rust/module_17.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_18.rs
Normal file
50
src/test_scan_rust/module_18.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_19.rs
Normal file
50
src/test_scan_rust/module_19.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_2.rs
Normal file
50
src/test_scan_rust/module_2.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_20.rs
Normal file
50
src/test_scan_rust/module_20.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_21.rs
Normal file
50
src/test_scan_rust/module_21.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_22.rs
Normal file
50
src/test_scan_rust/module_22.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_23.rs
Normal file
50
src/test_scan_rust/module_23.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_24.rs
Normal file
50
src/test_scan_rust/module_24.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_25.rs
Normal file
50
src/test_scan_rust/module_25.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_26.rs
Normal file
50
src/test_scan_rust/module_26.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_27.rs
Normal file
50
src/test_scan_rust/module_27.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_28.rs
Normal file
50
src/test_scan_rust/module_28.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_29.rs
Normal file
50
src/test_scan_rust/module_29.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_3.rs
Normal file
50
src/test_scan_rust/module_3.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_30.rs
Normal file
50
src/test_scan_rust/module_30.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_4.rs
Normal file
50
src/test_scan_rust/module_4.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_5.rs
Normal file
50
src/test_scan_rust/module_5.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_6.rs
Normal file
50
src/test_scan_rust/module_6.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_7.rs
Normal file
50
src/test_scan_rust/module_7.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_8.rs
Normal file
50
src/test_scan_rust/module_8.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
50
src/test_scan_rust/module_9.rs
Normal file
50
src/test_scan_rust/module_9.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::net::TcpStream;
|
||||
use std::process::Command;
|
||||
|
||||
fn process_user_input(input: &str) -> String {
|
||||
let data = input.to_string();
|
||||
format!("processed: {}", data)
|
||||
}
|
||||
|
||||
fn execute_command(cmd: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let output = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
.output()?;
|
||||
Ok(String::from_utf8_lossy(&output.stdout).to_string())
|
||||
}
|
||||
|
||||
fn read_file_to_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
fn connect_to_server(addr: &str) -> Result<TcpStream, std::io::Error> {
|
||||
TcpStream::connect(addr)
|
||||
}
|
||||
|
||||
fn parse_config(data: &str) -> HashMap<String, String> {
|
||||
let mut map = HashMap::new();
|
||||
for line in data.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
map.insert(k.trim().to_string(), v.trim().to_string());
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_process_input() {
|
||||
let result = process_user_input("hello");
|
||||
assert!(result.contains("hello"));
|
||||
}
|
||||
}
|
||||
55
src/test_scan_web/handler1.js
Normal file
55
src/test_scan_web/handler1.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler10.js
Normal file
55
src/test_scan_web/handler10.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler11.js
Normal file
55
src/test_scan_web/handler11.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler12.js
Normal file
55
src/test_scan_web/handler12.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler13.js
Normal file
55
src/test_scan_web/handler13.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler14.js
Normal file
55
src/test_scan_web/handler14.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler15.js
Normal file
55
src/test_scan_web/handler15.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler16.js
Normal file
55
src/test_scan_web/handler16.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler17.js
Normal file
55
src/test_scan_web/handler17.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler18.js
Normal file
55
src/test_scan_web/handler18.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler19.js
Normal file
55
src/test_scan_web/handler19.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler2.js
Normal file
55
src/test_scan_web/handler2.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler20.js
Normal file
55
src/test_scan_web/handler20.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler21.js
Normal file
55
src/test_scan_web/handler21.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler22.js
Normal file
55
src/test_scan_web/handler22.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler23.js
Normal file
55
src/test_scan_web/handler23.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler24.js
Normal file
55
src/test_scan_web/handler24.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler25.js
Normal file
55
src/test_scan_web/handler25.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler26.js
Normal file
55
src/test_scan_web/handler26.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler27.js
Normal file
55
src/test_scan_web/handler27.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler28.js
Normal file
55
src/test_scan_web/handler28.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler29.js
Normal file
55
src/test_scan_web/handler29.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler3.js
Normal file
55
src/test_scan_web/handler3.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler30.js
Normal file
55
src/test_scan_web/handler30.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler4.js
Normal file
55
src/test_scan_web/handler4.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler5.js
Normal file
55
src/test_scan_web/handler5.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler6.js
Normal file
55
src/test_scan_web/handler6.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler7.js
Normal file
55
src/test_scan_web/handler7.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler8.js
Normal file
55
src/test_scan_web/handler8.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
55
src/test_scan_web/handler9.js
Normal file
55
src/test_scan_web/handler9.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const mysql = require('mysql');
|
||||
const { exec } = require('child_process');
|
||||
const bodyParser = require('body-parser');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const dbConfig = {
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: 'password',
|
||||
database: 'testdb'
|
||||
};
|
||||
|
||||
app.get('/api/data', (req, res) => {
|
||||
const userId = req.query.id;
|
||||
const query = `SELECT * FROM users WHERE id = ${userId}`;
|
||||
const connection = mysql.createConnection(dbConfig);
|
||||
connection.query(query, (err, results) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/upload', (req, res) => {
|
||||
const filename = req.body.filename;
|
||||
const filepath = `/uploads/${filename}`;
|
||||
fs.readFile(filepath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
return;
|
||||
}
|
||||
res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/exec', (req, res) => {
|
||||
const cmd = req.body.command;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
res.status(500).json({ error: stderr });
|
||||
return;
|
||||
}
|
||||
res.send(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
Reference in New Issue
Block a user