天天看點

Sqlmap遠端連接配接Mysql,報錯(2003)

環境:Windows,Kali linux。

工具:Sqlmap,Mysql,PyMySQL。

使用sqlmap連接配接本地mysql時報錯,檢查發現少個python庫PyMySQL,github上有最新下載下傳,

解壓PyMySQL-master,

安裝執行python setup.py install,

重新開機下mysql服務,

sqlmap目錄下執行

<span style="font-size:18px;">python sqlmap.py -d mysql://root:[email protected]:3306/mysql</span>
           

搞定!繼續測試遠端是否可用,繼續無法連接配接(10061),關閉防火牆繼續嘗試,還是失敗。最終找到問題:Kali中Mysql通路權限問題。

<span style="font-size:18px;">[email protected]:~# cd /etc/mysql/mysql.conf.d/
[email protected]:/etc/mysql/mysql.conf.d# ls
mysqld.cnf  mysqld_safe_syslog.cnf   :q
<span style="color:#ff0000;">[email protected]:/etc/mysql/mysql.conf.d# vi mysqld.cnf</span> </span>
           
</pre><p></p><p><span style="font-size:18px;"><span style="white-space:pre">	</span>找到這一行,将最後一行注釋掉。</span></p><p></p><pre name="code" class="html"><span style="font-size:18px;"># Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address           = 127.0.0.1
</span>
           

:wq儲存退出,接着修改權限。

登陸mysql

<span style="font-size:18px;color:#ff0000;">grant all on *.* to 使用者名@"%" identified by "密碼"
</span>
           
<pre name="code" class="html"><pre name="code" class="html"><span style="font-size:18px;"><span style="color:#ff0000;">flush privileges;</span>
exit</span>
           

重新開機下mysql

service mysql restart
           

最後測試下

python sqlmap.py -d mysql://root:[email protected]:3306/mysql
           

搞定!