Sun Jan 7 16:40:48 UTC 2024

This commit is contained in:
Odweta
2024-01-07 16:40:48 +00:00
parent 8181fa15af
commit 5c7ec71442
9 changed files with 105 additions and 7 deletions
Regular → Executable
View File
+4 -5
View File
@@ -1,15 +1,14 @@
SHELL=/bin/bash
install:
python3 -m pip install -r requirements.txt
python -m pip install -r requirements.txt
./.config/mkdirs.sh
cp ./src/main.py /bin/solen
chmod 774 /bin/solen
chmod 774 /usr/bin/solen
sudo cp ./src/main.py /bin/solen
sudo chown $(USER) /bin/solen
cp ./src/lib/*.py $(HOME)/.local/lib/python3.11/site-packages/solenlib
sudo cp ./src/lib/*.py $(HOME)/.local/lib/python3.10/site-packages/solenlib
run:
./.config/launch.sh
+1 -1
View File
@@ -2,7 +2,7 @@
An enhanced version of the ŠkolaOnLine (ŠOL) online school system.
It aims to provide more readable data than the web version and remove some of the annoyances of the mobile app. It is intended to be an Android app in the future, but so far it is **only for Linux** (not tested anywhere else).
It aims to provide more readable data than the web version and remove some of the annoyances of the mobile app. It is intended to be and Android app in the future, but so far it is **only for Linux** (not tested anywhere else).
Insiration was taken from [@JakubAndrysek](https://github.com/JakubAndrysek)'s [skola-online-stahovani-znamek](https://github.com/JakubAndrysek/skola-online-stahovani-znamek) project.
BIN
View File
Binary file not shown.
+69
View File
@@ -0,0 +1,69 @@
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLEncoder;
public class App {
public static void main(String[] args) throws IOException {
URL url = new URL("http://127.0.0.1:8080/fetch.php");
HttpURLConnection client = null;
try {
client = (HttpURLConnection) url.openConnection();
// Additional headers
client.setRequestProperty("Connection", "close");
client.setUseCaches(false);
// Set the request method to POST
client.setRequestMethod("POST");
client.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
client.setDoOutput(true);
// Send the parameters in the request body
String urlParameters = "username=" + URLEncoder.encode("zlevorantonin", "UTF-8") +
"&password=" + URLEncoder.encode("Skolajenej!22", "UTF-8");
DataOutputStream wr = new DataOutputStream(client.getOutputStream());
wr.writeBytes(urlParameters);
wr.flush();
wr.close();
// Get the response code
int responseCode = client.getResponseCode();
//System.out.println("Response Code: " + responseCode);
// Read the response body
try (BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()))) {
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
// Print the response body
System.out.println(response.toString());
}
} catch (MalformedURLException error) {
// Handles an incorrectly entered URL
System.out.println("malformed URL");
} catch (SocketTimeoutException error) {
// Handles URL access timeout.
System.out.println("socket timeout");
} catch (IOException error) {
// Handles input and output errors
System.out.println("IO exception: " + error.getMessage());
error.printStackTrace();
} finally {
if (client != null) // Make sure the connection is not null.
client.disconnect();
}
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
//The url you wish to send the POST request to
$url = "http://localhost:8080/fetch.php";
//The data you want to send via POST
$fields = [
'username' => "x",
'password' => "y"
];
//url-ify the data for the POST
$fields_string = http_build_query($fields);
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//So that curl_exec returns the contents of the cURL; rather than echoing it
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
//execute post
$result = curl_exec($ch);
echo $result;
?>
+1 -1
View File
@@ -1,4 +1,4 @@
lxml
bs4
requests
cryptography
Regular → Executable
View File
+1
View File
@@ -230,6 +230,7 @@ def get_whitespace(password, username, strdata, key: str, idx=0) -> int:
except ValueError:
pass
print(max_len)
return max_len
def show_schedule(password, username, local=False):