-
Notifications
You must be signed in to change notification settings - Fork 0
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.
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()
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 theaccname
attribute with the provided account name. Thecreate_account
method generates a random number, appends it to the account name, and then uses thesubprocess
module to execute thenet 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 theAccountCreator
class and calls itscreate_account
method. -
The
main
function is the entry point of the module. It initializes an empty list,threads
, to store the thread objects. It iteratesconfig['Threads']
times, splitting the account names fromconfig['AccountNames']
using a comma separator. For each account name, a new thread is created, targeting theloop
function with the account name as an argument. The thread is added to thethreads
list and started. Finally, the main thread waits for all the threads to finish using thejoin
method. -
The
if __name__ == '__main__'
block ensures that themain
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.