Java Code Examples for org.jsoup.select.Elements#html()
The following examples show how to use
org.jsoup.select.Elements#html() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfluenceServerRCE.java From TrackRay with GNU General Public License v3.0 | 6 votes |
@Override public boolean check(Map param) { if (!param.isEmpty()){ this.url = param.get(this.currentParams()[0].key()).toString(); if (url.endsWith("/")) url = url.substring(0,url.length()-1); Document parse = attack(String.format(readFilePayload, "../web.xml")); if (parse!=null){ Elements wiki = parse.getElementsByClass("wiki-content"); if (wiki!=null&&wiki.hasText()){ String text = wiki.html(); if (text.contains("filter-class")) sendColorMsg(Message.RED("存在安全漏洞")); return true; } } } return false; }
Example 2
Source File: ToolChecker.java From chipster with MIT License | 6 votes |
/** * Updates manuals parameters according to new Parameters. * @param newParameters, the string that is displayed on the manual. * @param documentationPath, the path of the documentation */ private void writeParameters(Set<String> newParameters, String documentationPath) { File documentation = new File(documentationPath); Document doc; try { doc = Jsoup.parse(documentation, "UTF-8"); Elements parameters = doc.select("h3:contains(Parameters) + ul"); parameters.html(""); // Modify parameters for (String p: newParameters) { parameters.prepend("<li>" + p + "</li>" ); } // Write file FileWriter newFile = new FileWriter(documentation, false); newFile.write(doc.outerHtml()); newFile.close(); System.out.println(doc.outerHtml()); } catch (IOException e) { e.printStackTrace(); } }
Example 3
Source File: V2exHotProcessor.java From hot-crawler with MIT License | 5 votes |
@Override protected Info getInfoByElement(Element element) { Elements elements1 = element.getElementsByTag("a"); String infoTitle = elements1.html(); StringBuilder infoUrl = new StringBuilder(); infoUrl.append(this.prefix); infoUrl.append(elements1.attr("href")); String url = infoUrl.substring(0, infoUrl.indexOf("#")); Info info = new Info(); info.setTitle(infoTitle); info.setUrl(url); return info; }
Example 4
Source File: ConfluenceServerRCE.java From TrackRay with GNU General Public License v3.0 | 5 votes |
@Override public Object start() { println("请输入要读取的文件 如/etc/passwd,输入exit退出"); while(true){ String input = getInput(); if (input.equals("exit")) break; if (input.startsWith("/")) input = input.substring(1,input.length()); String format = String.format(readFilePayload, "file:///".concat(input)); Document parse = attack(format); if (parse!=null){ Elements wiki = parse.getElementsByClass("wiki-content"); if (wiki!=null&&wiki.hasText()){ String text = wiki.html(); println("========================="); sendColorMsg(Message.RED(HtmlUtils.htmlEscape(text))); println("========================="); } } } return ""; }
Example 5
Source File: NotificationsService.java From FaceSlim with GNU General Public License v2.0 | 5 votes |
private String getNumber(String connectUrl) { try { CookieManager cm = CookieManager.getInstance(); Elements message; if (preferences.getBoolean("use_tor", false)) { message = Jsoup.connect(connectUrl) .userAgent(userAgent) .proxy(Miscellany.getProxy(preferences)) .timeout(JSOUP_TIMEOUT) .cookie("https://m.facebook.com", cm.getCookie("https://m.facebook.com")) .cookie("https://m.facebookcorewwwi.onion", cm.getCookie("https://m.facebookcorewwwi.onion")) .get() .select("div#viewport").select("div#page").select("div._129-") .select("#messages_jewel").select("span._59tg"); } else { message = Jsoup.connect(connectUrl) .userAgent(userAgent) .timeout(JSOUP_TIMEOUT) .cookie("https://m.facebook.com", cm.getCookie("https://m.facebook.com")) .get() .select("div#viewport").select("div#page").select("div._129-") .select("#messages_jewel").select("span._59tg"); } return message.html(); } catch (IllegalArgumentException | IOException ex) { Log.i("CheckMessagesTask", "Cookie sync problem or IOException", ex); if (ex instanceof IllegalArgumentException && !syncProblemOccurred) { syncProblemToast(); syncProblemOccurred = true; } } return "failure"; }
Example 6
Source File: HtmlParser.java From gecco with MIT License | 5 votes |
public String $html(String selector, boolean isOuter) { Elements elements = $(selector); if (elements != null) { if(isOuter) { return elements.outerHtml(); } return elements.html(); } return null; }
Example 7
Source File: URLDownloadTests.java From java_in_examples with Apache License 2.0 | 4 votes |
private static String testJsoupHeadlines(String url) throws Exception { Document doc = Jsoup.connect(url).userAgent(USER_AGENT).cookie("auth", "token") .timeout(30000).get(); Elements newsHeadlines = doc.select("#mp-itn b a"); return newsHeadlines.html(); }