Project EGE is aimed at finding test variants created by teachers immediately after their creation.
- Ensure you have Python 3.12 or higher installed.
- Clone the project repository using the following command:
git clone https://github.com/zv3zdochka/Cheat_Ege.git
- Navigate to the project directory:
cd Cheat_Ege
- Install the necessary dependencies using the
requirements.txt
file:pip install -r requirements.txt
-
Local_Search_async.py: This file contains asynchronous versions of functions for searching test variants created by teachers. It is intended for running on local machines.
-
Bot.py: This file contains the code for the bot components of the project.
-
Search.py: This is an optimized server version of a bot designed for educational purposes. It is specifically tailored to monitor web pages for certain content and notify users accordingly.
-
Local_Search.py: This file contains functions for searching test variants created by teachers. It supports two search modes: bottom-up and top-down. You can use the functions to search for the test variants on your pc.
-
If you want to run the bot locally, you likely need to use either
Local_Search.py
orLocal_Search_async.py
. Choose the appropriate script based on your requirements and run it using Python. -
If you want to run Search.py on Yandex cloud virtual machine visit VM.md.
-
Requirements Installation:
Make sure you have Python installed. Then, install the required libraries using pip:
pip install -r requirements.txt
-
Execution:
Run the script using Python:
python Search.py
Make sure you're in the directory where
Search.py
is located. -
Docker:
Alternatively, you can run the bot using Docker. Ensure you have Docker installed and the Docker daemon is running. Then, build the Docker image:
docker build -t search-bot .
Once the image is built, you can run a container from it:
docker run -d --name search-bot-container search-bot
This will run the bot in a Docker container named
search-bot-container
.
- The code is optimized for performance, utilizing asynchronous programming with asyncio to handle multiple tasks concurrently.
- It employs aiohttp for asynchronous HTTP requests, which improves efficiency when fetching web pages.
- The code is designed to minimize downtime and maximize responsiveness, ensuring timely updates and notifications.
/allow <user_id>
: Authorize a user to access the bot./deny <user_id>
: Deny authorization for a user./help
: Display help information./admin <user_id>
: Upgrade a user to admin status./text <message>
: Send a message to all users./textto <user_id> <message>
: Send a message to a specific user./users
: Get a list of authorized users./all
: Get a list of all users./banned
: Get a list of banned users./save
: Save bot data to files./ban <user_id>
: Ban a user from accessing the bot./free <user_id>
: Release a user from ban./delete <user_id>
: Delete a user from the bot's records.
-
Edit the variables
targets
,subject_name
,start
, andend
according to your needs:targets
: List of target texts to search for on web pages.subject_name
: The name of the EGE subject for which you want to perform the search. Possible values:'math'
,'mathb'
,'phys'
,'inf'
,'rus'
,'bio'
,'en'
,'chem'
,'geo'
,'soc'
,'de'
,'fr'
,'lit'
,'sp'
,'hist'
.start
: The starting page ID from which the search will begin.end
: The ending page ID on which the search will end.
-
Run the script. Depending on your needs, uncomment one of the functions in the
if __name__ == "__main__":
block:search_from_current_for_first()
: View all options from just created to the very first one.search_from_current_to_end(end)
: View all options from just created to the end.search_from_to(start, end)
: View all options from start to end.search_from_to_last(start)
: View all options from start to just created.
-
Upon completion of the script execution, the execution time will be displayed, and the code will exit with code
1
.
- Make sure you have access to the sdamgia.ru website, you have to use russian ip.
- Before using, ensure that your IP is not being blocked on the sdamgia.ru website.
- Create a JSON file (
data.json
) containing the information about the subjects you want to search. The JSON file should have the following format:
{
"subject_name1": [["target","target"], 123],
"subject_name2": [["target","target"], 234]
}
Replace "subject_name"
with the name of the EGE subject, "targets"
with a list of target texts to search for on web pages, and "start_id"
with the starting page ID from which the search will begin.
- Run the script with the following command:
python Local_Search_async.py data.json
Ensure that you pass the correct filename (data.json
) as an argument.
-
The script will continuously search for the specified targets on the web pages asynchronously. When targets are found, they will be logged in the
found.txt
file along with the subject name and the current time. -
The script will update the JSON file with the latest information about the last processed page ID for each subject.
-
The script adjusts its sleep time dynamically based on the time taken for each cycle. If a cycle completes too quickly, the sleep time increases slightly, and if it takes too long, the sleep time decreases slightly to optimize performance.
- Ensure that the JSON file (
data.json
) exists and contains the required information in the correct format. - Make sure you have access to the sdamgia.ru website, you have to use russian ip.
- Before using, ensure that your IP is not being blocked on the sdamgia.ru website.
This file is a Telegram bot script designed to manage user authorization and interactions. It includes features such as authorization requests, user banning, message broadcasting, and more.
-
Token: Replace the
TOKEN
variable with your Telegram bot token obtained from BotFather. -
Admin Authorization: Replace
creator
variable value with your Telegram user id. This user will have admin privileges. -
Running the Bot: Run the script to start the bot.
- When a user sends a message to the bot, they will be prompted for authorization.
- Admins can authorize users using the
/allow
command followed by the user's ID. - Admins can deny authorization using the
/deny
command followed by the user's ID.
/help
: Displays help message./admin <user_id>
: Grants admin privileges to the specified user ID./text <message>
: Sends the specified message to all users./textto <user_id> <message>
: Sends the specified message to a specific user./users
: Displays a list of authorized users./all
: Displays a dictionary of user IDs and their corresponding usernames./banned
: Displays a list of banned users./save
: Sends the bot's data files to the invoking admin./ban <user_id>
: Bans the specified user./free <user_id>
: Unbans the specified user./delete <user_id>
: Deletes the specified user from the list of authorized users.
- The bot periodically sends random messages to all authorized users.
- User authorization data is stored in
users.json
. - Logs are stored in
log.txt
. - Messages sent by the bot are logged in
found.txt
.
- Ensure that the bot is authorized to interact with users and has the necessary permissions.
- Use admin commands with caution, especially commands that grant admin privileges or ban users.