mardi 25 octobre 2022

How to limit and randomize the web output?

Is there a way where I can limit a website generaot output and make the output more randomize since it outputs the name alphabetically. I tried to use limit and randomize i, but it doesn't seem to work

import re
from selenium import webdriver
import os
import json
import requests
import validators
from urllib.request import Request, urlopen
import numpy as np
import random 
import whois
import pandas as pd
import itertools

Combined = open("dictionaries/Combined.txt", 'r', encoding="utf-8")
Example = open("dictionaries/examples.txt", 'w', encoding="utf-8")

with open("dictionaries/Combined.txt") as i:
    Test = [line.rstrip() for line in i]

This is what's inside the Combined.txt

Combined text file

delimeters = ['','-', '.']

output_count = 100
web = 'web'
suffix = 'co.id'
for x in range(output_count):
    output = []
    for combo in itertools.combinations(Test, 2):
        out = ''
        for i, d in enumerate(delimeters):
            out = d.join(combo)
            out = delimeters[i-1].join([out, web])
            addr = '.'.join([out, suffix])
            output.append(random.choice(out))
            Example.write(addr+'\n')

with open("dictionaries/examples.txt") as f:
websamples = [line.rstrip() for line in f]

This is the output that i get.

websamples

websamples

Websamples 2

As you see at the image, the web generator outputs too many web domain generator it doesn't even show the rest of the output in Jupyter Notebook. Is there a way where the web domain generator doesn't output the web alphabetically and mix it up and limits the number of outputs that I want? for example i want to limit it to just a 100 with randomize outputs instead of outputting possible combination domain name and outputs it alphabetically

Thanks




Aucun commentaire:

Enregistrer un commentaire