阅读量:2
嘿,这里是目录!
0. 前言
- 安装了多半天,累死简直,网上说这个的相对不大详细,总结一下经验,反正就疯狂报错,最后能用了
- 安装环境1:windows10 + python3.8.5【简单一点】
- 安装环境2:vmware虚拟机,kali2024.1(自带python2.7和python3.11)【复杂亿些】
- Ciphey官方安装教程,写的挺简单的
- 核心要点1:python3.7+以上的版本才可以使用,python3.8也行,但是windows下python3.9+不可以,其他平台python3.10+不可以
- 核心要点2:windows环境下python默认安装32位,但是使用ciphey需要安装在python是64位的环境
1. window10环境安装ciphey【简单一点】
1.1 检查环境
- 检查python是不是3.7或者3.8版本的?不是用不了
- cmd中敲(不用进管理员模式),查看是否符合
python --version
- 检查python是否是64位的版本1?不是用不了
- cmd中敲(不用进管理员模式),查看是否符合
python import platform platform.architecture()
- 如果两者都满足,恭喜你具备安装条件了,开始安装
1.2 我的环境
- windows10 + python3.8.5
1.3 安装23
- cmd中敲(不用进管理员模式)
pip install ciphey -i https://pypi.mirrors.ustc.edu.cn/simple/
- 编辑这个python文件
..\python安装的路径\Lib\site-packages\pywhat\regex_identifier.py
- 将文件中的r改成rb
import json import os import re class RegexIdentifier: def __init__(self): path = "Data/regex.json" fullpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), path) # 改下面这句里的r with open(fullpath, "r") as myfile: self.regexes = json.load(myfile)
- 改成这样就行
with open(fullpath, "rb") as myfile:
- 完结,可以正常使用了
- 使用指南4,cmd中直接敲命令就行
ciphey --help ciphey -t "密文" ciphey -f 文件名
- 举俩栗子
ciphey -t "aGVsbG8gbXkgbmFtZSBpcyBiZWU="
ciphey -t "4O595954494Q32515046324757595N534R52415653334357474R4N575955544R4O5N4Q46434S4O59474253464Q5N444R4Q51334557524O5N4S424944473542554O595N44534O324R49565746515532464O49345649564O464R4R494543504N35"
1.4 头铁的报错
- 当时没想明白(现在也没明白)为啥非得从r改成rb,就先没改,试了试不改能不能跑,很好,不能跑,会报错,必须改
- 报错信息如下
Traceback (most recent call last): File "D:\Python385\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "D:\Python385\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "D:\Python385\Scripts\ciphey.exe\__main__.py", line 7, in <module> File "D:\Python385\lib\site-packages\click\core.py", line 829, in __call__ return self.main(*args, **kwargs) File "D:\Python385\lib\site-packages\click\core.py", line 782, in main rv = self.invoke(ctx) File "D:\Python385\lib\site-packages\click\core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "D:\Python385\lib\site-packages\click\core.py", line 610, in invoke return callback(*args, **kwargs) File "D:\Python385\lib\site-packages\ciphey\ciphey.py", line 222, in main config.complete_config() File "D:\Python385\lib\site-packages\ciphey\iface\_config.py", line 189, in complete_config self.load_objs() File "D:\Python385\lib\site-packages\ciphey\iface\_config.py", line 131, in load_objs self.objs["checker"] = self( File "D:\Python385\lib\site-packages\ciphey\iface\_config.py", line 102, in __call__ return self.instantiate(t) File "D:\Python385\lib\site-packages\ciphey\iface\_config.py", line 97, in instantiate ret = t(self) File "D:\Python385\lib\site-packages\ciphey\iface\_modules.py", line 153, in __init__ self._base = cls(config) File "D:\Python385\lib\site-packages\ciphey\basemods\Checkers\ezcheck.py", line 46, in __init__ self.checkers.append(config(What)) File "D:\Python385\lib\site-packages\ciphey\iface\_config.py", line 102, in __call__ return self.instantiate(t) File "D:\Python385\lib\site-packages\ciphey\iface\_config.py", line 97, in instantiate ret = t(self) File "D:\Python385\lib\site-packages\ciphey\iface\_modules.py", line 153, in __init__ self._base = cls(config) File "D:\Python385\lib\site-packages\ciphey\basemods\Checkers\what.py", line 59, in __init__ self.id = identifier.Identifier() File "D:\Python385\lib\site-packages\pywhat\identifier.py", line 10, in __init__ self.regex_id = RegexIdentifier() File "D:\Python385\lib\site-packages\pywhat\regex_identifier.py", line 11, in __init__ self.regexes = json.load(myfile) File "D:\Python385\lib\json\__init__.py", line 293, in load return loads(fp.read(), UnicodeDecodeError: 'gbk' codec can't decode byte 0xbf in position 695: illegal multibyte sequence
2. vmware虚拟机,kali2024.1(自带python2.7和python3.11)【复杂亿些】
2.1 检查环境
- 检查python是不是3.7或者3.8版本的?
- cmd中敲(不用进管理员模式),这里面可以看到有一些软链接,有python2.7,也有python3.11
cd /usr/bin/ ll python*
- 悬着的心终于死了,确实不是python3.7或者python3.8,也不用检查python是否是64位的版本了,现在的环境反正也装不了
2.2 我的环境
- vmware虚拟机,kali2024.1 + python2.7 + python3.11
2.3 环境改造
- 没有就造一个python3.8的环境,查找相关资料,如何在linux环境中安装不同版本的python
- 参考文章操作:kali linux 安装python 3xx 以及多版本切换的方式,python就用了这篇文章里的3.8.16版本
- 要点1:这里敲命令的时候注意截图,到底是在哪个目录下进行操作
- 要点2:执行这两条命令会出点异常情况,但是没有红色的报错,事实上就是python3-pip没装上,python-dev改名了,现在叫python-dev-is-python3,继续安装ciphey会报错,显示没有pip3这个模块
- 修改过后正确的命令
# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py # python3.8 get-pip.py # 因为事实上我一开始就没注意到这个问题,所以产生很多问题都是挨着来解决的 # 我不确定上面这两行能否解决未成功安装pip这个问题 # 如果查询pip版本显示没有pip模块,大概率是要重新走一遍下面的路的 # 查询pip版本命令 # python3.8 -m pip --version sudo apt-get install build-essential libssl-dev libffi-dev python-dev-is-python3
2.4 忽略了未生效的命令之后,后续报错解决(参考文章的所有步骤都已走完)
- 原文中有问题的命令
sudo apt-get install -y python3-pip #pip安装 sudo apt-get install build-essential libssl-dev libffi-dev python-dev #环境安装
2.4.1 sudo apt-get install build-essential libssl-dev libffi-dev python-dev
- sudo apt-get install build-essential libssl-dev libffi-dev python-dev执行后会显示如下信息,python-dev改名了,现在叫python-dev-is-python3
┌──(kali㉿kali)-[/usr/bin] └─$ sudo apt-get install build-essential libssl-dev libffi-dev python-dev [sudo] password for kali: Sorry, try again. [sudo] password for kali: Reading package lists... Done Building dependency tree... Done Reading state information... Done Package python-dev is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: python2 python2-dev python-dev-is-python3 E: Package 'python-dev' has no installation candidate
- 重装python-dev-is-python3
sudo apt-get install build-essential libssl-dev libffi-dev python-dev-is-python3
2.4.2 sudo apt-get install -y python3-pip
- sudo apt-get install -y python3-pip执行后会显示如下信息,事实上就是python3-pip没装上
┌──(kali㉿kali)-[~/Softwares/Python-3.8.16] └─$ sudo apt-get install -y python3-pip [sudo] password for kali: Reading package lists... Done Building dependency tree... Done Reading state information... Done python3-pip is already the newest version (24.0+dfsg-2). python3-pip set to manually installed. The following packages were automatically installed and are no longer required: cgroupfs-mount containerd libintl-perl libintl-xs-perl libmodule-find-perl libmodule-scandeps-perl libproc-processtable-perl libsort-naturally-perl needrestart Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 813 not upgraded. 0更新,0新安装,0被移除,813没有被更新
- 继续安装ciphey的报错,显示没有pip3这个模块
┌──(kali㉿kali)-[~/Softwares/Python-3.8.16] └─$ python38 -m pip3 install -U ciphey /usr/bin/python38: No module named pip3
- 查询python3.8的pip版本也会显示没有pip这个模块
┌──(kali㉿kali)-[~/Softwares/Python-3.8.16] └─$ python38 -m pip --version /usr/bin/python38: No module named pip
- 陷入沉思,没有pip那就安装pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python38 get-pip.py
- 报错来喽
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/ Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping ERROR: Could not find a version that satisfies the requirement pip (from versions: none) ERROR: No matching distribution found for pip
- 看不懂,交给了ai帮我分析了一下
- 模块不可用:错误信息中多次提到了 ssl module in Python is not available 和 Can’t connect to HTTPS URL because the SSL module is not available. 这表明你的 Python 环境中缺少 SSL 模块,这通常是因为 Python 没有编译时链接到 OpenSSL 库。
- 网络连接问题:由于缺少 SSL 模块,你的 Python 环境无法建立安全的 HTTPS 连接,导致无法从 PyPI 下载 pip。
- 确认 ssl 模块:由于你的报错信息中提到了 SSL 模块不可用,确保 Python 3.8 有 ssl 模块。运行命令检查后发现确实没有SSL模块。
┌──(kali㉿kali)-[~/Softwares/Python-3.8.16] └─$ python38 -c "import ssl; print(ssl)" Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/kali/Softwares/Python-3.8.16/Lib/ssl.py", line 98, in <module> import _ssl # if we can't import it, let the error propagate ModuleNotFoundError: No module named '_ssl'
- 重新编译 Python,如果 Python 3.8 是从源代码安装的,并且没有正确链接 OpenSSL,你可能需要重新编译 Python,然后按照编译说明进行操作,确保在编译时链接到 OpenSSL:
./configure --with-ssl make sudo make install
- 全部执行完毕后出了个橙色警告,但使用上好像也没遇到啥问题
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
- 安装pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python38 get-pip.py
- 一堆橙色警告,但是successfully啦
WARNING: The script wheel is installed in '/home/kali/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The scripts pip, pip3 and pip3.8 are installed in '/home/kali/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed pip-24.0 wheel-0.43.0 [notice] A new release of pip is available: 22.0.4 -> 24.0 [notice] To update, run: pip3 install --upgrade pip
- 查询pip版本
┌──(kali㉿kali)-[~/Softwares/Python-3.8.16] └─$ python38 -m pip --version pip 24.0 from /home/kali/.local/lib/python3.8/site-packages/pip (python 3.8)
2.5 安装2
- cmd中敲(不用进管理员模式)
python38 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ciphey
- 如果只敲下面的命令,会报错哦,因为下载速度太慢了
python3 -m pip install -U ciphey
- 报错信息,网络连接问题,连接超时
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa3c9f63e80>, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)')': /packages/0e/72/a3add0e4eec4eb9e2569554f7c70f4a3c27712f40e3284d483e88094cc0e/langdetect-1.0.9.tar.gz Downloading langdetect-1.0.9.tar.gz (981 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━ 614.4/981.5 kB 4.7 kB/s eta 0:01:19 ERROR: Exception: Traceback (most recent call last): File "/home/kali/.local/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py", line 438, in _error_catcher yield File "/home/kali/.local/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py", line 561, in read data = self._fp_read(amt) if not fp_closed else b"" File "/home/kali/.local/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py", line 527, in _fp_read return self._fp.read(amt) if amt is not None else self._fp.read() File "/home/kali/.local/lib/python3.8/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 98, in read data: bytes = self.__fp.read(amt) File "/home/kali/Softwares/Python-3.8.16/Lib/http/client.py", line 459, in read n = self.readinto(b) File "/home/kali/Softwares/Python-3.8.16/Lib/http/client.py", line 503, in readinto n = self.fp.readinto(b) File "/home/kali/Softwares/Python-3.8.16/Lib/socket.py", line 669, in readinto return self._sock.recv_into(b) File "/home/kali/Softwares/Python-3.8.16/Lib/ssl.py", line 1241, in recv_into return self.read(nbytes, buffer) File "/home/kali/Softwares/Python-3.8.16/Lib/ssl.py", line 1099, in read return self._sslobj.read(len, buffer) socket.timeout: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper status = run_func(*args) File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 245, in wrapper return func(self, options, args) File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 377, in run requirement_set = resolver.resolve( File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve result = self._result = resolver.resolve( File "/home/kali/.local/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve state = resolution.resolve(requirements, max_rounds=max_rounds) File "/home/kali/.local/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 427, in resolve failure_causes = self._attempt_to_pin_criterion(name) File "/home/kali/.local/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 239, in _attempt_to_pin_criterion criteria = self._get_updated_criteria(candidate) File "/home/kali/.local/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 230, in _get_updated_criteria self._add_to_criteria(criteria, requirement, parent=candidate) File "/home/kali/.local/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 173, in _add_to_criteria if not criterion.candidates: File "/home/kali/.local/lib/python3.8/site-packages/pip/_vendor/resolvelib/structs.py", line 156, in __bool__ return bool(self._sequence) File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__ return any(self) File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr> return (c for c in iterator if id(c) not in self._incompatible_ids) File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 47, in _iter_built candidate = func() File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 182, in _make_candidate_from_link base: Optional[BaseCandidate] = self._make_base_candidate_from_link( File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 228, in _make_base_candidate_from_link self._link_candidate_cache[link] = LinkCandidate( File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 290, in __init__ super().__init__( File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 156, in __init__ self.dist = self._prepare() File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 222, in _prepare dist = self._prepare_distribution() File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 301, in _prepare_distribution return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True) File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 525, in prepare_linked_requirement return self._prepare_linked_requirement(req, parallel_builds) File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 596, in _prepare_linked_requirement local_file = unpack_url( File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 168, in unpack_url file = get_http_url( File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 109, in get_http_url from_path, content_type = download(link, temp_dir.path) File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/network/download.py", line 147, in __call__ for chunk in chunks: File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/cli/progress_bars.py", line 53, in _rich_progress_bar for chunk in iterable: File "/home/kali/.local/lib/python3.8/site-packages/pip/_internal/network/utils.py", line 63, in response_chunks for chunk in response.raw.stream( File "/home/kali/.local/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py", line 622, in stream data = self.read(amt=amt, decode_content=decode_content) File "/home/kali/.local/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py", line 587, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "/home/kali/Softwares/Python-3.8.16/Lib/contextlib.py", line 131, in __exit__ self.gen.throw(type, value, traceback) File "/home/kali/.local/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py", line 443, in _error_catcher raise ReadTimeoutError(self._pool, None, "Read timed out.") pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
- 又是一堆橙色警告,但是successfully啦
WARNING: The script cmark is installed in '/home/kali/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script pygmentize is installed in '/home/kali/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script pyflakes is installed in '/home/kali/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script pycodestyle is installed in '/home/kali/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The scripts isort and isort-identify-imports are installed in '/home/kali/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script base58 is installed in '/home/kali/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script flake8 is installed in '/home/kali/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The scripts epylint, pylint, pylint-config, pyreverse and symilar are installed in '/home/kali/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The scripts name-that-hash and nth are installed in '/home/kali/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The scripts pywhat and what are installed in '/home/kali/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script ciphey is installed in '/home/kali/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed appdirs-1.4.4 astroid-2.15.8 base58-2.1.1 base91-1.0.1 ciphey-5.14.0 cipheycore-0.3.2 cipheydists-0.3.35 click-7.1.2 colorama-0.4.6 commonmark-0.9.1 dill-0.3.8 flake8-3.9.2 isort-5.13.2 langdetect-1.0.9 lazy-object-proxy-1.10.0 loguru-0.5.3 mccabe-0.6.1 mock-4.0.3 name_that_hash-1.10.0 platformdirs-4.2.1 pybase62-0.4.3 pycodestyle-2.7.0 pyflakes-2.3.1 pygments-2.18.0 pylint-2.17.7 pywhat-1.1.0 pyyaml-5.4.1 rich-10.16.2 six-1.16.0 tomli-2.0.1 tomlkit-0.12.5 typing-extensions-4.11.0 wrapt-1.16.0
- 完结,可以正常使用了
- 使用指南
python38 -m ciphey --help python38 -m ciphey -t "密文" python38 -m ciphey -f 文件名
- 举俩栗子
python38 -m ciphey -t "aGVsbG8gbXkgbmFtZSBpcyBiZWU="
python38 -m ciphey -t "4O595954494Q32515046324757595N534R52415653334357474R4N575955544R4O5N4Q46434S4O59474253464Q5N444R4Q51334557524O5N4S424944473542554O595N44534O324R49565746515532464O49345649564O464R4R494543504N35"