Skip to content

Running Metta

Chris Gates edited this page Feb 2, 2018 · 5 revisions

Running Metta

Confirm redis is running / start redis-server (Run this is its own terminal tab)

user@ubuntu:~/metta$ redis-server 
2867:C 02 Oct 08:20:34.699 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
2867:M 02 Oct 08:20:34.699 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.6 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 2867
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

2867:M 02 Oct 08:20:34.701 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
2867:M 02 Oct 08:20:34.701 # Server started, Redis version 3.0.6
2867:M 02 Oct 08:20:34.701 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
2867:M 02 Oct 08:20:34.701 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
2867:M 02 Oct 08:20:34.701 * The server is now ready to accept connections on port 6379

Start the celery shell script (Run this is its own terminal tab)

(metta) user@ubuntu:~/metta$ ./start_vagrant_celery.sh 
[2017-10-02 08:43:30,368: DEBUG/MainProcess] | Worker: Preparing bootsteps.
[2017-10-02 08:43:30,369: DEBUG/MainProcess] | Worker: Building graph...
[2017-10-02 08:43:30,369: DEBUG/MainProcess] | Worker: New boot order: {StateDB, Beat, Timer, Hub, Pool, Autoscaler, Consumer}
[2017-10-02 08:43:30,375: DEBUG/MainProcess] | Consumer: Preparing bootsteps.
[2017-10-02 08:43:30,375: DEBUG/MainProcess] | Consumer: Building graph...
[2017-10-02 08:43:30,385: DEBUG/MainProcess] | Consumer: New boot order: {Connection, Events, Heart, Mingle, Gossip, Tasks, Control, Agent, event loop}
 
 -------------- vagrant@ubuntu v4.1.0 (latentcall)
---- **** ----- 
--- * ***  * -- Linux-4.10.0-28-generic-x86_64-with-Ubuntu-16.04-xenial 2017-10-02 08:43:30
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .> app:         tasks:0x7fab5854cd90
- ** ---------- .> transport:   redis://127.0.0.1:6379/1
- ** ---------- .> results:     redis://localhost/0
- *** --- * --- .> concurrency: 3 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** ----- 
 -------------- [queues]
                .> celery           exchange=celery(direct) key=celery
                

[tasks]
  . celery.accumulate
  . celery.backend_cleanup
  . celery.chain
  . celery.chord
  . celery.chord_unlock
  . celery.chunks
  . celery.group
  . celery.map
  . celery.starmap
  . workers.vagranttasks.alive_vagrant
  . workers.vagranttasks.runcmd_nodb_osx
  . workers.vagranttasks.runcmd_nodb_win
  . workers.vagranttasks.runcmd_osx
  . workers.vagranttasks.runcmd_win

[2017-10-02 08:43:30,393: DEBUG/MainProcess] | Worker: Starting Hub
[2017-10-02 08:43:30,393: DEBUG/MainProcess] ^-- substep ok
[2017-10-02 08:43:30,393: DEBUG/MainProcess] | Worker: Starting Pool
[2017-10-02 08:43:30,444: DEBUG/MainProcess] ^-- substep ok
[2017-10-02 08:43:30,445: DEBUG/MainProcess] | Worker: Starting Consumer
[2017-10-02 08:43:30,445: DEBUG/MainProcess] | Consumer: Starting Connection
[2017-10-02 08:43:30,486: INFO/MainProcess] Connected to redis://127.0.0.1:6379/1
[2017-10-02 08:43:30,486: DEBUG/MainProcess] ^-- substep ok
[2017-10-02 08:43:30,486: DEBUG/MainProcess] | Consumer: Starting Events
[2017-10-02 08:43:30,491: DEBUG/MainProcess] ^-- substep ok
[2017-10-02 08:43:30,491: DEBUG/MainProcess] | Consumer: Starting Heart
[2017-10-02 08:43:30,493: DEBUG/MainProcess] ^-- substep ok
[2017-10-02 08:43:30,493: DEBUG/MainProcess] | Consumer: Starting Mingle
[2017-10-02 08:43:30,493: INFO/MainProcess] mingle: searching for neighbors
[2017-10-02 08:43:31,505: INFO/MainProcess] mingle: all alone
[2017-10-02 08:43:31,505: DEBUG/MainProcess] ^-- substep ok
[2017-10-02 08:43:31,505: DEBUG/MainProcess] | Consumer: Starting Gossip
[2017-10-02 08:43:31,507: DEBUG/MainProcess] ^-- substep ok
[2017-10-02 08:43:31,507: DEBUG/MainProcess] | Consumer: Starting Tasks
[2017-10-02 08:43:31,509: DEBUG/MainProcess] ^-- substep ok
[2017-10-02 08:43:31,509: DEBUG/MainProcess] | Consumer: Starting Control
[2017-10-02 08:43:31,510: DEBUG/MainProcess] ^-- substep ok
[2017-10-02 08:43:31,511: DEBUG/MainProcess] | Consumer: Starting event loop
[2017-10-02 08:43:31,511: DEBUG/MainProcess] | Worker: Hub.register Pool...
[2017-10-02 08:43:31,511: INFO/MainProcess] vagrant@ubuntu ready.
[2017-10-02 08:43:31,511: DEBUG/MainProcess] basic.qos: prefetch_count->12


