Delete black9.py
Browse files
black9.py
DELETED
|
@@ -1,494 +0,0 @@
|
|
| 1 |
-
# By AbdeeLkarim BesTo
|
| 2 |
-
|
| 3 |
-
import requests , json , binascii , time , urllib3 , base64 , datetime , re ,socket , threading , random , os
|
| 4 |
-
from protobuf_decoder.protobuf_decoder import Parser
|
| 5 |
-
from Crypto.Cipher import AES
|
| 6 |
-
from Crypto.Util.Padding import pad , unpad
|
| 7 |
-
from datetime import datetime
|
| 8 |
-
from google.protobuf.timestamp_pb2 import Timestamp
|
| 9 |
-
|
| 10 |
-
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
| 11 |
-
|
| 12 |
-
Key , Iv = bytes([89, 103, 38, 116, 99, 37, 68, 69, 117, 104, 54, 37, 90, 99, 94, 56]) , bytes([54, 111, 121, 90, 68, 114, 50, 50, 69, 51, 121, 99, 104, 106, 77, 37])
|
| 13 |
-
|
| 14 |
-
def EnC_AEs(HeX):
|
| 15 |
-
cipher = AES.new(Key , AES.MODE_CBC , Iv)
|
| 16 |
-
return cipher.encrypt(pad(bytes.fromhex(HeX), AES.block_size)).hex()
|
| 17 |
-
|
| 18 |
-
def DEc_AEs(HeX):
|
| 19 |
-
cipher = AES.new(Key , AES.MODE_CBC , Iv)
|
| 20 |
-
return unpad(cipher.decrypt(bytes.fromhex(HeX)), AES.block_size).hex()
|
| 21 |
-
|
| 22 |
-
def EnC_PacKeT(HeX , K , V):
|
| 23 |
-
return AES.new(K , AES.MODE_CBC , V).encrypt(pad(bytes.fromhex(HeX) ,16)).hex()
|
| 24 |
-
|
| 25 |
-
def DEc_PacKeT(HeX , K , V):
|
| 26 |
-
return unpad(AES.new(K , AES.MODE_CBC , V).decrypt(bytes.fromhex(HeX)) , 16).hex()
|
| 27 |
-
|
| 28 |
-
def EnC_Uid(H , Tp):
|
| 29 |
-
e , H = [] , int(H)
|
| 30 |
-
while H:
|
| 31 |
-
e.append((H & 0x7F) | (0x80 if H > 0x7F else 0)) ; H >>= 7
|
| 32 |
-
return bytes(e).hex() if Tp == 'Uid' else None
|
| 33 |
-
|
| 34 |
-
def EnC_Vr(N):
|
| 35 |
-
if N < 0: ''
|
| 36 |
-
H = []
|
| 37 |
-
while True:
|
| 38 |
-
BesTo = N & 0x7F ; N >>= 7
|
| 39 |
-
if N: BesTo |= 0x80
|
| 40 |
-
H.append(BesTo)
|
| 41 |
-
if not N: break
|
| 42 |
-
return bytes(H)
|
| 43 |
-
|
| 44 |
-
def DEc_Uid(H):
|
| 45 |
-
n = s = 0
|
| 46 |
-
for b in bytes.fromhex(H):
|
| 47 |
-
n |= (b & 0x7F) << s
|
| 48 |
-
if not b & 0x80: break
|
| 49 |
-
s += 7
|
| 50 |
-
return n
|
| 51 |
-
|
| 52 |
-
def CrEaTe_VarianT(field_number, value):
|
| 53 |
-
field_header = (field_number << 3) | 0
|
| 54 |
-
return EnC_Vr(field_header) + EnC_Vr(value)
|
| 55 |
-
|
| 56 |
-
def CrEaTe_LenGTh(field_number, value):
|
| 57 |
-
field_header = (field_number << 3) | 2
|
| 58 |
-
encoded_value = value.encode() if isinstance(value, str) else value
|
| 59 |
-
return EnC_Vr(field_header) + EnC_Vr(len(encoded_value)) + encoded_value
|
| 60 |
-
|
| 61 |
-
def CrEaTe_ProTo(fields):
|
| 62 |
-
packet = bytearray()
|
| 63 |
-
for field, value in fields.items():
|
| 64 |
-
if isinstance(value, dict):
|
| 65 |
-
nested_packet = CrEaTe_ProTo(value)
|
| 66 |
-
packet.extend(CrEaTe_LenGTh(field, nested_packet))
|
| 67 |
-
elif isinstance(value, int):
|
| 68 |
-
packet.extend(CrEaTe_VarianT(field, value))
|
| 69 |
-
elif isinstance(value, str) or isinstance(value, bytes):
|
| 70 |
-
packet.extend(CrEaTe_LenGTh(field, value))
|
| 71 |
-
return packet
|
| 72 |
-
|
| 73 |
-
def DecodE_HeX(H):
|
| 74 |
-
R = hex(H)
|
| 75 |
-
F = str(R)[2:]
|
| 76 |
-
if len(F) == 1: F = "0" + F ; return F
|
| 77 |
-
else: return F
|
| 78 |
-
|
| 79 |
-
def Fix_PackEt(parsed_results):
|
| 80 |
-
result_dict = {}
|
| 81 |
-
for result in parsed_results:
|
| 82 |
-
field_data = {}
|
| 83 |
-
field_data['wire_type'] = result.wire_type
|
| 84 |
-
if result.wire_type == "varint":
|
| 85 |
-
field_data['data'] = result.data
|
| 86 |
-
if result.wire_type == "string":
|
| 87 |
-
field_data['data'] = result.data
|
| 88 |
-
if result.wire_type == "bytes":
|
| 89 |
-
field_data['data'] = result.data
|
| 90 |
-
elif result.wire_type == 'length_delimited':
|
| 91 |
-
field_data["data"] = Fix_PackEt(result.data.results)
|
| 92 |
-
result_dict[result.field] = field_data
|
| 93 |
-
return result_dict
|
| 94 |
-
|
| 95 |
-
def DeCode_PackEt(input_text):
|
| 96 |
-
try:
|
| 97 |
-
parsed_results = Parser().parse(input_text)
|
| 98 |
-
parsed_results_objects = parsed_results
|
| 99 |
-
parsed_results_dict = Fix_PackEt(parsed_results_objects)
|
| 100 |
-
json_data = json.dumps(parsed_results_dict)
|
| 101 |
-
return json_data
|
| 102 |
-
except Exception as e:
|
| 103 |
-
print(f"error {e}")
|
| 104 |
-
return None
|
| 105 |
-
|
| 106 |
-
def xMsGFixinG(n):
|
| 107 |
-
return '🗿'.join(str(n)[i:i + 3] for i in range(0 , len(str(n)) , 3))
|
| 108 |
-
|
| 109 |
-
def ArA_CoLor():
|
| 110 |
-
Tp = ["32CD32" , "00BFFF" , "00FA9A" , "90EE90" , "FF4500" , "FF6347" , "FF69B4" , "FF8C00" , "FF6347" , "FFD700" , "FFDAB9" , "F0F0F0" , "F0E68C" , "D3D3D3" , "A9A9A9" , "D2691E" , "CD853F" , "BC8F8F" , "6A5ACD" , "483D8B" , "4682B4", "9370DB" , "C71585" , "FF8C00" , "FFA07A"]
|
| 111 |
-
return random.choice(Tp)
|
| 112 |
-
|
| 113 |
-
def xBunnEr():
|
| 114 |
-
bN = [902000306 , 902000305 , 902000003 , 902000016 , 902000017 , 902000019 , 902000020 , 902000021 , 902000023 , 902000070 , 902000087 , 902000108 , 902000011 , 902049020 , 902049018 , 902049017 , 902049016 , 902049015 , 902049003 , 902033016 , 902033017 , 902033018 , 902048018 , 902000306 , 902000305]
|
| 115 |
-
return random.choice(bN)
|
| 116 |
-
|
| 117 |
-
def xSEndMsg(Msg , Tp , Tp2 , id , K , V):
|
| 118 |
-
feilds = {1: id, 2: Tp2, 3: Tp, 4: Msg , 5: 1735129800, 7: 2, 9: {1: "xBesTo - C4", 2: xBunnEr(), 3: 901048018, 4: 330, 5: 909034009, 8: "xBesTo - C4", 10: 1, 11: 1, 14: {1: 1158053040, 2: 8, 3: "\u0010\u0015\b\n\u000b\u0015\f\u000f\u0011\u0004\u0007\u0002\u0003\r\u000e\u0012\u0001\u0005\u0006"}}, 10: "en", 13: {2: 1, 3: 1}, 14: {}}
|
| 119 |
-
Pk = str(CrEaTe_ProTo(feilds).hex())
|
| 120 |
-
Pk = "080112" + EnC_Uid(len(Pk) // 2 , Tp = 'Uid') + Pk
|
| 121 |
-
return GeneRaTePk(str(Pk) , '1215' , K , V)
|
| 122 |
-
|
| 123 |
-
def Auth_Chat(idT, sq, K, V):
|
| 124 |
-
fields = {
|
| 125 |
-
1: 3,
|
| 126 |
-
2: {
|
| 127 |
-
1: idT,
|
| 128 |
-
3: "fr",
|
| 129 |
-
4: sq
|
| 130 |
-
}
|
| 131 |
-
}
|
| 132 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '1215' , K , V)
|
| 133 |
-
def xSendTeamMsg(msg, idT, K, V):
|
| 134 |
-
fields = {
|
| 135 |
-
1: 1,
|
| 136 |
-
2: {
|
| 137 |
-
1: 12404281032,
|
| 138 |
-
2: idT,
|
| 139 |
-
4: msg,
|
| 140 |
-
7: 2,
|
| 141 |
-
10: "fr",
|
| 142 |
-
9: {
|
| 143 |
-
1: "C4 TEAM",
|
| 144 |
-
2: xBunnEr(),
|
| 145 |
-
4: 330,
|
| 146 |
-
5: 827001005,
|
| 147 |
-
8: "C4 TEAM",
|
| 148 |
-
10: 1,
|
| 149 |
-
11: 1,
|
| 150 |
-
12: {
|
| 151 |
-
1: 2
|
| 152 |
-
},
|
| 153 |
-
14: {
|
| 154 |
-
1: 1158053040,
|
| 155 |
-
2: 8,
|
| 156 |
-
3: "\u0010\u0015\b\n\u000b\u0015\f\u000f\u0011\u0004\u0007\u0002\u0003\r\u000e\u0012\u0001\u0005\u0006"
|
| 157 |
-
}
|
| 158 |
-
},
|
| 159 |
-
13: {
|
| 160 |
-
1: 2,
|
| 161 |
-
2: 1
|
| 162 |
-
},
|
| 163 |
-
14:{}
|
| 164 |
-
}
|
| 165 |
-
}
|
| 166 |
-
|
| 167 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '1215' , K , V)
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
def spmroom(K, V, uid):
|
| 171 |
-
fields = {
|
| 172 |
-
1: 22, # ✅ مفتاح رقمي
|
| 173 |
-
2: { # ✅ مفتاح رقمي
|
| 174 |
-
1: int(uid) # ✅ مفتاح رقمي
|
| 175 |
-
}
|
| 176 |
-
}
|
| 177 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()), '0E15', K, V)
|
| 178 |
-
|
| 179 |
-
def openroom(K, V):
|
| 180 |
-
fields = {
|
| 181 |
-
1: 2, # ✅ Integer key
|
| 182 |
-
2: { # ✅ Integer key
|
| 183 |
-
1: 1, # ✅ Integer key
|
| 184 |
-
2: 15, # ✅ Integer key
|
| 185 |
-
3: 5,
|
| 186 |
-
4: "AlliFF",
|
| 187 |
-
5: "1",
|
| 188 |
-
6: 12,
|
| 189 |
-
7: 1,
|
| 190 |
-
8: 1,
|
| 191 |
-
9: 1,
|
| 192 |
-
11: 1,
|
| 193 |
-
12: 2,
|
| 194 |
-
14: 36981056,
|
| 195 |
-
15: {
|
| 196 |
-
1: "IDC3",
|
| 197 |
-
2: 126,
|
| 198 |
-
3: "ME"
|
| 199 |
-
},
|
| 200 |
-
16: "\u0001\u0003\u0004\u0007\t\n\u000b\u0012\u000f\u000e\u0016\u0019\u001a \u001d",
|
| 201 |
-
18: 2368584,
|
| 202 |
-
27: 1,
|
| 203 |
-
34: "\u0000\u0001",
|
| 204 |
-
40: "en",
|
| 205 |
-
48: 1,
|
| 206 |
-
49: {
|
| 207 |
-
1: 21
|
| 208 |
-
},
|
| 209 |
-
50: {
|
| 210 |
-
1: 36981056,
|
| 211 |
-
2: 2368584,
|
| 212 |
-
5: 2
|
| 213 |
-
}
|
| 214 |
-
}
|
| 215 |
-
}
|
| 216 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()), '0E15', K, V)
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
def OpEnSq(K , V):
|
| 220 |
-
fields = {1: 1, 2: {2: "\u0001", 3: 1, 4: 1, 5: "en", 9: 1, 11: 1, 13: 1, 14: {2: 5756, 6: 11, 8: "1.111.5", 9: 2, 10: 4}}}
|
| 221 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0515' , K , V)
|
| 222 |
-
|
| 223 |
-
def cHSq(Nu , Uid , K , V):
|
| 224 |
-
fields = {1: 17, 2: {1: int(Uid), 2: 1, 3: int(Nu - 1), 4: 62, 5: "\u001a", 8: 5, 13: 329}}
|
| 225 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0515' , K , V)
|
| 226 |
-
|
| 227 |
-
def SEnd_InV(Nu , Uid , K , V):
|
| 228 |
-
fields = {1: 2 , 2: {1: int(Uid) , 2: "ME" , 4: int(Nu)}}
|
| 229 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0515' , K , V)
|
| 230 |
-
|
| 231 |
-
def ExiT(id , K , V):
|
| 232 |
-
fields = {
|
| 233 |
-
1: 7,
|
| 234 |
-
2: {
|
| 235 |
-
1: int(11037044965)
|
| 236 |
-
}
|
| 237 |
-
}
|
| 238 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0515' , K , V)
|
| 239 |
-
|
| 240 |
-
def AuthClan(CLan_Uid , AuTh , K , V):
|
| 241 |
-
fields = {1: 3, 2: {1: int(CLan_Uid) , 2: 1, 4: str(AuTh)}}
|
| 242 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '1201' , K , V)
|
| 243 |
-
|
| 244 |
-
def GeT_Status(PLayer_Uid , K , V):
|
| 245 |
-
PLayer_Uid = EnC_Uid(PLayer_Uid , Tp = 'Uid')
|
| 246 |
-
if len(PLayer_Uid) == 8: Pk = f'080112080a04{PLayer_Uid}1005'
|
| 247 |
-
elif len(PLayer_Uid) == 10: Pk = f"080112090a05{PLayer_Uid}1005"
|
| 248 |
-
return GeneRaTePk(Pk , '0f15' , K , V)
|
| 249 |
-
|
| 250 |
-
def SPam_Room(Uid , Rm , Nm , K , V):
|
| 251 |
-
fields = {1: 78, 2: {1: int(Rm), 2: f"[{ArA_CoLor()}]{Nm}", 3: {2: 1, 3: 1}, 4: 330, 5: 1, 6: 201, 10: xBunnEr(), 11: int(Uid), 12: 1}}
|
| 252 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0e15' , K , V)
|
| 253 |
-
|
| 254 |
-
def Join_Room(room_id , K , V):
|
| 255 |
-
fields = {1: 3, 2: {1: int(room_id), 8: {1: "IDC1", 2: 3000, 3: "ME"}, 9: "\x01\t\n\x12\x19 ", 10: 1, 12: b"\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01", 13: 3, 14: 3, 16: "ME"}}
|
| 256 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0e10' , K , V)
|
| 257 |
-
|
| 258 |
-
def SPamSq(Uid , K , V):
|
| 259 |
-
fields = {1: 33, 2: {1: int(Uid) , 2: 'ME', 3: 1, 4: 1, 7: 330, 8: 19459, 9: 100, 12: 1, 16: 1, 17: {2: 94, 6: 11, 8: '1.111.5', 9: 3, 10: 2}, 18: 201, 23: {2: 1, 3: 1}, 24: xBunnEr() , 26: {}, 28: {}}}
|
| 260 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0515' , K , V)
|
| 261 |
-
|
| 262 |
-
def AccEpT(PLayer_Uid , AuTh_CodE_Sq , K , V):
|
| 263 |
-
fields = {1: 4, 2: {1: int(PLayer_Uid), 3: int(PLayer_Uid), 4: "\u0001\u0007\t\n\u0012\u0019\u001a ", 8: 1, 9: {2: 1393, 4: "wW_T", 6: 11, 8: "1.111.5", 9: 3, 10: 2}, 10: AuTh_CodE_Sq, 12: 1, 13: "en", 16: "OR"}}
|
| 264 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()) , '0515' , K , V)
|
| 265 |
-
|
| 266 |
-
def GenJoinSquadsPacket(code, key, iv):
|
| 267 |
-
fields = {}
|
| 268 |
-
fields[1] = 4
|
| 269 |
-
fields[2] = {}
|
| 270 |
-
fields[2][4] = bytes.fromhex("01090a0b121920")
|
| 271 |
-
fields[2][5] = str(code)
|
| 272 |
-
fields[2][6] = 6
|
| 273 |
-
fields[2][8] = 1
|
| 274 |
-
fields[2][9] = {}
|
| 275 |
-
fields[2][9][2] = 800
|
| 276 |
-
fields[2][9][6] = 11
|
| 277 |
-
fields[2][9][8] = "1.111.1"
|
| 278 |
-
fields[2][9][9] = 5
|
| 279 |
-
fields[2][9][10] = 1
|
| 280 |
-
print(fields)
|
| 281 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()), '0515', key, iv)
|
| 282 |
-
#1750287629500765351_vfhkisb7hv 8679231987
|
| 283 |
-
def ghost_pakcet(player_id , nm , secret_code , key ,iv):
|
| 284 |
-
fields = {
|
| 285 |
-
1: 61,
|
| 286 |
-
2: {
|
| 287 |
-
1: int(player_id),
|
| 288 |
-
2: {
|
| 289 |
-
1: int(player_id),
|
| 290 |
-
2: 1159,
|
| 291 |
-
3: f"[b][c][{ArA_CoLor()}]{nm}",
|
| 292 |
-
5: 12,
|
| 293 |
-
6: 15,
|
| 294 |
-
7: 1,
|
| 295 |
-
8: {
|
| 296 |
-
2: 1,
|
| 297 |
-
3: 1,
|
| 298 |
-
},
|
| 299 |
-
9: 3,
|
| 300 |
-
},
|
| 301 |
-
3: secret_code,},}
|
| 302 |
-
return GeneRaTePk(str(CrEaTe_ProTo(fields).hex()), '0515', key, iv)
|
| 303 |
-
|
| 304 |
-
def _V(b, i):
|
| 305 |
-
r = s = 0
|
| 306 |
-
while True:
|
| 307 |
-
c = b[i]; i += 1
|
| 308 |
-
r |= (c & 0x7F) << s
|
| 309 |
-
if c < 0x80: break
|
| 310 |
-
s += 7
|
| 311 |
-
return r, i
|
| 312 |
-
|
| 313 |
-
def PrOtO(hx):
|
| 314 |
-
b, i, R = bytes.fromhex(hx), 0, {}
|
| 315 |
-
while i < len(b):
|
| 316 |
-
H, i = _V(b, i)
|
| 317 |
-
F, T = H >> 3, H & 7
|
| 318 |
-
if T == 0:
|
| 319 |
-
R[F], i = _V(b, i)
|
| 320 |
-
elif T == 2:
|
| 321 |
-
L, i = _V(b, i)
|
| 322 |
-
S = b[i:i+L]; i += L
|
| 323 |
-
try: R[F] = S.decode()
|
| 324 |
-
except:
|
| 325 |
-
try: R[F] = PrOtO(S.hex())
|
| 326 |
-
except: R[F] = S
|
| 327 |
-
elif T == 5:
|
| 328 |
-
R[F] = int.from_bytes(b[i:i+4], 'little'); i += 4
|
| 329 |
-
else:
|
| 330 |
-
raise ValueError(f'Unknown wire type: {T}')
|
| 331 |
-
return R
|
| 332 |
-
|
| 333 |
-
def GeT_KEy(obj , target):
|
| 334 |
-
values = []
|
| 335 |
-
def collect(o):
|
| 336 |
-
if isinstance(o, dict):
|
| 337 |
-
for k, v in o.items():
|
| 338 |
-
if k == target:
|
| 339 |
-
values.append(v)
|
| 340 |
-
collect(v)
|
| 341 |
-
elif isinstance(o, list):
|
| 342 |
-
for v in o:
|
| 343 |
-
collect(v)
|
| 344 |
-
collect(obj)
|
| 345 |
-
return values[-1] if values else None
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
def GeneRaTePk(Pk , N , K , V):
|
| 349 |
-
PkEnc = EnC_PacKeT(Pk , K , V)
|
| 350 |
-
_ = DecodE_HeX(int(len(PkEnc) // 2))
|
| 351 |
-
if len(_) == 2: HeadEr = N + "000000"
|
| 352 |
-
elif len(_) == 3: HeadEr = N + "00000"
|
| 353 |
-
elif len(_) == 4: HeadEr = N + "0000"
|
| 354 |
-
elif len(_) == 5: HeadEr = N + "000"
|
| 355 |
-
return bytes.fromhex(HeadEr + _ + PkEnc)
|
| 356 |
-
|
| 357 |
-
def GuiLd_AccEss(Tg , Nm , Uid , BLk , OwN , AprV):
|
| 358 |
-
return Tg in Nm and Uid not in BLk and Uid in (OwN | AprV)
|
| 359 |
-
|
| 360 |
-
def ChEck_Commande(id):
|
| 361 |
-
return "<" not in id and ">" not in id and "[" not in id and "]" not in id
|
| 362 |
-
|
| 363 |
-
def L_DaTa():
|
| 364 |
-
load = lambda f: json.load(open(f)) if os.path.exists(f) else {}
|
| 365 |
-
return map(load, ["BesTo_CLan_LiKes.json" , "BesTo_RemaininG_LiKes.json" , "BesTo_RemaininG_Room.json"])
|
| 366 |
-
|
| 367 |
-
def ChEck_Limit_CLan(Uid , STaTus):
|
| 368 |
-
data , max_use , file = (like_data_clan, 10, "BesTo_CLan_LiKes.json") if STaTus == "like" else ''
|
| 369 |
-
t , limit = time.time(), 86400
|
| 370 |
-
u = data.get(str(Uid), {"count": 0, "start_time": t})
|
| 371 |
-
if t - u["start_time"] >= limit:
|
| 372 |
-
u = {"count": 0, "start_time": t}
|
| 373 |
-
if u["count"] < max_use:
|
| 374 |
-
u["count"] += 1
|
| 375 |
-
data[str(Uid)] = u
|
| 376 |
-
json.dump(data , open(file, "w"))
|
| 377 |
-
return f"{max_use - u['count']}" , datetime.fromtimestamp(u["start_time"] + limit).strftime("%I:%M %p - %d/%m/%y")
|
| 378 |
-
return False , datetime.fromtimestamp(u["start_time"] + limit).strftime("%I:%M %p - %d/%m/%y")
|
| 379 |
-
|
| 380 |
-
def ChEck_Limit(Uid , STaTus):
|
| 381 |
-
data , max_use , file = (like_data, 10, "BesTo_RemaininG_LiKes.json") if STaTus == "like" else (room_data, 10, "BesTo_RemaininG_Room.json")
|
| 382 |
-
t , limit = time.time(), 86400
|
| 383 |
-
u = data.get(str(Uid), {"count": 0, "start_time": t})
|
| 384 |
-
if t - u["start_time"] >= limit:
|
| 385 |
-
u = {"count": 0, "start_time": t}
|
| 386 |
-
if u["count"] < max_use:
|
| 387 |
-
u["count"] += 1
|
| 388 |
-
data[str(Uid)] = u
|
| 389 |
-
json.dump(data , open(file, "w"))
|
| 390 |
-
return f"{max_use - u['count']}" , datetime.fromtimestamp(u["start_time"] + limit).strftime("%I:%M %p - %d/%m/%y")
|
| 391 |
-
return False , datetime.fromtimestamp(u["start_time"] + limit).strftime("%I:%M %p - %d/%m/%y")
|
| 392 |
-
|
| 393 |
-
f = 'blacklist.txt'
|
| 394 |
-
approvee = 'approved.txt'
|
| 395 |
-
black , approve = [] , []
|
| 396 |
-
|
| 397 |
-
def load_blacklist():
|
| 398 |
-
global black
|
| 399 |
-
try:
|
| 400 |
-
with open(f, 'r') as file:
|
| 401 |
-
black = [line.strip() for line in file if line.strip()]
|
| 402 |
-
except: black = []
|
| 403 |
-
|
| 404 |
-
def encrypt_uids():
|
| 405 |
-
global black
|
| 406 |
-
try:
|
| 407 |
-
if black: black = [EnC_Uid(uid , Tp = 'Uid') for uid in black]
|
| 408 |
-
except:
|
| 409 |
-
try: open(f, 'w').close()
|
| 410 |
-
except: pass
|
| 411 |
-
load_blacklist()
|
| 412 |
-
|
| 413 |
-
if not black: open(f, 'w').close()
|
| 414 |
-
|
| 415 |
-
def load_approve():
|
| 416 |
-
global approve
|
| 417 |
-
try:
|
| 418 |
-
with open(approvee, 'r') as file: approve = [line.strip() for line in file if line.strip()]
|
| 419 |
-
except: approve = []
|
| 420 |
-
|
| 421 |
-
def encrypt_uids2():
|
| 422 |
-
global approve
|
| 423 |
-
try:
|
| 424 |
-
if approve: approve = [EnC_Uid(uid , Tp = 'Uid') for uid in approve]
|
| 425 |
-
except:
|
| 426 |
-
try: open(approvee, 'w').close()
|
| 427 |
-
except: pass
|
| 428 |
-
load_approve()
|
| 429 |
-
|
| 430 |
-
if not approve: open(approvee, 'w').close()
|
| 431 |
-
|
| 432 |
-
def Add_Uid(user_id):
|
| 433 |
-
with open(f, 'r') as file: lines = file.read().splitlines()
|
| 434 |
-
if str(user_id) not in lines:
|
| 435 |
-
with open(f, 'a') as file: file.write(f"{user_id}\n")
|
| 436 |
-
|
| 437 |
-
def Remove_Uid(f, player_uid):
|
| 438 |
-
try:
|
| 439 |
-
with open(f, 'r+') as file: lines = file.readlines() ; file.seek(0), file.truncate(), file.writelines(l for l in lines if l.strip() != player_uid) ; return True
|
| 440 |
-
except FileNotFoundError: return False
|
| 441 |
-
|
| 442 |
-
def A(user_id):
|
| 443 |
-
with open(approvee, 'r') as file: lines = file.read().splitlines()
|
| 444 |
-
if str(user_id) not in lines:
|
| 445 |
-
with open(approvee, 'a') as file: file.write(f"{user_id}\n")
|
| 446 |
-
|
| 447 |
-
def D(approvee, player_uid):
|
| 448 |
-
try:
|
| 449 |
-
with open(approvee, 'r+') as file: lines = file.readlines() ; file.seek(0), file.truncate(), file.writelines(l for l in lines if l.strip() != player_uid) ; return True
|
| 450 |
-
except FileNotFoundError: return False
|
| 451 |
-
|
| 452 |
-
def Clear():
|
| 453 |
-
try:
|
| 454 |
-
open(f, 'w').close() ; black.clear() ; return True
|
| 455 |
-
except: return False
|
| 456 |
-
|
| 457 |
-
def Add_Black(user_id):
|
| 458 |
-
Add_Uid(user_id)
|
| 459 |
-
if EnC_Uid(user_id , Tp = 'Uid') not in black: black.append(EnC_Uid(user_id , Tp = 'Uid')) ; return True
|
| 460 |
-
else: return False
|
| 461 |
-
|
| 462 |
-
def Rem_Black(user_id):
|
| 463 |
-
user_id_encrypted = EnC_Uid(user_id , Tp = 'Uid')
|
| 464 |
-
if user_id_encrypted in black: black.remove(user_id_encrypted) ; Remove_Uid(f , user_id) ; return True
|
| 465 |
-
else: return False
|
| 466 |
-
|
| 467 |
-
def Show_Uids():
|
| 468 |
-
try:
|
| 469 |
-
with open(f) as file: return "\n".join(sorted(file.read().splitlines(), key=int)) or False
|
| 470 |
-
except (FileNotFoundError, ValueError): return False
|
| 471 |
-
|
| 472 |
-
def Approved(user_id):
|
| 473 |
-
A(user_id)
|
| 474 |
-
if EnC_Uid(user_id , Tp = 'Uid') not in approve: approve.append(EnC_Uid(user_id , Tp = 'Uid')) ; return True
|
| 475 |
-
else: return False
|
| 476 |
-
|
| 477 |
-
def DeApproved(user_id):
|
| 478 |
-
user_id_encrypted = EnC_Uid(user_id , Tp = 'Uid')
|
| 479 |
-
if user_id_encrypted in approve: approve.remove(user_id_encrypted) ; D(approvee , user_id) ; return True
|
| 480 |
-
else: return False
|
| 481 |
-
|
| 482 |
-
def Show_Approvs():
|
| 483 |
-
try:
|
| 484 |
-
with open(approvee) as file: return "\n".join(sorted(file.read().splitlines(), key=int)) or False
|
| 485 |
-
except (FileNotFoundError, ValueError): return False
|
| 486 |
-
|
| 487 |
-
def Clear_Approvs():
|
| 488 |
-
try:
|
| 489 |
-
open(approvee, 'w').close() ; approve.clear() ; return True
|
| 490 |
-
except: return False
|
| 491 |
-
|
| 492 |
-
load_blacklist() ; encrypt_uids()
|
| 493 |
-
load_approve() ; encrypt_uids2()
|
| 494 |
-
like_data_clan , like_data , room_data = L_DaTa()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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