Giter VIP home page Giter VIP logo

v2iplimit's Introduction

Markdownify

Hi, I’m houshmand-2005

My Projects:

Contact Information

v2iplimit's People

Contributors

dependabot[bot] avatar houshmand-2005 avatar nikita-safonov 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  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

v2iplimit's Issues

عدم محاسبه دقیق زمان آنبن شدن یوزر

عرض سلام و خسته نباشید
وقتی یک یوزر بن میشه توی زمان مشخص شده آنبن نمیشه
من زمان ها رو به صورت دیفالت گذاشتم (چک 240 و بن بودن :210)
ولی متاسفانه توی اکثر مواقع یوزر قبل از 210 ثانیه مجدد اکتیو میشه
گاهی وقت 2 دقیقه و گاهی حتی بعد از یک دقیقه اکتیو میشه
من از نسخه مرزبان استفاده میکنم
لطفا این باگ رو بررسی و رفع کنید
پیشاپیش سپاسگذارم

1 VPS & Multiple Panels

Hello Again,
I hope you're doing great!

How can I run this script for multiple panels on 1 VPS?
Is it doable? Please guide me through it if you can.

I appreciate your time bro!
Thanks a lot

There is no active user

Hi. During the execution of the script, I get this result. Active users in fact about 10. Could you tell me what the problem might be?

-----run------
There is no active user
-----done-----

ارسال لاگ فقط برای تعداد خاصی آی‌پی متصل

سلام. ممنون از اسکریپت خوبی که تهیه کردید.
راهی هست که لاگ های ارسالی به ربات، فقط برای یوزر هایی که از تعداد خاصی IP متصل به بالا هستن ارسال بشه؟
مثلا فقط یوزر هایی که بیشتر مساوی 3 کاربر دارن لاگ ارسال بشه

Question

Hello Again,
I hope you're doing great!

I'm here with another question as always, sorry for bothering you.
I applied this script for a panel on a different VPS which the panel is not on that and it worked!
So is this the way it works? it doesn't matter where we run it?

Please let me know
Thanks a lot

عدم نمایش کاربرهای فعال

اسکریپت به پنل مرزبان با موفقیت متصل می شود اما تعداد کاربر فعال را نمی تواند محاسبه کند و ۰ بر میگرداند

Count duplicate IPs in a single interval

سلام و خداقوت بخاطر آپدیت جدید. خیلی ترتمیز تر شده امیدوارم رو به پیشرفت باشی همچنان
مشکلی که تو نسخه جدید پیش اومد برای من این بود که توی هر اینتروال (که من 60ثانیه تعیین کرده بودم)، آی‌پی های تکراری برای بعضی کاربران ثبت میکرد و نتیجه این میشد که یک کاربر با فقط یک IP طی اون 60 ثانیه، همون یک IP رو 6 بار حساب کرده بود و کاربر رو بن کرده بود.

تو پیامی که "همه" کاربران رو همزمان میفرسته، تعداد IP رو درست زده بود. ولی تو پیام Warning همچین صحنه ای پیش اومد:

image

و همین یکبار و همین یک کاربر هم نبود. برای کاربر های زیادی مکررا ایجاد شد.

  • پ.ن: برای اینتروال 240ثانیه هم امتحان کردم مشکل وجود داشت همچنان

UsageTime Command

Hello Again,

This command " /UsageTime " doesn't work most of the times.
When I enter it, it says "User not found" while I write completely correct.
Uppercase and Lowercase Letters are written according to username and yet doesn't work.

Sometimes after I enter the command 10 times, it replies with the wrong time.
For instance, it says yesterday at 14:00 while the user has connected this morning.

Please let me know what I should do
Thank you for all your effort and time bro

cant run script in windows

سلام و عرض ادب
من یک سرور دارم که روی اون ویندوز سرور 2019 نصب هست
اسکریپت شما رو که اجرا میکنم چند تا ارور میده
اولیش این هست تو خط 11
ModuleNotFoundError: No module named 'pytz'

راهی وجود داره بشه از اسکریپت رو سرور ویندوزی استفاده کرد؟

Bug Report

Hello Again,
I hope you're doing well.

Sometimes it identifies a large number of IPs connected to a config like 25, 37 and 47. These are the numbers.
While only one person is using it.

Also, It disconnects users that have exceeded IP Limit but it doesn't enable them after the 4 minutes.

Please let me know what I should do
Thank you so very much for all your effort and time

از کار افتادن بعد از چند ساعت

سلام . من از اخرین نسخه مرزبان استفاده میکنم و از این اسکریپت استفاده میکنم اما بعد از چند ساعت از کار میفته و اعلام میکنه که کاربری اکتیو نیست اما بعد از استوپ کردن و دوباره استارت کردنش درست میشه
من از روش اول برای ران کردنش استفاده کردم (screen)
افراد دیگه هم همین مشکل رو داشتن و فکر میکنم همگانی هست
لطفا یه بررسی بکنید

Wrong IP count in logs

Hello and good day,

I have done some research on the issue of the script logging incorrect numbers of connected IPs, which several other people have reported, and I would like to share my findings.

My setup consists of a master server and some nodes. Occasionally, some IPs connected to a node or the master server are missing from the Telegram logs. Restarting the Marzban service on the affected server fixes the issue temporarily, but it reoccurs after some time (hours or days) with the same or different nodes.

Moreover, when the script encounters a connection problem with a server, it attempts to reconnect to that server. However, I have noticed through Telegram logs that the script sometimes fails to detect connection problems, so it does not try to reconnect. This causes a drop in connected IPs. When the script finally detects and reconnects to the problematic server, everything returns to normal.

I am not sure if this is a problem with the Marzban or the Houshmand script, but I have observed that when the script reports a connection problem with a server, the users on that server remain connected.

I hope this helps to understand and resolve the problem.

Issue

Hello Again,
I hope you're doing well!

I was wondering if you've changed the script recently because I tried it today on a new VPS and it doesn't work!

root@TED:/V2IpLimit/Marzban# python3 v2_ip_limit.py
Traceback (most recent call last):
File "/V2IpLimit/Marzban/v2_ip_limit.py", line 12, in
import requests
ModuleNotFoundError: No module named 'requests'

Also I tried "chmod +x cronjob.sh v2_ip_limit.py"
None of them worked! No Log was sent to Telegram neither!

Please let me know what I should do...
Thank you so much

اجرا نشدن اسکریپت بعد از خارج شدن از سرور

سلام
بعد از اینکه از سرور خارج میشم اسکریپت ادامه نمیده و stop میخوره
اگر یک اپشن دیگه هم اضافه کنید بهش طرف از محدودیت ای پیش بیشتر مصرف کرد و اکانتش غیر فعال شد بعد از یک تایم مشخص اکانتش خودکار فعال شه عالی میشه

اپدیت مرزبان

درود و خسته نباشید
مرزبان به نسخه 0.4.0 ارتقاع پیدا کرد ، ایا با نسخه فعلی اسکریپت سازگار هست؟ یا اپدیت میدید؟
باتشکر

Api

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

گزارش باگ

سلام و تشکر بابت این اسکریپت خوب فقط یک مشکلی که داری اینه که اگر از لودبالانسر(مثلا لودبالانسر هتزنر) استفاده بشه آیپی رو تشخیص نمیده، حتی یدونه هم حسابش نمیکنه اون آیپی رو اصلا انگار وجود نداره.
به بات تلگرامی هم نتونستم وصلش کنم ممنون میشم بیشتر راهنمایی کنید 🙏

مشکل از کار افتادن اسکریپت

درود بر شما و ممنون از زحماتتون
مشکلی که بهش برخوردم اینکه اسکریپت مثلا صبح فعال میکنم تا شب Count ip رو 0 میزنه و دیگه لیمیت نمیکنه. یه بار هسته Xray ریستارت میکنم درست میشه.
"log": {
"loglevel": "info"
},
برای لاگ توی کد فقط همین تکه کد بالا رو گذاشتم و از HAproxy هم استفاده میکنم. ولی option forwardfor رو قرار دادم توی Haproxy
همچنین تقریبا هر چند ساعت یکبار وب سوکت کانکشنش به مشکل میخوره و دوباره به سرور اصلی و نود ارتباط میگیره البته بعد اینکار مجدد فعال میشه و مشکلی نداره
ممنون میشم راهنمایی کنید

