hack the box ~魔法使いへの道~ (その5) PythonでRDPブルートフォースアタック①



セキュリティに関する知識は,現代社会においてますます重要性を増しています.それに伴い,セキュリティに関する技術もますます需要が高まっています.その中でも,ホワイトハッカーとしてのスキルは,現代のエンジニアにとって非常に重要なものとなっています.本記事では,Pythonを使ったセキュリティの学習を目的として,Hack the Boxでブルートフォースアタックを学ぶ方法について解説します.



Hack the Boxとは

Hack the Boxは,ホワイトハッカーを目指したエンジニアのための,実践的なセキュリティ学習プラットフォームです.Hack the Boxでは,仮想マシンに対する攻撃や,Webサイトに対する攻撃など,様々な攻撃シナリオが用意されており,エンジニアは自由に攻撃を行い,セキュリティのスキルを磨くことができます.

Hack the BoxをやるためのPCの設定方法はこちら




Hack the Boxでブルートフォースアタックを行うためには,まずPythonの環境を構築する必要があります.Pythonは,ブルートフォースアタックにおいて非常に便利な言語であり,Hack the Boxでも広く使用されています.Pythonの環境構築には,AnacondaやMinicondaなどのツールが利用できます.






└─$ sudo sh ./Miniconda3-latest-Linux-x86_64.sh -u
[sudo] maki のパスワード:

Welcome to Miniconda3 py39_4.12.0

In order to continue the installation process, please review the license
Please, press ENTER to continue
End User License Agreement - Miniconda

Copyright 2015-2022, Anaconda, Inc.

All rights reserved under the 3-clause BSD License:

This End User License Agreement (the "Agreement") is a legal agreement between you and Anaconda, Inc. ("Anaconda") and governs your use of Miniconda.

Subject to the terms of this Agreement, Anaconda hereby grants you a non-exclusive, non-transferable license to:

  * Install and use the Miniconda,
  * Modify and create derivative works of sample source code delivered in Miniconda subject to the Terms of Service for the Repository (as defined hereinafter) available at https://www.anaconda.com/terms-of-service, and
  * Redistribute code files in source (if provided to you by Anaconda as source) and binary forms, with or without modification subject to the requirements set forth below.

Anaconda may, at its option, make available patches, workarounds or other updates to Miniconda. Unless the updates are provided with their separate governing terms, they are deemed part of Miniconda licensed to you as provided in t
his Agreement. This Agreement does not entitle you to any support for Miniconda.

Anaconda reserves all rights not expressly granted to you in this Agreement.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  * Neither the name of Anaconda nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

You acknowledge that, as between you and Anaconda, Anaconda owns all right, title, and interest, including all intellectual property rights, in and to Miniconda and, with respect to third-party products distributed with or through 
Miniconda, the applicable third-party licensors own all right, title and interest, including all intellectual property rights, in and to such products. If you send or transmit any communications or materials to Anaconda suggesting 
or recommending changes to the software or documentation, including without limitation, new features or functionality relating thereto, or any comments, questions, suggestions or the like ("Feedback"), Anaconda is free to use such 

Do you accept the license terms? [yes|no]
[no] >>> yes

Miniconda3 will now be installed into this location:

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/root/miniconda3] >>> 
Unpacking payload ...
Collecting package metadata (current_repodata.json): done                                                                                                                                                                              
Solving environment: done

# All requested packages already installed.

installation finished.
Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
[no] >>> yes
no change     /root/miniconda3/condabin/conda
no change     /root/miniconda3/bin/conda
no change     /root/miniconda3/bin/conda-env
no change     /root/miniconda3/bin/activate
no change     /root/miniconda3/bin/deactivate
no change     /root/miniconda3/etc/profile.d/conda.sh
no change     /root/miniconda3/etc/fish/conf.d/conda.fish
no change     /root/miniconda3/shell/condabin/Conda.psm1
no change     /root/miniconda3/shell/condabin/conda-hook.ps1
no change     /root/miniconda3/lib/python3.9/site-packages/xontrib/conda.xsh
no change     /root/miniconda3/etc/profile.d/conda.csh
no change     /root/.zshrc
No action taken.
If you'd prefer that conda's base environment not be activated on startup, 
   set the auto_activate_base parameter to false: 

conda config --set auto_activate_base false

Thank you for installing Miniconda3!





Unpacking payload ... concurrent.futures.process._RemoteTraceback: ''' Traceback (most recent call last): File "concurrent/futures/process.py", line 368, in _queue_management_worker File "multiprocessing/connection.py", line 251, in recv TypeError: __init__() missing 1 required positional argument: 'msg' '''




「sudo su」でrootに入ると(base)の仮想環境に入ることができます.

└─$ sudo su                                       
(base) ┌──(root㉿kali)-[/home/maki/Downloads]




  • *1:Miniconda — Conda documentation
  • *2:Anacondaのインストールに失敗しMinicondaを入れた話