Skip to content

Commit

Permalink
删除无用代码
Browse files Browse the repository at this point in the history
  • Loading branch information
iSafeBlue committed May 14, 2019
1 parent fc2fae7 commit 15df516
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void run() {
public void executor(){
//PageUtils.copyTaskProxy(task,crawlerPage);
if (check(task.getResult())){

before();

attack(task);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,6 @@ private ResponseStatus post(String url, String body, String contentType) {
return ret;
}

public static void main(String[] args) throws HttpException, IOException {
testGet();
//testUploadFile();
}

//test
public static void testGet() throws HttpException, IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import com.trackray.base.httpclient.CrawlerPage;
import com.trackray.base.httpclient.Fetcher;
import org.javaweb.core.net.HttpURLRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
Expand All @@ -24,6 +26,8 @@
public abstract class AbstractPlugin<E> implements Callable<AbstractPlugin<E>> {


public final Logger log = LoggerFactory.getLogger(this.getClass());


protected final static String BASE = Constant.RESOURCES_INCLUDE_PATH; // resource外部资源文件的绝对路径

Expand Down Expand Up @@ -87,9 +91,12 @@ public AbstractPlugin<E> executor() {
flag = false;
}
if (flag){ //合法则执行插件代码
String title = currentPlugin().title();
log.info(String.format("[%s] 该插件通过检测,正在执行。",title));
before();
result = start();
after();
log.info(String.format("[%s] 插件执行结束。",title));
}
return this;
}
Expand Down
168 changes: 0 additions & 168 deletions base/src/main/java/com/trackray/base/utils/ApiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,172 +75,4 @@ public static List<JSONObject> censys(String query){
}


public static String tooluWhois(String domain){
HttpClient client = new HttpClient();
HashMap<String, Object> map = new HashMap<>();
map.put("sld",domain);
ResponseStatus post = client.post(TOOLLU_WHOIS_API,map);
if (post!=null && post.getStatusCode() == 200 && !post.getContent().isEmpty()) {
SysLog.info("已扫描到WHOIS");
return post.getContent();
}
return "";
}
public static List<String> chinazReverse(String domain){
ArrayList<String> arr = new ArrayList<>();
HttpClient httpClient = new HttpClient();
Document parse = null;
try {
ResponseStatus responseStatus = httpClient.get("http://whois.chinaz.com/" + domain);
Document doc = Jsoup.parse(responseStatus.getContent());
if (doc.toString().contains("邮箱反查")){
String href = doc.select("a:contains(邮箱反查)").attr("href");

ResponseStatus resp = httpClient.get("http://whois.chinaz.com/" + href);
parse = Jsoup.parse(resp.getContent());
}
} catch (HttpException e) {
e.printStackTrace();
return arr;
} catch (IOException e) {
e.printStackTrace();
return arr;
}

if (parse!=null)
{
Elements items = parse.select(".Wholist .domain");

for (Element item : items) {
String text = item.select("div.listOther a").text();
arr.add(text);
}

}
SysLog.info("邮箱反查结束");
return arr;
}
public static List<String> aizhanReverseRegisted(String domain){
ArrayList<String> arr = new ArrayList<>();
String url = String.format(AIZHAN_API, domain);
CrawlerPage page = new CrawlerPage();
page.getRequest().setUrl(url);
Fetcher fetcher = new Fetcher();
try {

fetcher.run(page);
if (page.getResponse().getStatus().getStatusCode() == 200 && page.getResponse().getStatus().getContent().contains("反查邮箱")){
String content = page.getResponse().getStatus().getContent();
String md5 = RegexUtil.extractStr(content, "([a-fA-F0-9]{32})");
String param = "?domain="+domain+"&cc="+md5+"&rn=1531734119&update=true";
page.getRequest().setUrl("https://whois.aizhan.com/api/whois"+param);
fetcher.run(page);
String content1 = page.getResponse().getStatus().getContent();
JSONObject json = page.getResponse().getRespFormatJson();
String email = json.optJSONObject("regrinfo").optString("email");

if (ReUtils.isMail(email)) {
String emailurl = "https://whois.aizhan.com/reverse-whois?q="+email+"&t=email";
page.getRequest().setUrl("https://whois.aizhan.com".concat(emailurl));
fetcher.run(page);
Document respFormatHtml = page.getResponse().getRespFormatHtml();
if (page.getResponse().getStatus().getContent().contains("url domain")) {
Document parse = page.getResponse().getRespFormatHtml();
Elements elements = parse.select("tr.url.domain a");
for (Element element : elements) {
String text = element.text();
arr.add(text);
}
}
}
}
}catch (Exception e){
return arr;
}

return arr;
}

public static Map<String,String> aizhanIcp(String domain){
HashMap<String, String> map = new HashMap<>();
HttpClient httpClient = new HttpClient();
String url = "https://icp.aizhan.com/%s/";
try {
ResponseStatus responseStatus = httpClient.get(String.format(url, domain));
String html = responseStatus.getContent();
if (!html.contains("未找到") && html.contains("该单位备案网站") && html.contains("缓存于"))
{
Document doc = Jsoup.parse(html);

Elements trs = doc.select("div#company .table-s1 tbody tr");
for (Element tr : trs) {
String title = tr.select("td").get(1).text();
String dom = tr.select("td").get(2).text();
map.put(dom,title);
}
}
} catch (HttpException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
SysLog.info("ICP反查结束");
return map;
}

public static List<String> chinazSame(String ip){
List<String> result = new ArrayList<String>();
HashMap<String, String> map = new HashMap<String, String>();
int total = 5;
for (int page=1;page<=total;page++) {
String url = CHINAZ_SAME_API.concat("?s="+ip+"&page="+page);
Document doc = null;
try {
URL u = new URL(url);
doc = Jsoup.parse(u, 10000);
} catch (Exception e) {
continue;
}
if (doc !=null && doc.toString().contains("ReLists")) {
String pagestr = RegexUtil.extractStr(doc.toString(), "共(\\d)+页");
int i = 1;
try {
Integer.parseInt(pagestr);
}catch (Exception e){
i=1;
}
if (page == 1) {
if (i <= 5 && i >= 1){
total = i;
}
}
Elements reLists = doc.select("li.ReLists");
for (Element list : reLists) {
String domain = list.select("div.overhid a").text();
map.put(domain,"");
}
}else {
continue;
}

}

for (String key : map.keySet()) {
result.add(key);
}
SysLog.info("同服网站扫描结束");
return result;
}

public static void main(String[] args) throws IOException {

}

public static String initSQLMap(String api) {

page.getRequest().setUrl(api+"/task/new");
f.run(page);
JSONObject resp = page.getResponse().getRespFormatJson();
return resp.optString("taskid");
}
}
29 changes: 0 additions & 29 deletions base/src/main/java/com/trackray/base/utils/ShellUtils.java

This file was deleted.

0 comments on commit 15df516

Please sign in to comment.