「java模拟ip」java模拟ip欺骗
本篇文章给大家谈谈java模拟ip,以及java模拟ip欺骗对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
- 1、java模拟ip子网划分程序
- 2、ip模拟器到底有什么用?
- 3、JAVA怎么获取IP地址
- 4、java获得IP地址
- 5、像在百度搜索引擎输入IP就能获取到本人的本机IP,如何用java实现?
- 6、IP动态变化功能java如何实现
java模拟ip子网划分程序
选修课吗,这么简单的都不会吗,几十个人都问,你们上课都睡觉的吧。201.99.1.33255.255.255.224201.99.1.65255.255.255.224201.99.1.97255.255.255.224201.99.1.129255.255.255.224201.99.1.161255.255.255.224201.99.1.193255.255.255.224
ip模拟器到底有什么用?
转换IP的功能呀
模拟器你肯定要多开使用
这样相同的IP上游戏肯定是不安全的
所以就需要用到转换IP了
现在可以下、、兔子、窗口。IP
更安全了。
JAVA怎么获取IP地址
这个是获取不到的,因为有代理、端口映射等等转发情况的存在。为什么不保存相对路径/域名/或者在服务器上某个配置文件中配置域名/数据库中一个表/数据库中某个字段保存当前服务器的ip地址呢?
java获得IP地址
下面有一篇文章,介绍若何读取物理网卡的地址 ,同样的
你可以用这个方法读取你所需要的本机IP地址
=======================================================
J2SE5.0新特性之ProcessBuilder
这个例子使用了J2SE5.0的ProcessBuilder类执行外部的程序,相对于 Runtime.exec ,它更方便,可以设置环境变量等。这里使用它在windows下读取物理网卡的地址
package com.kuaff.jdk5package;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
public class ProcessBuilderShow
{
public static List getPhysicalAddress()
{
Process p = null;
//物理网卡列表
List address = new ArrayList();
try
{
//执行ipconfig /all命令
p = new ProcessBuilder("ipconfig", "/all").start();
}
catch (IOException e)
{
return address;
}
byte[] b = new byte[1024];
StringBuffer sb = new StringBuffer();
//读取进程输出值
InputStream in = p.getInputStream();
try
{
while (in.read(b)0)
{
sb.append(new String(b));
}
}
catch (IOException e1)
{
}
finally
{
try
{
in.close();
}
catch (IOException e2)
{
}
}
//以下分析输出值,得到物理网卡
String rtValue = sb.substring(0);
int i = rtValue.indexOf("Physical Address. . . . . . . . . :");
while(i0)
{
rtValue = rtValue.substring(i + "Physical Address. . . . . . . . . :".length());
address.add(rtValue.substring(0,18));
i = rtValue.indexOf("Physical Address. . . . . . . . . :");
}
return address;
}
public static void main(String[] args)
{
List address = ProcessBuilderShow.getPhysicalAddress();
for(String add:address)
{
System.out.printf("物理网卡地址:%s%n", add);
}
}
}
像在百度搜索引擎输入IP就能获取到本人的本机IP,如何用java实现?
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package baidu;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.sql.Connection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @author stcdasqy
*/
public class Baidu {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception{
URL url = new URL("");
URLConnection conn = url.openConnection();
InputStream is = conn.getInputStream();
byte buf[] = new byte[40];
int len;
String ret = "";
while((len=is.read(buf))!=-1){
ret += new String(buf,"GB2312");
}
is.close();
String regex = "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(ret);
if(m.find()){
System.out.println(m.group(0));
}
}
}这样就可以了
IP动态变化功能java如何实现
ava代码
语法:rasdial 连接名称 /disconnect
实例: rasdial 宽带 /disconnect
java程序调用rasdial命令:
Java代码
package com.sesame.network;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class ConnectNetWork {
/**
* 执行CMD命令,并返回String字符串
*/
public static String executeCmd(String strCmd) throws Exception {
Process p = Runtime.getRuntime().exec(“cmd /c ” + strCmd);
StringBuilder sbCmd = new StringBuilder();
BufferedReader br = new BufferedReader(new InputStreamReader(p
.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
sbCmd.append(line + ”\n”);
}
return sbCmd.toString();
}
/**
* 连接ADSL
*/
public static boolean connAdsl(String adslTitle, String adslName, String adslPass) throws Exception {
System.out.println(“正在建立连接.”);
String adslCmd = ”rasdial ” + adslTitle + ” ” + adslName + ” ”
+ adslPass;
String tempCmd = executeCmd(adslCmd);
// 判断是否连接成功
if (tempCmd.indexOf(“已连接”) 0) {
System.out.println(“已成功建立连接.”);
return true;
} else {
System.err.println(tempCmd);
System.err.println(“建立连接失败”);
return false;
}
}
关于java模拟ip和java模拟ip欺骗的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。