J. Doe
J. Doe

Reputation: 1

how to get the output in the same line python

I'm trying to send a "scammer" a bunch of fake email and passwords but i get this output:

Milan
[email protected]

this is the script:

import requests
import random

val = 1
url = 'https://repens.serveo.net/login.php'

while val == 1:
   file = open("/home/user/Documents/scam/names.json").readlines()
   random_name = random.choice(file)
   random_number = random.randint(0, 99)
   email_provider = ["@yahoo.com", "@gmail.com", "@walla.com"]
   random_email_provider = random.choice(email_provider)
   name = random_name
   username = "%s%s%s" % (name, random_number, random_email_provider)
   password = random.randint(0, 9999999)
   print(username)

    requests.post(url, allow_redirects=False, data={
        'username': username,
        'password': password    })

this is what my names file look like:

Liam Noah William James Logan

I also tried:

[ "Liam", "Noah", "William", "James", "Logan", ]

Upvotes: 0

Views: 82

Answers (2)

Wizhard Hacker1
Wizhard Hacker1

Reputation: 11

output


import requests
import random
import string
import json
import os


# setting variables
chars = string.ascii_letters + string.digits + '!@#$%^&*()'
random.seed = (os.urandom(1024))


# setting up different domain extensions
domain = ['.com', '.gov', '.us', '.edu', '.org', '.ru', '.tw', '.live', '.io', '.blog', '.biz', '.blog', '.co']


# url to overflow
url = 'https://www.stealmylogin.com/demo.html'

# loading and reading json files
names = json.loads(open('names.json').read())
org = json.loads(open('domain.json').read())

# setting up random users and password
for name in names:
    name_extra = ''.join(random.choice(string.digits))
    userId = name.lower() + name_extra + '@' + random.choice(org) + random.choice(domain)
    userPassword = ''.join(random.choice(chars) for i in range(8))

# sending user/password to url above
    requests.post(url, allow_redirects=False, data={
        'auid2yjauysd2uasdasdasd': userId,
        'kjauysd6sAJSDhyui2yasd': userPassword
    })


# print the results  - example: sending username [email protected] and password ankCRzk8
    print('sending username %s and password %s' % (userId, userPassword)).

Upvotes: 1

Omkar
Omkar

Reputation: 392

to get the 3 strings appended in a single line, you need to get the name without the next line character. You are getting the name from a file which is split by readlines(). You can put the names in a space separated format so you can get your names like this:

names = list(map(file.read().split()))



you could also do something like this for getting your names from the file:

with open('data.txt', 'r') as myfile:
    data=myfile.read().replace('\n', '')

reference : How to read a text file into a string variable?

Upvotes: 1

Related Questions