nasl解析 (java语言)

yanchuanliang 2011-03-28 05:00:35
最近想用java写一个基于nasl脚本的漏洞扫描程序。请高手过来指点。我不知道如何解析nasl脚本。

#
# (C) Tenable Network Security
#
#

if (description) {
script_id(18208);
script_version("$Revision: 1.1 $");

name["english"] = "602LAN SUITE Open Telnet Proxy";
script_name(english:name["english"]);

desc["english"] = "
The remote host is running 602LAN SUITE with an open Telnet server
proxy. By using through such a proxy, an attacker is able to launch
attacks that appear to originate from the remote host and possibly to
access resources that are only available to machines on the same
internal network as the remote host.

Solution : Reconfigure 602LAN SUITE, disabling the TELNET server proxy.
Risk factor : High";
script_description(english:desc["english"]);

summary["english"] = "Checks for telnet proxy in 602LAN SUITE";
script_summary(english:summary["english"]);

script_category(ACT_ATTACK);
script_family(english:"General");

script_copyright(english:"This script is Copyright (C) 2005 Tenable Network Security");

script_dependencie("find_service.nes");
script_require_ports("Services/telnet", 23);

exit(0);
}


port = get_kb_item("Services/telnet");
if (!port) port = 23;
if (!get_port_state(port)) exit(0);


# Open a connection and grab the banner.
soc = open_sock_tcp(port);
if (!soc) exit(0);
banner = recv(socket:soc, length:2048);


# If it looks like 602LAN SUITE...
if ("host[:port]:" >< banner) {
# Try to connect back to the server on port 31337.
req = string(this_host(),":31337\r\n");
filter = string("tcp and src ", get_host_ip(), " and dst ", this_host(), " and dst port 31337");
send(socket:soc, data:req);
res = recv_line(socket:soc, length:2048);

# Hmmm, there seems to be a filter limiting outbound connections.
if ("Access Denied by IP Filter" >< res) exit(0);

# If we can, there's a problem.
res = pcap_next(pcap_filter:filter);
if (res) security_hole(port);
}
比如这段代码,如何用java语句进行解析。请高手指点。
...全文
219 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
yanchuanliang 2011-04-01
  • 打赏
  • 举报
回复
对了,最近在网上找到了一个jnessuslib 不会用,哪位指点一下 不胜感激。qq6429l7o17
yanchuanliang 2011-04-01
  • 打赏
  • 举报
回复
唉,不会写编译器呀。哪位帮个忙。把这个解析出来就可以。java语言的 谢了
龙四 2011-03-31
  • 打赏
  • 举报
回复
可以写个编译器了

看《编译原理》吧

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