From 89477d6929c42080b8dbadd6736fc04a0f606f2d Mon Sep 17 00:00:00 2001 From: g147 <26509147+g147@users.noreply.github.com> Date: Sun, 30 Jun 2024 15:47:56 +0530 Subject: [PATCH] puncia[0.18] --- README.md | 10 +++++++--- puncia/__main__.py | 50 ++++++++++++++++++++++++++++++++++++---------- setup.py | 2 +- 3 files changed, 48 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index a4b4fcb..8843d8b 100644 --- a/README.md +++ b/README.md @@ -13,14 +13,18 @@ Puncia utilizes two of our intelligent APIs to gather the results -
**Please note that although these results can sometimes be pretty inaccurate & unreliable, they can greatly differ from time to time due to their self-improvement capabilities.** +**Aggressive rate-limits can be avoided with an API key: https://arpsyndicate.io/pricing.html** + ## Installation 1. From PyPi - `pip3 install puncia` 2. From Source - `pip3 install .`
## Usage -1. Subdomain - `puncia subdomain ` -2. Exploit - `puncia exploit ` -3. Bulk - `puncia exploit `
+1. Query Domains - `puncia subdomain ` +2. Query Exploit & Vulnerability Identifiers - `puncia exploit ` +3. Bulk Queries - `puncia exploit `
+4. Store an API key - `puncia storekey `
+ ### Bulk Input JSON Format ``` { diff --git a/puncia/__main__.py b/puncia/__main__.py index 30a0ea1..ef1cf6f 100755 --- a/puncia/__main__.py +++ b/puncia/__main__.py @@ -8,14 +8,36 @@ API_URLS = { "subdomain": "http://api.subdomain.center/?domain=", "exploit": "http://api.exploit.observer/?keyword=", + "auth_subdomain": "http://api.subdomain.center/beta/?auth={0}&domain=", + "auth_exploit": "http://api.exploit.observer/beta/?auth={0}&keyword=", "russia": "http://api.exploit.observer/russia/", "china": "http://api.exploit.observer/china/", } -def query_api(mode, query, output_file=None, cid=None): - time.sleep(8) - url = API_URLS.get(mode) +def store_key(key=""): + home = os.path.expanduser("~") + with open(home + "/.puncia", "w") as f: + f.write(key) + + +def read_key(): + try: + home = os.path.expanduser("~") + with open(home + "/.puncia", "r") as f: + key = f.read() + return key + except: + pass + return "" + + +def query_api(mode, query, output_file=None, cid=None, akey=""): + if len(akey) > 0 and mode in ["exploit", "subdomain"]: + url = API_URLS.get("auth_" + mode).format(akey) + else: + time.sleep(60) + url = API_URLS.get(mode) if "^" in query: if query == "^RU_NON_CVE": url = API_URLS.get("russia") @@ -29,7 +51,6 @@ def query_api(mode, query, output_file=None, cid=None): cid = "Chinese VIDs with no associated CVEs" if not url: sys.exit("Invalid Mode") - response = requests.get(url + query).json() if not response: print("Null response from the API") @@ -43,6 +64,7 @@ def query_api(mode, query, output_file=None, cid=None): reurl.replace("https://api.exploit.observer/?keyword=", ""), output_file, cid, + akey, ) return if output_file: @@ -105,22 +127,21 @@ def query_api(mode, query, output_file=None, cid=None): def main(): try: print("---------") - print("Panthera(P.)uncia [v0.17]") + print("Panthera(P.)uncia [v0.18]") print("A.R.P. Syndicate [https://arpsyndicate.io]") - print("Subdomain Center [https://subdomain.center]") - print("Exploit Observer [https://exploit.observer]") print("---------") if len(sys.argv) < 3: sys.exit( - "usage: puncia [output_file/output_directory]\nrefer: https://github.com/ARPSyndicate/puncia#usage" + "usage: puncia [output_file/output_directory]\nrefer: https://github.com/ARPSyndicate/puncia#usage" ) mode = sys.argv[1] query = sys.argv[2] output_file = sys.argv[3] if len(sys.argv) == 4 else None + akey = read_key() - if mode not in API_URLS and mode != "bulk": + if mode not in API_URLS and mode != "bulk" and mode != "storekey": sys.exit("Invalid Mode") if mode == "bulk": @@ -129,6 +150,8 @@ def main(): if output_file: os.makedirs(output_file + "/subdomain/", exist_ok=True) os.makedirs(output_file + "/exploit/", exist_ok=True) + else: + sys.exit("Bulk Mode requires an Output Directory") with open(query, "r") as f: input_file = json.load(f) if "subdomain" in input_file: @@ -138,6 +161,7 @@ def main(): "subdomain", bulk_query, output_file + "/subdomain/" + bulk_query + ".json", + akey=akey, ) except Exception as ne: sys.exit(f"Error: {str(ne)}") @@ -149,11 +173,17 @@ def main(): "exploit", bulk_query, output_file + "/exploit/" + bulk_query + ".json", + akey=akey, ) except Exception as ne: sys.exit(f"Error: {str(ne)}") + + elif mode == "storekey": + store_key(query) + print("Successful!") + else: - query_api(mode, query, output_file) + query_api(mode, query, output_file, akey=akey) except Exception as e: sys.exit(f"Error: {str(e)}") diff --git a/setup.py b/setup.py index 9c7ce13..4b232af 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name="puncia", - version="0.17", + version="0.18", author="A.R.P. Syndicate", author_email="ayush@arpsyndicate.io", keywords="subdomains subdomain exploits exploit arpsyndicate panthera uncia puncia snow leopard",