home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / iss / part01 < prev    next >
Encoding:
Text File  |  1993-10-10  |  57.9 KB  |  1,909 lines

  1. Newsgroups: comp.sources.misc
  2. From: gt6468c@prism.gatech.edu (Christopher Klaus)
  3. Subject: v40i001:  iss - Internet Security Scanner, v1.21, Part01/01
  4. Message-ID: <1993Oct9.160012.15539@sparky.sterling.com>
  5. X-Md4-Signature: 24b83c41baa599f424f850e1ee6f720f
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Sat, 9 Oct 1993 16:00:12 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: gt6468c@prism.gatech.edu (Christopher Klaus)
  12. Posting-number: Volume 40, Issue 1
  13. Archive-name: iss/part01
  14. Environment: INET, UNIX
  15. Supersedes: iss: Volume 39, Issue 109
  16.  
  17. Internet Security Scanner (ISS) is one of the first multi-level security
  18. scanners available to the public.  It was designed to be flexible and easily
  19. portable to many unix platforms and do its job in a reasonable amount of
  20. time.  It provides information to the administrator that will fix obvious
  21. security misconfigurations. 
  22.  
  23. ISS does a multi-level scan of security, not just searching for one
  24. weakness in the system.  To provide this to the public or at least to the
  25. security conscious crowd may cause people to think that it is too dangerous
  26. for the public, but many of the (cr/h)ackers are already aware of these
  27. security holes and know how to exploit them. 
  28.  
  29. These security holes are not deep in some OS routines, but standard
  30. misconfigurations that many domains on Internet tend to show.  Many of these
  31. holes are warned about in CERT and CIAC advisories.  This is the first
  32. release of ISS and there is still much room for improvement. 
  33.  
  34. ISS will quickly scan the domain. It does not try to connect to every
  35. address, but rather scans through doing a name lookup for each address.  And
  36. if that address has a name, it will then do a more thorough lookup of
  37. information on that host. With the -q option, it will try to connect to hosts
  38. even without names.  
  39.  
  40. To sum it up, ISS will scan a domain grabbing essential information for
  41. administrators to easily sort through and give them a chance to secure the
  42. open machines on their network.
  43.  
  44. --
  45. Christopher William Klaus
  46. Internet: gt6468c@prism.gatech.edu coup@gnu.ai.mit.edu cklaus@hotsun.nersc.gov
  47. 26468 GaTech Station, Atlanta Georgia, 30332   (404)-206-1513
  48.  
  49. #! /bin/sh
  50. # This is a shell archive.  Remove anything before this line, then unpack
  51. # it by saving it into a file and typing "sh file".  To overwrite existing
  52. # files, type "sh file -c".  You can also feed this as standard input via
  53. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  54. # will see the following message at the end:
  55. #        "End of shell archive."
  56. # Contents:  iss iss/Bugs iss/Changes iss/Makefile iss/iss.1 iss/iss.c
  57. #   iss/readme.iss iss/telnet.h iss/todo
  58. # Wrapped by gt6468c@sundial.gatech.edu on Wed Oct  6 02:40:30 1993
  59. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  60. if test ! -d 'iss' ; then
  61.     echo shar: Creating directory \"'iss'\"
  62.     mkdir 'iss'
  63. fi
  64. if test -f 'iss/Bugs' -a "${1}" != "-c" ; then 
  65.   echo shar: Will not clobber existing file \"'iss/Bugs'\"
  66. else
  67. echo shar: Extracting \"'iss/Bugs'\" \(157 characters\)
  68. sed "s/^X//" >'iss/Bugs' <<'END_OF_FILE'
  69. XCant open a port socket sometimes.
  70. XThe src code hasnt been tested on many other unixes other than SunOs4.1.1-3.
  71. XCore dumps sometimes for unknown reasons.
  72. X
  73. X
  74. X
  75. END_OF_FILE
  76. if test 157 -ne `wc -c <'iss/Bugs'`; then
  77.     echo shar: \"'iss/Bugs'\" unpacked with wrong size!
  78. fi
  79. # end of 'iss/Bugs'
  80. fi
  81. if test -f 'iss/Changes' -a "${1}" != "-c" ; then 
  82.   echo shar: Will not clobber existing file \"'iss/Changes'\"
  83. else
  84. echo shar: Extracting \"'iss/Changes'\" \(2028 characters\)
  85. sed "s/^X//" >'iss/Changes' <<'END_OF_FILE'
  86. XV1.00 First Release.
  87. X
  88. XV1.02 Patched a few minor bugs.
  89. X1. Changing  S_un to s.addr which abreviates the structure, but also
  90. Xmakes it more compatible to compile on other machines.
  91. X2. The closing of files was changed from close(file) -> fclose(file).
  92. X3. Unnecessary variables have been removed.
  93. X4. One of the nested loops was incorrectly bracketted around the wrong command.
  94. X5. Incorrectly calling the function getname(a). Changed to getname(&a).
  95. X
  96. XV1.03 Minor bugs fixed that make it more compatible on other unixes.
  97. X1. Check for NULL file before closing ISS.log. Caused core dump on some unixes.
  98. X2. Included <strings.h>
  99. X3. Added siginterrupt (SIGALRM,1) to varies parts. Apparently on some machines,
  100. X the signal wasn't being caught until this was set.
  101. X
  102. XV1.10 Added new features and better routines.
  103. X1. Changed the method of how to scan allowing a user to be more specific
  104. Xin which hosts are scanned.
  105. X2. Option "-p" implemented to scan individual hosts for all opening tcp port.
  106. X3. Sending a QUIT to the SMTP and FTP port.
  107. X4. Can now enter just one ip-address to probe that host.
  108. X5. Option -o to change the output to something other than ISS.log.
  109. X  if "-o -" is spefied, - becomes stdout. Allowing for easier debugging and
  110. X  testing.
  111. X
  112. XV1.20 Modified a few more minor bugs.
  113. X1. Used htonl() and htons() hopefully to fix byte order of addresses on some machines.
  114. X2. Made the socket descriptions all conform to (sd) and changed
  115. Xclose(s) to close(sd).
  116. X3. Added more checking of read(s, &c, 1) routines.
  117. X4. Allowing the user to just enter one ip-addr to scan that particular host
  118. Xfor security holes.
  119. X5. Checks "NoName" as a domainname guess.
  120. X6. Increased size of hostnames within program.
  121. X
  122. XV1.21 Few fixes.
  123. X1. Options -e and -y turned off more than just what they were suppose to.
  124. X2. Cleaned up some code for routines that allowed users to select which 
  125. Xhosts to scan.
  126. X3. Made time-outs longer and checks slightly more efficent for ftp and smtp.
  127. X4. #ifdef sun siginterrupt routine.
  128. X5. Including <string.h> except for pyramid systems.
  129. X
  130. X
  131. X
  132. END_OF_FILE
  133. if test 2028 -ne `wc -c <'iss/Changes'`; then
  134.     echo shar: \"'iss/Changes'\" unpacked with wrong size!
  135. fi
  136. # end of 'iss/Changes'
  137. fi
  138. if test -f 'iss/Makefile' -a "${1}" != "-c" ; then 
  139.   echo shar: Will not clobber existing file \"'iss/Makefile'\"
  140. else
  141. echo shar: Extracting \"'iss/Makefile'\" \(64 characters\)
  142. sed "s/^X//" >'iss/Makefile' <<'END_OF_FILE'
  143. Xiss:    iss.o telnet.h
  144. X    $(CC) -o $@ iss.o
  145. X
  146. Xclean:
  147. X    rm -f iss iss.o
  148. END_OF_FILE
  149. if test 64 -ne `wc -c <'iss/Makefile'`; then
  150.     echo shar: \"'iss/Makefile'\" unpacked with wrong size!
  151. fi
  152. # end of 'iss/Makefile'
  153. fi
  154. if test -f 'iss/iss.1' -a "${1}" != "-c" ; then 
  155.   echo shar: Will not clobber existing file \"'iss/iss.1'\"
  156. else
  157. echo shar: Extracting \"'iss/iss.1'\" \(9446 characters\)
  158. sed "s/^X//" >'iss/iss.1' <<'END_OF_FILE'
  159. X.\" "%W% %G%"
  160. X.TH ISS 1
  161. X.SH NAME
  162. Xiss \- Internet Security Scanner
  163. X.SH SYNOPSIS
  164. X.B iss
  165. X[ -msrdyvpqefo ] #1 #2 
  166. X.SH DESCRIPTION
  167. X.I ISS
  168. XInternet Security Scanner (
  169. X.I ISS
  170. X) is one of the first multi-level security
  171. Xscanners available to the public.  It was designed to be flexible and easily
  172. Xportable to many unix platforms and do its job in a reasonable amount of
  173. Xtime.  It provides information to the administrator that will fix obvious
  174. Xsecurity misconfigurations. 
  175. X.PP
  176. X.I ISS
  177. Xdoes a multi-level scan of security, not just searching for one
  178. Xweakness in the system.  To provide this to the public or at least to the
  179. Xsecurity conscious crowd may cause people to think that it is too dangerous
  180. Xfor the public, but many of the (cr/h)ackers are already aware of these
  181. Xsecurity holes and know how to exploit them. 
  182. X.PP
  183. XThese security holes are not deep in some OS routines, but standard
  184. Xmisconfigurations that many domains on Internet tend to show.  Many of these
  185. Xholes are warned about in CERT and CIAC advisories.  This is the first
  186. Xrelease of 
  187. X.I ISS 
  188. Xand there is still much room for improvement. 
  189. X.PP
  190. X.I ISS
  191. Xis a project that I started as I became interested in security.  As I
  192. Xheard about (cr/h)ackers breaking into NASA and universities around the
  193. Xworld, I wanted to find out the deep secrets of security and how these people
  194. Xwere able to gain access to expensive machines that I would think were
  195. Xsecure.  I searched Internet for relative information, such as Phrack and
  196. XCERT advisories. 
  197. X.PP
  198. XMost information was vague and did not explain how intruders were able to
  199. Xgain access to most systems.  At most the information told administrators to
  200. Xmake password security tighter and to apply the vendor's security patches. 
  201. XThey lacked real information on how an intruder would look at a site to try
  202. Xto gain access.  Having talked with security experts and reading CERT
  203. Xadvisories, I started trying to look for various security holes within my
  204. Xdomain.
  205. X.PP
  206. XTo my surprise, I noticed that many of machines were adequately secured,
  207. Xbut within a domain there remained enough machines with obvious holes that
  208. Xanyone wanted into any machine could attack the weak 'trusted' machine and
  209. Xfrom there could gain access to the rest of the domain. From this project, I
  210. Xhave not learned any new deep secret to cracking systems, but with the right
  211. Xtools that most domains on Internet are insecure.  These holes will not be a
  212. Xsurprise to any advanced intruder, but with this tool administrators will be
  213. Xable to quickly search for obvious holes and prepare to fix them.
  214. X.PP
  215. X
  216. X.SH OPTIONS
  217. X.TP
  218. X.B \-d
  219. XIgnores Checking Default Logins such as sync.
  220. X.TP
  221. X.B \-m
  222. XIgnores checking for mail port.
  223. X.TP
  224. X.B \-s
  225. Xxx number of seconds max to wait.
  226. X.TP
  227. X.B \-r
  228. XIgnores Checking for RPC calls.
  229. X.TP
  230. X.B \-y
  231. XTry to get pw via Ypx.
  232. X.TP
  233. X.B \-v
  234. XIgnores finding Mail Aliases for decode, guest, bbs, lp.
  235. X.TP
  236. X.B \-p
  237. XScans one Host for all open TCP ports (disables all other options).
  238. X.TP
  239. X.B \-q
  240. XTurns off Quick Scan so it finds hosts even with no name.
  241. X.TP
  242. X.B \-e
  243. XOnly logs directories that can be mounted by everyone.
  244. X.TP
  245. X.B \-f
  246. XIgnores Checking FTP port for logging in as anonymous.
  247. X.TP
  248. X.B \-o
  249. XChanges logfile to something besides ISS.log. 
  250. X.PP
  251. X#1 and #2 are the beginning and end of the domain address to scan.
  252. X.PP
  253. X.I ISS
  254. Xwill scan a domain sequentially looking for connections.  When it finds
  255. Xa host it will try to connect to various ports.  For starters, it tries the
  256. Xtelnet port. When it connects to the telnet port, it logs any information
  257. Xthat the host displays.  
  258. X.PP
  259. XWith the -d option, 
  260. X.I ISS
  261. Xignores trying default accounts.  By default,
  262. X.I ISS
  263. Xwill then try to log in as 'sync' which is a common account name for
  264. XSunOS and other Unixes.  It in itself is not a big hole other than giving
  265. Xmore information about type of OS, version number of OS, and  displaying the
  266. XMOTD.   But 'sync' with no password can become a security hole as someone
  267. Xwith a regular account on that host can divert the 'sync' privileges and
  268. Xultimately become root.  The 'sync' account should be passworded or disabled.
  269. X.PP
  270. XWith the -m option, 
  271. X.I ISS
  272. Xignores the mail port. By default, 
  273. X.I ISS
  274. Xtries the
  275. Xmail port. Connecting to this provides information regarding the hostname,
  276. Xtype of OS it is, and even the version number of sendmail. 
  277. X.PP
  278. XWith the -v option, 
  279. X.I ISS
  280. Xwont check for mail aliases. By default, it will
  281. Xcheck for various users and aliases.  The obvious aliases to search for is
  282. Xdecode and uudecode.  With these aliases, you are able to send mail to
  283. Xdecode@hostname with a file that has been uuencoded to overwrite a systems
  284. Xfile, such as .rhosts.  Some of the users it looks for is 'bbs','guest','lp',
  285. Xand the well known debug and wiz backdoors within sendmail.  'bbs','guest',
  286. Xand 'lp' are known to have weak passwords or no passwords at all.
  287. X.PP
  288. XWith the -f option, 
  289. X.I ISS
  290. Xwont check the FTP port. By default, it will
  291. Xconnect to the ftp port and check to see if a person can log into anonymous. 
  292. XMany systems such as Macs let anyone log in and look around other users'
  293. Xprivate information.  If it succeeds logging in as anonymous, it will then
  294. Xattempt to create a directory.  If it does that successfully, the main
  295. Xdirectory of the FTP site is writeable and open to attack.  Many anonymous
  296. Xftp sites have security holes.  Such weaknesses is being able to write to the
  297. Xmain directory of the ftp directory, thus an intruder could write a .rhost
  298. Xfile and log in as ftp.  Plus, the anonymous ftp site may contain the actual
  299. Xhost's password file and not just a dummy password file. 
  300. X.PP
  301. XWith the -r option, 
  302. X.I ISS
  303. Xignores checking for rpc. By default, 
  304. X.I ISS
  305. Xwill look
  306. Xfor holes that most systems are more prone to have open.  It uses rpc
  307. Xinformation to find security weaknesses.  It will do a 'rpcinfo -p hostname'.
  308. XWith this information gained, it finds which hosts are running NIS, rexd,
  309. Xbootparam, whose on the host, selection_svc, and NFS. 
  310. X.PP
  311. XIf a system shows YPServ, it is likely that it has not been patched yet and
  312. Xwith the proper domainname, ypserv will provide the password file to any
  313. Xremote host asking for it.  To fix this, apply the proper ypserv patch from
  314. Xyour vendor.  
  315. X.I ISS
  316. Xwill attempt to guess the domainname and that will provide
  317. Xinformation as to which machine is the NIS server is.   The domainname should
  318. Xbe changed if it can easily be guessed so that it will slow people from
  319. Xgrabbing the password file.  Another attempt to fix this problem is
  320. Xto make sure that if the password file does get out, none of the
  321. Xpasswords can easily be cracked.  Crack (by Alec Muffett alecm@sun.com) does
  322. Xa fine job of finding weak passwords. Also shadowing the password file will
  323. Xhelp correct this weakness.
  324. X.PP
  325. XWith the -y option and a program called Ypx (by Rob Nautu
  326. Xrob@wzv.win.tue.nl), 
  327. X.I ISS
  328. Xwill try to grab the password file from ypserv.
  329. X.PP
  330. XIf a system shows Select_svr, selection_svr is running on the machine and
  331. Xthere are known holes that let anyone remotely grab the password file.
  332. XSelection_svr should be disabled.
  333. X.PP
  334. XWhen Rexd is running on a remote system, anyone with a small C program can
  335. Xemulate the 'on' command spoofing any user on the remote machine, thus
  336. Xgaining access to the password file and adding .rhosts files. Rexd should be
  337. Xdisabled.
  338. X.PP
  339. XIf a machine is running Bootparam, it is likely a server to diskless
  340. Xclients.  One problem with bootparam is that if it is running and someone
  341. Xcan guess which machines the client and servers are, they are able to get
  342. Xthe domainname from bootparam, which goes back to the YPServ problem.   
  343. X.PP
  344. XThe -e option will only log exports that everyone can mount.  To
  345. Xusually find out which machines are its clients, by default, log all the
  346. Xexportable directories.  'showmount -e hostname' shows the exports on a
  347. Xremote host.  If the exported directories look like:
  348. X.RS
  349. X.nf
  350. X
  351. X    /usr            (everyone)
  352. X    /export/placebo    placebo
  353. X    /export/spiff      spiff
  354. X.fi
  355. X.RE
  356. X.PP
  357. XAnyone can mount /usr and possible replace files and do other damage.
  358. XPlacebo and spiff appear to be clients to this server.
  359. X.PP
  360. X.I ISS
  361. Xalso does a 'rusers -l hostname' searching for users on the system.
  362. XThat provides how busy is the machine and possible login entries to try.
  363. X.PP
  364. X.I ISS
  365. Xwith option -p will support scanning all the ports on a certain host,
  366. Xthus looking for possible access entries, such as gophers, muds, and other
  367. Xapplications ran by local users.  This has not been implemented yet.
  368. X.PP
  369. X.I ISS
  370. Xwill quickly scan the domain. It does not try to connect to every
  371. Xaddress, but rather scans through doing a name lookup for each address.  And
  372. Xif that address has a name, it will then do a more thorough lookup of
  373. Xinformation on that host. With the -q option, it will try to connect to hosts
  374. Xeven without names.  
  375. X.PP
  376. XTo sum it up, 
  377. X.I ISS
  378. Xwill scan a domain grabbing essential information for
  379. Xadministrators to easily sort through and give him a chance to secure the
  380. Xopen machines on his network.
  381. X
  382. X.SH ACKNOWLEDGEMENTS
  383. X
  384. XI would like to thank the following people for ideas, suggestions, and help:
  385. XScott Miles, Dan Farmer, Wietse Venema, Alec Muffett, Scott Yelich, Darren
  386. XReed, and Tim Newsham.
  387. X
  388. X.SH ENHANCEMENTS
  389. X.PP
  390. XPlease send suggestions to
  391. X.RS
  392. X.nf
  393. X                cklaus@hotsun.nersc.gov
  394. X                         or
  395. X                coup@gnu.ai.mit.edu.
  396. X.fi
  397. X.RE
  398. X.SH COPYRIGHT
  399. X.PP
  400. XCopyright (c) Christopher Klaus, 1992, 1993.
  401. X(cklaus@hotsun.nersc.gov or coup@gnu.ai.mit.edu)
  402. X
  403. X.SH BUGS
  404. X.PP
  405. XMay not be ready to compile on machines beside SunOs.
  406. END_OF_FILE
  407. if test 9446 -ne `wc -c <'iss/iss.1'`; then
  408.     echo shar: \"'iss/iss.1'\" unpacked with wrong size!
  409. fi
  410. # end of 'iss/iss.1'
  411. fi
  412. if test -f 'iss/iss.c' -a "${1}" != "-c" ; then 
  413.   echo shar: Will not clobber existing file \"'iss/iss.c'\"
  414. else
  415. echo shar: Extracting \"'iss/iss.c'\" \(20292 characters\)
  416. sed "s/^X//" >'iss/iss.c' <<'END_OF_FILE'
  417. X/*
  418. X * Internet Security Scannner v1.21
  419. X *
  420. X * Purpose: Check the Security of your Domain
  421. X *
  422. X *
  423. X * program_name -options #1 #2
  424. X * #1 is the inetnet network to start searching on
  425. X * #2 is the inetnet network to end searching on
  426. X *
  427. X *
  428. X * This software is Copyright (c) 1992, 1993 by Christopher Klaus
  429. X *
  430. X * Permission is hereby granted to copy, distribute or otherwise
  431. X * use any part of this package as long as you do not try to make
  432. X * money from it or pretend that you wrote it.  This copyright
  433. X * notice must be maintained in any copy made.
  434. X *
  435. X * Use of this software constitutes acceptance for use in an AS IS
  436. X * condition. There are NO warranties with regard to this software.
  437. X * In no event shall the author be liable for any damages whatsoever
  438. X * arising out of or in connection with the use or performance of this
  439. X * software.  Any use of this software is at the user's own risk.
  440. X *
  441. X *  If you make modifications to this software that you feel
  442. X *  increases it usefulness for the rest of the community, please
  443. X *  email the changes, enhancements, bug fixes as well as any and
  444. X *  all ideas to me. This software is going to be maintained and
  445. X *  enhanced as deemed necessary by the community.
  446. X *
  447. X *              Christopher Klaus
  448. X *  (cklaus@hotsun.nersc.gov or coup@gnu.ai.mit.edu)
  449. X */
  450. X
  451. X#include <fcntl.h>
  452. X#include <sys/types.h>
  453. X#include <sys/socket.h>
  454. X#include <netinet/in.h>
  455. X#include <signal.h>
  456. X#include <stdio.h>
  457. X#include <string.h>
  458. X#include <netdb.h>
  459. X#include <ctype.h>
  460. X#include <arpa/nameser.h>
  461. X#include "telnet.h"
  462. X#include <sys/stat.h>
  463. X#ifndef pyr
  464. X#include <string.h>
  465. X#endif
  466. X#ifdef pyr
  467. X#include <strings.h>
  468. X#endif
  469. X
  470. X
  471. X
  472. X#define TELOPTS
  473. X#define TELCMDS
  474. X#define BUFSIZE 16
  475. X#include <resolv.h>
  476. X
  477. X/* Set to Appropriate Paths For Various Unixes */
  478. X#define SHOWMOUNT "/usr/etc/showmount"
  479. X#define RUSERS "/usr/ucb/rusers"
  480. X#define RPCINFO "/usr/etc/rpcinfo"
  481. X#define YPWHICH "/usr/bin/ypwhich"
  482. X
  483. Xstruct sockaddr_in a;
  484. X/* struct of socket */
  485. Xint x, i, thirty = 30, sd;
  486. Xint r;
  487. X/*  range values to scan */
  488. Xstruct in_addr first, second, myaddr;
  489. X
  490. Xint sec = 0, port = 0;
  491. X/* Check to see when function is done */
  492. Xint done;
  493. X/* Conditions to check scan for in each host */
  494. Xint mail = 0, acctcheck = 0, ypx = 0, rpcinfo = 0, scanports = 0;
  495. Xint quick = 0, export = 0, ftp = 0, login = 0;
  496. X
  497. Xint mnt = 0, width = 0;
  498. Xchar hname[200], testname[200], smtpname[200], addr[100], *progname, c;
  499. Xchar tryname[200], res[10][200], buf[200], temp1[200], temp2[200];
  500. X
  501. XFILE *fp = NULL;
  502. Xdonothing()            /* Signal sets done variable to tell program
  503. X                 * to quit */
  504. X{
  505. X    done = 1;
  506. X#ifdef sun
  507. X    siginterrupt(SIGALRM, 1);
  508. X#endif
  509. X    signal(SIGALRM, donothing);
  510. X}
  511. Xgetname(addr)
  512. X    struct sockaddr_in *addr;
  513. X{
  514. X    struct hostent *hoste;
  515. X    hoste = gethostbyaddr((char *) &addr->sin_addr, sizeof(struct in_addr),
  516. X              addr->sin_family);
  517. X    if (hoste)
  518. X    {
  519. X    sprintf(hname, "%s", hoste->h_name);
  520. X    return (1);
  521. X    } else
  522. X    {
  523. X    sprintf(hname, "NoName");    /* May be interesting */
  524. X    return (0);
  525. X    }
  526. X}
  527. Xctos()                /* Connect to Socket */
  528. X{
  529. X    int soc;
  530. X    soc = socket(AF_INET, SOCK_STREAM, 0);
  531. X    if (soc < 0)
  532. X    {
  533. X    sleep(5);
  534. X    (void) setsockopt(soc, SOL_SOCKET, SO_REUSEADDR, &thirty, sizeof(thirty));
  535. X    soc = socket(AF_INET, SOCK_STREAM, 0);
  536. X    printf("Retrying Socket.\n");
  537. X    if (soc < 0)
  538. X    {
  539. X        printf("Socket is locked\n");
  540. X    }
  541. X    }
  542. X    a.sin_port = htons((port == 0) ? 23 : port);
  543. X    a.sin_family = AF_INET;
  544. X    a.sin_addr.s_addr = x;
  545. X    r = connect(soc, &a, sizeof(a));
  546. X    return (soc);
  547. X}
  548. X/* Give usage message */
  549. Xvoid
  550. Xusage()
  551. X{
  552. X    printf("\n\nISS v1.21  (Internet Security Scanner)\n");
  553. X    printf("Usage: %s -msrdyvpqefo #1 #2 \n", progname);
  554. X    printf(" -m Ignores checking for mail port.\n");
  555. X    printf(" -s xx number of seconds max to wait\n");
  556. X    printf(" -r Ignores Checking for RPC calls\n");
  557. X    printf(" -d Ignores Checking Default Logins such as sync\n");
  558. X    printf(" -y Try to get pw via Ypx\n");
  559. X    printf(" -v Ignores finding Mail Aliases for decode, guest, bbs, lp\n");
  560. X    printf(" -p Scans one Host for all open TCP ports (disables all");
  561. X    printf(" other options)\n");
  562. X    printf(" -q Turns off Quick Scan so it finds hosts even with no name.\n");
  563. X    printf(" -e Only logs directories that can be mounted by everyone\n");
  564. X    printf(" -f Ignores Checking FTP port for logging in as anonymous\n");
  565. X    printf(" -o <file> send output to non ISS.log file, \"-\" is stdout\n");
  566. X    printf("#1 is the inetnet network to start searching on\n");
  567. X    printf("#2 is the inetnet network to end searching on\n");
  568. X    printf("(ie. 128.128.128.1 128.128.128.25 will scan all hosts from \n");
  569. X    printf(" 128.128.128.1 to 128.128.128.25).\n");
  570. X
  571. X    printf("\nWritten By Christopher Klaus (coup@gnu.ai.mit.edu)\n");
  572. X    printf(" Send me suggestions, bugs, fixes, and ideas.    Send flames > /dev/null\n");
  573. X    exit(1);
  574. X}
  575. Xclrlog()            /* clear log buffer */
  576. X{
  577. X    for (i = 0; i < 190; i++)
  578. X    {
  579. X    temp1[i] = ' ';
  580. X    temp2[i] = ' ';
  581. X    }
  582. X    temp1[0] = '\0';
  583. X}
  584. Xfmt(buff1, buff2)        /* Format string for log */
  585. X    char buff1[200], buff2[200];
  586. X{
  587. X
  588. X    int y, r;
  589. X    y = 0;
  590. X
  591. X    r = 0;
  592. X    while ((buff1[y] != NULL) && (r < width))
  593. X    {
  594. X    if (iscntrl(buff1[y]))
  595. X        buff1[y] = ' ';
  596. X
  597. X    if (y != 0)
  598. X        if ((buff1[y] == buff2[r - 1]) && (ispunct(buff1[y]) || isspace(buff1[y])))
  599. X        y++;
  600. X        else
  601. X        {
  602. X        buff2[r] = buff1[y];
  603. X        y++;
  604. X        r++;
  605. X        }
  606. X    else
  607. X    {
  608. X        buff2[r] = buff1[y];
  609. X        y++;
  610. X        r++;
  611. X    }
  612. X    }
  613. X    buff2[r] = NULL;
  614. X
  615. X}
  616. X
  617. X
  618. Xdo_log(s)            /* Records the telnet session and tries
  619. X                 * defaults */
  620. X    int s;
  621. X{
  622. X    unsigned char c, buf[5];
  623. X    int a, count, cnt;
  624. X    alarm(0);
  625. X    alarm(9);
  626. X    width = 78;
  627. X    clrlog();
  628. X    cnt = 0;
  629. X    count = 0;
  630. X    (void) write(s, '\n', 1);
  631. X    while (!done && (count != 250))
  632. X    {
  633. X    a = read(s, &c, 1);
  634. X    if (a < 0)
  635. X        return;
  636. X    if (a == 0)
  637. X        continue;
  638. X    if (c == IAC)
  639. X    {
  640. X        read(s, buf, 2);
  641. X        respond(s, buf[0], buf[1]);
  642. X    } else
  643. X    {
  644. X        if (c == 0)
  645. X        continue;
  646. X        if (c == '\n')
  647. X        {
  648. X        temp1[cnt] = c;
  649. X        cnt++;
  650. X        count++;
  651. X        continue;
  652. X        }
  653. X        if (isprint(c) || isspace(c))
  654. X        {
  655. X        temp1[cnt] = c;
  656. X        count++;
  657. X        cnt++;
  658. X        }
  659. X    }
  660. X    }
  661. X    fmt(temp1, temp2);
  662. X    fflush(fp);
  663. X    if (login != 1)
  664. X    {
  665. X    (void) writeln(s, "sync");
  666. X    alarm(0);
  667. X    alarm(3);
  668. X    cnt = 0;
  669. X    for (count = 0; count < 3; count++)
  670. X    {
  671. X        c = 0;
  672. X        while ((c != '\n') && !done)
  673. X        {
  674. X        c = 0;
  675. X        if (!(read(sd, &c, 1)) && (c != 0))
  676. X        {
  677. X            fprintf(fp, "%c", c);
  678. X            fflush(fp);
  679. X        }
  680. X        }
  681. X    }
  682. X
  683. X    fflush(fp);
  684. X    }
  685. X}
  686. X
  687. X
  688. X
  689. X
  690. X/* Our Policy is always say *NO* to telnet negotations */
  691. Xrespond(s, com, opt)
  692. X    int s;
  693. X    unsigned int com, opt;
  694. X{
  695. X    unsigned char buf[10];
  696. X    buf[0] = IAC;
  697. X    buf[2] = opt;
  698. X    switch (com)
  699. X    {
  700. X    /* will and wont get do and dont as reply */
  701. X    case WILL:
  702. X    case WONT:
  703. X    buf[1] = DONT;
  704. X    (void) write(s, buf, 3);
  705. X    break;
  706. X    /* do and dont get will and wont as reply  */
  707. X    case DO:
  708. X    case DONT:
  709. X    buf[1] = WONT;
  710. X    (void) write(s, buf, 3);
  711. X    break;
  712. X    default:
  713. X    fprintf(stderr, "(%d)(%d)", com, opt);
  714. X    }
  715. X}
  716. X /* Takes a Name and uses parts of it to guess domainname */
  717. Xdomainguess()
  718. X{
  719. X    int l, l1, i;
  720. X    l = 0;
  721. X    l1 = 0;
  722. X    for (i = 0; i <= (strlen(hname)); i++)
  723. X    {
  724. X
  725. X    res[l][l1] = hname[i];
  726. X    l1++;
  727. X    if (hname[i] == '.')
  728. X    {
  729. X        res[l][l1 - 1] = NULL;
  730. X        l1 = 0;
  731. X        l++;
  732. X    }
  733. X    }
  734. X    sprintf(tryname, "NoName");
  735. X    testdomain();
  736. X    sprintf(tryname, "noname");
  737. X    testdomain();
  738. X    sprintf(tryname, "Noname");
  739. X    testdomain();
  740. X    for (i = 0; i <= l; i++)
  741. X    {
  742. X    sprintf(tryname, "%s", res[i]);
  743. X    testdomain();
  744. X    }
  745. X    for (i = 0; i < l; i++)
  746. X    {
  747. X    sprintf(tryname, "%s.%s", res[i], res[i + 1]);
  748. X    testdomain();
  749. X    }
  750. X    if (l >= 2)
  751. X    {
  752. X    sprintf(tryname, "%s.%s.%s", res[l - 2], res[l - 1], res[l]);
  753. X    testdomain();
  754. X    }
  755. X    if (l >= 3)
  756. X    {
  757. X    sprintf(tryname, "%s.%s.%s.%s", res[l - 3], res[l - 2], res[l - 1], res[l]);
  758. X    testdomain();
  759. X    }
  760. X    if (l >= 4)
  761. X    {
  762. X    sprintf(tryname, "%s.%s.%s.%s.%s", res[l - 4], res[l - 3], res[l - 2], res[l - 1], res[l]);
  763. X    testdomain();
  764. X    }
  765. X}
  766. Xtestdomain()            /* Check each guess to see if it matched
  767. X                 * domainname */
  768. X{
  769. X    FILE *nis;            /* pointer to nis domainname log file */
  770. X
  771. X
  772. X    (void) sprintf(buf, "%s -d %s %s > %s.dom 2>/dev/null", YPWHICH, tryname, hname, addr);
  773. X    (void) system(buf);
  774. X    (void) sprintf(buf, "%s.dom", addr);
  775. X    if ((nis = fopen(buf, "r")) == NULL)
  776. X    {
  777. X    printf("\nError Opening File\n");
  778. X    return (1);
  779. X    }
  780. X    while (!feof(nis))
  781. X    {
  782. X    buf[0] = NULL;
  783. X    fgets(buf, sizeof(buf), nis);
  784. X    if ((strstr(buf, "Domain") == NULL) && (buf[0] != NULL))
  785. X    {
  786. X        fprintf(fp, "\nDomainname: %s NIS Server: %s", tryname, buf);
  787. X    }
  788. X    }
  789. X    (void) fclose(nis);
  790. X    (void) sprintf(buf, "rm %s.dom", addr);
  791. X    (void) system(buf);
  792. X
  793. X}
  794. Xgetsmtpname()
  795. X{
  796. X    int l, lp1, i;
  797. X    l = 0;
  798. X    lp1 = 0;
  799. X    for (i = 0; i <= (strlen(temp1)); i++)
  800. X    {
  801. X    if ((temp1[i] == ' '))
  802. X        l++;
  803. X
  804. X    if (l == 1)
  805. X    {
  806. X        if (lp1 != 0)
  807. X        {
  808. X        smtpname[lp1 - 1] = temp1[i];
  809. X        }
  810. X        lp1++;
  811. X    }
  812. X    }
  813. X}
  814. X
  815. X
  816. X
  817. Xchecksmtp()            /* Check Sendmail Port */
  818. X{
  819. X    int count = 0;
  820. X    int t = 0;
  821. X    alarm((sec == 0) ? 8 : sec);
  822. X    port = 25;
  823. X    done = 0;
  824. X    c = 0;
  825. X    sd = ctos();
  826. X    if (r != -1)
  827. X    {
  828. X    /* Read & Write Here */
  829. X    (void) setsockopt(sd, SOL_SOCKET, SO_LINGER, &thirty, sizeof(thirty));
  830. X    fcntl(sd, F_SETFL, O_NDELAY);
  831. X    while ((c != '\n') && !done)
  832. X    {
  833. X        read(sd, &c, 1);
  834. X        if ((c != 0) && (t < 200))
  835. X        {
  836. X        temp1[t] = c;
  837. X        t++;
  838. X        }
  839. X    }
  840. X    width = 75;
  841. X    fmt(temp1, temp2);
  842. X    fprintf(fp, "\nSMTP:%s\n", temp2);
  843. X    getsmtpname();
  844. X    clrlog();
  845. X    if (!acctcheck)
  846. X    {
  847. X        (void) writeln(sd, "VRFY guest");
  848. X        (void) writeln(sd, "VRFY decode");
  849. X        (void) writeln(sd, "VRFY bbs");
  850. X        (void) writeln(sd, "VRFY lp");
  851. X        (void) writeln(sd, "VRFY uudecode");
  852. X        (void) writeln(sd, "wiz");
  853. X        (void) writeln(sd, "debug");
  854. X        (void) writeln(sd, "QUIT");
  855. X        alarm(0);
  856. X        alarm(10);
  857. X        for (count = 0; count < 9; count++)
  858. X        {
  859. X        c = 0;
  860. X        while ((c != '\n') && !done)
  861. X        {
  862. X            read(sd, &c, 1);
  863. X            if (c != 0)
  864. X            {
  865. X            fprintf(fp, "%c", c);
  866. X            fflush(fp);
  867. X            }
  868. X        }
  869. X        }
  870. X    }
  871. X    } else
  872. X    {
  873. X    fprintf(fp, "\n NoSMTP");
  874. X    }
  875. X
  876. X    alarm(0);
  877. X    (void) close(sd);
  878. X    done = 0;
  879. X}
  880. Xcheckftp()            /* Check FTP Port for anonymous */
  881. X{
  882. X    int count = 0;
  883. X    int t = 0;
  884. X    alarm((sec == 0) ? 5 : sec);
  885. X    port = 21;
  886. X    sd = ctos();
  887. X    if (r != -1)
  888. X    {
  889. X    (void) setsockopt(sd, SOL_SOCKET, SO_LINGER, &thirty, sizeof(thirty));
  890. X    done = 0;
  891. X    c = 0;
  892. X    t = 0;
  893. X    fcntl(sd, F_SETFL, O_NDELAY);
  894. X    fflush(fp);
  895. X    clrlog();
  896. X    while ((c != '\n') && !done && (t < 200))
  897. X    {
  898. X        read(sd, &c, 1);
  899. X        if (c != 0)
  900. X        {
  901. X        temp1[t] = c;
  902. X        t++;
  903. X        }
  904. X    }
  905. X    width = 75;
  906. X    fmt(temp1, temp2);
  907. X    fprintf(fp, "\nFTP:%s\n", temp2);
  908. X    clrlog();
  909. X    (void) writeln(sd, "user anonymous");
  910. X    (void) writeln(sd, "pass -iss@iss.iss.iss");    /* turns off messages
  911. X                             * with dash */
  912. X    (void) writeln(sd, "pwd");    /* PWD shows current directory */
  913. X    (void) writeln(sd, "mkd test");    /* Tries to make a directory */
  914. X    (void) writeln(sd, "rmd test");    /* Tries to remove the directory */
  915. X    (void) writeln(sd, "QUIT");
  916. X    alarm(0);
  917. X    alarm(10);
  918. X    for (count = 0; count < 30; count++)
  919. X    {
  920. X        c = 0;
  921. X        while ((c != '\n') && !done)
  922. X        {
  923. X        read(sd, &c, 1);
  924. X        if (c != 0)
  925. X        {
  926. X            fprintf(fp, "%c", c);
  927. X        }
  928. X        }
  929. X    }
  930. X    } else
  931. X    {
  932. X    fprintf(fp, "\n NoFTP");
  933. X    }
  934. X
  935. X    alarm(0);
  936. X    (void) close(sd);
  937. X}
  938. Xcheckrpc()
  939. X{
  940. X    FILE *rpc;            /* pointer to rpcinfo log file */
  941. X
  942. X    int rusr, yp, rex, name, boot, x25, sels;
  943. X    /* Flags for rusers,ypserv,rexd,x25,select_svr,bootparam and named server */
  944. X
  945. X    yp = 0;
  946. X    mnt = 0;
  947. X    rex = 0;
  948. X    boot = 0;
  949. X    sels = 0;
  950. X    x25 = 0;
  951. X    rusr = 0;
  952. X    name = 0;
  953. X
  954. X    (void) sprintf(buf, "%s.log", addr);
  955. X    if ((rpc = fopen(buf, "r")) == NULL)
  956. X    {
  957. X    (void) printf("\nError Opening File\n");
  958. X    return (1);
  959. X    }
  960. X    while (!feof(rpc))
  961. X    {
  962. X    fgets(buf, sizeof(buf), rpc);
  963. X    if (strstr(buf, "ypserv") != NULL)
  964. X    {
  965. X        if (!yp)
  966. X        fprintf(fp, " YPSERV");
  967. X        yp = 1;
  968. X    }
  969. X    if (strstr(buf, "mount") != NULL)
  970. X    {
  971. X        if (!mnt)
  972. X        fprintf(fp, " MOUNT");
  973. X        mnt = 1;
  974. X    }
  975. X    if (strstr(buf, "name") != NULL)
  976. X    {
  977. X        if (!name)
  978. X        fprintf(fp, " NAME");
  979. X        name = 1;
  980. X    }
  981. X    if (strstr(buf, "x25") != NULL)
  982. X    {
  983. X        if (!x25)
  984. X        fprintf(fp, " X25");
  985. X        x25 = 1;
  986. X    }
  987. X    if (strstr(buf, "boot") != NULL)
  988. X    {
  989. X        if (!boot)
  990. X        fprintf(fp, " BOOT");
  991. X        boot = 1;
  992. X    }
  993. X    if (strstr(buf, "selec") != NULL)
  994. X    {
  995. X        if (!sels)
  996. X        fprintf(fp, " SELECT");
  997. X        sels = 1;
  998. X    }
  999. X    if (strstr(buf, "rexd") != NULL)
  1000. X    {
  1001. X        if (!rex)
  1002. X        fprintf(fp, " REXD");
  1003. X        rex = 1;
  1004. X    }
  1005. X    if (strstr(buf, "rusers") != NULL)
  1006. X    {
  1007. X        if (!rusr)
  1008. X        fprintf(fp, " RUSERS");
  1009. X        rusr = 1;
  1010. X    }
  1011. X    }
  1012. X    (void) fclose(rpc);
  1013. X/* Try to guess domain name if ypserv was found */
  1014. X    if (yp)
  1015. X    {
  1016. X    (void) strcpy(testname, hname);
  1017. X    domainguess();
  1018. X    if (smtpname[0] != NULL)
  1019. X    {
  1020. X        (void) strcpy(testname, smtpname);
  1021. X        domainguess();
  1022. X        smtpname[0] = NULL;
  1023. X    }
  1024. X    }
  1025. X/*  Check Mount List for directories */
  1026. X    if (mnt == 1)
  1027. X    {
  1028. X    sprintf(buf, "%s -e %s > %s.log 2>/dev/null", SHOWMOUNT, addr, addr);
  1029. X    system(buf);
  1030. X    sprintf(buf, "%s.log", addr);
  1031. X    if ((rpc = fopen(buf, "r")) == NULL)
  1032. X    {
  1033. X        (void) printf("\nError Opening File\n");
  1034. X        return (1);
  1035. X    }
  1036. X    fprintf(fp, "\n");
  1037. X    while (!feof(rpc))
  1038. X    {
  1039. X        fgets(buf, sizeof(buf), rpc);
  1040. X        if (!export == 1)
  1041. X        {
  1042. X        fprintf(fp, "%s", buf);
  1043. X        sprintf(buf, " ");
  1044. X        } else
  1045. X        {
  1046. X        if (strstr(buf, "every") != NULL)
  1047. X        {
  1048. X            fprintf(fp, "ALL:%s", buf);
  1049. X            (void) sprintf(buf, " ");
  1050. X        }
  1051. X        }
  1052. X    }
  1053. X    (void) fclose(rpc);
  1054. X    }
  1055. X/* Tries to get password file via ypserv, need ypx in local directory */
  1056. X/* Plan to add my own code that grabs the password file */
  1057. X    if ((yp == 1) && (ypx == 1))
  1058. X    {
  1059. X    sprintf(buf, "./ypx -dgs -o %s.yp %s", addr, hname);
  1060. X    system(buf);
  1061. X    }
  1062. X    if (rusr == 1)
  1063. X    {
  1064. X    sprintf(buf, "%s -l %s > %s.log 2> /dev/null", RUSERS, hname, addr);
  1065. X    system(buf);
  1066. X    sprintf(buf, "%s.log", addr);
  1067. X    if ((rpc = fopen(buf, "r")) == NULL)
  1068. X    {
  1069. X        (void) printf("\nError Opening File\n");
  1070. X        return (1);
  1071. X    }
  1072. X    fprintf(fp, "\n");
  1073. X    sprintf(buf, "NoOne Online");
  1074. X    while (!feof(rpc))
  1075. X    {
  1076. X        fgets(buf, sizeof(buf), rpc);
  1077. X        {
  1078. X        fprintf(fp, "%s", buf);
  1079. X        }
  1080. X    }
  1081. X    (void) fclose(rpc);
  1082. X
  1083. X    }
  1084. X    (void) sprintf(buf, "rm %s.log", addr);
  1085. X    (void) system(buf);
  1086. X}
  1087. Xcheckall()
  1088. X{
  1089. X    alarm((sec == 0) ? 6 : sec);
  1090. X    /* Set Alarm to def 6 seconds */
  1091. X    port = 23;
  1092. X    sd = ctos();
  1093. X    if (r != -1)
  1094. X    {
  1095. X    do_log(sd);
  1096. X    }
  1097. X    /* Try to Connect */
  1098. X    alarm(0);
  1099. X    (void) close(sd);
  1100. X    if (r != -1)
  1101. X    {
  1102. X    if (!rpcinfo)
  1103. X    {
  1104. X        (void) sprintf(buf, "%s -p %s > %s.log 2> /dev/null", RPCINFO, addr, addr);
  1105. X        (void) system(buf);
  1106. X    }
  1107. X    (void) getname(&a);
  1108. X    fprintf(fp, "%s %s", addr, hname);
  1109. X    fprintf(fp, "\n>%s", temp2);
  1110. X    clrlog();
  1111. X    if (!mail)
  1112. X    {
  1113. X        checksmtp();    /* Try to Read The SendMail Port */
  1114. X    }
  1115. X    if (ftp != 1)
  1116. X    {
  1117. X        checkftp();
  1118. X    }
  1119. X    if (!rpcinfo)
  1120. X    {
  1121. X        (void) checkrpc();
  1122. X    }
  1123. X    fprintf(fp, "\n\n");
  1124. X    fflush(fp);
  1125. X    }
  1126. X#ifdef notdef
  1127. X    else
  1128. X    {
  1129. X    if (quick == 1)
  1130. X    {
  1131. X        fprintf(fp, "Host %s would not connect.\n", hname);
  1132. X    }
  1133. X    }
  1134. X#endif
  1135. X}
  1136. Xopen_logfile(file)
  1137. X    char *file;
  1138. X{
  1139. X    if (!fp)
  1140. X    {
  1141. X    if (fp = fopen(file, "r"))
  1142. X    {
  1143. X        (void) fclose(fp);
  1144. X        fp = fopen(file, "a");
  1145. X    } else
  1146. X        fp = fopen(file, "a");
  1147. X    fprintf(fp, "       -->    Inet Sec Scanner Log By Christopher Klaus (C) 1993    <--\n");
  1148. X    fprintf(fp, "              Email: cklaus@hotsun.nersc.gov coup@gnu.ai.mit.edu\n");
  1149. X    fprintf(fp, "       ================================================================\n");
  1150. X
  1151. X    }
  1152. X}
  1153. Xwriteln(pd, string)
  1154. X    int pd;
  1155. X    char *string;
  1156. X{
  1157. X    (void) write(pd, string, strlen(string));
  1158. X    (void) write(pd, "\n", 1);
  1159. X}
  1160. X/* Thanks to H.Morrow Long,Manager of Development,Yale U CS Computing Facility
  1161. X   INET: Long-Morrow@CS.Yale.EDU
  1162. X   for the following routines taken from probe_tcp_ports.c,v 1.3 93/10/01 */
  1163. X
  1164. XProbe_TCP_Ports(Name)
  1165. X    char *Name;
  1166. X{
  1167. X    unsigned Port;
  1168. X    char *Host;
  1169. X    struct hostent *HostEntryPointer;
  1170. X    struct sockaddr_in SocketInetAddr;
  1171. X    struct hostent TargetHost;
  1172. X    struct in_addr TargetHostAddr;
  1173. X    char *AddressList[1];
  1174. X    char NameBuffer[128];
  1175. X
  1176. X    extern int inet_addr();
  1177. X    extern char *rindex();
  1178. X    if (Name == NULL)
  1179. X    return (1);
  1180. X    Host = Name;
  1181. X    if (Host == NULL)
  1182. X    return (1);
  1183. X    HostEntryPointer = gethostbyname(Host);
  1184. X    if (HostEntryPointer == NULL)
  1185. X    {
  1186. X    TargetHostAddr.s_addr = inet_addr(Host);
  1187. X    if (TargetHostAddr.s_addr == -1)
  1188. X    {
  1189. X        (void) fprintf(fp, "unknown host: %s\n", Host);
  1190. X        return (1);
  1191. X    }
  1192. X    (void) strcpy(NameBuffer, Host);
  1193. X    TargetHost.h_name = NameBuffer;
  1194. X    TargetHost.h_addr_list = AddressList, TargetHost.h_addr =
  1195. X        (char *) &TargetHostAddr;
  1196. X    TargetHost.h_length = sizeof(struct in_addr);
  1197. X    TargetHost.h_addrtype = AF_INET;
  1198. X    TargetHost.h_aliases = 0;
  1199. X    HostEntryPointer = &TargetHost;
  1200. X    }
  1201. X    SocketInetAddr.sin_family = HostEntryPointer->h_addrtype;
  1202. X    bcopy(HostEntryPointer->h_addr, (char *) &SocketInetAddr.sin_addr,
  1203. X      HostEntryPointer->h_length);
  1204. X
  1205. X
  1206. X    for (Port = 1; Port < 65536; Port++)
  1207. X    (void) Probe_TCP_Port(Port, HostEntryPointer, SocketInetAddr);
  1208. X    return (0);
  1209. X}
  1210. XProbe_TCP_Port(Port, HostEntryPointer, SocketInetAddr)
  1211. X    unsigned Port;
  1212. X    struct hostent *HostEntryPointer;
  1213. X    struct sockaddr_in SocketInetAddr;
  1214. X{
  1215. X    int SocketDescriptor;
  1216. X    struct servent *ServiceEntryPointer;
  1217. X
  1218. X
  1219. X    SocketInetAddr.sin_port = htons(Port);
  1220. X    SocketDescriptor = socket(AF_INET, SOCK_STREAM, 6);
  1221. X    if (SocketDescriptor < 0)
  1222. X    {
  1223. X    perror("socket");
  1224. X    return (1);
  1225. X    }
  1226. X    if (!(connect(SocketDescriptor, (char *) &SocketInetAddr,
  1227. X          sizeof(SocketInetAddr)) < 0))
  1228. X    {
  1229. X    (void) fprintf(fp, "Host %s, Port %d ",
  1230. X               HostEntryPointer->h_name, Port);
  1231. X    if ((ServiceEntryPointer = getservbyport(Port, "tcp")) !=
  1232. X        (struct servent *) NULL)
  1233. X        (void) fprintf(fp, " (\"%s\" service) ",
  1234. X               ServiceEntryPointer->s_name);
  1235. X    (void) fprintf(fp, "opened.\n");
  1236. X    (void) fflush(fp);
  1237. X    }
  1238. X    (void) close(SocketDescriptor);
  1239. X    return (0);
  1240. X}
  1241. Xmain(argc, argv)
  1242. X    int argc;
  1243. X    char **argv;
  1244. X{
  1245. X    char line[512];
  1246. X    char *logfile = "ISS.log", *arg;
  1247. X    sethostent(1);
  1248. X    progname = argv[0];
  1249. X    first.s_addr = 0;
  1250. X    second.s_addr = 0;
  1251. X
  1252. X    if (argc == 1)
  1253. X    usage();
  1254. X
  1255. X    while ((arg = *++argv))
  1256. X    {
  1257. X    if (*arg == '-')
  1258. X        for (arg++; *arg; arg++)
  1259. X        switch (*arg)
  1260. X        {
  1261. X        case 'h':
  1262. X            usage();
  1263. X            exit(0);
  1264. X            break;
  1265. X        case 'd':
  1266. X            login++;
  1267. X            break;
  1268. X        case 'v':
  1269. X            acctcheck++;
  1270. X            break;
  1271. X        case 'y':
  1272. X            ypx++;
  1273. X            break;
  1274. X        case 'f':
  1275. X            ftp++;
  1276. X            break;
  1277. X        case 'm':
  1278. X            mail++;
  1279. X            break;
  1280. X        case 'o':
  1281. X            if (argv[1] && *argv[1])
  1282. X            if (!strcmp(argv[1], "-"))
  1283. X                fp = stdout;
  1284. X            else
  1285. X                logfile = *++argv;
  1286. X            break;
  1287. X        case 'r':
  1288. X            rpcinfo++;
  1289. X            break;
  1290. X        case 'q':
  1291. X            quick++;
  1292. X            break;
  1293. X        case 'e':
  1294. X            export++;
  1295. X            break;
  1296. X        case 'p':
  1297. X            scanports++;
  1298. X            open_logfile(logfile);
  1299. X            logfile = *++argv;
  1300. X            break;
  1301. X        case 's':
  1302. X            sec = atoi(arg + 1);
  1303. X            if (sec == 0)
  1304. X            {
  1305. X            if (!*++argv)
  1306. X            {
  1307. X                (void) printf("Parse error! missing parameter\n");
  1308. X                exit(1);
  1309. X            }
  1310. X            sec = atoi(*argv);
  1311. X            }
  1312. X            break;
  1313. X        }
  1314. X    else
  1315. X    {
  1316. X        if (!first.s_addr)
  1317. X        first.s_addr = inet_addr(*argv);
  1318. X        else if (!second.s_addr)
  1319. X        second.s_addr = inet_addr(*argv);
  1320. X    }
  1321. X    }
  1322. X    if (scanports)
  1323. X    {
  1324. X    Probe_TCP_Ports(logfile);
  1325. X    (void) fclose(fp);
  1326. X    return (0);
  1327. X    }
  1328. X    if (!first.s_addr)
  1329. X    {
  1330. X    (void) printf("Enter address to probe : ");
  1331. X    (void) gets(line);
  1332. X    first.s_addr = inet_addr(line);
  1333. X    }
  1334. X    if (!second.s_addr)
  1335. X    {
  1336. X    second.s_addr = first.s_addr;
  1337. X    }
  1338. X    if (first.s_addr == -1 || second.s_addr == -1)
  1339. X    {
  1340. X    (void) printf("Out of range.\n");
  1341. X    exit(1);
  1342. X    }
  1343. X    open_logfile(logfile);
  1344. X#ifdef sun
  1345. X    siginterrupt(SIGALRM, 1);
  1346. X#endif
  1347. X    signal(SIGALRM, donothing);
  1348. X    fprintf(fp, "\nScanning from %s", inet_ntoa(first));
  1349. X    fprintf(fp, " to %s\n", inet_ntoa(second));
  1350. X    fflush(fp);
  1351. X
  1352. X    for (x = ntohl(first.s_addr); x <= ntohl(second.s_addr); x++)
  1353. X    {
  1354. X    if ((x & 0xff) == 255)
  1355. X        x++;
  1356. X    if ((x & 0xff) == 0)
  1357. X        x++;
  1358. X    myaddr.s_addr = htonl(x);
  1359. X    (void) strcpy(addr, inet_ntoa(myaddr));
  1360. X    if (quick == 1)
  1361. X    {
  1362. X        a.sin_port = htons((port == 0) ? 23 : port);
  1363. X        a.sin_family = AF_INET;
  1364. X        a.sin_addr.s_addr = myaddr.s_addr;
  1365. X        if (getname(&a) == 1)    /* Look For Names */
  1366. X        checkall();    /* Try for addresses with names */
  1367. X    } else
  1368. X        checkall();        /* Try for each address */
  1369. X    }
  1370. X    endhostent();
  1371. X    (void) fclose(fp);
  1372. X    return (0);
  1373. X}
  1374. END_OF_FILE
  1375. if test 20292 -ne `wc -c <'iss/iss.c'`; then
  1376.     echo shar: \"'iss/iss.c'\" unpacked with wrong size!
  1377. fi
  1378. # end of 'iss/iss.c'
  1379. fi
  1380. if test -f 'iss/readme.iss' -a "${1}" != "-c" ; then 
  1381.   echo shar: Will not clobber existing file \"'iss/readme.iss'\"
  1382. else
  1383. echo shar: Extracting \"'iss/readme.iss'\" \(8971 characters\)
  1384. sed "s/^X//" >'iss/readme.iss' <<'END_OF_FILE'
  1385. X       Internet Security Scanner, v1.21
  1386. X
  1387. X    Copyright (c) Christopher Klaus, 1992, 1993.
  1388. X      (cklaus@hotsun.nersc.gov or coup@gnu.ai.mit.edu)
  1389. X
  1390. X
  1391. X  Internet Security Scanner (ISS) is one of the first multi-level security
  1392. Xscanners available to the public.  It was designed to be flexible and easily
  1393. Xportable to many unix platforms and do its job in a reasonable amount of
  1394. Xtime.  It provides information to the administrator that will fix obvious
  1395. Xsecurity misconfigurations. 
  1396. X
  1397. X  ISS does a multi-level scan of security, not just searching for one
  1398. Xweakness in the system.  To provide this to the public or at least to the
  1399. Xsecurity conscious crowd may cause people to think that it is too dangerous
  1400. Xfor the public, but many of the (cr/h)ackers are already aware of these
  1401. Xsecurity holes and know how to exploit them. 
  1402. X
  1403. X  These security holes are not deep in some OS routines, but standard
  1404. Xmisconfigurations that many domains on Internet tend to show.  Many of these
  1405. Xholes are warned about in CERT and CIAC advisories.  This is the first
  1406. Xrelease of ISS and there is still much room for improvement. 
  1407. X
  1408. X  ISS is a project that I started as I became interested in security.  As I
  1409. Xheard about (cr/h)ackers breaking into NASA and universities around the
  1410. Xworld, I wanted to find out the deep secrets of security and how these people
  1411. Xwere able to gain access to expensive machines that I would think were
  1412. Xsecure.  I searched Internet for relative information, such as Phrack and
  1413. XCERT advisories. 
  1414. X
  1415. X  Most information was vague and did not explain how intruders were able to
  1416. Xgain access to most systems.  At most the information told administrators to
  1417. Xmake password security tighter and to apply the vendor's security patches. 
  1418. XThey lacked real information on how an intruder would look at a site to try
  1419. Xto gain access.  Having talked with security experts and reading CERT
  1420. Xadvisories, I started trying to look for various security holes within my
  1421. Xdomain.
  1422. X
  1423. X  To my surprise, I noticed that many of machines were adequately secured,
  1424. Xbut within a domain there remained enough machines with obvious holes that
  1425. Xanyone wanted into any machine could attack the weak 'trusted' machine and
  1426. Xfrom there could gain access to the rest of the domain. From this project, I
  1427. Xhave not learned any new deep secret to cracking systems, but with the right
  1428. Xtools that most domains on Internet are insecure.  These holes will not be a
  1429. Xsurprise to any advanced intruder, but with this tool administrators will be
  1430. Xable to quickly search for obvious holes and prepare to fix them.
  1431. X
  1432. X  ISS will scan a domain sequentially looking for connections.  When it finds
  1433. Xa host it will try to connect to various ports.  For starters, it tries the
  1434. Xtelnet port. When it connects to the telnet port, it logs any information
  1435. Xthat the host displays.  
  1436. X
  1437. X    With the -d option, ISS ignores trying default accounts.  By default,
  1438. XISS will then try to log in as 'sync' which is a common account name for
  1439. XSunOS and other Unixes.  It in itself is not a big hole other than giving
  1440. Xmore information about type of OS, version number of OS, and  displaying the
  1441. XMOTD.   But 'sync' with no password can become a security hole as someone
  1442. Xwith a regular account on that host can divert the 'sync' privileges and
  1443. Xultimately become root.  The 'sync' account should be passworded or disabled.
  1444. X
  1445. X  With the -m option, ISS ignores the mail port. By default, ISS tries the
  1446. Xmail port. Connecting to this provides information regarding the hostname,
  1447. Xtype of OS it is, and even the version number of sendmail. 
  1448. X
  1449. X  With the -v option, ISS wont check for mail aliases. By default, it will
  1450. Xcheck for various users and aliases.  The obvious aliases to search for is
  1451. Xdecode and uudecode.  With these aliases, you are able to send mail to
  1452. Xdecode@hostname with a file that has been uuencoded to overwrite a systems
  1453. Xfile, such as .rhosts.  Some of the users it looks for is 'bbs', 'guest',
  1454. X'lp', and the well known debug and wiz backdoors within sendmail.  'bbs',
  1455. X'guest', and 'lp' are known to have weak passwords or no passwords at all.
  1456. X
  1457. X  With the -f option, ISS wont check the FTP port. By default, it will
  1458. Xconnect to the ftp port and check to see if a person can log into anonymous.
  1459. X Many systems such as Macs let anyone log in and look around other users'
  1460. Xprivate information.  If it succeeds logging in as anonymous, it will then
  1461. Xattempt to create a directory.  If it does that successfully, the main
  1462. Xdirectory of the FTP site is writeable and open to attack.  Many anonymous
  1463. Xftp sites have security holes.  Such weaknesses is being able to write to
  1464. Xthe main directory of the ftp directory, thus an intruder could write a
  1465. X.rhost file and log in as ftp.  Plus, the anonymous ftp site may contain the
  1466. Xactual host's password file and not just a dummy password file. 
  1467. X
  1468. X  With the -r option, ISS ignores checking for rpc. By default, ISS will
  1469. Xlook for holes that most systems are more prone to have open.  It uses rpc
  1470. Xinformation to find security weaknesses.  It will do a 'rpcinfo -p
  1471. Xhostname'. With this information gained, it finds which hosts are running
  1472. XNIS, rexd, bootparam, whose on the host, selection_svc, and NFS. 
  1473. X
  1474. X  If a system shows YPServ, it is likely that it has not been patched yet and
  1475. Xwith the proper domainname, ypserv will provide the password file to any
  1476. Xremote host asking for it.  To fix this, apply the proper ypserv patch from
  1477. Xyour vendor.  ISS will attempt to guess the domainname and that will provide
  1478. Xinformation as to which machine is the NIS server is.   The domainname should
  1479. Xbe changed if it can easily be guessed so that it will slow people from
  1480. Xgrabbing the password file.  Another attempt to fix this problem is
  1481. Xto make sure that if the password file does get out, none of the
  1482. Xpasswords can easily be cracked.  Crack (by Alec Muffett alecm@sun.com) does
  1483. Xa fine job of finding weak passwords. Also shadowing the password file will
  1484. Xhelp correct this weakness.
  1485. X
  1486. X  With the -y option and a program called Ypx (by Rob Nautu
  1487. Xrob@wzv.win.tue.nl), ISS will try to grab the password file from ypserv.
  1488. X
  1489. X  If a system shows Select_svr, selection_svr is running on the machine and
  1490. Xthere are known holes that let anyone remotely read any file on the system,
  1491. Xeven the password file.  Selection_svr should be disabled.
  1492. X
  1493. X  When Rexd is running on a remote system, anyone with a small C program can
  1494. Xemulate the 'on' command spoofing any user on the remote machine, thus
  1495. Xgaining access to the password file and adding .rhosts files. Rexd should be
  1496. Xdisabled.
  1497. X
  1498. X  If a machine is running Bootparam, it is likely a server to diskless
  1499. Xclients.  One problem with bootparam is that if it is running and someone
  1500. Xcan guess which machines the client and servers are, they are able to get
  1501. Xthe domainname from bootparam, which goes back to the YPServ problem.   
  1502. X
  1503. X  The -e option will only log exports that everyone can mount.  To
  1504. Xusually find out which machines are its clients, by default, log all the
  1505. Xexportable directories.  'showmount -e hostname' shows the exports on a
  1506. Xremote host.  If the exported directories look like:
  1507. X
  1508. X    /usr            (everyone)
  1509. X    /export/placebo    placebo
  1510. X    /export/spiff      spiff
  1511. X
  1512. X  Anyone can mount /usr and possible replace files and do other damage.
  1513. XPlacebo and spiff appear to be clients to this server.
  1514. X
  1515. X  ISS also does a 'rusers -l hostname' searching for users on the system.
  1516. XThat provides how busy is the machine and possible login entries to try.
  1517. X
  1518. X  ISS with option -p will support scanning all the ports on a certain host,
  1519. Xthus looking for possible access entries, such as gophers, muds, and other
  1520. Xapplications ran by local users.  It also can be used to show which ports
  1521. Xare blocked by a firewall.
  1522. X
  1523. X  ISS will quickly scan the domain. It does not try to connect to every
  1524. Xaddress, but rather scans through doing a name lookup for each address.  And
  1525. Xif that address has a name, it will then do a more thorough lookup of
  1526. Xinformation on that host. With the -q option, it will try to connect to hosts
  1527. Xeven without names.  
  1528. X
  1529. X  Option -o will allow you to send output to another log file rather than
  1530. Xthe regular ISS.log.  Output to "-" is to stdout, allowing for quicker
  1531. Xdebugging and testing.
  1532. X
  1533. X  To sum it up, ISS will scan a domain grabbing essential information for
  1534. Xadministrators to easily sort through and give themselves a chance to secure
  1535. Xthe open machines on their network.
  1536. X
  1537. X  Some additional notes about this program.  You can find patches and
  1538. Xadditional information from cert@cert.org and their anonymous FTP site 
  1539. Xcert.org (192.88.209.5).  They have an advisory about the security flaws
  1540. Xfound with ISS that may be beneficial in closing the flaws.
  1541. X
  1542. XAcknowledgements
  1543. X  I would like to thank the following people for ideas, suggestions, and help:
  1544. XScott Miles, Dan Farmer, Wietse Venema, Alec Muffett, Scott Yelich, Darren
  1545. XReed, Tim Newsham, H. Morrow Long (for port scan routines), Jim Morton, and
  1546. XBilly Barron.
  1547. X
  1548. X Please send suggestions to
  1549. X
  1550. X    cklaus@hotsun.nersc.gov
  1551. X or:    coup@gnu.ai.mit.edu.
  1552. X
  1553. X Copyright C Klaus, 1993.
  1554. END_OF_FILE
  1555. if test 8971 -ne `wc -c <'iss/readme.iss'`; then
  1556.     echo shar: \"'iss/readme.iss'\" unpacked with wrong size!
  1557. fi
  1558. # end of 'iss/readme.iss'
  1559. fi
  1560. if test -f 'iss/telnet.h' -a "${1}" != "-c" ; then 
  1561.   echo shar: Will not clobber existing file \"'iss/telnet.h'\"
  1562. else
  1563. echo shar: Extracting \"'iss/telnet.h'\" \(10035 characters\)
  1564. sed "s/^X//" >'iss/telnet.h' <<'END_OF_FILE'
  1565. X/*
  1566. X * Copyright (c) 1983 Regents of the University of California.
  1567. X * All rights reserved.
  1568. X *
  1569. X * Redistribution and use in source and binary forms, with or without
  1570. X * modification, are permitted provided that the following conditions
  1571. X * are met:
  1572. X * 1. Redistributions of source code must retain the above copyright
  1573. X *    notice, this list of conditions and the following disclaimer.
  1574. X * 2. Redistributions in binary form must reproduce the above copyright
  1575. X *    notice, this list of conditions and the following disclaimer in the
  1576. X *    documentation and/or other materials provided with the distribution.
  1577. X * 3. All advertising materials mentioning features or use of this software
  1578. X *    must display the following acknowledgement:
  1579. X *    This product includes software developed by the University of
  1580. X *    California, Berkeley and its contributors.
  1581. X * 4. Neither the name of the University nor the names of its contributors
  1582. X *    may be used to endorse or promote products derived from this software
  1583. X *    without specific prior written permission.
  1584. X *
  1585. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1586. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1587. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1588. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1589. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1590. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1591. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1592. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1593. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1594. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1595. X * SUCH DAMAGE.
  1596. X *
  1597. X *    @(#)telnet.h    5.14 (Berkeley) 4/3/91
  1598. X */
  1599. X
  1600. X#ifndef _TELNET_H_
  1601. X#define    _TELNET_H_
  1602. X
  1603. X/*
  1604. X * Definitions for the TELNET protocol.
  1605. X */
  1606. X#define    IAC    255        /* interpret as command: */
  1607. X#define    DONT    254        /* you are not to use option */
  1608. X#define    DO    253        /* please, you use option */
  1609. X#define    WONT    252        /* I won't use option */
  1610. X#define    WILL    251        /* I will use option */
  1611. X#define    SB    250        /* interpret as subnegotiation */
  1612. X#define    GA    249        /* you may reverse the line */
  1613. X#define    EL    248        /* erase the current line */
  1614. X#define    EC    247        /* erase the current character */
  1615. X#define    AYT    246        /* are you there */
  1616. X#define    AO    245        /* abort output--but let prog finish */
  1617. X#define    IP    244        /* interrupt process--permanently */
  1618. X#define    BREAK    243        /* break */
  1619. X#define    DM    242        /* data mark--for connect. cleaning */
  1620. X#define    NOP    241        /* nop */
  1621. X#define    SE    240        /* end sub negotiation */
  1622. X#define EOR     239             /* end of record (transparent mode) */
  1623. X#define    ABORT    238        /* Abort process */
  1624. X#define    SUSP    237        /* Suspend process */
  1625. X#define    xEOF    236        /* End of file: EOF is already used... */
  1626. X
  1627. X#define SYNCH    242        /* for telfunc calls */
  1628. X
  1629. X#ifdef TELCMDS
  1630. Xchar *telcmds[] = {
  1631. X    "EOF", "SUSP", "ABORT", "EOR",
  1632. X    "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
  1633. X    "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
  1634. X};
  1635. X#else
  1636. Xextern char *telcmds[];
  1637. X#endif
  1638. X
  1639. X#define    TELCMD_FIRST    xEOF
  1640. X#define    TELCMD_LAST    IAC
  1641. X#define    TELCMD_OK(x)    ((x) <= TELCMD_LAST && (x) >= TELCMD_FIRST)
  1642. X#define    TELCMD(x)    telcmds[(x)-TELCMD_FIRST]
  1643. X
  1644. X/* telnet options */
  1645. X#define TELOPT_BINARY    0    /* 8-bit data path */
  1646. X#define TELOPT_ECHO    1    /* echo */
  1647. X#define    TELOPT_RCP    2    /* prepare to reconnect */
  1648. X#define    TELOPT_SGA    3    /* suppress go ahead */
  1649. X#define    TELOPT_NAMS    4    /* approximate message size */
  1650. X#define    TELOPT_STATUS    5    /* give status */
  1651. X#define    TELOPT_TM    6    /* timing mark */
  1652. X#define    TELOPT_RCTE    7    /* remote controlled transmission and echo */
  1653. X#define TELOPT_NAOL     8    /* negotiate about output line width */
  1654. X#define TELOPT_NAOP     9    /* negotiate about output page size */
  1655. X#define TELOPT_NAOCRD    10    /* negotiate about CR disposition */
  1656. X#define TELOPT_NAOHTS    11    /* negotiate about horizontal tabstops */
  1657. X#define TELOPT_NAOHTD    12    /* negotiate about horizontal tab disposition */
  1658. X#define TELOPT_NAOFFD    13    /* negotiate about formfeed disposition */
  1659. X#define TELOPT_NAOVTS    14    /* negotiate about vertical tab stops */
  1660. X#define TELOPT_NAOVTD    15    /* negotiate about vertical tab disposition */
  1661. X#define TELOPT_NAOLFD    16    /* negotiate about output LF disposition */
  1662. X#define TELOPT_XASCII    17    /* extended ascic character set */
  1663. X#define    TELOPT_LOGOUT    18    /* force logout */
  1664. X#define    TELOPT_BM    19    /* byte macro */
  1665. X#define    TELOPT_DET    20    /* data entry terminal */
  1666. X#define    TELOPT_SUPDUP    21    /* supdup protocol */
  1667. X#define    TELOPT_SUPDUPOUTPUT 22    /* supdup output */
  1668. X#define    TELOPT_SNDLOC    23    /* send location */
  1669. X#define    TELOPT_TTYPE    24    /* terminal type */
  1670. X#define    TELOPT_EOR    25    /* end or record */
  1671. X#define    TELOPT_TUID    26    /* TACACS user identification */
  1672. X#define    TELOPT_OUTMRK    27    /* output marking */
  1673. X#define    TELOPT_TTYLOC    28    /* terminal location number */
  1674. X#define    TELOPT_3270REGIME 29    /* 3270 regime */
  1675. X#define    TELOPT_X3PAD    30    /* X.3 PAD */
  1676. X#define    TELOPT_NAWS    31    /* window size */
  1677. X#define    TELOPT_TSPEED    32    /* terminal speed */
  1678. X#define    TELOPT_LFLOW    33    /* remote flow control */
  1679. X#define TELOPT_LINEMODE    34    /* Linemode option */
  1680. X#define TELOPT_XDISPLOC    35    /* X Display Location */
  1681. X#define TELOPT_ENVIRON    36    /* Environment variables */
  1682. X#define    TELOPT_AUTHENTICATION 37/* Authenticate */
  1683. X#define    TELOPT_ENCRYPT    38    /* Encryption option */
  1684. X#define    TELOPT_EXOPL    255    /* extended-options-list */
  1685. X
  1686. X
  1687. X#define    NTELOPTS    (1+TELOPT_ENCRYPT)
  1688. X#ifdef TELOPTS
  1689. Xchar *telopts[NTELOPTS+1] = {
  1690. X    "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
  1691. X    "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
  1692. X    "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
  1693. X    "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
  1694. X    "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
  1695. X    "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
  1696. X    "TACACS UID", "OUTPUT MARKING", "TTYLOC",
  1697. X    "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
  1698. X    "LINEMODE", "XDISPLOC", "ENVIRON", "AUTHENTICATION",
  1699. X    "ENCRYPT",
  1700. X    0,
  1701. X};
  1702. X#define    TELOPT_FIRST    TELOPT_BINARY
  1703. X#define    TELOPT_LAST    TELOPT_ENCRYPT
  1704. X#define    TELOPT_OK(x)    ((x) <= TELOPT_LAST && (x) >= TELOPT_FIRST)
  1705. X#define    TELOPT(x)    telopts[(x)-TELOPT_FIRST]
  1706. X#endif
  1707. X
  1708. X/* sub-option qualifiers */
  1709. X#define    TELQUAL_IS    0    /* option is... */
  1710. X#define    TELQUAL_SEND    1    /* send option */
  1711. X#define    TELQUAL_INFO    2    /* ENVIRON: informational version of IS */
  1712. X#define    TELQUAL_REPLY    2    /* AUTHENTICATION: client version of IS */
  1713. X#define    TELQUAL_NAME    3    /* AUTHENTICATION: client version of IS */
  1714. X
  1715. X/*
  1716. X * LINEMODE suboptions
  1717. X */
  1718. X
  1719. X#define    LM_MODE        1
  1720. X#define    LM_FORWARDMASK    2
  1721. X#define    LM_SLC        3
  1722. X
  1723. X#define    MODE_EDIT    0x01
  1724. X#define    MODE_TRAPSIG    0x02
  1725. X#define    MODE_ACK    0x04
  1726. X#define MODE_SOFT_TAB    0x08
  1727. X#define MODE_LIT_ECHO    0x10
  1728. X
  1729. X#define    MODE_MASK    0x1f
  1730. X
  1731. X/* Not part of protocol, but needed to simplify things... */
  1732. X#define MODE_FLOW        0x0100
  1733. X#define MODE_ECHO        0x0200
  1734. X#define MODE_INBIN        0x0400
  1735. X#define MODE_OUTBIN        0x0800
  1736. X#define MODE_FORCE        0x1000
  1737. X
  1738. X#define    SLC_SYNCH    1
  1739. X#define    SLC_BRK        2
  1740. X#define    SLC_IP        3
  1741. X#define    SLC_AO        4
  1742. X#define    SLC_AYT        5
  1743. X#define    SLC_EOR        6
  1744. X#define    SLC_ABORT    7
  1745. X#define    SLC_EOF        8
  1746. X#define    SLC_SUSP    9
  1747. X#define    SLC_EC        10
  1748. X#define    SLC_EL        11
  1749. X#define    SLC_EW        12
  1750. X#define    SLC_RP        13
  1751. X#define    SLC_LNEXT    14
  1752. X#define    SLC_XON        15
  1753. X#define    SLC_XOFF    16
  1754. X#define    SLC_FORW1    17
  1755. X#define    SLC_FORW2    18
  1756. X
  1757. X#define    NSLC        18
  1758. X
  1759. X/*
  1760. X * For backwards compatability, we define SLC_NAMES to be the
  1761. X * list of names if SLC_NAMES is not defined.
  1762. X */
  1763. X#define    SLC_NAMELIST    "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
  1764. X            "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
  1765. X            "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
  1766. X#ifdef    SLC_NAMES
  1767. Xchar *slc_names[] = {
  1768. X    SLC_NAMELIST
  1769. X};
  1770. X#else
  1771. Xextern char *slc_names[];
  1772. X#define    SLC_NAMES SLC_NAMELIST
  1773. X#endif
  1774. X
  1775. X#define    SLC_NAME_OK(x)    ((x) >= 0 && (x) < NSLC)
  1776. X#define SLC_NAME(x)    slc_names[x]
  1777. X
  1778. X#define    SLC_NOSUPPORT    0
  1779. X#define    SLC_CANTCHANGE    1
  1780. X#define    SLC_VARIABLE    2
  1781. X#define    SLC_DEFAULT    3
  1782. X#define    SLC_LEVELBITS    0x03
  1783. X
  1784. X#define    SLC_FUNC    0
  1785. X#define    SLC_FLAGS    1
  1786. X#define    SLC_VALUE    2
  1787. X
  1788. X#define    SLC_ACK        0x80
  1789. X#define    SLC_FLUSHIN    0x40
  1790. X#define    SLC_FLUSHOUT    0x20
  1791. X
  1792. X#define    ENV_VALUE    0
  1793. X#define    ENV_VAR        1
  1794. X#define    ENV_ESC        2
  1795. X
  1796. X/*
  1797. X * AUTHENTICATION suboptions
  1798. X */
  1799. X
  1800. X/*
  1801. X * Who is authenticating who ...
  1802. X */
  1803. X#define    AUTH_WHO_CLIENT        0    /* Client authenticating server */
  1804. X#define    AUTH_WHO_SERVER        1    /* Server authenticating client */
  1805. X#define    AUTH_WHO_MASK        1
  1806. X
  1807. X/*
  1808. X * amount of authentication done
  1809. X */
  1810. X#define    AUTH_HOW_ONE_WAY    0
  1811. X#define    AUTH_HOW_MUTUAL        2
  1812. X#define    AUTH_HOW_MASK        2
  1813. X
  1814. X#define    AUTHTYPE_NULL        0
  1815. X#define    AUTHTYPE_KERBEROS_V4    1
  1816. X#define    AUTHTYPE_KERBEROS_V5    2
  1817. X#define    AUTHTYPE_SPX        3
  1818. X#define    AUTHTYPE_MINK        4
  1819. X#define    AUTHTYPE_CNT        5
  1820. X
  1821. X#define    AUTHTYPE_TEST        99
  1822. X
  1823. X#ifdef    AUTH_NAMES
  1824. Xchar *authtype_names[] = {
  1825. X    "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
  1826. X};
  1827. X#else
  1828. Xextern char *authtype_names[];
  1829. X#endif
  1830. X
  1831. X#define    AUTHTYPE_NAME_OK(x)    ((x) >= 0 && (x) < AUTHTYPE_CNT)
  1832. X#define    AUTHTYPE_NAME(x)    authtype_names[x]
  1833. X
  1834. X/*
  1835. X * ENCRYPTion suboptions
  1836. X */
  1837. X#define    ENCRYPT_IS        0    /* I pick encryption type ... */
  1838. X#define    ENCRYPT_SUPPORT        1    /* I support encryption types ... */
  1839. X#define    ENCRYPT_REPLY        2    /* Initial setup response */
  1840. X#define    ENCRYPT_START        3    /* Am starting to send encrypted */
  1841. X#define    ENCRYPT_END        4    /* Am ending encrypted */
  1842. X#define    ENCRYPT_REQSTART    5    /* Request you start encrypting */
  1843. X#define    ENCRYPT_REQEND        6    /* Request you send encrypting */
  1844. X#define    ENCRYPT_ENC_KEYID    7
  1845. X#define    ENCRYPT_DEC_KEYID    8
  1846. X#define    ENCRYPT_CNT        9
  1847. X
  1848. X#define    ENCTYPE_ANY        0
  1849. X#define    ENCTYPE_DES_CFB64    1
  1850. X#define    ENCTYPE_DES_OFB64    2
  1851. X#define    ENCTYPE_CNT        3
  1852. X
  1853. X#ifdef    ENCRYPT_NAMES
  1854. Xchar *encrypt_names[] = {
  1855. X    "IS", "SUPPORT", "REPLY", "START", "END",
  1856. X    "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
  1857. X    0,
  1858. X};
  1859. Xchar *enctype_names[] = {
  1860. X    "ANY", "DES_CFB64",  "DES_OFB64",  0,
  1861. X};
  1862. X#else
  1863. Xextern char *encrypt_names[];
  1864. Xextern char *enctype_names[];
  1865. X#endif
  1866. X
  1867. X
  1868. X#define    ENCRYPT_NAME_OK(x)    ((x) >= 0 && (x) < ENCRYPT_CNT)
  1869. X#define    ENCRYPT_NAME(x)        encrypt_names[x]
  1870. X
  1871. X#define    ENCTYPE_NAME_OK(x)    ((x) >= 0 && (x) < ENCTYPE_CNT)
  1872. X#define    ENCTYPE_NAME(x)        enctype_names[x]
  1873. X
  1874. X#endif /* !_TELNET_H_ */
  1875. END_OF_FILE
  1876. if test 10035 -ne `wc -c <'iss/telnet.h'`; then
  1877.     echo shar: \"'iss/telnet.h'\" unpacked with wrong size!
  1878. fi
  1879. # end of 'iss/telnet.h'
  1880. fi
  1881. if test -f 'iss/todo' -a "${1}" != "-c" ; then 
  1882.   echo shar: Will not clobber existing file \"'iss/todo'\"
  1883. else
  1884. echo shar: Extracting \"'iss/todo'\" \(676 characters\)
  1885. sed "s/^X//" >'iss/todo' <<'END_OF_FILE'
  1886. XTry common default accounts (e.g. guest, bbs, lp, adm, admin, sysadm). 
  1887. X
  1888. XThe following are possible things to probe for: more sendmail bugs, tftp, more
  1889. Xftp tests, finger probe, ypset , nfs problems (guess file handles, export
  1890. Xaccess list => 256 bytes), rsh bug, ip-forwarding, and various other bugs.
  1891. X
  1892. XClean up the Log file so it is more readable and comprehensive.  For example,
  1893. XFTP will tell you whether or not it has anonymous FTP and if the ftp site has
  1894. Xflaws, rather than just showing the results of the commands.
  1895. X
  1896. XMake it so you can 'iss hostname' and it will scan that host and any related
  1897. Xhosts in that domain that would provide access to the hostname you specified.
  1898. X
  1899. END_OF_FILE
  1900. if test 676 -ne `wc -c <'iss/todo'`; then
  1901.     echo shar: \"'iss/todo'\" unpacked with wrong size!
  1902. fi
  1903. # end of 'iss/todo'
  1904. fi
  1905. echo shar: End of shell archive.
  1906. exit 0
  1907.  
  1908. exit 0 # Just in case...
  1909.