Skip to content

Commit 2e1bad8

Browse files
committed
Merge branch 'master' into issues/19-encrypted_dns
2 parents f9b0adc + 9e03c61 commit 2e1bad8

File tree

673 files changed

+59610
-107516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

673 files changed

+59610
-107516
lines changed

.goreleaser.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ release:
5555
footer: |
5656
## Enjoy!
5757
58-
Those were the changes on {{ .Tag }}!
59-
6058
# You can change the name of the release.
6159
# Default is `{{.Tag}}` on OSS and `{{.PrefixedTag}}` on Pro.
6260
name_template: "{{.ProjectName}}-v{{.Version}}"

README.md

Lines changed: 77 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@ teams to evaluate security controls (e.g. firewalls) and ensure that monitoring
2424
are able to detect malicious traffic.
2525
2626
Usage:
27-
flightsim <command> [arguments]
27+
flightsim <command> [arguments]
2828
29-
Available Commands:
30-
run Run all modules, or a particular module
31-
version Prints the version number
29+
Available commands:
30+
get Get a list of elements (ie. families) of a certain category (ie. c2)
31+
run Run all modules, or a particular module
32+
version Prints the version number
3233
3334
Cheatsheet:
34-
flightsim run Run all the modules
35-
flightsim run c2 Simulate C2 traffic
36-
flightsim run c2:trickbot Simulate C2 traffic for the TrickBot family
35+
flightsim run Run all the modules
36+
flightsim run c2 Simulate C2 traffic
37+
flightsim run c2:trickbot Simulate C2 traffic for the TrickBot family
38+
flightsim run ssh-transfer:1GB Simulate a 1GB SSH/SFTP file transfer
39+
40+
flightsim get families:c2 Get a list of all c2 families
3741
```
3842

3943
The utility runs individual modules to generate malicious traffic. To perform all available tests, simply use `flightsim run` which will generate traffic using the first available non-loopback network interface. **Note:** when running many modules, flightsim will gather destination addresses from the AlphaSOC API, so requires egress Internet access.
@@ -44,7 +48,7 @@ To list the available modules, use `flightsim run --help`. To execute a particul
4448
$ flightsim run --help
4549
usage: flightsim run [flags] [modules]
4650
47-
To run all available simulators, call:
51+
To run all available modules, call:
4852
4953
flightsim run
5054
@@ -54,45 +58,82 @@ To run all available simulators, call:
5458
5559
Available modules:
5660
57-
c2, dga, miner, scan, sink, spambot, tunnel-dns, tunnel-icmp
61+
c2, dga, imposter, miner, scan, sink, spambot, ssh-exfil, ssh-transfer, tunnel-dns, tunnel-icmp
5862
5963
Available flags:
6064
-dry
61-
print actions without performing any network activity
65+
print actions without performing any network activity
6266
-fast
63-
reduce sleep intervals between simulation events
67+
reduce sleep intervals between simulation events
6468
-iface string
65-
network interface or local IP address to use
69+
network interface or local IP address to use
6670
-size int
67-
number of hosts generated for each simulator
71+
number of hosts generated for each simulator
6872
6973
$ flightsim run dga
7074
7175
AlphaSOC Network Flight Simulator™ (https://github.com/alphasoc/flightsim)
72-
The IP address of the network interface is 172.20.10.2
73-
The current time is 23-Jan-20 11:33:21
74-
75-
11:33:21 [dga] Generating a list of DGA domains
76-
11:33:21 [dga] Resolving nurqatp.space
77-
11:33:22 [dga] Resolving uahscqe.top
78-
11:33:23 [dga] Resolving asimazf.biz
79-
11:33:24 [dga] Resolving phxeohj.biz
80-
11:33:25 [dga] Resolving crgwsoe.biz
81-
11:33:26 [dga] Resolving sazafls.biz
82-
11:33:27 [dga] Resolving gljyxdv.space
83-
11:33:28 [dga] Resolving eiontgl.top
84-
11:33:29 [dga] Resolving pqjseqc.top
85-
11:33:30 [dga] Resolving mamsnmu.biz
86-
11:33:31 [dga] Resolving ntettqn.top
87-
11:33:32 [dga] Resolving niyvbvg.top
88-
11:33:33 [dga] Resolving bxgqonb.biz
89-
11:33:34 [dga] Resolving encggla.top
90-
11:33:35 [dga] Resolving qphfoxn.biz
91-
11:33:35 [dga] Done (15/15)
76+
The address of the network interface for IP traffic is 192.168.220.38
77+
The address of the network interface for DNS queries is 192.168.220.38
78+
The current time is 26-Oct-21 17:28:51
79+
80+
17:28:51 [dga] Generating a list of DGA domains
81+
17:28:51 [dga] Resolving 6kauziij.com
82+
17:28:52 [dga] Resolving paxeo0jk.biz
83+
17:28:53 [dga] Resolving iuuub8al.biz
84+
17:28:54 [dga] Resolving bxsei3nj.com
85+
17:28:55 [dga] Resolving zbwltf1h.space
86+
17:28:56 [dga] Resolving yoze7avi.com
87+
17:28:57 [dga] Resolving ijax8aqw.space
88+
17:28:58 [dga] Resolving wwrjyj4l.space
89+
17:28:59 [dga] Resolving uioc5hky.com
90+
17:29:00 [dga] Resolving lcwdji5t.biz
91+
17:29:01 [dga] Resolving zluwcb4h.biz
92+
17:29:02 [dga] Resolving 8jodcvhj.space
93+
17:29:03 [dga] Resolving ju5haxur.com
94+
17:29:04 [dga] Resolving ivthu2dl.biz
95+
17:29:05 [dga] Resolving ha0bsxft.com
96+
17:29:05 [dga] Done (15/15)
9297
9398
All done! Check your SIEM for alerts using the timestamps and details above.
9499
```
95100

