Skip to content

Commit 7f20beb

Browse files
committed
显示子域名数量
1 parent 9142305 commit 7f20beb

File tree

4 files changed

+55
-2
lines changed

4 files changed

+55
-2
lines changed

src/domain/DomainPanel.java

+1
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ public void showDataToDomainGUI() {
450450
stdout.println("Load Domain Panel Data Done, " + domainResult.getSummary());
451451

452452
listenerIsOn = true;
453+
targetTable.getTargetModel().refreshSubdomainCount();
453454
}
454455

455456
/**

src/domain/target/TargetEntry.java

+35
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import base.Commons;
2121
import burp.BurpExtender;
22+
import domain.DomainManager;
2223

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

3436
public static final String Target_Type_Domain = "Domain";
3537
public static final String Target_Type_Wildcard_Domain = "WildcardDomain"; //
@@ -226,6 +228,39 @@ public void setTrustLevel(String trustLevel) {
226228
public String switchTrustLevel() {
227229
return trustLevel = AssetTrustLevel.getNextLevel(trustLevel);
228230
}
231+
232+
233+
public int getSubdomainCount() {
234+
return subdomainCount;
235+
}
236+
237+
public void setSubdomainCount(int subdomainCount) {
238+
this.subdomainCount = subdomainCount;
239+
}
240+
241+
242+
public void countSubdomain(Set<String> domains) {
243+
if (this.type.equals(Target_Type_Domain)) {
244+
for (String domain:domains) {
245+
if (domain.endsWith("." + this.target) || domain.equalsIgnoreCase(this.target)) {
246+
this.subdomainCount++;
247+
}
248+
}
249+
}
250+
251+
if (this.type.equals(Target_Type_Wildcard_Domain)) {
252+
for (String domain:domains) {
253+
if (DomainUtils.isMatchWildCardDomain(this.target, domain)) {
254+
this.subdomainCount++;
255+
}
256+
}
257+
}
258+
259+
if (this.type.equals(Target_Type_Subnet)) {
260+
this.subdomainCount =IPAddressUtils.toIPList(this.target).size();
261+
}
262+
263+
}
229264

230265
public void zoneTransferCheck() {
231266
String rootDomain = InternetDomainName.from(target).topPrivateDomain().toString();

src/domain/target/TargetTable.java

+4
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ public void tableHeaderLengthInit() {
200200
if (column.getIdentifier().equals("Keyword")) {
201201
column.setPreferredWidth(width * "Keyword".length());
202202
}
203+
204+
if (column.getIdentifier().equals("Count")) {
205+
column.setPreferredWidth(width * "100".length());
206+
}
203207
}
204208
//this.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);//配合横向滚动条
205209
}

src/domain/target/TargetTableModel.java

+15-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class TargetTableModel extends AbstractTableModel {
3535
private GUIMain guiMain;
3636

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

4141
private static final transient Logger log = LogManager.getLogger(TargetTableModel.class);
@@ -130,6 +130,9 @@ public Object getValueAt(int rowIndex, int columnIndex) {
130130
if (columnIndex == titletList.indexOf("TrustLevel")) {
131131
return entry.getTrustLevel();
132132
}
133+
if (columnIndex == titletList.indexOf("Count")) {
134+
return entry.getSubdomainCount();
135+
}
133136
return "";
134137
}
135138

@@ -190,7 +193,7 @@ public String getColumnName(int columnIndex) {
190193
public Class<?> getColumnClass(int columnIndex) {
191194
if (columnIndex == titletList.indexOf("Black")) {
192195
return boolean.class;
193-
} else if (columnIndex == titletList.indexOf("#")) {
196+
} else if (columnIndex == titletList.indexOf("#") || columnIndex == titletList.indexOf("Count")) {
194197
return Integer.class;//如果返回int.class排序会有问题,why?
195198
} else {
196199
return String.class;
@@ -542,6 +545,16 @@ public void debugPrint(String domain, int type, String reason) {
542545
}
543546
}
544547
}
548+
549+
public void refreshSubdomainCount() {
550+
for (TargetEntry entry:targetEntries.values()) {
551+
entry.countSubdomain(guiMain.getDomainPanel().getDomainResult().getSubDomainSet());
552+
}
553+
int size = targetEntries.size();
554+
if (size>=1) {
555+
fireTableRowsUpdated(0,targetEntries.size()-1);
556+
}
557+
}
545558

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

0 commit comments

Comments
 (0)