Common Classes [Java]
A snippet of the code which will be used to demonstrate examples:
// 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());
}
}
}
Common Classes and their use-cases
Method - Returns all the methods which are defined.
from Method m
where m.hasQualifiedName("com.scalesec.vulnado", "LinkLister", "getLinksV2")
select m

Common predicates of the Method
class:
hasQualifiedName() - Returns all the methods that belong to the specific class.
getCallee() - Returns all the calls the method makes:

getDeclaringType() - Gets the class where this method is declared:

MethodAccess - Returns all the methods which were invoked with a list of arguments.
from MethodAccess m
where m.getMethod().hasQualifiedName("com.scalesec.vulnado", "LinkLister" , "getLinksV2")
select m

Common predicates of the MethodAccess
class:
getMethod() - Cast the
MethodAccess
object of typeMethod
so the predicates listed above can be called.getCaller() - Returns all the locations (<- change this word) from where the method is called:

Last updated
Was this helpful?