CTF-Crypto工具推荐:Ciphey安装教程(支持Windows和Kali,多版本Python)
嘿,这里是目录!
0. 前言
1. window10环境安装ciphey【简单一点】
1.1 检查环境
- 检查python是不是3.7或者3.8版本的?不是用不了
python --version
- 检查python是否是64位的版本1?不是用不了
python
import platform
platform.architecture()
- 如果两者都满足,恭喜你具备安装条件了,开始安装
1.2 我的环境
1.3 安装23
pip install ciphey -i https://pypi.mirrors.ustc.edu.cn/simple/
..\python安装的路径\Lib\site-packages\pywhat\regex_identifier.py
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:
ciphey --help
ciphey -t "密文"
ciphey -f 文件名
ciphey -t "aGVsbG8gbXkgbmFtZSBpcyBiZWU="
ciphey -t "4O595954494Q32515046324757595N534R52415653334357474R4N575955544R4O5N4Q46434S4O59474253464Q5N444R4Q51334557524O5N4S424944473542554O595N44534O324R49565746515532464O49345649564O464R4R494543504N35"
1.4 头铁的报错
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版本的?
cd /usr/bin/
ll python*
- 悬着的心终于死了,确实不是python3.7或者python3.8,也不用检查python是否是64位的版本了,现在的环境反正也装不了
2.2 我的环境
2.3 环境改造
- 没有就造一个python3.8的环境,查找相关资料,如何在linux环境中安装不同版本的python
# 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
sudo apt-get install build-essential libssl-dev libffi-dev python-dev-is-python3
2.4.2 sudo apt-get install -y 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没有被更新
┌──(kali㉿kali)-[~/Softwares/Python-3.8.16]
└─$ python38 -m pip3 install -U ciphey
/usr/bin/python38: No module named pip3
┌──(kali㉿kali)-[~/Softwares/Python-3.8.16]
└─$ python38 -m pip --version
/usr/bin/python38: No module named 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
┌──(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'
./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
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python38 get-pip.py
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
┌──(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
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.
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"
-
两种方法判断Python的位数是32位还是64位 ↩︎
-
【密码学工具】Ciphey和WinDecrypto的使用随笔 ↩︎ ↩︎
-
CTF-Crypto必备自动解密神器python-Ciphey(详细安装介绍) ↩︎
-
自动解密神器Ciphey ↩︎
作者:清梦daydream