zaws 0.0.5 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.travis.yml +9 -18
- data/Gemfile +0 -0
- data/Gemfile.lock +26 -35
- data/Gemfile.lock.linux +69 -0
- data/Gemfile.lock.mac +81 -0
- data/Gemfile.lock.windows +77 -0
- data/LICENSE +0 -0
- data/README.md +11 -0
- data/Rakefile +1 -7
- data/archive/cloud_trail/cloud_trail.feature +124 -0
- data/bin/win_zaws.bat +2 -0
- data/lib/zaws.rb +54 -41
- data/lib/zaws/command/ai.rb +34 -0
- data/lib/zaws/command/bucket.rb +35 -0
- data/lib/zaws/command/cloud_trail.rb +43 -0
- data/lib/zaws/command/compute.rb +152 -87
- data/lib/zaws/command/config.rb +42 -0
- data/lib/zaws/command/elasticip.rb +19 -9
- data/lib/zaws/command/hosted_zone.rb +31 -18
- data/lib/zaws/command/iam.rb +37 -0
- data/lib/zaws/command/load_balancer.rb +54 -51
- data/lib/zaws/command/nessus.rb +41 -0
- data/lib/zaws/command/newrelic.rb +30 -0
- data/lib/zaws/command/route_table.rb +135 -122
- data/lib/zaws/command/security_group.rb +95 -82
- data/lib/zaws/command/subnet.rb +58 -46
- data/lib/zaws/command/sumo.rb +34 -0
- data/lib/zaws/command/vpc.rb +53 -0
- data/lib/zaws/external/awscli/awscli.rb +65 -0
- data/lib/zaws/external/awscli/commands.rb +10 -0
- data/lib/zaws/external/awscli/commands/aws.rb +40 -0
- data/lib/zaws/external/awscli/commands/ec2.rb +74 -0
- data/lib/zaws/external/awscli/commands/ec2/allocate_address.rb +42 -0
- data/lib/zaws/external/awscli/commands/ec2/assign_private_ip_addresses.rb +49 -0
- data/lib/zaws/external/awscli/commands/ec2/associate_address.rb +48 -0
- data/lib/zaws/external/awscli/commands/ec2/associate_route_table.rb +48 -0
- data/lib/zaws/external/awscli/commands/ec2/authorize_security_group_ingress.rb +70 -0
- data/lib/zaws/external/awscli/commands/ec2/create_route.rb +60 -0
- data/lib/zaws/external/awscli/commands/ec2/create_route_table.rb +40 -0
- data/lib/zaws/external/awscli/commands/ec2/create_security_group.rb +58 -0
- data/lib/zaws/external/awscli/commands/ec2/create_subnet.rb +62 -0
- data/lib/zaws/external/awscli/commands/ec2/create_tags.rb +53 -0
- data/lib/zaws/external/awscli/commands/ec2/create_vpc.rb +21 -0
- data/lib/zaws/external/awscli/commands/ec2/delete_route.rb +54 -0
- data/lib/zaws/external/awscli/commands/ec2/delete_route_table.rb +46 -0
- data/lib/zaws/external/awscli/commands/ec2/delete_security_group.rb +46 -0
- data/lib/zaws/external/awscli/commands/ec2/delete_subnet.rb +46 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_addresses.rb +41 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_images.rb +58 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_instances.rb +56 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_route_tables.rb +44 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_security_groups.rb +50 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_subnets.rb +48 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_vpc_peering_connections.rb +23 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_vpcs.rb +26 -0
- data/lib/zaws/external/awscli/commands/ec2/disable_vgw_route_propagation.rb +48 -0
- data/lib/zaws/external/awscli/commands/ec2/disassociate-address.rb +42 -0
- data/lib/zaws/external/awscli/commands/ec2/disassociate_route_table.rb +41 -0
- data/lib/zaws/external/awscli/commands/ec2/enable_vgw_route_propagation.rb +48 -0
- data/lib/zaws/external/awscli/commands/ec2/filter.rb +115 -0
- data/lib/zaws/external/awscli/commands/ec2/modify_instance_attribute.rb +62 -0
- data/lib/zaws/external/awscli/commands/ec2/network_interfaces.rb +63 -0
- data/lib/zaws/external/awscli/commands/ec2/release_address.rb +42 -0
- data/lib/zaws/external/awscli/commands/ec2/revoke_security_group_ingress.rb +70 -0
- data/lib/zaws/external/awscli/commands/ec2/run_instances.rb +21 -0
- data/lib/zaws/external/awscli/commands/ec2/stop_instances.rb +21 -0
- data/lib/zaws/external/awscli/commands/ec2/terminate_instances.rb +40 -0
- data/lib/zaws/external/awscli/commands/ec2/unassign_private_ip_addresses.rb +49 -0
- data/lib/zaws/external/awscli/commands/elb.rb +19 -0
- data/lib/zaws/external/awscli/commands/elb/create_load_balancer.rb +64 -0
- data/lib/zaws/external/awscli/commands/elb/create_load_balancer_listeners.rb +47 -0
- data/lib/zaws/external/awscli/commands/elb/delete_load_balancer.rb +40 -0
- data/lib/zaws/external/awscli/commands/elb/delete_load_balancer_listeners.rb +49 -0
- data/lib/zaws/external/awscli/commands/elb/deregister_instances_with_load_balancer.rb +49 -0
- data/lib/zaws/external/awscli/commands/elb/describe_load_balancers.rb +30 -0
- data/lib/zaws/external/awscli/commands/elb/register_instances_with_load_balancer.rb +49 -0
- data/lib/zaws/external/awscli/commands/iam.rb +31 -0
- data/lib/zaws/external/awscli/commands/iam/GetPolicy.rb +21 -0
- data/lib/zaws/external/awscli/commands/iam/GetPolicyVersion.rb +21 -0
- data/lib/zaws/external/awscli/commands/iam/GetRolePolicy.rb +21 -0
- data/lib/zaws/external/awscli/commands/route53.rb +19 -0
- data/lib/zaws/external/awscli/commands/route53/list_hosted_zones.rb +30 -0
- data/lib/zaws/external/awscli/commands/route53/list_resource_record_sets.rb +41 -0
- data/lib/zaws/external/awscli/commands/s3/ls.rb +34 -0
- data/lib/zaws/external/awscli/commands/s3/mb.rb +41 -0
- data/lib/zaws/external/awscli/commands/s3/sync.rb +48 -0
- data/lib/zaws/external/awscli/credentials.rb +22 -0
- data/lib/zaws/external/awscli/data.rb +10 -0
- data/lib/zaws/external/awscli/data/ec2.rb +33 -0
- data/lib/zaws/external/awscli/data/ec2/instance.rb +162 -0
- data/lib/zaws/external/awscli/data/ec2/security_group.rb +51 -0
- data/lib/zaws/external/awscli/data/ec2/subnet.rb +59 -0
- data/lib/zaws/external/awscli/data/ec2/vpc.rb +85 -0
- data/lib/zaws/external/awscli/data/iam.rb +34 -0
- data/lib/zaws/external/awscli/data/iam/policy.rb +42 -0
- data/lib/zaws/external/awscli/data/iam/policy_document.rb +52 -0
- data/lib/zaws/external/awscli/data/iam/policy_version.rb +42 -0
- data/lib/zaws/external/awscli/data/iam/role_policy.rb +52 -0
- data/lib/zaws/external/awscli/generators/result/ec2/addresses.rb +70 -0
- data/lib/zaws/external/awscli/generators/result/ec2/allocation_id.rb +39 -0
- data/lib/zaws/external/awscli/generators/result/ec2/association_id.rb +29 -0
- data/lib/zaws/external/awscli/generators/result/ec2/images.rb +46 -0
- data/lib/zaws/external/awscli/generators/result/ec2/instances.rb +57 -0
- data/lib/zaws/external/awscli/generators/result/ec2/ip_permissions.rb +70 -0
- data/lib/zaws/external/awscli/generators/result/ec2/network_interfaces.rb +53 -0
- data/lib/zaws/external/awscli/generators/result/ec2/private_ip_addresses.rb +41 -0
- data/lib/zaws/external/awscli/generators/result/ec2/route_tables.rb +80 -0
- data/lib/zaws/external/awscli/generators/result/ec2/routes.rb +58 -0
- data/lib/zaws/external/awscli/generators/result/ec2/security_groups.rb +73 -0
- data/lib/zaws/external/awscli/generators/result/ec2/subnets.rb +88 -0
- data/lib/zaws/external/awscli/generators/result/ec2/tags.rb +34 -0
- data/lib/zaws/external/awscli/generators/result/ec2/virtual_gateway.rb +32 -0
- data/lib/zaws/external/awscli/generators/result/elb/listeners.rb +65 -0
- data/lib/zaws/external/awscli/generators/result/elb/load_balancers.rb +61 -0
- data/lib/zaws/external/awscli/generators/result/route53/hosted_zones.rb +52 -0
- data/lib/zaws/external/awscli/regions.rb +13 -0
- data/lib/zaws/external/nessusapi/data/agents.rb +36 -0
- data/lib/zaws/external/nessusapi/data/scanners.rb +35 -0
- data/lib/zaws/external/nessusapi/nessusapi.rb +57 -0
- data/lib/zaws/external/nessusapi/reources.rb +10 -0
- data/lib/zaws/external/nessusapi/resources/agents.rb +18 -0
- data/lib/zaws/external/nessusapi/resources/agents/list.rb +20 -0
- data/lib/zaws/external/nessusapi/resources/scanners.rb +18 -0
- data/lib/zaws/external/nessusapi/resources/scanners/list.rb +20 -0
- data/lib/zaws/external/newrelicapi/data/servers.rb +36 -0
- data/lib/zaws/external/newrelicapi/newrelic_client.rb +64 -0
- data/lib/zaws/external/newrelicapi/newrelic_creds.rb +60 -0
- data/lib/zaws/external/newrelicapi/newrelicapi.rb +46 -0
- data/lib/zaws/external/newrelicapi/resources/servers.rb +18 -0
- data/lib/zaws/external/newrelicapi/resources/servers/list.rb +20 -0
- data/lib/zaws/external/sumoapi/data/collectors.rb +35 -0
- data/lib/zaws/external/sumoapi/data/sources.rb +35 -0
- data/lib/zaws/external/sumoapi/resources/collectors.rb +18 -0
- data/lib/zaws/external/sumoapi/resources/collectors/list.rb +20 -0
- data/lib/zaws/external/sumoapi/resources/sources.rb +18 -0
- data/lib/zaws/external/sumoapi/resources/sources/list.rb +20 -0
- data/lib/zaws/external/sumoapi/sumo_client.rb +63 -0
- data/lib/zaws/external/sumoapi/sumo_creds.rb +67 -0
- data/lib/zaws/external/sumoapi/sumoapi.rb +56 -0
- data/lib/zaws/helper/data_lattice.rb +22 -0
- data/lib/zaws/helper/filestore.rb +48 -0
- data/lib/zaws/helper/filter.rb +15 -0
- data/lib/zaws/helper/inifile.rb +632 -0
- data/lib/zaws/helper/nessus_client.rb +143 -0
- data/lib/zaws/helper/nessus_creds.rb +67 -0
- data/lib/zaws/helper/option.rb +14 -15
- data/lib/zaws/helper/output.rb +81 -29
- data/lib/zaws/helper/process_hash.rb +47 -0
- data/lib/zaws/helper/shell.rb +0 -0
- data/lib/zaws/helper/verbose.rb +15 -0
- data/lib/zaws/helper/zfile.rb +8 -8
- data/lib/zaws/services/ai.rb +35 -0
- data/lib/zaws/services/ai/query.rb +135 -0
- data/lib/zaws/services/aws.rb +41 -0
- data/lib/zaws/services/chef.rb +0 -0
- data/lib/zaws/services/cloud_trail.rb +76 -0
- data/lib/zaws/services/config.rb +31 -0
- data/lib/zaws/services/ec2.rb +47 -0
- data/lib/zaws/services/ec2/compute.rb +352 -0
- data/lib/zaws/services/ec2/elasticip.rb +82 -0
- data/lib/zaws/services/ec2/route_table.rb +210 -0
- data/lib/zaws/services/ec2/security_group.rb +186 -0
- data/lib/zaws/services/ec2/subnet.rb +111 -0
- data/lib/zaws/services/ec2/vpc.rb +69 -0
- data/lib/zaws/{elb.rb → services/elb.rb} +3 -2
- data/lib/zaws/services/elb/load_balancer.rb +160 -0
- data/lib/zaws/services/iam.rb +25 -0
- data/lib/zaws/services/iam/policy.rb +25 -0
- data/lib/zaws/services/iam/role.rb +23 -0
- data/lib/zaws/services/nessus.rb +24 -0
- data/lib/zaws/services/nessus/agents.rb +19 -0
- data/lib/zaws/services/nessus/scanners.rb +19 -0
- data/lib/zaws/services/newrelic.rb +21 -0
- data/lib/zaws/services/newrelic/servers.rb +19 -0
- data/lib/zaws/{route53.rb → services/route53.rb} +1 -1
- data/lib/zaws/services/route53/hosted_zone.rb +36 -0
- data/lib/zaws/services/s3.rb +15 -0
- data/lib/zaws/services/s3/bucket.rb +42 -0
- data/lib/zaws/services/sumo.rb +21 -0
- data/lib/zaws/services/sumo/collectors.rb +19 -0
- data/lib/zaws/services/vmware.rb +0 -0
- data/lib/zaws/version.rb +1 -1
- data/shove_all.sh +6 -0
- data/shove_all_mac.sh +6 -0
- data/shove_all_windows.sh +6 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/zaws/command/ec2/compute/assoc_security_group_spec.rb +135 -0
- data/spec/zaws/command/ec2/compute/compute_spec.rb +321 -0
- data/spec/zaws/command/ec2/compute/images_spec.rb +69 -0
- data/spec/zaws/command/ec2/compute/management_spec.rb +364 -0
- data/spec/zaws/command/ec2/compute/network_spec.rb +93 -0
- data/spec/zaws/command/ec2/compute/node_spec.rb +70 -0
- data/spec/zaws/command/ec2/compute/secondary_ip_spec.rb +212 -0
- data/spec/zaws/command/ec2/compute/storage_spec.rb +63 -0
- data/spec/zaws/command/ec2/elasticip_spec.rb +271 -0
- data/spec/zaws/command/ec2/route_table_spec.rb +844 -0
- data/spec/zaws/command/ec2/security_group_spec.rb +710 -0
- data/spec/zaws/command/ec2/subnet_spec.rb +273 -0
- data/spec/zaws/command/ec2/vpc_spec.rb +180 -0
- data/spec/zaws/command/elb/load_balancer_spec.rb +633 -0
- data/spec/zaws/command/iam/policy_spec.rb +101 -0
- data/spec/zaws/command/iam/role_policy_spec.rb +35 -0
- data/spec/zaws/command/route53/hosted_zone_spec.rb +100 -0
- data/spec/zaws/command/s3/bucket_spec.rb +70 -0
- data/spec/zaws/external/awscli/data/ec2/instance_spec.rb +90 -0
- data/spec/zaws/external/awscli/data/iam/policy_document_spec.rb +56 -0
- data/spec/zaws/external/awscli/data/iam/role_policy_spec.rb +54 -0
- data/spec/zaws/external/awscli/get_aws_version_spec.rb +18 -0
- data/spec/zaws/helper/option_spec.rb +54 -0
- data/spec/zaws/helper/output_spec.rb +144 -0
- data/spec/zaws/helper/process_hash_spec.rb +48 -0
- data/spec/zaws/helper/shell_spec.rb +56 -0
- data/spec/zaws/nessus/scanners.json +0 -0
- data/spec/zaws/version_spec.rb +18 -0
- data/zaws.gemspec +1 -3
- metadata +260 -189
- data/feature/compute/assoc_security_group.feature +0 -55
- data/feature/compute/compute.feature +0 -138
- data/feature/compute/secondary_ip.feature +0 -107
- data/feature/compute/view.feature +0 -23
- data/feature/compute/view_images.feature +0 -24
- data/feature/elasticip/elasticip.feature +0 -138
- data/feature/elasticip/view.feature +0 -18
- data/feature/hosted_zone/view.feature +0 -17
- data/feature/hosted_zone/view_record.feature +0 -29
- data/feature/load_balancer/instance_registration.feature +0 -120
- data/feature/load_balancer/listener.feature +0 -86
- data/feature/load_balancer/load_balancer.feature +0 -101
- data/feature/load_balancer/view.feature +0 -18
- data/feature/route_table/assoc_subnet.feature +0 -128
- data/feature/route_table/route_propagation.feature +0 -93
- data/feature/route_table/route_table.feature +0 -91
- data/feature/route_table/route_to_gateway.feature +0 -69
- data/feature/route_table/route_to_instance.feature +0 -115
- data/feature/route_table/view.feature +0 -25
- data/feature/security_group/ingress_cidr.feature +0 -144
- data/feature/security_group/ingress_group.feature +0 -184
- data/feature/security_group/security_group.feature +0 -107
- data/feature/security_group/view.feature +0 -23
- data/feature/subnet/subnet.feature +0 -94
- data/feature/subnet/view.feature +0 -24
- data/feature/support/env.rb +0 -14
- data/feature/version.feature +0 -6
- data/lib/zaws/aws.rb +0 -26
- data/lib/zaws/ec2.rb +0 -40
- data/lib/zaws/ec2/compute.rb +0 -247
- data/lib/zaws/ec2/elasticip.rb +0 -79
- data/lib/zaws/ec2/route_table.rb +0 -207
- data/lib/zaws/ec2/security_group.rb +0 -154
- data/lib/zaws/ec2/subnet.rb +0 -109
- data/lib/zaws/elb/load_balancer.rb +0 -157
- data/lib/zaws/route53/hosted_zone.rb +0 -36
- data/spec/zaws/ec2/compute/add_volume_spec.rb +0 -39
- data/spec/zaws/ec2/compute/block_device_mapping_spec.rb +0 -31
- data/spec/zaws/ec2/compute/instance_id_by_external_id_spec.rb +0 -23
- data/spec/zaws/ec2/compute/instance_ping_spec.rb +0 -34
- data/spec/zaws/ec2/compute/instance_running_spec.rb +0 -47
- data/spec/zaws/ec2/compute/network_interface_json_spec.rb +0 -57
- data/spec/zaws/ec2/compute/nosdcheck_spec.rb +0 -17
- data/spec/zaws/ec2/compute/tag_instance_spec.rb +0 -21
- data/spec/zaws/ec2/security_group/id_by_name_spec.rb +0 -32
- data/spec/zaws/ec2/subnet/available_spec.rb +0 -22
- data/spec/zaws/ec2/subnet/declare_spec.rb +0 -31
- data/spec/zaws/ec2/subnet/exists_spec.rb +0 -33
- data/spec/zaws/ec2/subnet/id_array_by_cidrblock_array_spec.rb +0 -48
- data/spec/zaws/ec2/subnet/id_by_cidrblock_spec.rb +0 -35
- data/spec/zaws/ec2/subnet/id_by_ip_spec.rb +0 -42
- data/spec/zaws/ec2/subnet/view_spec.rb +0 -34
- data/spec/zaws/elb/load_balancer/calculated_listener_spec.rb +0 -18
- data/spec/zaws/helper/option/absent_spec.rb +0 -14
- data/spec/zaws/helper/option/exclusive_spec.rb +0 -14
- data/spec/zaws/helper/option/exists_spec.rb +0 -18
- data/spec/zaws/helper/option/minimum_spec.rb +0 -14
- data/spec/zaws/helper/output/binary_nagios_check_spec.rb +0 -19
- data/spec/zaws/helper/output/colorize_spec.rb +0 -30
- data/spec/zaws/helper/output/opt_exclusive_spec.rb +0 -14
- data/spec/zaws/helper/output/opt_minimum_spec.rb +0 -15
- data/spec/zaws/helper/output/opt_required_spec.rb +0 -12
- data/spec/zaws/helper/shell/cli_spec.rb +0 -33
- data/spec/zaws/helper/shell/if_then_spec.rb +0 -24
data/bin/win_zaws.bat
ADDED
data/lib/zaws.rb
CHANGED
@@ -1,56 +1,69 @@
|
|
1
|
-
require "zaws/version"
|
2
|
-
require "zaws/helper/option"
|
3
|
-
require "zaws/helper/output"
|
4
|
-
require "zaws/helper/shell"
|
5
|
-
require "zaws/helper/zfile"
|
6
|
-
require "zaws/command/subnet"
|
7
|
-
require "zaws/command/security_group"
|
8
|
-
require "zaws/command/route_table"
|
9
|
-
require "zaws/command/compute"
|
10
|
-
require "zaws/command/elasticip"
|
11
|
-
require "zaws/command/load_balancer"
|
12
|
-
require "zaws/command/hosted_zone"
|
13
|
-
require "zaws/aws"
|
14
|
-
require "zaws/ec2"
|
15
|
-
require "zaws/elb"
|
16
|
-
require "zaws/route53"
|
17
|
-
require "zaws/ec2/subnet"
|
18
|
-
require "zaws/ec2/security_group"
|
19
|
-
require "zaws/ec2/route_table"
|
20
|
-
require "zaws/ec2/compute"
|
21
|
-
require "zaws/ec2/elasticip"
|
22
|
-
require "zaws/elb/load_balancer"
|
23
|
-
require "zaws/route53/hosted_zone"
|
24
1
|
require "thor"
|
2
|
+
Dir["#{File.dirname(__FILE__)}/zaws/**/*.rb"].each { |item| load(item) }
|
25
3
|
|
26
4
|
module ZAWS
|
27
5
|
class ZAWSCLI < Thor
|
28
6
|
|
29
|
-
|
30
|
-
subcommand "subnet",ZAWS::Command::Subnet
|
7
|
+
attr_accessor :out
|
31
8
|
|
32
|
-
|
33
|
-
|
9
|
+
def initialize(*args)
|
10
|
+
super
|
11
|
+
@out = $stdout
|
12
|
+
end
|
34
13
|
|
35
|
-
|
36
|
-
|
14
|
+
desc "subnet", "ec2 subnet(s)"
|
15
|
+
subcommand "subnet", ZAWS::Command::Subnet
|
37
16
|
|
38
|
-
|
39
|
-
|
17
|
+
desc "security_group", "ec2 security group(s)"
|
18
|
+
subcommand "security_group", ZAWS::Command::Security_Group
|
40
19
|
|
41
|
-
|
42
|
-
|
20
|
+
desc "route_table", "ec2 route table(s)"
|
21
|
+
subcommand "route_table", ZAWS::Command::Route_Table
|
43
22
|
|
44
|
-
|
45
|
-
|
23
|
+
desc "compute", "ec2 compute instance(s)"
|
24
|
+
subcommand "compute", ZAWS::Command::Compute
|
46
25
|
|
47
|
-
|
48
|
-
|
26
|
+
desc "elasticip", "ec2 elasticip(s)"
|
27
|
+
subcommand "elasticip", ZAWS::Command::Elasticip
|
49
28
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
29
|
+
desc "load_balancer", "elb load balancer(s)"
|
30
|
+
subcommand "load_balancer", ZAWS::Command::Load_Balancer
|
31
|
+
|
32
|
+
desc "hosted_zone", "elb hosted_zone(s)"
|
33
|
+
subcommand "hosted_zone", ZAWS::Command::Hosted_Zone
|
34
|
+
|
35
|
+
desc "cloud_trail", "aws cloud trail"
|
36
|
+
subcommand "cloud_trail", ZAWS::Command::CloudTrail
|
37
|
+
|
38
|
+
desc "bucket", "S3 storage bucket(s)"
|
39
|
+
subcommand "bucket", ZAWS::Command::Bucket
|
40
|
+
|
41
|
+
desc "iam", "iam access control"
|
42
|
+
subcommand "iam", ZAWS::Command::IAM
|
43
|
+
|
44
|
+
desc "vpc", "virtual private cloud (or vpc)"
|
45
|
+
subcommand "vpc", ZAWS::Command::Vpc
|
46
|
+
|
47
|
+
desc "nessus", "tennable nessus"
|
48
|
+
subcommand "nessus", ZAWS::Command::Nessus
|
49
|
+
|
50
|
+
desc "ai", "artificial intelligence"
|
51
|
+
subcommand "ai", ZAWS::Command::Ai
|
52
|
+
|
53
|
+
desc "sumo", "sumologic"
|
54
|
+
subcommand "sumo", ZAWS::Command::Sumo
|
55
|
+
|
56
|
+
desc "newrelic", "newrelic"
|
57
|
+
subcommand "newrelic", ZAWS::Command::Newrelic
|
58
|
+
|
59
|
+
desc "config", "config"
|
60
|
+
subcommand "config", ZAWS::Command::Config
|
61
|
+
|
62
|
+
desc "version", "Get the version of the Zynx AWS Automation Tool."
|
63
|
+
|
64
|
+
def version
|
65
|
+
@out.puts "zaws version #{ZAWS::VERSION}"
|
66
|
+
end
|
54
67
|
|
55
68
|
end
|
56
69
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module ZAWS
|
4
|
+
module Command
|
5
|
+
class Ai < Thor
|
6
|
+
class_option :verbose, :type => :boolean, :desc => "Verbose outout", :aliases => :d, :default => false
|
7
|
+
|
8
|
+
attr_accessor :ai
|
9
|
+
attr_accessor :out
|
10
|
+
attr_accessor :print_exit_code
|
11
|
+
|
12
|
+
def initialize(*args)
|
13
|
+
super
|
14
|
+
shellout=ZAWS::Helper::Shell.new
|
15
|
+
nessusapi = ZAWS::Nessusapi.new(shellout)
|
16
|
+
sumoapi = ZAWS::Sumoapi.new(shellout)
|
17
|
+
newrelicapi = ZAWS::Newrelicapi.new(shellout)
|
18
|
+
awscli = ZAWS::AWSCLI.new(shellout)
|
19
|
+
@ai = ZAWS::Controllers::AI.new(shellout, nessusapi,sumoapi,newrelicapi,awscli)
|
20
|
+
@out = $stdout
|
21
|
+
@print_exit_code = false
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "query", "query"
|
25
|
+
option :home, :type => :string, :default => ENV['HOME'], :desc => 'Home directory location for credentials file'
|
26
|
+
def query(*value)
|
27
|
+
@ai.awscli.home=options[:home]
|
28
|
+
value = [value] if value.instance_of?(String)
|
29
|
+
@out.puts(@ai.query.all(options[:home], options[:verbose],value))
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module ZAWS
|
4
|
+
module Command
|
5
|
+
class Bucket < Thor
|
6
|
+
class_option :region, :type => :string, :desc => "AWS Region", :banner => "<region>", :aliases => :r, :required => true
|
7
|
+
|
8
|
+
attr_accessor :aws
|
9
|
+
attr_accessor :out
|
10
|
+
attr_accessor :print_exit_code
|
11
|
+
|
12
|
+
def initialize(*args)
|
13
|
+
super
|
14
|
+
shellout=ZAWS::Helper::Shell.new
|
15
|
+
awscli = ZAWS::AWSCLI.new(shellout)
|
16
|
+
@aws = ZAWS::AWS.new(shellout, awscli)
|
17
|
+
@out = $stdout
|
18
|
+
@print_exit_code = false
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "declare BUCKET_NAME", "declare an S3 bucket."
|
22
|
+
|
23
|
+
def declare(name)
|
24
|
+
@aws.s3.bucket.declare(name, options[:region], @out)
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "sync BUCKET_NAME[/PATH]", "download the contents of an S3 bucket."
|
28
|
+
option :dest, :type => :string, :desc => "directory to save to.", :aliases => :d
|
29
|
+
|
30
|
+
def sync(bucket_name)
|
31
|
+
@aws.s3.bucket.sync(options[:region], bucket_name, options[:dest])
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module ZAWS
|
4
|
+
module Command
|
5
|
+
class CloudTrail < Thor
|
6
|
+
class_option :region, :type => :string, :desc => "AWS Region", :banner => "<region>", :aliases => :r, :required => true
|
7
|
+
|
8
|
+
attr_accessor :aws
|
9
|
+
attr_accessor :out
|
10
|
+
attr_accessor :print_exit_code
|
11
|
+
|
12
|
+
def initialize(*args)
|
13
|
+
super
|
14
|
+
shellout=ZAWS::Helper::Shell.new
|
15
|
+
awscli = ZAWS::AWSCLI.new(shellout)
|
16
|
+
@aws = ZAWS::AWS.new(shellout,awscli)
|
17
|
+
@out = $stdout
|
18
|
+
@print_exit_code = false
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
desc "view","View a cloud trail"
|
23
|
+
option :trailName, :type => :string, :desc => "Name of the cloud trail to view", :aliases => :n
|
24
|
+
option :bucket, :type => :string, :desc => "Name of the bucket where the cloud trail is stored", :aliases => :b
|
25
|
+
option :raw, :type => :boolean, :desc => "Return the cloud trail in its raw, json format", :aliases => :w, :default => false
|
26
|
+
def view
|
27
|
+
if options[:bucket]
|
28
|
+
@aws.cloud_trail.get_cloud_trail_by_bucket(options[:region], options[:bucket], options[:raw], options[:verbose]?$stdout:nil)
|
29
|
+
else
|
30
|
+
@aws.cloud_trail.get_cloud_trail_by_name(options[:region], options[:trailName] ? options[:trailName] : 'default', options[:raw], options[:verbose]?@out:nil)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "declare TRAIL_NAME","Declare a cloud trail"
|
35
|
+
option :bucket, :type => :string, :desc => "Name of the bucket where the cloud trail is to be stored", :aliases => :b
|
36
|
+
def declare(name)
|
37
|
+
@aws.cloud_trail.declare(name,options[:region],options[:bucket] ? options[:bucket] : "zaws-cloudtrail-#{name}")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
|
data/lib/zaws/command/compute.rb
CHANGED
@@ -2,98 +2,163 @@ require 'thor'
|
|
2
2
|
|
3
3
|
module ZAWS
|
4
4
|
module Command
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
5
|
+
class Compute < Thor
|
6
|
+
class_option :region, :type => :string, :desc => "AWS Region", :banner => "<region>", :aliases => :r, :required => true
|
7
|
+
class_option :verbose, :type => :boolean, :desc => "Verbose outout", :aliases => :d, :default => false
|
8
|
+
|
9
|
+
attr_accessor :aws
|
10
|
+
attr_accessor :out
|
11
|
+
attr_accessor :print_exit_code
|
12
|
+
|
13
|
+
def initialize(*args)
|
14
|
+
super
|
15
|
+
shellout=ZAWS::Helper::Shell.new
|
16
|
+
awscli = ZAWS::AWSCLI.new(shellout,false)
|
17
|
+
@aws = ZAWS::AWS.new(shellout, awscli)
|
18
|
+
@out = $stdout
|
19
|
+
@print_exit_code = false
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "view", "View compute instances."
|
23
|
+
option :viewtype, :type => :string, :desc => "View type, json or table", :banner => "<viewtype>", :aliases => :w, :default => "table"
|
24
|
+
option :vpcid, :type => :string, :desc => "AWS VPC id", :banner => "<vpcid>", :aliases => :v, :default => nil
|
25
|
+
option :profile, :type => :string, :desc => "AWS Profile", :banner => "<profile>", :aliases => :p, :default => nil
|
26
|
+
option :home, :type => :string, :default => ENV['HOME'], :desc => 'Home directory location for credentials file'
|
27
|
+
def view
|
28
|
+
region =options[:region]
|
29
|
+
viewtype=options[:viewtype]
|
30
|
+
verbose=(options[:verbose] ? @out : nil)
|
31
|
+
vpcid=options[:vpcid]
|
32
|
+
profile=options[:profile]
|
33
|
+
home=options[:home]
|
34
|
+
@aws.ec2.compute.view(region, viewtype, @out, verbose, vpcid,nil, profile,home)
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "view_images", "View images, by default the images are owned by self (your account))."
|
38
|
+
option :viewtype, :type => :string, :desc => "View type, json or table", :banner => "<viewtype>", :aliases => :w, :default => "table"
|
19
39
|
option :owner, :type => :string, :desc => "filter by owner of the images", :banner => "<owner>", :aliases => :o, :default => "self"
|
20
|
-
option :imageid, :type => :string, :desc => "filter by owner of the images", :banner => "<imageid>", :aliases => :i, :default => nil
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
desc "exists_by_external_id EXTERNAL_ID","Determine if an instance exists by the instance's EXTERNAL_ID."
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
desc "declare EXTERNAL_ID IMAGE OWNER TYPE ROOT_SIZE ZONE KEY SECURITY_GROUP","Declare a compute instance."
|
35
|
-
option :vpcid, :type => :string, :desc => "AWS VPC id", :banner => "<vpcid>",
|
40
|
+
option :imageid, :type => :string, :desc => "filter by owner of the images", :banner => "<imageid>", :aliases => :i, :default => nil
|
41
|
+
|
42
|
+
def view_images
|
43
|
+
@aws.ec2.compute.view_images(options[:region], options[:viewtype], options[:owner], options[:imageid], @out, (options[:verbose] ? @out : nil))
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "exists_by_external_id EXTERNAL_ID", "Determine if an instance exists by the instance's EXTERNAL_ID."
|
47
|
+
option :vpcid, :type => :string, :desc => "AWS VPC id", :banner => "<vpcid>", :aliases => :v, :default => nil
|
48
|
+
|
49
|
+
def exists_by_external_id(externalid)
|
50
|
+
val, instance_id, sgroups=@aws.ec2.compute.exists(options[:region], @out, (options[:verbose] ? @out : nil), options[:vpcid], externalid)
|
51
|
+
return val
|
52
|
+
end
|
53
|
+
|
54
|
+
desc "declare EXTERNAL_ID IMAGE OWNER TYPE ROOT_SIZE ZONE KEY SECURITY_GROUP", "Declare a compute instance."
|
55
|
+
option :vpcid, :type => :string, :desc => "AWS VPC id", :banner => "<vpcid>", :aliases => :v, :default => nil
|
36
56
|
option :privateip, :type => :array, :desc => "array of private ip addresses, in vpc, each given a network interface", :banner => "<privateip>", :aliases => :p, :default => nil
|
37
57
|
option :optimized, :type => :string, :desc => "ebs optimized", :banner => "<optimized>", :aliases => :i, :default => false
|
38
|
-
|
39
|
-
option :clienttoken, :type => :string, :desc => "AWS VPC id", :banner => "<clienttoken>",
|
40
|
-
option :
|
41
|
-
|
58
|
+
option :apiterminate, :type => :string, :desc => "ebs optimized", :banner => "<apiterminate>", :aliases => :a, :default => false
|
59
|
+
option :clienttoken, :type => :string, :desc => "AWS VPC id", :banner => "<clienttoken>", :aliases => :c, :default => nil
|
60
|
+
option :check, :type => :boolean, :desc => "Returns a check result", :aliases => :n, :default => false
|
61
|
+
option :undofile, :type => :string, :desc => "File for undo commands", :banner => "<undofile>", :aliases => :f, :default => nil
|
42
62
|
option :nosdcheck, :type => :boolean, :desc => "No source dest check (primarily needed for NAT instances)", :banner => "<nosdcheck>", :aliases => :s, :default => false
|
43
63
|
option :skipruncheck, :type => :boolean, :desc => "Flag to skip the running check during testing.", :banner => "<skipruncheck>", :aliases => :r, :default => false
|
44
|
-
option :volume, :type => :string, :desc => "volume (ex: --volume /dev/sdf)", :banner => "<volume>"
|
45
|
-
option :volsize, :type => :string, :desc => "volsize", :banner => "<volsize>"
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
64
|
+
option :volume, :type => :string, :desc => "volume (ex: --volume /dev/sdf)", :banner => "<volume>"
|
65
|
+
option :volsize, :type => :string, :desc => "volsize", :banner => "<volsize>"
|
66
|
+
option :tenancy, :type => :string, :desc => "tenancy can be defualt|dedicated", :banner => "<tenancy>" #AWS defaults to "default" when not specified
|
67
|
+
option :profilename, :type => :string, :desc => "instance profile name", :banner => "<profilename>"
|
68
|
+
option :userdata, :type => :string, :desc => "instance userdata yml filename", :banner => "<userdata>"
|
69
|
+
def declare(externalid, image, owner, type, root, zone, key, sgroup)
|
70
|
+
val=@aws.ec2.compute.declare(externalid, image, owner, type, root, zone, key, sgroup, options[:privateip], options[:optimized], options[:apiterminate], options[:clienttoken], options[:region], @out, (options[:verbose] ? @out : nil), options[:vpcid], options[:check], options[:undofile], options[:nosdcheck], options[:skipruncheck], options[:volsize], options[:volume], options[:tenancy], options[:profilename], options[:userdata])
|
71
|
+
return val
|
72
|
+
end
|
73
|
+
|
74
|
+
desc "delete EXTERNAL_ID", "Delete the instance's an instance by EXTERNAL_ID, this only works if api termination is enabled."
|
75
|
+
option :vpcid, :type => :string, :desc => "AWS VPC id", :banner => "<vpcid>", :aliases => :v, :default => nil
|
76
|
+
|
77
|
+
def delete(externalid)
|
78
|
+
@aws.ec2.compute.delete(options[:region], @out, (options[:verbose] ? @out : nil), options[:vpcid], externalid)
|
79
|
+
end
|
80
|
+
|
81
|
+
desc "exists_security_group_assoc EXTERNAL_ID SECURITY_GROUP", "Determine if an instance with an EXTERNAL_ID is associated to a named SECURITY_GROUP."
|
82
|
+
option :vpcid, :type => :string, :desc => "AWS VPC id", :banner => "<vpcid>", :aliases => :v, :default => nil
|
83
|
+
|
84
|
+
def exists_security_group_assoc(externalid, security_group)
|
85
|
+
val, instancid, sgroupid=@aws.ec2.compute.exists_security_group_assoc(options[:region], @out, (options[:verbose] ? @out : nil), options[:vpcid], externalid, security_group)
|
86
|
+
end
|
87
|
+
|
88
|
+
desc "assoc_security_group EXTERNAL_ID SECURITY_GROUP", "Associate a named SECURITY_GROUP to an instance by the instance's EXTERNAL_ID."
|
89
|
+
option :vpcid, :type => :string, :desc => "AWS VPC id", :banner => "<vpcid>", :aliases => :v, :default => nil
|
90
|
+
|
91
|
+
def assoc_security_group(externalid, security_group)
|
92
|
+
@aws.ec2.compute.assoc_security_group(options[:region], @out, (options[:verbose] ? @out : nil), options[:vpcid], externalid, security_group)
|
93
|
+
end
|
94
|
+
|
95
|
+
desc "exists_secondary_ip EXTERNAL_ID IP", "Determine if a secondary IP exists by the instance's EXTERNAL_ID."
|
96
|
+
option :vpcid, :type => :string, :desc => "AWS VPC id", :banner => "<vpcid>", :aliases => :v, :default => nil
|
97
|
+
|
98
|
+
def exists_secondary_ip(externalid, ip)
|
99
|
+
val, compute_exists, netid=@aws.ec2.compute.exists_secondary_ip(options[:region], ip, @out, (options[:verbose] ? @out : nil), options[:vpcid], externalid)
|
100
|
+
end
|
101
|
+
|
102
|
+
desc "declare_secondary_ip EXTERNAL_ID IP", "Declare secondary IP for instance by the instance's EXTERNAL_ID."
|
103
|
+
option :vpcid, :type => :string, :desc => "AWS VPC id", :banner => "<vpcid>", :aliases => :v, :default => nil
|
104
|
+
option :check, :type => :boolean, :desc => "Returns a check result", :aliases => :n, :default => false
|
105
|
+
option :undofile, :type => :string, :desc => "File for undo commands", :banner => "<undofile>", :aliases => :f, :default => nil
|
106
|
+
|
107
|
+
def declare_secondary_ip(externalid, ip)
|
108
|
+
@aws.ec2.compute.declare_secondary_ip(options[:region], ip, @out, (options[:verbose] ? @out : nil), options[:vpcid], externalid, options[:check], options[:undofile])
|
109
|
+
end
|
110
|
+
|
111
|
+
desc "delete_secondary_ip EXTERNAL_ID IP", "Delete secondary IP for instance by the instance's EXTERNAL_ID."
|
112
|
+
option :vpcid, :type => :string, :desc => "AWS VPC id", :banner => "<vpcid>", :aliases => :v, :default => nil
|
113
|
+
|
114
|
+
def delete_secondary_ip(externalid, ip)
|
115
|
+
@aws.ec2.compute.delete_secondary_ip(options[:region], ip, @out, (options[:verbose] ? @out : nil), options[:vpcid], externalid)
|
116
|
+
end
|
117
|
+
|
118
|
+
desc "interval_eligible", "present a list of instances by name eligible for start stop"
|
119
|
+
option :policy_arn, :type => :string, :desc => "Policy Arn", :banner => "<policy>", :default => nil
|
120
|
+
|
121
|
+
def interval_eligible
|
122
|
+
@aws.ec2.compute.interval_eligible(options[:policy_arn], options[:region], @out, (options[:verbose] ? @out : nil))
|
123
|
+
end
|
124
|
+
|
125
|
+
desc "set_interval HOURS EMAIL", ""
|
126
|
+
option :name, :type => :string, :desc => "Name", :banner => "<role>", :default => nil
|
127
|
+
option :externalid, :type => :string, :desc => "Externalid", :banner => "<policy>", :default => nil
|
128
|
+
option :overridebasetime, :type => :string, :desc => "Override basetime for testing, it will be used instead of now", :banner => "<overridebasetime>", :default => nil
|
129
|
+
option :policy_arn, :type => :string, :desc => "Policy Arn", :banner => "<policy>", :default => nil
|
130
|
+
|
131
|
+
def set_interval(hours, email)
|
132
|
+
@aws.ec2.compute.set_interval(options[:policy_arn], options[:name], options[:externalid], hours, email, options[:region], @out, (options[:verbose] ? @out : nil), options[:overridebasetime])
|
133
|
+
end
|
134
|
+
|
135
|
+
desc "interval_cron POLICY_ARN", "This job will search through the hosts and stop and start hosts accourding to their interval tag setting"
|
136
|
+
option :policy_arn, :type => :string, :desc => "Policy Arn", :banner => "<policy>", :default => nil
|
137
|
+
option :overridebasetime, :type => :string, :desc => "Override basetime for testing, it will be used instead of now", :banner => "<overridebasetime>", :default => nil
|
138
|
+
|
139
|
+
def interval_cron()
|
140
|
+
@aws.ec2.compute.interval_cron(options[:policy_arn], options[:region], @out, (options[:verbose] ? @out : nil), options[:overridebasetime])
|
141
|
+
end
|
142
|
+
|
143
|
+
desc "start", "start instance specified"
|
144
|
+
option :name, :type => :string, :desc => "Name", :banner => "<role>", :default => nil
|
145
|
+
option :externalid, :type => :string, :desc => "Externalid", :banner => "<policy>", :default => nil
|
146
|
+
option :skipruncheck, :type => :boolean, :desc => "Flag to skip the running check during testing.", :banner => "<skipruncheck>", :aliases => :r, :default => false
|
147
|
+
|
148
|
+
def start()
|
149
|
+
@aws.ec2.compute.start(options[:name], options[:externalid], options[:region], @out, (options[:verbose] ? @out : nil), options[:skipruncheck])
|
150
|
+
end
|
151
|
+
|
152
|
+
desc "stop", "stop instance specified"
|
153
|
+
option :name, :type => :string, :desc => "Name", :banner => "<role>", :default => nil
|
154
|
+
option :externalid, :type => :string, :desc => "Externalid", :banner => "<policy>", :default => nil
|
155
|
+
option :skipruncheck, :type => :boolean, :desc => "Flag to skip the running check during testing.", :banner => "<skipruncheck>", :aliases => :r, :default => false
|
156
|
+
|
157
|
+
def stop()
|
158
|
+
@aws.ec2.compute.stop(options[:name], options[:externalid], options[:region], @out, (options[:verbose] ? @out : nil), options[:skipruncheck])
|
159
|
+
end
|
160
|
+
|
161
|
+
end
|
97
162
|
end
|
98
163
|
end
|
99
164
|
|