Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion kinder/ebs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
###############################################################################
# TODO:
###############################################################################
import sys
from re import search

from kinder.ec2 import EC2 # need to work with instance parents
Expand All @@ -20,7 +21,7 @@ def __init__(self, volume_id, region, sess):
self.conn = sess.resource("ec2", region_name=region)
except Exception as e:
KLog.log("issue connecting to AWS %s" % str(e), "critical")
exit("[!] issue connecting to AWS: %s" % str(e))
sys.exit("[!] issue connecting to AWS: %s" % str(e))
# get volume reference
self.volume = self.conn.Volume(volume_id)
self.region = region
Expand Down
4 changes: 3 additions & 1 deletion kinder/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
###############################################################################
# TODO:
###############################################################################
import sys

from botocore.exceptions import ClientError

from lib.krampus_logging import KLog
Expand All @@ -16,7 +18,7 @@ def __init__(self, instance_id, region, sess):
self.conn = sess.resource("ec2", region)
except Exception as e:
KLog.log("issue connecting to AWS %s" % str(e), "critical")
exit("[!] issue connecting to AWS: %s" % str(e))
sys.exit("[!] issue connecting to AWS: %s" % str(e))
# set it
self.instance = self.getInstanceByID(instance_id)
# verify the instance
Expand Down
4 changes: 3 additions & 1 deletion kinder/lambda_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
###############################################################################
# TODO:
###############################################################################
import sys

from lib.krampus_logging import KLog


Expand All @@ -14,7 +16,7 @@ def __init__(self, func_name, region, sess):
self.conn = sess.client("lambda", region_name=region)
except Exception as e:
KLog.log("issue connecting to AWS %s" % str(e), "critical")
exit("[!] issue connecting to AWS: %s" % str(e))
sys.exit("[!] issue connecting to AWS: %s" % str(e))
# get volume reference
self.func = func_name
self.region = region
Expand Down
4 changes: 3 additions & 1 deletion kinder/rds.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# TODO:
# add more disable groups/rules
###############################################################################
import sys

from lib.krampus_logging import KLog


Expand All @@ -15,7 +17,7 @@ def __init__(self, instance_name, region, sess):
self.conn = sess.client('rds', region_name=region)
except:
KLog.log("issue connecting to AWS", "critical")
exit("[!] issue connecting to AWS")
sys.exit("[!] issue connecting to AWS")
# set it
self.name = instance_name
self.disable_groups = ['sg-c6d41cae']
Expand Down
4 changes: 3 additions & 1 deletion kinder/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
###############################################################################
# TODO:
###############################################################################
import sys

from lib.krampus_logging import KLog


Expand All @@ -16,7 +18,7 @@ def __init__(self, bucket_name, sess, region="us-east-1"):
self.conn = sess.resource("s3", region_name=region)
except:
KLog.log("issue connecting to AWS", "critical")
exit("[!] issue connecting to AWS")
sys.exit("[!] issue connecting to AWS")
# set it - as far as krampus is concerned the acls are the bucket
self.bucket = self.conn.BucketAcl(bucket_name)

Expand Down
5 changes: 4 additions & 1 deletion kinder/security_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
# TODO:
# no ipv6 support
###############################################################################
import sys

from botocore.exceptions import ClientError

from lib.krampus_logging import KLog


Expand All @@ -20,7 +23,7 @@ def __init__(self, group_id, region, sess):
self.group = False
except:
KLog.log("issue connecting to AWS", "critical")
exit("[!] issue connecting to AWS")
sys.exit("[!] issue connecting to AWS")

# see if there is a specified range in this rule
def hasRange(self, rules, cidr_range):
Expand Down
15 changes: 8 additions & 7 deletions lib/krampus_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@
# TODO:
# all these tasks should return a status to krampus.py
###############################################################################
import boto3
from botocore.exceptions import ClientError
import json
import time
import sys
import time

import boto3
from botocore.exceptions import ClientError

from kinder import ebs
# our stuff
from kinder import ec2
from kinder import iam
from kinder import lambda_funcs
from kinder import rds
from kinder import s3
from kinder import security_group
from kinder import ebs
from kinder import lambda_funcs
from lib.krampus_logging import KLog
from lib.aws_sessions import KSession
from lib.krampus_logging import KLog

# not sure what keys will be passed, but I do know how what krampus wants
KEYS = {
Expand Down Expand Up @@ -240,7 +241,7 @@ def getTasks(self, key):
self.json_data = json.load(self.bucket.Object(key).get()['Body'])
except ClientError as e:
KLog.log("failed to download tasks file: %s" % str(e), "critical")
exit()
sys.exit()
for job in self.json_data['tasks']:
# resolve the arn
arn_obj = KTask.ARN(job[KEYS['arn']])
Expand Down