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
#! /usr/bin/env python3.10 | |
""" | |
This module is used for detecting motion, and then recording, streaming and sending an SMS. | |
Install packages beforehand via: `pip install khayyam pytz requests opencv-python` | |
FFmpeg is required for streaming, and it should be in your PATH. | |
Remember to fill in these items: | |
- streaming link: line 66 | |
- SMS sender and receivers numbers: line 69 |
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
#! /usr/bin/env python3 | |
""" | |
This module is used for checking IP GeoLocations of users. | |
Install Pandas and Requests beforehand via: `pip install pandas requests` | |
Also remember to enter your API key in line 26. | |
Sample Command: | |
$ sudo journalctl -u xray --since "5 min ago" | grep "admin" | cut -d " " -f 6,7,8 | python3 ip.py - |
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
#! /usr/bin/env python3.10 | |
""" | |
This module is used for checking V2Ray traffic consumption. | |
Install Pandas beforehand via: `pip install pandas` | |
Sample Command: | |
$ xray api statsquery --server="127.0.0.1:10085" -pattern '' | python3 traffic.py - | |
GitHub: https://github.com/Mahyar24/V2Conf |
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
#! /usr/bin/env python3.10 | |
""" | |
This module is used for checking excessive use by V2Ray users. | |
Install Polars beforehand via: `pip install polars` | |
Sample Command: | |
$ journalctl -u v2ray --since "72 h ago" | grep email | cut -d " " -f 6,7,8,13 | python abnormal.py - | |
GitHub: https://github.com/Mahyar24/V2Conf | |
[email protected], Mon 28 Nov 2022 | |
""" |
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
import math | |
from functools import cache | |
from typing import Optional | |
@cache | |
def is_prime(n: int, primes: tuple[int]) -> bool: | |
sqrt = math.floor(math.sqrt(n)) | |
for i in primes: |
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
import math | |
from concurrent.futures import ProcessPoolExecutor, as_completed | |
from typing import Callable | |
def cut_list(data: list, n: int): | |
for i in range(1, math.ceil(len(data) / n) + 1): | |
yield data[(i - 1) * n: i * n] | |
def parallelize(func: Callable, inputs: list, n: int): |
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
#! /usr/bin/python3.10 | |
""" | |
This module is used for checking excessive use by V2Ray users. | |
Install Pandas beforehand via: `pip install pandas` | |
Sample Command: | |
$ journalctl -u v2ray --since "72 h ago" | grep email | cut -d " " -f 6,7,8,13 | python abnormal.py - | |
GitHub: https://github.com/Mahyar24/V2Conf |
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
import time | |
import pandas as pd | |
def pretty_time(sec: int) -> str: | |
return time.strftime("%H:%M:%S", time.gmtime(sec)) | |
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
import time | |
import pandas as pd | |
def pretty_time(sec: int) -> str: | |
return time.strftime("%H:%M:%S", time.gmtime(sec)) | |
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
import time | |
import pandas as pd | |
def pretty_time(sec: int) -> str: | |
return time.strftime("%H:%M:%S", time.gmtime(sec)) | |
NewerOlder