Tunnel

Hi,
Thanks for your script, when i use tunnel to connect marzban it cant find user ip and it return tunnel server ip for user.
can we do something for that?

"There is no active user" when setting up Xray to write logs to files

I found a problem. If the xray_config.json file specifies saving logs to files like this:

   "log": {
     "loglevel": "info",
         "access": "/var/lib/marzban-node/access.log",
         "error": "/var/lib/marzban-node/error.log"
   },

then the script does not work, it displays "There is no active user".
Right while the script was running, I deleted and added back the access and error entries, restarted Xray and the script either worked or stopped.

اشتباه من

بعد از 3 ماه فهمیدم یک اشتباه کردم اینجا مینویسم شاید به درد کسی بخوره
کرون جاب رو گذاشته بودم هر 10 دقیقه اجرا شه. و همیشه میدیدم حدود 300 نفر متصل هستند.
در صورتی که فقط یک بار کرون جاب اجرا شه کافیه حالا 900 نفر نشون میده متصل هستند و آمار دقیق تر هست
با سپاس از هوشمند عزیر بابت این اسکریپت

Own Script

Is it possible to assign this system to my own script or it is working with only marzban?

"Node number x doesn't work" message can be deleted.

سلام.
بعد از اینکه مرزبان قابلیت Enable/Disable نود ها رو اضافه کرده، بعضی نود ها که Disable هستن همچنان با اسکریپت V2IPLimit این پیام براشون ارسال میشه.
بنظرم اگر طوری بشه که نود های Disable تشخیص داده بشن و این پیام براشون ارسال نشه خیلی بهتر میتونه باشه.

سوال

سلام وقت بخیر

من دو بار اسکنر فعال کردم این مشکلی نداره که؟یا چطوری میتونم یدونش قطع کنم.

چه کامند های برای بات تلگرام هست ممنون میشم راهنمایی کنید؟

telegram notification

درود با عرض خسته نباشید
من وقتی اسکریپت رو به صورت عادی ران میکنم بدون هیچ مشکلی تا ساعت ها کار میکنه ولی وقتی
"SEND_LOGS_TO_TEL": "True"
روشن میکنم چند تای اولی رو درست میفرسته توی تلگرام ولی بعد از چند تا این ارور رو میده

-----run------
Traceback (most recent call last):
  File "/root/V2IpLimit/Marzban/v2_ip_limit.py", line 627, in <module>
    job()
  File "/root/V2IpLimit/Marzban/v2_ip_limit.py", line 501, in job
    file.write(str(user_ip))
UnboundLocalError: local variable 'user_ip' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/V2IpLimit/Marzban/v2_ip_limit.py", line 631, in <module>
    send_logs_to_telegram(ex)
  File "/root/V2IpLimit/Marzban/v2_ip_limit.py", line 106, in send_logs_to_telegram
    messages = message.split("\n")
AttributeError: 'UnboundLocalError' object has no attribute 'split'

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

A Command for Telegram Bot for Last Usage Time of A User

Hello again,

I know I have already asked you for a lot of features and you added them kindly :)
I just have an idea, if you don't have enough time to do it, I totally understand.

I think The Logs also state the last time a user has connected so it would be nice to add a command for telegram bot to know the last time a user has connected, something like this:
/UsageTime Username
Last Time Active: 13-06-23 I 02:10:00

I believe it can enhance the script, it would be a cool feature but the choice is yours.
Thank you again for everything you've done bro!

مشکل در اتصال به سرور برای گرفتن لاگ

