def __populate_web_services_for_network_service(self, network_service=None, user_string=None, count=1): """ Populate web services for the given network service. :param network_service: The network service to populate web services for. :param count: The number of web services to add to the network service. :param user_string: A string depicting the user that is being populated. :return: The list of newly-created web services. """ hostnames = set() while True: hostnames.add(WsFaker.get_domain_name()) if len(hostnames) == count: break new_services = [] for hostname in hostnames: new_web_service = network_service.web_services.create( ip_address=network_service.ip_address.address, port=network_service.port, host_name=hostname, ssl_enabled=RandomHelper.flip_coin(), ) self.__populate_web_service_scans_for_web_service( web_service=new_web_service, user_string=user_string) new_services.append(new_web_service) return new_services
def _populate_dummy(cls, to_populate): from lib import WsFaker, RandomHelper to_populate.domain_name = WsFaker.get_domain_name() to_populate.resolutions = WsFaker.get_domain_resolutions() to_populate.has_resolutions = RandomHelper.flip_coin() to_populate.subdomains = WsFaker.get_subdomains() to_populate.related_ips = WsFaker.get_domain_related_ips() return to_populate
def _populate_dummy(cls, to_populate): from lib import WsFaker, RandomHelper to_populate.response_code = WsFaker.get_http_response_status() to_populate.response_has_content = RandomHelper.flip_coin() to_populate.response_mime_type = WsFaker.get_mime_string() to_populate.response_primary_hash = WsFaker.get_sha256_string() to_populate.response_secondary_hash = WsFaker.get_sha256_string() to_populate.over_ssl = RandomHelper.flip_coin() to_populate.hostname = WsFaker.get_domain_name() return to_populate
def __populate_domain_names_for_organization(self, organization=None, user_string=None, count=3): """ Populate domain names for the given organization. :param organization: The organization to add domain names to. :param user_string: A string depicting the user to add domain names for. :param count: The number of domain names to add. :return: The newly-created domain names. """ domains = set() while True: domains.add(WsFaker.get_domain_name()) if len(domains) == count: break new_domains = [] for domain in domains: new_domain = organization.domain_names.create(name=domain, ) self.__populate_domain_name_scans_for_domain_name( domain_name=new_domain, user_string=user_string) new_domains.append(new_domain) return new_domains
def _populate_dummy(cls, to_populate): from lib import WsFaker, RandomHelper to_populate.cert_serial_number = ":".join(WsFaker.get_words()) to_populate.cert_version = WsFaker.get_random_int() to_populate.cert_has_start_time = RandomHelper.flip_coin() to_populate.cert_start_time = WsFaker.get_time_in_past() to_populate.cert_has_invalid_time = RandomHelper.flip_coin() to_populate.cert_invalid_time = WsFaker.get_time_in_future() to_populate.cert_expired = RandomHelper.flip_coin() to_populate.cert_md5_digest = WsFaker.get_sha256_string() to_populate.cert_sha1_digest = WsFaker.get_sha256_string() to_populate.cert_sha256_digest = WsFaker.get_sha256_string() to_populate.cert_sha512_digest = WsFaker.get_sha256_string() to_populate.cert_key_bits = WsFaker.get_random_int() to_populate.cert_key_type = "RSA" to_populate.cert_public_key = ".".join(WsFaker.get_words(200)) to_populate.cert_content = ".".join(WsFaker.get_words(200)) to_populate.cert_issuer_common_name = WsFaker.get_words(1)[0] to_populate.cert_issuer_country = WsFaker.get_words(1)[0] to_populate.cert_issuer_email = WsFaker.get_words(1)[0] to_populate.cert_issuer_hash = WsFaker.get_words(1)[0] to_populate.cert_issuer_locality = WsFaker.get_words(1)[0] to_populate.cert_issuer_organization = WsFaker.get_words(1)[0] to_populate.cert_issuer_organizational_unit = WsFaker.get_words(1)[0] to_populate.cert_issuer_state = WsFaker.get_words(1)[0] to_populate.cert_subject_common_name = WsFaker.get_domain_name() to_populate.cert_subject_country = WsFaker.get_words(1)[0] to_populate.cert_subject_email = WsFaker.get_words(1)[0] to_populate.cert_subject_hash = WsFaker.get_words(1)[0] to_populate.cert_subject_locality = WsFaker.get_words(1)[0] to_populate.cert_subject_organization = WsFaker.get_words(1)[0] to_populate.cert_subject_organizational_unit = WsFaker.get_words(1)[0] to_populate.cert_subject_state = WsFaker.get_words(1)[0] to_populate.cert_extension_names = WsFaker.get_words(5) to_populate.cert_has_authority_key_id = RandomHelper.flip_coin() to_populate.cert_authority_key_id = WsFaker.get_words(1)[0] to_populate.cert_has_subject_key_id = RandomHelper.flip_coin() to_populate.cert_subject_key_id = WsFaker.get_words(1)[0] to_populate.cert_has_extended_key_usage = RandomHelper.flip_coin() to_populate.cert_extended_key_usage = WsFaker.get_words(1)[0] to_populate.cert_has_certificate_policies = RandomHelper.flip_coin() to_populate.cert_certificate_policies = WsFaker.get_words(1)[0] to_populate.cert_has_crl_distribution_points = RandomHelper.flip_coin() to_populate.cert_crl_distribution_points = WsFaker.get_words(1)[0] to_populate.cert_has_subject_alt_name = RandomHelper.flip_coin() to_populate.cert_subject_alt_name = WsFaker.get_words(1)[0] to_populate.cert_has_authority_info_access = RandomHelper.flip_coin() to_populate.cert_authority_info_access = WsFaker.get_words(1)[0] to_populate.cert_is_valid = RandomHelper.flip_coin() to_populate.supports_fallback_scsv = RandomHelper.flip_coin() to_populate.is_vulnerable_to_heartbleed = RandomHelper.flip_coin() to_populate.is_vulnerable_to_ccs_injection = RandomHelper.flip_coin() to_populate.accepts_client_renegotiation = RandomHelper.flip_coin() to_populate.supports_secure_renegotiation = RandomHelper.flip_coin() to_populate.is_ticket_resumption_supported = RandomHelper.flip_coin() to_populate.supports_sslv3 = RandomHelper.flip_coin() to_populate.supports_tlsv1 = RandomHelper.flip_coin() to_populate.supports_tlsv1_1 = RandomHelper.flip_coin() to_populate.supports_tlsv1_2 = RandomHelper.flip_coin() to_populate.sslv3_preferred_cipher = WsFaker.get_words() to_populate.tlsv1_preferred_cipher = WsFaker.get_words() to_populate.tlsv1_1_preferred_cipher = WsFaker.get_words() to_populate.tlsv1_2_preferred_cipher = WsFaker.get_words() to_populate.sslv3_supported_ciphers = WsFaker.get_words() to_populate.tlsv1_supported_ciphers = WsFaker.get_words() to_populate.tlsv1_1_supported_ciphers = WsFaker.get_words() to_populate.tlsv1_2_supported_ciphers = WsFaker.get_words() to_populate.is_vulnerable = RandomHelper.flip_coin() to_populate.cert_is_trusted = RandomHelper.flip_coin() to_populate.scan_completed_at = WsFaker.get_time_in_past() to_populate.cert_extensions = WsFaker.get_certificate_extensions() to_populate.supports_sslv2 = RandomHelper.flip_coin() to_populate.sslv2_preferred_cipher = WsFaker.get_words() to_populate.sslv2_supported_ciphers = WsFaker.get_words() to_populate.heartbleed_test_errored = RandomHelper.flip_coin() to_populate.fallback_scsv_test_errored = RandomHelper.flip_coin() to_populate.ccs_injection_test_errored = RandomHelper.flip_coin() to_populate.session_renegotiation_test_errored = RandomHelper.flip_coin( ) to_populate.session_resumption_test_errored = RandomHelper.flip_coin() to_populate.cert_certificate_policy_oids = WsFaker.get_words() to_populate.cert_is_extended_validation = RandomHelper.flip_coin() return to_populate
def _populate_dummy(cls, to_populate): from lib import WsFaker, RandomHelper to_populate.uses_wordpress = RandomHelper.flip_coin() to_populate.uses_iss = RandomHelper.flip_coin() to_populate.uses_apache = RandomHelper.flip_coin() to_populate.uses_nginx = RandomHelper.flip_coin() to_populate.total_header_count = WsFaker.get_random_int(minimum=1, maximum=500) to_populate.unique_header_count = WsFaker.get_random_int(minimum=1, maximum=500) to_populate.server_headers = WsFaker.get_server_header_values() to_populate.transactions_count = WsFaker.get_random_int(minimum=1, maximum=500) to_populate.ok_count = WsFaker.get_random_int(minimum=1, maximum=500) to_populate.has_ok = to_populate.ok_count > 0 to_populate.redirect_count = WsFaker.get_random_int(minimum=1, maximum=500) to_populate.has_redirect = to_populate.redirect_count > 0 to_populate.client_error_count = WsFaker.get_random_int(minimum=1, maximum=500) to_populate.has_client_error = to_populate.client_error_count > 0 to_populate.server_error_count = WsFaker.get_random_int(minimum=1, maximum=500) to_populate.has_server_error = to_populate.server_error_count > 0 to_populate.total_resource_size = WsFaker.get_random_int( minimum=100000, maximum=500000) to_populate.uses_tomcat_management_portal = RandomHelper.flip_coin() to_populate.has_screenshots = RandomHelper.flip_coin() to_populate.screenshots_count = WsFaker.get_random_int(minimum=1, maximum=10) to_populate.main_screenshot_s3_bucket = WsFaker.get_s3_bucket() to_populate.main_screenshot_s3_key = WsFaker.get_s3_key() to_populate.response_count = WsFaker.get_random_int(minimum=1, maximum=10) to_populate.redirect_301_count = WsFaker.get_random_int(minimum=1, maximum=10) to_populate.redirect_302_count = WsFaker.get_random_int(minimum=1, maximum=10) to_populate.all_responses_redirects = RandomHelper.flip_coin() to_populate.all_responses_server_errors = RandomHelper.flip_coin() to_populate.all_responses_client_errors = RandomHelper.flip_coin() to_populate.response_statuses = WsFaker.get_http_response_statuses() to_populate.hostname_resolves = RandomHelper.flip_coin() to_populate.resolved_ip_matches_hostname = RandomHelper.flip_coin() to_populate.response_content_types = WsFaker.get_response_content_types( ) to_populate.www_authenticate_headers = WsFaker.get_words() to_populate.has_www_authenticate_headers = RandomHelper.flip_coin() to_populate.has_basic_auth = RandomHelper.flip_coin() to_populate.has_digest_auth = RandomHelper.flip_coin() to_populate.has_ntlm_auth = RandomHelper.flip_coin() to_populate.basic_auth_realms = WsFaker.get_words() to_populate.has_server_headers = RandomHelper.flip_coin() to_populate.has_multiple_server_headers = RandomHelper.flip_coin() to_populate.all_responses_not_found = RandomHelper.flip_coin() to_populate.resolved_ip_address = WsFaker.get_ipv4_address() to_populate.ssl_certificate_cname = WsFaker.get_domain_name() to_populate.ssl_certificate_expired = RandomHelper.flip_coin() to_populate.ssl_certificate_is_valid = RandomHelper.flip_coin() to_populate.ssl_certificate_start_time = WsFaker.get_time_in_past() to_populate.ssl_certificate_invalid_time = WsFaker.get_time_in_future() to_populate.scan_completed_at = DatetimeHelper.now() to_populate.hostname_is_ip_address = RandomHelper.flip_coin() to_populate.has_ssl_certificate_data = RandomHelper.flip_coin() to_populate.ssl_certificate_md5_digest = WsFaker.get_md5_string() to_populate.open_ports = WsFaker.get_web_app_open_ports() to_populate.landing_header_redirect_location = WsFaker.get_url() to_populate.landing_meta_refresh_location = WsFaker.get_url() to_populate.landing_response_status = WsFaker.get_http_response_status( ) to_populate.landing_title = " ".join(WsFaker.get_words()) to_populate.local_login_form_count = WsFaker.get_random_int() to_populate.local_login_form_https_count = WsFaker.get_random_int() to_populate.remote_login_form_count = WsFaker.get_random_int() to_populate.remote_login_form_https_count = WsFaker.get_random_int() to_populate.user_agent_fingerprints = WsFaker.get_user_agent_fingerprints( ) return to_populate
def _populate_dummy(cls, to_populate): from lib import WsFaker to_populate.domain_uuid = WsFaker.create_uuid() to_populate.domain_name = WsFaker.get_domain_name() to_populate.domain_added_by = WsFaker.get_word() return to_populate
def _populate_dummy(cls, to_populate): from lib import WsFaker to_populate.enumeration_method = WsFaker.get_word() to_populate.child_domains = WsFaker.get_domain_names() to_populate.parent_domain = WsFaker.get_domain_name() return to_populate
def _populate_dummy(cls, to_populate): from lib import WsFaker, RandomHelper to_populate.web_service_uuid = WsFaker.create_uuid() to_populate.web_service_host_name = WsFaker.get_domain_name() to_populate.web_service_uses_ssl = RandomHelper.flip_coin() return to_populate
def _populate_dummy(cls, to_populate): from lib import WsFaker to_populate.hostname = WsFaker.get_domain_name() to_populate.discovery_method = WsFaker.get_vhost_discovery_method() return to_populate