forked from API-Security/APIKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUrlScanCount.java
More file actions
42 lines (33 loc) · 963 Bytes
/
UrlScanCount.java
File metadata and controls
42 lines (33 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package burp.utils;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class UrlScanCount {
private final ConcurrentHashMap<String, Integer> countMap;
public UrlScanCount() {
this.countMap = new ConcurrentHashMap<>();
}
public Map<String, Integer> getStringMap() {
return this.countMap;
}
public Integer get(String key) {
Integer ret = this.countMap.get(key);
if (ret == null) {
return 0;
} else {
return ret;
}
}
public void add(String key) {
if (key == null || key.length() <= 0) {
throw new IllegalArgumentException("Key 不能为空");
}
synchronized (this.getStringMap()) {
this.countMap.put(key, (this.get(key) + 1));
}
}
public void del(String key) {
if (this.countMap.get(key) != null) {
this.countMap.remove(key);
}
}
}