Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added interface definitions for public structs Moved keys logic to its own package Replaced client gob encoding by json for better interoperability Moved crypto things to crypto package Fixed tests
- Loading branch information
Showing
19 changed files
with
1,047 additions
and
718 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package e4common | ||
|
||
// Command is a command sent by C2 to a client. | ||
type Command int | ||
|
||
// ... | ||
const ( | ||
RemoveTopic Command = iota | ||
ResetTopics | ||
SetIDKey | ||
SetTopicKey | ||
RemovePubKey | ||
ResetPubKeys | ||
SetPubKey | ||
) | ||
|
||
// ToByte converts a command into its byte representation | ||
func (c *Command) ToByte() byte { | ||
switch *c { | ||
case RemoveTopic: | ||
return 0 | ||
case ResetTopics: | ||
return 1 | ||
case SetIDKey: | ||
return 2 | ||
case SetTopicKey: | ||
return 3 | ||
case RemovePubKey: | ||
return 4 | ||
case ResetPubKeys: | ||
return 5 | ||
case SetPubKey: | ||
return 6 | ||
} | ||
return 255 | ||
} | ||
|
||
// ToString converts a command into its string representation. | ||
func (c *Command) ToString() string { | ||
|
||
switch *c { | ||
case RemoveTopic: | ||
return "RemoveTopic" | ||
case ResetTopics: | ||
return "ResetTopics" | ||
case SetIDKey: | ||
return "SetIDKey" | ||
case SetTopicKey: | ||
return "SetTopicKey" | ||
case RemovePubKey: | ||
return "RemovePubKey" | ||
case ResetPubKeys: | ||
return "ResetPubKeys" | ||
case SetPubKey: | ||
return "SetPubKey" | ||
} | ||
return "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package crypto | ||
|
||
// ... | ||
const ( | ||
IDLen = 16 | ||
KeyLen = 32 | ||
TagLen = 16 | ||
HashLen = 16 | ||
TimestampLen = 8 | ||
MaxTopicLen = 512 | ||
MaxSecondsDelay = 60 * 10 | ||
|
||
IDLenHex = IDLen * 2 | ||
KeyLenHex = KeyLen * 2 | ||
|
||
NameMinLen = 1 | ||
NameMaxLen = 255 | ||
) |
Oops, something went wrong.