forked from Rativel/BurritOS
test: add 90 test files for round 1 scan (30 rust + 30 java + 30 js)
This commit is contained in:
63
src/test_scan_android/Activity14.java
Normal file
63
src/test_scan_android/Activity14.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.test.scan.android;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class ActivityEXT extends Activity {
|
||||
private WebView webView;
|
||||
private Connection dbConnection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
}
|
||||
|
||||
public void loadUrl(String url) {
|
||||
webView.loadUrl(url);
|
||||
}
|
||||
|
||||
public void executeQuery(String query) throws SQLException {
|
||||
Statement stmt = dbConnection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
while (rs.next()) {
|
||||
String data = rs.getString("data");
|
||||
processResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void openFile(String path) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
processLine(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
public void sendRequest(String endpoint, String payload) throws IOException {
|
||||
URL url = new URL(endpoint);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
os.write(payload.getBytes());
|
||||
os.flush();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void processResult(String data) {
|
||||
System.out.println("Result: " + data);
|
||||
}
|
||||
|
||||
public void processLine(String line) {
|
||||
System.out.println("Line: " + line);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user