Spaces:
Running
Running
Upload main.py
Browse files
main.py
CHANGED
@@ -47,7 +47,7 @@ from typing_extensions import Annotated
|
|
47 |
from typing import Annotated, Union
|
48 |
from typing import Optional, List, Dict, Any
|
49 |
|
50 |
-
from pydantic import BaseModel
|
51 |
from base64 import b64decode as kc
|
52 |
from base64 import b64decode
|
53 |
from random import choice
|
@@ -59,6 +59,7 @@ from serpapi import GoogleSearch
|
|
59 |
|
60 |
from fastapi import FastAPI, UploadFile, File, Response, Request
|
61 |
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
|
|
62 |
from fastapi import Depends, HTTPException, status
|
63 |
from fastapi.openapi.utils import get_openapi
|
64 |
from fastapi.responses import StreamingResponse, JSONResponse, FileResponse
|
@@ -67,6 +68,11 @@ from fastapi import Request, Header
|
|
67 |
from fastapi import Body, Query
|
68 |
from fastapi.staticfiles import StaticFiles
|
69 |
from fastapi.templating import Jinja2Templates
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
from starlette.responses import RedirectResponse
|
72 |
from starlette.staticfiles import StaticFiles
|
@@ -139,9 +145,9 @@ COOKIE_BARD_TOKEN = os.environ["COOKIE_BARD_TOKEN"]
|
|
139 |
MONITOR_API_KEYS = os.environ["MONITOR_API_KEYS"]
|
140 |
PICSART_API_KEY = os.environ["PICSART_API_KEY"]
|
141 |
|
142 |
-
|
143 |
-
db =
|
144 |
-
collection = db[
|
145 |
|
146 |
trans = SyncTranslator()
|
147 |
|
@@ -191,8 +197,8 @@ class FedBans(BaseModel):
|
|
191 |
class GetsaFedBans(BaseModel):
|
192 |
user_id: int
|
193 |
|
194 |
-
def get_all_api_keys():
|
195 |
-
user = collection.find({})
|
196 |
api_keys = []
|
197 |
for x in user:
|
198 |
api_key = x.get("ryuzaki_api_key")
|
@@ -200,8 +206,8 @@ def get_all_api_keys():
|
|
200 |
api_keys.append(api_key)
|
201 |
return api_keys
|
202 |
|
203 |
-
def get_all_fedbans_api_keys():
|
204 |
-
user = collection.find({})
|
205 |
api_keys = []
|
206 |
for x in user:
|
207 |
api_key = x.get("fedbans_api_key")
|
@@ -209,8 +215,8 @@ def get_all_fedbans_api_keys():
|
|
209 |
api_keys.append(api_key)
|
210 |
return api_keys
|
211 |
|
212 |
-
def validate_api_key(api_key: str = Header(...)):
|
213 |
-
USERS_API_KEYS = get_all_api_keys()
|
214 |
if api_key not in USERS_API_KEYS:
|
215 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
216 |
|
@@ -218,8 +224,8 @@ def validate_api_key_only_devs(api_key: str = Header(...)):
|
|
218 |
if api_key not in ONLY_DEVELOPER_API_KEYS:
|
219 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
220 |
|
221 |
-
def validate_api_key_fedbans(api_key: str = Header(...)):
|
222 |
-
USERS_API_KEYS = get_all_fedbans_api_keys()
|
223 |
if api_key not in USERS_API_KEYS:
|
224 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
225 |
|
@@ -227,6 +233,50 @@ def secs_to_mins(secs: int) -> str:
|
|
227 |
mins, secs = divmod(secs, 60)
|
228 |
return f"{mins}:{secs}"
|
229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
@app.get("/akeno/youtube-search", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
231 |
async def youtube_search(payload: YouTubeSearch):
|
232 |
try:
|
@@ -573,7 +623,7 @@ async def pinterestv2(query: str):
|
|
573 |
)
|
574 |
|
575 |
@app.get("/akeno/pornpics", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
576 |
-
async def pornpics(query: str):
|
577 |
try:
|
578 |
response = await search_porn_images(query)
|
579 |
return SuccessResponse(
|
@@ -587,7 +637,7 @@ async def pornpics(query: str):
|
|
587 |
)
|
588 |
|
589 |
@app.get("/akeno/pornowhite", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
590 |
-
async def pornowhite_(query: str):
|
591 |
try:
|
592 |
response = search_pornwhite_videos(query)
|
593 |
return SuccessResponse(
|
@@ -615,7 +665,7 @@ async def happymods_(q: str):
|
|
615 |
)
|
616 |
|
617 |
@app.get("/akeno/hentai", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
618 |
-
async def hentai_():
|
619 |
try:
|
620 |
response = await HentaiAnime()
|
621 |
return SuccessResponse(
|
@@ -725,7 +775,7 @@ async def tiktokdl_(link: str):
|
|
725 |
)
|
726 |
|
727 |
@app.get("/akeno/xnxxsearch", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
728 |
-
async def xnxx_search(query: str, quality: str):
|
729 |
data_dict = {
|
730 |
"720p": search_filters.SearchingQuality.X_720p,
|
731 |
"1080p": search_filters.SearchingQuality.X_1080p_plus
|
@@ -771,7 +821,7 @@ async def xnxx_search(query: str, quality: str):
|
|
771 |
|
772 |
|
773 |
@app.get("/akeno/xnxx-dl", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
774 |
-
async def xnxx_download(link: str):
|
775 |
try:
|
776 |
x = xnxx_client()
|
777 |
response = x.get_video(link)
|
@@ -852,7 +902,7 @@ RAMDOM_STATUS = [
|
|
852 |
"spammer",
|
853 |
]
|
854 |
|
855 |
-
def remove_sibyl_system_banned(user_id):
|
856 |
update_doc = {
|
857 |
"sibyl_ban": None,
|
858 |
"reason_sibyl": None,
|
@@ -860,9 +910,9 @@ def remove_sibyl_system_banned(user_id):
|
|
860 |
"date_joined_sib": None,
|
861 |
"sibyl_userid": None
|
862 |
}
|
863 |
-
return collection.update_one({"user_id": user_id}, {"$unset": update_doc}, upsert=True)
|
864 |
|
865 |
-
def new_user_spammers(
|
866 |
user_id,
|
867 |
hashtag,
|
868 |
reason,
|
@@ -876,9 +926,9 @@ def new_user_spammers(
|
|
876 |
"date_joined": date_joined,
|
877 |
"is_banned": is_banned
|
878 |
}
|
879 |
-
return collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
|
880 |
|
881 |
-
def new_sibyl_system_banned(user_id, name, reason, date_joined):
|
882 |
update_doc = {
|
883 |
"sibyl_ban": name,
|
884 |
"reason_sibyl": reason,
|
@@ -886,14 +936,14 @@ def new_sibyl_system_banned(user_id, name, reason, date_joined):
|
|
886 |
"date_joined_sib": date_joined,
|
887 |
"sibyl_userid": user_id
|
888 |
}
|
889 |
-
return collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
|
890 |
|
891 |
-
def cybersecuritydb(user_id, mongo_url):
|
892 |
update_doc = {"mongodb": mongo_url}
|
893 |
-
return collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
|
894 |
|
895 |
-
def get_sibyl_system_banned(user_id):
|
896 |
-
user = collection.find_one({"user_id": user_id})
|
897 |
if user:
|
898 |
sibyl_name = user.get("sibyl_ban")
|
899 |
reason = user.get("reason_sibyl")
|
@@ -904,8 +954,8 @@ def get_sibyl_system_banned(user_id):
|
|
904 |
else:
|
905 |
return None
|
906 |
|
907 |
-
def get_fedbans_(user_id):
|
908 |
-
user = collection.find_one({"user_id": user_id})
|
909 |
if user:
|
910 |
user_id = user.get("user_id")
|
911 |
hashtag = user.get("hashtag")
|
@@ -922,10 +972,10 @@ def get_fedbans_(user_id):
|
|
922 |
else:
|
923 |
return None
|
924 |
|
925 |
-
def get_all_banned():
|
926 |
banned_users = []
|
927 |
|
928 |
-
users = collection.find({})
|
929 |
|
930 |
for user_id in users:
|
931 |
reason = user_id.get("reason_sibyl")
|
@@ -933,7 +983,7 @@ def get_all_banned():
|
|
933 |
banned_users.append({"user_id": user_id, "reason": reason})
|
934 |
return banned_users
|
935 |
|
936 |
-
def new_profile_clone(
|
937 |
user_id,
|
938 |
first_name,
|
939 |
last_name=None,
|
@@ -946,10 +996,10 @@ def new_profile_clone(
|
|
946 |
"profile_id": profile_id,
|
947 |
"bio": bio
|
948 |
}
|
949 |
-
collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
|
950 |
|
951 |
-
def get_profile_clone(user_id):
|
952 |
-
user = collection.find_one({"user_id": user_id})
|
953 |
if user:
|
954 |
first_name = user.get("first_name")
|
955 |
last_name = user.get("last_name")
|
@@ -959,7 +1009,7 @@ def get_profile_clone(user_id):
|
|
959 |
else:
|
960 |
return None
|
961 |
|
962 |
-
def new_verify_otp(
|
963 |
user_id,
|
964 |
otp_code,
|
965 |
ip_addres,
|
@@ -971,11 +1021,10 @@ def new_verify_otp(
|
|
971 |
"ip_addres": ip_addres,
|
972 |
"auth_status": auth_status,
|
973 |
}
|
974 |
-
collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
|
975 |
|
976 |
-
|
977 |
-
|
978 |
-
user = collection.find_one({"user_id": user_id})
|
979 |
if user and "otp_code" in user:
|
980 |
return user["otp_code"]
|
981 |
return None
|
@@ -990,10 +1039,10 @@ class OTPCallbackPayload(BaseModel):
|
|
990 |
user_id: int
|
991 |
|
992 |
@app.get("/api/get-verify", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
993 |
-
def get_verify_otp(user_id: int, request: Request):
|
994 |
try:
|
995 |
client_host = request.client.host
|
996 |
-
get_otp_code = get_stored_otp(user_id)
|
997 |
if get_otp_code:
|
998 |
return SuccessResponse(
|
999 |
status="True",
|
@@ -1019,11 +1068,11 @@ def get_verify_otp(user_id: int, request: Request):
|
|
1019 |
)
|
1020 |
|
1021 |
@app.post("/api/verify", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1022 |
-
def verify_otp(payload: OTPCallbackPayload, request: Request):
|
1023 |
try:
|
1024 |
client_host = request.client.host
|
1025 |
otp = generate_otp()
|
1026 |
-
new_verify_otp(
|
1027 |
payload.user_id,
|
1028 |
otp,
|
1029 |
ip_addres=client_host,
|
@@ -1050,12 +1099,12 @@ def verify_otp(payload: OTPCallbackPayload, request: Request):
|
|
1050 |
)
|
1051 |
|
1052 |
@app.post("/ryuzaki/profile-clone", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1053 |
-
def profile_clone(
|
1054 |
item: ProfileClone,
|
1055 |
api_key: None = Depends(validate_api_key)
|
1056 |
):
|
1057 |
try:
|
1058 |
-
new_profile_clone(
|
1059 |
user_id=item.user_id,
|
1060 |
first_name=item.first_name,
|
1061 |
last_name=item.last_name,
|
@@ -1076,12 +1125,12 @@ def profile_clone(
|
|
1076 |
return SuccessResponse(status="False", randydev={"message": "Internal server error."})
|
1077 |
|
1078 |
@app.get("/ryuzaki/get-profile-clone", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1079 |
-
def get_profile_(
|
1080 |
item: GetProfileClone,
|
1081 |
api_key: None = Depends(validate_api_key)
|
1082 |
):
|
1083 |
try:
|
1084 |
-
response = get_profile_clone(item.user_id)
|
1085 |
if response[0]:
|
1086 |
return SuccessResponse(
|
1087 |
status="True",
|
@@ -1102,8 +1151,8 @@ def get_profile_(
|
|
1102 |
return SuccessResponse(status="False", randydev={"message": "Internal server error."})
|
1103 |
|
1104 |
@app.get("/ryuzaki/getbanlist")
|
1105 |
-
def sibyl_get_all_banlist():
|
1106 |
-
banned_users = get_all_banned()
|
1107 |
return {
|
1108 |
"status": "True",
|
1109 |
"randydev": {
|
@@ -1121,15 +1170,15 @@ def blacklist_words():
|
|
1121 |
return {"status": "false", "message": f"Internal server error: {str(e)}"}
|
1122 |
|
1123 |
@app.delete("/ryuzaki/sibyldel", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1124 |
-
def sibyl_system_delete(
|
1125 |
item: SibylSystemDel,
|
1126 |
api_key: None = Depends(validate_api_key_only_devs)
|
1127 |
):
|
1128 |
try:
|
1129 |
-
_, _, _, _, sibyl_user_id = get_sibyl_system_banned(item.user_id)
|
1130 |
|
1131 |
if sibyl_user_id:
|
1132 |
-
remove_sibyl_system_banned(item.user_id)
|
1133 |
return SuccessResponse(
|
1134 |
status="True",
|
1135 |
randydev={"message": f"Successfully removed {item.user_id} from the Sibyl ban list"}
|
@@ -1143,8 +1192,8 @@ def sibyl_system_delete(
|
|
1143 |
return SuccessResponse(status="False", randydev={"message": "Internal server error."})
|
1144 |
|
1145 |
@app.get("/user/get-fedban", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1146 |
-
def getfedbans_(payload: GetsaFedBans, api_key: str = Depends(validate_api_key_fedbans)):
|
1147 |
-
users_bans = get_fedbans_(payload.user_id)
|
1148 |
try:
|
1149 |
if users_bans[3] == True:
|
1150 |
return SuccessResponse(
|
@@ -1180,7 +1229,7 @@ def getfedbans_(payload: GetsaFedBans, api_key: str = Depends(validate_api_key_f
|
|
1180 |
)
|
1181 |
|
1182 |
@app.post("/user/fedban", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1183 |
-
def fedbans_(payload: FedBans, api_key: str = Depends(validate_api_key_fedbans)):
|
1184 |
if payload.user_id == 1191668125:
|
1185 |
return SuccessResponse(status="False", randydev={"message": "Only Developer."})
|
1186 |
|
@@ -1188,7 +1237,7 @@ def fedbans_(payload: FedBans, api_key: str = Depends(validate_api_key_fedbans))
|
|
1188 |
if not payload.hashtag.startswith("#"):
|
1189 |
return SuccessResponse(status="False", randydev={"message": "Invalid hashtag."})
|
1190 |
try:
|
1191 |
-
new_user_spammers(
|
1192 |
user_id=payload.user_id,
|
1193 |
hashtag=payload.hashtag,
|
1194 |
reason=payload.reason,
|
@@ -1220,9 +1269,8 @@ def fedbans_(payload: FedBans, api_key: str = Depends(validate_api_key_fedbans))
|
|
1220 |
}
|
1221 |
)
|
1222 |
|
1223 |
-
|
1224 |
@app.post("/ryuzaki/sibylban", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1225 |
-
def sibyl_system_ban(
|
1226 |
item: SibylSystemBan,
|
1227 |
api_key: None = Depends(validate_api_key)
|
1228 |
):
|
@@ -1232,11 +1280,11 @@ def sibyl_system_ban(
|
|
1232 |
try:
|
1233 |
date_joined = str(dt.now())
|
1234 |
sibyl_ban = random.choice(RAMDOM_STATUS)
|
1235 |
-
_, _, is_banned, _, sibyl_user_id = get_sibyl_system_banned(item.user_id)
|
1236 |
|
1237 |
if sibyl_user_id is not None and is_banned:
|
1238 |
return SuccessResponse(status="False", randydev={"message": "User is already banned."})
|
1239 |
-
new_sibyl_system_banned(item.user_id, sibyl_ban, item.reason, date_joined)
|
1240 |
return SuccessResponse(
|
1241 |
status="True",
|
1242 |
randydev={
|
@@ -1251,11 +1299,11 @@ def sibyl_system_ban(
|
|
1251 |
return SuccessResponse(status="False", randydev={"message": "Internal server error."})
|
1252 |
|
1253 |
@app.get("/ryuzaki/sibyl", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1254 |
-
def sibyl_system(
|
1255 |
item: SibylSystem,
|
1256 |
api_key: None = Depends(validate_api_key)
|
1257 |
):
|
1258 |
-
sibyl_result = get_sibyl_system_banned(item.user_id)
|
1259 |
if sibyl_result:
|
1260 |
sibyl_name, reason, is_banned, date_joined, sibyl_user_id = sibyl_result
|
1261 |
return SuccessResponse(
|
@@ -1697,7 +1745,7 @@ def gemini_pro(item: GeminiPro):
|
|
1697 |
mongo_url=item.mongo_url,
|
1698 |
user_id=item.user_id
|
1699 |
)
|
1700 |
-
cybersecuritydb(item.user_id, item.mongo_url)
|
1701 |
answer, gemini_chat = geni._GeminiLatest__get_response_gemini(item.query)
|
1702 |
return SuccessResponse(
|
1703 |
status="True",
|
|
|
47 |
from typing import Annotated, Union
|
48 |
from typing import Optional, List, Dict, Any
|
49 |
|
50 |
+
from pydantic import BaseModel, EmailStr
|
51 |
from base64 import b64decode as kc
|
52 |
from base64 import b64decode
|
53 |
from random import choice
|
|
|
59 |
|
60 |
from fastapi import FastAPI, UploadFile, File, Response, Request
|
61 |
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
62 |
+
from fastapi.security import APIKeyHeader
|
63 |
from fastapi import Depends, HTTPException, status
|
64 |
from fastapi.openapi.utils import get_openapi
|
65 |
from fastapi.responses import StreamingResponse, JSONResponse, FileResponse
|
|
|
68 |
from fastapi import Body, Query
|
69 |
from fastapi.staticfiles import StaticFiles
|
70 |
from fastapi.templating import Jinja2Templates
|
71 |
+
from fastapi import FastAPI, HTTPException
|
72 |
+
|
73 |
+
from cryptography.fernet import Fernet
|
74 |
+
from motor.motor_asyncio import AsyncIOMotorClient
|
75 |
+
from datetime import datetime, timedelta
|
76 |
|
77 |
from starlette.responses import RedirectResponse
|
78 |
from starlette.staticfiles import StaticFiles
|
|
|
145 |
MONITOR_API_KEYS = os.environ["MONITOR_API_KEYS"]
|
146 |
PICSART_API_KEY = os.environ["PICSART_API_KEY"]
|
147 |
|
148 |
+
client = AsyncIOMotorClient(MONGO_URL)
|
149 |
+
db = client['tiktokbot']
|
150 |
+
collection = db['users']
|
151 |
|
152 |
trans = SyncTranslator()
|
153 |
|
|
|
197 |
class GetsaFedBans(BaseModel):
|
198 |
user_id: int
|
199 |
|
200 |
+
async def get_all_api_keys():
|
201 |
+
user = await collection.find({})
|
202 |
api_keys = []
|
203 |
for x in user:
|
204 |
api_key = x.get("ryuzaki_api_key")
|
|
|
206 |
api_keys.append(api_key)
|
207 |
return api_keys
|
208 |
|
209 |
+
async def get_all_fedbans_api_keys():
|
210 |
+
user = await collection.find({})
|
211 |
api_keys = []
|
212 |
for x in user:
|
213 |
api_key = x.get("fedbans_api_key")
|
|
|
215 |
api_keys.append(api_key)
|
216 |
return api_keys
|
217 |
|
218 |
+
async def validate_api_key(api_key: str = Header(...)):
|
219 |
+
USERS_API_KEYS = await get_all_api_keys()
|
220 |
if api_key not in USERS_API_KEYS:
|
221 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
222 |
|
|
|
224 |
if api_key not in ONLY_DEVELOPER_API_KEYS:
|
225 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
226 |
|
227 |
+
async def validate_api_key_fedbans(api_key: str = Header(...)):
|
228 |
+
USERS_API_KEYS = await get_all_fedbans_api_keys()
|
229 |
if api_key not in USERS_API_KEYS:
|
230 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
231 |
|
|
|
233 |
mins, secs = divmod(secs, 60)
|
234 |
return f"{mins}:{secs}"
|
235 |
|
236 |
+
api_key_header = APIKeyHeader(name="api_key", auto_error=False)
|
237 |
+
|
238 |
+
async def validate_api_key_porno(api_key: Optional[str] = Depends(api_key_header)) -> str:
|
239 |
+
if api_key is None:
|
240 |
+
raise HTTPException(status_code=403, detail="API key required")
|
241 |
+
user = await collection.find_one({"username": api_key, "blocked": False})
|
242 |
+
if not user:
|
243 |
+
raise HTTPException(status_code=403, detail="Invalid or blocked API key")
|
244 |
+
return api_key
|
245 |
+
|
246 |
+
class RegistrationModel(BaseModel):
|
247 |
+
gmail: EmailStr
|
248 |
+
api_key: str
|
249 |
+
expiration_days: int = 3
|
250 |
+
|
251 |
+
key = Fernet.generate_key()
|
252 |
+
cipher_suite = Fernet(key)
|
253 |
+
|
254 |
+
def encrypt_key(api_key: str) -> str:
|
255 |
+
encrypted_key = cipher_suite.encrypt(api_key.encode())
|
256 |
+
return encrypted_key.decode()
|
257 |
+
|
258 |
+
@app.get("/some-endpoint")
|
259 |
+
async def some_endpoint(api_key: str = Depends(validate_api_key_porno)):
|
260 |
+
return {"message": "Access granted"}
|
261 |
+
|
262 |
+
@app.post("/register")
|
263 |
+
async def register_user(data: RegistrationModel):
|
264 |
+
encrypted_key = encrypt_key(data.api_key)
|
265 |
+
current_time = datetime.utcnow()
|
266 |
+
expiration_time = current_time + timedelta(days=data.expiration_days)
|
267 |
+
result = await collection.insert_one({
|
268 |
+
"username": data.api_key,
|
269 |
+
"gmail": data.gmail,
|
270 |
+
"key": encrypted_key,
|
271 |
+
"blocked": False,
|
272 |
+
"created_at": current_time,
|
273 |
+
"expires_at": expiration_time
|
274 |
+
})
|
275 |
+
if result.inserted_id:
|
276 |
+
return {"message": f"User {data.api_key} registered successfully"}
|
277 |
+
else:
|
278 |
+
raise HTTPException(status_code=500, detail="Registration failed")
|
279 |
+
|
280 |
@app.get("/akeno/youtube-search", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
281 |
async def youtube_search(payload: YouTubeSearch):
|
282 |
try:
|
|
|
623 |
)
|
624 |
|
625 |
@app.get("/akeno/pornpics", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
626 |
+
async def pornpics(query: str, api_key: str = Depends(validate_api_key_porno)):
|
627 |
try:
|
628 |
response = await search_porn_images(query)
|
629 |
return SuccessResponse(
|
|
|
637 |
)
|
638 |
|
639 |
@app.get("/akeno/pornowhite", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
640 |
+
async def pornowhite_(query: str, api_key: str = Depends(validate_api_key_porno)):
|
641 |
try:
|
642 |
response = search_pornwhite_videos(query)
|
643 |
return SuccessResponse(
|
|
|
665 |
)
|
666 |
|
667 |
@app.get("/akeno/hentai", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
668 |
+
async def hentai_(api_key: str = Depends(validate_api_key_porno)):
|
669 |
try:
|
670 |
response = await HentaiAnime()
|
671 |
return SuccessResponse(
|
|
|
775 |
)
|
776 |
|
777 |
@app.get("/akeno/xnxxsearch", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
778 |
+
async def xnxx_search(query: str, quality: str, api_key: str = Depends(validate_api_key_porno)):
|
779 |
data_dict = {
|
780 |
"720p": search_filters.SearchingQuality.X_720p,
|
781 |
"1080p": search_filters.SearchingQuality.X_1080p_plus
|
|
|
821 |
|
822 |
|
823 |
@app.get("/akeno/xnxx-dl", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
824 |
+
async def xnxx_download(link: str, api_key: str = Depends(validate_api_key_porno)):
|
825 |
try:
|
826 |
x = xnxx_client()
|
827 |
response = x.get_video(link)
|
|
|
902 |
"spammer",
|
903 |
]
|
904 |
|
905 |
+
async def remove_sibyl_system_banned(user_id):
|
906 |
update_doc = {
|
907 |
"sibyl_ban": None,
|
908 |
"reason_sibyl": None,
|
|
|
910 |
"date_joined_sib": None,
|
911 |
"sibyl_userid": None
|
912 |
}
|
913 |
+
return await collection.update_one({"user_id": user_id}, {"$unset": update_doc}, upsert=True)
|
914 |
|
915 |
+
async def new_user_spammers(
|
916 |
user_id,
|
917 |
hashtag,
|
918 |
reason,
|
|
|
926 |
"date_joined": date_joined,
|
927 |
"is_banned": is_banned
|
928 |
}
|
929 |
+
return await collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
|
930 |
|
931 |
+
async def new_sibyl_system_banned(user_id, name, reason, date_joined):
|
932 |
update_doc = {
|
933 |
"sibyl_ban": name,
|
934 |
"reason_sibyl": reason,
|
|
|
936 |
"date_joined_sib": date_joined,
|
937 |
"sibyl_userid": user_id
|
938 |
}
|
939 |
+
return await collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
|
940 |
|
941 |
+
async def cybersecuritydb(user_id, mongo_url):
|
942 |
update_doc = {"mongodb": mongo_url}
|
943 |
+
return await collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
|
944 |
|
945 |
+
async def get_sibyl_system_banned(user_id):
|
946 |
+
user = await collection.find_one({"user_id": user_id})
|
947 |
if user:
|
948 |
sibyl_name = user.get("sibyl_ban")
|
949 |
reason = user.get("reason_sibyl")
|
|
|
954 |
else:
|
955 |
return None
|
956 |
|
957 |
+
async def get_fedbans_(user_id):
|
958 |
+
user = await collection.find_one({"user_id": user_id})
|
959 |
if user:
|
960 |
user_id = user.get("user_id")
|
961 |
hashtag = user.get("hashtag")
|
|
|
972 |
else:
|
973 |
return None
|
974 |
|
975 |
+
async def get_all_banned():
|
976 |
banned_users = []
|
977 |
|
978 |
+
users = await collection.find({})
|
979 |
|
980 |
for user_id in users:
|
981 |
reason = user_id.get("reason_sibyl")
|
|
|
983 |
banned_users.append({"user_id": user_id, "reason": reason})
|
984 |
return banned_users
|
985 |
|
986 |
+
async def new_profile_clone(
|
987 |
user_id,
|
988 |
first_name,
|
989 |
last_name=None,
|
|
|
996 |
"profile_id": profile_id,
|
997 |
"bio": bio
|
998 |
}
|
999 |
+
await collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
|
1000 |
|
1001 |
+
async def get_profile_clone(user_id):
|
1002 |
+
user = await collection.find_one({"user_id": user_id})
|
1003 |
if user:
|
1004 |
first_name = user.get("first_name")
|
1005 |
last_name = user.get("last_name")
|
|
|
1009 |
else:
|
1010 |
return None
|
1011 |
|
1012 |
+
async def new_verify_otp(
|
1013 |
user_id,
|
1014 |
otp_code,
|
1015 |
ip_addres,
|
|
|
1021 |
"ip_addres": ip_addres,
|
1022 |
"auth_status": auth_status,
|
1023 |
}
|
1024 |
+
await collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
|
1025 |
|
1026 |
+
async def get_stored_otp(user_id: int):
|
1027 |
+
user = await collection.find_one({"user_id": user_id})
|
|
|
1028 |
if user and "otp_code" in user:
|
1029 |
return user["otp_code"]
|
1030 |
return None
|
|
|
1039 |
user_id: int
|
1040 |
|
1041 |
@app.get("/api/get-verify", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1042 |
+
async def get_verify_otp(user_id: int, request: Request):
|
1043 |
try:
|
1044 |
client_host = request.client.host
|
1045 |
+
get_otp_code = await get_stored_otp(user_id)
|
1046 |
if get_otp_code:
|
1047 |
return SuccessResponse(
|
1048 |
status="True",
|
|
|
1068 |
)
|
1069 |
|
1070 |
@app.post("/api/verify", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1071 |
+
async def verify_otp(payload: OTPCallbackPayload, request: Request):
|
1072 |
try:
|
1073 |
client_host = request.client.host
|
1074 |
otp = generate_otp()
|
1075 |
+
await new_verify_otp(
|
1076 |
payload.user_id,
|
1077 |
otp,
|
1078 |
ip_addres=client_host,
|
|
|
1099 |
)
|
1100 |
|
1101 |
@app.post("/ryuzaki/profile-clone", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1102 |
+
async def profile_clone(
|
1103 |
item: ProfileClone,
|
1104 |
api_key: None = Depends(validate_api_key)
|
1105 |
):
|
1106 |
try:
|
1107 |
+
await new_profile_clone(
|
1108 |
user_id=item.user_id,
|
1109 |
first_name=item.first_name,
|
1110 |
last_name=item.last_name,
|
|
|
1125 |
return SuccessResponse(status="False", randydev={"message": "Internal server error."})
|
1126 |
|
1127 |
@app.get("/ryuzaki/get-profile-clone", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1128 |
+
async def get_profile_(
|
1129 |
item: GetProfileClone,
|
1130 |
api_key: None = Depends(validate_api_key)
|
1131 |
):
|
1132 |
try:
|
1133 |
+
response = await get_profile_clone(item.user_id)
|
1134 |
if response[0]:
|
1135 |
return SuccessResponse(
|
1136 |
status="True",
|
|
|
1151 |
return SuccessResponse(status="False", randydev={"message": "Internal server error."})
|
1152 |
|
1153 |
@app.get("/ryuzaki/getbanlist")
|
1154 |
+
async def sibyl_get_all_banlist():
|
1155 |
+
banned_users = await get_all_banned()
|
1156 |
return {
|
1157 |
"status": "True",
|
1158 |
"randydev": {
|
|
|
1170 |
return {"status": "false", "message": f"Internal server error: {str(e)}"}
|
1171 |
|
1172 |
@app.delete("/ryuzaki/sibyldel", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1173 |
+
async def sibyl_system_delete(
|
1174 |
item: SibylSystemDel,
|
1175 |
api_key: None = Depends(validate_api_key_only_devs)
|
1176 |
):
|
1177 |
try:
|
1178 |
+
_, _, _, _, sibyl_user_id = await get_sibyl_system_banned(item.user_id)
|
1179 |
|
1180 |
if sibyl_user_id:
|
1181 |
+
await remove_sibyl_system_banned(item.user_id)
|
1182 |
return SuccessResponse(
|
1183 |
status="True",
|
1184 |
randydev={"message": f"Successfully removed {item.user_id} from the Sibyl ban list"}
|
|
|
1192 |
return SuccessResponse(status="False", randydev={"message": "Internal server error."})
|
1193 |
|
1194 |
@app.get("/user/get-fedban", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1195 |
+
async def getfedbans_(payload: GetsaFedBans, api_key: str = Depends(validate_api_key_fedbans)):
|
1196 |
+
users_bans = await get_fedbans_(payload.user_id)
|
1197 |
try:
|
1198 |
if users_bans[3] == True:
|
1199 |
return SuccessResponse(
|
|
|
1229 |
)
|
1230 |
|
1231 |
@app.post("/user/fedban", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1232 |
+
async def fedbans_(payload: FedBans, api_key: str = Depends(validate_api_key_fedbans)):
|
1233 |
if payload.user_id == 1191668125:
|
1234 |
return SuccessResponse(status="False", randydev={"message": "Only Developer."})
|
1235 |
|
|
|
1237 |
if not payload.hashtag.startswith("#"):
|
1238 |
return SuccessResponse(status="False", randydev={"message": "Invalid hashtag."})
|
1239 |
try:
|
1240 |
+
await new_user_spammers(
|
1241 |
user_id=payload.user_id,
|
1242 |
hashtag=payload.hashtag,
|
1243 |
reason=payload.reason,
|
|
|
1269 |
}
|
1270 |
)
|
1271 |
|
|
|
1272 |
@app.post("/ryuzaki/sibylban", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1273 |
+
async def sibyl_system_ban(
|
1274 |
item: SibylSystemBan,
|
1275 |
api_key: None = Depends(validate_api_key)
|
1276 |
):
|
|
|
1280 |
try:
|
1281 |
date_joined = str(dt.now())
|
1282 |
sibyl_ban = random.choice(RAMDOM_STATUS)
|
1283 |
+
_, _, is_banned, _, sibyl_user_id = await get_sibyl_system_banned(item.user_id)
|
1284 |
|
1285 |
if sibyl_user_id is not None and is_banned:
|
1286 |
return SuccessResponse(status="False", randydev={"message": "User is already banned."})
|
1287 |
+
await new_sibyl_system_banned(item.user_id, sibyl_ban, item.reason, date_joined)
|
1288 |
return SuccessResponse(
|
1289 |
status="True",
|
1290 |
randydev={
|
|
|
1299 |
return SuccessResponse(status="False", randydev={"message": "Internal server error."})
|
1300 |
|
1301 |
@app.get("/ryuzaki/sibyl", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
|
1302 |
+
async def sibyl_system(
|
1303 |
item: SibylSystem,
|
1304 |
api_key: None = Depends(validate_api_key)
|
1305 |
):
|
1306 |
+
sibyl_result = await get_sibyl_system_banned(item.user_id)
|
1307 |
if sibyl_result:
|
1308 |
sibyl_name, reason, is_banned, date_joined, sibyl_user_id = sibyl_result
|
1309 |
return SuccessResponse(
|
|
|
1745 |
mongo_url=item.mongo_url,
|
1746 |
user_id=item.user_id
|
1747 |
)
|
1748 |
+
await cybersecuritydb(item.user_id, item.mongo_url)
|
1749 |
answer, gemini_chat = geni._GeminiLatest__get_response_gemini(item.query)
|
1750 |
return SuccessResponse(
|
1751 |
status="True",
|