From cfb3faa4c738082a64bd784d79229d2d73df3811 Mon Sep 17 00:00:00 2001 From: "xvgawa@gmail.com" Date: Wed, 3 Jun 2026 20:47:27 +0800 Subject: [PATCH] test: add 90 test files for round 1 scan (30 rust + 30 java + 30 js) --- src/test_scan_android/Activity1.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity10.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity11.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity12.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity13.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity14.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity15.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity16.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity17.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity18.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity19.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity2.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity20.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity21.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity22.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity23.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity24.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity25.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity26.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity27.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity28.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity29.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity3.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity30.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity4.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity5.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity6.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity7.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity8.java | 63 +++++++++++++++++++++++++++ src/test_scan_android/Activity9.java | 63 +++++++++++++++++++++++++++ src/test_scan_rust/module_1.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_10.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_11.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_12.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_13.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_14.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_15.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_16.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_17.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_18.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_19.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_2.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_20.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_21.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_22.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_23.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_24.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_25.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_26.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_27.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_28.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_29.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_3.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_30.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_4.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_5.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_6.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_7.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_8.rs | 50 +++++++++++++++++++++ src/test_scan_rust/module_9.rs | 50 +++++++++++++++++++++ src/test_scan_web/handler1.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler10.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler11.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler12.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler13.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler14.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler15.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler16.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler17.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler18.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler19.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler2.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler20.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler21.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler22.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler23.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler24.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler25.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler26.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler27.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler28.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler29.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler3.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler30.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler4.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler5.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler6.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler7.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler8.js | 55 +++++++++++++++++++++++ src/test_scan_web/handler9.js | 55 +++++++++++++++++++++++ 90 files changed, 5040 insertions(+) create mode 100644 src/test_scan_android/Activity1.java create mode 100644 src/test_scan_android/Activity10.java create mode 100644 src/test_scan_android/Activity11.java create mode 100644 src/test_scan_android/Activity12.java create mode 100644 src/test_scan_android/Activity13.java create mode 100644 src/test_scan_android/Activity14.java create mode 100644 src/test_scan_android/Activity15.java create mode 100644 src/test_scan_android/Activity16.java create mode 100644 src/test_scan_android/Activity17.java create mode 100644 src/test_scan_android/Activity18.java create mode 100644 src/test_scan_android/Activity19.java create mode 100644 src/test_scan_android/Activity2.java create mode 100644 src/test_scan_android/Activity20.java create mode 100644 src/test_scan_android/Activity21.java create mode 100644 src/test_scan_android/Activity22.java create mode 100644 src/test_scan_android/Activity23.java create mode 100644 src/test_scan_android/Activity24.java create mode 100644 src/test_scan_android/Activity25.java create mode 100644 src/test_scan_android/Activity26.java create mode 100644 src/test_scan_android/Activity27.java create mode 100644 src/test_scan_android/Activity28.java create mode 100644 src/test_scan_android/Activity29.java create mode 100644 src/test_scan_android/Activity3.java create mode 100644 src/test_scan_android/Activity30.java create mode 100644 src/test_scan_android/Activity4.java create mode 100644 src/test_scan_android/Activity5.java create mode 100644 src/test_scan_android/Activity6.java create mode 100644 src/test_scan_android/Activity7.java create mode 100644 src/test_scan_android/Activity8.java create mode 100644 src/test_scan_android/Activity9.java create mode 100644 src/test_scan_rust/module_1.rs create mode 100644 src/test_scan_rust/module_10.rs create mode 100644 src/test_scan_rust/module_11.rs create mode 100644 src/test_scan_rust/module_12.rs create mode 100644 src/test_scan_rust/module_13.rs create mode 100644 src/test_scan_rust/module_14.rs create mode 100644 src/test_scan_rust/module_15.rs create mode 100644 src/test_scan_rust/module_16.rs create mode 100644 src/test_scan_rust/module_17.rs create mode 100644 src/test_scan_rust/module_18.rs create mode 100644 src/test_scan_rust/module_19.rs create mode 100644 src/test_scan_rust/module_2.rs create mode 100644 src/test_scan_rust/module_20.rs create mode 100644 src/test_scan_rust/module_21.rs create mode 100644 src/test_scan_rust/module_22.rs create mode 100644 src/test_scan_rust/module_23.rs create mode 100644 src/test_scan_rust/module_24.rs create mode 100644 src/test_scan_rust/module_25.rs create mode 100644 src/test_scan_rust/module_26.rs create mode 100644 src/test_scan_rust/module_27.rs create mode 100644 src/test_scan_rust/module_28.rs create mode 100644 src/test_scan_rust/module_29.rs create mode 100644 src/test_scan_rust/module_3.rs create mode 100644 src/test_scan_rust/module_30.rs create mode 100644 src/test_scan_rust/module_4.rs create mode 100644 src/test_scan_rust/module_5.rs create mode 100644 src/test_scan_rust/module_6.rs create mode 100644 src/test_scan_rust/module_7.rs create mode 100644 src/test_scan_rust/module_8.rs create mode 100644 src/test_scan_rust/module_9.rs create mode 100644 src/test_scan_web/handler1.js create mode 100644 src/test_scan_web/handler10.js create mode 100644 src/test_scan_web/handler11.js create mode 100644 src/test_scan_web/handler12.js create mode 100644 src/test_scan_web/handler13.js create mode 100644 src/test_scan_web/handler14.js create mode 100644 src/test_scan_web/handler15.js create mode 100644 src/test_scan_web/handler16.js create mode 100644 src/test_scan_web/handler17.js create mode 100644 src/test_scan_web/handler18.js create mode 100644 src/test_scan_web/handler19.js create mode 100644 src/test_scan_web/handler2.js create mode 100644 src/test_scan_web/handler20.js create mode 100644 src/test_scan_web/handler21.js create mode 100644 src/test_scan_web/handler22.js create mode 100644 src/test_scan_web/handler23.js create mode 100644 src/test_scan_web/handler24.js create mode 100644 src/test_scan_web/handler25.js create mode 100644 src/test_scan_web/handler26.js create mode 100644 src/test_scan_web/handler27.js create mode 100644 src/test_scan_web/handler28.js create mode 100644 src/test_scan_web/handler29.js create mode 100644 src/test_scan_web/handler3.js create mode 100644 src/test_scan_web/handler30.js create mode 100644 src/test_scan_web/handler4.js create mode 100644 src/test_scan_web/handler5.js create mode 100644 src/test_scan_web/handler6.js create mode 100644 src/test_scan_web/handler7.js create mode 100644 src/test_scan_web/handler8.js create mode 100644 src/test_scan_web/handler9.js diff --git a/src/test_scan_android/Activity1.java b/src/test_scan_android/Activity1.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity1.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity10.java b/src/test_scan_android/Activity10.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity10.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity11.java b/src/test_scan_android/Activity11.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity11.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity12.java b/src/test_scan_android/Activity12.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity12.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity13.java b/src/test_scan_android/Activity13.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity13.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity14.java b/src/test_scan_android/Activity14.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity14.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity15.java b/src/test_scan_android/Activity15.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity15.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity16.java b/src/test_scan_android/Activity16.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity16.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity17.java b/src/test_scan_android/Activity17.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity17.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity18.java b/src/test_scan_android/Activity18.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity18.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity19.java b/src/test_scan_android/Activity19.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity19.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity2.java b/src/test_scan_android/Activity2.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity2.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity20.java b/src/test_scan_android/Activity20.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity20.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity21.java b/src/test_scan_android/Activity21.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity21.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity22.java b/src/test_scan_android/Activity22.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity22.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity23.java b/src/test_scan_android/Activity23.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity23.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity24.java b/src/test_scan_android/Activity24.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity24.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity25.java b/src/test_scan_android/Activity25.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity25.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity26.java b/src/test_scan_android/Activity26.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity26.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity27.java b/src/test_scan_android/Activity27.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity27.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity28.java b/src/test_scan_android/Activity28.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity28.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity29.java b/src/test_scan_android/Activity29.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity29.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity3.java b/src/test_scan_android/Activity3.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity3.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity30.java b/src/test_scan_android/Activity30.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity30.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity4.java b/src/test_scan_android/Activity4.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity4.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity5.java b/src/test_scan_android/Activity5.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity5.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity6.java b/src/test_scan_android/Activity6.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity6.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity7.java b/src/test_scan_android/Activity7.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity7.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity8.java b/src/test_scan_android/Activity8.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity8.java @@ -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); + } +} diff --git a/src/test_scan_android/Activity9.java b/src/test_scan_android/Activity9.java new file mode 100644 index 0000000..eda9524 --- /dev/null +++ b/src/test_scan_android/Activity9.java @@ -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); + } +} diff --git a/src/test_scan_rust/module_1.rs b/src/test_scan_rust/module_1.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_1.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_10.rs b/src/test_scan_rust/module_10.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_10.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_11.rs b/src/test_scan_rust/module_11.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_11.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_12.rs b/src/test_scan_rust/module_12.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_12.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_13.rs b/src/test_scan_rust/module_13.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_13.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_14.rs b/src/test_scan_rust/module_14.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_14.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_15.rs b/src/test_scan_rust/module_15.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_15.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_16.rs b/src/test_scan_rust/module_16.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_16.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_17.rs b/src/test_scan_rust/module_17.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_17.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_18.rs b/src/test_scan_rust/module_18.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_18.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_19.rs b/src/test_scan_rust/module_19.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_19.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_2.rs b/src/test_scan_rust/module_2.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_2.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_20.rs b/src/test_scan_rust/module_20.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_20.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_21.rs b/src/test_scan_rust/module_21.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_21.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_22.rs b/src/test_scan_rust/module_22.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_22.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_23.rs b/src/test_scan_rust/module_23.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_23.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_24.rs b/src/test_scan_rust/module_24.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_24.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_25.rs b/src/test_scan_rust/module_25.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_25.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_26.rs b/src/test_scan_rust/module_26.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_26.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_27.rs b/src/test_scan_rust/module_27.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_27.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_28.rs b/src/test_scan_rust/module_28.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_28.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_29.rs b/src/test_scan_rust/module_29.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_29.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_3.rs b/src/test_scan_rust/module_3.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_3.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_30.rs b/src/test_scan_rust/module_30.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_30.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_4.rs b/src/test_scan_rust/module_4.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_4.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_5.rs b/src/test_scan_rust/module_5.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_5.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_6.rs b/src/test_scan_rust/module_6.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_6.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_7.rs b/src/test_scan_rust/module_7.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_7.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_8.rs b/src/test_scan_rust/module_8.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_8.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_rust/module_9.rs b/src/test_scan_rust/module_9.rs new file mode 100644 index 0000000..d2d41ee --- /dev/null +++ b/src/test_scan_rust/module_9.rs @@ -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> { + 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 { + 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::connect(addr) +} + +fn parse_config(data: &str) -> HashMap { + 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")); + } +} diff --git a/src/test_scan_web/handler1.js b/src/test_scan_web/handler1.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler1.js @@ -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'); +}); diff --git a/src/test_scan_web/handler10.js b/src/test_scan_web/handler10.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler10.js @@ -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'); +}); diff --git a/src/test_scan_web/handler11.js b/src/test_scan_web/handler11.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler11.js @@ -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'); +}); diff --git a/src/test_scan_web/handler12.js b/src/test_scan_web/handler12.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler12.js @@ -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'); +}); diff --git a/src/test_scan_web/handler13.js b/src/test_scan_web/handler13.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler13.js @@ -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'); +}); diff --git a/src/test_scan_web/handler14.js b/src/test_scan_web/handler14.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler14.js @@ -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'); +}); diff --git a/src/test_scan_web/handler15.js b/src/test_scan_web/handler15.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler15.js @@ -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'); +}); diff --git a/src/test_scan_web/handler16.js b/src/test_scan_web/handler16.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler16.js @@ -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'); +}); diff --git a/src/test_scan_web/handler17.js b/src/test_scan_web/handler17.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler17.js @@ -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'); +}); diff --git a/src/test_scan_web/handler18.js b/src/test_scan_web/handler18.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler18.js @@ -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'); +}); diff --git a/src/test_scan_web/handler19.js b/src/test_scan_web/handler19.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler19.js @@ -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'); +}); diff --git a/src/test_scan_web/handler2.js b/src/test_scan_web/handler2.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler2.js @@ -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'); +}); diff --git a/src/test_scan_web/handler20.js b/src/test_scan_web/handler20.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler20.js @@ -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'); +}); diff --git a/src/test_scan_web/handler21.js b/src/test_scan_web/handler21.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler21.js @@ -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'); +}); diff --git a/src/test_scan_web/handler22.js b/src/test_scan_web/handler22.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler22.js @@ -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'); +}); diff --git a/src/test_scan_web/handler23.js b/src/test_scan_web/handler23.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler23.js @@ -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'); +}); diff --git a/src/test_scan_web/handler24.js b/src/test_scan_web/handler24.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler24.js @@ -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'); +}); diff --git a/src/test_scan_web/handler25.js b/src/test_scan_web/handler25.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler25.js @@ -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'); +}); diff --git a/src/test_scan_web/handler26.js b/src/test_scan_web/handler26.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler26.js @@ -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'); +}); diff --git a/src/test_scan_web/handler27.js b/src/test_scan_web/handler27.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler27.js @@ -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'); +}); diff --git a/src/test_scan_web/handler28.js b/src/test_scan_web/handler28.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler28.js @@ -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'); +}); diff --git a/src/test_scan_web/handler29.js b/src/test_scan_web/handler29.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler29.js @@ -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'); +}); diff --git a/src/test_scan_web/handler3.js b/src/test_scan_web/handler3.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler3.js @@ -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'); +}); diff --git a/src/test_scan_web/handler30.js b/src/test_scan_web/handler30.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler30.js @@ -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'); +}); diff --git a/src/test_scan_web/handler4.js b/src/test_scan_web/handler4.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler4.js @@ -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'); +}); diff --git a/src/test_scan_web/handler5.js b/src/test_scan_web/handler5.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler5.js @@ -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'); +}); diff --git a/src/test_scan_web/handler6.js b/src/test_scan_web/handler6.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler6.js @@ -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'); +}); diff --git a/src/test_scan_web/handler7.js b/src/test_scan_web/handler7.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler7.js @@ -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'); +}); diff --git a/src/test_scan_web/handler8.js b/src/test_scan_web/handler8.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler8.js @@ -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'); +}); diff --git a/src/test_scan_web/handler9.js b/src/test_scan_web/handler9.js new file mode 100644 index 0000000..eef7912 --- /dev/null +++ b/src/test_scan_web/handler9.js @@ -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'); +});