1. edit config.ini to point to the virtualbox/vagrant boxes location and vagrant names

You may want to run the following command to ignore changes to your config.ini file when you git pull in the future:

git update-index --assume-unchanged config.ini

To undo and start tracking again:

git update-index --no-assume-unchanged config.ini

2. "vagrant up" your vagrants if you haven't

3. In a new tab run run_simulation_yaml.py


$ python run_simulation_yaml.py -f MITRE/Adversarial_Simulation/actions_example.yml

 __   __  _______  _______  _______  _______
|  |_|  ||       ||       ||       ||   _   |
|       ||    ___||_     _||_     _||  |_|  |
|       ||   |___   |   |    |   |  |       |
|       ||    ___|  |   |    |   |  |       |
| ||_|| ||   |___   |   |    |   |  |   _   |
|_|   |_||_______|  |___|    |___|  |__| |__|


YAML FILE: MITRE/Adversarial_Simulation/actions_example.yml

Running UUID actions inside:MITRE/Adversarial_Simulation/actions_example.yml
OS matched windows...sending to the windows vagrant
Running: cmd.exe /c net user
Running: cmd.exe /c net user /domain

4. You should be able to view how things are going in the tab where you ran ./start_vagrant_celery.sh

[2017-11-03 15:09:40,097: DEBUG/MainProcess] TaskPool: Apply <function _fast_trace_task at 0x10c5da500> (args:('workers.vagranttasks.runcmd_nodb_win', 'c86fd5ef-260c-40cf-915b-b2046831a66d', {'origin': 'gen9212@XXXXXXXXX', 'lang': 'py', 'task': 'workers.vagranttasks.runcmd_nodb_win', 'group': None, 'root_id': 'c86fd5ef-260c-40cf-915b-b2046831a66d', u'delivery_info': {u'priority': 0, u'redelivered': None, u'routing_key': 'celery', u'exchange': u''}, 'expires': None, u'correlation_id': 'c86fd5ef-260c-40cf-915b-b2046831a66d', 'retries': 0, 'timelimit': [None, None], 'argsrepr': "('cmd.exe /c net user', 'Actions Example', '66a63b5f-268f-42cc-9e67-1518a4b01326', 'windows-cb')", 'eta': None, 'parent_id': None, u'reply_to': '717b4782-0b1a-3207-8563-d06e8450e9ae', 'id': 'c86fd5ef-260c-40cf-915b-b2046831a66d', 'kwargsrepr': '{}'}, '[["cmd.exe /c net user", "Actions Example", "66a63b5f-268f-42cc-9e67-1518a4b01326", "windows-cb"], {}, {"chord": null, "callbacks": null, "errbacks": null, "chain": null}]', 'application/json', 'utf-8') kwargs:{})
[2017-11-03 15:09:40,098: DEBUG/MainProcess] Task accepted: workers.vagranttasks.runcmd_nodb_win[c86fd5ef-260c-40cf-915b-b2046831a66d] pid:9200
[2017-11-03 15:09:40,098: WARNING/PoolWorker-1] changing locations
[2017-11-03 15:09:40,099: WARNING/PoolWorker-1] ##### DEBUG -- We made it to the vagrant function  -- DEBUG ######
[2017-11-03 15:09:40,099: WARNING/PoolWorker-1] 'Running: cmd.exe /c net user with Rule GUID: 66a63b5f-268f-42cc-9e67-1518a4b01326 against vagrant windows-cb

User accounts for \\

-------------------------------------------------------------------------------
Administrator            automation               DefaultAccount
defaultuser0             Guest                    
The command completed with one or more errors.

The following WinRM command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!