Skip to content

Commit

Permalink
显示子域名数量
Browse files Browse the repository at this point in the history
  • Loading branch information
bit4woo committed Oct 17, 2024
1 parent 9142305 commit 7f20beb
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/domain/DomainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ public void showDataToDomainGUI() {
stdout.println("Load Domain Panel Data Done, " + domainResult.getSummary());

listenerIsOn = true;
targetTable.getTargetModel().refreshSubdomainCount();
}

/**
Expand Down
35 changes: 35 additions & 0 deletions src/domain/target/TargetEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import base.Commons;
import burp.BurpExtender;
import domain.DomainManager;

public class TargetEntry {
private String target = "";//根域名、网段、或者IP
Expand All @@ -30,6 +31,7 @@ public class TargetEntry {
private Set<String> comments = new HashSet<>();
private boolean useTLD = true;//TLD= Top-Level Domain,比如 baidu.com为true,*.m.baidu.com为false
private String trustLevel = AssetTrustLevel.Maybe;
private int subdomainCount = 0;

public static final String Target_Type_Domain = "Domain";
public static final String Target_Type_Wildcard_Domain = "WildcardDomain"; //
Expand Down Expand Up @@ -226,6 +228,39 @@ public void setTrustLevel(String trustLevel) {
public String switchTrustLevel() {
return trustLevel = AssetTrustLevel.getNextLevel(trustLevel);
}


public int getSubdomainCount() {
return subdomainCount;
}

public void setSubdomainCount(int subdomainCount) {
this.subdomainCount = subdomainCount;
}


public void countSubdomain(Set<String> domains) {
if (this.type.equals(Target_Type_Domain)) {
for (String domain:domains) {
if (domain.endsWith("." + this.target) || domain.equalsIgnoreCase(this.target)) {
this.subdomainCount++;
}
}
}

if (this.type.equals(Target_Type_Wildcard_Domain)) {
for (String domain:domains) {
if (DomainUtils.isMatchWildCardDomain(this.target, domain)) {
this.subdomainCount++;
}
}
}

if (this.type.equals(Target_Type_Subnet)) {
this.subdomainCount =IPAddressUtils.toIPList(this.target).size();
}

}

public void zoneTransferCheck() {
String rootDomain = InternetDomainName.from(target).topPrivateDomain().toString();
Expand Down
4 changes: 4 additions & 0 deletions src/domain/target/TargetTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ public void tableHeaderLengthInit() {
if (column.getIdentifier().equals("Keyword")) {
column.setPreferredWidth(width * "Keyword".length());
}

if (column.getIdentifier().equals("Count")) {
column.setPreferredWidth(width * "100".length());
}
}
//this.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);//配合横向滚动条
}
Expand Down
17 changes: 15 additions & 2 deletions src/domain/target/TargetTableModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class TargetTableModel extends AbstractTableModel {
private GUIMain guiMain;

private static final transient String[] standardTitles = new String[]{
"#", "Domain/Subnet", "Keyword", "Comment", "TrustLevel"};
"#", "Domain/Subnet", "Keyword", "Comment", "TrustLevel","Count"};
private static transient List<String> titletList = new ArrayList<>(Arrays.asList(standardTitles));

private static final transient Logger log = LogManager.getLogger(TargetTableModel.class);
Expand Down Expand Up @@ -130,6 +130,9 @@ public Object getValueAt(int rowIndex, int columnIndex) {
if (columnIndex == titletList.indexOf("TrustLevel")) {
return entry.getTrustLevel();
}
if (columnIndex == titletList.indexOf("Count")) {
return entry.getSubdomainCount();
}
return "";
}

Expand Down Expand Up @@ -190,7 +193,7 @@ public String getColumnName(int columnIndex) {
public Class<?> getColumnClass(int columnIndex) {
if (columnIndex == titletList.indexOf("Black")) {
return boolean.class;
} else if (columnIndex == titletList.indexOf("#")) {
} else if (columnIndex == titletList.indexOf("#") || columnIndex == titletList.indexOf("Count")) {
return Integer.class;//如果返回int.class排序会有问题,why?
} else {
return String.class;
Expand Down Expand Up @@ -542,6 +545,16 @@ public void debugPrint(String domain, int type, String reason) {
}
}
}

public void refreshSubdomainCount() {
for (TargetEntry entry:targetEntries.values()) {
entry.countSubdomain(guiMain.getDomainPanel().getDomainResult().getSubDomainSet());
}
int size = targetEntries.size();
if (size>=1) {
fireTableRowsUpdated(0,targetEntries.size()-1);
}
}

/**
* 判断域名或IP,是否为我们的目标资产。完全是根据target中的配置来判断的。
Expand Down

0 comments on commit 7f20beb

Please sign in to comment.