close

用 curl 登入

設定user agent 為 Mozilla/5.0
agent="Mozilla/5.0"

-A 指定user agent
-d 附帶參數
-c write cookie
-b 使用特定cookie
-o 輸出檔案

curl -A $agent -d "lang=English" -c "/tmp/.cookie.txt" http://192.168.199.123/ -o index.php
curl -A $agent -d "username=administrator&password=test1234" -b /tmp/.cookie.txt http://192.168.199.123//index.php?op=login -o index.php


用 curl 上傳檔案

-H 指定header 這邊要讓Expect 為空 是因為lighthttpd 版本低於 1.5.XXX的時候 不能辨識Expect: 100
-F 指定上傳檔名 檔名前要有@
--form 指定 form value


curl -A $agent -b /tmp/.cookie.txt -H "Expect:" --form "op=up" --form "type=1" -F "file=@test.zip" http://192.168.199.123/upload.php?type=test



ref:
1. http://curl.netmirror.org/docs/httpscripting.html
2. http://my-web-design.blogspot.com/2008/11/curl.html


全站熱搜
創作者介紹
創作者 coolkevin 的頭像
coolkevin

about my life

coolkevin 發表在 痞客邦 留言(0) 人氣()