GerbenJavado / LinkFinder

A python script that finds endpoints in JavaScript files
https://gerbenjavado.com/discovering-hidden-content-using-linkfinder
MIT License
3.64k stars 588 forks source link

How to prepend domain name before the relative url. #69

Open jaikishantulswani opened 4 years ago

jaikishantulswani commented 4 years ago

@GerbenJavado @EdOverflow Is there any workaround to append domain name before the relative url's like full url ?

EdOverflow commented 4 years ago

You can pipe the output into sed.

$ python linkfinder.py -i https://example.com/example.js -o cli | sed 's#^\/#https://example.com/#g'
jaikishantulswani commented 4 years ago

Hi @EdOverflow thank you for your reply. Here as per your solution only the parent domain is appended to all the relative urls. But I have some scenario where I use -d flag and linkfinder found some more sub domains and their relative url's too, so how we append them ? Example: python linkfinder.py -i https://example.com -d -o cli /test /test1 /test2 https://new.example.com /demo1 /demo2

So in the above scenario there is one more subdomain and their relative url's found so how we append https://new.example.com too.

Regards, @jaikishantulswani

jaikishantulswani commented 4 years ago

Hi @EdOverflow any workaround for this ?

jaikishantulswani commented 4 years ago

Hi @EdOverflow any workaround for this ?

EdOverflow commented 4 years ago

@jaikishantulswani, as far as I can tell this might be too difficult to solve as is because it is not always clear which host the JS file belongs to. In your example, there is no guarantee that /demo2 belongs to https://new.example.com, so you might end up with a lot of false-positives.

I am open to suggestions though. Maybe someone out there knows of a potential solution for this problem.