Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

Commit

Permalink
Merge a66748c into 86bec9c
Browse files Browse the repository at this point in the history
  • Loading branch information
aloftus23 committed Sep 14, 2022
2 parents 86bec9c + a66748c commit d647137
Show file tree
Hide file tree
Showing 7 changed files with 621 additions and 17 deletions.
4 changes: 4 additions & 0 deletions src/pe_source/cybersixgill.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ def get_credentials(self, org_id, sixgill_org_id, pe_org_uid, source_uid):
LOGGER.error(e)
return 1

if creds_df.empty:
LOGGER.error("No credentials for %s", org_id)
return 1

# Change empty and ambiguous breach names
creds_df.loc[
creds_df["breach_name"] == "", "breach_name"
Expand Down
5 changes: 5 additions & 0 deletions src/pe_source/pe_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def run_pe_script(source, orgs_list, cybersix_methods):
elif source == "shodan":
shodan = Shodan(orgs_list)
shodan.run_shodan()
else:
logging.error(
"Not a valid source name. Correct values are cybersixgill or shodan."
)
sys.exit(1)


def main():
Expand Down
56 changes: 56 additions & 0 deletions tests/data/cybersix_breach_insert.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[
{
"breach_date": "2022-05-07",
"breach_name": "Breach 2",
"data_source_uid": "source_uid",
"description": "Description 2",
"exposed_cred_count": 2,
"modified_date": "2022-05-07",
"password_included": true
},
{
"breach_date": "2022-04-15",
"breach_name": "Breach 3",
"data_source_uid": "source_uid",
"description": "Description 3",
"exposed_cred_count": 2,
"modified_date": "2022-04-15",
"password_included": false
},
{
"breach_date": "2022-05-10",
"breach_name": "Breach 4",
"data_source_uid": "source_uid",
"description": "Description 4",
"exposed_cred_count": 2,
"modified_date": "2022-05-10",
"password_included": false
},
{
"breach_date": "2022-05-06",
"breach_name": "Breach 5",
"data_source_uid": "source_uid",
"description": "Description 5",
"exposed_cred_count": 1,
"modified_date": "2022-05-06",
"password_included": false
},
{
"breach_date": "2022-05-08",
"breach_name": "Breach 6",
"data_source_uid": "source_uid",
"description": "Description 6",
"exposed_cred_count": 1,
"modified_date": "2022-05-08",
"password_included": false
},
{
"breach_date": "2022-04-26",
"breach_name": "Cybersixgill_1",
"data_source_uid": "source_uid",
"description": "Description 1",
"exposed_cred_count": 3,
"modified_date": "2022-04-26",
"password_included": true
}
]
156 changes: 156 additions & 0 deletions tests/data/cybersix_creds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
[
{
"breach_date": "2022-04-26",
"breach_id": 1,
"breach_name": "",
"create_time": "2022-04-26 20:53:13",
"description": "Description 1",
"domain": "sample.com",
"email": "person1@sample.com",
"hash_type": "plain",
"login_id": "",
"name": "",
"password": "askjna",
"phone": ""
},
{
"breach_date": "2022-04-26",
"breach_id": 1,
"breach_name": "",
"create_time": "2022-04-26 16:15:41",
"description": "Description 1",
"domain": "sample.com",
"email": "person2@sample.com",
"hash_type": "plain",
"login_id": "",
"name": "",
"password": "asfvas",
"phone": ""
},
{
"breach_date": "2022-04-26",
"breach_id": 1,
"breach_name": "",
"create_time": "2022-04-26 08:29:03",
"description": "Description 1",
"domain": "sample.com",
"email": "person3@sample.com",
"hash_type": "plain",
"login_id": "",
"name": "",
"password": "ksfjnva",
"phone": ""
},
{
"breach_date": "2022-05-07",
"breach_id": 2,
"breach_name": "Breach 2",
"create_time": "2022-05-07 16:15:40",
"description": "Description 2",
"domain": "sample.com",
"email": "person4@sample.com",
"hash_type": "plain",
"login_id": "",
"name": "",
"password": "safvas",
"phone": ""
},
{
"breach_date": "2022-05-07",
"breach_id": 2,
"breach_name": "Breach 2",
"create_time": "2022-05-07 10:56:11",
"description": "Description 2",
"domain": "sample.com",
"email": "person5@sample.com",
"hash_type": "plain",
"login_id": "None",
"name": "None",
"password": "asdvasv",
"phone": "None"
},
{
"breach_date": "2022-04-15",
"breach_id": 3,
"breach_name": "Breach 3",
"create_time": "2022-04-15 21:43:27",
"description": "Description 3",
"domain": "sample.com",
"email": "person6@sample.com",
"hash_type": "plain",
"login_id": "None",
"name": "None",
"password": "",
"phone": "None"
},
{
"breach_date": "2022-04-15",
"breach_id": 3,
"breach_name": "Breach 3",
"create_time": "2022-04-15 09:22:26",
"description": "Description 3",
"domain": "sample.com",
"email": "person7@sample.com",
"hash_type": "plain",
"login_id": "None",
"name": "None",
"password": "",
"phone": "None"
},
{
"breach_date": "2022-05-10",
"breach_id": 4,
"breach_name": "Breach 4",
"create_time": "2022-04-15 09:39:37",
"description": "Description 4",
"domain": "sample.com",
"email": "person8@sample.com",
"hash_type": "plain",
"login_id": "None",
"name": "None",
"password": "",
"phone": "None"
},
{
"breach_date": "2022-05-10",
"breach_id": 4,
"breach_name": "Breach 4",
"create_time": "2022-04-15 09:36:13",
"description": "Description 4",
"domain": "sample.com",
"email": "person9@sample.com",
"hash_type": "plain",
"login_id": "None",
"name": "None",
"password": "",
"phone": "None"
},
{
"breach_date": "2022-05-06",
"breach_id": 5,
"breach_name": "Breach 5",
"create_time": "2022-05-06 09:38:21",
"description": "Description 5",
"domain": "sample.com",
"email": "person10@sample.com",
"hash_type": "plain",
"login_id": "None",
"name": "None",
"password": "",
"phone": "None"
},
{
"breach_date": "2022-05-08",
"breach_id": 6,
"breach_name": "Breach 6",
"create_time": "2022-05-08 09:27:44",
"description": "Description 6",
"domain": "sample.com",
"email": "person11@sample.com",
"hash_type": "plain",
"login_id": "None",
"name": "None",
"password": "",
"phone": "None"
}
]
156 changes: 156 additions & 0 deletions tests/data/cybersix_creds_insert.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
[
{
"breach_name": "Cybersixgill_1",
"credential_breaches_uid": "breach_uid_1",
"data_source_uid": "source_uid",
"email": "person1@sample.com",
"hash_type": "plain",
"login_id": "",
"modified_date": "2022-04-26",
"name": "",
"organizations_uid": "pe_org_uid",
"password": "askjna",
"phone": "",
"sub_domain": "sample.com"
},
{
"breach_name": "Cybersixgill_1",
"credential_breaches_uid": "breach_uid_1",
"data_source_uid": "source_uid",
"email": "person2@sample.com",
"hash_type": "plain",
"login_id": "",
"modified_date": "2022-04-26",
"name": "",
"organizations_uid": "pe_org_uid",
"password": "asfvas",
"phone": "",
"sub_domain": "sample.com"
},
{
"breach_name": "Cybersixgill_1",
"credential_breaches_uid": "breach_uid_1",
"data_source_uid": "source_uid",
"email": "person3@sample.com",
"hash_type": "plain",
"login_id": "",
"modified_date": "2022-04-26",
"name": "",
"organizations_uid": "pe_org_uid",
"password": "ksfjnva",
"phone": "",
"sub_domain": "sample.com"
},
{
"breach_name": "Breach 2",
"credential_breaches_uid": "breach_uid_2",
"data_source_uid": "source_uid",
"email": "person4@sample.com",
"hash_type": "plain",
"login_id": "",
"modified_date": "2022-05-07",
"name": "",
"organizations_uid": "pe_org_uid",
"password": "safvas",
"phone": "",
"sub_domain": "sample.com"
},
{
"breach_name": "Breach 2",
"credential_breaches_uid": "breach_uid_2",
"data_source_uid": "source_uid",
"email": "person5@sample.com",
"hash_type": "plain",
"login_id": "None",
"modified_date": "2022-05-07",
"name": "None",
"organizations_uid": "pe_org_uid",
"password": "asdvasv",
"phone": "None",
"sub_domain": "sample.com"
},
{
"breach_name": "Breach 3",
"credential_breaches_uid": "breach_uid_3",
"data_source_uid": "source_uid",
"email": "person6@sample.com",
"hash_type": "plain",
"login_id": "None",
"modified_date": "2022-04-15",
"name": "None",
"organizations_uid": "pe_org_uid",
"password": "",
"phone": "None",
"sub_domain": "sample.com"
},
{
"breach_name": "Breach 3",
"credential_breaches_uid": "breach_uid_3",
"data_source_uid": "source_uid",
"email": "person7@sample.com",
"hash_type": "plain",
"login_id": "None",
"modified_date": "2022-04-15",
"name": "None",
"organizations_uid": "pe_org_uid",
"password": "",
"phone": "None",
"sub_domain": "sample.com"
},
{
"breach_name": "Breach 4",
"credential_breaches_uid": "breach_uid_4",
"data_source_uid": "source_uid",
"email": "person8@sample.com",
"hash_type": "plain",
"login_id": "None",
"modified_date": "2022-05-10",
"name": "None",
"organizations_uid": "pe_org_uid",
"password": "",
"phone": "None",
"sub_domain": "sample.com"
},
{
"breach_name": "Breach 4",
"credential_breaches_uid": "breach_uid_4",
"data_source_uid": "source_uid",
"email": "person9@sample.com",
"hash_type": "plain",
"login_id": "None",
"modified_date": "2022-05-10",
"name": "None",
"organizations_uid": "pe_org_uid",
"password": "",
"phone": "None",
"sub_domain": "sample.com"
},
{
"breach_name": "Breach 5",
"credential_breaches_uid": "breach_uid_5",
"data_source_uid": "source_uid",
"email": "person10@sample.com",
"hash_type": "plain",
"login_id": "None",
"modified_date": "2022-05-06",
"name": "None",
"organizations_uid": "pe_org_uid",
"password": "",
"phone": "None",
"sub_domain": "sample.com"
},
{
"breach_name": "Breach 6",
"credential_breaches_uid": "breach_uid_6",
"data_source_uid": "source_uid",
"email": "person11@sample.com",
"hash_type": "plain",
"login_id": "None",
"modified_date": "2022-05-08",
"name": "None",
"organizations_uid": "pe_org_uid",
"password": "",
"phone": "None",
"sub_domain": "sample.com"
}
]

0 comments on commit d647137

Please sign in to comment.