forked from p34709852/monkey
Merge pull request #502 from guardicore/bugfix/remove_warnings
Bugfix/remove warnings
This commit is contained in:
commit
0b22903c36
|
@ -27,35 +27,36 @@ class MonkeyIslandRequests(object):
|
||||||
@classmethod
|
@classmethod
|
||||||
def refresh_jwt_token(cls, request_function):
|
def refresh_jwt_token(cls, request_function):
|
||||||
@functools.wraps(request_function)
|
@functools.wraps(request_function)
|
||||||
def request_function_wrapper(self, *args,**kwargs):
|
def request_function_wrapper(self, *args, **kwargs):
|
||||||
self.token = self.try_get_jwt_from_server()
|
self.token = self.try_get_jwt_from_server()
|
||||||
# noinspection PyArgumentList
|
# noinspection PyArgumentList
|
||||||
return request_function(self, *args, **kwargs)
|
return request_function(self, *args, **kwargs)
|
||||||
|
|
||||||
return request_function_wrapper
|
return request_function_wrapper
|
||||||
|
|
||||||
def get_jwt_from_server(self):
|
def get_jwt_from_server(self):
|
||||||
resp = requests.post(self.addr + "api/auth",
|
resp = requests.post(self.addr + "api/auth", # noqa: DUO123
|
||||||
json={"username": NO_AUTH_CREDS, "password": NO_AUTH_CREDS},
|
json={"username": NO_AUTH_CREDS, "password": NO_AUTH_CREDS},
|
||||||
verify=False)
|
verify=False)
|
||||||
return resp.json()["access_token"]
|
return resp.json()["access_token"]
|
||||||
|
|
||||||
@_Decorators.refresh_jwt_token
|
@_Decorators.refresh_jwt_token
|
||||||
def get(self, url, data=None):
|
def get(self, url, data=None):
|
||||||
return requests.get(self.addr + url,
|
return requests.get(self.addr + url, # noqa: DUO123
|
||||||
headers=self.get_jwt_header(),
|
headers=self.get_jwt_header(),
|
||||||
params=data,
|
params=data,
|
||||||
verify=False)
|
verify=False)
|
||||||
|
|
||||||
@_Decorators.refresh_jwt_token
|
@_Decorators.refresh_jwt_token
|
||||||
def post(self, url, data):
|
def post(self, url, data):
|
||||||
return requests.post(self.addr + url,
|
return requests.post(self.addr + url, # noqa: DUO123
|
||||||
data=data,
|
data=data,
|
||||||
headers=self.get_jwt_header(),
|
headers=self.get_jwt_header(),
|
||||||
verify=False)
|
verify=False)
|
||||||
|
|
||||||
@_Decorators.refresh_jwt_token
|
@_Decorators.refresh_jwt_token
|
||||||
def post_json(self, url, dict_data):
|
def post_json(self, url, dict_data):
|
||||||
return requests.post(self.addr + url,
|
return requests.post(self.addr + url, # noqa: DUO123
|
||||||
json=dict_data,
|
json=dict_data,
|
||||||
headers=self.get_jwt_header(),
|
headers=self.get_jwt_header(),
|
||||||
verify=False)
|
verify=False)
|
||||||
|
|
|
@ -2,7 +2,7 @@ provider "google" {
|
||||||
project = "test-000000"
|
project = "test-000000"
|
||||||
region = "europe-west3"
|
region = "europe-west3"
|
||||||
zone = "europe-west3-b"
|
zone = "europe-west3-b"
|
||||||
credentials = "${file("../gcp_keys/gcp_key.json")}"
|
credentials = file("../gcp_keys/gcp_key.json")
|
||||||
}
|
}
|
||||||
locals {
|
locals {
|
||||||
resource_prefix = ""
|
resource_prefix = ""
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
resource "google_compute_firewall" "islands-in" {
|
resource "google_compute_firewall" "islands-in" {
|
||||||
name = "${local.resource_prefix}islands-in"
|
name = "${local.resource_prefix}islands-in"
|
||||||
network = "${google_compute_network.monkeyzoo.name}"
|
network = google_compute_network.monkeyzoo.name
|
||||||
|
|
||||||
allow {
|
allow {
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
|
@ -14,7 +14,7 @@ resource "google_compute_firewall" "islands-in" {
|
||||||
|
|
||||||
resource "google_compute_firewall" "islands-out" {
|
resource "google_compute_firewall" "islands-out" {
|
||||||
name = "${local.resource_prefix}islands-out"
|
name = "${local.resource_prefix}islands-out"
|
||||||
network = "${google_compute_network.monkeyzoo.name}"
|
network = google_compute_network.monkeyzoo.name
|
||||||
|
|
||||||
allow {
|
allow {
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
|
@ -27,7 +27,7 @@ resource "google_compute_firewall" "islands-out" {
|
||||||
|
|
||||||
resource "google_compute_firewall" "monkeyzoo-in" {
|
resource "google_compute_firewall" "monkeyzoo-in" {
|
||||||
name = "${local.resource_prefix}monkeyzoo-in"
|
name = "${local.resource_prefix}monkeyzoo-in"
|
||||||
network = "${google_compute_network.monkeyzoo.name}"
|
network = google_compute_network.monkeyzoo.name
|
||||||
|
|
||||||
allow {
|
allow {
|
||||||
protocol = "all"
|
protocol = "all"
|
||||||
|
@ -40,7 +40,7 @@ resource "google_compute_firewall" "monkeyzoo-in" {
|
||||||
|
|
||||||
resource "google_compute_firewall" "monkeyzoo-out" {
|
resource "google_compute_firewall" "monkeyzoo-out" {
|
||||||
name = "${local.resource_prefix}monkeyzoo-out"
|
name = "${local.resource_prefix}monkeyzoo-out"
|
||||||
network = "${google_compute_network.monkeyzoo.name}"
|
network = google_compute_network.monkeyzoo.name
|
||||||
|
|
||||||
allow {
|
allow {
|
||||||
protocol = "all"
|
protocol = "all"
|
||||||
|
@ -53,7 +53,7 @@ resource "google_compute_firewall" "monkeyzoo-out" {
|
||||||
|
|
||||||
resource "google_compute_firewall" "tunneling-in" {
|
resource "google_compute_firewall" "tunneling-in" {
|
||||||
name = "${local.resource_prefix}tunneling-in"
|
name = "${local.resource_prefix}tunneling-in"
|
||||||
network = "${google_compute_network.tunneling.name}"
|
network = google_compute_network.tunneling.name
|
||||||
|
|
||||||
allow {
|
allow {
|
||||||
protocol = "all"
|
protocol = "all"
|
||||||
|
@ -65,7 +65,7 @@ resource "google_compute_firewall" "tunneling-in" {
|
||||||
|
|
||||||
resource "google_compute_firewall" "tunneling-out" {
|
resource "google_compute_firewall" "tunneling-out" {
|
||||||
name = "${local.resource_prefix}tunneling-out"
|
name = "${local.resource_prefix}tunneling-out"
|
||||||
network = "${google_compute_network.tunneling.name}"
|
network = google_compute_network.tunneling.name
|
||||||
|
|
||||||
allow {
|
allow {
|
||||||
protocol = "all"
|
protocol = "all"
|
||||||
|
@ -77,7 +77,7 @@ resource "google_compute_firewall" "tunneling-out" {
|
||||||
|
|
||||||
resource "google_compute_firewall" "tunneling2-in" {
|
resource "google_compute_firewall" "tunneling2-in" {
|
||||||
name = "${local.resource_prefix}tunneling2-in"
|
name = "${local.resource_prefix}tunneling2-in"
|
||||||
network = "${google_compute_network.tunneling2.name}"
|
network = google_compute_network.tunneling2.name
|
||||||
|
|
||||||
allow {
|
allow {
|
||||||
protocol = "all"
|
protocol = "all"
|
||||||
|
@ -89,7 +89,7 @@ resource "google_compute_firewall" "tunneling2-in" {
|
||||||
|
|
||||||
resource "google_compute_firewall" "tunneling2-out" {
|
resource "google_compute_firewall" "tunneling2-out" {
|
||||||
name = "${local.resource_prefix}tunneling2-out"
|
name = "${local.resource_prefix}tunneling2-out"
|
||||||
network = "${google_compute_network.tunneling2.name}"
|
network = google_compute_network.tunneling2.name
|
||||||
|
|
||||||
allow {
|
allow {
|
||||||
protocol = "all"
|
protocol = "all"
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
//Custom cloud images
|
//Custom cloud images
|
||||||
data "google_compute_image" "hadoop-2" {
|
data "google_compute_image" "hadoop-2" {
|
||||||
name = "hadoop-2"
|
name = "hadoop-2"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "hadoop-3" {
|
data "google_compute_image" "hadoop-3" {
|
||||||
name = "hadoop-3"
|
name = "hadoop-3"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "elastic-4" {
|
data "google_compute_image" "elastic-4" {
|
||||||
name = "elastic-4"
|
name = "elastic-4"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "elastic-5" {
|
data "google_compute_image" "elastic-5" {
|
||||||
name = "elastic-5"
|
name = "elastic-5"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -23,73 +23,73 @@ data "google_compute_image" "sambacry-6" {
|
||||||
*/
|
*/
|
||||||
data "google_compute_image" "shellshock-8" {
|
data "google_compute_image" "shellshock-8" {
|
||||||
name = "shellshock-8"
|
name = "shellshock-8"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "tunneling-9" {
|
data "google_compute_image" "tunneling-9" {
|
||||||
name = "tunneling-9"
|
name = "tunneling-9"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "tunneling-10" {
|
data "google_compute_image" "tunneling-10" {
|
||||||
name = "tunneling-10"
|
name = "tunneling-10"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "tunneling-11" {
|
data "google_compute_image" "tunneling-11" {
|
||||||
name = "tunneling-11"
|
name = "tunneling-11"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "sshkeys-11" {
|
data "google_compute_image" "sshkeys-11" {
|
||||||
name = "sshkeys-11"
|
name = "sshkeys-11"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "sshkeys-12" {
|
data "google_compute_image" "sshkeys-12" {
|
||||||
name = "sshkeys-12"
|
name = "sshkeys-12"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "mimikatz-14" {
|
data "google_compute_image" "mimikatz-14" {
|
||||||
name = "mimikatz-14"
|
name = "mimikatz-14"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "mimikatz-15" {
|
data "google_compute_image" "mimikatz-15" {
|
||||||
name = "mimikatz-15"
|
name = "mimikatz-15"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "mssql-16" {
|
data "google_compute_image" "mssql-16" {
|
||||||
name = "mssql-16"
|
name = "mssql-16"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "weblogic-18" {
|
data "google_compute_image" "weblogic-18" {
|
||||||
name = "weblogic-18"
|
name = "weblogic-18"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "weblogic-19" {
|
data "google_compute_image" "weblogic-19" {
|
||||||
name = "weblogic-19"
|
name = "weblogic-19"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "smb-20" {
|
data "google_compute_image" "smb-20" {
|
||||||
name = "smb-20"
|
name = "smb-20"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "scan-21" {
|
data "google_compute_image" "scan-21" {
|
||||||
name = "scan-21"
|
name = "scan-21"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "scan-22" {
|
data "google_compute_image" "scan-22" {
|
||||||
name = "scan-22"
|
name = "scan-22"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "struts2-23" {
|
data "google_compute_image" "struts2-23" {
|
||||||
name = "struts2-23"
|
name = "struts2-23"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "struts2-24" {
|
data "google_compute_image" "struts2-24" {
|
||||||
name = "struts2-24"
|
name = "struts2-24"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "island-linux-250" {
|
data "google_compute_image" "island-linux-250" {
|
||||||
name = "island-linux-250"
|
name = "island-linux-250"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
data "google_compute_image" "island-windows-251" {
|
data "google_compute_image" "island-windows-251" {
|
||||||
name = "island-windows-251"
|
name = "island-windows-251"
|
||||||
project = "${local.monkeyzoo_project}"
|
project = local.monkeyzoo_project
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
// Local variables
|
// Local variables
|
||||||
locals {
|
locals {
|
||||||
default_ubuntu="${google_compute_instance_template.ubuntu16.self_link}"
|
default_ubuntu=google_compute_instance_template.ubuntu16.self_link
|
||||||
default_windows="${google_compute_instance_template.windows2016.self_link}"
|
default_windows=google_compute_instance_template.windows2016.self_link
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_network" "monkeyzoo" {
|
resource "google_compute_network" "monkeyzoo" {
|
||||||
|
@ -23,27 +23,27 @@ resource "google_compute_network" "tunneling2" {
|
||||||
resource "google_compute_subnetwork" "monkeyzoo-main" {
|
resource "google_compute_subnetwork" "monkeyzoo-main" {
|
||||||
name = "${local.resource_prefix}monkeyzoo-main"
|
name = "${local.resource_prefix}monkeyzoo-main"
|
||||||
ip_cidr_range = "10.2.2.0/24"
|
ip_cidr_range = "10.2.2.0/24"
|
||||||
network = "${google_compute_network.monkeyzoo.self_link}"
|
network = google_compute_network.monkeyzoo.self_link
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_subnetwork" "tunneling-main" {
|
resource "google_compute_subnetwork" "tunneling-main" {
|
||||||
name = "${local.resource_prefix}tunneling-main"
|
name = "${local.resource_prefix}tunneling-main"
|
||||||
ip_cidr_range = "10.2.1.0/28"
|
ip_cidr_range = "10.2.1.0/28"
|
||||||
network = "${google_compute_network.tunneling.self_link}"
|
network = google_compute_network.tunneling.self_link
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_subnetwork" "tunneling2-main" {
|
resource "google_compute_subnetwork" "tunneling2-main" {
|
||||||
name = "${local.resource_prefix}tunneling2-main"
|
name = "${local.resource_prefix}tunneling2-main"
|
||||||
ip_cidr_range = "10.2.0.0/27"
|
ip_cidr_range = "10.2.0.0/27"
|
||||||
network = "${google_compute_network.tunneling2.self_link}"
|
network = google_compute_network.tunneling2.self_link
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "hadoop-2" {
|
resource "google_compute_instance_from_template" "hadoop-2" {
|
||||||
name = "${local.resource_prefix}hadoop-2"
|
name = "${local.resource_prefix}hadoop-2"
|
||||||
source_instance_template = "${local.default_ubuntu}"
|
source_instance_template = local.default_ubuntu
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.hadoop-2.self_link}"
|
image = data.google_compute_image.hadoop-2.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,10 @@ resource "google_compute_instance_from_template" "hadoop-2" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "hadoop-3" {
|
resource "google_compute_instance_from_template" "hadoop-3" {
|
||||||
name = "${local.resource_prefix}hadoop-3"
|
name = "${local.resource_prefix}hadoop-3"
|
||||||
source_instance_template = "${local.default_windows}"
|
source_instance_template = local.default_windows
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.hadoop-3.self_link}"
|
image = data.google_compute_image.hadoop-3.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -72,10 +72,10 @@ resource "google_compute_instance_from_template" "hadoop-3" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "elastic-4" {
|
resource "google_compute_instance_from_template" "elastic-4" {
|
||||||
name = "${local.resource_prefix}elastic-4"
|
name = "${local.resource_prefix}elastic-4"
|
||||||
source_instance_template = "${local.default_ubuntu}"
|
source_instance_template = local.default_ubuntu
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.elastic-4.self_link}"
|
image = data.google_compute_image.elastic-4.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -87,10 +87,10 @@ resource "google_compute_instance_from_template" "elastic-4" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "elastic-5" {
|
resource "google_compute_instance_from_template" "elastic-5" {
|
||||||
name = "${local.resource_prefix}elastic-5"
|
name = "${local.resource_prefix}elastic-5"
|
||||||
source_instance_template = "${local.default_windows}"
|
source_instance_template = local.default_windows
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.elastic-5.self_link}"
|
image = data.google_compute_image.elastic-5.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -135,10 +135,10 @@ resource "google_compute_instance_from_template" "sambacry-7" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "shellshock-8" {
|
resource "google_compute_instance_from_template" "shellshock-8" {
|
||||||
name = "${local.resource_prefix}shellshock-8"
|
name = "${local.resource_prefix}shellshock-8"
|
||||||
source_instance_template = "${local.default_ubuntu}"
|
source_instance_template = local.default_ubuntu
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.shellshock-8.self_link}"
|
image = data.google_compute_image.shellshock-8.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -150,10 +150,10 @@ resource "google_compute_instance_from_template" "shellshock-8" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "tunneling-9" {
|
resource "google_compute_instance_from_template" "tunneling-9" {
|
||||||
name = "${local.resource_prefix}tunneling-9"
|
name = "${local.resource_prefix}tunneling-9"
|
||||||
source_instance_template = "${local.default_ubuntu}"
|
source_instance_template = local.default_ubuntu
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.tunneling-9.self_link}"
|
image = data.google_compute_image.tunneling-9.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -169,10 +169,10 @@ resource "google_compute_instance_from_template" "tunneling-9" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "tunneling-10" {
|
resource "google_compute_instance_from_template" "tunneling-10" {
|
||||||
name = "${local.resource_prefix}tunneling-10"
|
name = "${local.resource_prefix}tunneling-10"
|
||||||
source_instance_template = "${local.default_ubuntu}"
|
source_instance_template = local.default_ubuntu
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.tunneling-10.self_link}"
|
image = data.google_compute_image.tunneling-10.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -188,10 +188,10 @@ resource "google_compute_instance_from_template" "tunneling-10" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "tunneling-11" {
|
resource "google_compute_instance_from_template" "tunneling-11" {
|
||||||
name = "${local.resource_prefix}tunneling-11"
|
name = "${local.resource_prefix}tunneling-11"
|
||||||
source_instance_template = "${local.default_ubuntu}"
|
source_instance_template = local.default_ubuntu
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.tunneling-11.self_link}"
|
image = data.google_compute_image.tunneling-11.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -203,10 +203,10 @@ resource "google_compute_instance_from_template" "tunneling-11" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "sshkeys-11" {
|
resource "google_compute_instance_from_template" "sshkeys-11" {
|
||||||
name = "${local.resource_prefix}sshkeys-11"
|
name = "${local.resource_prefix}sshkeys-11"
|
||||||
source_instance_template = "${local.default_ubuntu}"
|
source_instance_template = local.default_ubuntu
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.sshkeys-11.self_link}"
|
image = data.google_compute_image.sshkeys-11.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -218,10 +218,10 @@ resource "google_compute_instance_from_template" "sshkeys-11" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "sshkeys-12" {
|
resource "google_compute_instance_from_template" "sshkeys-12" {
|
||||||
name = "${local.resource_prefix}sshkeys-12"
|
name = "${local.resource_prefix}sshkeys-12"
|
||||||
source_instance_template = "${local.default_ubuntu}"
|
source_instance_template = local.default_ubuntu
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.sshkeys-12.self_link}"
|
image = data.google_compute_image.sshkeys-12.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -249,10 +249,10 @@ resource "google_compute_instance_from_template" "rdpgrinder-13" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "mimikatz-14" {
|
resource "google_compute_instance_from_template" "mimikatz-14" {
|
||||||
name = "${local.resource_prefix}mimikatz-14"
|
name = "${local.resource_prefix}mimikatz-14"
|
||||||
source_instance_template = "${local.default_windows}"
|
source_instance_template = local.default_windows
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.mimikatz-14.self_link}"
|
image = data.google_compute_image.mimikatz-14.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -264,10 +264,10 @@ resource "google_compute_instance_from_template" "mimikatz-14" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "mimikatz-15" {
|
resource "google_compute_instance_from_template" "mimikatz-15" {
|
||||||
name = "${local.resource_prefix}mimikatz-15"
|
name = "${local.resource_prefix}mimikatz-15"
|
||||||
source_instance_template = "${local.default_windows}"
|
source_instance_template = local.default_windows
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.mimikatz-15.self_link}"
|
image = data.google_compute_image.mimikatz-15.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -279,10 +279,10 @@ resource "google_compute_instance_from_template" "mimikatz-15" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "mssql-16" {
|
resource "google_compute_instance_from_template" "mssql-16" {
|
||||||
name = "${local.resource_prefix}mssql-16"
|
name = "${local.resource_prefix}mssql-16"
|
||||||
source_instance_template = "${local.default_windows}"
|
source_instance_template = local.default_windows
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.mssql-16.self_link}"
|
image = data.google_compute_image.mssql-16.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -314,10 +314,10 @@ resource "google_compute_instance_from_template" "upgrader-17" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "weblogic-18" {
|
resource "google_compute_instance_from_template" "weblogic-18" {
|
||||||
name = "${local.resource_prefix}weblogic-18"
|
name = "${local.resource_prefix}weblogic-18"
|
||||||
source_instance_template = "${local.default_ubuntu}"
|
source_instance_template = local.default_ubuntu
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.weblogic-18.self_link}"
|
image = data.google_compute_image.weblogic-18.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -329,10 +329,10 @@ resource "google_compute_instance_from_template" "weblogic-18" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "weblogic-19" {
|
resource "google_compute_instance_from_template" "weblogic-19" {
|
||||||
name = "${local.resource_prefix}weblogic-19"
|
name = "${local.resource_prefix}weblogic-19"
|
||||||
source_instance_template = "${local.default_windows}"
|
source_instance_template = local.default_windows
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.weblogic-19.self_link}"
|
image = data.google_compute_image.weblogic-19.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -344,10 +344,10 @@ resource "google_compute_instance_from_template" "weblogic-19" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "smb-20" {
|
resource "google_compute_instance_from_template" "smb-20" {
|
||||||
name = "${local.resource_prefix}smb-20"
|
name = "${local.resource_prefix}smb-20"
|
||||||
source_instance_template = "${local.default_windows}"
|
source_instance_template = local.default_windows
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.smb-20.self_link}"
|
image = data.google_compute_image.smb-20.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -359,10 +359,10 @@ resource "google_compute_instance_from_template" "smb-20" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "scan-21" {
|
resource "google_compute_instance_from_template" "scan-21" {
|
||||||
name = "${local.resource_prefix}scan-21"
|
name = "${local.resource_prefix}scan-21"
|
||||||
source_instance_template = "${local.default_ubuntu}"
|
source_instance_template = local.default_ubuntu
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.scan-21.self_link}"
|
image = data.google_compute_image.scan-21.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -374,10 +374,10 @@ resource "google_compute_instance_from_template" "scan-21" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "scan-22" {
|
resource "google_compute_instance_from_template" "scan-22" {
|
||||||
name = "${local.resource_prefix}scan-22"
|
name = "${local.resource_prefix}scan-22"
|
||||||
source_instance_template = "${local.default_windows}"
|
source_instance_template = local.default_windows
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.scan-22.self_link}"
|
image = data.google_compute_image.scan-22.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -389,10 +389,10 @@ resource "google_compute_instance_from_template" "scan-22" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "struts2-23" {
|
resource "google_compute_instance_from_template" "struts2-23" {
|
||||||
name = "${local.resource_prefix}struts2-23"
|
name = "${local.resource_prefix}struts2-23"
|
||||||
source_instance_template = "${local.default_ubuntu}"
|
source_instance_template = local.default_ubuntu
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.struts2-23.self_link}"
|
image = data.google_compute_image.struts2-23.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -404,10 +404,10 @@ resource "google_compute_instance_from_template" "struts2-23" {
|
||||||
|
|
||||||
resource "google_compute_instance_from_template" "struts2-24" {
|
resource "google_compute_instance_from_template" "struts2-24" {
|
||||||
name = "${local.resource_prefix}struts2-24"
|
name = "${local.resource_prefix}struts2-24"
|
||||||
source_instance_template = "${local.default_windows}"
|
source_instance_template = local.default_windows
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.struts2-24.self_link}"
|
image = data.google_compute_image.struts2-24.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -421,10 +421,10 @@ resource "google_compute_instance_from_template" "island-linux-250" {
|
||||||
name = "${local.resource_prefix}island-linux-250"
|
name = "${local.resource_prefix}island-linux-250"
|
||||||
machine_type = "n1-standard-2"
|
machine_type = "n1-standard-2"
|
||||||
tags = ["island", "linux", "ubuntu16"]
|
tags = ["island", "linux", "ubuntu16"]
|
||||||
source_instance_template = "${local.default_ubuntu}"
|
source_instance_template = local.default_ubuntu
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.island-linux-250.self_link}"
|
image = data.google_compute_image.island-linux-250.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
@ -442,10 +442,10 @@ resource "google_compute_instance_from_template" "island-windows-251" {
|
||||||
name = "${local.resource_prefix}island-windows-251"
|
name = "${local.resource_prefix}island-windows-251"
|
||||||
machine_type = "n1-standard-2"
|
machine_type = "n1-standard-2"
|
||||||
tags = ["island", "windows", "windowsserver2016"]
|
tags = ["island", "windows", "windowsserver2016"]
|
||||||
source_instance_template = "${local.default_windows}"
|
source_instance_template = local.default_windows
|
||||||
boot_disk{
|
boot_disk{
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "${data.google_compute_image.island-windows-251.self_link}"
|
image = data.google_compute_image.island-windows-251.self_link
|
||||||
}
|
}
|
||||||
auto_delete = true
|
auto_delete = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ resource "google_compute_instance_template" "ubuntu16" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
service_account {
|
service_account {
|
||||||
email ="${local.service_account_email}"
|
email =local.service_account_email
|
||||||
scopes=["cloud-platform"]
|
scopes=["cloud-platform"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ resource "google_compute_instance_template" "windows2016" {
|
||||||
subnetwork="monkeyzoo-main"
|
subnetwork="monkeyzoo-main"
|
||||||
}
|
}
|
||||||
service_account {
|
service_account {
|
||||||
email="${local.service_account_email}"
|
email=local.service_account_email
|
||||||
scopes=["cloud-platform"]
|
scopes=["cloud-platform"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ class ControlClient(object):
|
||||||
if ControlClient.proxies:
|
if ControlClient.proxies:
|
||||||
monkey['tunnel'] = ControlClient.proxies.get('https')
|
monkey['tunnel'] = ControlClient.proxies.get('https')
|
||||||
|
|
||||||
requests.post("https://%s/api/monkey" % (WormConfiguration.current_server,),
|
requests.post("https://%s/api/monkey" % (WormConfiguration.current_server,), # noqa: DUO123
|
||||||
data=json.dumps(monkey),
|
data=json.dumps(monkey),
|
||||||
headers={'content-type': 'application/json'},
|
headers={'content-type': 'application/json'},
|
||||||
verify=False,
|
verify=False,
|
||||||
|
@ -76,7 +76,7 @@ class ControlClient(object):
|
||||||
if ControlClient.proxies:
|
if ControlClient.proxies:
|
||||||
debug_message += " through proxies: %s" % ControlClient.proxies
|
debug_message += " through proxies: %s" % ControlClient.proxies
|
||||||
LOG.debug(debug_message)
|
LOG.debug(debug_message)
|
||||||
requests.get("https://%s/api?action=is-up" % (server,),
|
requests.get("https://%s/api?action=is-up" % (server,), # noqa: DUO123
|
||||||
verify=False,
|
verify=False,
|
||||||
proxies=ControlClient.proxies,
|
proxies=ControlClient.proxies,
|
||||||
timeout=TIMEOUT_IN_SECONDS)
|
timeout=TIMEOUT_IN_SECONDS)
|
||||||
|
@ -112,7 +112,7 @@ class ControlClient(object):
|
||||||
monkey = {}
|
monkey = {}
|
||||||
if ControlClient.proxies:
|
if ControlClient.proxies:
|
||||||
monkey['tunnel'] = ControlClient.proxies.get('https')
|
monkey['tunnel'] = ControlClient.proxies.get('https')
|
||||||
requests.patch("https://%s/api/monkey/%s" % (WormConfiguration.current_server, GUID),
|
requests.patch("https://%s/api/monkey/%s" % (WormConfiguration.current_server, GUID), # noqa: DUO123
|
||||||
data=json.dumps(monkey),
|
data=json.dumps(monkey),
|
||||||
headers={'content-type': 'application/json'},
|
headers={'content-type': 'application/json'},
|
||||||
verify=False,
|
verify=False,
|
||||||
|
@ -129,7 +129,7 @@ class ControlClient(object):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
telemetry = {'monkey_guid': GUID, 'telem_category': telem_category, 'data': data}
|
telemetry = {'monkey_guid': GUID, 'telem_category': telem_category, 'data': data}
|
||||||
requests.post("https://%s/api/telemetry" % (WormConfiguration.current_server,),
|
requests.post("https://%s/api/telemetry" % (WormConfiguration.current_server,), # noqa: DUO123
|
||||||
data=json.dumps(telemetry),
|
data=json.dumps(telemetry),
|
||||||
headers={'content-type': 'application/json'},
|
headers={'content-type': 'application/json'},
|
||||||
verify=False,
|
verify=False,
|
||||||
|
@ -144,7 +144,7 @@ class ControlClient(object):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
telemetry = {'monkey_guid': GUID, 'log': json.dumps(log)}
|
telemetry = {'monkey_guid': GUID, 'log': json.dumps(log)}
|
||||||
requests.post("https://%s/api/log" % (WormConfiguration.current_server,),
|
requests.post("https://%s/api/log" % (WormConfiguration.current_server,), # noqa: DUO123
|
||||||
data=json.dumps(telemetry),
|
data=json.dumps(telemetry),
|
||||||
headers={'content-type': 'application/json'},
|
headers={'content-type': 'application/json'},
|
||||||
verify=False,
|
verify=False,
|
||||||
|
@ -158,7 +158,7 @@ class ControlClient(object):
|
||||||
if not WormConfiguration.current_server:
|
if not WormConfiguration.current_server:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
reply = requests.get("https://%s/api/monkey/%s" % (WormConfiguration.current_server, GUID),
|
reply = requests.get("https://%s/api/monkey/%s" % (WormConfiguration.current_server, GUID), # noqa: DUO123
|
||||||
verify=False,
|
verify=False,
|
||||||
proxies=ControlClient.proxies)
|
proxies=ControlClient.proxies)
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ class ControlClient(object):
|
||||||
if not WormConfiguration.current_server:
|
if not WormConfiguration.current_server:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
requests.patch("https://%s/api/monkey/%s" % (WormConfiguration.current_server, GUID),
|
requests.patch("https://%s/api/monkey/%s" % (WormConfiguration.current_server, GUID), # noqa: DUO123
|
||||||
data=json.dumps({'config_error': True}),
|
data=json.dumps({'config_error': True}),
|
||||||
headers={'content-type': 'application/json'},
|
headers={'content-type': 'application/json'},
|
||||||
verify=False,
|
verify=False,
|
||||||
|
@ -247,7 +247,7 @@ class ControlClient(object):
|
||||||
if (monkeyfs.isfile(dest_file)) and (size == monkeyfs.getsize(dest_file)):
|
if (monkeyfs.isfile(dest_file)) and (size == monkeyfs.getsize(dest_file)):
|
||||||
return dest_file
|
return dest_file
|
||||||
else:
|
else:
|
||||||
download = requests.get("https://%s/api/monkey/download/%s" %
|
download = requests.get("https://%s/api/monkey/download/%s" % # noqa: DUO123
|
||||||
(WormConfiguration.current_server, filename),
|
(WormConfiguration.current_server, filename),
|
||||||
verify=False,
|
verify=False,
|
||||||
proxies=ControlClient.proxies)
|
proxies=ControlClient.proxies)
|
||||||
|
@ -273,7 +273,7 @@ class ControlClient(object):
|
||||||
if not WormConfiguration.current_server:
|
if not WormConfiguration.current_server:
|
||||||
return None, None
|
return None, None
|
||||||
try:
|
try:
|
||||||
reply = requests.post("https://%s/api/monkey/download" % (WormConfiguration.current_server,),
|
reply = requests.post("https://%s/api/monkey/download" % (WormConfiguration.current_server,), # noqa: DUO123
|
||||||
data=json.dumps(host_dict),
|
data=json.dumps(host_dict),
|
||||||
headers={'content-type': 'application/json'},
|
headers={'content-type': 'application/json'},
|
||||||
verify=False, proxies=ControlClient.proxies)
|
verify=False, proxies=ControlClient.proxies)
|
||||||
|
@ -315,7 +315,7 @@ class ControlClient(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_pba_file(filename):
|
def get_pba_file(filename):
|
||||||
try:
|
try:
|
||||||
return requests.get(PBA_FILE_DOWNLOAD %
|
return requests.get(PBA_FILE_DOWNLOAD % # noqa: DUO123
|
||||||
(WormConfiguration.current_server, filename),
|
(WormConfiguration.current_server, filename),
|
||||||
verify=False,
|
verify=False,
|
||||||
proxies=ControlClient.proxies)
|
proxies=ControlClient.proxies)
|
||||||
|
|
|
@ -172,10 +172,13 @@ class ShellShockExploiter(HostExploiter):
|
||||||
LOG.info("File %s exists on remote host" % file_path)
|
LOG.info("File %s exists on remote host" % file_path)
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
def attempt_exploit(self, url, attacks=_attacks):
|
def attempt_exploit(self, url, attacks=None):
|
||||||
# Flag used to identify whether the exploit has successfully caused the
|
# Flag used to identify whether the exploit has successfully caused the
|
||||||
# server to return a useful response
|
# server to return a useful response
|
||||||
|
|
||||||
|
if not attacks:
|
||||||
|
attacks = self._attacks
|
||||||
|
|
||||||
LOG.debug("Attack Flag is: %s" % self.success_flag)
|
LOG.debug("Attack Flag is: %s" % self.success_flag)
|
||||||
|
|
||||||
LOG.debug("Trying exploit for %s" % url)
|
LOG.debug("Trying exploit for %s" % url)
|
||||||
|
@ -206,7 +209,7 @@ class ShellShockExploiter(HostExploiter):
|
||||||
try:
|
try:
|
||||||
LOG.debug("Header is: %s" % header)
|
LOG.debug("Header is: %s" % header)
|
||||||
LOG.debug("Attack is: %s" % attack)
|
LOG.debug("Attack is: %s" % attack)
|
||||||
r = requests.get(url, headers={header: attack}, verify=False, timeout=TIMEOUT)
|
r = requests.get(url, headers={header: attack}, verify=False, timeout=TIMEOUT) # noqa: DUO123
|
||||||
result = r.content.decode()
|
result = r.content.decode()
|
||||||
return result
|
return result
|
||||||
except requests.exceptions.RequestException as exc:
|
except requests.exceptions.RequestException as exc:
|
||||||
|
@ -229,7 +232,7 @@ class ShellShockExploiter(HostExploiter):
|
||||||
attack_urls = [attack_path + url for url in url_list]
|
attack_urls = [attack_path + url for url in url_list]
|
||||||
for u in attack_urls:
|
for u in attack_urls:
|
||||||
try:
|
try:
|
||||||
reqs.append(requests.head(u, verify=False, timeout=TIMEOUT))
|
reqs.append(requests.head(u, verify=False, timeout=TIMEOUT)) # noqa: DUO123
|
||||||
except requests.Timeout:
|
except requests.Timeout:
|
||||||
timeout = True
|
timeout = True
|
||||||
break
|
break
|
||||||
|
|
|
@ -80,7 +80,7 @@ class WebLogic201710271(WebRCE):
|
||||||
else:
|
else:
|
||||||
payload = self.get_exploit_payload('cmd', '/c', command + ' 1> NUL 2> NUL')
|
payload = self.get_exploit_payload('cmd', '/c', command + ' 1> NUL 2> NUL')
|
||||||
try:
|
try:
|
||||||
post(url, data=payload, headers=HEADERS, timeout=EXECUTION_TIMEOUT, verify=False)
|
post(url, data=payload, headers=HEADERS, timeout=EXECUTION_TIMEOUT, verify=False) # noqa: DUO123
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error("Connection error: %s" % e)
|
LOG.error("Connection error: %s" % e)
|
||||||
return False
|
return False
|
||||||
|
@ -116,7 +116,7 @@ class WebLogic201710271(WebRCE):
|
||||||
def check_if_exploitable_weblogic(self, url, httpd):
|
def check_if_exploitable_weblogic(self, url, httpd):
|
||||||
payload = self.get_test_payload(ip=httpd.local_ip, port=httpd.local_port)
|
payload = self.get_test_payload(ip=httpd.local_ip, port=httpd.local_port)
|
||||||
try:
|
try:
|
||||||
post(url, data=payload, headers=HEADERS, timeout=REQUEST_DELAY, verify=False)
|
post(url, data=payload, headers=HEADERS, timeout=REQUEST_DELAY, verify=False) # noqa: DUO123
|
||||||
except exceptions.ReadTimeout:
|
except exceptions.ReadTimeout:
|
||||||
# Our request will not get response thus we get ReadTimeout error
|
# Our request will not get response thus we get ReadTimeout error
|
||||||
pass
|
pass
|
||||||
|
@ -299,7 +299,7 @@ class WebLogic20192725(WebRCE):
|
||||||
:return: Formatted payload
|
:return: Formatted payload
|
||||||
"""
|
"""
|
||||||
empty_payload = '''
|
empty_payload = '''
|
||||||
<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"
|
<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"
|
||||||
xmlns:wsa=\"http://www.w3.org/2005/08/addressing\" xmlns:asy=\"http://www.bea.com/async/AsyncResponseService\">
|
xmlns:wsa=\"http://www.w3.org/2005/08/addressing\" xmlns:asy=\"http://www.bea.com/async/AsyncResponseService\">
|
||||||
<soapenv:Header>
|
<soapenv:Header>
|
||||||
<wsa:Action>xx</wsa:Action>
|
<wsa:Action>xx</wsa:Action>
|
||||||
|
|
|
@ -2,7 +2,6 @@ from abc import ABCMeta, abstractmethod
|
||||||
|
|
||||||
|
|
||||||
class HostScanner(metaclass=ABCMeta):
|
class HostScanner(metaclass=ABCMeta):
|
||||||
@property
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def is_host_alive(self, host):
|
def is_host_alive(self, host):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
|
@ -32,7 +32,7 @@ class HTTPFinger(HostFinger):
|
||||||
# try http, we don't optimise for 443
|
# try http, we don't optimise for 443
|
||||||
for url in (https, http): # start with https and downgrade
|
for url in (https, http): # start with https and downgrade
|
||||||
try:
|
try:
|
||||||
with closing(head(url, verify=False, timeout=1)) as req:
|
with closing(head(url, verify=False, timeout=1)) as req: # noqa: DUO123
|
||||||
server = req.headers.get('Server')
|
server = req.headers.get('Server')
|
||||||
ssl = True if 'https://' in url else False
|
ssl = True if 'https://' in url else False
|
||||||
self.init_service(host.services, ('tcp-' + port[1]), port[0])
|
self.init_service(host.services, ('tcp-' + port[1]), port[0])
|
||||||
|
|
|
@ -51,15 +51,18 @@ if is_windows_os():
|
||||||
local_hostname = socket.gethostname()
|
local_hostname = socket.gethostname()
|
||||||
return socket.gethostbyname_ex(local_hostname)[2]
|
return socket.gethostbyname_ex(local_hostname)[2]
|
||||||
|
|
||||||
|
|
||||||
def get_routes():
|
def get_routes():
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
else:
|
else:
|
||||||
from fcntl import ioctl
|
from fcntl import ioctl
|
||||||
|
|
||||||
|
|
||||||
def local_ips():
|
def local_ips():
|
||||||
valid_ips = [network['addr'] for network in get_host_subnets()]
|
valid_ips = [network['addr'] for network in get_host_subnets()]
|
||||||
return valid_ips
|
return valid_ips
|
||||||
|
|
||||||
|
|
||||||
def get_routes(): # based on scapy implementation for route parsing
|
def get_routes(): # based on scapy implementation for route parsing
|
||||||
try:
|
try:
|
||||||
f = open("/proc/net/route", "r")
|
f = open("/proc/net/route", "r")
|
||||||
|
@ -125,7 +128,7 @@ def check_internet_access(services):
|
||||||
"""
|
"""
|
||||||
for host in services:
|
for host in services:
|
||||||
try:
|
try:
|
||||||
requests.get("https://%s" % (host,), timeout=TIMEOUT, verify=False)
|
requests.get("https://%s" % (host,), timeout=TIMEOUT, verify=False) # noqa: DUO123
|
||||||
return True
|
return True
|
||||||
except ConnectionError:
|
except ConnectionError:
|
||||||
# Failed connecting
|
# Failed connecting
|
||||||
|
|
|
@ -308,4 +308,4 @@ def get_interface_to_target(dst):
|
||||||
return None
|
return None
|
||||||
paths.sort()
|
paths.sort()
|
||||||
ret = paths[-1][1]
|
ret = paths[-1][1]
|
||||||
return ret[1]
|
return ret[1]
|
||||||
|
|
|
@ -3,11 +3,15 @@ import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.coinit_flags = 0 # needed for proper destruction of the wmi python module
|
sys.coinit_flags = 0 # needed for proper destruction of the wmi python module
|
||||||
|
# noinspection PyPep8
|
||||||
import infection_monkey.config
|
import infection_monkey.config
|
||||||
|
# noinspection PyPep8
|
||||||
from infection_monkey.system_info.mimikatz_collector import MimikatzCollector
|
from infection_monkey.system_info.mimikatz_collector import MimikatzCollector
|
||||||
|
# noinspection PyPep8
|
||||||
from infection_monkey.system_info import InfoCollector
|
from infection_monkey.system_info import InfoCollector
|
||||||
|
# noinspection PyPep8
|
||||||
from infection_monkey.system_info.wmi_consts import WMI_CLASSES
|
from infection_monkey.system_info.wmi_consts import WMI_CLASSES
|
||||||
|
# noinspection PyPep8
|
||||||
from common.utils.wmi_utils import WMIUtils
|
from common.utils.wmi_utils import WMIUtils
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
|
@ -61,8 +61,8 @@ class TcpProxy(TransportProxyBase):
|
||||||
except socket.timeout:
|
except socket.timeout:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
dest = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
try:
|
try:
|
||||||
dest = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
||||||
dest.connect((self.dest_host, self.dest_port))
|
dest.connect((self.dest_host, self.dest_port))
|
||||||
except socket.error as ex:
|
except socket.error as ex:
|
||||||
source.close()
|
source.close()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import TestPlugin
|
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import TestPlugin # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
class SomeDummyPlugin:
|
class SomeDummyPlugin:
|
||||||
|
|
|
@ -17,7 +17,7 @@ class SegmentationFinding(Finding):
|
||||||
"""
|
"""
|
||||||
Creates a segmentation finding. If a segmentation finding with the relevant subnets already exists, adds the
|
Creates a segmentation finding. If a segmentation finding with the relevant subnets already exists, adds the
|
||||||
event to the existing finding, and the "worst" status is chosen (i.e. if the existing one is "Failed" it will
|
event to the existing finding, and the "worst" status is chosen (i.e. if the existing one is "Failed" it will
|
||||||
remain so).
|
remain so).
|
||||||
|
|
||||||
:param subnets: the 2 subnets of this finding.
|
:param subnets: the 2 subnets of this finding.
|
||||||
:param status: STATUS_PASSED or STATUS_FAILED
|
:param status: STATUS_PASSED or STATUS_FAILED
|
||||||
|
|
|
@ -26,9 +26,9 @@ class AttackConfig(object):
|
||||||
:return: Technique object or None if technique is not found
|
:return: Technique object or None if technique is not found
|
||||||
"""
|
"""
|
||||||
attack_config = AttackConfig.get_config()
|
attack_config = AttackConfig.get_config()
|
||||||
for key, attack_type in list(attack_config['properties'].items()):
|
for config_key, attack_type in list(attack_config['properties'].items()):
|
||||||
for key, technique in list(attack_type['properties'].items()):
|
for type_key, technique in list(attack_type['properties'].items()):
|
||||||
if key == technique_id:
|
if type_key == technique_id:
|
||||||
return technique
|
return technique
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,9 @@ def safe_process_telemetry(processing_function, telemetry_json):
|
||||||
try:
|
try:
|
||||||
processing_function(telemetry_json)
|
processing_function(telemetry_json)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.error("Error while in {} stage of processing telemetry.".format(processing_function.func_name),
|
logger.error(
|
||||||
exc_info=True)
|
"Error {} while in {} stage of processing telemetry.".format(str(err), processing_function.func_name),
|
||||||
|
exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
def process_ssh_info(telemetry_json):
|
def process_ssh_info(telemetry_json):
|
||||||
|
|
Loading…
Reference in New Issue