// SOURCE: mhttps://github.com/ScaleSec/vulnado
package com.scalesec.vulnado;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.ArrayList;
import java.util.List;
import java.io.IOException;
import java.net.*;
public class LinkLister {
public static List<String> getLinks(String url) throws IOException {
List<String> result = new ArrayList<String>();
Document doc = Jsoup.connect(url).get();
Elements links = doc.select("a");
for (Element link : links) {
result.add(link.absUrl("href"));
}
return result;
}
public static List<String> getLinksV2(String url) throws BadRequest {
try {
URL aUrl= new URL(url);
String host = aUrl.getHost();
System.out.println(host);
if (host.startsWith("172.") || host.startsWith("192.168") || host.startsWith("10.")){
throw new BadRequest("Use of Private IP");
} else {
return getLinks(url);
}
} catch(Exception e) {
throw new BadRequest(e.getMessage());
}
}
}
// SOURCE: mhttps://github.com/ScaleSec/vulnado
package com.scalesec.vulnado;
import org.springframework.boot.*;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.boot.autoconfigure.*;
import java.util.List;
import java.io.Serializable;
import java.io.IOException;
@RestController
@EnableAutoConfiguration
public class LinksController {
@RequestMapping(value = "/links", produces = "application/json")
List<String> links(@RequestParam String url) throws IOException{
return LinkLister.getLinks(url);
}
@RequestMapping(value = "/links-v2", produces = "application/json")
List<String> linksV2(@RequestParam String url) throws BadRequest{
return LinkLister.getLinksV2(url);
}
}
Common Classes and their use-cases
from Method m
where m.hasQualifiedName("com.scalesec.vulnado", "LinkLister", "getLinksV2")
select m
from MethodAccess m
where m.getMethod().hasQualifiedName("com.scalesec.vulnado", "LinkLister" , "getLinksV2")
select m