Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



   260

extractor solution

by BoDJa - 23 April, 2024 - 11:43 AM
This post is by a banned member (BoDJa) - Unhide
BoDJa  
Heaven
3.173
Posts
1.698
Threads
7 Years of service
#1
(This post was last modified: 23 April, 2024 - 03:31 PM by BoDJa. Edited 1 time in total.)
i have a file that has this format:
Code:
SOFT: Mozilla Firefox
URL: https://account.live.com
USER: mchd3233elecrazy@hotmail.com
PASS: jhonataaz22n200417

and i want to extract only email and password
like this screenshot
[Image: PxJl7gE.png]
Ticketmaster Accounts Aged 2002 - 2020 With Your numbers

[Image: 0Bl9S0A.gif]
This post is by a banned member (UberFuck) - Unhide
UberFuck  
Godlike
1.554
Posts
375
Threads
6 Years of service
#2
Quick python script to put it in user:pass format.
Code:
from dataclasses import dataclass

@dataclass
class UserCombo:
    username: str
    password: str

def ParseText(text: str):
    rtype, rval = None, None
    if ':' in text:
        rtype, rval = text.split(':', 1)
        return rtype.strip(), rval.strip()
    return None, None

def ParseFile(filePath: str) -> list[UserCombo]:
    data, usercombos = [], []
    with open(filePath, 'r', encoding='utf8') as f:
        data = f.readlines()
    currentCombo = UserCombo(None, None)
    for line in data:
        elem, val = ParseText(line)
        if elem == 'USER':
            currentCombo.username = val
        elif elem == 'PASS':
            currentCombo.password = val
        if currentCombo.username and currentCombo.password:
            usercombos.append(currentCombo)
            currentCombo = UserCombo(None, None)
    return usercombos

def HandleCombos(combos: list[UserCombo], outfilePath: str):
    outputFile = open(outfilePath, 'w', encoding='utf8')
    for combo in combos:
        print(f'{combo.username}:{combo.password}')
        outputFile.write(f'{combo.username}:{combo.password}\n')
    outputFile.close()

if __name__ == '__main__':
    combos = ParseFile('input_formatted.txt')
    HandleCombos(combos, 'outfile_userpass.txt')

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)