Hazza3100 / Webshare-Formatter

Webshare Formatter that swaps around the format of ip:port:user:pass to user:pass@ip:port
4 stars 1 forks source link

remake #1

Open V4rial opened 2 months ago

V4rial commented 2 months ago
class Formatter:
    def __init__(self):
        pass

    @staticmethod
    def format(value, username="default_user", password="default_pass"):
        try:
            with open(value) as f:
                lines = f.read().split('\n')
            formatted_lines = []
            for line in lines:
                if line.strip():
                    parts = line.split(':')
                    if len(parts) == 2:
                        ip, port = parts
                        formatted_line = '{}:{}@{}:{}\n'.format(username, password, ip, port)
                        formatted_lines.append(formatted_line)
                    else:
                        print(f"wrong format and u r animal: {line}")

            with open('formatted.txt', 'w') as f:
                f.writelines(formatted_lines)

            print("Gratz you did IT!")

        except Exception as e:
            print(f"An error has occured: {e}")

# add your shit proxy format
Formatter().format('proxy.txt', username="user", password="password")

thanks for the code Lol
Hazza3100 commented 2 months ago

Want to make a pull?