Java实现WinPcap+Wireshark数据抓包模拟联通客户端签到功能

本编博客通过WinPcap+Wireshark进行无线网络抓包,获取基本信息,进而模拟其他用户的app请求。

本编博客主要学习交流,其次告诉广大网友切勿贪小便宜使用未知WiFi。

读者们首先需要下载并安装WinPcap和Wireshark,安装Wireshark之前必须安装winPcap,可以通过官网下载:

        Wireshark :https://www.wireshark.org/download.html

        WinPcap:http://www.winpcap.org/install/

1、安装成功之后,使用360WiFi、猎豹WiFi等开放自己的WiFi,打开Wireshark监测自己的无线网络


2、使用接入WIFI的设备,这时将捕获到设备操作信息。


通过捕获到的数据包,可以查询通讯的协议protocol、请求的信息request以及响应信息response等

3、通过前两步,能过查询数据信息,接下来模拟一个客户端,以联通签到领金币为例,使用java实现,相关jar包及说明http://blog.csdn.net/myfmyfmyfmyf/article/details/46860025

package com;

import java.io.IOException;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.CookieStore;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

/**
 * 
 * 
 * @author muyunfei
 * @qq  1147417467
 * <p>Modification History:</p> 
 * <p>Date       Author      Description</p>
 * <p>------------------------------------------------------------------</p>
 * <p>Oct 9, 2016           牟云飞       		 新建</p>
 */
public class BugMain_chinaUnicom {
	
	public static  CookieStore cookieStore = null;
	
	public static void main(String[] args) {
		try{
			 HttpClient httpclient = HttpClients.createDefault();
			 HttpPost httpPost= new HttpPost("http://m.client.10010.com/SigninApp/signin/signInNow.htm");
//			 httpPost.setHeader("Cookie", "*****************0");
			 httpPost.setHeader("Cookie","**************");
			 httpPost.setHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36");
			 httpPost.setHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
			 httpPost.setHeader("Host","m.client.10010.com");
			 httpPost.setHeader("Proxy-Connection","keep-alive");
			 // Create a custom response handler
			 ResponseHandler<String> responseHandler = new ResponseHandler<String>() {
				//成功调用连接后,对返回数据进行的操作
	            public String handleResponse(
	                    final HttpResponse response) throws ClientProtocolException, IOException {
	                int status = response.getStatusLine().getStatusCode();
	                if (status >= 200 && status < 300) {
	                	//获得调用成功后  返回的数据
	                    HttpEntity entity = response.getEntity();
	                    if(null!=entity){
	                    	String result= EntityUtils.toString(entity);
	                    	System.out.println(result);
	                    	return result;
	                    }else{
	                    	return null;
	                    }
	                } else {
	                    throw new ClientProtocolException("Unexpected response status: " + status);
	                }
	            }
	
	        };
	      //返回的json对象
	        String responseBody = httpclient.execute(httpPost, responseHandler);
	        System.out.println(responseBody);
		}catch (Exception e) {
			e.printStackTrace();
		}
	}

}
调用结果:






  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

牟云飞

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值