File size: 2,752 Bytes
7f38bb3
 
 
 
ed0cbc2
7f38bb3
37b65f4
ed0cbc2
7f38bb3
 
46d85c1
7f38bb3
ed0cbc2
17d73d2
46d85c1
ed0cbc2
46d85c1
ed0cbc2
 
46d85c1
 
 
 
 
 
ed0cbc2
 
8573cfc
ed0cbc2
 
 
6b0c2aa
7f38bb3
ed0cbc2
 
 
7f38bb3
 
 
 
 
6b0c2aa
 
46d85c1
ed0cbc2
7f38bb3
46d85c1
 
7f38bb3
46d85c1
 
7f38bb3
 
 
 
ca4e572
 
7f38bb3
 
ed0cbc2
7f38bb3
ed0cbc2
46d85c1
ed0cbc2
46d85c1
ed0cbc2
 
 
46d85c1
 
ed0cbc2
46d85c1
ed0cbc2
46d85c1
 
ed0cbc2
46d85c1
 
9b34beb
46d85c1
 
 
 
 
 
 
 
 
7f38bb3
 
9fed31b
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
import json
import random
import time
from datetime import datetime
from collections import deque

from flask import Flask, Response, render_template, stream_with_context, make_response
import requests

app = Flask(__name__)
random.seed() 

# Rate limiting parameters
MAX_REQUESTS_PER_SECOND = 1500 
REQUEST_TIME_WINDOW = 1 

# Store timestamps of recent requests
recent_requests = deque()

# Telegram configuration
TELEGRAM_BOT_TOKEN = '7408530224:AAGLPps_bWOHQ7mQDBe-BsXTiaJA8JmYIeo' 
TELEGRAM_CHAT_ID = '-1001825626706' 

# Initialize a dictionary to store requests per second
requests_per_second = {}

def send_telegram_alert(message):
    url = f"https://lol-v2.mxflower.eu.org/api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
    data = {"chat_id": TELEGRAM_CHAT_ID, "text": message}
    requests.post(url, json=data)

@app.route('/')
def index():
    with open("index.html", "r") as f:
        html = f.read()
    return html

@app.route('/chart-data')
def chart_data():
    def generate_random_data():
        while True:
            current_time = datetime.now().strftime('%M:%S')
            if current_time not in requests_per_second:
                requests_per_second[current_time] = 0 

            json_data = json.dumps(
                {'time': current_time, 'value': requests_per_second[current_time]}
            )
            yield f"data:{json_data}\n\n"
            time.sleep(1) 
            requests_per_second[current_time] = 0  

    response = Response(stream_with_context(generate_random_data()), mimetype="text/event-stream")
    response.headers["Cache-Control"] = "no-cache"
    response.headers["X-Accel-Buffering"] = "no"
    return response

@app.route("/attack")
def attack():
    global recent_requests

    now = time.time()
    current_time = datetime.now().strftime('%M:%S') 

    # Rate Limiting (Improved)
    while recent_requests and now - recent_requests[0] > REQUEST_TIME_WINDOW:
        recent_requests.popleft()

    if len(recent_requests) >= MAX_REQUESTS_PER_SECOND:
        return "Too many requests, please try again later.", 429

    recent_requests.append(now)

    if current_time in requests_per_second:
        requests_per_second[current_time] += 1
    else:
        requests_per_second[current_time] = 1

    if requests_per_second[current_time] == 700: 
        send_telegram_alert(f"High traffic detected! at https://skylinex.eu.org/ {current_time}")

    # Create the response
    response = make_response("Your Requests Get Approved and Cached Check https://skylinex.eu.org/")
    
    # Set the desired Link header
    response.headers["Link"] = "TELEGRAM VANO_GANZZZ"

    return response

if __name__ == '__main__':
    app.run(debug=True, threaded=True, host="0.0.0.0", port=7860)