Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run caldera.py #48

Closed
mgraf2 opened this issue Jul 5, 2018 · 22 comments
Closed

Unable to run caldera.py #48

mgraf2 opened this issue Jul 5, 2018 · 22 comments

Comments

@mgraf2
Copy link

mgraf2 commented Jul 5, 2018

I am getting the following error:

Traceback (most recent call last):
File "caldera.py", line 16, in
from app import server
File "C:\Users\John\Desktop\caldera-master 2\caldera\app\server.py", line 136
async def heartbeat_init():
^

@unkempthenry
Copy link
Contributor

Check your python version. You need 3.5+ . Check out the installation instructions here https://caldera.readthedocs.io/en/latest/installation.html

@mgraf2
Copy link
Author

mgraf2 commented Jul 5, 2018

my mistake I had python 3 and 2 both installed and accidentally ran with 2. I am getting a new error now.

File "C:\Users\John\AppData\Local\Programs\Python\Python37\lib\site-packages\p
ymongo\helpers.py", line 210, in _check_command_response
raise OperationFailure(msg % errmsg, code, response)
pymongo.errors.OperationFailure: Oplog collection reads are not allowed while in
the rollback or startup state.

@dm-mitre
Copy link
Contributor

dm-mitre commented Jul 6, 2018

@mgraf2 what version of mongodb and pymongo are you using?

@mgraf2
Copy link
Author

mgraf2 commented Jul 6, 2018

pymongo 3.5.1, and mongodb version 4.0.

@mgraf2
Copy link
Author

mgraf2 commented Jul 6, 2018

I was able to get past that with a lower version of mongodb, but now I am getting the following error:

C:\Users\John\Desktop\caldera-master 2\caldera>C:\Users\John\AppData\Local\Progr
ams\Python\Python37\python.exe caldera.py
Enter PEM pass phrase:DEBUG:app.server:Planner has started
DEBUG:asyncio:Using selector: SelectSelector
INFO:app.server:Planner closed
Process Process-1:
Traceback (most recent call last):
File "C:\Users\John\AppData\Local\Programs\Python\Python37\lib\site-packages\m
ongoengine\queryset\queryset.py", line 95, in _iter_results
raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\John\AppData\Local\Programs\Python\Python37\lib\multiprocessing
\process.py", line 297, in _bootstrap
self.run()
File "C:\Users\John\AppData\Local\Programs\Python\Python37\lib\multiprocessing
\process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\John\Desktop\caldera-master 2\caldera\app\server.py", line 165,
in sigint_handler
target()
File "C:\Users\John\Desktop\caldera-master 2\caldera\app\server.py", line 306,
in planner_process
loop.run_until_complete(start_operations(rebuild_mappings))
File "C:\Users\John\AppData\Local\Programs\Python\Python37\lib\asyncio\base_ev
ents.py", line 568, in run_until_complete
return future.result()
File "C:\Users\John\Desktop\caldera-master 2\caldera\app\updates.py", line 71,
in start_operations
for step in CodedStep.objects(name__nin=[x.name for x in operation_steps
.all_steps]):
RuntimeError: generator raised StopIteration

@unkempthenry
Copy link
Contributor

@mgraf2 Would you mind trying this with Python 3.6? I know I said 3.5+ earlier, but I'd like to rule out python version as the cause here.

@mgraf2
Copy link
Author

mgraf2 commented Jul 6, 2018

I can try that, I am now seeing this I think I am closer. What config file do I add this to?

INFO:app.server:No SSL certificate or key found. Generating a self-signed SSL c
rtificate for you.
'openssl' is not recognized as an internal or external command,
operable program or batch file.
ERROR:app.server:Could not locate certificate chain. Please generate with opens
l and add to configuration file.
e.g. 'openssl req -new -x509 -days 3652 -subj /CN='hostname --fqdn'/OU=
ervers/O='hostname -d'/C=US -nodes -out conf/cert.pem -keyout conf/key.pem'

@mgraf2
Copy link
Author

mgraf2 commented Jul 6, 2018

I finally got it to work, thank you for all your help!

@unkempthenry
Copy link
Contributor

In caldera/conf there's a settings.yaml file where the SSL cert and private key can be specified. By default these live in caldera/conf/cert.pem and caldera/conf/key.pem respectively.

