From f094587b5dd2192023ddfefa29b14cbd99ef5db8 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 8 Oct 2022 01:11:19 +0700 Subject: [PATCH] IP_List_generator : [experimental] combine module init --- IP_List_generator/ip_gen.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/IP_List_generator/ip_gen.py b/IP_List_generator/ip_gen.py index b5b8e73..20e6d68 100644 --- a/IP_List_generator/ip_gen.py +++ b/IP_List_generator/ip_gen.py @@ -54,6 +54,31 @@ def htaccess(input, output): else: pass + +""" +Must be in IP List Format!! +""" +def combine(destination, fileadd): + # Append List + with open(fileadd ,'r') as f: + readinput = f.read().splitlines() + with open(destination, 'a') as f: + for line in readinput: + f.write(line + "\n") + f.close() + # Clear Duplicated + with open(destination, 'r') as f: + lines = set(f.readlines()) + with open(destination, 'w') as f: + f.writelines(set(lines)) + f.close() + # Sort + with open(destination, 'r') as f: + lines = sorted(f.readlines()) + with open(destination, 'w') as f: + for line in lines: + f.write(line) + def BuildDate(): UTC = pytz.utc date = datetime.datetime.now(UTC)