001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Scott Ferguson
028: */
029:
030: package com.caucho.quercus.lib;
031:
032: import com.caucho.quercus.QuercusModuleException;
033: import com.caucho.quercus.annotation.NotNull;
034: import com.caucho.quercus.annotation.Optional;
035: import com.caucho.quercus.annotation.Reference;
036: import com.caucho.quercus.annotation.ReturnNullAsFalse;
037: import com.caucho.quercus.env.*;
038: import com.caucho.quercus.lib.file.SocketInputOutput;
039: import com.caucho.quercus.module.AbstractQuercusModule;
040: import com.caucho.util.L10N;
041:
042: import javax.naming.NameNotFoundException;
043: import javax.naming.NamingEnumeration;
044: import javax.naming.NamingException;
045: import javax.naming.directory.Attribute;
046: import javax.naming.directory.Attributes;
047: import javax.naming.directory.DirContext;
048: import javax.naming.directory.InitialDirContext;
049: import java.io.IOException;
050: import java.net.InetAddress;
051: import java.net.Socket;
052: import java.util.LinkedHashMap;
053: import java.util.Map;
054: import java.util.logging.Level;
055: import java.util.logging.Logger;
056: import java.util.regex.Pattern;
057:
058: /**
059: * Information about PHP network
060: */
061: public class NetworkModule extends AbstractQuercusModule {
062: private static final L10N L = new L10N(NetworkModule.class);
063: private static final Logger log = Logger
064: .getLogger(NetworkModule.class.getName());
065:
066: private static final LinkedHashMap<String, LongValue> _protoToNum = new LinkedHashMap<String, LongValue>();
067: private static final LinkedHashMap<String, ServiceNode> _servToNum = new LinkedHashMap<String, ServiceNode>();
068:
069: public static final int LOG_EMERG = 0;
070: public static final int LOG_ALERT = 1;
071: public static final int LOG_CRIT = 2;
072: public static final int LOG_ERR = 3;
073: public static final int LOG_WARNING = 4;
074: public static final int LOG_NOTICE = 5;
075: public static final int LOG_INFO = 6;
076: public static final int LOG_DEBUG = 7;
077:
078: public static final int LOG_PID = 1;
079: public static final int LOG_CONS = 2;
080: public static final int LOG_NDELAY = 8;
081: public static final int LOG_NOWAIT = 16;
082: public static final int LOG_ODELAY = 4;
083: public static final int LOG_PERROR = 32;
084:
085: public static final int LOG_AUTH = 32;
086: public static final int LOG_AUTHPRIV = 80;
087: public static final int LOG_CRON = 72;
088: public static final int LOG_DAEMON = 24;
089: public static final int LOG_KERN = 0;
090: public static final int LOG_LOCAL0 = 128;
091: public static final int LOG_LOCAL1 = 136;
092: public static final int LOG_LOCAL2 = 144;
093: public static final int LOG_LOCAL3 = 152;
094: public static final int LOG_LOCAL4 = 160;
095: public static final int LOG_LOCAL5 = 168;
096: public static final int LOG_LOCAL6 = 176;
097: public static final int LOG_LOCAL7 = 184;
098: public static final int LOG_LPR = 48;
099: public static final int LOG_MAIL = 16;
100: public static final int LOG_NEWS = 56;
101: public static final int LOG_SYSLOG = 40;
102: public static final int LOG_USER = 8;
103: public static final int LOG_UUCP = 64;
104:
105: public static final int DNS_A = 1;
106: public static final int DNS_CNAME = 16;
107: public static final int DNS_HINFO = 4096;
108: public static final int DNS_MX = 16384;
109: public static final int DNS_NS = 2;
110: public static final int DNS_PTR = 2048;
111: public static final int DNS_SOA = 32;
112: public static final int DNS_TXT = 32768;
113: public static final int DNS_AAAA = 134217728;
114: public static final int DNS_SRV = 33554432;
115: public static final int DNS_NAPTR = 67108864;
116: public static final int DNS_A6 = 16777216;
117: public static final int DNS_ALL = 251713587;
118: public static final int DNS_ANY = 268435456;
119:
120: /**
121: * Opens a socket
122: */
123: public static SocketInputOutput fsockopen(Env env, String host,
124: @Optional("80")
125: int port, @Optional
126: @Reference
127: Value errno, @Optional
128: @Reference
129: Value errstr, @Optional
130: double timeout) {
131: try {
132: Socket s = new Socket(host, port);
133:
134: if (timeout > 0)
135: s.setSoTimeout((int) (timeout * 1000));
136: else
137: s.setSoTimeout(120000);
138:
139: SocketInputOutput stream;
140: stream = new SocketInputOutput(env, s,
141: SocketInputOutput.Domain.AF_INET);
142:
143: stream.init();
144:
145: return stream;
146: } catch (IOException e) {
147: log.log(Level.FINER, e.toString(), e);
148:
149: if (errstr != null)
150: errstr.set(env.createString(e.toString()));
151:
152: return null;
153: }
154: }
155:
156: /**
157: * Converts string to long
158: */
159: public static Value ip2long(String ip) {
160: // php/1m00
161:
162: if (ip == null)
163: return LongValue.MINUS_ONE;
164:
165: long v = 0;
166:
167: int p = 0;
168: int len = ip.length();
169: for (int i = 0; i < 4; i++) {
170: int digit = 0;
171: char ch = 0;
172:
173: for (; p < len && '0' <= (ch = ip.charAt(p)) && ch <= '9'; p++) {
174: digit = 10 * digit + ch - '0';
175: }
176:
177: if (p < len && ch != '.')
178: return BooleanValue.FALSE;
179: else if (p == len && i < 3)
180: return BooleanValue.FALSE;
181:
182: p++;
183:
184: v = 256 * v + digit;
185: }
186:
187: return new LongValue(v);
188: }
189:
190: /**
191: * Returns the IP address of the given host name. If the IP address cannot
192: * be obtained, then the provided host name is returned instead.
193: *
194: * @param hostname the host name who's IP to search for
195: *
196: * @return the IP for the given host name or, if the IP cannot be obtained,
197: * the provided host name
198: */
199: public static String gethostbyname(String hostname) {
200: // php/1m01
201:
202: if (hostname == null)
203: return "";
204:
205: InetAddress ip = null;
206:
207: try {
208: ip = InetAddress.getByName(hostname);
209: } catch (Exception e) {
210: log.log(Level.WARNING, e.toString(), e);
211:
212: return hostname;
213: }
214:
215: return ip.getHostAddress();
216: }
217:
218: /**
219: * Returns the IP addresses of the given host name. If the IP addresses
220: * cannot be obtained, then the provided host name is returned instead.
221: *
222: * @param hostname the host name who's IP to search for
223: *
224: * @return the IPs for the given host name or, if the IPs cannot be obtained,
225: * the provided host name
226: */
227: public static Value gethostbynamel(Env env, String hostname) {
228: // php/1m02
229:
230: InetAddress ip[] = null;
231:
232: try {
233: ip = InetAddress.getAllByName(hostname);
234: } catch (Exception e) {
235: log.log(Level.WARNING, e.toString(), e);
236:
237: return BooleanValue.FALSE;
238: }
239:
240: ArrayValue ipArray = new ArrayValueImpl();
241:
242: for (int k = 0; k < ip.length; k++) {
243: String currentIPString = ip[k].getHostAddress();
244:
245: StringValue currentIP = env.createString((currentIPString));
246:
247: ipArray.append(currentIP);
248: }
249:
250: return ipArray;
251: }
252:
253: /**
254: * Returns the IP address of the given host name. If the IP address cannot
255: * be obtained, then the provided host name is returned instead.
256: *
257: * @return the IP for the given host name or, if the IP cannot be obtained,
258: * the provided host name
259: */
260: @ReturnNullAsFalse
261: public static String gethostbyaddr(Env env, String ip) {
262: // php/1m03
263:
264: if (ip == null) {
265: env.warning("Address must not be null.");
266:
267: return null;
268: }
269:
270: String formIPv4 = "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\."
271: + "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\."
272: + "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\."
273: + "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";
274:
275: CharSequence ipToCS = ip.subSequence(0, ip.length());
276:
277: if (!(Pattern.matches(formIPv4, ipToCS))) {
278: env.warning("Address is not in a.b.c.d form");
279:
280: return null;
281: }
282:
283: String splitIP[] = null;
284:
285: try {
286: splitIP = ip.split("\\.");
287: } catch (Exception e) {
288: log.log(Level.WARNING, e.toString(), e);
289:
290: env.warning("Regex expression invalid");
291:
292: return ip;
293: }
294:
295: byte addr[] = new byte[splitIP.length];
296:
297: for (int k = 0; k < splitIP.length; k++) {
298: Integer intForm = new Integer(splitIP[k]);
299:
300: addr[k] = intForm.byteValue();
301: }
302:
303: InetAddress host = null;
304:
305: try {
306: host = InetAddress.getByAddress(addr);
307: } catch (Exception e) {
308: log.log(Level.WARNING, e.toString(), e);
309:
310: return ip;
311: }
312:
313: return host.getHostName();
314: }
315:
316: /**
317: * Returns the protocol number associated with the given protocol name.
318: *
319: * @param protoName the name of the protocol
320: *
321: * @return the number associated with the given protocol name
322: */
323: public static Value getprotobyname(String protoName) {
324: // php/1m04
325:
326: if (!(_protoToNum.containsKey(protoName)))
327: return BooleanValue.FALSE;
328:
329: return LongValue.create((_protoToNum.get(protoName).toLong()));
330: }
331:
332: /**
333: * Returns the protocol name associated with the given protocol number.
334: */
335: @ReturnNullAsFalse
336: public static String getprotobynumber(int protoNumber) {
337: // php/1m05
338:
339: for (Map.Entry<String, LongValue> entry : _protoToNum
340: .entrySet())
341: if (entry.getValue().toLong() == protoNumber)
342: return entry.getKey();
343:
344: return null;
345: }
346:
347: /**
348: * Returns the port number associated with the given protocol and service
349: * name.
350: *
351: * @param service the service name
352: * @param protocol the protocol, either udp or tcp
353: *
354: * @return the number associated with the given protocol and service name
355: */
356: public static Value getservbyname(String service, String protocol) {
357: // php/1m06
358:
359: if (!(_servToNum.containsKey(service)))
360: return BooleanValue.FALSE;
361:
362: ServiceNode node = _servToNum.get(service);
363:
364: if (!(node.protocolCheck(protocol)))
365: return BooleanValue.FALSE;
366:
367: return node.getPort();
368: }
369:
370: /**
371: * Returns the service name associated it the given protocol name and
372: * service port.
373: *
374: * @param port the service port number
375: * @param protocol the protocol, either udp or tcp
376: *
377: * @return the service name
378: */
379: @ReturnNullAsFalse
380: public static String getservbyport(int port, String protocol) {
381: // php/1m07
382:
383: for (Map.Entry<String, ServiceNode> entry : _servToNum
384: .entrySet()) {
385: ServiceNode node = entry.getValue();
386:
387: if (node.getPort().toLong() == port
388: && node.protocolCheck(protocol))
389: return entry.getKey();
390: }
391:
392: return null;
393: }
394:
395: public static boolean getmxrr(Env env, @NotNull
396: String hostname, @Reference
397: Value mxhosts, @Optional
398: @Reference
399: Value weight) {
400: return dns_get(env, hostname, "MX", mxhosts, weight);
401: }
402:
403: private static boolean dns_get(Env env, String hostname,
404: String type, Value hostsRef, Value weightRef) {
405: try {
406: // php/1m08
407:
408: if (hostname == null || type == null)
409: return false;
410:
411: DirContext ictx = new InitialDirContext();
412: Attributes attributes;
413:
414: if (type.equals("ANY") || type.equals("ALL"))
415: attributes = ictx.getAttributes("dns:/" + hostname);
416: else
417: attributes = ictx.getAttributes("dns:/" + hostname,
418: new String[] { type });
419:
420: ArrayValue hosts = new ArrayValueImpl();
421:
422: ArrayValue weights = new ArrayValueImpl();
423:
424: NamingEnumeration list = attributes.getAll();
425:
426: if (!(list.hasMore()))
427: return false;
428:
429: while (list.hasMore()) {
430: Attribute record = (Attribute) list.next();
431:
432: String id = record.getID();
433:
434: NamingEnumeration attrList = record.getAll();
435:
436: while (attrList.hasMore()) {
437: String target = String.valueOf(attrList.next());
438:
439: if (target.endsWith("."))
440: target = target.substring(0,
441: target.length() - 1);
442:
443: int weight = 0;
444:
445: if ("MX".equals(id)) {
446: int space = target.indexOf(" ");
447: if (space > -1) {
448: String priorityPart = target.substring(0,
449: space);
450: String hostPart = target
451: .substring(space + 1);
452:
453: target = hostPart;
454:
455: try {
456: weight = Integer.valueOf(priorityPart);
457: } catch (NumberFormatException ex) {
458: log.log(Level.FINE, ex.toString(), ex);
459: }
460: }
461: }
462:
463: weights.append(LongValue.create(weight));
464: hosts.append(StringValue.create(target));
465: }
466: }
467:
468: ArrayModule.array_multisort(env, new Value[] { weights,
469: hosts });
470:
471: if (hostsRef != null)
472: hostsRef.set(hosts);
473:
474: if (weightRef != null)
475: weightRef.set(weights);
476:
477: return true;
478: } catch (NameNotFoundException e) {
479: return false;
480: } catch (NamingException e) {
481: throw new QuercusModuleException(e);
482: }
483: }
484:
485: /**
486: * Finds the mx hosts for the given hostname, placing them in mxhosts and
487: * their corresponding weights in weight, if provided. Returns true if any
488: * hosts were found. False otherwise.
489: *
490: * @param hostname the hostname to find records for
491: * @param mxhosts an array to add the mx hosts to
492: * @param weight an array to add the weights to
493: *
494: * @return true if records are found, false otherwise
495: */
496: public static boolean dns_get_mx(Env env, @NotNull
497: String hostname, @Reference
498: Value mxhosts, @Optional
499: @Reference
500: Value weight) {
501: return dns_get(env, hostname, "MX", mxhosts, weight);
502:
503: }
504:
505: public static boolean checkdnsrr(Env env, @NotNull
506: String hostname, @Optional("MX")
507: String type) {
508: return dns_get(env, hostname, type, null, null);
509: }
510:
511: /**
512: * Finds the mx hosts for the given hostname, placing them in mxhosts and
513: * their corresponding weights in weight, if provided. Returns true if any
514: * hosts were found. False otherwise.
515: *
516: * @param hostname the hostname to find records for
517: *
518: * @return true if records are found, false otherwise
519: */
520: public static boolean dns_check_record(Env env, @NotNull
521: String hostname, @Optional("MX")
522: String type) {
523: return dns_get(env, hostname, type, null, null);
524: }
525:
526: public ArrayValue dns_get_record(Env env, @NotNull
527: String hostname, @Optional("-1")
528: int type, @Optional
529: @Reference
530: Value authnsRef, @Optional
531: @Reference
532: Value addtlRef) {
533: ArrayValue result = new ArrayValueImpl();
534:
535: ArrayValueImpl authns = null;
536:
537: if (authnsRef != null && !authnsRef.isNull()) {
538: authns = new ArrayValueImpl();
539: authnsRef.set(authns);
540: env.stub("authns unimplemented");
541: }
542:
543: ArrayValueImpl addtl = null;
544:
545: if (addtlRef != null && !addtlRef.isNull()) {
546: addtl = new ArrayValueImpl();
547: addtlRef.set(addtl);
548: env.stub("addtl unimplemented");
549: }
550:
551: if (hostname == null)
552: return result;
553:
554: if (type == -1)
555: type = DNS_ANY;
556:
557: String typeName;
558:
559: switch (type) {
560: case DNS_A:
561: typeName = "A";
562: break;
563: case DNS_CNAME:
564: typeName = "CNAME";
565: break;
566: case DNS_HINFO:
567: typeName = "HINFO";
568: break;
569: case DNS_MX:
570: typeName = "MX";
571: break;
572: case DNS_NS:
573: typeName = "NS";
574: break;
575: case DNS_PTR:
576: typeName = "PTR";
577: break;
578: case DNS_SOA:
579: typeName = "SOA";
580: break;
581: case DNS_TXT:
582: typeName = "TXT";
583: break;
584: case DNS_AAAA:
585: typeName = "AAAA";
586: break;
587: case DNS_SRV:
588: typeName = "SRV";
589: break;
590: case DNS_NAPTR:
591: typeName = "NAPTR";
592: break;
593: case DNS_A6:
594: typeName = "A6";
595: break;
596: default:
597: typeName = null;
598: }
599:
600: try {
601: DirContext ictx = new InitialDirContext();
602: Attributes attributes;
603:
604: if (typeName == null)
605: attributes = ictx.getAttributes("dns:/" + hostname);
606: else
607: attributes = ictx.getAttributes("dns:/" + hostname,
608: new String[] { typeName });
609:
610: NamingEnumeration list = attributes.getAll();
611:
612: while (list.hasMore()) {
613: Attribute record = (Attribute) list.next();
614:
615: String id = record.getID();
616:
617: NamingEnumeration attrList = record.getAll();
618:
619: while (attrList.hasMore()) {
620: String attr = String.valueOf(attrList.next());
621:
622: String target = attr;
623:
624: if (target.endsWith("."))
625: target = target.substring(0,
626: target.length() - 1);
627:
628: ArrayValueImpl recordValue = new ArrayValueImpl();
629: recordValue.put("host", hostname);
630: recordValue.put("type", id);
631:
632: if ("MX".equals(id)) {
633: int space = target.indexOf(" ");
634: if (space > -1) {
635: String priorityPart = target.substring(0,
636: space);
637: String hostPart = target
638: .substring(space + 1);
639:
640: try {
641: recordValue.put("pri", Integer
642: .valueOf(priorityPart));
643: target = hostPart;
644: } catch (NumberFormatException ex) {
645: log.log(Level.FINE, ex.toString(), ex);
646: }
647: }
648: } else if ("A".equals(id)) {
649: try {
650: recordValue.put("ip", target);
651:
652: target = null;
653: } catch (Exception e) {
654: log.log(Level.FINE, e.toString(), e);
655: }
656: }
657:
658: if (target != null)
659: recordValue.put("target", target);
660:
661: result.put(recordValue);
662: }
663: }
664: } catch (NameNotFoundException ex) {
665: log.log(Level.FINER, ex.toString(), ex);
666: } catch (NamingException ex) {
667: throw new QuercusModuleException(ex);
668: }
669:
670: return result;
671: }
672:
673: /**
674: * Initialization of syslog.
675: */
676: public static Value define_syslog_variables(Env env) {
677: env.stub("unimplemented");
678: return NullValue.NULL;
679: }
680:
681: /**
682: * Opens syslog.
683: *
684: * XXX: stubbed for now
685: */
686: public static boolean openlog(Env env, String ident, int option,
687: int facility) {
688: env.stub("unimplemented");
689: return true;
690: }
691:
692: /**
693: * Closes syslog.
694: */
695: public static boolean closelog() {
696: return true;
697: }
698:
699: /**
700: * syslog
701: */
702: public static boolean syslog(Env env, int priority, String message) {
703: Level level = Level.OFF;
704:
705: switch (priority) {
706: case LOG_EMERG:
707: case LOG_ALERT:
708: case LOG_CRIT:
709: level = Level.SEVERE;
710: break;
711: case LOG_ERR:
712: case LOG_WARNING:
713: level = Level.WARNING;
714: break;
715: case LOG_NOTICE:
716: level = Level.CONFIG;
717: break;
718: case LOG_INFO:
719: level = Level.INFO;
720: break;
721: case LOG_DEBUG:
722: level = Level.FINE;
723: break;
724: }
725:
726: env.getLogger().log(level, message);
727:
728: return true;
729: }
730:
731: private static class ServiceNode {
732: private LongValue _port;
733:
734: private boolean _isTCP;
735: private boolean _isUDP;
736:
737: ServiceNode(int port, boolean tcp, boolean udp) {
738: _port = LongValue.create(port);
739: _isTCP = tcp;
740: _isUDP = udp;
741: }
742:
743: public LongValue getPort() {
744: return _port;
745: }
746:
747: public boolean protocolCheck(String protocol) {
748: if (protocol.equals("tcp"))
749: return _isTCP;
750: else if (protocol.equals("udp"))
751: return _isUDP;
752: else
753: return false;
754: }
755:
756: public boolean isTCP() {
757: return _isTCP;
758: }
759:
760: public boolean isUDP() {
761: return _isUDP;
762: }
763: }
764:
765: static {
766: _protoToNum.put("ip", LongValue.create(0));
767: _protoToNum.put("icmp", LongValue.create(1));
768: _protoToNum.put("ggp", LongValue.create(3));
769: _protoToNum.put("tcp", LongValue.create(6));
770: _protoToNum.put("egp", LongValue.create(8));
771: _protoToNum.put("pup", LongValue.create(12));
772: _protoToNum.put("udp", LongValue.create(17));
773: _protoToNum.put("hmp", LongValue.create(12));
774: _protoToNum.put("xns-idp", LongValue.create(22));
775: _protoToNum.put("rdp", LongValue.create(27));
776: _protoToNum.put("rvd", LongValue.create(66));
777: _servToNum.put("echo", new ServiceNode(7, true, true));
778: _servToNum.put("discard", new ServiceNode(9, true, true));
779: _servToNum.put("systat", new ServiceNode(11, true, true));
780: _servToNum.put("daytime", new ServiceNode(13, true, true));
781: _servToNum.put("qotd", new ServiceNode(17, true, true));
782: _servToNum.put("chargen", new ServiceNode(19, true, true));
783: _servToNum.put("ftp-data", new ServiceNode(20, true, false));
784: _servToNum.put("ftp", new ServiceNode(21, true, false));
785: _servToNum.put("telnet", new ServiceNode(23, true, false));
786: _servToNum.put("smtp", new ServiceNode(25, true, false));
787: _servToNum.put("time", new ServiceNode(37, true, true));
788: _servToNum.put("rlp", new ServiceNode(39, false, true));
789: _servToNum.put("nameserver", new ServiceNode(42, true, true));
790: _servToNum.put("nicname", new ServiceNode(43, true, false));
791: _servToNum.put("domain", new ServiceNode(53, true, true));
792: _servToNum.put("bootps", new ServiceNode(67, false, true));
793: _servToNum.put("bootpc", new ServiceNode(68, false, true));
794: _servToNum.put("tftp", new ServiceNode(69, false, true));
795: _servToNum.put("gopher", new ServiceNode(70, true, false));
796: _servToNum.put("finger", new ServiceNode(79, true, false));
797: _servToNum.put("http", new ServiceNode(80, true, false));
798: _servToNum.put("kerberos", new ServiceNode(88, true, true));
799: _servToNum.put("hostname", new ServiceNode(101, true, false));
800: _servToNum.put("iso-tsap", new ServiceNode(102, true, false));
801: _servToNum.put("rtelnet", new ServiceNode(107, true, false));
802: _servToNum.put("pop2", new ServiceNode(109, true, false));
803: _servToNum.put("pop3", new ServiceNode(110, true, false));
804: _servToNum.put("sunrpc", new ServiceNode(111, true, true));
805: _servToNum.put("auth", new ServiceNode(113, true, false));
806: _servToNum.put("uucp-path", new ServiceNode(117, true, false));
807: _servToNum.put("nntp", new ServiceNode(119, true, false));
808: _servToNum.put("ntp", new ServiceNode(123, false, true));
809: _servToNum.put("epmap", new ServiceNode(135, true, true));
810: _servToNum.put("netbios-ns", new ServiceNode(137, true, true));
811: _servToNum
812: .put("netbios-dgm", new ServiceNode(138, false, true));
813: _servToNum
814: .put("netbios-ssn", new ServiceNode(139, true, false));
815: _servToNum.put("imap", new ServiceNode(143, true, false));
816: _servToNum.put("pcmail-srv", new ServiceNode(158, true, false));
817: _servToNum.put("snmp", new ServiceNode(161, false, true));
818: _servToNum.put("snmptrap", new ServiceNode(162, false, true));
819: _servToNum.put("print-srv", new ServiceNode(170, true, false));
820: _servToNum.put("bgp", new ServiceNode(179, true, false));
821: _servToNum.put("irc", new ServiceNode(194, true, false));
822: _servToNum.put("ipx", new ServiceNode(213, false, true));
823: _servToNum.put("ldap", new ServiceNode(389, true, false));
824: _servToNum.put("https", new ServiceNode(443, true, true));
825: _servToNum
826: .put("microsoft-ds", new ServiceNode(445, true, true));
827: _servToNum.put("kpasswd", new ServiceNode(464, true, true));
828: _servToNum.put("isakmp", new ServiceNode(500, false, true));
829: _servToNum.put("exec", new ServiceNode(512, true, false));
830: _servToNum.put("biff", new ServiceNode(512, false, true));
831: _servToNum.put("login", new ServiceNode(513, true, false));
832: _servToNum.put("who", new ServiceNode(513, false, true));
833: _servToNum.put("cmd", new ServiceNode(514, true, false));
834: _servToNum.put("syslog", new ServiceNode(514, false, true));
835: _servToNum.put("printer", new ServiceNode(515, true, false));
836: _servToNum.put("talk", new ServiceNode(517, false, true));
837: _servToNum.put("ntalk", new ServiceNode(518, false, true));
838: _servToNum.put("efs", new ServiceNode(520, true, false));
839: _servToNum.put("router", new ServiceNode(520, false, true));
840: _servToNum.put("timed", new ServiceNode(525, false, true));
841: _servToNum.put("tempo", new ServiceNode(526, true, false));
842: _servToNum.put("courier", new ServiceNode(530, true, false));
843: _servToNum.put("conference", new ServiceNode(531, true, false));
844: _servToNum.put("netnews", new ServiceNode(532, true, false));
845: _servToNum.put("netwall", new ServiceNode(533, false, true));
846: _servToNum.put("uucp", new ServiceNode(540, true, false));
847: _servToNum.put("klogin", new ServiceNode(543, true, false));
848: _servToNum.put("kshell", new ServiceNode(544, true, false));
849: _servToNum.put("new-rwho", new ServiceNode(550, false, true));
850: _servToNum.put("remotefs", new ServiceNode(556, true, false));
851: _servToNum.put("rmonitor", new ServiceNode(560, false, true));
852: _servToNum.put("monitor", new ServiceNode(561, false, true));
853: _servToNum.put("ldaps", new ServiceNode(636, true, false));
854: _servToNum.put("doom", new ServiceNode(666, true, true));
855: _servToNum
856: .put("kerberos-adm", new ServiceNode(749, true, true));
857: _servToNum
858: .put("kerberos-iv", new ServiceNode(750, false, true));
859: _servToNum.put("kpop", new ServiceNode(1109, true, false));
860: _servToNum.put("phone", new ServiceNode(1167, false, true));
861: _servToNum.put("ms-sql-s", new ServiceNode(1433, true, true));
862: _servToNum.put("ms-sql-m", new ServiceNode(1434, true, true));
863: _servToNum.put("wins", new ServiceNode(1512, true, true));
864: _servToNum
865: .put("ingreslock", new ServiceNode(1524, true, false));
866: _servToNum.put("12tp", new ServiceNode(1701, false, true));
867: _servToNum.put("pptp", new ServiceNode(1723, true, false));
868: _servToNum.put("radius", new ServiceNode(1812, false, true));
869: _servToNum.put("radacct", new ServiceNode(1813, false, true));
870: _servToNum.put("nfsd", new ServiceNode(2049, false, true));
871: _servToNum.put("knetd", new ServiceNode(2053, true, false));
872: _servToNum.put("man", new ServiceNode(9535, true, false));
873: }
874: }
|