static String getExtension(byte[] request) { String url = getPathFromRequest(request); int query_start = url.indexOf('?'); if (query_start == -1) { query_start = url.length(); } url = url.substring(0, query_start); int last_dot = url.lastIndexOf('.'); if (last_dot == -1) { return ""; } else { return url.substring(last_dot); } }
public static String getExtension(byte[] request) { String url = getPathFromRequest(request); int query_start = url.indexOf('?'); if (query_start == -1) { query_start = url.length(); } url = url.substring(0, query_start); int last_dot = url.lastIndexOf('.'); if (last_dot == -1) { return ""; } else { return url.substring(last_dot); } }
static String getExtension(byte[] request) { String url = getPathFromRequest(request); int query_start = url.indexOf('?'); if (query_start == -1) { query_start = url.length(); } url = url.substring(0, query_start); int last_dot = url.lastIndexOf('.'); if (last_dot == -1) { return ""; } else { return url.substring(last_dot); } }
static byte[] appendToQuery(byte[] request, String suffix) { String url = getPathFromRequest(request); if(url.contains("?")) { if (url.indexOf("?") == url.length()-1) { // add suffix } else { suffix = "&" + suffix; } } else { suffix = "?" + suffix; } return replaceFirst(request, url.getBytes(), (url+suffix).getBytes()); }
static boolean isInPath(IScannerInsertionPoint insertionPoint) { byte type = insertionPoint.getInsertionPointType(); boolean isInPath = (type == IScannerInsertionPoint.INS_URL_PATH_FILENAME || type == IScannerInsertionPoint.INS_URL_PATH_FOLDER); if (!isInPath && type == IScannerInsertionPoint.INS_USER_PROVIDED) { final String injectionCanary = "zxcvcxz"; String path = Utilities.getPathFromRequest(insertionPoint.buildRequest(injectionCanary.getBytes())); if (path.contains(injectionCanary)) { if (path.contains("?")) { if (path.indexOf(injectionCanary) < path.indexOf("?")) { isInPath = true; } } else { isInPath = true; } } } return isInPath; }
public static URL getURL(IHttpRequestResponse request) { IHttpService service = request.getHttpService(); URL url; try { url = new URL(service.getProtocol(), service.getHost(), service.getPort(), getPathFromRequest(request.getRequest())); } catch (java.net.MalformedURLException e) { url = null; } return url; }
private static URL getURL(IHttpRequestResponse request) { IHttpService service = request.getHttpService(); URL url; try { url = new URL(service.getProtocol(), service.getHost(), service.getPort(), getPathFromRequest(request.getRequest())); } catch (java.net.MalformedURLException e) { url = null; } return url; }
public static URL getURL(IHttpRequestResponse request) { IHttpService service = request.getHttpService(); URL url; try { url = new URL(service.getProtocol(), service.getHost(), service.getPort(), getPathFromRequest(request.getRequest())); } catch (java.net.MalformedURLException e) { url = null; } return url; }