101+
The utility also has a `get` command which can be used to query information that can later be used with the simulation modules. At present, a list of C2 families can be obtained to be used with the C2 module. To see how to use the `get` command, run `flightsim get -h` as below.
102+
103+
```
104+
$ flightsim get -h
105+
106+
AlphaSOC Network Flight Simulator™ (https://github.com/alphasoc/flightsim)
107+
The current time is 26-Oct-21 17:42:23
108+
109+
usage: flightsim get [flags] element:category
110+
111+
Available elements:
112+
113+
families
114+
115+
Available categories:
116+
117+
c2
118+
119+
Available flags:
120+
```
121+
122+
To get a list of C2 families, run:
123+
124+
```
125+
$ flightsim get families:c2
126+
127+
AlphaSOC Network Flight Simulator™ (https://github.com/alphasoc/flightsim)
128+
The current time is 26-Oct-21 17:43:51
129+
130+
17:43:51 [families:c2] Fetching c2 families
131+
17:44:01 [families:c2] 404 Keylogger, AB Stealer, AceRAT, Adwind, Agent Tesla, Aggah, Alien, Amadeus Stealer, Amadey, Anubis, APT29, Ares, Arkei Stealer, ARS VBS Loader, AsyncRAT, Athena, ATRAPS, Avalon, Ave Maria, AZORult, Banload, BASHLITE, BazarBackdoor, Beta Bot, BitRAT, BlackMatter, BlackNET RAT, BlackRock, Blackshades, BlackWorm RAT, Bloody Stealer, BlueBot, Bozok RAT, Buer Loader, Cafeini, CCleaner Backdoor, cerberus, Cerberus, ChaChi, Chrysaor, Citadel, Cloud Stalker, Cobalt Strike, Colibri, Collector Stealer, cookiestealer, coronastealer, Crimson RAT, CryptBot, CyberGate RAT, Cypress, Cythosia, DanaBot, DarkComet, DarkSide, Darktrack RAT, DCRat, deeprats, DiamondFox, Djvu, DoppelDridex, Dridex, Eredel, evilbear, FakeCop, Ficker Stealer, FIN7, FlawedGrace, FormBook, GachiSteal, Gaudox, Gazorp, GCleaner, Gh0st RAT, Glupteba, Godzilla Loader, Gomorrah, gomorrahstealer, Gorynych, Gozi, Grandoreiro, griffon, GuLoader, H1N1, HAFNIUM, Hancitor, Haxdoor, Hidden Tear, HorusEyes, Houdini, Hydra, IcedID, ISR Stealer, JackPOS, JSOutProx, KeyBase, Keylogger, Kimsuky, KPOT Stealer, Lemon Duck, Lilith, LimeRAT, LiteHTTP, littlethief, Loda, LokiBot, Lu0bot, Lucifer, MassLogger, Mekotio, Metamorfo, Metasploit, Mirai, MirrorBlast, Mispadu, modernloader, MooBot, Mozi, Mythic, NanoCore RAT, Netbounce, NetBus, Netfilter Rootkit, NetSupport Manager, NetWire RAT, Neutrino, Nexus, Nishang, Nixscare, njRAT, NOBELIUM, NodeJS Ransomware, NovaHTTP, Orcus RAT, Oski Stealer, Ostap, Ousaban, Ozone RAT, Parallax RAT, Parasite HTTP RAT, plague, Poison Ivy, Pony, PoshC2, Poulight Stealer, PowerShell Empire, Predator the Thief, ProjectSpy, ProRat, PsiXBot, Purple Fox, QNAPCrypt, QNodeService, Quakbot, Quasar RAT, Qudox, Raccoon Stealer, Ratty, RedLine, RedLine Stealer, Remcos RAT, RevengeRAT, REvil, Rezo, RMS, RuRAT, Ryuk, saint, Sality, SamoRAT, Saruman Stealer, SectopRAT, ServHelper, Seth HTTP Botnet, sh1zo1der, sicherheitrat, SilverFish, sliver, sLoad, Smoke Loader, SolarMarker, SOMBRAT, Squirrelwaffle, SquirrelWaffle, Stealer-DT, StealthWorker, StealthWorker Go, StormKitty, STRRAT, SupremeMiner, systembc, SystemBC, TA505, Taurus, TeamBot, Tofsee, TrickBot, TriumphLoader, Tsunami, TVRAT, uAdmin, Umbra Loader, Ursnif, vertex, VertexNet, Vidar, Vjw0rm, VKeylogger, VoidRAT, Vulturi Stealer, XOR DDoS, XpertRAT, XtremeRAT, ZeroAccess, Zeus, zgRAT, ZHacker13 ReverseTCPShell, Zloader, ztds, Zyklon
132+
17:44:01 [families:c2] Fetched 220 c2 families
133+
134+
All done!
135+
```
136+
96137
## Description of Modules
97138

98139
The modules packaged with the utility are listed in the table below.
@@ -101,9 +142,12 @@ The modules packaged with the utility are listed in the table below.
101142
| ------------- | ----------------------------------------------------------------------------- |
102143
| `c2` | Generates both DNS and IP traffic to a random list of known C2 destinations |
103144
| `dga` | Simulates DGA traffic using random labels and top-level domains |
145+
| `imposter` | Generates DNS traffic to a list of imposter domains |
104146
| `miner` | Generates Stratum mining protocol traffic to known cryptomining pools |
105147
| `scan` | Performs a port scan of random RFC 5737 addresses using common TCP ports |
106148
| `sink` | Connects to known sinkholed destinations run by security researchers |
107149
| `spambot` | Resolves and connects to random Internet SMTP servers to simulate a spam bot |
150+
| `ssh-exfil` | Simulates an SSH file transfer to a service running on a non-standard SSH port|
151+
| `ssh-transfer`| Simulates an SSH file transfer to a service running on an SSH port |
108152
| `tunnel-dns` | Generates DNS tunneling requests to \*.sandbox.alphasoc.xyz |
109153
| `tunnel-icmp` | Generates ICMP tunneling traffic to an Internet service operated by AlphaSOC |

cmd/get/get.go

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
// Package get implements the get command.
2+
package get
3+
4+
import (
5+
"flag"
6+
"fmt"
7+
"os"
8+
"strings"
9+
"text/tabwriter"
10+
"time"
11+
12+
"github.com/alphasoc/flightsim/wisdom"
13+
)
14+
15+
var Version string
16+
17+
var usage = `usage: flightsim get [flags] element:category
18+
19+
Available elements:
20+
21+
%s
22+
23+
Available categories:
24+
25+
%s
26+
27+
Available flags:
28+
`
29+
30+
// printWelcome prints a basic welcome banner.
31+
func printWelcome() {
32+
fmt.Printf(`
33+
AlphaSOC Network Flight Simulator™ %s (https://github.com/alphasoc/flightsim)
34+
The current time is %s
35+
`, Version, time.Now().Format("02-Jan-06 15:04:05"))
36+
}
37+
38+
// printGoodbye prints a parting message.
39+
func printGoodbye() {
40+
fmt.Printf("\nAll done!\n")
41+
}
42+
43+
// printMsg prints msg, decorated with an info string and the current date/time.
44+
func printMsg(info string, msg string) {
45+
if msg == "" {
46+
return
47+
}
48+
fmt.Printf("%s [%s] %s\n", time.Now().Format("15:04:05"), info, msg)
49+
}
50+
51+
// We only know how to get families for now.
52+
var supportedElementsMap = map[string]bool{
53+
"families": true,
54+
}
55+
56+
// supportedElements returns a slice of fetchable elements.
57+
func supportedElements() []string {
58+
var elements []string
59+
for e := range supportedElementsMap {
60+
elements = append(elements, e)
61+
}
62+
return elements
63+
}
64+
65+
// Taken from open-wisdom/server/entries/entries.go.
66+
// TODO: would be good to fetch these also.
67+
var supportedCategoriesMap = map[string]bool{
68+
"c2": true,
69+
}
70+
71+
// supportedCategories returns a slice of fetchable categories.
72+
func supportedCategories() []string {
73+
var categories []string
74+
for e := range supportedCategoriesMap {
75+
categories = append(categories, e)
76+
}
77+
return categories
78+
}
79+
80+
// computeFormatStr returns a format string to be used with column printing.
81+
func computeFormatStr(cols int) string {
82+
fmtStr := "\n"
83+
for i := 0; i < cols; i++ {
84+
fmtStr += "%v\t"
85+
}
86+
return fmtStr
87+
}
88+
89+
// printCol prints elements in cols columns.
90+
func printCol(elements []string, cols int) {
91+
w := new(tabwriter.Writer)
92+
// Min width, tab width, padding, pad char, flags.
93+
w.Init(os.Stdout, 8, 8, 1, '\t', 0)
94+
// Compute format string.
95+
fmtStr := computeFormatStr(cols)
96+
// Convert elements ([]string) to []interface{}.
97+
elementsToPrint := make([]interface{}, len(elements))
98+
for i, v := range elements {
99+
elementsToPrint[i] = v
100+
}
101+
// Print.
102+
i := 0
103+
lenElementsToPrint := len(elementsToPrint)
104+
for leftToPrint := lenElementsToPrint; leftToPrint > 0; {
105+
// We don't have enough elements left to print to satisfy the format string,
106+
// or the re-slice. Thus, reset *cols and recompute the format string.
107+
if leftToPrint < cols {
108+
cols = leftToPrint
109+
fmtStr = computeFormatStr(cols)
110+
}
111+
fmt.Fprintf(w, fmtStr, elementsToPrint[i:i+cols]...)
112+
// Move by number of columns.
113+
i += cols
114+
leftToPrint = lenElementsToPrint - i
115+
}
116+
// Append a blank line.
117+
fmt.Fprintf(w, "%v", "\n\n")
118+
w.Flush()
119+
}
120+
121+
// RunCmd runs the 'get' command and returns an error.
122+
func RunCmd(args []string) error {
123+
printWelcome()
124+
// Mirrors look of run command.
125+
fmt.Println("")
126+
cmdLine := flag.NewFlagSet("get", flag.ExitOnError)
127+
// TODO: replace cols with -format (issue #45).
128+
// cols := cmdLine.Int("cols", 0, "print elements in number of columns")
129+
usageMsg := fmt.Sprintf(usage, strings.Join(supportedElements(), ", "), strings.Join(supportedCategories(), ", "))
130+
cmdLine.Usage = func() {
131+
fmt.Fprintf(cmdLine.Output(), usageMsg)
132+
cmdLine.PrintDefaults()
133+
}
134+
cmdLine.Parse(args)
135+
// Next arg should be element:category (ie. families:c2)
136+
toGet := cmdLine.Arg(0)
137+
if len(toGet) == 0 {
138+
return fmt.Errorf("nothing to get\n\n%v", usageMsg)
139+
}
140+
toGetArr := strings.Split(cmdLine.Arg(0), ":")
141+
if len(toGetArr) != 2 {
142+
return fmt.Errorf("unable to get '%v': invalid format", toGet)
143+
}
144+
elem := toGetArr[0]
145+
cat := toGetArr[1]
146+
// infoTag == "element:category" (ie. families:c2). Mirrors the run command.
147+
infoTag := cmdLine.Arg(0)
148+
var elements []string
149+
var err error
150+
switch elem {
151+
case "families":
152+
printMsg(infoTag, fmt.Sprintf("Fetching %v %v", cat, elem))
153+
elements, err = wisdom.Families(cat)
154+
if err != nil {
155+
return err
156+
}
157+
default:
158+
return fmt.Errorf("unable to get '%v': unsupported element '%v'", toGet, elem)
159+
}
160+
// TODO: Leave quotes in for later cut/paste?
161+
for i := 0; i < len(elements); i++ {
162+
elements[i] = strings.Trim(elements[i], "\"")
163+
}
164+
// Default is to print in a single line. Otherwise, column print.
165+
// if *cols <= 0 {
166+
// printMsg(infoTag, strings.Join(elements, ", "))
167+
// } else {
168+
// printCol(elements, *cols)
169+
// }
170+
printMsg(infoTag, strings.Join(elements, ", "))
171+
172+
printMsg(infoTag, fmt.Sprintf("Fetched %v %v %v", len(elements), cat, elem))
173+
printGoodbye()
174+
return nil
175+
}

cmd/run/print.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ func printMsg(s *Simulation, msg string) {
2121
fmt.Printf("%s [%s] %s\n", time.Now().Format("15:04:05"), s.Name(), msg)
2222
}
2323

24-
func printWelcome(ip string) {
24+
func printWelcome(ip, dnsIntfIP string) {
2525
fmt.Printf(`
2626
AlphaSOC Network Flight Simulator™ %s (https://github.com/alphasoc/flightsim)
27-
The IP address of the network interface is %s
27+
The address of the network interface for IP traffic is %s
28+
The address of the network interface for DNS queries is %s
2829
The current time is %s
29-
`, Version, ip, time.Now().Format("02-Jan-06 15:04:05"))
30+
`, Version, ip, dnsIntfIP, time.Now().Format("02-Jan-06 15:04:05"))
3031
}
3132

3233
func printGoodbye() {

0 commit comments

Comments
 (0)