我的java套接字应用程序
我试图从java制作一个简单的端口扫描程序,我是这样制作的:
package PortScanning;
/**
*
* @author fonts
*/
import java.net.*;
import java.io.*;
public class port {
static int scan=20;
public void load() {
try {
if (scan <= 587)
{
System.out.print(" Scanning...");
scan++;
Socket gw = new Socket("127.0.0.1",scan);
System.out.println(scan + "\t\t opened");
port lagi=new port();
lagi.load();
}
else
{
System.out.println("\n—————————————–\n—————————————–\n Finish... \n\n");
}
}
catch (Exception e)
{
System.out.println(scan + "\t\t closed");
port lagi=new port();
lagi.load();
}
}
public static void main(String[]args)
{
System.out.print(" Try Scanning \n—————————————–\n—————————————–\n\n");
scan--;
port panggil=new port();
panggil.load();
}
}
但我想问扫描端口的过程如何捕获我之前插入数据库的数据,这样系统工作就会变成自动扫描在我这样做之前数据库表的:
=================
ip | port
=================
127.0.0.1 | 80
127.0.0.1 | 25
etc. | etc.
=================
我希望任何人都可以帮助我的问题 非常感谢
I tried to make a simple port scanning programs from java and I make it like this:
package PortScanning;
/**
*
* @author fonts
*/
import java.net.*;
import java.io.*;
public class port {
static int scan=20;
public void load() {
try {
if (scan <= 587)
{
System.out.print(" Scanning...");
scan++;
Socket gw = new Socket("127.0.0.1",scan);
System.out.println(scan + "\t\t opened");
port lagi=new port();
lagi.load();
}
else
{
System.out.println("\n—————————————–\n—————————————–\n Finish... \n\n");
}
}
catch (Exception e)
{
System.out.println(scan + "\t\t closed");
port lagi=new port();
lagi.load();
}
}
public static void main(String[]args)
{
System.out.print(" Try Scanning \n—————————————–\n—————————————–\n\n");
scan--;
port panggil=new port();
panggil.load();
}
}
but I wanted to ask how the process of scanning ports on the capture of data that I previously inserted into the database, so will the system work becomes automatic scanning of the database table before I make like this:
=================
ip | port
=================
127.0.0.1 | 80
127.0.0.1 | 25
etc. | etc.
=================
I hope anyone can help my problem
and thanks a lot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要使用 Java 访问数据库,可以使用 JDBC。查看 Jdbc-Tutorial 开始使用。
关于您的端口扫描程序,您可以按照以下路径构建它:
Connection
Statement
从 找到每个端口,用其关联的 IP 扫描它;使用ResultSet
Statement
和数据库Connection
祝你好运!
For accessing databases in Java, one can use JDBC. Have a look at Jdbc-Tutorial for getting started.
Concerning your port scanning program, you can follow the following path for building it :
Connection
Statement
ResultSet
Statement
and databaseConnection
Good luck !