Skip to content

Commit

Permalink
update pocx to 0.1.8 and add exception capture
Browse files Browse the repository at this point in the history
  • Loading branch information
antx-code committed Mar 17, 2022
1 parent cd79604 commit 10b45e9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pocx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.1.7'
__version__ = '0.1.8'

from .aio_poc import AioPoc
from .basic_poc import BasicPoc
1 change: 1 addition & 0 deletions pocx/aio_poc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import httpx
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
httpx._config.DEFAULT_CIPHERS += ":ALL:@SECLEVEL=1"


class AioPoc(metaclass=ABCMeta):
Expand Down
1 change: 1 addition & 0 deletions pocx/basic_poc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import httpx
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
httpx._config.DEFAULT_CIPHERS += ":ALL:@SECLEVEL=1"


class BasicPoc(metaclass=ABCMeta):
Expand Down
23 changes: 13 additions & 10 deletions pocx/funcs/ceye.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import httpx
import subprocess
from loguru import logger
from .snow_flake import IdWorker

Expand Down Expand Up @@ -40,20 +39,24 @@ def generate_payload_id(self):
return str(self.id_worker.get_id())

@logger.catch(level='ERROR')
def verify(self, pid: str, verify_type: str='dns'):
def verify(self, pfilter: str, verify_type: str='dns'):
"""
Verify the payload.
:param pid: The unique id of the payload.
:param pfilter: The unique string of the payload.
:param verify_type: The type of the verification, http or dns.
:return: The bool result of the verification.
"""
verify_url = f'http://api.ceye.io/v1/records?token={self.api_token}&type={verify_type}&filter={pid}'
result = httpx.get(verify_url).json()
if not result['data']:
logger.error(f'{pid} not found in Ceye')
verify_url = f'http://api.ceye.io/v1/records?token={self.api_token}&type={verify_type}&filter={pfilter}'
try:
result = httpx.get(verify_url).json()
if not result['data']:
logger.error(f'{pfilter} not found in Ceye')
return False
logger.success(f'{pfilter} found in Ceye')
logger.success(f'The ceye records are: \n{result["data"]}')
return True
except Exception as e:
logger.error(f'verify has been occur an error \n{e}')
return False
logger.success(f'{pid} found in Ceye')
logger.success(f'The ceye records are: \n{result["data"]}')
return True
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pocx"
version = "0.1.7"
version = "0.1.8"
description = "A Simple, Fast and Powerful poc engine tools was built by antx, which support synchronous mode and asynchronous mode."
authors = ["antx <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 10b45e9

Please sign in to comment.