Skip to content

win_acc.py

LopeKinz edited this page Jul 6, 2023 · 1 revision

win_acc.py

This document provides an overview of the win_acc.py module, which is used for creating user accounts on a Windows system. The module contains a class called AccountCreator and a main function that utilizes multi-threading to create multiple user accounts simultaneously.

Code

import random
import subprocess
import threading

config = {
    "Threads": 10,
    "AccountNames": "Penis,IloveDick,Idk"
}

class AccountCreator:
    def __init__(self, accname):
        self.accname = accname

    def create_account(self):
        new = ''.join(random.choice(9999) for _ in range(5))
        try:
            print(f"Adding new user: {self.accname}{new}")
            subprocess.os.system(f'net user {self.accname}{new} {self.accname}{new} /add')
            print(f"Successfully added new user! User: {self.accname}{new}")
        except:
            print('Failed!')

def loop(accname):
    account_creator = AccountCreator(accname)
    account_creator.create_account()

def main():
    threads = []
    for v in range(config['Threads']):
        account_names = config['AccountNames'].split(',')
        t = threading.Thread(target=loop, args=(account_names,))
        threads.append(t)
        t.start()

    for t in threads:
        t.join()

if __name__ == '__main__':
    main()

Description

The win_acc.py module allows for the creation of user accounts on a Windows system using multi-threading. Here is an explanation of the different parts of the code:

  • The config dictionary stores the configuration settings, including the number of threads to be used (Threads) and the account names to be created (AccountNames).

  • The AccountCreator class represents an account creator object. It has an __init__ method that initializes the accname attribute with the provided account name. The create_account method generates a random number, appends it to the account name, and then uses the subprocess module to execute the net user command, creating a new user account with the generated username and password. If an exception occurs during the account creation process, a failure message is printed.

  • The loop function is called by each thread and takes an account name as a parameter. It creates an instance of the AccountCreator class and calls its create_account method.

  • The main function is the entry point of the module. It initializes an empty list, threads, to store the thread objects. It iterates config['Threads'] times, splitting the account names from config['AccountNames'] using a comma separator. For each account name, a new thread is created, targeting the loop function with the account name as an argument. The thread is added to the threads list and started. Finally, the main thread waits for all the threads to finish using the join method.

  • The if __name__ == '__main__' block ensures that the main function is only executed when the module is run directly, not when it is imported as a module by another script.

Please note that the code provided should be tested thoroughly before using it in a production environment.

Clone this wiki locally