用於登陸後的資訊收集爬蟲

2021-07-22 14:35:48 字數 1388 閱讀 9306

有時候我們需要的使用者資訊是要通過使用者登入後得到,這些資訊其實也可以通過爬蟲獲得。

本demo中用到的2個外部庫 org.jsoup,jxl(用於寫excel),

同樣以中南財經政法大學教務處學生個人資訊系統為例:

接下來就是檢視網頁原始碼,即找到傳遞賬號密碼的目的位址

登陸進去後檢視所需調轉的網頁位址

(我這次是為了得到課表,所以進入的是課表的網頁)

接下來就是定位所需的內容

接下來就是po出源**

首先是遠端登陸的**:

public static string login(string xh,string pwd) throws ioexception

接下來是主函式:

public

static

void

main(string args) throws ioexception, biffexception, writeexception

;string str1=;

for(int i=0;i<5;i++)

sheet.addcell(new label(0,i+1,str1[i]));

for(int j=0;j<7;j++)

sheet.addcell(new label(j+1,0,str[j]));

for(int i=0;i<5;i++)

sheet.addcell(new label(j+1,i+1,sbuffer.tostring()));

m++;}}

book.write();

book.close();

}

po出結果圖:

有人可能會說為什麼我自己進行登入的時候是需要驗證碼的。但是我在這裡並沒有進行驗證碼的輸入,因為學校比較low.做的是前端驗證碼。如果遠端登入直接掛伺服器的話就可以繞過前端,樓主曾試過暴力破解別人的學生資訊密碼,就是不停地迴圈迭代,(密碼只有6位),8g記憶體的筆記本,2個半小時就得到了密碼。

curl登陸後模擬登陸並訪問登陸後的頁面

header content type textml charset utf 8 採集的資訊需要先登入的就要先模擬登入 設定cookie儲存路徑 cookie path ch curl init 組裝使用者名稱和密碼 info username 141391000914 info password ...

使用php的curl爬取登陸後的資訊

1 curl初始化 ch curl init 2 設定post資料 data array post xuehao 13110572068 3 設定請求的url curl setopt ch,curlopt url,4 設定請求的引數 curl setopt ch,curlopt post,1 cur...

用於讀取爬蟲後的檔案

coding utf 8 created on 2014 7 24 author administrator import urllib2 from urllib2 import request import re import sys def p f print s.s s f.module f....