Running the commandline specified in the logging output should generate the needed pem files openssl req -new -x509 -days 3652 -subj /CN='hostname --fqdn'/OU= ervers/O='hostname -d'/C=US -nodes -out conf/cert.pem -keyout conf/key.pem .

However, I think newer versions of openssl might throw an error at that line because it's missing a newly required agument. If that happens you can run openssl req -new -x509 -days 3652 -nodes -out conf/cert.pem -keyout conf/key.pem and follow the interactive prompt to fill out all the fields.

@unkempthenry
Copy link
Contributor

@mgraf2 nice! Did you wind up switching to Python 3.6?

@mgraf2
Copy link
Author

mgraf2 commented Jul 10, 2018

Yes I wound up switching to python 3.6, also didn't realize when running caldera.py it was asking for pem password which is printed to the cmd prompt but it gets hidden by a bunch of other stuff thats printed out; probably should have it wait for user to input pem password before continuing. I kept hitting enter without realizing it was asking for pem password and then it would exit with the error code. Can we expect other adversaries to be added to Caldera in a future update or is the user expected to add these on their own?

@w0rk3r
Copy link

w0rk3r commented Jul 14, 2018

I'm trying to run caldera on a centos, all dependencies installed and python3.6, getting the first error

pymongo.errors.OperationFailure: Oplog collection reads are not allowed while in the rollback or startup state.

Any tip to get this solved and running?

@mgraf2
Copy link
Author

mgraf2 commented Jul 14, 2018

I switched to Mongodb 3.0.1, and that seemed to do the trick.

@dm-mitre
Copy link
Contributor

@mgraf2 has the solution. We're currently working on MongoDB 4.0 support

@w0rk3r
Copy link

w0rk3r commented Jul 14, 2018

Oh, so that's it...i will try, thank you guys :D

@ericgatm4
Copy link

@dm-mitre want to be clear I must use MongodB3.6 not 4.0 as it's not supported yet. It looks the only download on Mongodb site is 4.0 though

@mgraf2
Copy link
Author

mgraf2 commented Jul 21, 2018

@mgraf2
Copy link
Author

mgraf2 commented Jul 21, 2018

3.01 rather

@ericgatm4
Copy link

ericgatm4 commented Jul 21, 2018 via email

@dm-mitre
Copy link
Contributor

@mgraf2 @ericgatm4 @w0rk3r We pushed some updates to support MongoDB 4.0 and also a docker-compose script which should make installation and running much easier. Let us know if you have any problems.

@stevenbrz
Copy link

stevenbrz commented Jul 30, 2018

@dm-mitre
It seems like the current build is incompatible with Python 3.7 as I ran into the following until downgrading to Python 3.6.x


Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\mongoengine\queryset\queryset.py", line 95, in _iter_results
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\caldera-master\caldera\app\server.py", line 127, in run
    web_process(settings, debug)
  File "C:\Users\Administrator\Desktop\caldera-master\caldera\app\server.py", line 250, in web_process
    for connection in ActiveConnection.objects:
RuntimeError: generator raised StopIteration

DEBUG:app.server:Planner has started
INFO:app.server:Loading default ATT&CK definitions
Process Process-1:
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\mongoengine\queryset\queryset.py", line 95, in _iter_results
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py", line 297, in _bootstrap
    self.run()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Administrator\Desktop\caldera-master\caldera\app\server.py", line 168, in sigint_handler
    target()
  File "C:\Users\Administrator\Desktop\caldera-master\caldera\app\server.py", line 303, in planner_process
    attack.load_default(attack_mappings)
  File "C:\Users\Administrator\Desktop\caldera-master\caldera\app\attack.py", line 90, in load_default
    for db_tech in AttackTechnique.objects:
RuntimeError: generator raised StopIteration

@unkempthenry
Copy link
Contributor

@stevenbrz , I've updated the version of mongoengine pinned in requirements.txt . I believe this will fix the error you received above running under Python 3.7.

brianedmonds90 pushed a commit that referenced this issue Jan 7, 2020
* Add files via upload

* Update wifi.ps1

* Update 297 Abilities

* Delete wifi.ps1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants