Skip to content

Implement Redis protocol#202

Merged
nl5887 merged 1 commit into
honeytrap:masterfrom
CapacitorSet:master
Feb 28, 2018
Merged

Implement Redis protocol#202
nl5887 merged 1 commit into
honeytrap:masterfrom
CapacitorSet:master

Conversation

@CapacitorSet

Copy link
Copy Markdown
Contributor

As mentioned in #201, the current Redis implementation is not compatible with Redis clients - it only implements the inline commands, which (as far as I know) isn't widely used.

This PR implements the Redis protocol with a simple parser, but does not support the "inline commands". If needed, it can also be implemented.

@nl5887

nl5887 commented Feb 28, 2018

Copy link
Copy Markdown
Contributor

Nice, thanks a lot!

@nl5887 nl5887 merged commit ae8b14d into honeytrap:master Feb 28, 2018
Comment thread services/redis/redis.go
func (d *redisDatum) ToString() (value string, success bool) {
switch d.DataType {
case 0x2b:
fallthrough

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CapacitorSet Why do you use a fallthrough here? Ty

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parser will put a string in Content both if it receives a simple string 0x2b (line 120, it uses cmd which is of type string) or if it receives a bulk string 0x24 (line 129, str is of type string). Therefore, in both cases we use the same logic, a type assertion to string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants