Compare commits

...

1 Commits

Author SHA1 Message Date
pixeebot[bot]
6c2da10eaa
Secure Source of Randomness 2024-06-15 10:28:21 +00:00
2 changed files with 133 additions and 133 deletions

View File

@ -8,9 +8,9 @@ from flask import send_file, jsonify
import datetime import datetime
import shutil import shutil
import json import json
import random
import sys import sys
import re import re
import secrets
class Capture(object): class Capture(object):
@ -31,7 +31,7 @@ class Capture(object):
# Few context variable assignment # Few context variable assignment
self.capture_token = "".join( self.capture_token = "".join(
[random.choice(self.random_choice_alphabet) for i in range(8)]) [secrets.choice(self.random_choice_alphabet) for i in range(8)])
self.capture_dir = "/tmp/{}/".format(self.capture_token) self.capture_dir = "/tmp/{}/".format(self.capture_token)
self.assets_dir = "/tmp/{}/assets/".format(self.capture_token) self.assets_dir = "/tmp/{}/assets/".format(self.capture_token)
self.pcap = self.capture_dir + "capture.pcap" self.pcap = self.capture_dir + "capture.pcap"

View File

@ -9,13 +9,13 @@ import sys
import time import time
import qrcode import qrcode
import base64 import base64
import random
import requests import requests
from wifi import Cell from wifi import Cell
from os import path, remove from os import path, remove
from io import BytesIO from io import BytesIO
from app.utils import terminate_process, read_config from app.utils import terminate_process, read_config
import secrets
class Network(object): class Network(object):
@ -170,14 +170,14 @@ class Network(object):
# Generate the hostapd configuration # Generate the hostapd configuration
if read_config(("network", "tokenized_ssids")): if read_config(("network", "tokenized_ssids")):
token = "".join([random.choice(self.random_choice_alphabet) token = "".join([secrets.choice(self.random_choice_alphabet)
for i in range(4)]) for i in range(4)])
self.AP_SSID = random.choice(read_config( self.AP_SSID = secrets.choice(read_config(
("network", "ssids"))) + "-" + token ("network", "ssids"))) + "-" + token
else: else:
self.AP_SSID = random.choice(read_config(("network", "ssids"))) self.AP_SSID = secrets.choice(read_config(("network", "ssids")))
self.AP_PASS = "".join( self.AP_PASS = "".join(
[random.choice(self.random_choice_alphabet) for i in range(8)]) [secrets.choice(self.random_choice_alphabet) for i in range(8)])
# Launch hostapd # Launch hostapd
if self.write_hostapd_config(): if self.write_hostapd_config():