Repository navigation
Expand file tree
/
Copy pathmain.py
More file actions
158 lines (131 loc) · 6.45 KB
/
Copy pathmain.py
File metadata and controls
158 lines (131 loc) · 6.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
from flask import Flask, request, jsonify
import json
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
import requests
import data_pb2
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
app = Flask(__name__)
freefire_version = "OB50"
# Protobuf definitions
key = bytes([89, 103, 38, 116, 99, 37, 68, 69, 117, 104, 54, 37, 90, 99, 94, 56])
iv = bytes([54, 111, 121, 90, 68, 114, 50, 50, 69, 51, 121, 99, 104, 106, 77, 37])
@app.route("/")
def home():
return "API is Alive with new!", 200
@app.route('/add-items', methods=['POST'])
def add_items():
try:
content = request.json
access_token = content.get('access_token')
item_ids = content.get('item_ids')
if not access_token or not item_ids:
return jsonify({"error": "Missing 'access_token' or 'item_ids'"}), 400
if len(item_ids) != 15:
return jsonify({"error": "Exactly 15 item IDs required"}), 400
try:
jwt_api_url = f"https://jwt.falconx64.com/access_token={access_token}&key=l9lawi"
jwt_response = requests.get(jwt_api_url, timeout=10)
if jwt_response.status_code != 200:
return jsonify({
"status": "error",
"message": "Failed to retrieve JWT Token",
"status_code": jwt_response.status_code
}), 502
jwt_data = jwt_response.json()
jwt_token = jwt_data.get("jwt")
region = jwt_data.get("region", "ind").lower()
if not jwt_token:
return jsonify({"error": "JWT missing in response"}), 500
except Exception as e:
return jsonify({
"status": "error",
"message": "Error retrieving JWT Token",
"details": str(e)
}), 500
# Step 2: Protobuf Build (same as your original)
data = data_pb2.MainMessage()
data.field_1 = 1
container1 = data.field_2.add()
container1.field_1 = 1
item_configs = [
{"field_1": 2, "field_4": 1, "field_6": {"field_6": item_ids[0]}},
{"field_1": 2, "field_4": 1, "field_5": 4, "field_6": {"field_6": item_ids[1]}},
{"field_1": 2, "field_4": 1, "field_5": 2, "field_6": {"field_6": item_ids[2]}},
{"field_1": 13, "field_3": 1, "field_6": {"field_6": item_ids[3]}},
{"field_1": 13, "field_3": 1, "field_4": 2, "field_6": {"field_6": item_ids[4]}},
{"field_1": 13, "field_3": 1, "field_5": 2, "field_6": {"field_6": item_ids[5]}},
{"field_1": 13, "field_3": 1, "field_5": 4, "field_6": {"field_6": item_ids[6]}},
{"field_1": 13, "field_3": 1, "field_4": 2, "field_5": 2, "field_6": {"field_6": item_ids[7]}},
{"field_1": 13, "field_3": 1, "field_4": 2, "field_5": 4, "field_6": {"field_6": item_ids[8]}},
{"field_1": 13, "field_3": 1, "field_4": 4, "field_6": {"field_6": item_ids[9]}},
{"field_1": 13, "field_3": 1, "field_4": 4, "field_5": 2, "field_6": {"field_6": item_ids[10]}},
{"field_1": 13, "field_3": 1, "field_4": 4, "field_5": 4, "field_6": {"field_6": item_ids[11]}},
{"field_1": 13, "field_3": 1, "field_4": 6, "field_6": {"field_6": item_ids[12]}},
{"field_1": 13, "field_3": 1, "field_4": 6, "field_5": 2, "field_6": {"field_6": item_ids[13]}},
{"field_1": 13, "field_3": 1, "field_4": 6, "field_5": 4, "field_6": {"field_6": item_ids[14]}}
]
for item_data in item_configs:
item = container1.field_2.add()
item.field_1 = item_data["field_1"]
if "field_3" in item_data:
item.field_3 = item_data["field_3"]
if "field_4" in item_data:
item.field_4 = item_data["field_4"]
if "field_5" in item_data:
item.field_5 = item_data["field_5"]
item.field_6.field_6 = item_data["field_6"]["field_6"]
container2 = data.field_2.add()
container2.field_1 = 9
item7 = container2.field_2.add()
item7.field_4 = 3
item7.field_6.field_14 = 3048205855
item8 = container2.field_2.add()
item8.field_4 = 3
item8.field_5 = 3
item8.field_6.field_14 = 3048205855
# Step 3: Encrypt
data_bytes = data.SerializeToString()
padded_data = pad(data_bytes, AES.block_size)
cipher = AES.new(key, AES.MODE_CBC, iv)
encrypted_data = cipher.encrypt(padded_data)
# Step 4: Region URL selection
def get_region_url(region):
region = region.lower()
return {
"ind": "https://client.ind.freefiremobile.com",
"br": "https://client.us.freefiremobile.com",
"us": "https://client.us.freefiremobile.com",
"na": "https://client.us.freefiremobile.com",
"sac": "https://client.us.freefiremobile.com"
}.get(region, "https://clientbp.ggblueshark.com")
url = f"{get_region_url(region)}/SetPlayerGalleryShowInfo"
# Step 5: Send request
headers = {
"Expect": "100-continue",
"Authorization": f"Bearer {jwt_token}",
"X-Unity-Version": "2018.4.11f1",
"X-GA": "v1 1",
"ReleaseVersion": freefire_version,
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "Dalvik/2.1.0 (Linux; U; Android 11; SM-A305F Build/RP1A.200720.012)",
"Connection": "Keep-Alive",
"Accept-Encoding": "gzip"
}
response = requests.post(url, headers=headers, data=encrypted_data)
if response.status_code == 200:
return jsonify(
{
"status": "success",
"message": "Items added successfully!",
"region" : region,
"uid": jwt_data.get("uid"),
"nickname": jwt_data.get("nickname"),
"platform": jwt_data.get("platform"),
})
else:
return jsonify({"status": "failed", "response": response.text}), response.status_code
except Exception as e:
return jsonify({"error": str(e)}), 500
if __name__ == '__main__':
app.run(debug=True)