forked from Jrohy/multi-v2ray
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
74 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
PORT=$1 | ||
|
||
[[ $# == 0 ]] && exit 1 | ||
|
||
clean_traffic(){ | ||
local TYPE=$1 | ||
RESULT=$(iptables -nvL $TYPE --line-numbers|grep -w "$PORT"|awk '{print $1}') | ||
echo "$RESULT" | while read LINE | ||
do | ||
[[ ${LINE} ]] && iptables -Z $TYPE $LINE | ||
done | ||
} | ||
|
||
clean_traffic INPUT | ||
clean_traffic OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
import os | ||
|
||
from loader import Loader | ||
from utils import color_str, Color, is_number, calcul_iptables_traffic | ||
|
||
loader = Loader() | ||
|
||
profile = loader.profile | ||
|
||
group_list = profile.group_list | ||
|
||
while True: | ||
print("{} 端口流量统计".format(color_str(Color.BLUE, "Iptables"))) | ||
print("1.查看流量统计\n") | ||
print("2.重置流量统计\n") | ||
print("tip: 默认全部v2端口都开启iptables的流量统计, 重启vps会全部重置!!!\n") | ||
|
||
choice = input("请输入数字选择功能:") | ||
if choice == "1": | ||
for group in group_list: | ||
print(calcul_iptables_traffic(group.port)) | ||
|
||
elif choice == "2": | ||
port = input("请输入要重置流量的端口:") | ||
if port and is_number(port): | ||
os.system("bash /usr/local/multi-v2ray/global_setting/clean_traffic.sh {}".format(str(port))) | ||
else: | ||
print(color_str(Color.RED, "输入有误!")) | ||
else: | ||
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters