zdgtl 2 months ago
zdgtl #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")



0
130
Wordpress Auto Post via XMLRPC

Wordpress Auto Post via XMLRPC

defaultuser.png
zdgtl
2 months ago
Cara Install C9 di Ubuntu

Cara Install C9 di Ubuntu

defaultuser.png
zdgtl
2 months ago
Wordpress adduser PHP script

Wordpress adduser PHP script

defaultuser.png
zdgtl
3 months ago
Cara Menghapus baris duplikat atau baris ganda

Cara Menghapus baris duplikat atau baris ganda

defaultuser.png
zdgtl
3 months ago
Woodmart Content modify

Woodmart Content modify

defaultuser.png
zdgtl
2 months ago