Skip to content

Latest commit

 

History

History
56 lines (38 loc) · 1.43 KB

README.md

File metadata and controls

56 lines (38 loc) · 1.43 KB

RSDGA

Really Simple Domain Generation Algorithm

Short and to the point Go library for generating domain names based on supplied parameters. A Domain Generation Algorithm is used to circumvent general domain blocklists by generating seemingly random domain names (In this case: using the current date along with an optional seed, hashed with MD5). A better description and overview can be found here.

Written for the Hands-on Writing Malware in Go talk at BSidesDC 2019.

For legal use only.

Pretty simple (One might say really simple):

import (
	"fmt"
	"time"

	"github.com/cs-5/rsdga"
)

func main() {
	t := time.Now()

	/* Use the current time to supply the year, month, and day. Use ".com" as the TLD */
	gen := rsdga.New(t.Year(), int(t.Month()), t.Day(), "com")

	/* Print out 5 domains */
	for i := 0; i < 5; i++ {
		fmt.Println(gen.Next())
	}
}

Output:

7cf3c19ef5871a8bdca3288bac26f615.com
813ed870de75f3605f7d4b2a0fe93608.com
6d06004feb188a4a463affbdbfff51d3.com
e285c151730d8a5ec59369d609df3e07.com
bec43b55c54522cfa12eaaef55c6f460.com

Make a new Generator

Without a seed: generator := rsdga.New(2019, 01, 01, "com")

With a seed: generator := rsdga.NewSeeded(2019, 01, 01, 1234, "com")

Get Domain

domain := generator.Next()