当前位置: 编程技术>移动开发
本页文章导读:
▪wireshark 怎么写过滤规则 wireshark 如何写过滤规则
一、IP过滤:包括来源IP或者目标IP等于某个IP
比如:ip.src addr==192.168.0.208 or ip.src addr eq 192.168.0.208 显示来源IP
ip.dst addr==192.168.0.208 or ip.dst addr eq 192.168.0.208 显示.........
▪ lbs计算二点距离 lbs计算2点距离
/** * 计算两点距离 */public class GeoTool { /** * */ private static final double EARTH_RADIUS = 6378.137; /*** * 计算两点间的距离 * @param lat1 * @param lon1 * @param lat2 * @param lon2 * @ret.........
▪ 判断字符串是不是全是数字 判断字符串是否全是数字
//判断字符串是否是数字(0.0) public boolean isNumeric(String str) { if(str == null || str.equals("")) { return false; } char[] p = str.toCharArray(); for (int i = 0; i < p.length; i++) { .........
[1]wireshark 怎么写过滤规则
来源: 互联网 发布时间: 2014-02-18
wireshark 如何写过滤规则
一、IP过滤:包括来源IP或者目标IP等于某个IP
比如:ip.src addr==192.168.0.208 or ip.src addr eq 192.168.0.208 显示来源IP
ip.dst addr==192.168.0.208 or ip.dst addr eq 192.168.0.208 显示目标IP
二、端口过滤:
比如:tcp.port eq 80 // 不管端口是来源的还是目标的都显示
tcp.port == 80
tcp.port eq 2722
tcp.port eq 80 or udp.port eq 80
tcp.dstport == 80 // 只显tcp协议的目标端口80
tcp.srcport == 80 // 只显tcp协议的来源端口80
过滤端口范围
tcp.port >= 1 and tcp.port <= 80
三、协议过滤:tcp
udp
arp
icmp
http
smtp
ftp
dns
msnms
ip
ssl
等等
排除ssl包,如!ssl 或者 not ssl
四、包长度过滤:
比如:
udp.length == 26 这个长度是指udp本身固定长度8加上udp下面那块数据包之和
tcp.len >= 7 指的是ip数据包(tcp下面那块数据),不包括tcp本身
ip.len == 94 除了以太网头固定长度14,其它都算是ip.len,即从ip本身到最后
frame.len == 119 整个数据包长度,从eth开始到最后
五、http模式过滤:
例子:
http.request.method == “GET”
http.request.method == “POST”
http.request.uri == “/img/logo-edu.gif”
http contains “GET”
http contains “HTTP/1.”
// GET包
http.request.method == “GET” && http contains “Host: ”
http.request.method == “GET” && http contains “User-Agent: ”
// POST包
http.request.method == “POST” && http contains “Host: ”
http.request.method == “POST” && http contains “User-Agent: ”
// 响应包
http contains “HTTP/1.1 200 OK” && http contains “Content-Type: ”
http contains “HTTP/1.0 200 OK” && http contains “Content-Type: ”
一定包含如下
Content-Type:
六、连接符 and / or
七、表达式:!(arp.src=/blog_article/=19268.1) and !(arp.dst.proto_ipv4==192.168.1.243)
参考资料: http://www.0x50sec.org/category/hack-tools/
[2] lbs计算二点距离
来源: 互联网 发布时间: 2014-02-18
lbs计算2点距离
/**
* 计算两点距离
*/
public class GeoTool {
/**
*
*/
private static final double EARTH_RADIUS = 6378.137;
/***
* 计算两点间的距离
* @param lat1
* @param lon1
* @param lat2
* @param lon2
* @return
*/
public static double getPointDistance(double lat1, double lon1, double lat2, double lon2) {
double result = 0;
double radLat1 = radian(lat1);
double ratlat2 = radian(lat2);
double a = radian(lat1) - radian(lat2);
double b = radian(lon1) - radian(lon2);
result = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2)
+ Math.cos(radLat1) * Math.cos(ratlat2)
* Math.pow(Math.sin(b / 2), 2)));
result = result * EARTH_RADIUS;
result = Math.round(result * 1000);
return result;
}
// 转换为弧度
private static double radian(double d) {
return (d * Math.PI) / 180.00;
}
/**
* 获取geoHash
* @param lat
* @param lon
* @return
*/
public static String geoHash(double lat,double lon){
return Geohash.encode(lat, lon);
}
}
/**
* 计算两点距离
*/
public class GeoTool {
/**
*
*/
private static final double EARTH_RADIUS = 6378.137;
/***
* 计算两点间的距离
* @param lat1
* @param lon1
* @param lat2
* @param lon2
* @return
*/
public static double getPointDistance(double lat1, double lon1, double lat2, double lon2) {
double result = 0;
double radLat1 = radian(lat1);
double ratlat2 = radian(lat2);
double a = radian(lat1) - radian(lat2);
double b = radian(lon1) - radian(lon2);
result = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2)
+ Math.cos(radLat1) * Math.cos(ratlat2)
* Math.pow(Math.sin(b / 2), 2)));
result = result * EARTH_RADIUS;
result = Math.round(result * 1000);
return result;
}
// 转换为弧度
private static double radian(double d) {
return (d * Math.PI) / 180.00;
}
/**
* 获取geoHash
* @param lat
* @param lon
* @return
*/
public static String geoHash(double lat,double lon){
return Geohash.encode(lat, lon);
}
}
[3] 判断字符串是不是全是数字
来源: 互联网 发布时间: 2014-02-18
判断字符串是否全是数字
//判断字符串是否是数字(0.0)
public boolean isNumeric(String str) {
if(str == null || str.equals("")) {
return false;
}
char[] p = str.toCharArray();
for (int i = 0; i < p.length; i++) {
System.out.println("--"+p[i]);
if(!isNum(""+p[i])) {
return false;
}
}
return true;
}
private boolean isNum(String str) {
Pattern pattern = Pattern.compile("[0-9.]*");
Matcher isNum = pattern.matcher(str);
if (!isNum.matches()) {
return false;
}
return true;
}
//判断字符串是否是数字(0.0)
public boolean isNumeric(String str) {
if(str == null || str.equals("")) {
return false;
}
char[] p = str.toCharArray();
for (int i = 0; i < p.length; i++) {
System.out.println("--"+p[i]);
if(!isNum(""+p[i])) {
return false;
}
}
return true;
}
private boolean isNum(String str) {
Pattern pattern = Pattern.compile("[0-9.]*");
Matcher isNum = pattern.matcher(str);
if (!isNum.matches()) {
return false;
}
return true;
}
最新技术文章: