Coderja 2 days ago
Coderja #coding

Logs Cleaner

Membersihkan Logs dan menyimpan yang di butuhkan saja

import re
import glob

# Define the patterns to search for and exclude
patterns = [
    {"pattern": r'wp-login\.php', "exclude_pattern": r'127\.0\.0|localhost|\.local|needrom|addon|UNKNOWN|null|000webhost|wordpress\.com|192\.168', "result_file": "wordpress.text"},
    {"pattern": r'\/wp-admin\/', "exclude_pattern": r'127\.0\.0|localhost|\.local|needrom|addon|UNKNOWN|null|000webhost|wordpress\.com|192\.168', "result_file": "wp-admin.text"},
    {"pattern": r'hostinger|weblink\.com\.br|hosting24\.com', "exclude_pattern": r'mail\.hostinger|webmail\.hostinger|webmail1|titan\.email|NOT_SAVED|UNKNOWN|joomla|needrom|null|telnet|fakepassword', "result_file": "hostinger.text"}
]

# Find all.txt files in the current directory
txt_files = glob.glob('*.txt')

# Iterate over the patterns
for pattern_dict in patterns:
    pattern = pattern_dict["pattern"]
    exclude_pattern = pattern_dict["exclude_pattern"]
    result_file = pattern_dict["result_file"]

    # Open the result file in append mode
    with open(result_file, 'a', encoding='utf-8') as result_file:
        for file in txt_files:
            with open(file, 'r', encoding='utf-8', errors='ignore') as f:
                for num, line in enumerate(f, 1):
                    if re.search(pattern, line) and not re.search(exclude_pattern, line, re.IGNORECASE):
                        result_file.write(f"{line.strip()}\n")



Installing Plugin JWT and Activate

defaultuser.png
Coderja
5 days ago
Reverse Complex String Using Regex

Reverse Complex String Using Regex

defaultuser.png
Coderja
1 week ago
Video Thumbnail Generator

Video Thumbnail Generator

defaultuser.png
Coderja
1 week ago

Menghilangkan Spasi Di depan Baris

Menghilangkan spasi di awal baris menggunakan regex notepad++

defaultuser.png
Coderja
17 hours ago

Fungsi PHP Sederhana

defaultuser.png
Coderja
1 week ago