文章
The information presented here is based on Data of :
þ Bellcore (Bell Communication Research) - USA
þ Mercury Communications - United Kingdom
þ Telekom - Germany
þ AcceSS 7 - Hewlett Packard Research CCiTT #7 Monitoring System
Note that some of the data presented in this article might be
classified material by some of those companies.
What is CCiTT #7
----------------
CCiTT #7 is the newest signalling system also called SS7 (or also Common
Channel Signalling No.7). It uses two channels for communication.
The first is the voice channel (or what ever you are transmitting over it)
and the second is the data channel. This data channels is completly seperated
from the voice channel and holds all calling information in it plus has got
the advanced features of caller ID, call forwarding, conference calling,
credit card calls, collect calls etc.
This extra data channel was put in since ccitt #6 because first it disables
now the "famous" blueboxing possiblity, second enhances line quality and
third expands possiblities for new features like caller ID etc.
It is used in nearly all west european countries, but now more and more
other countries change to this system as well like israel for example.
Monitoring Systems for CCiTT #7
-------------------------------
As far as i know the following Monitoring Systems are in existance and
available for telecommunication companies :
þ Bellcore : Davin and NetMavin
þ Hewlett Packard : HP E4250A, also known as AcceSS 7
þ Unisys : NIRIS Information Platform
þ Algen : Probe
þ Bellcore's monitoring system is based on unix and is programmed in C using
the X11 Unix Window System but can also be run on vt100 terminals and soon
on Macintoshs too. It can run on any workstation which is Unix compactible.
It has got also the possbility to work with data from other
Monitoring Systems like AcceSS 7 from HP and also use the C libraries from
HP's system.
It's easy to use with mouse support, Window graphic displays in realtime,
Zooming etc.
Interesting Options are for example :
Monitoring calls from a specific telephone number
Automatic Fraud Detection
Multiple simultaneos call traced (up to 100)
Bellcore's Davin and NetMavin is used by Bell and Mercury Telecommunication.
þ Hewlett Packards monitoring system is more general than Bellcore's.
It's based on HP unix machines (Apollos I think) running HPUX Unix.
It is very flexible and can link in any CCiTT #7 system.
Everything is written in C and the customer can program, enhance and tune
the monitoring tools as they like. Basic Tools are implemented so is the
monitoring data collection tools, but everything else must be programmed
by the customer or by an HP service team - but be sure they know what they
can do and will program everything to get you.
HP's AcceSS 7 System is used by the german Telecom.
(Installed in Frankfurt, Duesseldorf, Stuttgart and Nuernberg with
Controll Centers in Frankfurt and Bamberg)
þ Sorry, on the two others i haven't got any information, and i don't know
if other monitoring systems exist.
Of course Fraud Detection is not the main point of CCiTT #7 Monitoring.
It's more gathering traffic statistics for network planning, optimizing,
error controlling & detecting, and market decicions - but fraud detection
is an important part.
How does CCiTT #7 Fraud Detection work
--------------------------------------
Automatic Fraud Detection is based on pattern matching.
Patterns must first be measured for each every communication network/area.
Everything which is out of this pattern triggers an alarm.
Out-of-Pattern are :
identify calls of long duration
repeated calls to a particular dialed number from the same area of origin
repeated calls from the same area of origin to different numbers
long/many calls from an unbillable number
dialing special numbers
dialing many toll free numbers
A triggered alarm can result in anything, also depending on type of alarm :
saving data to log
continued electronical oberservation to detect more out-of-pattern behavior
autotrace
alarm operator
XXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXX \
XXXXXXXXXXXXXXXX \
XXXXXXXXXXXXXXXX \ Out-of- --> XXXXXXXX \ Continues --> XX
XXXXXXXXXXXXXXXX - Pattern --> XXXXXXXX - Out-of-Pattern --> XX
XXXXXXXXXXXXXXXX / XXXXXXXX / or
XXXXXXXXXXXXXXXX / Manual
XXXXXXXXXXXXXXXX / Inverstigation
XXXXXXXXXXXXXXXX
Calls going Monitoring Alarms of Continued FRAUD
though Monitoring system Monitoring Out-of-Pattern CASES
system Analyzing system or
Manual Investigation
Yes thats all ... there aren't much information available and even those
mentioned here are only known to a small group, although someone could
logically think it would be this way, but now you know it for sure ;-)
Please note that some data might be wrong or outdated (also it should not).
If so please tell me and in the next issue I'll present the new/corrected data.
If you got additional data, do something for the phreaker community and
send it me to release it in the next magazine or release it on your own!
I think, it was a year ago, when I first heard about a new calling card,
this time by German Telekom. The history of calling card fraud is very long,
because AT&T, MCi, Sprint and other phone companies made it possible for many
hackers and phreakers all over the world to make free phone calls very easy.
Now German Telekom offers the same service?! I think many guys tried to hack
those new cards, but I've never heard of a big success. There are several
different types of T-Cards, one is called T-CARD25 which is a pre-paid card
with an amount of 25 DM (18 $) - the other one is a charge card.
The cardholder will get a bill every month. On this bill all called phone
numbers are listed, but with XXX instead of the last three digits.
There are three possibilities to pay for your card: Together with your normal
phone bill, with a credit card or you give the permission, that Telekom will
take it from your bank account. In my new school, we must work in a local
company for a few weeks, to get the feeling of the real live. I looked up the
list and found out, that I must work for German Telekom. With an evil grin
I went home... There were a lot of things to do at Telekom, one fine thing
was, that I was able to make free calls, without having problems. There's
a big room there filled with ISDN phones from where you can make private calls.
One day, I called the Telekom Business Service and asked some questions.
The operator there noticed my Telekom internal Caller ID and she started
talking with me about many things. I got the answers to some difficult
questions, and she gave me an internal number for detailed technical
informations. "Don't give out this number to customers!" she warned me and
again I left the room with an evil grin on my face. One other day, an old
guy asked if there's is somebody who knows about T-Cards. He quickly noticed
that I'm more intelligent than the average Telko pig and an hour later I found
myself in a small room with a phone and a list full of Telekom internal calling
card numbers. I became an official T-Card System Tester. We tried a lot of
things and in one test, Telekom wanted to find out how many callers can call
the computer at the same time, before it will shut down. I made calls to the
whole world, and more and more testers all over the country invaded the system.
The automated voice talked slower, simple options took over one minute to
complete. Again, I made some calls and checked the account information.
I noticed that the last calls weren't billed. Interesting...
The internal cards were interesting, too. They acted like charge cards, but
they had a 50 DM (36 $) limit per month. The card computer itself is very
intelligent, it is able to learn the habits of a customer, e.g. which countries
he calls normally and how long he's talking. A further security measure is,
that after three wrong pin entries, the card will be locked for further calls
until the owner of the card calls the operator. Every customer can choose
a password/passphrase for such actions, because the operator must be sure
that the caller is really the cardholder. Sometimes they even make a callback
verification. You can use T-Cards in over 50 countries. I just tell you the
numbers of the most important countries.
Germany 0130-0222
Australia (Telstra) 1800-881-490
Australia (Optus) 008-5511-49
France 19-(wait for second dialtone)-0049
Great Britain (BT) 0-800-89-0049
Great Britain (Mercury) 0-500-89-0049
Hawaii 1-800-865-0049
Hongkong 800-0049
Irland 1-800-55-0049
Israel 177-490-2727
Italia 172-0049
Japan (KDD) 0039-491
Japan (IDC) 0066-55-449
Canada 1-800-465-0049
Netherlands 06-022-0049
Austria 022-903-049
Sweden 020-799-049
Spain 900-99-0049
South Africa 0800-99-0049
USA (AT&T) 1-800-292-0049
USA (MCi) 1-800-766-0049
USA (US-Sprint) 1-800-927-0049
How to use a hacked card?
1. Dial the access number
2. Press 1 for T-Card Service (if you're not calling from Germany)
3. Choose language: Press 1 for German, 2 for English and 3 for French
4. Enter Cardnumber and PIN then press #
5. Enter the number you wish to call dial 00+country code+number and press #
Instead of dialing a number you can access a submenu with *1#
Listen to the voice what you can do there.
Charge cards have the following format 8XXX XXXX XXXX + PIN (4 digits)
Pre-paid card have no PIN number, which makes them easy to hack, as if you
know a valid pre-paid card number you can easily guess new numbers.
They're not in sequence, but if 8214 1234 1234 is a valid card you can guess
some valid cards easy. But 18 $ is not very much, so concentrate hacking
the real ones. They came in two envelopes and the second letter arrives
about one or two days later. One letter contains the card, and the other the
PIN number. This should make stealing difficult, but wait... My card arrived
in July 95 and the temporary pin was 9507. Got the point?
I know it's difficult to hack one of these card, but if you have one, you'll
have much phun. I'm abusing one of the test cards for 6 month now. Customer
cards will often work a whole month. I think that's worth it.
Have phun!
端口可分为3大类:
1) 公认端口(Well Known Ports):从0到1023,它们紧密绑定于一些服务。通常这些端口的通讯明确表明了某种服务的协议。例如:80端口实际上总是HTTP通讯。
2) 注册端口(Registered Ports):从1024到49151。它们松散地绑定于一些服务。也就是说有许多服务绑定于这些端口,这些端口同样用于许多其它目的。例如:许多系统处理动态端口从1024左右开始。
3) 动态和/或私有端口(Dynamic and/or Private Ports):从49152到65535。理论上,不应为服务分配这些端口。实际上,机器通常从1024起分配动态端口。但也有例外:SUN的RPC端口从32768开始。
本节讲述通常TCP/UDP端口扫描在防火墙记录中的信息。记住:并不存在所谓ICMP端口。如果你对解读ICMP数据感兴趣,请参看本文的其它部分。
0 通常用于分析操作系统。这一方法能够工作是因为在一些系统中“0”是无效端口,当你试图使用一种通常的闭合端口连接它时将产生不同的结果。一种典型的扫描:使用IP地址为0.0.0.0,设置ACK位并在以太网层广播。
1 tcpmux 这显示有人在寻找SGI Irix机器。Irix是实现tcpmux的主要提供者,缺省情况下tcpmux在这种系统中被打开。Iris机器在发布时含有几个缺省的无密码的帐户,如lp, guest, uucp, nuucp, demos, tutor, diag, EZsetup, OutOfBox, 和4Dgifts。许多管理员安装后忘记删除这些帐户。因此Hacker们在Internet上搜索tcpmux并利用这些帐户。
7 Echo 你能看到许多人们搜索Fraggle放大器时,发送到x.x.x.0和x.x.x.255的信息。
常见的一种DoS攻击是echo循环(echo-loop),攻击者伪造从一个机器发送到另一个机器的UDP数据包,而两个机器分别以它们最快的方式回应这些数据包。(参见Chargen)
另一种东西是由DoubleClick在词端口建立的TCP连接。有一种产品叫做“Resonate Global Dispatch”,它与DNS的这一端口连接以确定最近的路由。
Harvest/squid cache将从3130端口发送UDP echo:“如果将cache的source_ping on选项打开,它将对原始主机的UDP echo端口回应一个HIT reply。”这将会产生许多这类数据包。
11 sysstat 这是一种UNIX服务,它会列出机器上所有正在运行的进程以及是什么启动了这些进程。这为入侵者提供了许多信息而威胁机器的安全,如暴露已知某些弱点或帐户的程序。这与UNIX系统中“ps”命令的结果相似
再说一遍:ICMP没有端口,ICMP port 11通常是ICMP type=11
19 chargen 这是一种仅仅发送字符的服务。UDP版本将会在收到UDP包后回应含有垃圾字符的包。TCP连接时,会发送含有垃圾字符的数据流知道连接关闭。Hacker利用IP欺骗可以发动DoS攻击。伪造两个chargen服务器之间的UDP包。由于服务器企图回应两个服务器之间的无限的往返数据通讯一个chargen和echo将导致服务器过载。同样fraggle DoS攻击向目标地址的这个端口广播一个带有伪造受害者IP的数据包,受害者为了回应这些数据而过载。
21 ftp 最常见的攻击者用于寻找打开“anonymous”的ftp服务器的方法。这些服务器带有可读写的目录。Hackers或Crackers 利用这些服务器作为传送warez (私有程序) 和pr0n(故意拼错词而避免被搜索引擎分类)的节点。
22 ssh PcAnywhere建立TCP和这一端口的连接可能是为了寻找ssh。这一服务有许多弱点。如果配置成特定的模式,许多使用RSAREF库的版本有不少漏洞。(建议在其它端口运行ssh)
还应该注意的是ssh工具包带有一个称为make-ssh-known-hosts的程序。它会扫描整个域的ssh主机。你有时会被使用这一程序的人无意中扫描到。
UDP(而不是TCP)与另一端的5632端口相连意味着存在搜索pcAnywhere的扫描。5632(十六进制的0x1600)位交换后是0x0016(使进制的22)。
23 Telnet 入侵者在搜索远程登陆UNIX的服务。大多数情况下入侵者扫描这一端口是为了找到机器运行的操作系统。此外使用其它技术,入侵者会找到密码。
25 smtp 攻击者(spammer)寻找SMTP服务器是为了传递他们的spam。入侵者的帐户总被关闭,他们需要拨号连接到高带宽的e-mail服务器上,将简单的信息传递到不同的地址。SMTP服务器(尤其是sendmail)是进入系统的最常用方法之一,因为它们必须完整的暴露于Internet且邮件的路由是复杂的(暴露+复杂=弱点)。
53 DNS Hacker或crackers可能是试图进行区域传递(TCP),欺骗DNS(UDP)或隐藏其它通讯。因此防火墙常常过滤或记录53端口。
需要注意的是你常会看到53端口做为UDP源端口。不稳定的防火墙通常允许这种通讯并假设这是对DNS查询的回复。Hacker常使用这种方法穿透防火墙。
67和68 Bootp和DHCP UDP上的Bootp/DHCP:通过DSL和cable-modem的防火墙常会看见大量发送到广播地址255.255.255.255的数据。这些机器在向DHCP服务器请求一个地址分配。Hacker常进入它们分配一个地址把自己作为局部路由器而发起大量的“中间人”(man-in-middle)攻击。客户端向68端口(bootps)广播请求配置,服务器向67端口(bootpc)广播回应请求。这种回应使用广播是因为客户端还不知道可以发送的IP地址。
69 TFTP(UDP) 许多服务器与bootp一起提供这项服务,便于从系统下载启动代码。但是它们常常错误配置而从系统提供任何文件,如密码文件。它们也可用于向系统写入文件。
79 finger Hacker用于获得用户信息,查询操作系统,探测已知的缓冲区溢出错误,回应从自己机器到其它机器finger扫描。
98 linuxconf 这个程序提供linux boxen的简单管理。通过整合的HTTP服务器在98端口提供基于Web界面的服务。它已发现有许多安全问题。一些版本setuid root,信任局域网,在/tmp下建立Internet可访问的文件,LANG环境变量有缓冲区溢出。此外因为它包含整合的服务器,许多典型的HTTP漏洞可能存在(缓冲区溢出,历遍目录等)
109 POP2 并不象POP3那样有名,但许多服务器同时提供两种服务(向后兼容)。在同一个服务器上POP3的漏洞在POP2中同样存在。
110 POP3 用于客户端访问服务器端的邮件服务。POP3服务有许多公认的弱点。关于用户名和密码交换缓冲区溢出的弱点至少有20个(这意味着Hacker可以在真正登陆前进入系统)。成功登陆后还有其它缓冲区溢出错误。
111 sunrpc portmap rpcbind Sun RPC PortMapper/RPCBIND。访问portmapper是扫描系统查看允许哪些RPC服务的最早的一步。常见RPC服务有:rpc.mountd, NFS, rpc.statd, rpc.csmd, rpc.ttybd, amd等。入侵者发现了允许的RPC服务将转向提供服务的特定端口测试漏洞。
记住一定要记录线路中的daemon, IDS, 或sniffer,你可以发现入侵者正使用什么程序访问以便发现到底发生了什么。
113 Ident auth 这是一个许多机器上运行的协议,用于鉴别TCP连接的用户。使用标准的这种服务可以获得许多机器的信息(会被Hacker利用)。但是它可作为许多服务的记录器,尤其是FTP, POP, IMAP, SMTP和IRC等服务。通常如果有许多客户通过防火墙访问这些服务,你将会看到许多这个端口的连接请求。记住,如果你阻断这个端口客户端会感觉到在防火墙另一边与e-mail服务器的缓慢连接。许多防火墙支持在TCP连接的阻断过程中发回RST,着将回停止这一缓慢的连接。
119 NNTP news 新闻组传输协议,承载USENET通讯。当你链接到诸如:news://comp.security.firewalls/. 的地址时通常使用这个端口。这个端口的连接企图通常是人们在寻找USENET服务器。多数ISP限制只有他们的客户才能访问他们的新闻组服务器。打开新闻组服务器将允许发/读任何人的帖子,访问被限制的新闻组服务器,匿名发帖或发送spam。
135 oc-serv MS RPC end-point mapper Microsoft在这个端口运行DCE RPC end-point mapper为它的DCOM服务。这与UNIX 111端口的功能很相似。使用DCOM和/或RPC的服务利用机器上的end-point mapper注册它们的位置。远端客户连接到机器时,它们查询end-point mapper找到服务的位置。同样Hacker扫描机器的这个端口是为了找到诸如:这个机器上运行Exchange Server吗?是什么版本?
这个端口除了被用来查询服务(如使用epdump)还可以被用于直接攻击。有一些DoS攻击直接针对这个端口。
137 NetBIOS name service nbtstat (UDP) 这是防火墙管理员最常见的信息,请仔细阅读文章后面的NetBIOS一节
139 NetBIOS File and Print Sharing 通过这个端口进入的连接试图获得NetBIOS/SMB服务。这个协议被用于Windows“文件和打印机共享”和SAMBA。在Internet上共享自己的硬盘是可能是最常见的问题。
大量针对这一端口始于1999,后来逐渐变少。2000年又有回升。一些VBS(IE5 VisualBasic Scripting)开始将它们自己拷贝到这个端口,试图在这个端口繁殖。
143 IMAP 和上面POP3的安全问题一样,许多IMAP服务器有缓冲区溢出漏洞运行登陆过程中进入。记住:一种Linux蠕虫(admw0rm)会通过这个端口繁殖,因此许多这个端口的扫描来自不知情的已被感染的用户。当RadHat在他们的Linux发布版本中默认允许IMAP后,这些漏洞变得流行起来。Morris蠕虫以后这还是第一次广泛传播的蠕虫。
这一端口还被用于IMAP2,但并不流行。
已有一些报道发现有些0到143端口的攻击源于脚本。
161 SNMP(UDP) 入侵者常探测的端口。SNMP允许远程管理设备。所有配置和运行信息都储存在数据库中,通过SNMP客获得这些信息。许多管理员错误配置将它们暴露于Internet。Crackers将试图使用缺省的密码“public”“private”访问系统。他们可能会试验所有可能的组合。
SNMP包可能会被错误的指向你的网络。Windows机器常会因为错误配置将HP JetDirect remote management软件使用SNMP。HP OBJECT IDENTIFIER将收到SNMP包。新版的Win98使用SNMP解析域名,你会看见这种包在子网内广播(cable modem, DSL)查询sysName和其它信息。
162 SNMP trap 可能是由于错误配置
177 xdmcp 许多Hacker通过它访问X-Windows控制台,它同时需要打开6000端口。
513 rwho 可能是从使用cable modem或DSL登陆到的子网中的UNIX机器发出的广播。这些人为Hacker进入他们的系统提供了很有趣的信息。
553 CORBA IIOP (UDP) 如果你使用cable modem或DSL VLAN,你将会看到这个端口的广播。CORBA是一种面向对象的RPC(remote procedure call)系统。Hacker会利用这些信息进入系统。
600 Pcserver backdoor 请查看1524端口
一些玩script的孩子认为他们通过修改ingreslock和pcserver文件已经完全攻破了系统-- Alan J. Rosenthal.
635 mountd Linux的mountd Bug。这是人们扫描的一个流行的Bug。大多数对这个端口的扫描是基于UDP的,但基于TCP的mountd有所增加(mountd同时运行于两个端口)。记住,mountd可运行于任何端口(到底在哪个端口,需要在端口111做portmap查询),只是Linux默认为635端口,就象NFS通常运行于2049端口。
1024 许多人问这个端口是干什么的。它是动态端口的开始。许多程序并不在乎用哪个端口连接网络,它们请求操作系统为它们分配“下一个闲置端口”。基于这一点分配从端口1024开始。这意味着第一个向系统请求分配动态端口的程序将被分配端口1024。为了验证这一点,你可以重启机器,打开Telnet,再打开一个窗口运行“natstat -a”,你将会看到Telnet被分配1024端口。请求的程序越多,动态端口也越多。操作系统分配的端口将逐渐变大。再来一遍,当你浏览Web页时用“netstat”查看,每个Web页需要一个新端口。
?ersion 0.4.1, June 20, 2000
http://www.robertgraham.com/pubs/firewall-seen.html
Copyright 1998-2000 by Robert Graham (mailto:firewall-seen1@robertgraham.com.
All rights reserved. This document may only be reproduced (whole or
in part) for non-commercial purposes. All reproductions must
contain this copyright notice and must not be altered, except by
permission of the author.
1025 参见1024
1026 参见1024
1080 SOCKS
这一协议以管道方式穿过防火墙,允许防火墙后面的许多人通过一个IP地址访问Internet。理论上它应该只允许内部的通信向外达到Internet。但是由于错误的配置,它会允许Hacker/Cracker的位于防火墙外部的攻击穿过防火墙。或者简单地回应位于Internet上的计算机,从而掩饰他们对你的直接攻击。WinGate是一种常见的Windows个人防火墙,常会发生上述的错误配置。在加入IRC聊天室时常会看到这种情况。
1114 SQL
系统本身很少扫描这个端口,但常常是sscan脚本的一部分。
1243 Sub-7木马(TCP)
参见Subseven部分。
1524 ingreslock后门
许多攻击脚本将安装一个后门Sh*ll 于这个端口(尤其是那些针对Sun系统中Sendmail和RPC服务漏洞的脚本,如statd, ttdbserver和cmsd)。如果你刚刚安装了你的防火墙就看到在这个端口上的连接企图,很可能是上述原因。你可以试试Telnet到你的机器上的这个端口,看看它是否会给你一个Sh*ll 。连接到600/pcserver也存在这个问题。
2049 NFS
NFS程序常运行于这个端口。通常需要访问portmapper查询这个服务运行于哪个端口,但是大部分情况是安装后NFS 杏谡飧龆丝冢?acker/Cracker因而可以闭开portmapper直接测试这个端口。
3128 squid
这是Squid HTTP代理服务器的默认端口。攻击者扫描这个端口是为了搜寻一个代理服务器而匿名访问Internet。你也会看到搜索其它代理服务器的端口:8000/8001/8080/8888。扫描这一端口的另一原因是:用户正在进入聊天室。其它用户(或服务器本身)也会检验这个端口以确定用户的机器是否支持代理。请查看5.3节。
5632 pcAnywere
你会看到很多这个端口的扫描,这依赖于你所在的位置。当用户打开pcAnywere时,它会自动扫描局域网C类网以寻找可能得代理(译者:指agent而不是proxy)。Hacker/cracker也会寻找开放这种服务的机器,所以应该查看这种扫描的源地址。一些搜寻pcAnywere的扫描常包含端口22的UDP数据包。参见拨号扫描。
6776 Sub-7 artifact
这个端口是从Sub-7主端口分离出来的用于传送数据的端口。例如当控制者通过电话线控制另一台机器,而被控机器挂断时你将会看到这种情况。因此当另一人以此IP拨入时,他们将会看到持续的,在这个端口的连接企图。(译者:即看到防火墙报告这一端口的连接企图时,并不表示你已被Sub-7控制。)
6970 RealAudio
RealAudio客户将从服务器的6970-7170的UDP端口接收音频数据流。这是由TCP7070端口外向控制连接设置的。
13223 PowWow
PowWow 是Tribal Voice的聊天程序。它允许用户在此端口打开私人聊天的连接。这一程序对于建立连接非常具有“进攻性”。它会“驻扎”在这一TCP端口等待回应。这造成类似心跳间隔的连接企图。如果你是一个拨号用户,从另一个聊天者手中“继承”了IP地址这种情况就会发生:好象很多不同的人在测试这一端口。这一协议使用“OPNG”作为其连接企图的前四个字节。
17027 Conducent
这是一个外向连接。这是由于公司内部有人安装了带有Conducent "adbot" 的共享软件。Conducent "adbot"是为共享软件显示广告服务的。使用这种服务的一种流行的软件是Pkware。有人试验:阻断这一外向连接不会有任何问题,但是封掉IP地址本身将会导致adbots持续在每秒内试图连接多次而导致连接过载:
机器会不断试图解析DNS名─ads.conducent.com,即IP地址216.33.210.40 ;216.33.199.77 ;216.33.199.80 ;216.33.199.81;216.33.210.41。(译者:不知NetAnts使用的Radiate是否也有这种现象)
27374 Sub-7木马(TCP)
参见Subseven部分。
30100 NetSphere木马(TCP)
通常这一端口的扫描是为了寻找中了NetSphere木马。
31337 Back Orifice “elite”
Hacker中31337读做“elite”/ei’li:t/(译者:法语,译为中坚力量,精华。即3=E, 1=L, 7=T)。因此许多后门程序运行于这一端口。其中最有名的是Back Orifice。曾经一段时间内这是Internet上最常见的扫描。现在它的流行越来越少,其它的木马程序越来越流行。
31789 Hack-a-tack
这一端口的UDP通讯通常是由于"Hack-a-tack"远程访问木马(RAT, Remote Access Trojan)。这种木马包含内置的31790端口扫描器,因此任何31789端口到317890端口的连接意味着已经有这种入侵。(31789端口是控制连接,317890端口是文件传输连接)
32770~32900 RPC服务
Sun Solaris的RPC服务在这一范围内。详细的说:早期版本的Solaris(2.5.1之前)将portmapper置于这一范围内,即使低端口被防火墙封闭仍然允许Hacker/cracker访问这一端口。扫描这一范围内的端口不是为了寻找portmapper,就是为了寻找可被攻击的已知的RPC服务。
33434~33600 traceroute
如果你看到这一端口范围内的UDP数据包(且只在此范围之内)则可能是由于traceroute。参见traceroute部分。
41508 Inoculan
早期版本的Inoculan会在子网内产生大量的UDP通讯用于识别彼此。参见
http://www.circlemud.org/~jelson/software/udpsend.html
http://www.ccd.bnl.gov/nss/tips/inoculan/index.html
(二) 下面的这些源端口意味着什么?
端口1~1024是保留端口,所以它们几乎不会是源端口。但有一些例外,例如来自NAT机器的连接。参见1.9。
常看见紧接着1024的端口,它们是系统分配给那些并不在乎使用哪个端口连接的应用程序的“动态端口”。
Server Client 服务 描述
1-5/tcp 动态 FTP 1-5端口意味着sscan脚本
20/tcp 动态 FTP FTP服务器传送文件的端口
53 动态 FTP DNS从这个端口发送UDP回应。你也可能看见源/目标端口的TCP连接。
123 动态 S/NTP 简单网络时间协议(S/NTP)服务器运行的端口。它们也会发送到这个端口的广播。
27910~27961/udp 动态 Quake Quake或Quake引擎驱动的游戏在这一端口运行其服务器。因此来自这一端口范围的UDP包或发送至这一端口范围的UDP包通常是游戏。
61000以上 动态 FTP 61000以上的端口可能来自Linux NAT服务器(IP Masquerade)
小鸟我的朋友用我的机子进了个游戏站 然后只要开IE就弹出了http://www.99244.com/这个恶心网站,很麻烦 不知道怎么办了 哪位前辈指导一下 谢谢
答:目前绝大多数网民都采用随Windows捆绑的IE浏览器上网,用QQ聊天,因此国内出现了很多恶意网站和恶意程序,他们侵害的目标以IE浏览器和腾讯QQ为主。
一, 对于新手,不具备相关专业知识,因此我们推荐使用常见的IE修复软件进行修复
一般情况下,恶意网站都是通过网页上面隐藏的恶意代码来实现远程安装程序,通过这个程序强行控制用户的电脑,实现以下几种效果: 格式化硬盘,锁定复注册表,篡改IE的默认页 ,IE的默认首页灰色按扭不可选 等等。
面对这些常见恶意程序的危害,需要一定的电脑专业知识才可能手工修复;有时候甚至需要用到调试工具才可能进行修复。恶意程序造成破坏的表现虽然不同,但是绝大多数仅仅起到修改的作用,修复相对较为容易,对工具软件的需求也不是很强烈,而有些破坏的修复是单机操作而无法实现的,对于新手,不具备相关专业知识,因此我们推荐使用常见的IE修复软件进行修复。
代表性的软件有:上网助手 IE修复专家2005、超级兔子IE管理专家、IE浏览器修复工具、黄山IE修复专家、HijackThis。以下软件各大软件站均有下载!
上网助手 IE修复专家2005
上网助手 IE修复专家2005由雅虎中国在前不久刚刚推出,这是一个完全免费的在线服务工具,不需下载安装,只要登陆zs.3721.com,选择 “IE修复专家”即可完成。上网助手 IE修复专家2005采用“傻瓜”式设计,只要进入了IE修复专家的界面,便可自行完成修复工作。地址 http://assistant.3721.com/start.htm?fb=client
超级兔子IE管理专家
超级兔子IE管理专家原是“超级兔子魔法设置”的一个附加功能,后来渐渐独立出来,目前个人版的最高版本是6.15,在修复功能之外还提供了实时防护功能,直接避免IE破坏的状况产生。
IE浏览器修复工具
IE浏览器修复工具是一款由个人编写的IE修复工具软件,目前最高版本为3.011,功能设计比较全面,在操作界面上选择自己所遇到的IE故障进行修复,作用直接明显。
黄山IE修复专家
黄山IE修复专家也是一款来自个人编写的软件,目前的最高版本是7.59,“傻瓜”式设计免去了操作上的麻烦,不过界面比较粗糙。
HijackThis
HijackThis式这次测试中我们选择的唯一一款国外软件,目前最高版本是1.99,其1.98版的汉化程序已经可以在网上找到,它的功能主要集中在对于注册表恶意修改的弥补。
二,如果想学习注册表,也可以手动来修复:
(一)如何在注册表被锁定的情况下修复注册表
注册表被锁定这一招是比较恶毒的,它使普遍用户即使会简单修改注册表使其恢复的条件下,困难又多了一层。症状是在开始菜单中点击“运行”,在运行框中输入regedit命令时,注册表不能够使用,并发现系统提示你没有权限运行该程序,然后让你联系系统管理员。
这是由于注册表编辑器:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System下的DWORD值“DisableRegistryTools”被修改为“1”的缘故,将其键值恢复为“0”即可恢复注册表的使用。
解决办法:
(1)可以自己动手制作一个解除注册表锁定的工具,就是用记事本编辑一个任意名字的.reg文件,比如recover.reg,内容如下:
REGEDIT4
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]
"DisableRegistryTools"=dword:00000000
要特别注意的是:如果你用这个方法制作解除注册表锁定的工具,一定要严格按照上面的书写格式进行,不能遗漏更不能修改(其实你只需将上述内容“复制”、“粘贴”到你机器记事本中即可);完成上述工作后,点击记事本的文件菜单中的“另存为”项,文件名可以随意,但文件扩展名必须为.reg(切记),然后点击“保存”。这样一个注册表解锁工具就制作完成了,之后你只须双击生成的工具图标,其会提示你是否将这个信息添加进注册表,你要点击“是”,随后系统提示信息已成功输入注册表,再点击“确定”即可将注册表解锁了。
(2)也可以直接下载下面这个解锁工具,下载完成运行后可直接解锁注册表编辑器:
http://it.rising.com.cn/antivirus/net_virus/spiteful/enable.reg
(二)篡改IE的默认页
有些IE被改了起始页后,即使设置了“使用默认页”仍然无效,这是因为IE起始页的默认页也被篡改了。具体说就是以下注册表项被修改:
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\Default_Page_URL
“Default_Page_URL”这个子键的键值即起始页的默认页。
解决办法:
运行注册表编辑器,然后展开上述子键,将“Default_Page_UR”子键的键值中的那些篡改网站的网址改掉就行了,或者将其设置为IE的默认值。
(三)修改IE浏览器缺省主页,并且锁定设置项,禁止用户更改
主要是修改了注册表中IE设置的下面这些键值(DWORD值为1时为不可选):
HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Control Panel
"Settings"=dword:1
HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Control Panel
"Links"=dword:1
HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Control Panel
"SecAddSites"=dword:1
解决办法:
将上面这些DWORD值改为“0”即可恢复功能。
(四)IE的默认首页灰色按扭不可选
这是由于注册表HKEY_USERS\.DEFAULT\Software\Policies\Microsoft\Internet Explorer\Control Panel
下的DWORD值“homepage”的键值被修改的缘故。原来的键值为“0”,被修改后为“1”(即为灰色不可选状态)。
解决办法:
将“homepage”的键值改为“0”即可。
(五)IE标题栏被修改
在系统默认状态下,是由应用程序本身来提供标题栏的信息,但也允许用户自行在上述注册表项目中填加信息,而一些恶意的网站正是利用了这一点来得逞的:它们将串值Window Title下的键值改为其网站名或更多的广告信息,从而达到改变浏览者IE标题栏的目的。
具体说来受到更改的注册表项目为:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\Window Title
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Window Title
解决办法:
①在Windows启动后,点击“开始”→“运行”菜单项,在“打开”栏中键入regedit,然后按“确定”键;
②展开注册表到
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main下,在右半部分窗口中找到串值“Window Title” ,将该串值删除即可,或将Window Title的键值改为“IE浏览器”等你喜欢的名字;
③同理,展开注册表到
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
然后按②中所述方法处理。
④退出注册表编辑器,重新启动计算机,运行IE,你会发现困扰你的问题被解决了!
(六)IE右键菜单被修改
受到修改的注册表项目为:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt
下被新建了网页的广告信息,并由此在IE右键菜单中出现!
解决办法:
打开注册标编辑器,找到
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt
删除相关的广告条文即可,注意不要把下载软件FlashGet和Netants也删除掉,这两个可是“正常”的,除非你不想在IE的右键菜单中见到它们。
(七)IE默认搜索引擎被修改
在IE浏览器的工具栏中有一个搜索引擎的工具按钮,可以实现网络搜索,被篡改后只要点击那个搜索工具按钮就会链接到那个篡改网站。出现这种现象的原因是以下注册表被修改:
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Search\CustomizeSearch
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Search\SearchAssistant
解决办法:
运行注册表编辑器,依次展开上述子键,将“CustomizeSearch”和“SearchAssistant”的键值改为某个搜索引擎的网址即可。
(八)系统启动时弹出对话框
受到更改的注册表项目为:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Winlogon
在其下被建立了字符串“LegalNoticeCaption”和“LegalNoticeText”,其中“LegalNoticeCaption”是提示框的标题,“LegalNoticeText”是提示框的文本内容。由于它们的存在,就使得我们每次登陆到Windwos桌面前都出现一个提示窗口,显示那些网页的广告信息!
解决办法:
打开注册表编辑器,找到
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Winlogon
这一个主键,然后在右边窗口中找到“LegalNoticeCaption”和“LegalNoticeText”这两个字符串,删除这两个字符串就可以解决在登陆时出现提示框的现象了。
(九)IE默认连接首页被修改
IE浏览器上方的标题栏被改成“欢迎访问……网站”的样式,这是最常见的篡改手段,受害者众多。
受到更改的注册表项目为:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\Start Page
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Start Page
通过修改“Start Page”的键值,来达到修改浏览者IE默认连接首页的目的,如浏览“万花谷”就会将你的IE默认连接首页修改为“http://on888.home.chinaren.com ”,即便是出于给自己的主页做广告的目的,也显得太霸道了一些,这也是这类网页惹人厌恶的原因。
解决办法:
①在Windows启动后,点击“开始”→“运行”菜单项,在“打开”栏中键入regedit,然后按“确定”键;
②展开注册表到
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main下,在右半部分窗口中找到串值“Start Page”双击 ,将Start Page的键值改为“about:blank”即可;
③同理,展开注册表到
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
在右半部分窗口中找到串值“Start Page”,然后按②中所述方法处理。
④退出注册表编辑器,重新启动计算机,一切OK了!
特殊例子:当IE的起始页变成了某些网址后,就算你通过选项设置修改好了,重启以后又会变成他们的网址啦,十分的难缠。其实他们是在你机器里加了一个自运行程序,它会在系统启动时将你的IE起始页设成他们的网站。
解决办法:运行注册表编辑器regedit.exe,然后依次展开
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\Run
主键,然后将其下的registry.exe子键删除,然后删除自运行程序c:\Program Files\registry.exe,最后从IE选项中重新设置起始页。
(十)IE中鼠标右键失效
浏览网页后在IE中鼠标右键失效,点击右键没有任何反应!
有的网络流氓为了达到其恶意宣传的目的,将你的右键弹出的功能菜单进行了修改,并且加入了一些乱七八糟的东西,甚至为了禁止你下载,将IE窗口中单击右键的功能都屏蔽掉。
解决办法:
1.右键菜单被修改。打开注册表编辑器,找到HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt,删除相关的广告条文。
2.右键功能失效。打开注册表编辑器,展开到HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Restrictions,将其DWORD值"NoBrowserContextMenu"的值改为0。
(十一)查看“源文件”菜单被禁用
在IE窗口中点击“查看”→“源文件”,发现“源文件”菜单已经被禁用。
恶意网页修改了注册表,具体的位置为:
在注册表
HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer
下建立子键“Restrictions”,然后在“Restrictions”下面建立两个DWORD值:
“NoViewSource”和“NoBrowserContextMenu”,并为这两个DWORD值赋值为“1”。
在注册表
HKEY_USERS\.DEFAULT\Software\Policies\Microsoft\Internet Explorer\Restrictions
下,将两个DWORD值:“NoViewSource”和“NoBrowserContextMenu”的键值都改为了“1”。
通过上面这些键值的修改就达到了在IE中使鼠标右键失效,使“查看”菜单中的“源文件”被禁用的目的。
解决办法:
将以下内容另存为后缀名为.reg的注册表文件,比如说unlock.reg,双击unlock.reg导入注册表,不用重启电脑,重新运行IE就会发现IE的功能恢复正常了。
REGEDIT4
HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Restrictions
“NoViewSource”=dword:00000000
"NoBrowserContextMenu"=dword:00000000
HKEY_USERS\.DEFAULT\Software\Policies\Microsoft\Internet Explorer\Restrictions
“NoViewSource”=dword:00000000
“NoBrowserContextMenu”=dword:00000000
在配置jsp开发环境的过程中会碰到不少问题,感谢网上的许多前辈的经验总结,作者cl41的JSP连接Mysql数据库攻略和作者Saulzy的MySQL学习笔记等文章对我来说简直是雪中送碳,为了帮助象我一样的初学者在此总结了不少作者的经验,非常感谢他们的无私奉献精神,也希望更多的人把这种精神发扬光大,呵呵,再次对所参考文章的作者表示最崇高的敬意!
以下软件下载连接地址无法显示的话,请直接到官方网站下载即可!
软件下载
Mysql
下载版本:mysql-4.1.13-win32.zip(Windows downloads)
http://dev.mysql.com/downloads/mysql/4.1.html
JDBC驱动
下载版本:mysql-connector-java-3.1.10.zip
http://dev.mysql.com/downloads/connector/j/3.1.html
下载j2sdk
下载版本:jdk-1_5_0_04-windows-i586-p.exe
http://java.sun.com/j2se/1.5.0/download.jsp
下载tomcat
下载版本: jakarta-tomcat-5.5.9.exe
http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi
安装,配置j2sdk:
执行j2sdk安装程序,按默认设置进行安装,也可自定义路径,但需修改下面的配置
配置j2sdk:
配置环境变量:
我的电脑->属性->高级->环境变量->系统变量中添加以下环境变量:
JAVA_HOME=C:\Program Files\Java\jdk1.5.0_04
CLASSPATH=%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
path=%JAVA_HOME%\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
写一个简单的java程序来测试J2SDK是否已安装成功:
public class hello
{
public static void main(String args[])
{
System.out.println("Hello");
}
}
将程序保存为文件名为hello.java的文件。
打开命令提示符窗口,进入到hello.java所在目录,键入下面的命令
javac hello.java
java hello
此时若打印出来hello则安装成功,若没有打印出这句话,仔细检查以上配置是否正确。
注意系统文件夹选项中应确定“隐藏已知文件类型的扩展名”不勾选(我的电脑—工具—查看)
安装,配置tomcat
执行tomcat安装程序,按默认设置进行安装,也可自定义路径,但需修改下面的配置
我的电脑->属性->高级->环境变量->系统变量中添加以下环境变量
CATALINA_HOME=C:\Program Files\Apache Software Foundation\Tomcat 5.5
CATALINA_BASE=C:\Program Files\Apache Software Foundation\Tomcat 5.5
修改环境变量中的classpath,把tomat安装目录下的common\lib下的servlet-api.jar添加到classpath中去,
修改后的classpath如下:
classpath=%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar;
启动tomcat,在IE中访问http://localhost:8080,若看到tomcat的欢迎页面的话说明安装成功。
安装mysql
解压缩mysql-4.1.13-win32.zip,运行setup.exe
首先出现的是安装向导欢迎界面,直接点击“Next”
继续,选择安装类型,选择“自定义”custom安装,然后点“Next”下一步,出现自定义安装界面
选择安装路径:C:\MySQL Server 4.1(可自定义)
点“OK”返回到自定义安装界面,路径已改为设置的路径
点“Next”,准备开始安装
点“Install”开始安装
完成后出现创建MySQL.com帐号的界面
如果是首次使用MySQL,选“Create anew free MySQL.com accout”
点“Next”,输入你的Email地址和自己设定的用于登录MySQL.com的密码
填完后点“Next”进入第二步
填写姓名等相关信息,填完点“Next”,进入第三步
填完电话号码、公司名称等信息后,点“Next”,
然后出现预览你刚才填的信息的界面,点“Next”出现安装完成界面
注意,这里有个配置向导的选项(Configure the MySQL Server now),
建议勾选立即配置你的MySQL。许多说安装完MySQL后无法启动,原因就在于没有配置MySQL。
点击“Finish”完成安装,并开始配置MySQL
点“Next”,进入配置类型选择页面。选“Detailed configuration”(详细配置)
点“Next”,进入服务类型选择页面。选“Developer Machine”(开发者机器),这样占用系统的资源不会很多
点“Next”后,进入数据库用法选择页面。选择“Multifunctional Database”
点“Next”,进入选择InnoDB数据存放位置页面
不用更改设置,直接放在Installation Path安装目录里即可,然后点“Next”,选择MySQL的同时联接数
选择“Manual Setting”,设置为100(根据自己需要,酌情设置)
点“Next”,配置MySQL在TCP/IP通讯环境中的端口选择默认的3306端口即可。
点“Next”,选择MySQL中的字符设置
注意,这里的选择将会影响你是否能在MySQL中使用中文。选择gb2312字符集以便支持简体中文
点“Next”,设置Windows服务选项
注意,这里的选择很关键。
“Install As Windows Service”一定要勾选,这是将MySQL作为Windows的服务运行。
“Service Name”就用默认的“MySQL”
下面的“Launch the MySQL Server automatically”一定要勾选,这样Windows启动时,MySQL就会自动启动服务,要不然就要手工启动MySQL。
许多人说安装MySQL后无法启动、无法连接、出现10061错误,原因就在这里。
点“Next”,设置根帐号root的登录密码
“Modify Security Settings”是设置根帐号的密码,输入你设定的密码即可。
“Create An Anonymous Account”是创建一个匿名帐号,这样会导致未经授权的用户非法访问你的数据库,有安全隐患,建议不要勾选。
点“Next”,MySQL配置向导将依据你上面的所有设定配置MySQL,以便MySQL的运行符合你的需要
点“Execute”开始配置,当出现“Service started successfully”时,说明你的配置完成,MySQL服务启动成功
点“Finish”完成,整个MySQL的配置完成,剩下的就是用MySQL客户端连接MySQL服务器,然后使用了。
安装JDBC驱动:
解压缩mysql-connector-java-3.1.10.zip
将要使用的是mysql-connector-java-3.1.10-bin-g.jar和mysql-connector-java-3.1.10-bin.jar
配置
在C:\Program Files\Java目录下建立mysqlforjdbc子目录,进入该目录将mysql-connector-java-3.1.10-bin.jar到该目录下
进入C:\Program Files\Java\jdk1.5.0_04\lib目录将mysql-connector-java-3.1.10-bin-g.jar拷贝到该目录下
然后配置classpath,追加%JAVA_HOME%\lib\mysql-connector-java-3.1.10-bin-g.jar;C:\Program Files\Java\mysqlforjdbc\mysql-connector-java-3.1.10-bin.jar;到该环境变量中去
追加以后环境变量如下:
CLASSPATH=%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;C:\Program Files\Apache Software Foundation\Tomcat5.5\common\lib\servlet-api.jar;%JAVA_HOME%\lib\mysql-connector-java-3.1.10-bin-g.jar;C:\Program Files\Java\mysqlforjdbc\mysql-connector-java-3.1.10-bin.jar;
配置这个的目的是让java应用程序找到连接mysql的驱动.
查看并启动MySQL服务
在Windows XP下安装完MySQL后,它就已经自动启动服务了,并且在开始菜单中有其客户端的快捷方式连接
可以通过Windows的服务管理器查看。“开始”-“运行”,输入“services.msc”,回车。
弹出Windows的服务管理器,然后就可以看见服务名为“mysql”的服务项了,其右边标明“已启动”
在开始菜单-所有程序-MySQL-MySQL Server 4.1-MySQL Command Line Client用客户端的快捷方式连接
输入安装是设置的密码即可
数据库的使用
Mysql安装完毕以后,在开始菜单-所有程序-MySQL-MySQL Server 4.1-MySQL Command Line Client用客户端的快捷方式连接
输入安装时设置的密码
使用mysql的基本命令(在mysql命令行编辑每输入完命令后最后一定要有分号)
显示数据库:show databases;
使用数据库:use 数据库名;
建库
在mysql里建一个数据库first,以及在数据库里建一个表about
命令:create database first;
为数据库设置权限(用户和密码)
命令:grant all privileges on first.* to test@localhost identified by “123456”;
当你执行完这个命令以后,只要你再以用户名:test,密码:123456登录时你就只可以对first这个数据库操作,这样避开使用root
输入命令:use first;
使用first数据库;
在first库中建表
命令:create table about(id int(8) primary key,name varchar(10));
在表中假如数据:
命令:insert into about values('xyw1026','laojiang');
退出
命令:exit
JSP连接mysql
在C:\Program Files\Apache Software Foundation\Tomcat5.5\webapps目录下建立子目录myapp
进入C:\Program Files\Apache Software Foundation\Tomcat5.5\webapps\myapp目录下
用记事本编写一个文件保存为first.jsp
代码如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/softforum?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"
//first为你的数据库名
Connection conn= DriverManager.getConnection(url);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from first";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜你");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
在浏览器中输入:
http://127.0.0.1:8080/myapp/first.jsp
若出现:
id|num
0 |laojiang
数据库操作成功,恭喜你
表示配置成功
进入C:\Program Files\Apache Software Foundation\Tomcat5.5\webapps\myapp目录
在myapp目录下新建一个目录WEB-INF,注意,目录名称是区分大小写的;
在WEB-INF下用记事本新建一个文件,命名为web.xml,内容如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>My Web Application</display-name>
<description>
A application for test.
</description>
</web-app>
在myapp下用记事本新建一个测试的jsp页面,文件名为index.jsp,文件内容如下:
<html><body><center>
Now time is: <%=new java.util.Date()%>
</center></body></html>
重启Tomcat
打开浏览器,输入http://localhost:8080/myapp/index.jsp
看到当前时间的话说明成功安装。
建立自己的Servlet:
用记事本新建一个servlet程序,文件名为HelloWorld.java,文件内容如下:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><head><title>");
out.println("This is my first Servlet");
out.println("</title></head><body>");
out.println("<h1>Hello,World!</h1>");
out.println("</body></html>");
}
}
编译
将HelloWorld.java剪切到C:\Program Files\Apache Software Foundation\Tomcat5.5\common\classes目录下
命令行方式下输入:
cd C:\Program Files\Apache Software Foundation\Tomcat5.5\common\classes
javac HelloWorld.java
用javac HelloWorld.java来编译这个文件,如果出现无法import javax.servlet.*
则将C:\Program Files\Apache Software Foundation\Tomcat5.5\common\lib目录下的servlet-api.jar文件拷贝并添加到
C:\Program Files\Java\jre1.5.0_04\lib\ext目录中去就可以了
然后在C:\Program Files\Apache Software Foundation\Tomcat5.5\common\classes下会产生一个编译后的servlet文件:HelloWorld.class
用记事本打开C:\Program Files\Apache Software Foundation\Tomcat5.5\webapps\ROOT\WEB-INF目录下的web.xml如下所示,添加后的内容如下:
.
.
.
<!-- JSPC servlet mappings start -->
<servlet>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<servlet-class>org.apache.jsp.index_jsp</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<url-pattern>/index.jsp</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/servlet/HelloWorld</url-pattern>
</servlet-mapping>
<!-- JSPC servlet mappings end -->
</web-app>
这段话中的servlet这一段声明了你要调用的Servlet,而servlet-mapping则是将声明的servlet“映射”到/servlet/HelloWorld地址上
启动Tomcat,启动浏览器,输入http://localhost:8080//servlet/HelloWorld 如果看到输出HelloWorld!就说明编写的servlet成功了。
注意:修改了web.xml以及新加了class,都要重启Tomcat
也可以在自己创建的目录下测试如:
将HelloWorld.class拷贝到C:\Program Files\Apache Software Foundation\Tomcat5.5\webapps\myapp\WEB-INF\classes目录下
其中classes目录若没有就创建一个
用记事本打开C:\Program Files\Apache Software Foundation\Tomcat5.5\webapps\myapp\WEB-INF目录下的web.xml如下所示,修改后的内容如下:
.
.
.
<!-- JSPC servlet mappings start -->
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/servlet/HelloWorld</url-pattern>
</servlet-mapping>
<!-- JSPC servlet mappings end -->
</web-app>
启动Tomcat,启动浏览器,输入http://localhost:8080/myapp/servlet/HelloWorld 如果看到输出HelloWorld!就说明编写的servlet成功了。
注意:修改了web.xml以及新加了class,都要重启Tomcat
建立自己的javaBean:
用记事本新建一个java程序,文件名为TestBean.java,文件内容如下:
package test;
public class TestBean{
private String name = null;
public TestBean(String strName_p){
this.name=strName_p;
}
public void setName(String strName_p){
this.name=strName_p;
}
public String getName(){
return this.name;
}
}
编译
将TestBean.java放在c:\test下,使用如下命令编译:
C:\test>javac TestBean.java
然后在c:\Test下会产生一个编译后的bean文件:TestBean.class
将TestBean.class文件剪切到C:\Program Files\Apache Software Foundation\Tomcat5.5\webapps\myapp\WEB-INF\classes\test目录下,
若无某些子目录则创建一个
新建一个TestBean.jsp文件,文件内容为:
<%@ page import="test.TestBean" %>
<html><body><center>
<%
TestBean testBean=new TestBean("This is a test java bean.");
%>
Java bean name is: <%=testBean.getName()%>
</center></body></html>
重启Tomcat,启动浏览器,输入http://localhost:8080/myapp/TestBean.jsp 如果看到输出Java bean name is: This is a test java bean
就说明编写的javaBean成功了。
第一步:----安装J2SDK:
到SUN官方站点(http://java.sun.com)下载J2SDK的安装文件:j2sdk-1_4_2_04-windows-i586-p.exe,下载之后安装好J2SDK;安装完之后,设置环境变量:我的电脑---属性---高级---环境变量;
选择---系统变量(S):
设置JAVA_HOME环境变量:
单击---新建,在变量名中输入:JAVA_HOME
在变量值中输入:D:\Java
(假设J2SDK安装在目录D:\Java下,反正就是J2SDK的安装目录。)
然后---确定,到此已经设置好JAVA_HOME环境变量。
设置CLASSPATH环境变量:
单击---新建,在变量名中输入:CLASSPATH
在变量值中输入:D:\Java\bin;.;D:\Java\lib;D:\Java\lib\dt.jar;D:\Java\lib\tools.jar
(中间的点号“.”和分号“;”必不可少。)
然后---确定,到此已经设置好CLASSPATH环境变量。
设置PATH环境变量:
单击---新建,在变量名中输入:PATH
在变量值中输入:D:\Java;.;D:\Java\bin
(中间的点号“.”和分号“;”必不可少。)
然后---确定,到此已经设置好JAVA_HOME环境变量。
三个环境变量设置好后,写一个简单的java程序来测试J2SDK是否已安装成功:
在D:\下新建一个目录test;然后写如下程序:
public class Test {
public static void main(String args[]) {
System.out.println("This is a test program.");
}
}
将上面的这段程序保存为文件名为Test.java的文件,保存在目录D:\test下。
然后打开命令提示符窗口,cd到你的test目录,然后键入下面的命令
javac Test.java
java Test
此时如果看到打印出来This is a test program.的话说明安装成功了,
如果没有打印出这句话,你需要仔细检查一下你的配置情况。
如果上面的J2SDK安装成功的话,接下来继续安装Tomcat:
第二步:----安装Tomcat:
到tomcat官方站点(http://www.apache.org/dist/jakarta/tomcat-4/)下载tomcat:
jakarta-tomcat-4.1.30.exe,下载之后安装。(比如安装在D:\Tomcat下。)
安装完之后,设置环境变量:我的电脑---属性---高级---环境变量;
选择---系统变量(S):
设置CATALINA_HOME环境变量:
单击---新建,在变量名中输入:CATALINA_HOME
在变量值中输入:D:\Tomcat
然后---确定,到此已经设置好CATALINA_HOME环境变量。
设置CATALINA_BASE环境变量:
单击---新建,在变量名中输入:CATALINA_BASE
在变量值中输入:D:\Tomcat
然后---确定,到此已经设置好CATALINA_BASE环境变量。
然后修改环境变量中的CLASSPATH,把Tomat安装目录下的common\lib下的servlet.jar追加到CLASSPATH中去,
修改后的CLASSPATH如下:
CLASSPATH=D:\Java\bin;.;D:\Java\lib;D:\Java\lib\dt.jar;D:\Java\lib\tools.jar;
D:\Tomcat\common\lib\servlet.jar
接着可以启动tomcat,在IE中访问http://localhost:8080,如果看到tomcat的欢迎页面的话说明安装成功了。
如果上面的tomcat安装成功的话,接下来继续安装JSP访问SQL Server 2000的驱动程序:
第三步:----安装JSP访问SQL Server 2000的驱动程序:
从微软的网站上下载驱动程序:SQL Server 2000 For JDBC 驱动程序,在Google中随便搜索就有。
然后将它安装好。(比如安装目录是D:\SQLDriverForJDBC。)
然后必须将安装目录中的lib目录下三个jar文件:
msbase.jar,mssqlserver.jar,msutil.jar拷贝到Tomcat目录下common\lib目录下,之后,修改环境变量中的CLASSPATH,
把SQL Server 2000 For JDBC 驱动程序安装目录下的
D:\SQLDriverForJDBC\lib\msbase.jar;D:\SQLDriverForJDBC\lib\mssqlserver.jar;
D:\SQLDriverForJDBC\msutil.jar;
追加到CLASSPATH中去,修改后的CLASSPATH如下:
CLASSPATH=D:\Java\bin;.;D:\Java\lib;D:\Java\lib\dt.jar;
_D:\Java\lib\tools.jar;D:\LubeeTomcat\common\lib\servlet.jar;
_D:\SQLDriverForJDBC\lib\msbase.jar;D:\SQLDriverForJDBC\lib\mssqlserver.jar;
D:\SQLDriverForJDBC\msutil.jar
必须重新启动Tomcat!
这样做的目的是,jsp页面在编译过程中不会出现找不到sql server driver类库的问题
写一个简单的用来测试连接SQL Server 2000的JSP代码
<%@ page import="java.lang.*, java.io.*, java.sql.*, java.util.*" contentType="text/html;charset=gb2312" %>
<html>
<body>
<% Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs";
//pubs 为你的数据库的
String user="sa";
String password="admin";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select job_id,job_desc from jobs";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) { %>
您的第一个字段内容为:<%=rs.getString(1)%><br>
您的第二个字段内容为:<%=rs.getString(2)%><br>
<% } %>
<% out.print("数据库操作成功,恭喜你"); %>
<% rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
将上面的JSP代码保存为sql_test.jsp,放在/Root目录下。
在地址中输入:http://localhost:8080/sql_test.jsp,如果全部配置成功的话,将显示如下:
您的第一个字段内容为:1
您的第二个字段内容为:New Hire - Job not specified
您的第一个字段内容为:2
您的第二个字段内容为:Chief Executive Officer
您的第一个字段内容为:3
您的第二个字段内容为:Business Operations Manager
您的第一个字段内容为:4
您的第二个字段内容为:Chief Financial Officier
您的第一个字段内容为:5
您的第二个字段内容为:Publisher
您的第一个字段内容为:6
您的第二个字段内容为:Managing Editor
您的第一个字段内容为:7
您的第二个字段内容为:Marketing Manager
您的第一个字段内容为:8
您的第二个字段内容为:Public Relations Manager
您的第一个字段内容为:9
您的第二个字段内容为:Acquisitions Manager
您的第一个字段内容为:10
您的第二个字段内容为:Productions Manager
您的第一个字段内容为:11
您的第二个字段内容为:Operations Manager
您的第一个字段内容为:12
您的第二个字段内容为:Editor
您的第一个字段内容为:13
您的第二个字段内容为:Sales Representative
您的第一个字段内容为:14
您的第二个字段内容为:Designer
数据库操作成功,恭喜你
以上所有的内容涉及的相关条件:
操作系统:Window 2000 Server
J2SDK版本:j2sdk-1_4_2_04-windows
Tomcat版本:jakarta-tomcat-4.1.30
本地数据库:SQL Server 2000
[Windows]:
登录MySQL数据库
mysql -h localhost -u username -p password database
设置密码
set password=password('password');
创建数据库
create database test;
给数据库设置权限
grant all on test.* to user@localhost identifird by 'password';
Don't know how to do the program
1. Specification
Write a class Game that models the tic-tac-toe game. Tic-tac-toe (also called noughts and crosses) is a game
between two players, X and O, who take turns to mark the spaces in a N x N board. The default value for N
is 3. Player X always moves first. A player wins if he/she has exactly W of his/her symbols in a line (vertical,
horizontal or diagonal). The default value for W is 3.
The player X wins the following game with N = 3 and W = 3.
The class Game should contain at least the following :
a. Static member function getID
Syntax
The class should include the member function getID that returns your name and University number. The
function prototype is:
class Game {
private:
...
public:
...
static string getID() { return("Chan Tai Man, h0512345"); }
}
X
X
O
X
X O
X
X O O
X
X O O
X
move 1 move 2 move 3 move 4 move 5
replace it with your own information
p. 2
b. Constructor
Syntax
The class should include appropriate constructors to construct an empty board. The function prototype is:
Game(unsigned int N, unsigned int W);
N defines the dimension of the board. W defines the winning number of symbols in a line. For example,
the following statement creates a 10x10 board and it requires 5 symbols in a line for a player to win.
Game game1(10, 5); // create 10x10 board,
// player having 5 symbols in a line wins
If no parameters are specified, the default is a 3 x 3 board and requiring 3 symbols to win.
Game game2; // create 3x3 board,
// player having 3 symbols in a line wins
Assumption
To simplify your program, you may assume that N is in the range of 1 to 10. W is always less than or equal
to N.
c. Member function move
Syntax
The class should contain a member function move that represents a move made by a player.
The function prototype is:
int move(char player, unsigned int vert_coor, unsigned int hori_coor);
player can be 'X' or 'O' (letter O, not zero). vert_coor and hori_coor are the coordinates of the cell that is
to be marked by the player. Both coordinates start from 0.
The following statements result in an X being marked on cell (1, 2) of the 3x3 board.
Game game1(3, 3);
int status = game1.move('X', 1, 2); // status will be 0
The content of the resultant board will be:
X
hori_coor
0 1 2
0
1
2
vert_coor
p. 3
Return Code
The member function should return a status code to the caller, with the following meaning:
• 0 : The move is successful and the game continues.
• 1 : The move is successful and the game is over. The player making the move wins.
(probably the most difficult part of your class)
• 2 : The move is successful and the game is over. It is a draw which means all cells are marked
but there's no winner.
• -1 : The move is unsuccessful because the game is already over.
• -2 : The move is unsuccessful because the parameters are invalid.
E.g. Player not 'X' or 'O', or specified cell is outside the board.
• -3 : The move is unsuccessful because it is not the turn of the player to make the move.
N.B. player 'X' always makes the first move.
• -4 : The move is unsuccessful because the specified cell is already occupied.
• -99 : The move is unsuccessful because of other errors (will not be tested during marking)
d. Member function dump
Syntax
The class should contain a member function dump. It returns a string object that represents the current
content of the board. The function prototype is:
string dump(void);
The returned string contains (N+1) * N characters. Each character represents the content of one cell: 'X'
for a cross, 'O' (letter O, not zero) for a nought, '.' (full stop) for an empty cell. The content is dumped
row by row. Each row is terminated by a newline. Assuming the current content of a 3x3 board is:
And the following statement is executed:
string content = game1.dump();
content will be a string object containing 12 characters: X.O\nXOO\n.X.\n
X O
X O O
X
p. 4
e. Member function save
Syntax
The class should contain a member function save that saves the current game to a file. What is actually
saved is determined by you. The requirement is that the file created by save should be readable by another
member function load that can restore the game. The function prototype is:
int save(char *filename);
filename is the name of the file to be used to save the game. E.g.
Game game1(3, 3);
game1.move('X', 1, 2);
int status = game1.save("mygame.dat");
A file mygame.dat should be created. No other files should be created.
Return Code
The member function should return a status code to the caller, with the following meaning:
• 0 : The game is successfully saved.
• -1 : The game cannot be saved because of errors. E.g. file can't be opened for writing
f. Member function load
Syntax
The class should contain a member function load that restores a game from a file. The function prototype is:
int load(char *filename);
filename is the name of the file containing the game.
The following program demonstrates how a game is saved and then restored to another Game object.
int main() {
Game game1(3, 3);
game1.move('X', 1, 2);
game1.move('O', 0, 0);
game1.save("mygame.dat");
Game game2(3, 3);
int status = game2.load("mygame.dat");
if (status == 0) {
cout << game2.dump();
cout << game2.move('O', 2, 1);
}
}
It should also be possible to save a game in one program, and restore it to another Game object in another
program.
p. 5
The following will be printed:
O..
..X
...
-3
Return Code
The member function should return a status code to the caller, with the following meaning:
• 0 : The game is successfully loaded.
• -1 : The game cannot be loaded because of errors. E.g. file can't be found
2. Submission
You should write the class in a header file (e.g. ex4.h) and submit the header file on or before the deadline.
You must NOT include main() in your header file. During marking, your header file will be included in a
testing program like the following :
#include <iostream>
#include <string>
#include <fstream>
#include "ex4.h" // ex4.h is written by you
int main()
{
Game game1(8, 3);
game1.move('X', 4, 3);
game1.move('O', 1, 2);
string s1 = game1.dump();
cout << s1;
...
}
Then the testing program will be compiled and run on hkueee, and the output will be compared with the
expected output.
To submit the source file, login hkueee.hku.hk and type homework (or /usr/local/bin/homework).
You will be instructed onscreen how to submit your file. Submission through email will NOT be accepted.
Plagiarism (i.e. copying) is strictly prohibited. Zero marks will be given to both the
source and copy if discovered. You must not copy or let others copy your work. It's your
own responsibility to prevent others from copying your program directly or indirectly (e.g.
obtain your program through another person).
You can discuss with others in the design phase only. Coding must be done separately and group program is
NOT accepted.
Marks will be deducted 20% per day for late submission
move returns -3 because it
should be player X's turn
p. 6
3. Marking scheme
The assignment will be marked according to the following scheme:
1. Compilable submission (20%)
• You will be awarded the marks if the following testing program can be compiled and run
successfully.
#include <iostream>
#include <string>
#include "ex4.h" // ex4.h is written by you
int main()
{
cout << Game::getID(); // output your ID
}
2. Provision of correct constructors, basic move function and dump function (30%)
3. Provision of correct move function that returns appropriate status code and other functions (50%)
Final remark: If you develop your program on computers other than the Unix machines of the Dept (i.e. not
on hkueee, su1001 to su1005), you must upload the source file to hkueee; compile and test it before you
submit the source file. Please note that programs working on PC may not work properly on hkueee.
Description
We are not alone.
In the year 3000, scientists have eventually found another planet which has intelligent
being living on. Let's say, Planet X. And we call the intelligent being there 'XMen'. To
learn advanced technology from Planet X, we want to exchange information with
XMen. Unfortunately, XMen use a very strange data format when sending message,
which is called m-encoding (m is for multiplication). Scientists on earth have
successfully found out the algorithm of m-encoding, defining as following:
For each data package from XMen, there are two non-negative integer numbers, A
and B. And the actual data XMen want to send is the product of A and B (A * B).
So, in this problem, you are to implement a decoder for data packages from XMen.
Input
There are multiple test cases. Input data starts with an integer N, indicating the
number of test cases. Each test case occupies just one line, and contains two
non-negative
integers A and B (0 <= A, B <=
10的1000000次方)(这里本来100000在10的右上方指数位置,但是贴过来变成一行了,所以我改成这样) separated by
just one space.
Output
For each test case, output the actual data XMen want to send, one in a line.
Sample Input
3
1 1
100 123
12345678901234567890 54321
Sample Output
1
12300
670629623593962962352690
题目释译后大概是这样:
我们并不孤独.
在公元3000年,科学家发现了在其它星球上有智慧的生命存在.我们对那个星球取名"X",那么那个
星球的外星人叫X星球人.为了学习X星球上的先进科技,我们需要和X星球人交换信息.
X星球人用一种奇怪的方式来传输信息,这种方式叫"m编码"方式.我们的科学最终发现了"m编码"
方式的算法,原来对于每个信息,X星球人把它分成两个数(A,B)的乘积(A*B),传输的时候外星人
传输的是A和B,现在要你把这个信息解码,即算出:A*B的值.
输入数据:
每行一个数,以EOF结束:
1 1
100 123
12345678901234567890 54321
输出数据:
每行一个数,分别为那一行两个数的乘积,
1
12300
670629623593962962352690
时间要求:
2秒钟以内.(注意,题目所给的输入样例只是最基本的数据,在真正测试时,会测试最复杂的情况.)
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define BACKSPACE 8
char *get_password(const char *prompt)
{
static char buffer[128];
int i = 0;
char letter=NULL;
printf( prompt );
// 最多可输入127个字符,最后一个留个'\0'
while ( ( i < 127 ) && ( letter!='\r' ) )
{
letter = getch();
// 当前输入的字符为退格'\b'
if ( letter == BACKSPACE )
{
// buffer中有字符存在
if( i > 0 )
{
// 缓冲区中字符退一个
buffer[ --i ] = NULL;
// 当前光标正等着你输入一个字符,而你却按下了退格键
// 屏幕上字符也应该退一个,这里相当于putchar( '\b' );
// 这样就将光标退到了上一个字符的位置,
putchar( BACKSPACE );
// 这里光标在要删除的字符上面闪烁,输出一个空格就将'*'号换掉了
// 想象一下你正在Word中插入模式下按下空格
putchar( ' ' );
// 因为你的空格操作导致光标又跳到了下一个字符位置
// 所以还需要退一次,以使光标在正确位置显示
putchar( BACKSPACE );
}
else
{
putchar( 7 );
}
}
else if ( letter != '\r' )
{
buffer[ i++ ] = letter;
putchar( '*' );
}
}
// 加上字符串结束标志,在C++编译器下这上语句是错的
// buffer = NULL;
// 可以这样处理
buffer[i] = '\0';
return buffer;
}
int main()
{
char *password;
password = get_password( "Enter Password:" );
if ( strcmp( password, "ILoveYou" ) )
printf( "\nPassword Incorrect!\n" );
else
printf( "\nPassword OK!\n" );
return 0;
}
/*
putchar( BACKSPACE );
putchar( ' ' );
putchar( BACKSPACE );
*/
// 举个例子
// 假设你当前你已经输入了一个字母'a',那么屏幕上应该是 "*_"
// '_'代表当标闪烁的地方
// putchar( BACKSPACE )之后
// 光标应该在*的上面
// putchar( ' ' )之后
// 你用空格替代了'*',所以就成了" _"(下划线前面有个空格)
// 看到没有,一个空格输入后光标又跳到了一个待输入的位置
// 而你的下一个字符需要在空格的位置显示,所以,再一次
// putchar( BACKSPACE )之后
// 同第一个一样,光标这回在空格上面,这将当你输入正确的字符后
// 就会在被删除字符的原处而不是下一处显示那个星星
Create a program for a collection of pets. You need to define your own
pet attributes. It has features with the following specifications:
i. The program can display individual pet or all pets information.
ii. The program can store all pets information in an array.
iii. The program can search for a particular pet detail.
iv. Any two features that you can use to manipulate the pet information.
*******************************************************************
class Pet{
// data attributes
// constructors
// methods.
}
Secondly u may want to creatre a constainer class called PetCollection
and this class should include amongst othger things the Pet array and a
size attibute to indicate the current size of the collection.
class PetCollection{
private Pet pets[];
private int size;
// constuctor
public PetCollection(){
// allocate memory to the array - lets say up to 100
// initiliaze the size to 0 to indicate the the array is empty initially.
}
// methods to include are AddPet, DisplayPet, SearchPet, RemovePet,
// menus and other auxillary funcitons should also be included in this class
}// end class
Finally u may want to create a driver class (i.e. the runnable application cal><)
public class driver{
public static void main(String args[]){
// instantiate the PetCollection
//use a d0-while loop so that the program will only stop when the user
// choosed to end the profram.
}
}// end class