-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
155 additions
and
51 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 |
---|---|---|
@@ -1,12 +1,18 @@ | ||
# Ignore .git folder | ||
.git* | ||
|
||
Dockerfile* | ||
docker-compose* | ||
.dockerignore | ||
.git | ||
.gitignore | ||
|
||
docs* | ||
.circleci* | ||
.vscode* | ||
|
||
README.md | ||
README.md.bu | ||
NOTES.md | ||
LICENSE | ||
.vscode | ||
Makefile | ||
CHANGELOG.md | ||
|
||
*.tar | ||
seccomp.json | ||
Vagrantfile |
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
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 |
---|---|---|
@@ -1,43 +1,92 @@ | ||
REPO=malice-plugins/windows-defender | ||
ORG=malice | ||
NAME=windows-defender | ||
CATEGORY=av | ||
VERSION=$(shell cat VERSION) | ||
MALWARE="befb88b89c2eb401900a68e9f5b78764203f2b48264fcc3f7121bf04a57fd408" | ||
|
||
all: build size test | ||
|
||
dev: | ||
docker build -t $(ORG)/$(NAME):dev -f Dockerfile.dev . | ||
all: build size test test-markdown | ||
|
||
build: | ||
build: ## Build docker image | ||
docker build -t $(ORG)/$(NAME):$(VERSION) . | ||
|
||
size: | ||
sed -i.bu 's/docker image-.*-blue/docker image-$(shell docker images --format "{{.Size}}" $(ORG)/$(NAME):$(VERSION))-blue/' README.md | ||
.PHONY: dev | ||
dev: ## Build dev docker image | ||
docker build -f Dockerfile.dev -t $(ORG)/$(NAME):dev . | ||
|
||
.PHONY: size | ||
size: build ## Get built image size | ||
sed -i.bu 's/docker%20image-.*-blue/docker%20image-$(shell docker images --format "{{.Size}}" $(ORG)/$(NAME):$(VERSION)| cut -d' ' -f1)-blue/' README.md | ||
|
||
.PHONY: tags | ||
tags: | ||
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}" $(ORG)/$(NAME) | ||
|
||
.PHONY: tar | ||
tar: build | ||
docker save $(ORG)/$(NAME):$(VERSION) -o wdef.tar | ||
|
||
update: | ||
@docker run --rm $(ORG)/$(NAME):$(VERSION) update | ||
|
||
test: | ||
docker run --init --rm $(ORG)/$(NAME):$(VERSION) --help | ||
test -f befb88b89c2eb401900a68e9f5b78764203f2b48264fcc3f7121bf04a57fd408 || wget https://github.com/maliceio/malice-av/raw/master/samples/befb88b89c2eb401900a68e9f5b78764203f2b48264fcc3f7121bf04a57fd408 | ||
docker run --init --rm -v $(PWD):/malware $(ORG)/$(NAME):$(VERSION) -t befb88b89c2eb401900a68e9f5b78764203f2b48264fcc3f7121bf04a57fd408 > SAMPLE.md | ||
docker run --init --rm -v $(PWD):/malware $(ORG)/$(NAME):$(VERSION) -V befb88b89c2eb401900a68e9f5b78764203f2b48264fcc3f7121bf04a57fd408 > results.json | ||
cat results.json | jq . | ||
rm befb88b89c2eb401900a68e9f5b78764203f2b48264fcc3f7121bf04a57fd408 | ||
@docker save $(ORG)/$(NAME):$(VERSION) -o wdef.tar | ||
|
||
.PHONY: vagrant | ||
vagrant: tar | ||
@vagrant up | ||
@vagrant ssh | ||
|
||
circle: | ||
http https://circleci.com/api/v1.1/project/github/${REPO} | jq '.[0].build_num' > .circleci/build_num | ||
http "$(shell http https://circleci.com/api/v1.1/project/github/${REPO}/$(shell cat .circleci/build_num)/artifacts${CIRCLE_TOKEN} | jq '.[].url')" > .circleci/SIZE | ||
sed -i.bu 's/docker%20image-.*-blue/docker%20image-$(shell cat .circleci/SIZE)-blue/' README.md | ||
test: | ||
@echo "===> Starting elasticsearch" | ||
@docker rm -f elasticsearch || true | ||
@docker run --init -d --name elasticsearch -p 9200:9200 blacktop/elasticsearch | ||
@echo "===> ${NAME} --help" | ||
@sleep 10; docker run --rm $(ORG)/$(NAME):$(VERSION) | ||
@echo "===> ${NAME} malware test" | ||
@test -f $(MALWARE) || wget https://github.com/maliceio/malice-av/raw/master/samples/$(MALWARE) | ||
@docker run --rm --link elasticsearch -v $(PWD):/malware $(ORG)/$(NAME):$(VERSION) -V $(MALWARE) | jq . > docs/results.json | ||
@cat docs/results.json | jq . | ||
|
||
.PHONY: test-markdown | ||
test-markdown: | ||
@echo "===> ${NAME} pull MarkDown from elasticsearch results" | ||
@http localhost:9200/malice/_search | jq . > docs/elastic.json | ||
@cat docs/elastic.json | jq '.hits.hits[] ._source.plugins.${CATEGORY}' | jq -r '.["${NAME}"].markdown' > docs/SAMPLE.md | ||
@docker rm -f elasticsearch | ||
|
||
.PHONY: run | ||
run: stop ## Run docker container | ||
@docker run --init -d --name $(NAME) -p 9200:9200 $(ORG)/$(NAME):$(VERSION) | ||
|
||
.PHONY: ssh | ||
ssh: ## SSH into docker image | ||
@docker run -it --rm --entrypoint=sh $(ORG)/$(NAME):$(VERSION) | ||
|
||
.PHONY: ssh-dev | ||
ssh-dev: ## SSH into docker image | ||
@docker run -it --rm --entrypoint=sh $(ORG)/$(NAME):dev | ||
|
||
.PHONY: stop | ||
stop: ## Kill running docker containers | ||
@docker rm -f $(NAME) || true | ||
|
||
circle: ci-size | ||
@sed -i.bu 's/docker%20image-.*-blue/docker%20image-$(shell cat .circleci/SIZE)-blue/' README.md | ||
@echo "===> Image size is: $(shell cat .circleci/SIZE)" | ||
|
||
ci-build: | ||
@echo "===> Getting CircleCI build number" | ||
@http https://circleci.com/api/v1.1/project/github/${REPO} | jq '.[0].build_num' > .circleci/build_num | ||
|
||
ci-size: ci-build | ||
@echo "===> Getting image build size from CircleCI" | ||
@http "$(shell http https://circleci.com/api/v1.1/project/github/${REPO}/$(shell cat .circleci/build_num)/artifacts${CIRCLE_TOKEN} | jq '.[].url')" > .circleci/SIZE | ||
|
||
clean: ## Clean docker image and stop all running containers | ||
docker-clean stop | ||
docker rmi $(ORG)/$(NAME):$(VERSION) || true | ||
docker rmi $(ORG)/$(NAME):dev || true | ||
rm $(MALWARE) || true | ||
rm README.md.bu || true | ||
|
||
# Absolutely awesome: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | ||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
.PHONY: build size tags test tar circle vagrant | ||
.DEFAULT_GOAL := all |
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#### Windows Defender | ||
| Infected | Result | Engine | Updated | | ||
|:-------------:|:-----------:|:-----------:|:------------:| | ||
| true | Backdoor:Win32/Lecna!dha | 0.1.0 | 20170910 | | ||
| true | Backdoor:Win32/Lecna!dha | 0.1.0 | 20171112 | | ||
|
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,35 @@ | ||
{ | ||
"took": 3, | ||
"timed_out": false, | ||
"_shards": { | ||
"total": 1, | ||
"successful": 1, | ||
"failed": 0 | ||
}, | ||
"hits": { | ||
"total": 1, | ||
"max_score": 1, | ||
"hits": [ | ||
{ | ||
"_index": "malice", | ||
"_type": "samples", | ||
"_id": "AV-xuG9JCZYeIXix6PqY", | ||
"_score": 1, | ||
"_source": { | ||
"plugins": { | ||
"av": { | ||
"windows-defender": { | ||
"engine": "0.1.0", | ||
"infected": true, | ||
"markdown": "#### Windows Defender\n| Infected | Result | Engine | Updated |\n|:-------------:|:-----------:|:-----------:|:------------:|\n| true | Backdoor:Win32/Lecna!dha | 0.1.0 | 20171112 |\n", | ||
"result": "Backdoor:Win32/Lecna!dha", | ||
"updated": "20171112" | ||
} | ||
} | ||
}, | ||
"scan_date": "2017-11-12T19:32:55.223188Z" | ||
} | ||
} | ||
] | ||
} | ||
} |
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,8 @@ | ||
{ | ||
"windows-defender": { | ||
"infected": true, | ||
"result": "Backdoor:Win32/Lecna!dha", | ||
"engine": "0.1.0", | ||
"updated": "20171112" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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