diff --git a/Aptfile b/Aptfile index f32119a..4213726 100644 --- a/Aptfile +++ b/Aptfile @@ -1,4 +1,4 @@ +git -y pv tree mediainfo -p7zip-full diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 317d5f7..0000000 --- a/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM xAbhish3k/waruserbot:slim-buster - -#clonning repo -RUN git clone https://github.com/xAbhish3k/waruserbot.git /root/userbot -#working directory -WORKDIR /root/userbot - -# Install requirements -RUN pip3 install -U -r requirements.txt - -ENV PATH="/home/userbot/bin:$PATH" - -CMD ["python3","-m","userbot"] diff --git a/README.md b/README.md index 97e96b4..f438c70 100644 --- a/README.md +++ b/README.md @@ -1,60 +1,62 @@ -
-
+
The owner would not be responsible for any kind of bans due to the bot.
+
+
+ `Telethon`
+
+ - Click On Generate String
+ - Then Click On Green Run Button.
+ - Wait for a while then fill the details.
+ - String will be saved in your Saved Message.
+
+
+
+
+
+
+
+
+
+ - Don't use a new Telegram ID (use an ID that is 7-8 months old).
+ - Don't use a fake number.
+ - Don't use a fake Gmail ID.
+
+ [Full Credit Hellbot] +
diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..034e848 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,21 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are +currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| 5.1.x | :white_check_mark: | +| 5.0.x | :x: | +| 4.0.x | :white_check_mark: | +| < 4.0 | :x: | + +## Reporting a Vulnerability + +Use this section to tell people how to report a vulnerability. + +Tell them where to go, how often they can expect to get an update on a +reported vulnerability, what to expect if the vulnerability is accepted or +declined, etc. diff --git a/app.json b/app.json index f0c83a0..a7a6f1e 100644 --- a/app.json +++ b/app.json @@ -1,86 +1,82 @@ { - "name": "Waruserbot", - "description": "A simple Telegram userbot based on Telethon . Maintained by Abhishek Singh", - "logo": "https://telegra.ph/file/4b0a3d49d8bf1e2e85fea.jpg", + "name": "WarUserBot", + "description": "One of the best Userbots for Telegram. Known for its Smoothness, Design, Support.", + "logo": "https://telegra.ph/file/5cadf9784f067a75dc51c.jpg", "keywords": [ + "telegram", + "userbot", "plugin", + "telethon", + "warbot", "modular", "productivity" ], - "repository": "https://github.com/xAbhish3k/waruserbot", - "website": "#TODO", - "success_url": "#TODO", + "repository": "https://github.com/xabhish3k/waruserbot/", "env": { - "ALIVE_NAME": { - "description": "give your name", - "value": "" + "ENV": { + "description": "Setting this to ANYTHING will enable Heroku.", + "value": "ANYTHING" + }, + "ABUSE": { + "description": "Leave it blank if you don't want Profanity in WarUserBot. Else Fill ON.", + "value": "OFF", + "required": false + }, + "HANDLER": { + "description": "Your command handler. Default is ' . ' (dot).", + "value": "." }, "APP_ID": { - "description": "Get this value from my.telegram.org! Please do not steal", + "description": "Get this value from my.telegram.org", "value": "" }, "API_HASH": { - "description": "Get this value from my.telegram.org! Please do not steal", + "description": "Get this value from my.telegram.org", "value": "" }, "STRING_SESSION": { - "description": "Get this value by running python3 telesetup.py locally or https://generatestringsession.xabhish3k.repl.run", + "description": "Get this value by using repl or Termux. Refer to the Repo for more info.", "value": "" }, - "TG_BOT_TOKEN": { - "description": "Needed for inline buttons maker. Make a bot at http://telegram.dog/BotFather and get the token of your bot.Worth it. Get it.", + "HEROKU_API_KEY": { + "description": "Go to https://dashboard.heroku.com/account, scroll down, and press Reveal API. Required for the updater to work.", "value": "" }, - "COMMAND_HAND_LER": { - "description": "Set this one with only one the symbol to use it before your command to run like . , ' `", - "value": ".", - "required": false + "HEROKU_APP_NAME": { + "description": "The Value of App Name you filled in right on top. Required for the updater to work.", + "value": "" }, - "ENV": { - "description": "Setting this to ANYTHING will enable heroku.", - "value": "ANYTHING", - "required": false + "BOT_TOKEN": { + "description": "Make a bot from @BotFather and paste the bot token here.", + "value": "" + } + }, + "addons": [ + { + "plan": "heroku-postgresql", + "options": { + "version": "12" + } + } + ], + "buildpacks": [ + { + "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest" }, - "HEROKU_API_KEY": { - "description": "Required for updating the bot and other stuff get it from https://dashboard.heroku.com/account", - "value": "", - "required": false + { + "url": "https://github.com/heroku/heroku-buildpack-google-chrome" }, - "HEROKU_APP_NAME": { - "description": "YOUR app name ", - "value": "", - "required": false + { + "url": "https://github.com/heroku/heroku-buildpack-chromedriver" }, - "TZ": { - "description": "Required for Correct Time on autopic/get time. Know your timezone from http://www.timezoneconverter.com/cgi-bin/findzone.tzc", - "value": "Asia/Kolkata", - "required": false + { + "url": "https://github.com/heroku/heroku-buildpack-apt.git" }, - "UPSTREAM_REPO": { - "description": "Don't change", - "value": "https://Github.com/xAbhish3k/Waruserbot", - "required": false - } - }, - "addons": [{ - "plan": "heroku-postgresql", - "options": { - "version": "12" + { + "url": "https://github.com/chrismytton/heroku-buildpack-jq" + }, + { + "url": "heroku/python" } - }], - "buildpacks": [{ - "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest" - },{ - "url":"https://github.com/heroku/heroku-buildpack-google-chrome" - },{ - "url":"https://github.com/heroku/heroku-buildpack-chromedriver" - },{ - "url": "https://github.com/opendoor-labs/heroku-buildpack-p7zip" - },{ - "url": "https://github.com/heroku/heroku-buildpack-apt.git" - },{ - "url": "https://github.com/chrismytton/heroku-buildpack-jq" - },{ - "url": "heroku/python" - }] + ] } diff --git a/hell_string.py b/hell_string.py new file mode 100644 index 0000000..5080ae2 --- /dev/null +++ b/hell_string.py @@ -0,0 +1,86 @@ +from random import randint + +from instagrapi import Client as IClient +from instagrapi.exceptions import ChallengeRequired, TwoFactorRequired +from pyrogram import Client as PClient +from telethon.sessions import StringSession +from telethon.sync import TelegramClient + + +def main(): + print("T E A M W A R B O T ! !") + print("Hello!! Welcome to WaruserBot Session Generator\n") + print("Human Verification Required !!") + while True: + verify = int(randint(1, 50)) + okvai = int(input(f"Enter {verify} to continue: ")) + if okvai == verify: + print("\nChoose the string session type: \n1. WaruserBot (Telethon) \n2. Music Bot (Pyrogram) \n3. Instagram Session") + while True: + library = input("\nYour Choice: ") + if library == "1": + generate_telethon_session() + break + elif library == "2": + generate_pyro_session() + break + elif library == "3": + generate_insta_session() + break + else: + print("Please enter integer values (1/2/3 only).") + break + else: + print("Verification Failed! Try Again:") + + +def generate_pyro_session(): + print("Pyrogram Session for Music Bot!") + APP_ID = int(input("\nEnter APP ID here: ")) + API_HASH = input("\nEnter API HASH here: ") + with PClient(':memory:', api_id=APP_ID, api_hash=API_HASH) as hellbot: + print("\nYour WaruserBot Session Is sent in your Telegram Saved Messages.") + hellbot.send_message( + "me", + f"#WarUserBOT_MUSIC #WARUSERBOT_SESSION #PYROGRAM\n\n`{hellbot.export_session_string()}`", + ) + + +def generate_telethon_session(): + print("\nTelethon Session For WarUserBot!") + APP_ID = int(input("\nEnter APP ID here: ")) + API_HASH = input("\nEnter API HASH here: ") + with TelegramClient(StringSession(), APP_ID, API_HASH) as hellbot: + print("\nYour WarUserBot Session Is sent in your Telegram Saved Messages.") + hellbot.send_message( + "me", + f"#WARUSERBOT #WARBOT_SESSION #TELETHON \n\n`{hellbot.session.save()}`", + ) + + +def generate_insta_session(): + print("Instagram Session For WARBot!") + cl = IClient() + username = input("Enter your Instagram Username: ") + password = input("Enter your Instagram Password: ") + try: + cl.login(username, password) + xyz = cl.get_settings() + sessionid = xyz['authorization_data']['sessionid'] + print(f"Your Instagram Session is: \n>>> {sessionid}") + print("\nCopy it from here and remember not to share it with anyone!") + except (ChallengeRequired, TwoFactorRequired, Exception) as e: + print(e) + + +def challenge_code(username, choice): + while True: + otp = input("Enter the OTP sent to your Email: ") + if otp.isdigit(): + break + else: + print("Enter digits only!") + return otp + + +main() diff --git a/heroku.yml b/heroku.yml deleted file mode 100644 index 11ed7a9..0000000 --- a/heroku.yml +++ /dev/null @@ -1,5 +0,0 @@ -build: - docker: - worker: Dockerfile -run: - worker: python3 -m userbot diff --git a/logging.conf b/logging.conf new file mode 100644 index 0000000..eba9050 --- /dev/null +++ b/logging.conf @@ -0,0 +1,32 @@ +[loggers] +keys=root + +[handlers] +keys=consoleHandler,fileHandler + +[formatters] +keys=consoleFormatter,fileFormatter + +[logger_root] +level=DEBUG +handlers=consoleHandler,fileHandler + +[handler_consoleHandler] +class=StreamHandler +level=INFO +formatter=consoleFormatter +args=(sys.stdout,) + +[handler_fileHandler] +class=FileHandler +level=ERROR +formatter=fileFormatter +args=('TelegramBot.log','w',) + +[formatter_consoleFormatter] +format=%(asctime)s - %(lineno)d - %(name)s - %(module)s - %(levelname)s - %(message)s +datefmt=%I:%M:%S %p + +[formatter_fileFormatter] +format=[%(asctime)s:%(name)s:%(lineno)d:%(levelname)s] %(message)s +datefmt=%m/%d/%Y %I:%M:%S %p diff --git a/render.yaml b/render.yaml new file mode 100644 index 0000000..942ec39 --- /dev/null +++ b/render.yaml @@ -0,0 +1,28 @@ +services: + - type: web + plan: free + name: WarBot + env: python + buildCommand: pip install -U -r requirements.txt + startCommand: python server.py & bash warbot + repo: https://github.com/MeAbhish3k/waruserbot + branch: master + envVars: + - key: ABUSE + sync: false + - key: APP_ID + sync: false + - key: API_HASH + sync: false + - key: BOT_TOKEN + sync: false + - key: ENV + value: ANYTHING + - key: STRING_SESSION + sync: false + - key: DATABASE_URL + sync: false + - key: PYTHON_VERSION + value: 3.10.6 + + autoDeploy: false diff --git a/requirements.txt b/requirements.txt index 655832f..b65ae5a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,74 +1,53 @@ -aiofiles aiohttp -apscheduler cairosvg -cloudscraper -colour -covid -cowpy -dataclasses DateTime emoji -fake_useragent -fonttools geopy gitpython +flask +flask_restful glitch_this google-api-python-client google-auth-httplib2 google-auth-oauthlib -googletrans==4.0.0-rc1 +gsearch gtts hachoir heroku3 html-telegraph-poster +httpx[http2] humanize IMDbPY -jikanpy +instagrapi justwatch lottie lyricsgenius -markdown -motor moviepy nekos.py opencv-python-headless Pillow -prettytable -psutil psycopg2 pyfiglet PyGithub -pygments -pylast pymediainfo -PyMuPDF pySmartDL python-barcode -python-dotenv pytz qrcode -randomstuff.py regex requests search-engine-parser selenium -setuptools==47.1.1 -ShazamAPI -spamwatch -speedtest-cli -sqlalchemy-json +spotdl sqlalchemy==1.3.23 telegraph -git+https://github.com/sandy1709/Telethon +telethon==1.24.0 tgcrypto -tswift -ujson -urlextract validators -vcsi -wand -wget -git+https://github.com/goldsmith/Wikipedia -youtube-search-python -youtube_dl +vcam +speedtest-cli + +git+https://github.com/xAbhish3k/py-googletrans@master +git+https://github.com/xAbhish3k/Wikipedia@master +git+https://github.com/xAbhish3k/yt-search-python@master + diff --git a/runtime.txt b/runtime.txt index 9bff0e0..7a33c42 100644 --- a/runtime.txt +++ b/runtime.txt @@ -1 +1 @@ -python-3.9.6 +python-3.10.6 diff --git a/server.py b/server.py new file mode 100644 index 0000000..4ba6a53 --- /dev/null +++ b/server.py @@ -0,0 +1,13 @@ +import os +from flask import Flask +from flask_restful import Resource, Api + +app = Flask(name) +api = Api(app) + +class Greeting (Resource): + def get(self): + return "WarBot is running !" + +api.add_resource(Greeting, '/') +app.run(host="0.0.0.0", port=os.environ.get("PORT", 8080)) diff --git a/setup/__init__.py b/setup/__init__.py deleted file mode 100644 index 8b13789..0000000 --- a/setup/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/stringsetup.py b/stringsetup.py deleted file mode 100644 index 11c6a8a..0000000 --- a/stringsetup.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python3 -# (c) https://t.me/TelethonChat/37677 -# This Source Code Form is subject to the terms of the GNU -# General Public License, v.3.0. If a copy of the GPL was not distributed with this -# file, You can obtain one at https://www.gnu.org/licenses/gpl-3.0.en.html. - -from telethon.sessions import StringSession -from telethon.sync import TelegramClient - -print( - """Please go-to my.telegram.org -Login using your Telegram account -Click on API Development Tools -Create a new application, by entering the required details""" -) -APP_ID = int(input("Enter APP ID here: ")) -API_HASH = input("Enter API HASH here: ") - -with TelegramClient(StringSession(), APP_ID, API_HASH) as client: - print(client.session.save()) - client.send_message("me", client.session.save()) diff --git a/setup/updater.py b/updater.py similarity index 57% rename from setup/updater.py rename to updater.py index d653d01..0807f6f 100644 --- a/setup/updater.py +++ b/updater.py @@ -1,20 +1,17 @@ import asyncio import difflib import shlex -from typing import Tuple import sys +from typing import Tuple -# if any requirements are cahnged then install that requirement -async def lines_differnce(file1, file2): +async def lines_difference(file1, file2): with open(file1) as f1: lines1 = f1.readlines() lines1 = [line.rstrip("\n") for line in lines1] with open(file2) as f2: lines2 = f2.readlines() lines2 = [line.rstrip("\n") for line in lines2] - diff = difflib.unified_diff( - lines1, lines2, fromfile=file1, tofile=file2, lineterm="", n=0 - ) + diff = difflib.unified_diff(lines1, lines2, fromfile=file1, tofile=file2, lineterm="", n=0) lines = list(diff)[2:] added = [line[1:] for line in lines if line[0] == "+"] removed = [line[1:] for line in lines if line[0] == "-"] @@ -22,8 +19,7 @@ async def lines_differnce(file1, file2): removedt = [i for i in removed if i not in added] return additions, removedt - -async def runcmd(cmd: str) -> Tuple[str, str, int, int]: +async def run_command(cmd: str) -> Tuple[str, str, int, int]: args = shlex.split(cmd) process = await asyncio.create_subprocess_exec( *args, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE @@ -36,17 +32,18 @@ async def runcmd(cmd: str) -> Tuple[str, str, int, int]: process.pid, ) - -async def update_requirements(main , test): - a, r = await lines_differnce(main, test) +async def update_requirements(main, test): + additions, removed = await lines_difference(main, test) try: - for i in a: - await runcmd(f"pip install {i}") - print(f"Succesfully installed {i}") + for requirement in additions: + await run_command(f"pip install {requirement}") + print(f">> Installed Requirement: {requirement}") except Exception as e: - print(f"Error while installing requirments {str(e)}") - + print(f"Error installing requirements: {str(e)}") -loop = asyncio.get_event_loop() -loop.run_until_complete(update_requirements(sys.argv[1] , sys.argv[2])) -loop.close() +if __name__ == "__main__": + if len(sys.argv) != 3: + print("Usage: python script.py