سلام، الان چهار پنج روزی هست که این رو روی یه سرور مجزا نصب کردم، تقریباً بعد از یک روز ارتباط با سرور اصلی قطع میشه و بعد هر ده ثانیه تلاش میکنه که وصل بشه و بنابراین هزاران پیام میاد، معمولا وقتی اینجوری میشه میرم توی سرور و یه بار استاپ میکنم و دوباره استارت ، بعدش دوباره وصل میشه و کار میکنه بدون مشکل. این اتفاق تقریباً هر روز می‌افته، کار دیگه ای هست که باید انجام داد، که من انجام ندادم؟

load balance and tunnel(iptables) problem

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

Bug

Hello Again,

The script doesn't enable users after they have exceeded the IP Limit.
It only disables them but doesn't enable them after the 4 minutes.

Seperate Logs of Multiple VPS on 1 Telegram Bot

Hello there!
I hope you are doing great!
First of all, I wanna thank everyone who has helped in this amazing project.

I was wondering if we could add a tag in the log to seperate it from other servers logs in telegram bot, I am using the same telegram bot for multiple servers in terms of logs and it's hard to know which one is for which server so if we could add a tag or a letter, anything to seperate the logs of each server it would be really amazing!!!

Please let me know what you think,
Thanks a lot :)

مشکل در نود

با سلام

ممنون از اسکریپت خوبتون فقط مشکلی که من دارم این هست که داخل تلگرام به من ارور Node number 1 doesn't work میده و بنده 3 تا نود دارم و لیمیت آی پی اعمال نمیشه

راه حلی برای این موضوع هستش؟

خروجی اسکریپت

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

file_name = "user_ip.txt"
    with open(file_name, "w") as file:
        file.write(str(user_ip))
    مقدار آخری رو چی بزارم که کل ایپی های متصل رو ذخیره کنه برام تو فایل
    
    با تشکر

Report a Bug (probably)

Hello and good day,

I've run the script and it's been working like a charm, thank you.

There is just one thing I noticed, when TIME_TO_CHECK is set to for example 300 and INACTIVE_DURATION is set to 240 the script does check for connections every 5 minutes and disable users who exceed the limit BUT it enables them way sooner than 4 minutes (what I observed through telegram logs was around a minute or so). I tried different timings, updating python to the latest version and even rerunning the screen after making changes to config.json file but the problem still persists.

I would appreciate if you address this issue since I'm not sure if it is because of my VPS configuration or the code itself, thanks.

It only shows some online users not all of them

Hi , I'm using the last version of marzban panel and encounter this problem that it only shows some online users not all of them. I thought maybe it could be IP_Location problem so I deleted that line from py file, the result was it showed all online users but with too many IPs (about 2-50) which as I checked are cloudflare lPs.
I live in Iran and I'm not using tunnel.
Can you help me to fix this problem?

Node Notification

Hello Houshmand
I hope you're doing great!

As I am aware, when the logs are sent to telegram, it also notifies us of a certain node being disconnected which is what I am looking for. Now this problem might not be something everyone has faced but I believe it's a really good feature.

I want the log that is sent to telegram to contain only node notification not the IP Limit log. Like if a certain node is on a status except "connected" It would notify in the telegram bot. The two statuses are "Connecting" and "Error" which is seen whenever a node has some sort of problem.

I know this is not directly relevant to the project you have here but is it possible to have such a thing?

Please let me know,
I really appreciate it!

main server doesn't work

سلام. من همه مراحل رو به دقت پیش رفتم ولی خطای main server doesn't work میگیرم. دلیل و راهکارش چیه؟
server rejected WebSocket connection: HTTP 400
main server doesn't work

Telegram getUpdates Unauthorized

Hi thanks for your script,

When I first deploy it i faced with such issue

https://api.telegram.org/<token>/getUpdates {'offset': None, 'timeout': 30}
{'ok': False, 'error_code': 401, 'description': 'Unauthorized'}

But other telegram funtions such as send_logs_to_telegram works well. So i add debug to dig into the code and found out this issue:

https://api.telegram.org/<token_part>GvALpM/sendMessage - send_logs_to_telegram
https://api.telegram.org/<token_part>GvALp/getUpdates {'offset': None, 'timeout': 30} - get_updates

