
Python 2.7로 작성된 원격 msfconsole로, metasploit의 msfrcpd 서버에 연결합니다. 이 도구를 사용하면 서버에서 autopwn2처럼 모듈을 데몬으로 영구적으로 로드할 수 있습니다.
이 도구는 더 이상 제가 유지보수하지 않습니다. Rapid7 자체에서 더 나은 대안을 제공하며, 다음과 같이 설명되어 있습니다: Metasploit을 원격으로 실행하는 방법
예시:
metasploit-framework 디렉토리 외부에서 msf 명령어를 사용할 수 있도록 하려면 GEM_HOME 변수를 설정하세요. 필요한 경로를 찾으려면 metasploit-framework 디렉토리로 cd한 후 다음을 실행하세요:
$ rvm gemdir
/usr/local/rvm/gems/ruby-2.5.1@metasploit-framework
$ rvm use 2.5.1@metasploit-framework
Metasploit을 데몬으로 시작하려면 msfd 유틸리티를 실행해야 합니다. 기본적으로 55554 포트에서 열립니다.
$ ./msfd -a 127.0.0.1
데몬에 연결하려면 다음과 같이 netcat을 사용하세요:
$ nc 127.0.0.1 5554
Metasploit의 msfrpcd 서버에 연결하기 위해 Python 2.7로 작성된 원격 msfconsole입니다. 이 도구는 autopwn2처럼 서버에서 모듈을 영구적으로 데몬으로 로드할 수 있는 기능을 제공합니다. msfrpcd 서버를 원격으로 사용할 수 있지만, 인증서 검증이 활성화되어 있지 않으므로 ssh 또는 mosh 셸을 사용하여 로컬에서 사용하는 것이 좋습니다.
[*] Connecting to server:
Host => myDomain.com,
Port => 55553,
User => msf,
Pwd => ***,
SSL => True
[+] Successfully connected
[*] Console id: 19
, ,
/ \
((__---,,,---__))
(_) O O (_)_________
\ _ / |\
o_o \ M S F | \
\ _____ | *
||| WW|||
||| |||
=[ metasploit v4.12.22-dev-52b81f3 ]
+ -- --=[ 1577 exploits - 906 auxiliary - 272 post ]
+ -- --=[ 455 payloads - 39 encoders - 8 nops ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]
msf >
사용법: Main.py [옵션]
Options:
-h, --help show this help message and exit
-r RESOURCE, --resource=RESOURCE
Path to resource file
-u USERNAME, --user=USERNAME
Username specified on msfrpcd
-p PASSWORD, --pass=PASSWORD
Password specified on msfrpcd
-s, --ssl Enable ssl
-P PORT, --port=PORT Port to connect to
-H HOST, --host=HOST Server ip
-c, --credentials Use hardcoded credentials
-e, --exit Exit after executing resource script
-c 옵션을 사용하면 Main.py에 하드코딩된 자격 증명을 사용할 수 있습니다. 매번 자격 증명 매개변수를 사용하지 않아도 되도록 자유롭게 변경하세요.
-r 옵션으로 컴퓨터에서 콘솔로 로드할 리소스 스크립트를 지정합니다.
하드코딩된 자격 증명을 사용하여 리소스 스크립트를 로드합니다:
python Main.py -c -r /root/resource/handler/allHandlers.rc
명령줄 인수를 통해 msfrpcd 서버에 로그인합니다:
python Main.py --ssl --port 55553 --host 127.0.0.1 --user msf --pass msf
먼저 metasploit이 설치되어 있어야 합니다. 그래픽 환경이 없거나 다른 이유로 설치 프로그램을 사용할 수 없는 경우 rapid7의 다음 가이드를 사용하세요: Nightly installers. 다음 명령어로 필요한 모든 의존성을 설치할 수 있습니다:
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \
chmod 755 msfinstall && \
./msfinstall
git clone https://github.com/allfro/pymetasploit.git pymetasploit
cd pymetasploit && sudo python setup.py install
또한 msfrpcd 서버를 시작하는 것을 잊지 마세요:
cd metasploit-framework/
ruby msfrpcd -U msf -P msf -p 55553
그리고 postgresql 데이터베이스를 시작하고 연결하는 것이 좋습니다: 참고로 echo 줄에서 비밀번호를 변경하세요.
sudo update-rc.d postgresql enable
sudo service postgresql start
echo "create database msf;create user msf with password 'password';grant all privileges on database msf to msf;" > createdb_sql.txt
sudo -u postgres /usr/bin/psql < /home/postgres/createdb_sql.txt
Metasploit에서:
db_connect msf:[email protected]/msf