--------------------------------------------------------------------------------
/cuckoo/data/analyzer/android/lib/api/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 | # Originally contributed by Check Point Software Technologies, Ltd.
5 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/android/lib/common/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 | # Originally contributed by Check Point Software Technologies, Ltd.
5 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/android/lib/core/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 | # Originally contributed by Check Point Software Technologies, Ltd.
5 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/android/modules/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 | # Originally contributed by Check Point Software Technologies, Ltd.
5 |
--------------------------------------------------------------------------------
/cuckoo/web/templates/analysis/pages/static/_strings.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | {% for string in report.analysis.strings %}
4 |
{{string}}
5 | {% endfor %}
6 |
7 |
8 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/android/modules/auxiliary/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 | # Originally contributed by Check Point Software Technologies, Ltd.
5 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/android/modules/packages/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 | # Originally contributed by Check Point Software Technologies, Ltd.
5 |
--------------------------------------------------------------------------------
/tests/files/enumplugins/sig1.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | from cuckoo.common.abstracts import Signature
6 |
7 | class Sig1(Signature):
8 | name = "sig1"
9 |
--------------------------------------------------------------------------------
/tests/files/enumplugins/sig2.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | from cuckoo.common.abstracts import Signature
6 |
7 | class Sig2(Signature):
8 | name = "sig2"
9 |
--------------------------------------------------------------------------------
/tests/files/enumplugins/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | from . import sig1, sig2, sig3
6 |
7 | class meta:
8 | plugins = sig1.Sig1, sig2.Sig2, sig3.Sig3
9 |
--------------------------------------------------------------------------------
/cuckoo/distributed/exception.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | class InvalidReport(Exception):
6 | pass
7 |
8 | class InvalidPcap(Exception):
9 | pass
10 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/linux/lib/common/exceptions.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | class CuckooError(Exception):
6 | pass
7 |
8 | class CuckooPackageError(Exception):
9 | pass
--------------------------------------------------------------------------------
/cuckoo/data/stuff/mitm.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2015-2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | # This is an empty boilerplate script where one can define a mitmdump script
6 | # for doing man in the middle interception.
7 |
--------------------------------------------------------------------------------
/cuckoo/distributed/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | # The worker.py is a standalone script, do not import it here.
6 | from . import api, app, db, exception, instance, misc
7 |
--------------------------------------------------------------------------------
/docs/book/usage/index.rst:
--------------------------------------------------------------------------------
1 | .. Usage chapter frontpage
2 |
3 | Usage
4 | =====
5 |
6 | This chapter explains how to use Cuckoo.
7 |
8 | .. toctree::
9 |
10 | start
11 | cwd
12 | submit
13 | web
14 | api
15 | dist
16 | utilities
17 | rooter
18 | feedback
19 | packages
20 | results
21 | clean
22 |
--------------------------------------------------------------------------------
/tests/darwin/assets/test_cuckoo_dropped_files.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | int main(int argc, char const *argv[])
6 | {
7 | FILE *f = fopen("something.txt", "w");
8 | if (f == NULL) {
9 | return EXIT_FAILURE;
10 | }
11 | fprintf(f, "HERE YOU ARE\n");
12 | fclose(f);
13 | return EXIT_SUCCESS;
14 | }
15 |
--------------------------------------------------------------------------------
/docs/book/introduction/index.rst:
--------------------------------------------------------------------------------
1 | .. Introduction chapter frontpage
2 |
3 | Introduction
4 | ============
5 |
6 | This is an introductory chapter to Cuckoo Sandbox.
7 | It explains some basic malware analysis concepts, what's Cuckoo and how it can fit
8 | in malware analysis.
9 |
10 | .. toctree::
11 |
12 | sandboxing
13 | what
14 | license
15 |
16 |
--------------------------------------------------------------------------------
/tests/files/sample_analysis_storage/files/a2a0fe3569d5b51c_updater.log:
--------------------------------------------------------------------------------
1 | : Loading AUM Integration library at path C:\Program Files (x86)\Adobe\Reader 9.0\Reader\AdobeUpdater.dll.
2 | : Successfully loaded AUM integration library
3 | : Successfully found all library entry points. Library is valid.
4 | : Entering GetAppID()
5 | : AUMDoPluginAction returns => 0
6 |
--------------------------------------------------------------------------------
/tests/files/sample_analysis_storage/files/d5e07709ac6b7ec4_adobeupdaterprefs.dat:
--------------------------------------------------------------------------------
1 |
2 |
3 | C:\Users\Administrator\AppData\Local\Adobe\Updater6\aum.log
4 | 2
5 | en_US
6 | 0
7 | 0
8 |
9 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/windows/lib/common/constants.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from lib.common.rand import random_string
7 |
8 | SHUTDOWN_MUTEX = "Global\\" + random_string(6, 10)
9 |
--------------------------------------------------------------------------------
/stuff/git-pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Setup as follows (from the Git repository root):
3 | # $ ln -s $PWD/stuff/git-pre-commit $PWD/.git/hooks/pre-commit
4 | set -e
5 |
6 | if git diff --cached cuckoo/web/src|grep -e '\+.*console.log'; then
7 | echo
8 | echo ">>> \033[0;31mGet rid of above console.log statement(s) before committing!\033[0m"
9 | echo
10 | exit 1
11 | fi
12 |
--------------------------------------------------------------------------------
/stuff/android/anti-vm/fake-cpuinfo:
--------------------------------------------------------------------------------
1 | Processor : ARMv7 Processor rev 0 (v7l)
2 | BogoMIPS : 366.18
3 | Features : swp half thumb fastmult vfp edsp neon vfpv3
4 | CPU implementer : 0x41
5 | CPU architecture: 7
6 | CPU variant : 0x0
7 | CPU part : 0xc08
8 | CPU revision : 0
9 |
10 | Hardware : Qualcomm MSM 8974 HAMMERHEAD (Flattened Device Tree)
11 | Revision : 0000
12 | Serial : 0000000000000000
--------------------------------------------------------------------------------
/cuckoo/web/dashboard/urls.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file "docs/LICENSE" for copying permission.
5 |
6 | from . import views
7 | from django.conf.urls import url
8 |
9 | urlpatterns = [
10 | url(r"^$", views.index, name="dashboard"),
11 | ]
12 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/android/lib/common/exceptions.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 | # Originally contributed by Check Point Software Technologies, Ltd.
5 |
6 | class CuckooError(Exception):
7 | pass
8 |
9 | class CuckooPackageError(Exception):
10 | pass
11 |
--------------------------------------------------------------------------------
/tests/test_colors.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo.common.colors import color
7 |
8 | def test_return_text():
9 | """Test colorized text contains the input string."""
10 | assert "foo" in color("foo", 11)
11 |
--------------------------------------------------------------------------------
/docs/book/customization/index.rst:
--------------------------------------------------------------------------------
1 | .. Customization chapter frontpage
2 |
3 | Customization
4 | =============
5 |
6 | This chapter explains how to customize Cuckoo.
7 | Cuckoo is written in a modular architecture built to be as customizable as it can,
8 | to fit the needs of all users.
9 |
10 | .. toctree::
11 |
12 | auxiliary
13 | machinery
14 | packages
15 | processing
16 | signatures
17 | reporting
18 |
--------------------------------------------------------------------------------
/docs/book/installation/host/index.rst:
--------------------------------------------------------------------------------
1 | ==================
2 | Preparing the Host
3 | ==================
4 |
5 | To run Cuckoo we suggest a *GNU/Linux* operating system. We'll be using the
6 | **latest Ubuntu LTS** (16.04 at the time of writing) throughout our
7 | documentation.
8 |
9 | .. toctree::
10 |
11 | requirements
12 | installation
13 | cwd
14 | configuration
15 | routing
16 | configuration_android
17 |
--------------------------------------------------------------------------------
/tests/darwin/assets/test_apicalls_root.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | int main(int argc, char *argv[])
8 | {
9 | struct passwd *pw = getpwuid(geteuid());
10 | assert(pw != NULL);
11 | if (strcmp("root", pw->pw_name) == 0) {
12 | printf("I'm root!\n");
13 | } else {
14 | printf("I'm user!\n");
15 | }
16 |
17 | return 0;
18 | }
19 |
--------------------------------------------------------------------------------
/tests/darwin/assets/test_dtruss_root.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | int main(int argc, char *argv[])
8 | {
9 | struct passwd *pw = getpwuid(geteuid());
10 | assert(pw != NULL);
11 | if (strcmp("root", pw->pw_name) == 0) {
12 | printf("Hello, r00t!\n");
13 | } else {
14 | printf("Hello, user!\n");
15 | }
16 |
17 | return 0;
18 | }
19 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/darwin/lib/common/abstracts.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | class Auxiliary(object):
7 | def __init__(self, options={}, analyzer=None):
8 | self.options = options
9 | self.analyzer = analyzer
10 |
--------------------------------------------------------------------------------
/tests/darwin/assets/test_dtruss_non_root.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | int main(int argc, char *argv[])
8 | {
9 | struct passwd *pw = getpwuid(geteuid());
10 | assert(pw != NULL);
11 | if (strcmp("root", pw->pw_name) == 0) {
12 | printf("Hello, r00t!\n");
13 | } else {
14 | printf("Hello, user!\n");
15 | }
16 |
17 | return 0;
18 | }
19 |
--------------------------------------------------------------------------------
/cuckoo/web/controllers/pcap/urls.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file "docs/LICENSE" for copying permission.
5 |
6 | from django.conf.urls import url
7 |
8 | from cuckoo.web.controllers.pcap.api import PcapApi
9 |
10 | urlpatterns = [
11 | url(r"^api/get/(?P\d+)/$", PcapApi.get)
12 | ]
13 |
--------------------------------------------------------------------------------
/cuckoo/web/src/handlebars/submission-task-table-body.hbs:
--------------------------------------------------------------------------------
1 | {{#each tasks}}
2 |
3 |
{{id}}
4 |
5 | {{date_added}}
6 | {{time_added}}
7 |
8 |
{{target}}
9 |
{{package}}
10 |
{{status}}
11 |
12 | {{/each}}
--------------------------------------------------------------------------------
/cuckoo/data/agent/agent.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright (C) 2010-2013 Claudio Guarnieri.
3 | # Copyright (C) 2014-2016 Cuckoo Foundation.
4 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
5 | # See the file 'docs/LICENSE' for copying permission.
6 |
7 | FILEPATH=$(readlink -f ${0%})
8 | FILEPATHDIR=$(dirname $FILEPATH)
9 |
10 | cd /tmp/
11 | python $FILEPATHDIR/agent.py >$FILEPATHDIR/agent.stdout 2>$FILEPATHDIR/agent.stderr &
12 |
13 |
--------------------------------------------------------------------------------
/cuckoo/data/signatures/extractor/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | from cuckoo.common.abstracts import Extractor
6 | from cuckoo.core.plugins import enumerate_plugins
7 |
8 | plugins = []
9 | extractors = enumerate_plugins(
10 | __file__, "signatures.extractor", globals(), Extractor, {}
11 | )
12 |
--------------------------------------------------------------------------------
/cuckoo/data/signatures/linux/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | from cuckoo.common.abstracts import Signature
6 | from cuckoo.core.plugins import enumerate_plugins
7 |
8 | plugins = enumerate_plugins(
9 | __file__, "signatures.linux", globals(),
10 | Signature, dict(platform="linux")
11 | )
12 |
--------------------------------------------------------------------------------
/cuckoo/web/controllers/cuckoo/urls.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2016-2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file "docs/LICENSE" for copying permission.
4 |
5 | from django.conf.urls import url
6 |
7 | from cuckoo.web.controllers.cuckoo.api import CuckooApi
8 |
9 | urlpatterns = [
10 | url(r"^api/status", CuckooApi.status),
11 | url(r"^api/vpn/status", CuckooApi.vpn_status)
12 | ]
13 |
--------------------------------------------------------------------------------
/cuckoo/web/src/handlebars/control-simple-select.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/cuckoo/reporting/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo.core.plugins import enumerate_plugins
7 | from cuckoo.common.abstracts import Report
8 |
9 | plugins = enumerate_plugins(
10 | __file__, "cuckoo.reporting", globals(), Report
11 | )
12 |
--------------------------------------------------------------------------------
/cuckoo/auxiliary/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo.core.plugins import enumerate_plugins
7 | from cuckoo.common.abstracts import Auxiliary
8 |
9 | plugins = enumerate_plugins(
10 | __file__, "cuckoo.auxiliary", globals(), Auxiliary
11 | )
12 |
--------------------------------------------------------------------------------
/cuckoo/processing/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo.core.plugins import enumerate_plugins
7 | from cuckoo.common.abstracts import Processing
8 |
9 | plugins = enumerate_plugins(
10 | __file__, "cuckoo.processing", globals(), Processing
11 | )
12 |
--------------------------------------------------------------------------------
/cuckoo/processing/extracted.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | from cuckoo.common.abstracts import Processing
6 | from cuckoo.core.extract import ExtractManager
7 |
8 | class Extracted(Processing):
9 | key = "extracted"
10 |
11 | def run(self):
12 | return ExtractManager.for_task(self.task.id).results()
13 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/darwin/lib/common/rand.py:
--------------------------------------------------------------------------------
1 | import random
2 | import string
3 |
4 | def random_string(minimum, maximum=None):
5 | if maximum is None:
6 | maximum = minimum
7 |
8 | count = random.randint(minimum, maximum)
9 | return "".join(random.choice(string.ascii_letters) for x in xrange(count))
10 |
11 | def random_integer(digits):
12 | start = 10 ** (digits - 1)
13 | end = (10 ** digits) - 1
14 | return random.randint(start, end)
15 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/windows/lib/common/rand.py:
--------------------------------------------------------------------------------
1 | import random
2 | import string
3 |
4 | def random_string(minimum, maximum=None):
5 | if maximum is None:
6 | maximum = minimum
7 |
8 | count = random.randint(minimum, maximum)
9 | return "".join(random.choice(string.ascii_letters) for x in xrange(count))
10 |
11 | def random_integer(digits):
12 | start = 10 ** (digits - 1)
13 | end = (10 ** digits) - 1
14 | return random.randint(start, end)
15 |
--------------------------------------------------------------------------------
/cuckoo/machinery/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2017 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo.core.plugins import enumerate_plugins
7 | from cuckoo.common.abstracts import Machinery
8 |
9 | plugins = enumerate_plugins(
10 | __file__, "cuckoo.machinery", globals(), Machinery, as_dict=True
11 | )
12 |
--------------------------------------------------------------------------------
/cuckoo/web/src/scss/layout/_typography.scss:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Cuckoo Foundation.
3 | This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | see the file 'docs/LICENSE' for copying permission.
5 | */
6 |
7 | pre {
8 | font-stretch: ultra-condensed;
9 | font-family: Consolas, monaco, monospace;
10 | font-size: 0.8em;
11 | }
12 |
13 | .center {
14 | text-align: center;
15 | }
16 |
17 | .mono {
18 | font-family: monospace;
19 | }
--------------------------------------------------------------------------------
/stuff/execsc/execsc.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | int main (int argc, char ** argv) {
6 | int fd;
7 | char buf[2048] = {0};
8 |
9 | if (argc < 2) return 1;
10 |
11 | // read in shellcode from analysis target file
12 | fd = open(argv[1], 0);
13 | read(fd, buf, 2048);
14 | close(fd);
15 |
16 | // jump into shellcode
17 | int (*func)();
18 | func = (int (*)()) buf;
19 | (int)(*func)();
20 |
21 | return 0;
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/cuckoo/web/src/scss/components/_tree.scss:
--------------------------------------------------------------------------------
1 | /*
2 | Tree styles
3 | - this is a bare style definition for the Tree class
4 | */
5 | .tree {
6 |
7 | // reset list styles
8 | &, ul {
9 | list-style: none;
10 | margin: 0;
11 | padding: 0;
12 |
13 | li {
14 | padding: 0;
15 | }
16 | }
17 |
18 | li {
19 | display: none;
20 | }
21 |
22 | &.open,
23 | ul.open {
24 | & > li {
25 | display: list-item;
26 | }
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/tests/darwin/assets/test_apicalls_from_dynamic_library.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | int main(int argc, char const *argv[])
6 | {
7 | void *h = dlopen("libruby.dylib", RTLD_LAZY);
8 | if (h == NULL) {
9 | return EXIT_FAILURE;
10 | } else {
11 | int (*rb_isalpha)(int) = dlsym(h, "rb_isalpha");
12 | int char_a = 0x61;
13 | return rb_isalpha(char_a) ? EXIT_SUCCESS : EXIT_FAILURE;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/cuckoo/data/signatures/cross/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2017 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo.common.abstracts import Signature
7 | from cuckoo.core.plugins import enumerate_plugins
8 |
9 | plugins = enumerate_plugins(
10 | __file__, "signatures.cross", globals(),
11 | Signature, {}
12 | )
13 |
--------------------------------------------------------------------------------
/cuckoo/machinery/kvm.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo.common.abstracts import LibVirtMachinery
7 |
8 | class KVM(LibVirtMachinery):
9 | """Virtualization layer for KVM based on python-libvirt."""
10 |
11 | # Set KVM connection string.
12 | dsn = "qemu:///system"
13 |
--------------------------------------------------------------------------------
/cuckoo/web/src/scss/layout/_responsive.scss:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Cuckoo Foundation.
3 | This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | see the file 'docs/LICENSE' for copying permission.
5 | */
6 |
7 | @media (max-width: 979px) {
8 | body {
9 | // padding-top: 50px;
10 | padding-bottom: 0px;
11 | }
12 | }
13 |
14 | @media (min-width: 992px) {
15 | #analysis_menu-sidebar {
16 | max-width: 260px;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/darwin/assets/test_apicalls_from_dynamic_library_root.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | int main(int argc, char const *argv[])
6 | {
7 | void *h = dlopen("libruby.dylib", RTLD_LAZY);
8 | if (h == NULL) {
9 | return EXIT_FAILURE;
10 | } else {
11 | int (*rb_isalpha)(int) = dlsym(h, "rb_isalpha");
12 | int char_a = 0x61;
13 | return rb_isalpha(char_a) ? EXIT_SUCCESS : EXIT_FAILURE;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/darwin/modules/packages/bash.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # Copyright (C) 2015 Dmitry Rodionov
3 | # This software may be modified and distributed under the terms
4 | # of the MIT license. See the LICENSE file for details.
5 |
6 | from lib.core.packages import Package
7 |
8 | class Bash(Package):
9 | """ Bash shell script analysys package. """
10 |
11 | def prepare(self):
12 | self.args = [self.target] + self.args
13 | self.target = "/bin/bash"
14 |
--------------------------------------------------------------------------------
/cuckoo/data/signatures/network/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2017 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo.common.abstracts import Signature
7 | from cuckoo.core.plugins import enumerate_plugins
8 |
9 | plugins = enumerate_plugins(
10 | __file__, "signatures.network", globals(),
11 | Signature, {}
12 | )
13 |
--------------------------------------------------------------------------------
/tests/files/sample_analysis_storage/files/ec7d15485840c06c_aumlib.log:
--------------------------------------------------------------------------------
1 | 2016-08-26T05:45:21: >>> Adobe Updater Log Begin >>>
2 | 2016-08-26T05:45:21: logFile: = C:\Users\Administrator\AppData\Local\Adobe\Updater6\aumLib.log
3 | 2016-08-26T05:45:21: logLevel: = 2
4 | 2016-08-26T05:45:21: Vista IE Protected Mode:No
5 | 2016-08-26T05:45:21: In AUMDoPluginAction(...)
6 | 2016-08-26T05:45:21: appIdentifierreader9rdr-en_US
7 | 2016-08-26T05:45:21: Has admin priv.
8 | 2016-08-26T05:45:21: ForkUpdater.
9 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/darwin/lib/common/exceptions.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | class CuckooError(Exception):
7 | pass
8 |
9 | class CuckooPackageError(Exception):
10 | pass
11 |
12 | class CuckooDisableModule(CuckooError):
13 | """Exception for disabling a module dynamically."""
14 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/windows/lib/common/exceptions.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | class CuckooError(Exception):
7 | pass
8 |
9 | class CuckooPackageError(Exception):
10 | pass
11 |
12 | class CuckooDisableModule(CuckooError):
13 | """Exception for disabling a module dynamically."""
14 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/android/lib/common/utils.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 | # Originally contributed by Check Point Software Technologies, Ltd.
5 |
6 | from lib.common.results import NetlogFile
7 |
8 | def send_file(name, data):
9 | """Send file to result server"""
10 | nf = NetlogFile(name)
11 | nf.sock.sendall(data)
12 | nf.close()
13 |
--------------------------------------------------------------------------------
/cuckoo/data/signatures/android/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2017 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo.common.abstracts import Signature
7 | from cuckoo.core.plugins import enumerate_plugins
8 |
9 | plugins = enumerate_plugins(
10 | __file__, "signatures.android", globals(),
11 | Signature, dict(platform="android")
12 | )
13 |
--------------------------------------------------------------------------------
/cuckoo/data/signatures/darwin/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2017 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo.common.abstracts import Signature
7 | from cuckoo.core.plugins import enumerate_plugins
8 |
9 | plugins = enumerate_plugins(
10 | __file__, "signatures.darwin", globals(),
11 | Signature, dict(platform="darwin")
12 | )
13 |
--------------------------------------------------------------------------------
/cuckoo/data/signatures/windows/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2017 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo.common.abstracts import Signature
7 | from cuckoo.core.plugins import enumerate_plugins
8 |
9 | plugins = enumerate_plugins(
10 | __file__, "signatures.windows", globals(),
11 | Signature, dict(platform="windows")
12 | )
13 |
--------------------------------------------------------------------------------
/cuckoo/web/controllers/machines/urls.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file "docs/LICENSE" for copying permission.
5 |
6 | from django.conf.urls import url
7 |
8 | from cuckoo.web.controllers.machines.api import MachinesApi
9 |
10 | urlpatterns = [
11 | url(r"^api/list/$", MachinesApi.list),
12 | url(r"^api/view/(?P\w+)/$", MachinesApi.view),
13 | ]
14 |
--------------------------------------------------------------------------------
/tests/files/conf/110_plain/auxiliary.conf:
--------------------------------------------------------------------------------
1 | [sniffer]
2 | # Enable or disable the use of an external sniffer (tcpdump) [yes/no].
3 | enabled = yes
4 |
5 | # Specify the path to your local installation of tcpdump. Make sure this
6 | # path is correct.
7 | tcpdump = /usr/sbin/tcpdump
8 |
9 | # Specify the network interface name on which tcpdump should monitor the
10 | # traffic. Make sure the interface is active.
11 | interface = vboxnet0
12 |
13 | # Specify a Berkeley packet filter to pass to tcpdump.
14 | # bpf = not arp
15 |
--------------------------------------------------------------------------------
/tests/files/conf/120_5vms/auxiliary.conf:
--------------------------------------------------------------------------------
1 | [sniffer]
2 | # Enable or disable the use of an external sniffer (tcpdump) [yes/no].
3 | enabled = yes
4 |
5 | # Specify the path to your local installation of tcpdump. Make sure this
6 | # path is correct.
7 | tcpdump = /usr/sbin/tcpdump
8 |
9 | # Specify the network interface name on which tcpdump should monitor the
10 | # traffic. Make sure the interface is active.
11 | interface = vboxnet0
12 |
13 | # Specify a Berkeley packet filter to pass to tcpdump.
14 | # bpf = not arp
15 |
--------------------------------------------------------------------------------
/tests/files/conf/120_plain/auxiliary.conf:
--------------------------------------------------------------------------------
1 | [sniffer]
2 | # Enable or disable the use of an external sniffer (tcpdump) [yes/no].
3 | enabled = yes
4 |
5 | # Specify the path to your local installation of tcpdump. Make sure this
6 | # path is correct.
7 | tcpdump = /usr/sbin/tcpdump
8 |
9 | # Specify the network interface name on which tcpdump should monitor the
10 | # traffic. Make sure the interface is active.
11 | interface = vboxnet0
12 |
13 | # Specify a Berkeley packet filter to pass to tcpdump.
14 | # bpf = not arp
15 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/windows/modules/packages/bin.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from lib.common.abstracts import Package
7 |
8 | class Shellcode(Package):
9 | """Shellcode (any x86 executable code) analysis package."""
10 |
11 | def start(self, path):
12 | return self.execute("bin/execsc.exe", args=[path])
13 |
--------------------------------------------------------------------------------
/cuckoo/web/src/scss/components/_navbar.scss:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Cuckoo Foundation.
3 | This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | see the file 'docs/LICENSE' for copying permission.
5 | */
6 |
7 | .navbar {
8 |
9 | &-brand,
10 | &-nav li a {
11 | line-height: 40px;
12 | height: 40px;
13 | padding-top: 0;
14 | }
15 |
16 | &-fixed-top {
17 | min-height: 30px;
18 |
19 | li a img {
20 | margin: 5px 0px 10px 20px;
21 | height: 34px;
22 | }
23 | }
24 |
25 | }
--------------------------------------------------------------------------------
/cuckoo/web/src/handlebars/dndupload_simple.hbs:
--------------------------------------------------------------------------------
1 |
2 |
14 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/darwin/modules/packages/macho.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # Copyright (C) 2015 Dmitry Rodionov
3 | # This software may be modified and distributed under the terms
4 | # of the MIT license. See the LICENSE file for details.
5 |
6 | from os import system
7 | from lib.core.packages import Package
8 |
9 | class Macho(Package):
10 | """ Mach-O executable analysys package. """
11 |
12 | def prepare(self):
13 | # Make sure that our target is executable
14 | system("/bin/chmod +x \"%s\"" % self.target)
15 |
--------------------------------------------------------------------------------
/cuckoo/private/cwd/init-pre.jinja2:
--------------------------------------------------------------------------------
1 | {{ "="*71 }}
2 | {{ yellow("Welcome to Cuckoo Sandbox, this appears to be your first run!") }}
3 | We will now set you up with our default configuration.
4 | You will be able to see and modify the Cuckoo configuration,
5 | Yara rules, Cuckoo Signatures, and much more to your likings
6 | by exploring the {{ red(cwd()) }} directory.
7 |
8 | Among other configurable items of most interest is the
9 | new location for your Cuckoo configuration:
10 | {{ red(cwd("conf")) }}
11 | {{ "="*71 }}
12 |
--------------------------------------------------------------------------------
/cuckoo/private/distributed/migration/versions/4d0a2590e997_node_task_index.py:
--------------------------------------------------------------------------------
1 | """node task index
2 |
3 | Revision ID: 4d0a2590e997
4 | Revises: 166078eb1311
5 | Create Date: 2015-06-30 15:46:11.780052
6 |
7 | """
8 |
9 | revision = "4d0a2590e997"
10 | down_revision = "166078eb1311"
11 | branch_labels = None
12 | depends_on = None
13 |
14 | from alembic import op
15 |
16 | def upgrade():
17 | op.create_index("ix_node_task", "task", ["node_id", "task_id"], unique=True)
18 |
19 | def downgrade():
20 | op.drop_index("ix_node_task", table_name="task")
21 |
--------------------------------------------------------------------------------
/cuckoo/web/src/tasks/bower.js:
--------------------------------------------------------------------------------
1 | var gulp = require('gulp');
2 | var assets = require('gulp-bower-assets');
3 |
4 | /**
5 | * BOWER task
6 | * @description: hooks up bower files using gulp-bower-assets
7 | */
8 | module.exports = function() {
9 |
10 | // select the assets.json file for parsing
11 | return gulp.src('assets.json')
12 |
13 | // run gulp-bower-assets to concat the bower files
14 | .pipe(assets({
15 | prefix: false
16 | }))
17 |
18 | // output to vendor folder in the assets directory of dit
19 | .pipe(gulp.dest('../static'));
20 |
21 | }
--------------------------------------------------------------------------------
/cuckoo/web/templates/analysis/pages/summary/_url.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 | {% for row in report.analysis.memory.malfind.data|volsort %}
12 |
13 |
{{row.process_id}}
14 |
{{row.process_name}}
15 |
{{row.vad_start}}
16 |
{{row.vad_tag}}
17 |
18 | {% endfor %}
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tests/files/conf/040_plain/kvm.conf:
--------------------------------------------------------------------------------
1 | [kvm]
2 | # Specify a comma-separated list of available machines to be used. For each
3 | # specified ID you have to define a dedicated section containing the details
4 | # on the respective machine. (E.g. cuckoo1,cuckoo2,cuckoo3)
5 | machines = cuckoo1
6 |
7 | [cuckoo1]
8 | # Specify the label name of the current machine as specified in your
9 | # libvirt configuration.
10 | label = cuckoo1
11 |
12 | # Specify the operating system platform used by current machine
13 | # [windows/darwin/linux].
14 | platform = windows
15 |
16 | # Specify the IP address of the current machine. Make sure that the IP address
17 | # is valid and that the host machine is able to reach it. If not, the analysis
18 | # will fail.
19 | ip = 192.168.122.105
20 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/android/modules/packages/default_browser.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 | # Originally contributed by Check Point Software Technologies, Ltd.
5 |
6 | from lib.common.abstracts import Package
7 | from lib.api.adb import execute_browser
8 |
9 | class default_browser(Package):
10 | """Default Browser analysis package."""
11 | def __init__(self, options={}):
12 | super(default_browser, self).__init__(options)
13 |
14 | def start(self, target):
15 | execute_browser(target)
16 |
17 | def check(self):
18 | return True
19 |
20 | def finish(self):
21 | return True
22 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/windows/modules/packages/exe.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | import os
7 | import shlex
8 |
9 | from lib.common.abstracts import Package
10 |
11 | class Exe(Package):
12 | """EXE analysis package."""
13 |
14 | def start(self, path):
15 | args = self.options.get("arguments", "")
16 |
17 | name, ext = os.path.splitext(path)
18 | if not ext:
19 | new_path = name + ".exe"
20 | os.rename(path, new_path)
21 | path = new_path
22 |
23 | return self.execute(path, args=shlex.split(args))
24 |
--------------------------------------------------------------------------------
/cuckoo/private/db_migration/versions/from_1_2_to_20c1-add_task_owner.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2014 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | """Added task owner used by Distributed Cuckoo (from Cuckoo 1.2 to 2.0-rc1)
6 |
7 | Revision ID: 3aa42d870199
8 | Revises: 18eee46c6f81
9 | Create Date: 2014-12-04 11:19:49.388410
10 | """
11 |
12 | # Revision identifiers, used by Alembic.
13 | revision = "3aa42d870199"
14 | down_revision = "495d5a6edef3"
15 |
16 | from alembic import op
17 | import sqlalchemy as sa
18 |
19 | def upgrade():
20 | op.add_column("tasks", sa.Column("owner", sa.String(length=64), nullable=True))
21 |
22 | def downgrade():
23 | pass
24 |
--------------------------------------------------------------------------------
/tests/files/sample_analysis_storage/task.json:
--------------------------------------------------------------------------------
1 | {"started_on": {"$dt": "2016-08-25T22:44:58.917943"}, "duration": 66, "sample_id": 83, "owner": "", "id": 2204, "category": "file", "priority": 374289732472983, "guest": {"status": "stopped", "name": "cuckoo1", "label": "cuckoo7", "manager": "VirtualBox", "started_on": "2016-08-25 22:44:59", "shutdown_on": "2016-08-25 22:46:00"}, "clock": {"$dt": "2016-08-25T22:44:56.778393"}, "custom": "", "machine": "", "platform": "", "memory": false, "status": "reported", "tags": [], "processing": null, "enforce_timeout": false, "completed_on": {"$dt": "2016-08-25T22:46:05.179941"}, "target": "/home/test/git/samples/CVE-2011-0611.pdf_", "package": "pdf", "route": "none", "timeout": 0, "options": {"human": "0"}, "added_on": {"$dt": "2016-08-25T22:44:56.778411"}}
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/linux/lib/common/hashing.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | import hashlib
6 |
7 | BUFSIZE = 1024*1024
8 |
9 | def sha256_file(path):
10 | return hash_file(hashlib.sha256, path)
11 |
12 | def hash_file(method, path):
13 | """Calculates an hash on a file by path.
14 | @param method: callable hashing method
15 | @param path: file path
16 | @return: computed hash string
17 | """
18 | f = open(path, "rb")
19 | h = method()
20 | while True:
21 | buf = f.read(BUFSIZE)
22 | if not buf:
23 | break
24 | h.update(buf)
25 | return h.hexdigest()
26 |
--------------------------------------------------------------------------------
/cuckoo/private/db_migration/versions/from_20c2_to_200_error_action.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | """action element for error (from Cuckoo 2.0-rc2 to 2.0.0)
6 |
7 | Revision ID: 181be2111077
8 | Revises: ef1ecf216392
9 | Create Date: 2017-02-23 15:11:39.711902
10 |
11 | """
12 |
13 | # Revision identifiers, used by Alembic.
14 | revision = "181be2111077"
15 | down_revision = "ef1ecf216392"
16 |
17 | from alembic import op
18 | import sqlalchemy as sa
19 |
20 | def upgrade():
21 | op.add_column(
22 | "errors", sa.Column("action", sa.String(length=64), nullable=True)
23 | )
24 |
25 | def downgrade():
26 | pass
27 |
--------------------------------------------------------------------------------
/cuckoo/web/src/scss/components/_tooltip.scss:
--------------------------------------------------------------------------------
1 | // basic jquery ui styles
2 | .ui-tooltip {
3 | padding: 8px;
4 | position: absolute;
5 | z-index: 9999;
6 | max-width: 300px;
7 | }
8 | body .ui-tooltip {
9 | border-width: 2px;
10 | }
11 |
12 | // cuckoo tooltip style
13 | .cuckoo-tooltip {
14 | background-color: #f5f5f5;
15 | border: 1px solid rgba($cuckoo_secundary_color, .1);
16 | padding: 15px;
17 | border-radius: 4px;
18 |
19 | &.tree-tip {
20 | font-size: 12px;
21 | padding: 3px;
22 | max-width: 70%;
23 | word-wrap: break-word;
24 | pointer-events: none;
25 | }
26 |
27 | @include cuckoo-theme('cyborg') {
28 | background-color: $cyborg_panel_color;
29 | border-color: $cyborg_border_color;
30 | color: $cyborg_text_color;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/tests/darwin/assets/test_ipconnections_tcp_with_timeout.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | void send_tcp(const char *remote, const int port)
8 | {
9 | int sd = socket(AF_INET, SOCK_STREAM, 0);
10 | assert(sd > 0);
11 |
12 | struct sockaddr_in addr;
13 | memset(&addr, 0, sizeof(addr));
14 | addr.sin_family = AF_INET;
15 | addr.sin_addr.s_addr = inet_addr(remote);
16 | addr.sin_port = htons(port);
17 |
18 | connect(sd, (struct sockaddr *)&addr , sizeof(addr));
19 | close(sd);
20 | }
21 |
22 | int main(int argc, char *argv[])
23 | {
24 | send_tcp("127.0.0.1", 80);
25 | sleep(5);
26 | send_tcp("127.0.0.1", 80);
27 |
28 | return 0;
29 | }
30 |
--------------------------------------------------------------------------------
/tests/test_common.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | import tempfile
6 |
7 | from cuckoo.common.virustotal import VirusTotalAPI
8 | from cuckoo.main import cuckoo_create
9 | from cuckoo.misc import set_cwd
10 |
11 | def test_vt_init():
12 | set_cwd(tempfile.mkdtemp())
13 | cuckoo_create(cfg={
14 | "processing": {
15 | "virustotal": {
16 | "key": "hello",
17 | "timeout": 32,
18 | "scan": False,
19 | },
20 | },
21 | })
22 | v = VirusTotalAPI()
23 | assert v.apikey == "hello"
24 | assert v.timeout == 32
25 | assert v.scan is False
26 |
--------------------------------------------------------------------------------
/cuckoo/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2017 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo import (
7 | auxiliary, machinery, processing, reporting
8 | )
9 |
10 | from cuckoo.misc import version as __version__
11 |
12 | signatures = []
13 |
14 | # Don't include machinery here as its data structure is different from the
15 | # other plugins - of which multiple are in use at any time.
16 | plugins = {
17 | "auxiliary": auxiliary.plugins,
18 | "machinery": machinery.plugins.values(),
19 | "processing": processing.plugins,
20 | "reporting": reporting.plugins,
21 | "signatures": signatures,
22 | }
23 |
--------------------------------------------------------------------------------
/cuckoo/data/yara/binaries/shellcodes.yar:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2010-2014 Cuckoo Foundation.
2 | // This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | // See the file 'docs/LICENSE' for copying permission.
4 |
5 | rule shellcode
6 | {
7 | meta:
8 | author = "nex"
9 | description = "Matched shellcode byte patterns"
10 |
11 | strings:
12 | $mz = { 4d 5a }
13 | $shell1 = { 64 8b 64 }
14 | $shell2 = { 64 a1 30 }
15 | $shell3 = { 64 8b 15 30 }
16 | $shell4 = { 64 8b 35 30 }
17 | $shell5 = { 55 8b ec 83 c4 }
18 | $shell6 = { 55 8b ec 81 ec }
19 | $shell7 = { 55 8b ec e8 }
20 | $shell8 = { 55 8b ec e9 }
21 | condition:
22 | not ($mz at 0) and
23 | any of ($shell*)
24 | }
25 |
--------------------------------------------------------------------------------
/cuckoo/web/templates/analysis/pages/network/_icmp.html:
--------------------------------------------------------------------------------
1 |
ICMP traffic
2 | {% if report.analysis.network.icmp %}
3 |
4 |
5 |
Source
6 |
Destination
7 |
ICMP Type
8 |
Data
9 |
10 | {% for packet in report.analysis.network.icmp %}
11 |
12 |
{{packet.src}}
13 |
{{packet.dst}}
14 |
{{packet.type}}
15 |
{{packet.data}}
16 |
17 | {% endfor %}
18 |
19 | {% else %}
20 |
No ICMP traffic performed.
21 | {% endif %}
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/darwin/lib/core/osx.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # Copyright (C) 2015 Dmitry Rodionov
3 | # This software may be modified and distributed under the terms
4 | # of the MIT license. See the LICENSE file for details.
5 |
6 | from os import system
7 | from datetime import datetime
8 |
9 | def set_wallclock(clock_str, **kwargs):
10 | clock = datetime.strptime(clock_str, "%Y%m%dT%H:%M:%S")
11 | # NOTE: On OS X there's `date` utility that accepts
12 | # new date/time as a string of the folowing format:
13 | # {month}{day}{hour}{minutes}{year}.{seconds}
14 | # where every {x} is a 2 digit number.
15 | cmd = "sudo date {0}".format(clock.strftime("%m%d%H%M%y.%S"))
16 |
17 | if "just_testing" in kwargs:
18 | return cmd
19 | else:
20 | system(cmd)
21 |
--------------------------------------------------------------------------------
/cuckoo/private/db_migration/versions/from_1_2_to_20c1-machine_options.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | """machine options (from Cuckoo 1.2 to 2.0-rc1)
7 |
8 | Revision ID: cd31654d187
9 | Revises: 1583656cb935
10 | Create Date: 2015-12-16 11:07:59.948819
11 |
12 | """
13 |
14 | # revision identifiers, used by Alembic.
15 | revision = "cd31654d187"
16 | down_revision = "1583656cb935"
17 |
18 | from alembic import op
19 | import sqlalchemy as sa
20 |
21 | def upgrade():
22 | op.add_column("machines", sa.Column("options", sa.String(length=255), nullable=True))
23 |
24 | def downgrade():
25 | pass
26 |
--------------------------------------------------------------------------------
/cuckoo/private/db_migration/versions/from_1_2_to_20c1-taken-route.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | """taken route for a task (from Cuckoo 1.2 to 2.0-rc1)
7 |
8 | Revision ID: 1070cd314621
9 | Revises: 4a04f40d4ab4
10 | Create Date: 2015-11-21 23:10:04.724813
11 |
12 | """
13 |
14 | # revision identifiers, used by Alembic.
15 | revision = "1070cd314621"
16 | down_revision = "4a04f40d4ab4"
17 |
18 | from alembic import op
19 | import sqlalchemy as sa
20 |
21 | def upgrade():
22 | op.add_column("tasks", sa.Column("route", sa.String(length=16), nullable=True))
23 |
24 | def downgrade():
25 | pass
26 |
--------------------------------------------------------------------------------
/cuckoo/private/db_migration/versions/from_1_2_to_20c1-processing-column.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | """processing column (from Cuckoo 1.2 to 2.0-rc1)
7 |
8 | Revision ID: 4a04f40d4ab4
9 | Revises: 3aa42d870199
10 | Create Date: 2015-11-15 00:57:32.068872
11 |
12 | """
13 |
14 | # revision identifiers, used by Alembic.
15 | revision = "4a04f40d4ab4"
16 | down_revision = "3aa42d870199"
17 |
18 | from alembic import op
19 | import sqlalchemy as sa
20 |
21 | def upgrade():
22 | op.add_column("tasks", sa.Column("processing", sa.String(length=16), nullable=True))
23 |
24 | def downgrade():
25 | pass
26 |
--------------------------------------------------------------------------------
/tests/files/conf/120_5vms/reporting.conf:
--------------------------------------------------------------------------------
1 | # Enable or disable the available reporting modules [on/off].
2 | # If you add a custom reporting module to your Cuckoo setup, you have to add
3 | # a dedicated entry in this file, or it won't be executed.
4 | # You can also add additional options under the section of your module and
5 | # they will be available in your Python class.
6 |
7 | [jsondump]
8 | enabled = yes
9 | indent = 4
10 | encoding = latin-1
11 |
12 | [reporthtml]
13 | enabled = yes
14 |
15 | [mmdef]
16 | enabled = no
17 |
18 | [maec40]
19 | enabled = no
20 | mode = overview
21 | processtree = true
22 | output_handles = false
23 | static = true
24 | strings = true
25 | virustotal = true
26 |
27 | [mongodb]
28 | enabled = no
29 | host = 127.0.0.1
30 | port = 27017
31 | db = cuckoo
32 | store_memdump = yes
--------------------------------------------------------------------------------
/tests/files/conf/120_plain/reporting.conf:
--------------------------------------------------------------------------------
1 | # Enable or disable the available reporting modules [on/off].
2 | # If you add a custom reporting module to your Cuckoo setup, you have to add
3 | # a dedicated entry in this file, or it won't be executed.
4 | # You can also add additional options under the section of your module and
5 | # they will be available in your Python class.
6 |
7 | [jsondump]
8 | enabled = yes
9 | indent = 4
10 | encoding = latin-1
11 |
12 | [reporthtml]
13 | enabled = yes
14 |
15 | [mmdef]
16 | enabled = no
17 |
18 | [maec40]
19 | enabled = no
20 | mode = overview
21 | processtree = true
22 | output_handles = false
23 | static = true
24 | strings = true
25 | virustotal = true
26 |
27 | [mongodb]
28 | enabled = no
29 | host = 127.0.0.1
30 | port = 27017
31 | db = cuckoo
32 | store_memdump = yes
--------------------------------------------------------------------------------
/tests/darwin/assets/test_ipconnections_udp.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | int main(int argc, char *argv[])
11 | {
12 | int sd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
13 | assert(sd > 0);
14 |
15 | struct sockaddr_in addr;
16 | memset(&addr, 0, sizeof(addr));
17 | addr.sin_family = AF_INET;
18 | inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr);
19 | addr.sin_port = htons(53);
20 |
21 | char *request = "hi, i like you";
22 | int ret = sendto(sd, request, strlen(request), 0, (struct sockaddr*)&addr, sizeof(addr));
23 | assert(ret >= 0);
24 |
25 | close(sd);
26 |
27 | return EXIT_SUCCESS;
28 | }
29 |
--------------------------------------------------------------------------------
/cuckoo/private/db_migration/versions/from_1_2_to_20c1-guest_status.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | """guest status (from Cuckoo 1.2 to 2.0-rc1)
7 |
8 | Revision ID: 1583656cb935
9 | Revises: 1070cd314621
10 | Create Date: 2015-12-15 14:25:27.379967
11 |
12 | """
13 |
14 | # revision identifiers, used by Alembic.
15 | revision = "1583656cb935"
16 | down_revision = "1070cd314621"
17 |
18 | from alembic import op
19 | import sqlalchemy as sa
20 |
21 | def upgrade():
22 | op.add_column("guests", sa.Column("status", sa.String(length=16), nullable=False, server_default="stopped"))
23 |
24 | def downgrade():
25 | pass
26 |
--------------------------------------------------------------------------------
/cuckoo/web/controllers/pcap/api.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2016-2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | import os
6 |
7 | from cuckoo.misc import cwd
8 | from cuckoo.web.utils import json_error_response, file_response, api_get
9 |
10 | class PcapApi:
11 | @api_get
12 | def get(request, task_id):
13 | file_path = cwd("dump.pcap", analysis=task_id)
14 | if not os.path.exists(file_path):
15 | return json_error_response("File not found")
16 |
17 | return file_response(
18 | data=open(file_path, "rb"),
19 | filename="analysis_pcap_dump_%s.pcap" % str(task_id),
20 | content_type="application/octet-stream; charset=UTF-8"
21 | )
22 |
--------------------------------------------------------------------------------
/cuckoo/private/distributed/migration/alembic.ini:
--------------------------------------------------------------------------------
1 | # A generic, single database configuration.
2 |
3 | [alembic]
4 | # path to migration scripts
5 | script_location = .
6 |
7 | # Logging configuration
8 | [loggers]
9 | keys = root,sqlalchemy,alembic
10 |
11 | [handlers]
12 | keys = console
13 |
14 | [formatters]
15 | keys = generic
16 |
17 | [logger_root]
18 | level = WARN
19 | handlers = console
20 | qualname =
21 |
22 | [logger_sqlalchemy]
23 | level = WARN
24 | handlers =
25 | qualname = sqlalchemy.engine
26 |
27 | [logger_alembic]
28 | level = INFO
29 | handlers =
30 | qualname = alembic
31 |
32 | [handler_console]
33 | class = StreamHandler
34 | args = (sys.stderr,)
35 | level = NOTSET
36 | formatter = generic
37 |
38 | [formatter_generic]
39 | format = %(levelname)-5.5s [%(name)s] %(message)s
40 | datefmt = %H:%M:%S
41 |
--------------------------------------------------------------------------------
/cuckoo/web/templates/analysis/pages/network/_http.html:
--------------------------------------------------------------------------------
1 | {% if report.analysis.network.http_ex or report.analysis.network.https_ex %}
2 |
3 |
4 | {% for http in report.analysis.network.https_ex %}
5 | {% include "partials/http-request.html" with http=http %}
6 | {% endfor %}
7 | {% for http in report.analysis.network.http_ex %}
8 | {% include "partials/http-request.html" with http=http %}
9 | {% endfor %}
10 |
11 |
12 | {% else %}
13 |
14 |
15 |
16 |
17 |
No traffic
18 |
19 |
20 |
21 |
22 | {% endif %}
--------------------------------------------------------------------------------
/cuckoo/web/src/gulpfile.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Cuckoo Foundation.
3 | This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | see the file 'docs/LICENSE' for copying permission.
5 | */
6 |
7 | /*
8 | require dependencies:
9 | gulp
10 | gulp-task-loader
11 | */
12 | var gulp = require('gulp');
13 |
14 | /*
15 | this script will read all modules in ./tasks and executes them
16 | as gulp task functions. All tasks can be used here by their names.
17 | */
18 | require('gulp-task-loader')('./tasks');
19 |
20 | // define the default task when 'gulp' is called from the CLI
21 | gulp.task('default', ['bower','styles','scripts','scripts-submission','handlebars','watch']);
22 |
23 | // task for ONLY building to static
24 | gulp.task('build', ['bower','styles','scripts','scripts-submission','handlebars']);
25 |
--------------------------------------------------------------------------------
/cuckoo/web/src/scss/components/_tcp.scss:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Cuckoo Foundation.
3 | This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | see the file 'docs/LICENSE' for copying permission.
5 | */
6 |
7 | /* tcp-flow.scss */
8 | .tcp {
9 |
10 | &-flow {
11 | list-style-type: none;
12 |
13 | li {
14 | margin-bottom: 20px;
15 | }
16 | }
17 |
18 | &-out pre {
19 | padding: 0;
20 | border: 0;
21 | background-color: white;
22 | color: #d9534f;
23 | }
24 |
25 | &-in {
26 |
27 | padding-left: 100px;
28 |
29 | pre {
30 | padding: 0;
31 | border: 0;
32 | background-color: white;
33 | color: #5bc0de;
34 | }
35 |
36 | }
37 |
38 | }
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/windows/modules/packages/jar.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from lib.common.abstracts import Package
7 |
8 | class Jar(Package):
9 | """Java analysis package."""
10 | PATHS = [
11 | ("ProgramFiles", "Java", "jre*", "bin", "java.exe"),
12 | ]
13 |
14 | def start(self, path):
15 | java = self.get_path_glob("Java")
16 | class_path = self.options.get("class")
17 |
18 | if class_path:
19 | args = ["-cp", path, class_path]
20 | else:
21 | args = ["-jar", path]
22 |
23 | return self.execute(java, args=args, trigger="file:%s" % path)
24 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/android/lib/common/constants.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 | # Originally contributed by Check Point Software Technologies, Ltd.
5 |
6 | import os
7 | import string
8 | import random
9 |
10 | def _rand_string(a, b):
11 | return "".join(random.choice(string.ascii_lowercase) for x in xrange(random.randint(a, b)))
12 |
13 | ROOT = os.path.join("/data/local/tmp", _rand_string(6, 10))
14 |
15 | PATHS = {
16 | "root" : ROOT,
17 | "logs" : os.path.join(ROOT, "logs"),
18 | "files" : os.path.join(ROOT, "files"),
19 | "shots" : os.path.join(ROOT, "shots"),
20 | "memory" : os.path.join(ROOT, "memory"),
21 | "drop" : os.path.join(ROOT, "drop")
22 | }
23 |
--------------------------------------------------------------------------------
/cuckoo/private/distributed/migration/env.py:
--------------------------------------------------------------------------------
1 | from alembic import context
2 | from sqlalchemy import create_engine, pool
3 |
4 | from cuckoo.distributed.db import db
5 | from cuckoo.distributed.misc import init_settings, settings
6 |
7 | from cuckoo.misc import set_cwd
8 |
9 | set_cwd(context.get_x_argument(as_dictionary=True)["cwd"])
10 | init_settings()
11 |
12 | config = context.config
13 |
14 | def run_migrations():
15 | engine = create_engine(settings.SQLALCHEMY_DATABASE_URI,
16 | poolclass=pool.NullPool)
17 |
18 | connection = engine.connect()
19 | context.configure(connection=connection, target_metadata=db.metadata)
20 |
21 | try:
22 | with context.begin_transaction():
23 | context.run_migrations()
24 | finally:
25 | connection.close()
26 |
27 | run_migrations()
28 |
--------------------------------------------------------------------------------
/tests/files/conf/110_plain/reporting.conf:
--------------------------------------------------------------------------------
1 | # Enable or disable the available reporting modules [on/off].
2 | # If you add a custom reporting module to your Cuckoo setup, you have to add
3 | # a dedicated entry in this file, or it won't be executed.
4 | # You can also add additional options under the section of your module and
5 | # they will be available in your Python class.
6 |
7 | [jsondump]
8 | enabled = yes
9 |
10 | [reporthtml]
11 | enabled = yes
12 |
13 | [mmdef]
14 | enabled = no
15 |
16 | [maec40]
17 | enabled = no
18 | mode = overview
19 | processtree = true
20 | output_handles = false
21 | static = true
22 | strings = true
23 | virustotal = true
24 |
25 | [mongodb]
26 | enabled = no
27 | host = 127.0.0.1
28 | port = 27017
29 |
30 | [hpfclient]
31 | enabled = no
32 | host =
33 | port = 10000
34 | ident =
35 | secret =
36 | channel =
37 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/android/lib/core/packages.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014-2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 | # Originally contributed by Check Point Software Technologies, Ltd.
5 |
6 | def choose_package(file_type, file_name):
7 | """Choose analysis package due to file type and file extension.
8 | @param file_type: file type.
9 | @return: package or None.
10 | """
11 | if not file_type:
12 | return None
13 |
14 | file_type = file_type.lower()
15 | file_name = file_name.lower()
16 |
17 | if "apk" in file_name:
18 | return "apk"
19 | elif "zip" in file_type:
20 | return "apk"
21 | # elif "DEX" in file_type:
22 | # return "dex"
23 | else:
24 | return "apk"
25 |
--------------------------------------------------------------------------------
/cuckoo/web/src/tasks/watch.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Cuckoo Foundation.
3 | This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | see the file 'docs/LICENSE' for copying permission.
5 | */
6 |
7 | /*
8 | require node dependencies:
9 | gulp
10 | gulp-watch
11 | */
12 | var gulp = require('gulp');
13 | var watch = require('gulp-watch');
14 |
15 | /*
16 | return Gulp function()
17 | - initiates watchers for static building
18 | */
19 | module.exports = function() {
20 | // starts a watcher RECURSIVE on all .scss files in /src/scss and assigns 'styles' as task
21 | gulp.watch('scss/**/*.scss', ['styles']);
22 | gulp.watch(['scripts/**/*.js','!scripts/submission/**/*.js'], ['scripts']);
23 | gulp.watch('scripts/submission/**/*.js', ['scripts-submission']);
24 | gulp.watch('handlebars/**/*.hbs', ['handlebars']);
25 | }
--------------------------------------------------------------------------------
/docs/AUTHORS:
--------------------------------------------------------------------------------
1 | AUTHORS
2 |
3 | Cuckoo is the result of the work and efforts of many people. Some main developers
4 | and some friends and users who kindly provided us with feedback and new features.
5 | You'll find contributions to the code mentioned in the specific source files.
6 |
7 | DEVELOPERS:
8 | Claudio "nex" Guarnieri Lead Developer @botherder
9 | Alessandro "jekil" Tanasi Core Developer @jekil
10 | Jurriaan "skier" Bremer Core Developer @skier_t
11 | Mark "rep" Schloesser Core Developer @repmovsb
12 |
13 | CONTRIBUTORS:
14 | A list of up-to-date contributors can be found at the following URL.
15 | http://docs.cuckoosandbox.org/en/latest/finalremarks/#people
16 |
17 | Thanks to the whole community and mailing list members who submitted bug
18 | reports and suggested new features.
19 |
--------------------------------------------------------------------------------
/tests/test_netlog.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo.common.netlog import (
7 | pointer_converter_32bit, pointer_converter_64bit
8 | )
9 |
10 | def test_pointer_repr():
11 | assert pointer_converter_32bit(0) == "0x00000000"
12 | assert pointer_converter_32bit(1) == "0x00000001"
13 | assert pointer_converter_32bit(0xffffffff) == "0xffffffff"
14 |
15 | assert pointer_converter_64bit(0) == "0x0000000000000000"
16 | assert pointer_converter_64bit(1) == "0x0000000000000001"
17 | assert pointer_converter_64bit(0xffffffff) == "0x00000000ffffffff"
18 | assert pointer_converter_64bit(0xffffffffffffffff) == "0xffffffffffffffff"
19 |
--------------------------------------------------------------------------------
/cuckoo/web/web/headers.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | from cuckoo.misc import version
7 |
8 | class CuckooHeaders(object):
9 | """Set Cuckoo custom response headers."""
10 |
11 | def process_response(self, request, response):
12 | response["Server"] = "Machete Server"
13 | response["X-Cuckoo-Version"] = version
14 | response["X-Content-Type-Options"] = "nosniff"
15 | response["X-Frame-Options"] = "DENY"
16 | response["X-XSS-Protection"] = "1; mode=block"
17 | response["Pragma"] = "no-cache"
18 | response["Cache-Control"] = "no-cache"
19 | response["Expires"] = "0"
20 | return response
21 |
--------------------------------------------------------------------------------
/cuckoo/web/templates/analysis/pages/memory/_apihooks.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
PID
5 |
Process Name
6 |
Victim Function
7 |
Hook Type
8 |
Hooking Module
9 |
10 |
11 |
12 | {% for row in report.analysis.memory.apihooks.data|volsort %}
13 |
14 |
{{row.process_id}}
15 |
{{row.process_name}}
16 |
{{row.victim_function}}
17 |
{{row.hook_type}}
18 |
{{row.hooking_module}}
19 |
20 | {% endfor %}
21 |
22 |
23 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/windows/modules/packages/reboot.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | import logging
6 |
7 | from lib.common.abstracts import Package
8 |
9 | log = logging.getLogger(__name__)
10 |
11 | class Reboot(Package):
12 | """Reboot analysis package."""
13 |
14 | def _handle_create_process(self, filepath, command_line, source):
15 | self.pids.append(self.execute(filepath, command_line))
16 |
17 | def start(self, path):
18 | for category, args in self.analyzer.reboot:
19 | if not hasattr(self, "_handle_%s" % category):
20 | log.warning("Unhandled reboot command: %s", category)
21 | continue
22 |
23 | getattr(self, "_handle_%s" % category)(*args)
24 |
--------------------------------------------------------------------------------
/tests/files/conf/120_5vms/physical.conf:
--------------------------------------------------------------------------------
1 | [physical]
2 | # Specify a comma-separated list of available machines to be used. For each
3 | # specified ID you have to define a dedicated section containing the details
4 | # on the respective machine. (E.g. physical1,physical2,physical3)
5 | machines = physical1
6 |
7 | # Credentials to access the machine
8 | user = username
9 | password = password
10 |
11 | [physical1]
12 | # Specify the label name of the current machine as specified in your
13 | # physical machine configuration.
14 | label = physical1
15 |
16 | # Specify the operating system platform used by current machine
17 | # [windows/darwin/linux].
18 | platform = windows
19 |
20 | # Specify the IP address of the current machine. Make sure that the IP address
21 | # is valid and that the host machine is able to reach it. If not, the analysis
22 | # will fail.
23 | ip = 192.168.56.101
24 |
--------------------------------------------------------------------------------
/tests/files/conf/120_plain/physical.conf:
--------------------------------------------------------------------------------
1 | [physical]
2 | # Specify a comma-separated list of available machines to be used. For each
3 | # specified ID you have to define a dedicated section containing the details
4 | # on the respective machine. (E.g. physical1,physical2,physical3)
5 | machines = physical1
6 |
7 | # Credentials to access the machine
8 | user = username
9 | password = password
10 |
11 | [physical1]
12 | # Specify the label name of the current machine as specified in your
13 | # physical machine configuration.
14 | label = physical1
15 |
16 | # Specify the operating system platform used by current machine
17 | # [windows/darwin/linux].
18 | platform = windows
19 |
20 | # Specify the IP address of the current machine. Make sure that the IP address
21 | # is valid and that the host machine is able to reach it. If not, the analysis
22 | # will fail.
23 | ip = 192.168.56.101
24 |
--------------------------------------------------------------------------------
/cuckoo/private/distributed/migration/versions/3cc1509b7fdc_node_status.py:
--------------------------------------------------------------------------------
1 | """node status
2 |
3 | Revision ID: 3cc1509b7fdc
4 | Revises: 37c08c9655bb
5 | Create Date: 2015-03-30 17:14:39.604125
6 |
7 | """
8 |
9 | revision = "3cc1509b7fdc"
10 | down_revision = "37c08c9655bb"
11 | branch_labels = None
12 | depends_on = None
13 |
14 | from alembic import op
15 | import sqlalchemy as sa
16 |
17 | def upgrade():
18 | op.create_table(
19 | "node_status",
20 | sa.Column("id", sa.Integer(), nullable=False),
21 | sa.Column("node_id", sa.Integer(), nullable=True),
22 | sa.Column("timestamp", sa.DateTime(), nullable=False),
23 | sa.Column("status", sa.Text(), nullable=False),
24 | sa.ForeignKeyConstraint(["node_id"], ["node.id"]),
25 | sa.PrimaryKeyConstraint("id")
26 | )
27 |
28 | def downgrade():
29 | op.drop_table("node_status")
30 |
--------------------------------------------------------------------------------
/cuckoo/web/templates/analysis/pages/memory/_devicetree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
Driver Name
5 |
Driver Offset
6 |
Devices
7 |
8 |
9 |
10 | {% for row in report.analysis.memory.devicetree.data|volsort %}
11 |
12 |
{{row.driver_name}}
13 |
{{row.driver_offset}}
14 |
15 | {% for device in row.devices %}
16 | {% if device.device_name %}
17 | {{device.device_name}},
18 | {% endif %}
19 | {% endfor %}
20 |
11 |
12 |
13 | {% for row in report.analysis.memory.sockscan.data|volsort %}
14 |
15 |
{{row.offset}}
16 |
{{row.process_id}}
17 |
{{row.address}}
18 |
{{row.port}}
19 |
{{row.protocol}}
20 |
{{row.create_time}}
21 |
22 | {% endfor %}
23 |
24 |
25 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/windows/modules/packages/wsf.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2016 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | import logging
6 | import os
7 |
8 | from lib.common.abstracts import Package
9 |
10 | log = logging.getLogger(__name__)
11 |
12 | class WSF(Package):
13 | """Windows Scripting File analysis package."""
14 | PATHS = [
15 | ("System32", "wscript.exe"),
16 | ]
17 |
18 | def start(self, path):
19 | wscript = self.get_path("WScript")
20 |
21 | # Enforce the .wsf file extension as is required by wscript.
22 | if not path.endswith(".wsf"):
23 | os.rename(path, path + ".wsf")
24 | path += ".wsf"
25 | log.info("Submitted file is missing extension, added .wsf")
26 |
27 | return self.execute(wscript, args=[path], trigger="file:%s" % path)
28 |
--------------------------------------------------------------------------------
/cuckoo/private/db_migration/versions/from_0_6_to_1_1_tasks_tags_relation.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | """tasks tags relation
6 |
7 | Revision ID: 263a45963c72
8 | Revises: 5aa718cc79e1
9 | Create Date: 2017-02-07 00:37:15.017423
10 |
11 | """
12 |
13 | # Revision identifiers, used by Alembic.
14 | revision = "263a45963c72"
15 | down_revision = "5aa718cc79e1"
16 |
17 | from alembic import op
18 | import sqlalchemy as sa
19 |
20 | def upgrade():
21 | op.create_table(
22 | "tasks_tags",
23 | sa.Column("task_id", sa.Integer(), nullable=True),
24 | sa.Column("tag_id", sa.Integer(), nullable=True),
25 | sa.ForeignKeyConstraint(["tag_id"], ["tags.id"]),
26 | sa.ForeignKeyConstraint(["task_id"], ["tasks.id"])
27 | )
28 |
29 | def downgrade():
30 | pass
31 |
--------------------------------------------------------------------------------
/cuckoo/web/templates/analysis/pages/memory/_idt.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
CPU
5 |
Index
6 |
Selector
7 |
Address
8 |
Module
9 |
Section
10 |
11 |
12 |
13 | {% for row in report.analysis.memory.idt.data|volsort %}
14 |
15 |
{{row.cpu_number}}
16 |
{{row.index}}
17 |
{{row.selector}}
18 |
{{row.address}}
19 |
{{row.module}}
20 |
{{row.section}}
21 |
22 | {% endfor %}
23 |
24 |
25 |
--------------------------------------------------------------------------------
/cuckoo/core/report.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2016-2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | class Report(object):
6 | def __init__(self, report):
7 | self.report = report
8 |
9 | def get(self, *keys):
10 | r = self.report
11 | for key in keys:
12 | if key not in r:
13 | return
14 | r = r[key]
15 | return r
16 |
17 | @property
18 | def info(self):
19 | return self.get("info") or {}
20 |
21 | @property
22 | def path(self):
23 | return self.get("info", "analysis_path")
24 |
25 | @property
26 | def feedback(self):
27 | return self.get("feedback") or {}
28 |
29 | @property
30 | def target(self):
31 | return self.get("target")
32 |
33 | @property
34 | def errors(self):
35 | return self.get("debug", "errors") or []
36 |
--------------------------------------------------------------------------------
/cuckoo/web/templates/analysis/pages/memory/_timers.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
Offset
5 |
Due Time
6 |
Period
7 |
Signaled
8 |
Routine
9 |
Module
10 |
11 |
12 |
13 | {% for row in report.analysis.memory.timers.data|volsort %}
14 |
15 |
{{row.offset}}
16 |
{{row.due_time}}
17 |
{{row.period}}
18 |
{{row.signaled}}
19 |
{{row.routine}}
20 |
{{row.module}}
21 |
22 | {% endfor %}
23 |
24 |
25 |
--------------------------------------------------------------------------------
/tests/windows/test_dumptls.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | import mock
6 |
7 | from lib.common.exceptions import CuckooError
8 | from modules.auxiliary.dumptls import DumpTLSMasterSecrets
9 |
10 | @mock.patch("modules.auxiliary.dumptls.Process")
11 | @mock.patch("modules.auxiliary.dumptls.log")
12 | def test_dumptls_regular_user(p, q):
13 | q.return_value.inject.side_effect = CuckooError(
14 | "Error returned by is32bit: process access denied"
15 | )
16 | DumpTLSMasterSecrets().start()
17 | p.warning.assert_called_once()
18 | assert "Agent as Administrator" in p.warning.call_args_list[0][0][0]
19 |
20 | @mock.patch("modules.auxiliary.dumptls.Process")
21 | @mock.patch("modules.auxiliary.dumptls.log")
22 | def test_dumptls_success(p, q):
23 | DumpTLSMasterSecrets().start()
24 | p.warning.assert_not_called()
25 |
--------------------------------------------------------------------------------
/cuckoo/apps/distributed.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2016-2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | import os
6 |
7 | from cuckoo.distributed.app import create_app
8 | from cuckoo.distributed.instance import (
9 | scheduler, status_caching, handle_node
10 | )
11 | from cuckoo.misc import decide_cwd
12 |
13 | app = None
14 |
15 | def cuckoo_distributed(hostname, port, debug):
16 | app = create_app()
17 | app.run(host=hostname, port=port, debug=debug)
18 |
19 | def cuckoo_distributed_instance(name):
20 | app = create_app()
21 |
22 | with app.app_context():
23 | if name == "dist.scheduler":
24 | scheduler()
25 | elif name == "dist.status":
26 | status_caching()
27 | else:
28 | handle_node(name)
29 |
30 | if os.environ.get("CUCKOO_APP") == "dist":
31 | decide_cwd(exists=True)
32 | app = create_app()
33 |
--------------------------------------------------------------------------------
/cuckoo/common/whitelist.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2015-2017 Cuckoo Foundation.
2 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
3 | # See the file 'docs/LICENSE' for copying permission.
4 |
5 | import os.path
6 |
7 | from cuckoo.misc import cwd
8 |
9 | domains = set()
10 |
11 | def is_whitelisted_domain(domain):
12 | # Initialize the domain whitelist.
13 | if not domains:
14 | for line in open(cwd("whitelist", "domain.txt", private=True), "rb"):
15 | if not line.strip() or line.startswith("#"):
16 | continue
17 | domains.add(line.strip())
18 |
19 | # Collect whitelist also from $CWD if available.
20 | if os.path.exists(cwd("whitelist", "domain.txt")):
21 | for line in open(cwd("whitelist", "domain.txt"), "rb"):
22 | if not line.strip() or line.startswith("#"):
23 | continue
24 | domains.add(line.strip())
25 |
26 | return domain in domains
27 |
--------------------------------------------------------------------------------
/cuckoo/data/analyzer/windows/modules/packages/js.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010-2013 Claudio Guarnieri.
2 | # Copyright (C) 2014-2016 Cuckoo Foundation.
3 | # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
4 | # See the file 'docs/LICENSE' for copying permission.
5 |
6 | import logging
7 | import os
8 |
9 | from lib.common.abstracts import Package
10 |
11 | log = logging.getLogger(__name__)
12 |
13 | class Javascript(Package):
14 | """Javascript analysis package."""
15 | PATHS = [
16 | ("System32", "wscript.exe"),
17 | ]
18 |
19 | def start(self, path):
20 | wscript = self.get_path("WScript")
21 |
22 | # Enforce the .js file extension as is required by wscript.
23 | if not path.endswith(".js"):
24 | os.rename(path, path + ".js")
25 | path += ".js"
26 | log.info("Submitted file is missing extension, added .js")
27 |
28 | return self.execute(wscript, args=[path], trigger="file:%s" % path)
29 |
--------------------------------------------------------------------------------
/cuckoo/web/templates/base.html:
--------------------------------------------------------------------------------
1 | {%include "header.html" %}
2 |
3 | {% autoescape on %}
4 |
5 |
6 |
Browser recommendation
7 |
Hello, we noticed that you are using . For the best performance of this application, we recommend to use Chrome, Firefox or any browser that supports WebKit.