资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

java抓包代码下载,Java程序包

急需Wireshark抓包软件的Java API

wireshark是基于winpcap或者libpcap的应用软件。如果你想自己开发抓包类的,应该用winpcap的api之类的。winpcap网站上faq提到这个问题了

五指山ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:028-86922220(备注:SSL证书合作)期待与您的合作!

Q-12: Does WinPcap work with Java?

A: We do not directly support Java. However you can find a Java wrapper at netresearch.ics.uci.edu/kfujii/jpcap/doc/index.html 和 jnetpcap.com /.

java程序 求抓包程序源代码!!

package com.daidai.util;

import org.hibernate.Session;

import org.hibernate.SessionFactory;

import org.hibernate.cfg.Configuration;

public class HibernateUtil {

private static SessionFactory sessionFactory;

public static SessionFactory getSessionFactory() {

Configuration conf=new Configuration().configure();

sessionFactory=conf.buildSessionFactory();

return sessionFactory;

}

public static void setSessionFactory(SessionFactory sessionFactory) {

HibernateUtil.sessionFactory = sessionFactory;

}

public static Session getSession(){

return sessionFactory.openSession();

}

}

package com.daidai.util;

import java.io.File;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.IOException;

import java.io.InputStreamReader;

import java.io.UnsupportedEncodingException;

import jxl.Cell;

import jxl.Sheet;

import jxl.Workbook;

import jxl.write.WritableSheet;

import jxl.write.WritableWorkbook;

public class Util {

private static String Cellphone_Number;

private static String Cellphone_Number1;

private static String Cellphone_Number2;

private static String Fasten_Telephone;

private static String Fasten_Telephone2;

private static String name;

private static String remarks;

public static Sheet rs;

public Util(){}

static{

try{

Workbook rwb=Workbook.getWorkbook(new File("Book1.xls"));

rs=rwb.getSheet(0);

int count=rs.getColumns();

System.out.println(count);

int count1=rs.getRows();

System.out.println(count1);

//获取第一行,第一列的值

//count1行

//count列

for(int i=0;icount1;i++){

for(int j=0;jcount;j++){

Cell c00 = rs.getCell(j, i);

String strc00 = c00.getContents();

//获取第一行,第二列的值

Cell c10 = rs.getCell(1, 0);

String strc10 = c10.getContents();

System.out.println(strc00);

System.out.println(strc10);

}

}

}catch(Exception e){

e.printStackTrace();

}

}

public static void main(String[]args){

Util u=new Util();

}

}

?xml version='1.0' encoding='utf-8'?

!DOCTYPE hibernate-configuration PUBLIC

"-//Hibernate/Hibernate Configuration DTD 3.0//EN"

""

hibernate-configuration

session-factory

property name="connection.driver_class"

com.mysql.jdbc.Driver/property

property name="connection.url"

jdbc:mysql://127.0.0.1:3306/test/property

property name="connection.username"

root/property

property name="connection.password"

daidai/property

!-- SQL dialect 数据库方言--

property name="dialect"

org.hibernate.dialect.MySQLDialect/property

!-- Echo all executed SQL to stdout --

property name="show_sql"true/property

property name="hbm2ddl.auto"create/property

mapping resource="User.hbm.xml"/

/session-factory

/hibernate-configuration

?xml version="1.0" encoding="utf-8"?

!DOCTYPE hibernate-mapping PUBLIC

"-//Hibernate/Hibernate Mapping DTD 3.0//EN"

""

hibernate-mapping package="com.daidai.entity"

class name="User" table="t_user"

id name="id"

generator class="native"/

/id

property name="name" type="java.lang.String" length="15"/

property name="Cellphone_Number" type="java.lang.String" length="11"/

property name="Cellphone_Number1" type="java.lang.String" length="11"/

property name="Cellphone_Number2" type="java.lang.String" length="11"/

property name="Fasten_Telephone" type="java.lang.String" length="11"/

property name="Fasten_Telephone2" type="java.lang.String" length="11"/

property name="remarks" type="java.lang.String"/

/class

/hibernate-mapping

package com.daidai.dao.impl;

import com.daidai.util.*;

import org.hibernate.HibernateException;

import org.hibernate.Session;

import com.daidai.dao.UserDAO;

import com.daidai.entity.User;

public class UserDAOImpl implements UserDAO {

public Session session=null;

public void save(User user) {

try {

session=HibernateUtil.getSession();

session.getTransaction().begin();

session.save(user);

session.getTransaction().commit();

} catch (HibernateException e) {

session.getTransaction().rollback();

e.printStackTrace();

throw e;

}

}

}

package com.daidai.dao;

import com.daidai.entity.User;

public interface UserDAO {

public void save(User user);

}

java 抓取网站下的所有网页。代码

贴的代码格式全乱了,我传了个附件。

里面的网址匹配还不完美,可以改进。

欢迎探讨。

如何可以用java实现后台抓包,然后提取想要的包

jPCAP在JAVA中,并非一个真正去实现对数据链路层的控制,而是一个中间件,JPCAP调用winpcap/libpcap,给JAVA语言提供一个公共的接口,从而实现了平台无关性。

如何通过抓包工具fiddler获取java程序的http请求

firefox的fidder插件 Java程序需要设置proxy才能生效:

String url="url address";

Proxy proxy = new Proxy(java.net.Proxy.Type.HTTP,new InetSocketAddress("127.0.0.1", 8888));

URL serverUrl = new URL(url);

HttpURLConnection conn = (HttpURLConnection) serverUrl.openConnection(proxy);

以下是完整参考代码:

package com.http;

import java.io.BufferedReader;

import java.io.InputStreamReader;

import java.net.HttpURLConnection;

import java.net.InetSocketAddress;

import java.net.Proxy;

import java.net.URL;

public class Http302Redirect {

public static void main(String[] args) {

try {

String url = "http 你的地址";

System.out.println("访问地址:" + url);

Proxy proxy = new Proxy(java.net.Proxy.Type.HTTP,

new InetSocketAddress("127.0.0.1", 8888));

URL serverUrl = new URL(url);

HttpURLConnection conn = (HttpURLConnection) serverUrl

.openConnection(proxy);

conn.setRequestMethod("GET");

conn.addRequestProperty("Accept-Charset", "UTF-8;");

conn.addRequestProperty("User-Agent",

"Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.8) Firefox/3.6.8");

conn.addRequestProperty("Referer", "");

conn.connect();

BufferedReader reader = new BufferedReader(new InputStreamReader(

conn.getInputStream()));

StringBuffer buffer = new StringBuffer();

String line = reader.readLine();

while (line != null) {

buffer.append(line).append("\r\n");

line = reader.readLine();

}

reader.close();

conn.disconnect();

System.out.println(buffer);

} catch (Exception e) {

e.printStackTrace();

}

}

}

java 代码实现下载.doc文件

%@ page contentType="text/html; charset=gb2312" %

%@ page import="java.io.*"%

%!

public String toUtf8String(String s)

{

StringBuffer sb = new StringBuffer();

for (int i=0;is.length();i++) {

char c = s.charAt(i);

if (c = 0 c = 255) {

sb.append(c);

} else {

byte[] b;

try {

b = Character.toString(c).getBytes("utf-8");

} catch (Exception ex) {

System.out.println(ex);

b = new byte[0];

}

for (int j = 0; j b.length; j++) {

int k = b[j];

if (k 0) k += 256;

sb.append("%" + Integer.toHexString(k).

toUpperCase());

}

}

}

return sb.toString();

}

%

%

String filename=new String(request.getParameter("filename").getBytes("ISO8859-1"),"GBK");

String dirName="D:/我.doc";

java.io.File ff=null;

String dd=dirName+System.getProperties().getProperty("file.separator")+filename;

try{

ff=new java.io.File(dd);

}

catch(Exception e){

System.out.println(e.getMessage());

e.printStackTrace();

}

if (ff!=nullff.exists()ff.isFile())

{

long filelength = ff.length();

InputStream inStream=new FileInputStream(dd);

//设置输出的格式

response.reset();

response.setContentType("application/x-msdownload");

response.setContentLength((int)filelength);

response.addHeader("Content-Disposition","attachment; filename=\"" + toUtf8String(filename) + "\"");

//循环取出流中的数据

byte[] b = new byte[100];

int len;

while((len=inStream.read(b)) 0)

response.getOutputStream().write(b,0,len);

inStream.close();

out.clear();

out = pageContext.pushBody();

}

%

:a href="d.jsp"aa/a

上面的那个是用流写的 但是也可以用超链接下载

你写上文件的路径就可以了


文章题目:java抓包代码下载,Java程序包
网站URL:http://cdkjz.cn/article/dsejech.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220