M - is missing due to rstrip("/sendMessage"). M is also in rstrip. Issue on StackOverflow

نمایش کابران حذف شده

سلام و ممنون بابت این اسکریپت خوب، طبق تست‌هایی که امروز انجام دادم متوجه شدم کاربرانی که لیمیت شدن ولی پاک شدن و دیگه وجود ندارن هنوز توی لیست محدود شده ها میان، میشه لطفاً این ویژگی رو اضافه کنید که اگر کاربری دیگه وجود نداره اون رو از لیست محدود شده ها حذف کنه؟ من حتی اومدم اون کاربر حذف شده رو توی لیست except یا همون استثنا قرار دادم ولی بازم توی لیست محدود شده ها هم نشون میده.

Ipv6

عرض سلام و خسته نباشید
مرسی از اسکریپت خوبتون ، خیلی کاربردیه
فقط یه موردی که بهش برخوردم اینه که برنامه ipv6 رو شناسایی نمیکنه
توی xray-log آی پی هارو میزنه اما اسکریپت اونارو شناسایی نمیکنه

مشکل در کانکشن های دیزیبل

سلام
اول که تشکر بابت اسکریپت کاربردی که نوشتید
فقط یه مشکل هست
همه چی به درستی کار میکنه و تشخیص میده که دوتا IP الان به یه کانکشن وصل هستن
کانشکن رو هم disable میکنه
ولی با اینکه کانکشن دیزیبل هست اما هر دو گوشی که باهاشون وصل بودم و باعث این دیزیبلی شدن
هر دو به سرور وصل میمونن
یعنی با اینکه کانکشن دیزیبل شده ولی ارتباطی قطع نمیشه (خیلی عجیبه)

مشکل در چک کردن نود ( ورژن dev)

درود بر شما
Failed to connect to this node [node id: 4] [node name: Germany-Node1] [node ip: xxx.xxxxx.xxx] [node status: connected] [node message: None] trying to connect 10 second later!

این ارور به تلگرام میفرسته در حالیکه نود کانکت و بدون مشکل داره کار میکنه

Running This on Windows

Hi

I was wondering how I can run this on my windows locally instead of linux.
Can you please guide me through It if It's possible?

I really appreciate It.

script can not detect ipv6

Hello
Thanks for your useful script.
The script works well for users that connected by ipv4 but some ISPs like irancell use ipv6 by default and script can not detect them. maybe it is because of x-ray core or... . please fix this issue or if it is not an issue of the script give me some fix tips.

Error HTTP 400

I run the code but i see this error:

Establishing connection for node number 1
no close frame received or sent
server rejected WebSocket connection: HTTP 400
Node number 1 doesn't work
Establishing connection for node number 2
no close frame received or sent
server rejected WebSocket connection: HTTP 400

what is the problem?!

Unintentionally stopping the script automatically

سلام.
اسکریپت بعد از حدود 24ساعت کار کردن، از کار افتاد و نیاز به استاپ و استارت از طریق کامند لاین داشت تا دوباره فعال بشه.
لاگش رو میفرستم براتون:

INFO - HTTP Request: POST https://mydomain.com/api/admin/token "HTTP/1.1 200 OK"
INFO - HTTP Request: GET https://mydomain.com/api/nodes "HTTP/1.1 200 OK"
INFO - HTTP Request: POST https://api.telegram.org/bot[token]/getUpdates "HTTP/1.1 200 OK"
ERROR - An unexpected error occurred:
ERROR - Failed to get token. make sure the panel is running and the username and password are correct.

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

مشکل در شناسایی اتصال نود های مرزبان

سلام و خسته نباشید، خیلی ممنون بخاطر اسکریپت خوبتون من یکهفتس با اینکه نود هام داخل پنل وصل شده کامل ولی داخل ربات ارور Node number X doesn't work میگیرم لاگ رو هم که چک کردم این عبارت زیر رو دیدم، ممنون میشم راهنمایی کنید.
did not receive a valid HTTP response

بازم میگم نود ها بدون مشکل وصل هستن و کار میکنن...

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.