Skip to content

Commit

Permalink
V3.4
Browse files Browse the repository at this point in the history
improve porn detection
optimize phone detection
  • Loading branch information
wikm360 committed Jun 16, 2024
1 parent 6370549 commit 840b22b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 64 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@

design.txt
detect port scan.py
detect Repeated IP Addresses and Ports.py
detect suspect domain and IPs.py
test.txt
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ What does this bot do?
10) most ulr used per user
11) calculate and send The most used user
12) send users usage ( get with mysql and marzban API )
13) send most versatile user (in porn sites)
14) send most thirsty user (in porn sites)
13) send user who has the most request in shortest time (versatile person) (in porn sites)
14) send user who spend the longest period in one domain (thirsty person) (in porn sites)
15) detect suspicious Domains and IPs and report by telegram

more features coming 🔜

Expand All @@ -44,7 +45,7 @@ Before installing the required libraries, you must first install Python and pip
First, download and extract the project with the following command :

```bash
wget https://github.com/wikm360/Xray-Log-Analyzer/releases/download/V2.7/Xray-Log-Analyzer.zip
wget https://github.com/wikm360/Xray-Log-Analyzer/releases/latest/download/Xray-Log-Analyzer.zip
unzip Xray-Log-Analyzer.zip -d /root/Xray-Log-Analyzer
cd Xray-Log-Analyzer/
```
Expand Down
77 changes: 16 additions & 61 deletions base.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,71 +134,34 @@ def analize () :


#porn detection :
pattern_porn = r"\b\w*\s*porn\s*\w*\b"
if re.findall(pattern_porn, line_str):
with open (f"{path}porn_detection.txt" , "a" , encoding="utf-8") as file :
file.writelines(line_str)
if user not in p_user :
p_user.append(user)

pattern_porn = r"\b\w*\s*xnxx\s*\w*\b"
if re.findall(pattern_porn, line_str):
with open (f"{path}porn_detection.txt" , "a" , encoding="utf-8") as file :
file.writelines(line_str)
if user not in p_user :
p_user.append(user)

pattern_porn = r"\b\w*\s*xvideos\s*\w*\b"
if re.findall(pattern_porn, line_str):
with open (f"{path}porn_detection.txt" , "a" , encoding="utf-8") as file :
file.writelines(line_str)
if user not in p_user :
p_user.append(user)

pattern_porn = r"\b\w*\s*sex\s*\w*\b"
if re.findall(pattern_porn, line_str):
with open (f"{path}porn_detection.txt" , "a" , encoding="utf-8") as file :
file.writelines(line_str)
if user not in p_user :
p_user.append(user)

pattern_porn = r"\b\w*\s*brazzer\s*\w*\b"
pattern_porn = r"\b\w*\s*(porn|xnxx|xvideos|sex|brazzer|xxx|erotica|hardcore|BDSM|fetish|Nude|NSFW|PNP|CYOC|OnlyFans|camgirl|webcam)\s*\w*\b"
if re.findall(pattern_porn, line_str):
with open (f"{path}porn_detection.txt" , "a" , encoding="utf-8") as file :
file.writelines(line_str)
if user not in p_user :
p_user.append(user)

# phone detection :
xiaomi_pattern = r"\b\w*\s*xiaomi\s*\w*\b"
samsung_pattern = r"\b\w*\s*samsung\s*\w*\b"
pattern = r"\b\w*\s*(xiaomi|samsung|dbankcloud)\s*\w*\b"
matches = re.findall(pattern, line_str)
if matches :
print(matches)
if user not in user_phone:
user_phone[user] = ["0"]
for match in matches:
if match in ["xiaomi", "samsung"] and match not in user_phone[f"{user}"]:
user_phone[user].append(match)
if match == "dbankcloud" and "huawei" not in user_phone[f"{user}"]:
user_phone[user].append("huawei")

apple_pattern = r"\b\w*\s*gsp\s*\w*\b"
apple_pattern_2 = r"\b\w*\s*apple\s*\w*\b"
huawei_pattern = r"\b\w*\s*dbankcloud\s*\w*\b"
if re.findall(xiaomi_pattern, line_str):
if user not in user_phone :
user_phone[f"{user}"] = ["0"]
if "xiaomi" not in user_phone[f"{user}"] :
user_phone[f"{user}"].append("xiaomi")

if re.findall(samsung_pattern, line_str):
if user not in user_phone :
user_phone[f"{user}"] = ["0"]
if "samsung" not in user_phone[f"{user}"] :
user_phone[f"{user}"].append("samsung")

if re.findall(apple_pattern, line_str):
if re.findall(apple_pattern_2 , line_str) :
if user not in user_phone :
user_phone[f"{user}"] = ["0"]
if "apple" not in user_phone[f"{user}"] :
user_phone[f"{user}"].append("apple")

if re.findall(huawei_pattern, line_str):
if user not in user_phone :
user_phone[f"{user}"] = ["0"]
if "huawei" not in user_phone[f"{user}"] :
user_phone[f"{user}"].append("huawei")

# specific inbound detector :
inbound_pattern = re.search(r"VMESS\s+\+\s+TCP", line_str, flags=re.IGNORECASE)
Expand All @@ -207,16 +170,6 @@ def analize () :
inbound_user.append(user)


# port scan detection :
# ip_port = line[2]
# ip = ip_port.split(":")[0]
# port = ip_port.split(":")[1]
# if ip == before_ip :
# if port != before_port :
# file_path = f"{path_user}port_scan_detection.txt"
# with open(file_path , "a") as file :
# file.writelines(line_str)

line_str = " "

print(count)
Expand Down Expand Up @@ -497,7 +450,9 @@ def clear_def() :
except :
pass

send_telegram_message("Done...Created by @wikm360 with ❤️...V3.0")
send_telegram_message('''🇩​​🇴​​🇳​​🇪​
< ​🇨​​🇷​​🇪​​🇦​​🇹​​🇪​​🇩​ ​🇧​​🇾​ @wikm360 ​🇼​​🇮​​🇹​​🇭​ ❤️ >
​🇻​3️⃣.4️⃣''')


def main() :
Expand Down

0 comments on commit 840b22b

Please sign in to comment.