英文:
How to store output for every xargs instance separately
问题
Ffuf用于目录和文件爆破,而domains.txt
包含有效的HTTP和HTTPS网址,如http://example.com,http://example2.com。我使用xargs来加速进程,同时运行10个并行实例。但问题在于,我无法为每个实例单独存储输出,而output.json
会被每个运行的实例覆盖。有什么方法可以使每个实例的output.json
都是唯一的,以便所有数据都被单独保存。我尝试了ffuf/$(date '+%s').json
,但也没有起作用。
英文:
cat domains.txt | xargs -P10 -I % ffuf -u %/FUZZ -w wordlist.txt -o output.json
Ffuf is used for directory and file bruteforcing while domains.txt contains valid HTTP and HTTPS URLs like http://example.com, http://example2.com. I used xargs to speed up the process by running 10 parallel instances. But the problem here is I am unable to store output for each instance separately and output.json is getting override by every running instance. Is there anything we can do to make output.json
unique for every instance so that all data gets saved separately. I tried ffuf/$(date '+%s').json
instead but it didn't work either.
答案1
得分: 4
Sure. Just name your output file using the domain. E.g.:
```shell
xargs -P10 -I % ffuf -u %/FUZZ -w wordlist.txt -o output-%.json < domains.txt
(I dropped cat
because it was unnecessary.)
I missed the fact that your domains.txt
file is actually a list of URLs rather than a list of domain names. I think the easiest fix is just to simplify domains.txt
to be just domain names, but you could also try something like:
xargs -P10 -I % sh -c 'domain="%"; ffuf -u %/FUZZ -w wordlist.txt -o output-${domain##*/}.json' < domains.txt
<details>
<summary>英文:</summary>
Sure. Just name your output file using the domain. E.g.:
xargs -P10 -I % ffuf -u %/FUZZ -w wordlist.txt -o output-%.json < domains.txt
(I dropped `cat` because it was unnecessary.)
---
I missed the fact that your `domains.txt` file is actually a list of URLs rather than a list of domain names. I think the easiest fix is just to simplify `domains.txt` to be just domain names, but you could also try something like:
xargs -P10 -I % sh -c 'domain="%"; ffuf -u %/FUZZ -w wordlist.txt -o output-${domain##*/}.json' < domains.txt
</details>
# 答案2
**得分**: -1
cat domains.txt | xargs -P10 -I % sh -c "ping % > output.json.%"
就像这样,你的“%”可以成为文件名的一部分。(我将你的命令更改为ping以进行测试)
所以可能更像这样:
cat domains.txt | xargs -P10 -I % sh -c "ffuf -u %/FUZZ -w wordlist.txt -o output.json.%"
我会用以下脚本替换你的ffuf命令,并从xargs命令中调用它。它只会删除无效的文件名字符并用点替换它们,然后运行命令:
```bash
#!/usr/bin/bash
URL=$1
FILE="`echo $URL | sed 's/:\/\/\./g'`"
ffuf -u ${URL}/FUZZ -w wordlist.txt -o output-${FILE}.json
英文:
cat domains.txt | xargs -P10 -I % sh -c "ping % > output.json.%"
Like this and your "%" can be part of the file name. (I changed your command to ping for my testing)
So maybe something more like this:
cat domains.txt | xargs -P10 -I % sh -c "ffuf -u %/FUZZ -w wordlist.txt -o output.json.%
"
I would replace your ffuf command with the following script, and call this from the xargs command. It just strips out the invalid file name characters and replaces them with a dot then runs the command:
#!/usr/bin/bash
URL=$1
FILE="`echo $URL | sed 's/:\/\//\./g'`"
ffuf -u ${URL}/FUZZ -w wordlist.txt -o output-${FILE}.json
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论