Skip to content

Improved performance of URL modification generation function - #45

Open
GuilhermeMonteiroPeixoto wants to merge 1 commit into
infosec-au:masterfrom
GuilhermeMonteiroPeixoto:patch-1
Open

Improved performance of URL modification generation function#45
GuilhermeMonteiroPeixoto wants to merge 1 commit into
infosec-au:masterfrom
GuilhermeMonteiroPeixoto:patch-1

Conversation

@GuilhermeMonteiroPeixoto

@GuilhermeMonteiroPeixoto GuilhermeMonteiroPeixoto commented Jan 4, 2023

Copy link
Copy Markdown

To improve the performance of this function, one way would be to change the inner loop that iterates over alteration_words to create the URLs to an outer loop. This way, instead of iterating over alteration_words on each iteration of the main loop, you could iterate over alteration_words just once and generate all the URLs at once. This should be faster than doing it on each iteration of the main loop.

Another suggestion would be to change the main loop to iterate over a list of tuples, where each tuple is formed by the current subdomain and the alteration_words to be added to it. This way, you could generate all the URLs with the modified subdomains at once, instead of having to read and write each line individually to the output file.

Uma maneira de melhorar a performance dessa função seria mudar o loop interno que itera sobre alteration_words para criar as URLs para um loop externo. Dessa forma, ao invés de iterar sobre alteration_words a cada iteração do loop principal, você poderia iterar sobre alteration_words apenas uma vez e gerar todas as URLs de uma vez. Isso deve ser mais rápido do que fazer isso a cada iteração do loop principal.

Outra sugestão seria mudar o loop principal para iterar sobre uma lista de tuplas, onde cada tupla é formada pelo subdomínio atual e os alteration_words a serem adicionados nele. Dessa forma, você poderia gerar todas as URLs com os subdomínios modificados de uma vez, em vez de ter que ler e escrever cada linha individualmente no arquivo de saída.

Além disso, você poderia considerar usar os módulos concurrent.futures ou multiprocessing do Python para paralelizar essa operação e melhorar ainda mais a performance. Isso pode ser especialmente útil se você tiver um grande número de subdomínios para processar.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant