Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tobusucs
Copy link

@tobusucs tobusucs commented Jul 6, 2018

No description provided.

@CLAassistant
Copy link

CLAassistant commented Jul 6, 2018

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov-io
Copy link

codecov-io commented Jul 6, 2018

Codecov Report

Merging #368 into master will increase coverage by 0.45%.
The diff coverage is 0%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
server/honeytrap.go 3.15% <0%> (-0.29%) ⬇️
server/matchers.go 0% <0%> (ø) ⬆️
services/ldap/search.go 0% <0%> (ø) ⬆️
services/smtp/storage.go 65.15% <0%> (ø) ⬆️
services/limiter.go 0% <0%> (ø) ⬆️
server/options.go 0% <0%> (ø) ⬆️
services/ldap/bind.go 47.5% <0%> (ø) ⬆️
services/copy.go 0% <0%> (ø) ⬆️
pushers/elasticsearch/elasticsearch.go 0% <0%> (ø) ⬆️
... and 61 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1f9418...3bdb28b. Read the comment docs.

@tobusucs tobusucs changed the title services : hadoop : implemented hadoop_namenode and hadoop_datanode [WIP] services : hadoop : implemented hadoop_namenode and hadoop_datanode Jul 6, 2018
"github.com/honeytrap/honeytrap/services"
)

/*-------- DOCKER CONFIGURATION
Copy link
Contributor

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"

Copy link
Contributor

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) {
Copy link
Contributor

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()),
Copy link
Contributor

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=") {
Copy link
Contributor

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

@tobusucs tobusucs force-pushed the test_hadoop branch 5 times, most recently from 016c7ea to 24e1886 Compare July 12, 2018 13:55
@tobusucs tobusucs force-pushed the test_hadoop branch 6 times, most recently from 51ed42b to a3ba210 Compare July 19, 2018 08:40
buff := bytes.Buffer{}

if req.URL.Path != "/jmx" {
fn := template.HTMLEscaper(s.htmlErrorPage(req.URL.Path))
Copy link
Collaborator

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(`
Copy link
Collaborator

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

@sammynx
Copy link
Collaborator

sammynx commented Jul 19, 2018

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.

@tobusucs tobusucs force-pushed the test_hadoop branch 2 times, most recently from 842fb58 to 06b68af Compare July 20, 2018 13:28
@tobusucs tobusucs force-pushed the test_hadoop branch 3 times, most recently from b61a49c to 7234f6a Compare August 2, 2018 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants