Skip to content

Commit 4e56cd3

Browse files
author
PadishahIII
committed
1.4.1
1 parent 2ea0d4e commit 4e56cd3

File tree

8 files changed

+117
-120
lines changed

8 files changed

+117
-120
lines changed

poetry.lock

Lines changed: 77 additions & 95 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "secretscraper"
3-
version = "1.4"
3+
version = "1.4.1"
44
description = "SecretScraper is a web scraper tool that can scrape the content through target websites and extract secret information via regular expression."
55
readme = "README.md"
66
authors = ["Padishah <[email protected]>"]

requirements.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ aiohttp==3.9.5 ; python_version >= "3.9" and python_version < "4.0" \
8181
aiosignal==1.3.1 ; python_version >= "3.9" and python_version < "4.0" \
8282
--hash=sha256:54cd96e15e1649b75d6c87526a6ff0b6c1b0dd3459f43d9ca11d48c339b68cfc \
8383
--hash=sha256:f8376fb07dd1e86a584e4fcdec80b36b7f81aac666ebc724e2c090300dd83b17
84-
anyio==4.3.0 ; python_version >= "3.9" and python_version < "4.0" \
85-
--hash=sha256:048e05d0f6caeed70d731f3db756d35dcc1f35747c8c403364a8332c630441b8 \
86-
--hash=sha256:f75253795a87df48568485fd18cdd2a3fa5c4f7c5be8e5e36637733fce06fed6
84+
anyio==4.4.0 ; python_version >= "3.9" and python_version < "4.0" \
85+
--hash=sha256:5aadc6a1bbb7cdb0bede386cac5e2940f5e2ff3aa20277e991cf028e0585ce94 \
86+
--hash=sha256:c1b2d8f46a8a812513012e1107cb0e68c17159a7a594208005a57dc776e1bdc7
8787
async-timeout==4.0.3 ; python_version >= "3.9" and python_version < "3.11" \
8888
--hash=sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f \
8989
--hash=sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028
@@ -96,9 +96,9 @@ beautifulsoup4==4.12.3 ; python_version >= "3.9" and python_version < "4.0" \
9696
bs4==0.0.2 ; python_version >= "3.9" and python_version < "4.0" \
9797
--hash=sha256:a48685c58f50fe127722417bae83fe6badf500d54b55f7e39ffe43b798653925 \
9898
--hash=sha256:abf8742c0805ef7f662dce4b51cca104cffe52b835238afc169142ab9b3fbccc
99-
certifi==2024.2.2 ; python_version >= "3.9" and python_version < "4.0" \
100-
--hash=sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f \
101-
--hash=sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1
99+
certifi==2024.6.2 ; python_version >= "3.9" and python_version < "4.0" \
100+
--hash=sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516 \
101+
--hash=sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56
102102
charset-normalizer==3.3.2 ; python_version >= "3.9" and python_version < "4.0" \
103103
--hash=sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027 \
104104
--hash=sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087 \
@@ -417,9 +417,9 @@ multidict==6.0.5 ; python_version >= "3.9" and python_version < "4.0" \
417417
requests-file==2.1.0 ; python_version >= "3.9" and python_version < "4.0" \
418418
--hash=sha256:0f549a3f3b0699415ac04d167e9cb39bccfb730cb832b4d20be3d9867356e658 \
419419
--hash=sha256:cf270de5a4c5874e84599fc5778303d496c10ae5e870bfa378818f35d21bda5c
420-
requests==2.32.2 ; python_version >= "3.9" and python_version < "4.0" \
421-
--hash=sha256:dd951ff5ecf3e3b3aa26b40703ba77495dab41da839ae72ef3c8e5d8e2433289 \
422-
--hash=sha256:fc06670dd0ed212426dfeb94fc1b983d917c4f9847c863f313c9dfaaffb7c23c
420+
requests==2.32.3 ; python_version >= "3.9" and python_version < "4.0" \
421+
--hash=sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760 \
422+
--hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6
423423
sniffio==1.3.1 ; python_version >= "3.9" and python_version < "4.0" \
424424
--hash=sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2 \
425425
--hash=sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc
@@ -432,9 +432,9 @@ soupsieve==2.5 ; python_version >= "3.9" and python_version < "4.0" \
432432
tldextract==5.1.2 ; python_version >= "3.9" and python_version < "4.0" \
433433
--hash=sha256:4dfc4c277b6b97fa053899fcdb892d2dc27295851ab5fac4e07797b6a21b2e46 \
434434
--hash=sha256:c9e17f756f05afb5abac04fe8f766e7e70f9fe387adb1859f0f52408ee060200
435-
typing-extensions==4.12.0 ; python_version >= "3.9" and python_version < "3.11" \
436-
--hash=sha256:8cbcdc8606ebcb0d95453ad7dc5065e6237b6aa230a31e81d0f440c30fed5fd8 \
437-
--hash=sha256:b349c66bea9016ac22978d800cfff206d5f9816951f12a7d0ec5578b0a819594
435+
typing-extensions==4.12.1 ; python_version >= "3.9" and python_version < "3.11" \
436+
--hash=sha256:6024b58b69089e5a89c347397254e35f1bf02a907728ec7fee9bf0fe837d203a \
437+
--hash=sha256:915f5e35ff76f56588223f15fdd5938f9a1cf9195c0de25130c627e4d597f6d1
438438
urllib3==2.2.1 ; python_version >= "3.9" and python_version < "4.0" \
439439
--hash=sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d \
440440
--hash=sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19

src/secretscraper/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""SecretScraper"""
22

3-
__version__ = "1.4"
3+
__version__ = "1.4.1"

src/secretscraper/facade.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,13 @@ def init(self) -> FileScanner:
364364

365365
# Read rules from config file
366366
rules: typing.Dict[str, str] = read_rules_from_setting(self.settings)
367-
handler = get_regex_handler(rules)
367+
handler_type = self.settings.get("handler_type", "re")
368+
if handler_type == "hyperscan":
369+
handler = get_regex_handler(rules)
370+
print_config(f"Using regex handler: Hyperscan")
371+
else:
372+
handler = get_regex_handler(rules, type_="regex", use_groups=True)
373+
print_config(f"Using regex handler: Re")
368374

369375
# Get all files from directory
370376
base: typing.Optional[pathlib.Path] = self.custom_settings.get('local', None)

src/secretscraper/util.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Common utility functions."""
2-
2+
import os
33
import re
4+
import sys
45
import typing
56
from collections import namedtuple
67
from pathlib import Path
@@ -120,7 +121,11 @@ def get_response_title(response: requests.Response) -> str:
120121

121122
def start_local_test_http_server(host: str, port: int, server_dir: Path = None) -> tuple[
122123
Thread, http.server.HTTPServer]:
123-
"""Start local test server"""
124+
"""Start local test server
125+
126+
"""
127+
# if sys.platform.startswith("win"):
128+
# return None, None
124129

125130
if server_dir is None:
126131
DIR = str(
@@ -133,7 +138,10 @@ class Handler(http.server.SimpleHTTPRequestHandler):
133138
def __init__(self, *args, **kwargs):
134139
super().__init__(*args, directory=DIR, **kwargs)
135140

136-
httpd = http.server.HTTPServer((host, port), Handler)
137-
thread = Thread(target=httpd.serve_forever)
138-
thread.start()
139-
return thread, httpd
141+
try:
142+
httpd = http.server.HTTPServer((host, port), Handler)
143+
thread = Thread(target=httpd.serve_forever)
144+
thread.start()
145+
return thread, httpd
146+
except OSError:
147+
return None, None

tests/test_facade.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ def test_normal_run(clicker: CliRunner, invoke_args: typing.List[str]):
242242
click.echo(result.output, file=f)
243243
print(result)
244244
finally:
245-
httpd.shutdown()
245+
if httpd is not None:
246+
httpd.shutdown()
246247

247248

248249
# @pytest.mark.parametrize( # TODO: cannot copy file in github actions

tests/test_util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from secretscraper.util import read_rules_from_setting, start_local_test_http_server
22
import requests
3-
from signal import pthread_kill, SIGKILL
43

54
from . import settings
65

@@ -18,5 +17,6 @@ def test_start_local_test_http_server():
1817
except AssertionError as e:
1918
raise e
2019
finally:
21-
httpd.shutdown()
22-
print(1)
20+
if httpd is not None:
21+
httpd.shutdown()
22+
# print(1)

0 commit comments

Comments
 (0)