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