Skip to content

Commit

Permalink
puncia[0.26]
Browse files Browse the repository at this point in the history
  • Loading branch information
g147 committed Jan 1, 2025
1 parent 099117c commit 9e62f03
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 14 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ Puncia utilizes two of our intelligent APIs to gather the results - <br>

1. Store an API key (storekey) - `puncia storekey <api-key>`
2. Query Domains (subdomain) - `puncia subdomain <domain> <output-file>`
3. Query Exploit & Vulnerability Identifiers (exploit)
3. Query Replica Domains (replica) - `puncia replica <domain> <output-file>`
4. Query Exploit & Vulnerability Identifiers (exploit)
- Russian VIDs with no associated CVEs (^RU_NON_CVE) - `puncia exploit ^RU_NON_CVE <output-file>`
- Chinese VIDs with no associated CVEs (^CN_NON_CVE) - `puncia exploit ^CN_NON_CVE <output-file>`
- Vulnerability & Exploit Identifers Watchlist (^WATCHLIST_IDES) - `puncia exploit ^WATCHLIST_IDES <output-file>`
- Vulnerable Technologies Watchlist (^WATCHLIST_TECH) - `puncia exploit ^WATCHLIST_TECH <output-file>`
- [Supported Vulnerability Identifiers](https://github.com/ARPSyndicate/docs?tab=readme-ov-file#supported-vulnerability-identifiers) - `puncia exploit <eoidentifier> <output-file>`
4. Enrich CVE/GHSA Identifiers (enrich) - `puncia enrich <cve-id/ghsa-id> <output-file>`
5. Multiple Queries (bulk/sbom)
5. Enrich CVE/GHSA Identifiers (enrich) - `puncia enrich <cve-id/ghsa-id> <output-file>`
6. Multiple Queries (bulk/sbom)

- Bulk Input JSON File Format - `puncia bulk <json-file> <output-directory>`
```
Expand All @@ -42,6 +43,10 @@ Puncia utilizes two of our intelligent APIs to gather the results - <br>
"domainA.com",
"domainB.com"
],
"replica": [
"domainA.com",
"domainB.com"
],
"exploit": [
"eoidentifierA",
"eoidentifierB"
Expand All @@ -54,7 +59,7 @@ Puncia utilizes two of our intelligent APIs to gather the results - <br>
```
- [SBOM Input JSON File Format](https://github.com/CycloneDX/bom-examples/blob/master/SBOM/protonmail-webclient-v4-0912dff/bom.json) - `puncia sbom <json-file> <output-directory>`
6. External Import
7. External Import
```
import puncia
Expand All @@ -81,6 +86,6 @@ Puncia utilizes two of our intelligent APIs to gather the results - <br>
## More from [A.R.P. Syndicate](https://www.arpsyndicate.io)
- [VEDAS Advisories](https://vedas.arpsyndicate.io)
- [Open Source Intelligence](https://asm.arpsyndicate.io/intelligence.html)
- [Attack Surface Management](https://asm.arpsyndicate.io)
- [Vulnerability Advisories AI](https://advisories.arpsyndicate.io)
- [Attack Surface Management](https://asm.arpsyndicate.io)
34 changes: 27 additions & 7 deletions puncia/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

API_URLS = {
"subdomain": "https://api.subdomain.center/?domain=",
"replica": "https://api.subdomain.center/?engine=octopus&domain=",
"exploit": "https://api.exploit.observer/?keyword=",
"enrich": "https://api.exploit.observer/?enrich=True&keyword=",
"auth_subdomain": "https://api.subdomain.center/beta/?auth={0}&domain=",
"auth_replica": "https://api.subdomain.center/beta/?auth={0}&engine=octopus&domain=",
"auth_exploit": "https://api.exploit.observer/beta/?auth={0}&keyword=",
"auth_enrich": "https://api.exploit.observer/beta/?auth={0}&enrich=True&keyword=",
"russia": "https://api.exploit.observer/russia/",
Expand All @@ -35,7 +37,7 @@ def read_key():


def query_api(mode, query, output_file=None, cid=None, apikey=""):
if len(apikey) > 0 and mode in ["exploit", "subdomain", "enrich"]:
if len(apikey) > 0 and mode in ["exploit", "subdomain", "enrich", "replica"]:
url = API_URLS.get("auth_" + mode).format(apikey)
else:
time.sleep(25)
Expand Down Expand Up @@ -63,7 +65,7 @@ def query_api(mode, query, output_file=None, cid=None, apikey=""):
cid = "Vulnerable Technologies Watchlist"
if not url:
sys.exit("Invalid Mode")
retries = 3
retries = 1
counter = 0
response = {}
while counter <= retries:
Expand All @@ -74,12 +76,15 @@ def query_api(mode, query, output_file=None, cid=None, apikey=""):
except:
print("An exception happened while requesting: " + query)
counter = counter + 1
time.sleep(60)
time.sleep(30)
if not response or len(response) == 0:
print("Null response from the API for: " + query)
return
if mode in ["spec_exploit"]:
os.system("rm " + output_file)
try:
os.remove(output_file)
except:
pass
for reurl in response:
query_api(
"exploit",
Expand All @@ -94,7 +99,7 @@ def query_api(mode, query, output_file=None, cid=None, apikey=""):
if os.path.isfile(output_file):
with open(output_file, "r") as f:
existing_data = json.load(f)
if mode == "subdomain":
if "subdomain" in mode or "replica" in mode:
if len(existing_data) == 0:
existing_data = []
existing_data.extend(response)
Expand Down Expand Up @@ -172,13 +177,13 @@ def add_component(name, version):
def main():
try:
print("---------")
print("Panthera(P.)uncia [v0.25]")
print("Panthera(P.)uncia [v0.26]")
print("A.R.P. Syndicate [https://www.arpsyndicate.io]")
print("---------")

if len(sys.argv) < 3:
sys.exit(
"usage: puncia <mode:subdomain/exploit/enrich/bulk/sbom/storekey> <query:domain/eoidentifier/jsonfile/apikey> [output_file/output_directory]\nrefer: https://github.com/ARPSyndicate/puncia#usage"
"usage: puncia <mode:subdomain/replica/exploit/enrich/bulk/sbom/storekey> <query:domain/eoidentifier/jsonfile/apikey> [output_file/output_directory]\nrefer: https://github.com/ARPSyndicate/puncia#usage"
)

mode = sys.argv[1]
Expand All @@ -199,6 +204,7 @@ def main():
sys.exit("jsonfile as query input required for bulk mode")
if output_file:
os.makedirs(output_file + "/subdomain/", exist_ok=True)
os.makedirs(output_file + "/replica/", exist_ok=True)
os.makedirs(output_file + "/exploit/", exist_ok=True)
os.makedirs(output_file + "/enrich/", exist_ok=True)
else:
Expand All @@ -223,6 +229,20 @@ def main():
except Exception as ne:
sys.exit(f"Error: {str(ne)}")
continue
if "replica" in input_file:
for bulk_query in input_file["replica"]:
try:
rdata = query_api(
"replica",
bulk_query,
output_file + "/replica/" + bulk_query + ".json",
apikey=apikey,
)
if len(rdata) > 0:
print(json.dumps(rdata, indent=4, sort_keys=True))
except Exception as ne:
sys.exit(f"Error: {str(ne)}")
continue
if "exploit" in input_file:
for bulk_query in input_file["exploit"]:
try:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="puncia",
version="0.25",
version="0.26",
author="A.R.P. Syndicate",
author_email="[email protected]",
keywords="subdomains subdomain exploits exploit sbom cyclonedx arpsyndicate panthera uncia puncia snow leopard",
Expand Down

0 comments on commit 9e62f03

Please sign in to comment.