New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] services : hadoop : implemented hadoop_namenode and hadoop_datanode #368
base: master
Are you sure you want to change the base?
Conversation
|
Codecov Report
@@ Coverage Diff @@
## master #368 +/- ##
==========================================
+ Coverage 41.22% 41.67% +0.45%
==========================================
Files 81 78 -3
Lines 8949 8796 -153
==========================================
- Hits 3689 3666 -23
+ Misses 4828 4705 -123
+ Partials 432 425 -7
Continue to review full report at Codecov.
|
"github.com/honeytrap/honeytrap/services" | ||
) | ||
|
||
/*-------- DOCKER CONFIGURATION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not just for docker, just a configuration sample.
|
||
[service.hadoop_datanode] | ||
type="hadoop_datanode" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make the version and os also configurable?
s.ch = ch | ||
} | ||
|
||
func ShowRequest(reqMethod, reqUri string, s *hadoopService, conn net.Conn) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you pass the request struct, you can use the request url .Path for matching. For the query params, just use req.Form after executing req.ParseForm().
s.ch.Send(event.New( | ||
services.EventOptions, | ||
event.Category("hadoop_namenode"), | ||
event.SourceAddr(conn.RemoteAddr()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the called service and name are also interesting for the event
|
||
func ShowRequest(reqMethod, reqUri string, s *hadoopService, conn net.Conn) { | ||
if reqMethod == "GET" { | ||
if strings.HasPrefix(reqUri, "/jmx?qry=") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at the Ethereum service for an approach to request / responses for http protocols
016c7ea
to
24e1886
Compare
51ed42b
to
a3ba210
Compare
buff := bytes.Buffer{} | ||
|
||
if req.URL.Path != "/jmx" { | ||
fn := template.HTMLEscaper(s.htmlErrorPage(req.URL.Path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to do HTMLEscape
if you translate it back immediately.
} | ||
|
||
func (s *hadoopService) htmlErrorPage(reqPath string) string { | ||
return fmt.Sprintln(` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to use Sprintln, just return the string
There is a lot of double code between name_node and data_node files. Could you move this into a single file and use that in your services. |
842fb58
to
06b68af
Compare
b61a49c
to
7234f6a
Compare
No description provided.