Skip to content

Commit

Permalink
Merge pull request #375 from 13ph03nix/fix/urllib3-hook
Browse files Browse the repository at this point in the history
Bug fixes & improvements
  • Loading branch information
13ph03nix authored Jul 26, 2023
2 parents c2bd358 + 0338e56 commit 30a9429
Show file tree
Hide file tree
Showing 18 changed files with 196 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
run: |
export VERSION=$(echo $GH_REF | sed 's:refs/tags/v::')
git config --global user.email "[email protected]"
git config --global user.name 'Tian Qiao'
git config --global user.name '13ph03nix'
git commit -a -m "Version ${VERSION} (automated version bump)"
git push origin master
env:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# version 2.0.5
----------------
* fix hook failure due to urllib3 update #368 #373
* optimize DSL expression execution #372
* making mmh3 an optional dependency #359
* disable mandatory updates

# version 2.0.4
----------------
* Updated protocol names that are compatible with Nuclei v2.9.1
Expand Down
6 changes: 3 additions & 3 deletions manpages/poc-console.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.\"
.\" Nov 3, 2022
.\" Man page author:
.\" Tian Qiao <[email protected]>
.\" 13ph03nix <[email protected]>
.\"
.SH NAME
.I poc-console
Expand Down Expand Up @@ -31,7 +31,7 @@ is maintained at:
.I https://pocsuite.org
.PP
.SH VERSION
This manual page documents pocsuite3 version 2.0.4
This manual page documents pocsuite3 version 2.0.5
.SH AUTHOR
.br
(c) 2014-present by Knownsec 404 Team
Expand All @@ -46,7 +46,7 @@ redistribute this software under certain conditions. If you wish to embed
pocsuite3 technology into proprietary software, we sell alternative licenses
(contact [email protected]).
.PP
Manual page started by Tian Qiao
Manual page started by 13ph03nix
<[email protected]>
.PP

6 changes: 3 additions & 3 deletions manpages/pocsuite.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.\"
.\" Nov 3, 2022
.\" Man page author:
.\" Tian Qiao <[email protected]>
.\" 13ph03nix <[email protected]>
.\"
.SH NAME
.I pocsuite3
Expand Down Expand Up @@ -289,7 +289,7 @@ is maintained at:
.I https://pocsuite.org
.PP
.SH VERSION
This manual page documents pocsuite3 version 2.0.4
This manual page documents pocsuite3 version 2.0.5
.SH AUTHOR
.br
(c) 2014-present by Knownsec 404 Team
Expand All @@ -304,7 +304,7 @@ redistribute this software under certain conditions. If you wish to embed
pocsuite3 technology into proprietary software, we sell alternative licenses
(contact [email protected]).
.PP
Manual page started by Tian Qiao
Manual page started by 13ph03nix
<[email protected]>
.PP

2 changes: 1 addition & 1 deletion pocsuite3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = 'pocsuite3'
__version__ = '2.0.4'
__version__ = '2.0.5'
__author__ = 'Knownsec 404 Team'
__author_email__ = '[email protected]'
__license__ = 'GPLv2'
Expand Down
5 changes: 2 additions & 3 deletions pocsuite3/lib/core/update.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from pocsuite3.lib.core.data import logger, conf
from six.moves.xmlrpc_client import ServerProxy
from pkg_resources import parse_version
Expand Down Expand Up @@ -47,5 +46,5 @@ def update():
' $ unzip master.zip\n'
' $ cd pocsuite3-master\n'
' $ pip3 install -r requirements.txt\n'
' $ python3 setup.py install\n')
sys.exit(-1)
' $ python3 setup.py install\n'
)
2 changes: 1 addition & 1 deletion pocsuite3/lib/request/patch/add_httpraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def httpraw(raw: str, ssl: bool = False, **kwargs):
raise Exception
tmp_headers = raws[1:index - 1]
tmp_headers = extract_dict('\n'.join(tmp_headers), '\n', ": ")
postData = raws[index]
postData = '\n'.join(raws[index:])
try:
json.loads(postData)
_json = postData
Expand Down
65 changes: 32 additions & 33 deletions pocsuite3/lib/request/patch/hook_urllib3_parse_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,39 +115,6 @@ def __str__(self):
return self.url


def split_first(s, delims):
"""
Given a string and an iterable of delimiters, split on the first found
delimiter. Return two split parts and the matched delimiter.
If not found, then the first part is the full input string.
Example::
>>> split_first('foo/bar?baz', '?/=')
('foo', 'bar?baz', '/')
>>> split_first('foo/bar?baz', '123')
('foo/bar?baz', '', None)
Scales linearly with number of delims. Not ideal for large number of delims.
"""
min_idx = None
min_delim = None
for d in delims:
idx = s.find(d)
if idx < 0:
continue

if min_idx is None or idx < min_idx:
min_idx = idx
min_delim = d

if min_idx is None or min_idx < 0:
return s, '', None

return s[:min_idx], s[min_idx + 1:], min_delim


def patched_parse_url(url):
"""
Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is
Expand All @@ -170,6 +137,38 @@ def patched_parse_url(url):
# Additionally, this implementations does silly things to be optimal
# on CPython.

def split_first(s, delims):
"""
Given a string and an iterable of delimiters, split on the first found
delimiter. Return two split parts and the matched delimiter.
If not found, then the first part is the full input string.
Example::
>>> split_first('foo/bar?baz', '?/=')
('foo', 'bar?baz', '/')
>>> split_first('foo/bar?baz', '123')
('foo/bar?baz', '', None)
Scales linearly with number of delims. Not ideal for large number of delims.
"""
min_idx = None
min_delim = None
for d in delims:
idx = s.find(d)
if idx < 0:
continue

if min_idx is None or idx < min_idx:
min_idx = idx
min_delim = d

if min_idx is None or min_idx < 0:
return s, '', None

return s[:min_idx], s[min_idx + 1:], min_delim

if not url:
# Empty
return Url()
Expand Down
4 changes: 2 additions & 2 deletions pocsuite3/lib/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ def minimum_version_required(ver):
from pkg_resources import parse_version
v1, v2 = parse_version(ver), parse_version(__version__)
if v1 > v2:
logger.error(f'The minimum version required for this PoC plugin is {ver}, '
f'you installed {__version__}, please upgrade pocsuite3 :)')
logger.warning(f'The minimum version required for this PoC plugin is {ver}, '
f'you installed {__version__}, please consider upgrading pocsuite3.')
from pocsuite3.lib.core.data import conf
from pocsuite3.lib.core.update import update
conf.update_all = True
Expand Down
Loading

0 comments on commit 30a9429

Please sign in to comment.