Skip to content
This repository was archived by the owner on Sep 2, 2019. It is now read-only.

Commit fb0e4c8

Browse files
author
ecstatic_nobel
committed
Merge branch 'v1.7'
2 parents 33e3f93 + c25b4ba commit fb0e4c8

File tree

11 files changed

+234
-389
lines changed

11 files changed

+234
-389
lines changed
File renamed without changes.

KitJackinSeason/.placeholder

Whitespace-only changes.

README.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
##### Be the first to know on a need-to-know basis.
33

44
### Description
5-
With `aa_adhoc`, run through a list of URLs and recursively check sites for malicious files based on predefined file extensions.
5+
With `aa_adhoc`, run through a list of URLs and check sites for malicious files based on predefined file extensions.
66

77
With `aa_certstream`, find out when a phishing kit has been staged on a domain. With this information, you can be amongst the first to:
88
- Know
99
- Block
1010
- Report
1111
- Analyze
1212

13-
With `aa_urlscan`, easily search [urlscan.io](https://urlscan.io/) and recursively check sites for malicious files based on predefined file extensions.
13+
With `aa_urlscan`, easily search [urlscan.io](https://urlscan.io/) and check sites for malicious files based on predefined file extensions.
1414

15-
With `aa_whoisds`, download a list of newly registered domains from [WHOIS Domain Search](https://whoisds.com/newly-registered-domains), score the domains, and search for signs of phishing activity.
15+
With `aa_whoisds`, download a list of newly registered domains from [WHOIS Domain Search](https://whoisds.com/newly-registered-domains), score the domains, and search for signs of malicious activity.
1616

1717
### Prerequisites
1818
- Ubuntu 18.04+ (should work on other Linux distros)
@@ -32,24 +32,22 @@ With `aa_whoisds`, download a list of newly registered domains from [WHOIS Domai
3232
**aa_adhoc**
3333
The following command will:
3434
- Make requests to the domains retrieved from a file
35-
- Recursively download the site when an open directory hosting a file with the desired file extension
35+
- Download files from the site when an open directory is found hosting a file with the desired file extension
3636

37-
3 positional arguments needed:
37+
1 positional arguments needed:
3838
- **Input File** : Path to the file containing URLs
39-
- **File Extension** : 7z, apk, bat, bz, bz2, crypt, dll, doc, docx, exe, gz, hta, iso, jar, json, lnk, ppt, ps1, py, rar, sfx, sh, tar, vb, vbs, xld, xls, xlsx, zip
4039

4140
Optional arguments:
42-
- **--file-dir** : Directory to use for interesting files detected (default: ./InterestingFiles/)
43-
- **--kit-dir** : Directory to use for phishing kits detected (default: ./KitJackinSeason/)
44-
- **--level** : Recursion depth (default=1, infinite=0)
45-
- **--quiet** : Don't show wget output
46-
- **--threads** : Numbers of threads to spawn
47-
- **--timeout** : Set time to wait for a connection
48-
- **--tor** : Download files via the Tor network
49-
- **--very-verbose** : Show error messages
41+
- **--directory** : Download data to CAP_DIR (default: ./Captures)
42+
- **--level** : Recursion depth (default=1, infinite=0)
43+
- **--quiet** : Don't show wget output
44+
- **--threads** : Numbers of threads to spawn
45+
- **--timeout** : Set the connection timeout to TIMEOUT
46+
- **--tor** : Download files via the Tor network
47+
- **--very-verbose** : Show error messages
5048
5149
```bash
52-
python aa_adhoc.py <INPUT_FILE> <FILE_EXTENSION> [--file-dir] [--kit-dir] [--level] [--quiet] [--threads] [--timeout] [--tor] [--very-verbose]
50+
python aa_adhoc.py <INPUT_FILE> [--directory] [--level] [--quiet] [--threads] [--timeout] [--tor] [--very-verbose]
5351
```
5452
5553
**aa_certstream**
@@ -61,20 +59,19 @@ The following command will:
6159
6260
Optional arguments:
6361
- **--dns-twist** : Check the twisted keywords found in dns_twisted.yaml
64-
- **--file-dir** : Directory to use for interesting files detected (default: ./InterestingFiles/)
65-
- **--kit-dir** : Directory to use for phishing kits detected (default: ./KitJackinSeason/)
62+
- **--directory** : Download data to CAP_DIR (default: ./Captures)
6663
- **--level** : Recursion depth (default=1, infinite=0)
6764
- **--log-nc** : File to store domains that have not been checked
6865
- **--quiet** : Don't show wget output
6966
- **--score** : Minimum score to trigger a session (Default: 75)
7067
- **--threads** : Numbers of threads to spawn
71-
- **--timeout** : Set time to wait for a connection
68+
- **--timeout** : Set the connection timeout to TIMEOUT
7269
- **--tor** : Download files via the Tor network
7370
- **--verbose** : Show domains being scored
7471
- **--very-verbose** : Show error messages
7572

7673
```bash
77-
python aa_certstream.py [--dns-twist] [--file-dir] [--kit-dir] [--level] [--log-nc] [--quiet] [--score] [--threads] [--timeout] [--tor] [--verbose] [--very-verbose]
74+
python aa_certstream.py [--dns-twist] [--directory] [--level] [--log-nc] [--quiet] [--score] [--threads] [--timeout] [--tor] [--verbose] [--very-verbose]
7875
```
7976

8077
**aa_urlscan**
@@ -88,17 +85,16 @@ The following command will:
8885
- **File Extension** : 7z, apk, bat, bz, bz2, crypt, dll, doc, docx, exe, gz, hta, iso, jar, json, lnk, ppt, ps1, py, rar, sfx, sh, tar, vb, vbs, xld, xls, xlsx, zip
8986

9087
Optional arguments:
91-
- **--file-dir** : Directory to use for interesting files detected (default: ./InterestingFiles/)
92-
- **--kit-dir** : Directory to use for phishing kits detected (default: ./KitJackinSeason/)
93-
- **--level** : Recursion depth (default=1, infinite=0)
94-
- **--quiet** : Don't show wget output
95-
- **--threads** : Numbers of threads to spawn
96-
- **--timeout** : Set time to wait for a connection
97-
- **--tor** : Download files via the Tor network
98-
- **--very-verbose** : Show error messages
88+
- **--directory** : Download data to CAP_DIR (default: ./Captures)
89+
- **--level** : Recursion depth (default=1, infinite=0)
90+
- **--quiet** : Don't show wget output
91+
- **--threads** : Numbers of threads to spawn
92+
- **--timeout** : Set the connection timeout to TIMEOUT
93+
- **--tor** : Download files via the Tor network
94+
- **--very-verbose** : Show error messages
9995
10096
```bash
101-
python aa_urlscan.py <QUERY_TYPE> <DELTA> <FILE_EXTENSION> [--file-dir] [--kit-dir] [--level] [--quiet] [--threads] [--timeout] [--tor] [--very-verbose]
97+
python aa_urlscan.py <QUERY_TYPE> <DELTA> <FILE_EXTENSION> [[--directory] [--level] [--quiet] [--threads] [--timeout] [--tor] [--very-verbose]
10298
```
10399
**Note**: If the path is a file, it will be automatically downloaded.
104100
@@ -113,20 +109,19 @@ python aa_urlscan.py <QUERY_TYPE> <DELTA> <FILE_EXTENSION> [--file-dir] [--kit-d
113109
114110
Optional arguments:
115111
- **--dns-twist** : Check the twisted keywords found in dns_twisted.yaml
116-
- **--file-dir** : Directory to use for interesting files detected (default: ./InterestingFiles/)
117-
- **--kit-dir** : Directory to use for phishing kits detected (default: ./KitJackinSeason/)
112+
- **--directory** : Download data to CAP_DIR (default: ./Captures)
118113
- **--level** : Recursion depth (default=1, infinite=0)
119114
- **--log-nc** : File to store domains that have not been checked
120115
- **--quiet** : Don't show wget output
121116
- **--score** : Minimum score to trigger a session (Default: 75)
122117
- **--threads** : Numbers of threads to spawn
123-
- **--timeout** : Set time to wait for a connection
118+
- **--timeout** : Set the connection timeout to TIMEOUT
124119
- **--tor** : Download files via the Tor network
125120
- **--verbose** : Show domains being scored
126121
- **--very-verbose** : Show error messages
127122

128123
```bash
129-
python aa_whoisds.py <DELTA> [--dns-twist] [--file-dir] [--kit-dir] [--level] [--log-nc] [--quiet] [--score] [--threads] [--timeout] [--tor] [--verbose] [--very-verbose]
124+
python aa_whoisds.py <DELTA> [--dns-twist] [--directory] [--level] [--log-nc] [--quiet] [--score] [--threads] [--timeout] [--tor] [--verbose] [--very-verbose]
130125
```
131126

132127
### Things to know
@@ -141,6 +136,11 @@ python aa_whoisds.py <DELTA> [--dns-twist] [--file-dir] [--kit-dir] [--level] [-
141136
- **Triggered**: a domain was found with the minimum score specified
142137
- **Download**: checks passed and a download was started
143138
- **Complete**: download complete or the site canceled it prematurely
139+
- **Directory**: the output directory is unavailable
140+
- If the keywords in `config.yaml` have been modified and `--dns-twist` is going to be used, regenerate `dns_twisted.yaml` by running the following command:
141+
```bash
142+
bash dnstwist.sh PATH_TO_DNSTWIST_SCRIPT
143+
```
144144
- Using the `--dns-twist` flag will default to a minimum of 20 threads
145145
146146
Please fork, create merge requests, and help make this better.

aa_adhoc.py

Lines changed: 22 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,21 @@
44
- Make requests to the domains retrieved from a file
55
- Recursively download the site when an open directory hosting a file with the desired file extension
66
7-
3 positional arguments needed:
7+
1 positional arguments needed:
88
- Input File : Path to the file containing URLs
9-
- File Extension : 7z, apk, bat, bz, bz2, crypt, dll, doc, docx, exe, gz, hta, iso, jar, json, lnk, ppt, ps1, py, rar, sfx, sh, tar, vb, vbs, xld, xls, xlsx, zip
109
1110
Optional arguments:
12-
- --file-dir : Directory to use for interesting files detected (default: ./InterestingFiles/)
13-
- --kit-dir : Directory to use for phishing kits detected (default: ./KitJackinSeason/)
11+
- --directory : Save data to CAP_DIR (default: ./Captures/)
1412
- --level : Recursion depth (default=1, infinite=0)
1513
- --quiet : Don't show wget output
1614
- --threads : Numbers of threads to spawn
17-
- --timeout : Set time to wait for a connection
15+
- --timeout : Set the connection timeout to TIMEOUT
1816
- --tor : Download files via the Tor network
1917
- --very-verbose : Show error messages
2018
2119
Usage:
2220
```
23-
python aa_adhoc.py <INPUT_FILE> <FILE_EXTENSION> [--file-dir] [--kit-dir] [--level] [--quiet] [--threads] [--timeout] [--tor] [--very-verbose]
21+
python aa_adhoc.py <INPUT_FILE> [--directory] [--level] [--quiet] [--threads] [--timeout] [--tor] [--very-verbose]
2422
```
2523
2624
Debugger: open("/tmp/aa.txt", "a").write("{}: <MSG>\n".format(<VAR>))
@@ -36,23 +34,14 @@
3634
parser.add_argument(metavar="input file",
3735
dest="input_file",
3836
help="Path to the file containing URLs")
39-
parser.add_argument(metavar="file extension",
40-
dest="ext",
41-
choices=["7z", "apk", "bat", "bz", "bz2", "crypt", "dll", "doc", "docx", "exe", "gz", "hta", "iso", "jar", "json", "lnk", "ppt", "ps1", "py", "rar", "sfx", "sh", "tar", "vb", "vbs", "xld", "xls", "xlsx", "zip"],
42-
help="7z, apk, bat, bz, bz2, crypt, dll, doc, docx, exe, gz, hta, iso, jar, json, lnk, ppt, ps1, py, rar, sfx, sh, tar, vb, vbs, xld, xls, xlsx, zip")
43-
parser.add_argument("--file-dir",
44-
dest="file_dir",
45-
default="./InterestingFile/",
37+
parser.add_argument("--directory",
38+
dest="cap_dir",
39+
default="./Captures/",
4640
required=False,
47-
help="Directory to use for interesting files detected (default: ./InterestingFiles)")
48-
parser.add_argument("--kit-dir",
49-
dest="kit_dir",
50-
default="./KitJackinSeason/",
51-
required=False,
52-
help="Directory to use for phishing kits detected (default: ./KitJackinSeason)")
41+
help="Download data to CAP_DIR (default: ./Captures)")
5342
parser.add_argument("--level",
5443
dest="level",
55-
default=0,
44+
default=1,
5645
required=False,
5746
type=str,
5847
help="Directory depth (default=1, infinite=0")
@@ -72,7 +61,7 @@
7261
default=30,
7362
required=False,
7463
type=int,
75-
help="Set time to wait for a connection")
64+
help="Set the connection timeout to TIMEOUT")
7665
parser.add_argument("--tor",
7766
dest="tor",
7867
action="store_true",
@@ -83,11 +72,8 @@
8372
action="store_true",
8473
required=False,
8574
help="Show error messages")
86-
args = parser.parse_args()
87-
uagent = "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko"
88-
8975
# Fix directory names
90-
args = commons.fix_directory(args)
76+
args = commons.fix_directory(parser.parse_args())
9177

9278
def main():
9379
""" """
@@ -96,36 +82,28 @@ def main():
9682

9783
# Print start messages
9884
commons.show_summary(args)
99-
commons.show_networking(args, uagent)
85+
commons.show_networking(args) # globals: proxies, torsocks
10086

101-
# Read suspicious.yaml
102-
suspicious = commons.read_suspicious(args)
87+
# Read config.yaml
88+
commons.read_config(args) # globals: config
10389

10490
# Recompile exclusions
105-
commons.recompile_exclusions()
106-
107-
# Build dict of extensions
108-
extensions = {}
109-
extensions.update(suspicious["archives"])
110-
extensions.update(suspicious["files"])
111-
112-
# Read file containing URLs
113-
urls = commons.read_file(args.input_file)
91+
commons.recompile_exclusions() # globals: exclusions
11492

11593
# Create queues
116-
recursion_queue = commons.create_queue("recursion_queue")
94+
url_queue = commons.create_queue("url_queue")
11795

11896
# Create threads
119-
commons.RecursiveQueueManager(args, recursion_queue, uagent, extensions)
97+
commons.UrlQueueManager(args, url_queue)
98+
99+
# Read file containing URLs
100+
urls = commons.read_file(args.input_file)
120101

121102
# Process URLs
122103
for url in urls:
123-
if not (url.startswith("http://") or url.startswith("https://")):
124-
continue
125-
126-
recursion_queue.put(url)
104+
url_queue.put(url)
127105

128-
recursion_queue.join()
106+
url_queue.join()
129107
return
130108

131109
if __name__ == "__main__":

aa_certstream.py

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,20 @@
88
99
Optional arguments:
1010
- --dns-twist : Check the twisted keywords found in dns_twisted.yaml
11-
- --file-dir : Directory to use for interesting files detected (default: ./InterestingFiles/)
12-
- --kit-dir : Directory to use for phishing kits detected (default: ./KitJackinSeason/)
11+
- --directory : Save data to CAP_DIR (default: ./Captures/)
1312
- --level : Recursion depth (default=1, infinite=0)
1413
- --log-nc : File to store domains that have not been checked
1514
- --quiet : Don't show wget output
1615
- --score : Minimum score to trigger a session (Default: 75)
1716
- --threads : Numbers of threads to spawn
18-
- --timeout : Set time to wait for a connection
17+
- --timeout : Set the connection timeout to TIMEOUT
1918
- --tor : Download files via the Tor network
2019
- --verbose : Show domains being scored
2120
- --very-verbose : Show error messages
2221
2322
Usage:
2423
```
25-
python aa_certstream.py [--dns-twist] [--file-dir] [--kit-dir] [--level] [--log-nc] [--quiet] [--score] [--threads] [--timeout] [--tor] [--verbose] [--very-verbose]
24+
python aa_certstream.py [--dns-twist] [--directory] [--level] [--log-nc] [--quiet] [--score] [--threads] [--timeout] [--tor] [--verbose] [--very-verbose]
2625
```
2726
2827
Debugger: open("/tmp/aa.txt", "a").write("{}: <MSG>\n".format(<VAR>))
@@ -50,16 +49,11 @@
5049
action="store_true",
5150
required=False,
5251
help="Check the twisted keywords found in dns_twisted.yaml")
53-
parser.add_argument("--file-dir",
54-
dest="file_dir",
55-
default="./InterestingFile/",
52+
parser.add_argument("--directory",
53+
dest="cap_dir",
54+
default="./Captures/",
5655
required=False,
57-
help="Directory to use for interesting files detected (default: ./InterestingFiles/)")
58-
parser.add_argument("--kit-dir",
59-
dest="kit_dir",
60-
default="./KitJackinSeason/",
61-
required=False,
62-
help="Directory to use for phishing kits detected (default: ./KitJackinSeason/)")
56+
help="Download data to CAP_DIR (default: ./Captures)")
6357
parser.add_argument("--level",
6458
dest="level",
6559
default=1,
@@ -93,7 +87,7 @@
9387
default=30,
9488
required=False,
9589
type=int,
96-
help="Set time to wait for a connection")
90+
help="Set the connection timeout to TIMEOUT")
9791
parser.add_argument("--tor",
9892
dest="tor",
9993
action="store_true",
@@ -109,16 +103,13 @@
109103
action="store_true",
110104
required=False,
111105
help="Show error messages")
112-
args = parser.parse_args()
113-
uagent = "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko"
106+
# Fix directory names
107+
args = commons.fix_directory(parser.parse_args())
114108

115109
# Set threads to a minimum of 20 if using --dns-twist
116110
if args.dns_twist and args.threads < 20:
117111
args.threads = 20
118112

119-
# Fix directory names
120-
args = commons.fix_directory(args)
121-
122113
tqdm.tqdm.monitor_interval = 0
123114

124115
def callback(message, context):
@@ -145,7 +136,7 @@ def callback(message, context):
145136

146137
pbar.update(1)
147138

148-
score = commons.score_domain(suspicious, domain.lower(), args)
139+
score = commons.score_domain(config, domain.lower(), args)
149140

150141
if "Let's Encrypt" in message["data"]["chain"][0]["subject"]["aggregated"]:
151142
score += 10
@@ -215,27 +206,27 @@ def on_open(instance):
215206
def main():
216207
""" """
217208
global exclusions
218-
global suspicious
209+
global config
219210
global url_queue
220211

221212
# Check if output directories exist
222213
commons.check_path(args)
223214

224215
# Print start messages
225216
commons.show_summary(args)
226-
commons.show_networking(args, uagent)
217+
commons.show_networking(args) # globals: proxies, torsocks
227218

228-
# Read suspicious.yaml
229-
suspicious = commons.read_suspicious(args)
219+
# Read config.yaml
220+
config = commons.read_config(args) # globals: config
230221

231222
# Recompile exclusions
232-
exclusions = commons.recompile_exclusions()
223+
exclusions = commons.recompile_exclusions() # globals: exclusions
233224

234225
# Create queues
235226
url_queue = commons.create_queue("url_queue")
236227

237228
# Create threads
238-
commons.UrlQueueManager(args, url_queue, uagent)
229+
commons.UrlQueueManager(args, url_queue)
239230

240231
# Listen for events via Certstream
241232
print(colored("Connecting to Certstream...\n", "yellow", attrs=["bold"]))

0 commit comments

Comments
 (0)