Skip to content

Commit

Permalink
release v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bit4woo committed Mar 31, 2021
1 parent 297c2d1 commit cb62455
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.bit4woo.burp</groupId>
<artifactId>domain_hunter_pro</artifactId>
<version>v1.0</version>
<version>v1.1</version>

<repositories>
<repository>
Expand Down
32 changes: 26 additions & 6 deletions src/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

Expand Down Expand Up @@ -95,23 +96,42 @@ public static String getFullExtenderName(){
public static void clearQueue() {
liveinputQueue.clear();
inputQueue.clear();

subDomainQueue.clear();
similarDomainQueue.clear();
relatedDomainQueue.clear();
emailQueue.clear();
packageNameQueue.clear();
}

/*
使用这种方法从Queue中取数据,一来避免了主动clear的操作,二来避免在使用数据后,clear操作之前加进来的数据的丢失。
*/
public static void moveQueueToSet(BlockingQueue<String> queue, Set<String> resultSet){
while (!queue.isEmpty()){
try {
String item = queue.take();
resultSet.add(item);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
public static void QueueToResult() {
HashSet<String> oldSubdomains = new HashSet<String>();
oldSubdomains.addAll(DomainPanel.getDomainResult().getSubDomainSet());

DomainPanel.getDomainResult().getSubDomainSet().addAll(subDomainQueue);
DomainPanel.getDomainResult().getSimilarDomainSet().addAll(similarDomainQueue);
DomainPanel.getDomainResult().getRelatedDomainSet().addAll(relatedDomainQueue);
DomainPanel.getDomainResult().getEmailSet().addAll(emailQueue);
DomainPanel.getDomainResult().getPackageNameSet().addAll(packageNameQueue);
moveQueueToSet(subDomainQueue,DomainPanel.getDomainResult().getSubDomainSet());
moveQueueToSet(similarDomainQueue,DomainPanel.getDomainResult().getSimilarDomainSet());
moveQueueToSet(relatedDomainQueue,DomainPanel.getDomainResult().getRelatedDomainSet());
moveQueueToSet(emailQueue,DomainPanel.getDomainResult().getEmailSet());
moveQueueToSet(packageNameQueue,DomainPanel.getDomainResult().getPackageNameSet());

// DomainPanel.getDomainResult().getSubDomainSet().addAll(subDomainQueue);
// DomainPanel.getDomainResult().getSimilarDomainSet().addAll(similarDomainQueue);
// DomainPanel.getDomainResult().getRelatedDomainSet().addAll(relatedDomainQueue);
// DomainPanel.getDomainResult().getEmailSet().addAll(emailQueue);
// DomainPanel.getDomainResult().getPackageNameSet().addAll(packageNameQueue);

HashSet<String> newSubdomains = new HashSet<String>();
newSubdomains.addAll(DomainPanel.getDomainResult().getSubDomainSet());
Expand Down
25 changes: 16 additions & 9 deletions src/domain/DomainManager.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package domain;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;

import com.alibaba.fastjson.JSON;
Expand Down Expand Up @@ -38,7 +41,7 @@ public class DomainManager {
private HashMap<String,Integer> unkownDomainMap = new HashMap<String,Integer>();//记录域名和解析失败的次数,大于五次就从子域名中删除。
private Set<String> EmailSet = new HashSet<String>();
private Set<String> PackageNameSet = new HashSet<String>();

private Set<String> newAndNotGetTitleDomainSet = new HashSet<String>();

public static int SUB_DOMAIN=0;
Expand Down Expand Up @@ -211,11 +214,15 @@ public String fetchSimilarDomains() {
}

public String fetchSubDomains() {
return String.join(System.lineSeparator(), subDomainSet);
List<String> tmplist= new ArrayList<>(subDomainSet);
Collections.sort(tmplist);
return String.join(System.lineSeparator(), tmplist);
}

public String fetchEmails() {
return String.join(System.lineSeparator(), EmailSet);
List<String> tmplist= new ArrayList<>(EmailSet);
Collections.sort(tmplist);
return String.join(System.lineSeparator(), tmplist);
}

public String fetchPackageNames() {
Expand All @@ -236,7 +243,7 @@ public Set<String> fetchRootDomainSet() {
}
return result;
}

public Set<String> fetchRootBlackDomainSet() {
Set<String> result = new HashSet<String>();
for (String key:rootDomainMap.keySet()) {
Expand Down Expand Up @@ -374,7 +381,7 @@ public int domainType(String domain) {
if (Commons.isValidIP(domain)) {//https://202.77.129.30
return DomainManager.IP_ADDRESS;
}

if (isInRootBlackDomain(domain)) {
return DomainManager.USELESS;
}
Expand Down Expand Up @@ -415,7 +422,7 @@ public boolean isRelatedEmail(String email) {
}
return false;
}

public boolean isInRootBlackDomain(String domain) {
if (domain.contains(":")) {//处理带有端口号的域名
domain = domain.substring(0,domain.indexOf(":"));
Expand All @@ -442,9 +449,9 @@ public static void main(String args[]) {
int type = new DomainObject("").domainType(Host);
System.out.println(type);*/

// DomainObject xx = new DomainObject("");
// xx.getRelatedDomainSet().add("xxx.baidu.com");
// System.out.println(xx.getRelatedDomainSet());
// DomainObject xx = new DomainObject("");
// xx.getRelatedDomainSet().add("xxx.baidu.com");
// System.out.println(xx.getRelatedDomainSet());


// System.out.println(InternetDomainName.from("www.jd.local").publicSuffix());
Expand Down
1 change: 1 addition & 0 deletions src/domain/DomainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
//to clear sub and similar domains
BurpExtender.QueueToResult();
domainResult.getEmailSet().addAll(collectEmails());
Set<String> tmpDomains = domainResult.getSubDomainSet();
Set<String> newSubDomainSet = new HashSet<>();
Set<String> newSimilarDomainSet = new HashSet<String>();
Expand Down

0 comments on commit cb62455

Please sign in to comment.