Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
SirGankalot committed Jun 23, 2024
1 parent 15b1461 commit 4578cd8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
12 changes: 6 additions & 6 deletions checker/src/checker_util_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ async def create_user(
# For later documentation this seed has to be set random because of threading issues from checker exploit 0 and 1 which generate the same email if seed is used normaly (seed exploit?)
random.seed(random.SystemRandom().random())
email = "".join(random.choices(string.ascii_letters + string.digits, k=20)) + "@example.com"
firstName = "".join(random.choices(string.ascii_letters + string.digits, k=20))
name = "".join(random.choices(string.ascii_letters + string.digits, k=20))
password1 = "".join(random.choices(string.ascii_letters + string.digits, k=20))
password2 = password1
logger.info(f"Creating user with email: {email} firstName: {firstName} password1: {password1} password2: {password2}")
logger.info(f"Creating user with email: {email} name: {name} password1: {password1} password2: {password2}")
logger.info(f"public_key on?: {public_key}")

response = await client.post(
"/sign-up",
data={
"email": email,
"firstName": firstName,
"name": name,
"public_key": public_key,
"password1": password1,
"password2": password2,
Expand Down Expand Up @@ -594,17 +594,17 @@ async def create_user_backup(
# For later documentation this seed has to be set random because of threading issues from checker exploit 0 and 1 which generate the same email if seed is used normaly (seed exploit?)
random.seed(random.SystemRandom().random())
email = "".join(random.choices(string.ascii_letters + string.digits, k=20)) + "@scam.com"
firstName = "".join(random.choices(string.ascii_letters + string.digits, k=20))
name = "".join(random.choices(string.ascii_letters + string.digits, k=20))
password1 = "".join(random.choices(string.ascii_letters + string.digits, k=20))
password2 = password1
logger.info(f"Creating user with email: {email} firstName: {firstName} password1: {password1} password2: {password2}")
logger.info(f"Creating user with email: {email} name: {name} password1: {password1} password2: {password2}")
logger.info(f"public_key on?: {public_key}")

response = await client.post(
"/sign-up",
data={
"email": email,
"firstName": firstName,
"name": name,
"public_key": public_key,
"password1": password1,
"password2": password2,
Expand Down
12 changes: 6 additions & 6 deletions exploit/ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ def generate_random_string(length):


def register():
firstName = generate_random_string(20)
email = firstName + "@" + generate_random_string(20) + ".scamfffffffff"
name = generate_random_string(20)
email = name + "@" + generate_random_string(20) + ".scamfffffffff"
password1 = generate_random_string(20)
password2 = password1
public_key = "on"
#public_key = "None"
data = {'email': email, 'firstName': firstName, 'public_key': public_key,
data = {'email': email, 'name': name, 'public_key': public_key,
'password1': password1, 'password2': password2}
data['vendor_lock'] = 'on'
data['never_full'] = 'on'
Expand All @@ -62,13 +62,13 @@ def register():


def spam_messages():
firstName = generate_random_string(20)
email = firstName + "@" + generate_random_string(20) + ".scamfffffffff"
name = generate_random_string(20)
email = name + "@" + generate_random_string(20) + ".scamfffffffff"
password1 = generate_random_string(20)
password2 = password1
public_key = None
#public_key = "None"
data = {'email': email, 'firstName': firstName, 'public_key': public_key,
data = {'email': email, 'name': name, 'public_key': public_key,
'password1': password1, 'password2': password2}
data['vendor_lock'] = 'on'
data['never_full'] = 'on'
Expand Down
8 changes: 4 additions & 4 deletions service/src/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async def logout():
async def sign_up():
if request.method == 'POST':
email = request.form.get('email')
first_name = request.form.get('firstName')
name = request.form.get('name')
password1 = request.form.get('password1')
password2 = request.form.get('password2')
#to be changed
Expand All @@ -90,7 +90,7 @@ async def sign_up():
flash('Email already exists.', category='error')
elif len(email) < 4:
flash('Email must be greater than 3 characters.', category='error')
elif len(first_name) < 2:
elif len(name) < 2:
flash('First name must be greater than 1 character.', category='error')
elif password1 != password2:
flash('Passwords don\'t match.', category='error')
Expand Down Expand Up @@ -118,7 +118,7 @@ async def sign_up():
for j in text:
final_private_key_text += j

new_user = User(email=email, first_name=first_name, private_key=private_key, public_key=public_key, public_key_name = final_text, private_key_name = final_private_key_text ,password= password1, time = datetime.datetime.now())
new_user = User(email=email, name=name, private_key=private_key, public_key=public_key, public_key_name = final_text, private_key_name = final_private_key_text ,password= password1, time = datetime.datetime.now())
db.session.add(new_user)
db.session.commit()
login_user(new_user, remember=True) # missing await?
Expand All @@ -127,7 +127,7 @@ async def sign_up():
else:
private_key = None
public_key = None
new_user = User(email=email, first_name=first_name, private_key=private_key, public_key=public_key, password= password1, time = datetime.datetime.now())
new_user = User(email=email, name=name, private_key=private_key, public_key=public_key, password= password1, time = datetime.datetime.now())
db.session.add(new_user)
db.session.commit() #await?
login_user(new_user, remember=True) # missing await?
Expand Down
2 changes: 1 addition & 1 deletion service/src/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(150), unique=True)
password = db.Column(db.String(150))
first_name = db.Column(db.String(150))
name = db.Column(db.String(150))
message = db.relationship('Message', backref='owner', lazy=True)
private_key = db.Column(db.String(255), unique=True)
public_key = db.Column(db.String(255), unique=True)
Expand Down
2 changes: 1 addition & 1 deletion service/src/templates/profil.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h1 align="center">Profil</h1>
<div style="word-wrap: break-word;">
<ul class="list-group list-group-flush" id="userlist">
<li class="list-group-item">Email: {{ user.email }}</li>
<li class="list-group-item">First Name: {{ user.first_name }}</li>
<li class="list-group-item">Name: {{ user.name }}</li>
<li class="list-group-item">Status: {{ user.status }}</li>
</ul>
</div>
Expand Down
8 changes: 4 additions & 4 deletions service/src/templates/sign_up.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ <h3 align="center">Sign Up</h3>
/>
</div>
<div class="form-group">
<label for="firstName">First Name</label>
<label for="name">Name</label>
<input
type="text"
class="form-control"
id="firstName"
name="firstName"
placeholder="Enter first name"
id="name"
name="name"
placeholder="Enter name"
/>
</div>
<!-- To be changed -->
Expand Down

0 comments on commit 4578cd8

Please sign in to comment.