Home > Blockchain >  Curl Bash check Path
Curl Bash check Path

Time:12-25

Firstly I want to thank for commenting nicely, And Sorry my question was not clear enough, I wanted to know if it is possible to fuzz a path in a list of URLs, if I have a list of URLs, the URLs is unknown to me but I want to Fuzz any part of the URL, suppose,

https://example.com/something/hello.html
https://example.com/nothing/welcome.php
https://example.com/something/nothing 

I want to Fuzz any part of those URLS Suppose the middle part, as like,

https://example.com/nothing/welcome.php

After appending string in "nothing" the path will be like,

https://example.com/mystring/welcome.php

If there is a long URL like

https://example.com/nothing/welcome/hello.html

I want to Fuzz "welcome" with any keywords.

So it will be like

https://example.com/nothing/mystring/hello.html

So using Curl can I Fuzz any path? to Fuzz any path of the URLS

Tried:

echo "https://example.com/1/hello.html" | while read url; do test=$(curl -s $url/3\' | grep '3'); test2=$(curl -s $url/6 | grep '6'); echo -e "$url""\n""[line 1] $url/test""\n""[line 2] $url/?$test";done

Thanks in advance!

CodePudding user response:

It's not very clear what you are asking but this is probably what you want

for n in {1..10}; do printf 'https://example.com/%d/hello.html\n' "$n"; done | xargs -n 1 curl -s

CodePudding user response:

$ seq 1 10 | xargs -I% echo curl http://foo.bar/%/chese
curl http://foo.bar/1/chese
curl http://foo.bar/2/chese
curl http://foo.bar/3/chese
curl http://foo.bar/4/chese
curl http://foo.bar/5/chese
curl http://foo.bar/6/chese
curl http://foo.bar/7/chese
curl http://foo.bar/8/chese
curl http://foo.bar/9/chese

This solution depends on gnu xargs (findutils).

-I% means replace each argument (substitute % with argument) in the final command. % is an arbitrary char.

for examgle, {} works too.

$ seq 1 10 | xargs  -I {} echo curl http://foo.bar/%/{}/chese
curl http://foo.bar/%/1/chese
curl http://foo.bar/%/2/chese
curl http://foo.bar/%/3/chese
curl http://foo.bar/%/4/chese
curl http://foo.bar/%/5/chese
curl http://foo.bar/%/6/chese
curl http://foo.bar/%/7/chese
curl http://foo.bar/%/8/chese
curl http://foo.bar/%/9/chese
curl http://foo.bar/%/10/chese
  • Related