Giter VIP home page Giter VIP logo

v2ray-connection-limiter's Introduction

v2ray-connection-limiter

(v2.0.1 updated / if you have V2 please update codes on your server)
with this script you can detect and ban those V2ray accounts which aren't only connected to one devices.

It's simple part i could do for the ppl who providing VPN for iranian users so they could selling VPN for more and more users. so 50 50 WIN WIN ! VPN providers getting money to get more Servers and many users Could get VPN as well lol. we should be togheder right ?

so i made something for VLESS and other protocols (vmess seems blocked in iran) which you can detect those accounts which using by more than 1 IP ! this script might has some bugs and it's possible to get more power from CPU SERVER .! so check everything first and put it on background

how it works ? it's finding connected IPs to user's Port and if more than specific IP counts are connected , it will disable that account . it counts those Ips which connecting and downloading data in same time so it doesn't count standbyed and disconnected connections

Install Guide :
1 - install python .
2 - pip3 install requests and pip3 install schedule
3 - install netstat (if your server doesn't have it so install it - debian : apt install net-tools)
4 - put it on background => nohup python3 main.py & (without background process : python3 main.py)
5 - you can set telegram bot token + your tlg chat_id for notification as well . it's pretty clear on the code .

Note:


you can change Limits in line 8 >> _max_allowed_connections = 1 (1 means only one device could able to connect but i suggest to set it on 3 it works great then, becuase sometimes switching between mobileData and ADSL gonna make some issues so num 3 is better .)

Note: : in v2 new users will checked automatically

tested on this V2ray: https://seakfind.github.io/2021/10/10/X-UI/

Donate:
Good news ! If you enjoyed this script you could donate me by donating USDT to my wallet ! A Coffee or etc.
USDT wallet Address (TRC20) : TBFJ3YirXc7vwwuRNeqhcBcQziB3h9bPbs

v2ray-connection-limiter's People

Contributors

net-pioneer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

v2ray-connection-limiter's Issues

server overloaded

Hi, First of all, thank you for your good program.
After running the program with the following command, the server will load up to 100%
nohup python3 main.py &
Is there a specific solution?

and another question
What is the meaning of the following message after running the program?
....
starting checker for : kalvandi
inbound with port 19634 blocked
inbound with port 54614 blocked
inbound with port 19634 blocked
...
Regards

v2ray+ws+tls+nginx

Is there any way to configure a default port? I don't think it will work on v2ray+ws+tls+nginx because they all use the same port 443.

Hiddify

Hi there, can we use it for Hiddify as well?

max connection

salam dadash kheyli karet
doroste man okesh kardm
khob javab mide montaha vase mobile az halat data mire ro wifi acc ro disable mikone ba inke gozashtam max connection 3
rah hali dari ?

It does not work for me/Change the block mode

Pouya jan,

First of all, I did everything you said in the tutorial, but unfortunately it does not work.
what may goes wrong?

I know that you write the code in the way to block the uid if the users are DOWNLOADING at the same time, but is it possible to block the uid right after the maximum connection touched?

it's the perfect config for me.

I have some servers and have only 20 users on each and your code could help me to stay safe and my users to stay connected.

also I have a weird problem with Vless + TLS.

I have managed to successfully config one of my Iran servers with v2ray Vless + TLS, but it seems it has a problem with loading media! telegram works perfect but Instagram, Youtube and Twitter pictures and videos on app or website don't even load!

is it possible to contact you by any chance and speak about this problem? my Telegram ID is: oftenhamed

Thank you Aziz.

failed limit to 3س

سلام خسته نباشی خیلی ممنون واقعا امید مایی
من تلاش کردم که طبق حرفت در لاین 10 تعداد رو از 1 به 3 برای 3 کانکشن بزارم ولی برنامه اجرا میشه و هیچ محدودیتی روش نمیاد ولیم کافیه تا دوباره بزارمش رو 1 همه چی اوکی میشه ولی خب من 3 کانکشن میخوام

ممنون میشم کمک کنی تازه کارم و بعد از 6 ساعت گشتن پیداتون کردم

Telegram bot doesn't work

First of all thanks for such a useful code.
I have a problem. I put my token and chat id into code but it doesn't send a massage to me.

I use vaxilu/x-ui panel

بررسی پیوسته همه نودها و درگیری زیاد پردازنده

سلام و درود
خیلی خیلی ممنون بابت کدی که زدید.
نکته ای که هست اینه که وقتی برنامه ران میشه از یوزر اول شروع میکنه به چک کردن اینکه چندتا آیپی در حال دانلود هستند و اگر بیشتر از تعداد مشخص شده باشه، نود رو غیر فعال میکنه و وقتی میره سراغ نود بعدی همچنان داره اولی رو چک میکنه و مثلا وقتی شروع به چک کردن نود 4 میکنه همچنان داره نودهای 1. 2. 3 رو هم بررسی میکنه. به آخری که میرسه تعداد زیادی نود رو داره پیوسته بررسی میکنه که بسیار پردازنده رو درگیر میکنه.

اگر امکانش باشه به گونه ای تغییرات ایجاد کنید که نودها رو دونه دونه بررسی کنه و یکی که تموم شد دیگه چکش نکنه بره سراغ نود بعدی تا پردازنده کمتر درگیر بشه و وقتی به آخری رسید و بررسیش تموم شد مثل همون حالتی که برای چک کردن یوزرهای جدید بهش زمان دادید این هم مثلا 15 دقیقه بعد دوباره همین فرآیند رو از سر بگیره و دونه دونه چک کنه تا آخر اینجوری عالی میشه.
ببخشید طولانی شد، نمیدونم تونستم منظورم رو برسونم یا نه
پیشاپیش بابت پاسخگوییتون ممنونم

Limiter for mack-a v2ray agent

سلام
از اونجایی که فکر میکنم تنها امیدم برای پیاده سازی محدودیت کانکشن شما باشی و هرچی گشتم کدی غیر از کد شما پیدا نکردم، از اونجایی که خیلیا از ایجنت های متفاوت استفاده میکنن، امکانش هست یه نگاه به به اسکریپت Mack-a از اینجا بندازین و یه راهنمایی بکنین که من باید چیکار بکنم که اسکریپت شما روش کار بکنه؟ چون اون هم ایجنت خیلی کامل و معروفیه ولی دیتابیسی ایجاد نمیکنه که من بتونم بهش آدرس بدم صرفا Subscription میسازه.
خیلی ممنون.

A question and an idea

Hi pouya, I appreciate your time and effort to write this code.

I have a question and an idea, if you have time to check them please.

Does this code create a log file and save ip addresses, port numbers and uids in the log and compare the new ips with the last one's saved in the log?
If yes, there'll be a problem. The problem is that if the user changes the location(internet access), they'll have more ip addresses saved in the log than specified in the code and will be blocked.

If it's possible, add this feature to the code that clear or delete the log file after every check.

The second ask is that, if you could async the code, this could improve the performance and responsiveness.

Thank you dear.
Good luck.

Disable client instead of inbound

Hey, I don't know if you still work on this project or not, I hope you do. Could you make it so it disables the client instead of the inbound?
That would be a lot more efficient, I tried doing it myself but I couldn't figure out how I can find out which client is using more devices than they should. I would appreciate any sort of ideas/suggestions. Thanks!

Terminate Program

Hi bro I tested your program and it was perfect thank you for your effort to improve this community
I have a question how can I terminate this program in the new ssh command line

پاک شدن لاگ

عزیزم دستت درد نکنه فقط نمیشه لاگ رو بعد از هر چک پاک کنه
و اینکه قسمت ارسال پیام جواب نمیده

hi

salam dadash ino chetor roo server ubuntu nasb konim mamnoon misham yek rahnamii bokoni

Setting specific IP limit for each user

Hi
The IP limit function works fine and the Telegram notification was a great idea. The only problem is that just a single IP limit can be set for all users. It would be better if IP limit could be set for each user individually, E.g. for user A IP limit = 3 and for user B IP limit = 5.
Thanks

پیشنهاد

سلام رفیق، دمت گرم خیلی ایده خوبی بهم دادی. یه پیشنهاد دارم. به جای اینکه توی حلقه به ازای هر یوزر یه بار netstat بگیره و cpu بچسبونی به سقف، چرا یه بار قبل از حلقه، netstat کلی (بدون grep روی پورت) نمی‌گیری و بعدش توی حلقه به ازای هر یوزر ازش استفاده کنی؟

need help

سلام عزیز دمت گرم بابت زحمتت
من نمیدونم چجوری باید این اسکریپتو ران کنم میشه راهنمایی کنی چه دستوراتی باید بزنم؟
مرسی

Iranian server problem

Hi. Thank you for all your efforts.
I think there is a problem that makes this solution unusable.
Iranian people need one IR server to bypass the Intranet these days, so basically, all the users will connect by the IR servers's ip to the v2ray server and this makes it impossible to set an ip limit.
but still, there are some VPN sellers who have found a way to handle it and they set a limit on the number of users.
Please correct me if I'm wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.