├── .gitignore
├── LICENSE
├── Makefile.am
├── README.md
├── build-aux
├── compile
├── depcomp
├── install-sh
└── missing
├── configure.ac
├── dist
└── DIST_TAR_HERE
├── src
├── Makefile.am
├── vbrute.c
└── vbrute.h
├── tests
└── Makefile.am
└── tmp
├── domains
└── ips
/.gitignore:
--------------------------------------------------------------------------------
1 | /Makefile
2 | /Makefile.in
3 | /aclocal.m4
4 | /autom4te.cache/
5 | /config.*
6 | /configure
7 | /depcomp
8 | /install-sh
9 | /libtool
10 | /ltmain.sh
11 | /m4/
12 | /missing
13 | /stamp-h?
14 | .deps/
15 | .dirstamp
16 | .libs/
17 | *.l[ao]
18 | *~
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU AFFERO GENERAL PUBLIC LICENSE
2 | Version 3, 19 November 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU Affero General Public License is a free, copyleft license for
11 | software and other kinds of works, specifically designed to ensure
12 | cooperation with the community in the case of network server software.
13 |
14 | The licenses for most software and other practical works are designed
15 | to take away your freedom to share and change the works. By contrast,
16 | our General Public Licenses are intended to guarantee your freedom to
17 | share and change all versions of a program--to make sure it remains free
18 | software for all its users.
19 |
20 | When we speak of free software, we are referring to freedom, not
21 | price. Our General Public Licenses are designed to make sure that you
22 | have the freedom to distribute copies of free software (and charge for
23 | them if you wish), that you receive source code or can get it if you
24 | want it, that you can change the software or use pieces of it in new
25 | free programs, and that you know you can do these things.
26 |
27 | Developers that use our General Public Licenses protect your rights
28 | with two steps: (1) assert copyright on the software, and (2) offer
29 | you this License which gives you legal permission to copy, distribute
30 | and/or modify the software.
31 |
32 | A secondary benefit of defending all users' freedom is that
33 | improvements made in alternate versions of the program, if they
34 | receive widespread use, become available for other developers to
35 | incorporate. Many developers of free software are heartened and
36 | encouraged by the resulting cooperation. However, in the case of
37 | software used on network servers, this result may fail to come about.
38 | The GNU General Public License permits making a modified version and
39 | letting the public access it on a server without ever releasing its
40 | source code to the public.
41 |
42 | The GNU Affero General Public License is designed specifically to
43 | ensure that, in such cases, the modified source code becomes available
44 | to the community. It requires the operator of a network server to
45 | provide the source code of the modified version running there to the
46 | users of that server. Therefore, public use of a modified version, on
47 | a publicly accessible server, gives the public access to the source
48 | code of the modified version.
49 |
50 | An older license, called the Affero General Public License and
51 | published by Affero, was designed to accomplish similar goals. This is
52 | a different license, not a version of the Affero GPL, but Affero has
53 | released a new version of the Affero GPL which permits relicensing under
54 | this license.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | TERMS AND CONDITIONS
60 |
61 | 0. Definitions.
62 |
63 | "This License" refers to version 3 of the GNU Affero General Public License.
64 |
65 | "Copyright" also means copyright-like laws that apply to other kinds of
66 | works, such as semiconductor masks.
67 |
68 | "The Program" refers to any copyrightable work licensed under this
69 | License. Each licensee is addressed as "you". "Licensees" and
70 | "recipients" may be individuals or organizations.
71 |
72 | To "modify" a work means to copy from or adapt all or part of the work
73 | in a fashion requiring copyright permission, other than the making of an
74 | exact copy. The resulting work is called a "modified version" of the
75 | earlier work or a work "based on" the earlier work.
76 |
77 | A "covered work" means either the unmodified Program or a work based
78 | on the Program.
79 |
80 | To "propagate" a work means to do anything with it that, without
81 | permission, would make you directly or secondarily liable for
82 | infringement under applicable copyright law, except executing it on a
83 | computer or modifying a private copy. Propagation includes copying,
84 | distribution (with or without modification), making available to the
85 | public, and in some countries other activities as well.
86 |
87 | To "convey" a work means any kind of propagation that enables other
88 | parties to make or receive copies. Mere interaction with a user through
89 | a computer network, with no transfer of a copy, is not conveying.
90 |
91 | An interactive user interface displays "Appropriate Legal Notices"
92 | to the extent that it includes a convenient and prominently visible
93 | feature that (1) displays an appropriate copyright notice, and (2)
94 | tells the user that there is no warranty for the work (except to the
95 | extent that warranties are provided), that licensees may convey the
96 | work under this License, and how to view a copy of this License. If
97 | the interface presents a list of user commands or options, such as a
98 | menu, a prominent item in the list meets this criterion.
99 |
100 | 1. Source Code.
101 |
102 | The "source code" for a work means the preferred form of the work
103 | for making modifications to it. "Object code" means any non-source
104 | form of a work.
105 |
106 | A "Standard Interface" means an interface that either is an official
107 | standard defined by a recognized standards body, or, in the case of
108 | interfaces specified for a particular programming language, one that
109 | is widely used among developers working in that language.
110 |
111 | The "System Libraries" of an executable work include anything, other
112 | than the work as a whole, that (a) is included in the normal form of
113 | packaging a Major Component, but which is not part of that Major
114 | Component, and (b) serves only to enable use of the work with that
115 | Major Component, or to implement a Standard Interface for which an
116 | implementation is available to the public in source code form. A
117 | "Major Component", in this context, means a major essential component
118 | (kernel, window system, and so on) of the specific operating system
119 | (if any) on which the executable work runs, or a compiler used to
120 | produce the work, or an object code interpreter used to run it.
121 |
122 | The "Corresponding Source" for a work in object code form means all
123 | the source code needed to generate, install, and (for an executable
124 | work) run the object code and to modify the work, including scripts to
125 | control those activities. However, it does not include the work's
126 | System Libraries, or general-purpose tools or generally available free
127 | programs which are used unmodified in performing those activities but
128 | which are not part of the work. For example, Corresponding Source
129 | includes interface definition files associated with source files for
130 | the work, and the source code for shared libraries and dynamically
131 | linked subprograms that the work is specifically designed to require,
132 | such as by intimate data communication or control flow between those
133 | subprograms and other parts of the work.
134 |
135 | The Corresponding Source need not include anything that users
136 | can regenerate automatically from other parts of the Corresponding
137 | Source.
138 |
139 | The Corresponding Source for a work in source code form is that
140 | same work.
141 |
142 | 2. Basic Permissions.
143 |
144 | All rights granted under this License are granted for the term of
145 | copyright on the Program, and are irrevocable provided the stated
146 | conditions are met. This License explicitly affirms your unlimited
147 | permission to run the unmodified Program. The output from running a
148 | covered work is covered by this License only if the output, given its
149 | content, constitutes a covered work. This License acknowledges your
150 | rights of fair use or other equivalent, as provided by copyright law.
151 |
152 | You may make, run and propagate covered works that you do not
153 | convey, without conditions so long as your license otherwise remains
154 | in force. You may convey covered works to others for the sole purpose
155 | of having them make modifications exclusively for you, or provide you
156 | with facilities for running those works, provided that you comply with
157 | the terms of this License in conveying all material for which you do
158 | not control copyright. Those thus making or running the covered works
159 | for you must do so exclusively on your behalf, under your direction
160 | and control, on terms that prohibit them from making any copies of
161 | your copyrighted material outside their relationship with you.
162 |
163 | Conveying under any other circumstances is permitted solely under
164 | the conditions stated below. Sublicensing is not allowed; section 10
165 | makes it unnecessary.
166 |
167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168 |
169 | No covered work shall be deemed part of an effective technological
170 | measure under any applicable law fulfilling obligations under article
171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172 | similar laws prohibiting or restricting circumvention of such
173 | measures.
174 |
175 | When you convey a covered work, you waive any legal power to forbid
176 | circumvention of technological measures to the extent such circumvention
177 | is effected by exercising rights under this License with respect to
178 | the covered work, and you disclaim any intention to limit operation or
179 | modification of the work as a means of enforcing, against the work's
180 | users, your or third parties' legal rights to forbid circumvention of
181 | technological measures.
182 |
183 | 4. Conveying Verbatim Copies.
184 |
185 | You may convey verbatim copies of the Program's source code as you
186 | receive it, in any medium, provided that you conspicuously and
187 | appropriately publish on each copy an appropriate copyright notice;
188 | keep intact all notices stating that this License and any
189 | non-permissive terms added in accord with section 7 apply to the code;
190 | keep intact all notices of the absence of any warranty; and give all
191 | recipients a copy of this License along with the Program.
192 |
193 | You may charge any price or no price for each copy that you convey,
194 | and you may offer support or warranty protection for a fee.
195 |
196 | 5. Conveying Modified Source Versions.
197 |
198 | You may convey a work based on the Program, or the modifications to
199 | produce it from the Program, in the form of source code under the
200 | terms of section 4, provided that you also meet all of these conditions:
201 |
202 | a) The work must carry prominent notices stating that you modified
203 | it, and giving a relevant date.
204 |
205 | b) The work must carry prominent notices stating that it is
206 | released under this License and any conditions added under section
207 | 7. This requirement modifies the requirement in section 4 to
208 | "keep intact all notices".
209 |
210 | c) You must license the entire work, as a whole, under this
211 | License to anyone who comes into possession of a copy. This
212 | License will therefore apply, along with any applicable section 7
213 | additional terms, to the whole of the work, and all its parts,
214 | regardless of how they are packaged. This License gives no
215 | permission to license the work in any other way, but it does not
216 | invalidate such permission if you have separately received it.
217 |
218 | d) If the work has interactive user interfaces, each must display
219 | Appropriate Legal Notices; however, if the Program has interactive
220 | interfaces that do not display Appropriate Legal Notices, your
221 | work need not make them do so.
222 |
223 | A compilation of a covered work with other separate and independent
224 | works, which are not by their nature extensions of the covered work,
225 | and which are not combined with it such as to form a larger program,
226 | in or on a volume of a storage or distribution medium, is called an
227 | "aggregate" if the compilation and its resulting copyright are not
228 | used to limit the access or legal rights of the compilation's users
229 | beyond what the individual works permit. Inclusion of a covered work
230 | in an aggregate does not cause this License to apply to the other
231 | parts of the aggregate.
232 |
233 | 6. Conveying Non-Source Forms.
234 |
235 | You may convey a covered work in object code form under the terms
236 | of sections 4 and 5, provided that you also convey the
237 | machine-readable Corresponding Source under the terms of this License,
238 | in one of these ways:
239 |
240 | a) Convey the object code in, or embodied in, a physical product
241 | (including a physical distribution medium), accompanied by the
242 | Corresponding Source fixed on a durable physical medium
243 | customarily used for software interchange.
244 |
245 | b) Convey the object code in, or embodied in, a physical product
246 | (including a physical distribution medium), accompanied by a
247 | written offer, valid for at least three years and valid for as
248 | long as you offer spare parts or customer support for that product
249 | model, to give anyone who possesses the object code either (1) a
250 | copy of the Corresponding Source for all the software in the
251 | product that is covered by this License, on a durable physical
252 | medium customarily used for software interchange, for a price no
253 | more than your reasonable cost of physically performing this
254 | conveying of source, or (2) access to copy the
255 | Corresponding Source from a network server at no charge.
256 |
257 | c) Convey individual copies of the object code with a copy of the
258 | written offer to provide the Corresponding Source. This
259 | alternative is allowed only occasionally and noncommercially, and
260 | only if you received the object code with such an offer, in accord
261 | with subsection 6b.
262 |
263 | d) Convey the object code by offering access from a designated
264 | place (gratis or for a charge), and offer equivalent access to the
265 | Corresponding Source in the same way through the same place at no
266 | further charge. You need not require recipients to copy the
267 | Corresponding Source along with the object code. If the place to
268 | copy the object code is a network server, the Corresponding Source
269 | may be on a different server (operated by you or a third party)
270 | that supports equivalent copying facilities, provided you maintain
271 | clear directions next to the object code saying where to find the
272 | Corresponding Source. Regardless of what server hosts the
273 | Corresponding Source, you remain obligated to ensure that it is
274 | available for as long as needed to satisfy these requirements.
275 |
276 | e) Convey the object code using peer-to-peer transmission, provided
277 | you inform other peers where the object code and Corresponding
278 | Source of the work are being offered to the general public at no
279 | charge under subsection 6d.
280 |
281 | A separable portion of the object code, whose source code is excluded
282 | from the Corresponding Source as a System Library, need not be
283 | included in conveying the object code work.
284 |
285 | A "User Product" is either (1) a "consumer product", which means any
286 | tangible personal property which is normally used for personal, family,
287 | or household purposes, or (2) anything designed or sold for incorporation
288 | into a dwelling. In determining whether a product is a consumer product,
289 | doubtful cases shall be resolved in favor of coverage. For a particular
290 | product received by a particular user, "normally used" refers to a
291 | typical or common use of that class of product, regardless of the status
292 | of the particular user or of the way in which the particular user
293 | actually uses, or expects or is expected to use, the product. A product
294 | is a consumer product regardless of whether the product has substantial
295 | commercial, industrial or non-consumer uses, unless such uses represent
296 | the only significant mode of use of the product.
297 |
298 | "Installation Information" for a User Product means any methods,
299 | procedures, authorization keys, or other information required to install
300 | and execute modified versions of a covered work in that User Product from
301 | a modified version of its Corresponding Source. The information must
302 | suffice to ensure that the continued functioning of the modified object
303 | code is in no case prevented or interfered with solely because
304 | modification has been made.
305 |
306 | If you convey an object code work under this section in, or with, or
307 | specifically for use in, a User Product, and the conveying occurs as
308 | part of a transaction in which the right of possession and use of the
309 | User Product is transferred to the recipient in perpetuity or for a
310 | fixed term (regardless of how the transaction is characterized), the
311 | Corresponding Source conveyed under this section must be accompanied
312 | by the Installation Information. But this requirement does not apply
313 | if neither you nor any third party retains the ability to install
314 | modified object code on the User Product (for example, the work has
315 | been installed in ROM).
316 |
317 | The requirement to provide Installation Information does not include a
318 | requirement to continue to provide support service, warranty, or updates
319 | for a work that has been modified or installed by the recipient, or for
320 | the User Product in which it has been modified or installed. Access to a
321 | network may be denied when the modification itself materially and
322 | adversely affects the operation of the network or violates the rules and
323 | protocols for communication across the network.
324 |
325 | Corresponding Source conveyed, and Installation Information provided,
326 | in accord with this section must be in a format that is publicly
327 | documented (and with an implementation available to the public in
328 | source code form), and must require no special password or key for
329 | unpacking, reading or copying.
330 |
331 | 7. Additional Terms.
332 |
333 | "Additional permissions" are terms that supplement the terms of this
334 | License by making exceptions from one or more of its conditions.
335 | Additional permissions that are applicable to the entire Program shall
336 | be treated as though they were included in this License, to the extent
337 | that they are valid under applicable law. If additional permissions
338 | apply only to part of the Program, that part may be used separately
339 | under those permissions, but the entire Program remains governed by
340 | this License without regard to the additional permissions.
341 |
342 | When you convey a copy of a covered work, you may at your option
343 | remove any additional permissions from that copy, or from any part of
344 | it. (Additional permissions may be written to require their own
345 | removal in certain cases when you modify the work.) You may place
346 | additional permissions on material, added by you to a covered work,
347 | for which you have or can give appropriate copyright permission.
348 |
349 | Notwithstanding any other provision of this License, for material you
350 | add to a covered work, you may (if authorized by the copyright holders of
351 | that material) supplement the terms of this License with terms:
352 |
353 | a) Disclaiming warranty or limiting liability differently from the
354 | terms of sections 15 and 16 of this License; or
355 |
356 | b) Requiring preservation of specified reasonable legal notices or
357 | author attributions in that material or in the Appropriate Legal
358 | Notices displayed by works containing it; or
359 |
360 | c) Prohibiting misrepresentation of the origin of that material, or
361 | requiring that modified versions of such material be marked in
362 | reasonable ways as different from the original version; or
363 |
364 | d) Limiting the use for publicity purposes of names of licensors or
365 | authors of the material; or
366 |
367 | e) Declining to grant rights under trademark law for use of some
368 | trade names, trademarks, or service marks; or
369 |
370 | f) Requiring indemnification of licensors and authors of that
371 | material by anyone who conveys the material (or modified versions of
372 | it) with contractual assumptions of liability to the recipient, for
373 | any liability that these contractual assumptions directly impose on
374 | those licensors and authors.
375 |
376 | All other non-permissive additional terms are considered "further
377 | restrictions" within the meaning of section 10. If the Program as you
378 | received it, or any part of it, contains a notice stating that it is
379 | governed by this License along with a term that is a further
380 | restriction, you may remove that term. If a license document contains
381 | a further restriction but permits relicensing or conveying under this
382 | License, you may add to a covered work material governed by the terms
383 | of that license document, provided that the further restriction does
384 | not survive such relicensing or conveying.
385 |
386 | If you add terms to a covered work in accord with this section, you
387 | must place, in the relevant source files, a statement of the
388 | additional terms that apply to those files, or a notice indicating
389 | where to find the applicable terms.
390 |
391 | Additional terms, permissive or non-permissive, may be stated in the
392 | form of a separately written license, or stated as exceptions;
393 | the above requirements apply either way.
394 |
395 | 8. Termination.
396 |
397 | You may not propagate or modify a covered work except as expressly
398 | provided under this License. Any attempt otherwise to propagate or
399 | modify it is void, and will automatically terminate your rights under
400 | this License (including any patent licenses granted under the third
401 | paragraph of section 11).
402 |
403 | However, if you cease all violation of this License, then your
404 | license from a particular copyright holder is reinstated (a)
405 | provisionally, unless and until the copyright holder explicitly and
406 | finally terminates your license, and (b) permanently, if the copyright
407 | holder fails to notify you of the violation by some reasonable means
408 | prior to 60 days after the cessation.
409 |
410 | Moreover, your license from a particular copyright holder is
411 | reinstated permanently if the copyright holder notifies you of the
412 | violation by some reasonable means, this is the first time you have
413 | received notice of violation of this License (for any work) from that
414 | copyright holder, and you cure the violation prior to 30 days after
415 | your receipt of the notice.
416 |
417 | Termination of your rights under this section does not terminate the
418 | licenses of parties who have received copies or rights from you under
419 | this License. If your rights have been terminated and not permanently
420 | reinstated, you do not qualify to receive new licenses for the same
421 | material under section 10.
422 |
423 | 9. Acceptance Not Required for Having Copies.
424 |
425 | You are not required to accept this License in order to receive or
426 | run a copy of the Program. Ancillary propagation of a covered work
427 | occurring solely as a consequence of using peer-to-peer transmission
428 | to receive a copy likewise does not require acceptance. However,
429 | nothing other than this License grants you permission to propagate or
430 | modify any covered work. These actions infringe copyright if you do
431 | not accept this License. Therefore, by modifying or propagating a
432 | covered work, you indicate your acceptance of this License to do so.
433 |
434 | 10. Automatic Licensing of Downstream Recipients.
435 |
436 | Each time you convey a covered work, the recipient automatically
437 | receives a license from the original licensors, to run, modify and
438 | propagate that work, subject to this License. You are not responsible
439 | for enforcing compliance by third parties with this License.
440 |
441 | An "entity transaction" is a transaction transferring control of an
442 | organization, or substantially all assets of one, or subdividing an
443 | organization, or merging organizations. If propagation of a covered
444 | work results from an entity transaction, each party to that
445 | transaction who receives a copy of the work also receives whatever
446 | licenses to the work the party's predecessor in interest had or could
447 | give under the previous paragraph, plus a right to possession of the
448 | Corresponding Source of the work from the predecessor in interest, if
449 | the predecessor has it or can get it with reasonable efforts.
450 |
451 | You may not impose any further restrictions on the exercise of the
452 | rights granted or affirmed under this License. For example, you may
453 | not impose a license fee, royalty, or other charge for exercise of
454 | rights granted under this License, and you may not initiate litigation
455 | (including a cross-claim or counterclaim in a lawsuit) alleging that
456 | any patent claim is infringed by making, using, selling, offering for
457 | sale, or importing the Program or any portion of it.
458 |
459 | 11. Patents.
460 |
461 | A "contributor" is a copyright holder who authorizes use under this
462 | License of the Program or a work on which the Program is based. The
463 | work thus licensed is called the contributor's "contributor version".
464 |
465 | A contributor's "essential patent claims" are all patent claims
466 | owned or controlled by the contributor, whether already acquired or
467 | hereafter acquired, that would be infringed by some manner, permitted
468 | by this License, of making, using, or selling its contributor version,
469 | but do not include claims that would be infringed only as a
470 | consequence of further modification of the contributor version. For
471 | purposes of this definition, "control" includes the right to grant
472 | patent sublicenses in a manner consistent with the requirements of
473 | this License.
474 |
475 | Each contributor grants you a non-exclusive, worldwide, royalty-free
476 | patent license under the contributor's essential patent claims, to
477 | make, use, sell, offer for sale, import and otherwise run, modify and
478 | propagate the contents of its contributor version.
479 |
480 | In the following three paragraphs, a "patent license" is any express
481 | agreement or commitment, however denominated, not to enforce a patent
482 | (such as an express permission to practice a patent or covenant not to
483 | sue for patent infringement). To "grant" such a patent license to a
484 | party means to make such an agreement or commitment not to enforce a
485 | patent against the party.
486 |
487 | If you convey a covered work, knowingly relying on a patent license,
488 | and the Corresponding Source of the work is not available for anyone
489 | to copy, free of charge and under the terms of this License, through a
490 | publicly available network server or other readily accessible means,
491 | then you must either (1) cause the Corresponding Source to be so
492 | available, or (2) arrange to deprive yourself of the benefit of the
493 | patent license for this particular work, or (3) arrange, in a manner
494 | consistent with the requirements of this License, to extend the patent
495 | license to downstream recipients. "Knowingly relying" means you have
496 | actual knowledge that, but for the patent license, your conveying the
497 | covered work in a country, or your recipient's use of the covered work
498 | in a country, would infringe one or more identifiable patents in that
499 | country that you have reason to believe are valid.
500 |
501 | If, pursuant to or in connection with a single transaction or
502 | arrangement, you convey, or propagate by procuring conveyance of, a
503 | covered work, and grant a patent license to some of the parties
504 | receiving the covered work authorizing them to use, propagate, modify
505 | or convey a specific copy of the covered work, then the patent license
506 | you grant is automatically extended to all recipients of the covered
507 | work and works based on it.
508 |
509 | A patent license is "discriminatory" if it does not include within
510 | the scope of its coverage, prohibits the exercise of, or is
511 | conditioned on the non-exercise of one or more of the rights that are
512 | specifically granted under this License. You may not convey a covered
513 | work if you are a party to an arrangement with a third party that is
514 | in the business of distributing software, under which you make payment
515 | to the third party based on the extent of your activity of conveying
516 | the work, and under which the third party grants, to any of the
517 | parties who would receive the covered work from you, a discriminatory
518 | patent license (a) in connection with copies of the covered work
519 | conveyed by you (or copies made from those copies), or (b) primarily
520 | for and in connection with specific products or compilations that
521 | contain the covered work, unless you entered into that arrangement,
522 | or that patent license was granted, prior to 28 March 2007.
523 |
524 | Nothing in this License shall be construed as excluding or limiting
525 | any implied license or other defenses to infringement that may
526 | otherwise be available to you under applicable patent law.
527 |
528 | 12. No Surrender of Others' Freedom.
529 |
530 | If conditions are imposed on you (whether by court order, agreement or
531 | otherwise) that contradict the conditions of this License, they do not
532 | excuse you from the conditions of this License. If you cannot convey a
533 | covered work so as to satisfy simultaneously your obligations under this
534 | License and any other pertinent obligations, then as a consequence you may
535 | not convey it at all. For example, if you agree to terms that obligate you
536 | to collect a royalty for further conveying from those to whom you convey
537 | the Program, the only way you could satisfy both those terms and this
538 | License would be to refrain entirely from conveying the Program.
539 |
540 | 13. Remote Network Interaction; Use with the GNU General Public License.
541 |
542 | Notwithstanding any other provision of this License, if you modify the
543 | Program, your modified version must prominently offer all users
544 | interacting with it remotely through a computer network (if your version
545 | supports such interaction) an opportunity to receive the Corresponding
546 | Source of your version by providing access to the Corresponding Source
547 | from a network server at no charge, through some standard or customary
548 | means of facilitating copying of software. This Corresponding Source
549 | shall include the Corresponding Source for any work covered by version 3
550 | of the GNU General Public License that is incorporated pursuant to the
551 | following paragraph.
552 |
553 | Notwithstanding any other provision of this License, you have
554 | permission to link or combine any covered work with a work licensed
555 | under version 3 of the GNU General Public License into a single
556 | combined work, and to convey the resulting work. The terms of this
557 | License will continue to apply to the part which is the covered work,
558 | but the work with which it is combined will remain governed by version
559 | 3 of the GNU General Public License.
560 |
561 | 14. Revised Versions of this License.
562 |
563 | The Free Software Foundation may publish revised and/or new versions of
564 | the GNU Affero General Public License from time to time. Such new versions
565 | will be similar in spirit to the present version, but may differ in detail to
566 | address new problems or concerns.
567 |
568 | Each version is given a distinguishing version number. If the
569 | Program specifies that a certain numbered version of the GNU Affero General
570 | Public License "or any later version" applies to it, you have the
571 | option of following the terms and conditions either of that numbered
572 | version or of any later version published by the Free Software
573 | Foundation. If the Program does not specify a version number of the
574 | GNU Affero General Public License, you may choose any version ever published
575 | by the Free Software Foundation.
576 |
577 | If the Program specifies that a proxy can decide which future
578 | versions of the GNU Affero General Public License can be used, that proxy's
579 | public statement of acceptance of a version permanently authorizes you
580 | to choose that version for the Program.
581 |
582 | Later license versions may give you additional or different
583 | permissions. However, no additional obligations are imposed on any
584 | author or copyright holder as a result of your choosing to follow a
585 | later version.
586 |
587 | 15. Disclaimer of Warranty.
588 |
589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597 |
598 | 16. Limitation of Liability.
599 |
600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608 | SUCH DAMAGES.
609 |
610 | 17. Interpretation of Sections 15 and 16.
611 |
612 | If the disclaimer of warranty and limitation of liability provided
613 | above cannot be given local legal effect according to their terms,
614 | reviewing courts shall apply local law that most closely approximates
615 | an absolute waiver of all civil liability in connection with the
616 | Program, unless a warranty or assumption of liability accompanies a
617 | copy of the Program in return for a fee.
618 |
619 | END OF TERMS AND CONDITIONS
620 |
621 | How to Apply These Terms to Your New Programs
622 |
623 | If you develop a new program, and you want it to be of the greatest
624 | possible use to the public, the best way to achieve this is to make it
625 | free software which everyone can redistribute and change under these terms.
626 |
627 | To do so, attach the following notices to the program. It is safest
628 | to attach them to the start of each source file to most effectively
629 | state the exclusion of warranty; and each file should have at least
630 | the "copyright" line and a pointer to where the full notice is found.
631 |
632 |
633 | Copyright (C)
634 |
635 | This program is free software: you can redistribute it and/or modify
636 | it under the terms of the GNU Affero General Public License as published by
637 | the Free Software Foundation, either version 3 of the License, or
638 | (at your option) any later version.
639 |
640 | This program is distributed in the hope that it will be useful,
641 | but WITHOUT ANY WARRANTY; without even the implied warranty of
642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643 | GNU Affero General Public License for more details.
644 |
645 | You should have received a copy of the GNU Affero General Public License
646 | along with this program. If not, see .
647 |
648 | Also add information on how to contact you by electronic and paper mail.
649 |
650 | If your software can interact with users remotely through a computer
651 | network, you should also make sure that it provides a way for users to
652 | get its source. For example, if your program is a web application, its
653 | interface could display a "Source" link that leads users to an archive
654 | of the code. There are many ways you could offer source, and different
655 | solutions will be better for different programs; see section 13 for the
656 | specific requirements.
657 |
658 | You should also get your employer (if you work as a programmer) or school,
659 | if any, to sign a "copyright disclaimer" for the program, if necessary.
660 | For more information on this, and how to apply and follow the GNU AGPL, see
661 | .
662 |
--------------------------------------------------------------------------------
/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_LDFLAGS = -levent -Wall
2 |
3 | SUBDIRS = src .
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | vbrute
2 | ==================
3 |
4 | Virtual hosts brute forcer. Specify file containing domains and file containing
5 | IPs and vbrute will attempt to connect to IP with specific domain.
6 |
7 | Usage:
8 |
9 | ```
10 | vbrute --domain-file --ip-file
11 |
12 | -d, --domain-file Specify file containing a list of domains you want to test
13 | -i, --ip-file Specify file containing a list of IP addresses you want to test
14 | -t, --timeout Specify request timeout. Default is 5 seconds
15 | ```
16 |
17 | Sample output:
18 |
19 | ```
20 | -----------------------------------------------------------
21 | Domain IP Code Length
22 | -----------------------------------------------------------
23 | google.com 212.58.253.67 301 229
24 | cnn.com 212.58.253.67 301 229
25 | test.com 212.58.253.67 301 229
26 | -----------------------------------------------------------
27 | Domain IP Code Length
28 | -----------------------------------------------------------
29 | google.com 173.194.41.88 301 219
30 | cnn.com 173.194.41.88 302 219
31 | test.com 173.194.41.88 302 219
32 | ```
33 |
--------------------------------------------------------------------------------
/build-aux/compile:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # Wrapper for compilers which do not understand '-c -o'.
3 |
4 | scriptversion=2012-10-14.11; # UTC
5 |
6 | # Copyright (C) 1999-2013 Free Software Foundation, Inc.
7 | # Written by Tom Tromey .
8 | #
9 | # This program is free software; you can redistribute it and/or modify
10 | # it under the terms of the GNU General Public License as published by
11 | # the Free Software Foundation; either version 2, or (at your option)
12 | # any later version.
13 | #
14 | # This program is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with this program. If not, see .
21 |
22 | # As a special exception to the GNU General Public License, if you
23 | # distribute this file as part of a program that contains a
24 | # configuration script generated by Autoconf, you may include it under
25 | # the same distribution terms that you use for the rest of that program.
26 |
27 | # This file is maintained in Automake, please report
28 | # bugs to or send patches to
29 | # .
30 |
31 | nl='
32 | '
33 |
34 | # We need space, tab and new line, in precisely that order. Quoting is
35 | # there to prevent tools from complaining about whitespace usage.
36 | IFS=" "" $nl"
37 |
38 | file_conv=
39 |
40 | # func_file_conv build_file lazy
41 | # Convert a $build file to $host form and store it in $file
42 | # Currently only supports Windows hosts. If the determined conversion
43 | # type is listed in (the comma separated) LAZY, no conversion will
44 | # take place.
45 | func_file_conv ()
46 | {
47 | file=$1
48 | case $file in
49 | / | /[!/]*) # absolute file, and not a UNC file
50 | if test -z "$file_conv"; then
51 | # lazily determine how to convert abs files
52 | case `uname -s` in
53 | MINGW*)
54 | file_conv=mingw
55 | ;;
56 | CYGWIN*)
57 | file_conv=cygwin
58 | ;;
59 | *)
60 | file_conv=wine
61 | ;;
62 | esac
63 | fi
64 | case $file_conv/,$2, in
65 | *,$file_conv,*)
66 | ;;
67 | mingw/*)
68 | file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
69 | ;;
70 | cygwin/*)
71 | file=`cygpath -m "$file" || echo "$file"`
72 | ;;
73 | wine/*)
74 | file=`winepath -w "$file" || echo "$file"`
75 | ;;
76 | esac
77 | ;;
78 | esac
79 | }
80 |
81 | # func_cl_dashL linkdir
82 | # Make cl look for libraries in LINKDIR
83 | func_cl_dashL ()
84 | {
85 | func_file_conv "$1"
86 | if test -z "$lib_path"; then
87 | lib_path=$file
88 | else
89 | lib_path="$lib_path;$file"
90 | fi
91 | linker_opts="$linker_opts -LIBPATH:$file"
92 | }
93 |
94 | # func_cl_dashl library
95 | # Do a library search-path lookup for cl
96 | func_cl_dashl ()
97 | {
98 | lib=$1
99 | found=no
100 | save_IFS=$IFS
101 | IFS=';'
102 | for dir in $lib_path $LIB
103 | do
104 | IFS=$save_IFS
105 | if $shared && test -f "$dir/$lib.dll.lib"; then
106 | found=yes
107 | lib=$dir/$lib.dll.lib
108 | break
109 | fi
110 | if test -f "$dir/$lib.lib"; then
111 | found=yes
112 | lib=$dir/$lib.lib
113 | break
114 | fi
115 | if test -f "$dir/lib$lib.a"; then
116 | found=yes
117 | lib=$dir/lib$lib.a
118 | break
119 | fi
120 | done
121 | IFS=$save_IFS
122 |
123 | if test "$found" != yes; then
124 | lib=$lib.lib
125 | fi
126 | }
127 |
128 | # func_cl_wrapper cl arg...
129 | # Adjust compile command to suit cl
130 | func_cl_wrapper ()
131 | {
132 | # Assume a capable shell
133 | lib_path=
134 | shared=:
135 | linker_opts=
136 | for arg
137 | do
138 | if test -n "$eat"; then
139 | eat=
140 | else
141 | case $1 in
142 | -o)
143 | # configure might choose to run compile as 'compile cc -o foo foo.c'.
144 | eat=1
145 | case $2 in
146 | *.o | *.[oO][bB][jJ])
147 | func_file_conv "$2"
148 | set x "$@" -Fo"$file"
149 | shift
150 | ;;
151 | *)
152 | func_file_conv "$2"
153 | set x "$@" -Fe"$file"
154 | shift
155 | ;;
156 | esac
157 | ;;
158 | -I)
159 | eat=1
160 | func_file_conv "$2" mingw
161 | set x "$@" -I"$file"
162 | shift
163 | ;;
164 | -I*)
165 | func_file_conv "${1#-I}" mingw
166 | set x "$@" -I"$file"
167 | shift
168 | ;;
169 | -l)
170 | eat=1
171 | func_cl_dashl "$2"
172 | set x "$@" "$lib"
173 | shift
174 | ;;
175 | -l*)
176 | func_cl_dashl "${1#-l}"
177 | set x "$@" "$lib"
178 | shift
179 | ;;
180 | -L)
181 | eat=1
182 | func_cl_dashL "$2"
183 | ;;
184 | -L*)
185 | func_cl_dashL "${1#-L}"
186 | ;;
187 | -static)
188 | shared=false
189 | ;;
190 | -Wl,*)
191 | arg=${1#-Wl,}
192 | save_ifs="$IFS"; IFS=','
193 | for flag in $arg; do
194 | IFS="$save_ifs"
195 | linker_opts="$linker_opts $flag"
196 | done
197 | IFS="$save_ifs"
198 | ;;
199 | -Xlinker)
200 | eat=1
201 | linker_opts="$linker_opts $2"
202 | ;;
203 | -*)
204 | set x "$@" "$1"
205 | shift
206 | ;;
207 | *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
208 | func_file_conv "$1"
209 | set x "$@" -Tp"$file"
210 | shift
211 | ;;
212 | *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
213 | func_file_conv "$1" mingw
214 | set x "$@" "$file"
215 | shift
216 | ;;
217 | *)
218 | set x "$@" "$1"
219 | shift
220 | ;;
221 | esac
222 | fi
223 | shift
224 | done
225 | if test -n "$linker_opts"; then
226 | linker_opts="-link$linker_opts"
227 | fi
228 | exec "$@" $linker_opts
229 | exit 1
230 | }
231 |
232 | eat=
233 |
234 | case $1 in
235 | '')
236 | echo "$0: No command. Try '$0 --help' for more information." 1>&2
237 | exit 1;
238 | ;;
239 | -h | --h*)
240 | cat <<\EOF
241 | Usage: compile [--help] [--version] PROGRAM [ARGS]
242 |
243 | Wrapper for compilers which do not understand '-c -o'.
244 | Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
245 | arguments, and rename the output as expected.
246 |
247 | If you are trying to build a whole package this is not the
248 | right script to run: please start by reading the file 'INSTALL'.
249 |
250 | Report bugs to .
251 | EOF
252 | exit $?
253 | ;;
254 | -v | --v*)
255 | echo "compile $scriptversion"
256 | exit $?
257 | ;;
258 | cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
259 | func_cl_wrapper "$@" # Doesn't return...
260 | ;;
261 | esac
262 |
263 | ofile=
264 | cfile=
265 |
266 | for arg
267 | do
268 | if test -n "$eat"; then
269 | eat=
270 | else
271 | case $1 in
272 | -o)
273 | # configure might choose to run compile as 'compile cc -o foo foo.c'.
274 | # So we strip '-o arg' only if arg is an object.
275 | eat=1
276 | case $2 in
277 | *.o | *.obj)
278 | ofile=$2
279 | ;;
280 | *)
281 | set x "$@" -o "$2"
282 | shift
283 | ;;
284 | esac
285 | ;;
286 | *.c)
287 | cfile=$1
288 | set x "$@" "$1"
289 | shift
290 | ;;
291 | *)
292 | set x "$@" "$1"
293 | shift
294 | ;;
295 | esac
296 | fi
297 | shift
298 | done
299 |
300 | if test -z "$ofile" || test -z "$cfile"; then
301 | # If no '-o' option was seen then we might have been invoked from a
302 | # pattern rule where we don't need one. That is ok -- this is a
303 | # normal compilation that the losing compiler can handle. If no
304 | # '.c' file was seen then we are probably linking. That is also
305 | # ok.
306 | exec "$@"
307 | fi
308 |
309 | # Name of file we expect compiler to create.
310 | cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
311 |
312 | # Create the lock directory.
313 | # Note: use '[/\\:.-]' here to ensure that we don't use the same name
314 | # that we are using for the .o file. Also, base the name on the expected
315 | # object file name, since that is what matters with a parallel build.
316 | lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
317 | while true; do
318 | if mkdir "$lockdir" >/dev/null 2>&1; then
319 | break
320 | fi
321 | sleep 1
322 | done
323 | # FIXME: race condition here if user kills between mkdir and trap.
324 | trap "rmdir '$lockdir'; exit 1" 1 2 15
325 |
326 | # Run the compile.
327 | "$@"
328 | ret=$?
329 |
330 | if test -f "$cofile"; then
331 | test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
332 | elif test -f "${cofile}bj"; then
333 | test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
334 | fi
335 |
336 | rmdir "$lockdir"
337 | exit $ret
338 |
339 | # Local Variables:
340 | # mode: shell-script
341 | # sh-indentation: 2
342 | # eval: (add-hook 'write-file-hooks 'time-stamp)
343 | # time-stamp-start: "scriptversion="
344 | # time-stamp-format: "%:y-%02m-%02d.%02H"
345 | # time-stamp-time-zone: "UTC"
346 | # time-stamp-end: "; # UTC"
347 | # End:
348 |
--------------------------------------------------------------------------------
/build-aux/depcomp:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # depcomp - compile a program generating dependencies as side-effects
3 |
4 | scriptversion=2013-05-30.07; # UTC
5 |
6 | # Copyright (C) 1999-2013 Free Software Foundation, Inc.
7 |
8 | # This program is free software; you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation; either version 2, or (at your option)
11 | # any later version.
12 |
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 |
18 | # You should have received a copy of the GNU General Public License
19 | # along with this program. If not, see .
20 |
21 | # As a special exception to the GNU General Public License, if you
22 | # distribute this file as part of a program that contains a
23 | # configuration script generated by Autoconf, you may include it under
24 | # the same distribution terms that you use for the rest of that program.
25 |
26 | # Originally written by Alexandre Oliva .
27 |
28 | case $1 in
29 | '')
30 | echo "$0: No command. Try '$0 --help' for more information." 1>&2
31 | exit 1;
32 | ;;
33 | -h | --h*)
34 | cat <<\EOF
35 | Usage: depcomp [--help] [--version] PROGRAM [ARGS]
36 |
37 | Run PROGRAMS ARGS to compile a file, generating dependencies
38 | as side-effects.
39 |
40 | Environment variables:
41 | depmode Dependency tracking mode.
42 | source Source file read by 'PROGRAMS ARGS'.
43 | object Object file output by 'PROGRAMS ARGS'.
44 | DEPDIR directory where to store dependencies.
45 | depfile Dependency file to output.
46 | tmpdepfile Temporary file to use when outputting dependencies.
47 | libtool Whether libtool is used (yes/no).
48 |
49 | Report bugs to .
50 | EOF
51 | exit $?
52 | ;;
53 | -v | --v*)
54 | echo "depcomp $scriptversion"
55 | exit $?
56 | ;;
57 | esac
58 |
59 | # Get the directory component of the given path, and save it in the
60 | # global variables '$dir'. Note that this directory component will
61 | # be either empty or ending with a '/' character. This is deliberate.
62 | set_dir_from ()
63 | {
64 | case $1 in
65 | */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
66 | *) dir=;;
67 | esac
68 | }
69 |
70 | # Get the suffix-stripped basename of the given path, and save it the
71 | # global variable '$base'.
72 | set_base_from ()
73 | {
74 | base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
75 | }
76 |
77 | # If no dependency file was actually created by the compiler invocation,
78 | # we still have to create a dummy depfile, to avoid errors with the
79 | # Makefile "include basename.Plo" scheme.
80 | make_dummy_depfile ()
81 | {
82 | echo "#dummy" > "$depfile"
83 | }
84 |
85 | # Factor out some common post-processing of the generated depfile.
86 | # Requires the auxiliary global variable '$tmpdepfile' to be set.
87 | aix_post_process_depfile ()
88 | {
89 | # If the compiler actually managed to produce a dependency file,
90 | # post-process it.
91 | if test -f "$tmpdepfile"; then
92 | # Each line is of the form 'foo.o: dependency.h'.
93 | # Do two passes, one to just change these to
94 | # $object: dependency.h
95 | # and one to simply output
96 | # dependency.h:
97 | # which is needed to avoid the deleted-header problem.
98 | { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
99 | sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
100 | } > "$depfile"
101 | rm -f "$tmpdepfile"
102 | else
103 | make_dummy_depfile
104 | fi
105 | }
106 |
107 | # A tabulation character.
108 | tab=' '
109 | # A newline character.
110 | nl='
111 | '
112 | # Character ranges might be problematic outside the C locale.
113 | # These definitions help.
114 | upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
115 | lower=abcdefghijklmnopqrstuvwxyz
116 | digits=0123456789
117 | alpha=${upper}${lower}
118 |
119 | if test -z "$depmode" || test -z "$source" || test -z "$object"; then
120 | echo "depcomp: Variables source, object and depmode must be set" 1>&2
121 | exit 1
122 | fi
123 |
124 | # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
125 | depfile=${depfile-`echo "$object" |
126 | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
127 | tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
128 |
129 | rm -f "$tmpdepfile"
130 |
131 | # Avoid interferences from the environment.
132 | gccflag= dashmflag=
133 |
134 | # Some modes work just like other modes, but use different flags. We
135 | # parameterize here, but still list the modes in the big case below,
136 | # to make depend.m4 easier to write. Note that we *cannot* use a case
137 | # here, because this file can only contain one case statement.
138 | if test "$depmode" = hp; then
139 | # HP compiler uses -M and no extra arg.
140 | gccflag=-M
141 | depmode=gcc
142 | fi
143 |
144 | if test "$depmode" = dashXmstdout; then
145 | # This is just like dashmstdout with a different argument.
146 | dashmflag=-xM
147 | depmode=dashmstdout
148 | fi
149 |
150 | cygpath_u="cygpath -u -f -"
151 | if test "$depmode" = msvcmsys; then
152 | # This is just like msvisualcpp but w/o cygpath translation.
153 | # Just convert the backslash-escaped backslashes to single forward
154 | # slashes to satisfy depend.m4
155 | cygpath_u='sed s,\\\\,/,g'
156 | depmode=msvisualcpp
157 | fi
158 |
159 | if test "$depmode" = msvc7msys; then
160 | # This is just like msvc7 but w/o cygpath translation.
161 | # Just convert the backslash-escaped backslashes to single forward
162 | # slashes to satisfy depend.m4
163 | cygpath_u='sed s,\\\\,/,g'
164 | depmode=msvc7
165 | fi
166 |
167 | if test "$depmode" = xlc; then
168 | # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
169 | gccflag=-qmakedep=gcc,-MF
170 | depmode=gcc
171 | fi
172 |
173 | case "$depmode" in
174 | gcc3)
175 | ## gcc 3 implements dependency tracking that does exactly what
176 | ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
177 | ## it if -MD -MP comes after the -MF stuff. Hmm.
178 | ## Unfortunately, FreeBSD c89 acceptance of flags depends upon
179 | ## the command line argument order; so add the flags where they
180 | ## appear in depend2.am. Note that the slowdown incurred here
181 | ## affects only configure: in makefiles, %FASTDEP% shortcuts this.
182 | for arg
183 | do
184 | case $arg in
185 | -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
186 | *) set fnord "$@" "$arg" ;;
187 | esac
188 | shift # fnord
189 | shift # $arg
190 | done
191 | "$@"
192 | stat=$?
193 | if test $stat -ne 0; then
194 | rm -f "$tmpdepfile"
195 | exit $stat
196 | fi
197 | mv "$tmpdepfile" "$depfile"
198 | ;;
199 |
200 | gcc)
201 | ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
202 | ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
203 | ## (see the conditional assignment to $gccflag above).
204 | ## There are various ways to get dependency output from gcc. Here's
205 | ## why we pick this rather obscure method:
206 | ## - Don't want to use -MD because we'd like the dependencies to end
207 | ## up in a subdir. Having to rename by hand is ugly.
208 | ## (We might end up doing this anyway to support other compilers.)
209 | ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
210 | ## -MM, not -M (despite what the docs say). Also, it might not be
211 | ## supported by the other compilers which use the 'gcc' depmode.
212 | ## - Using -M directly means running the compiler twice (even worse
213 | ## than renaming).
214 | if test -z "$gccflag"; then
215 | gccflag=-MD,
216 | fi
217 | "$@" -Wp,"$gccflag$tmpdepfile"
218 | stat=$?
219 | if test $stat -ne 0; then
220 | rm -f "$tmpdepfile"
221 | exit $stat
222 | fi
223 | rm -f "$depfile"
224 | echo "$object : \\" > "$depfile"
225 | # The second -e expression handles DOS-style file names with drive
226 | # letters.
227 | sed -e 's/^[^:]*: / /' \
228 | -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
229 | ## This next piece of magic avoids the "deleted header file" problem.
230 | ## The problem is that when a header file which appears in a .P file
231 | ## is deleted, the dependency causes make to die (because there is
232 | ## typically no way to rebuild the header). We avoid this by adding
233 | ## dummy dependencies for each header file. Too bad gcc doesn't do
234 | ## this for us directly.
235 | ## Some versions of gcc put a space before the ':'. On the theory
236 | ## that the space means something, we add a space to the output as
237 | ## well. hp depmode also adds that space, but also prefixes the VPATH
238 | ## to the object. Take care to not repeat it in the output.
239 | ## Some versions of the HPUX 10.20 sed can't process this invocation
240 | ## correctly. Breaking it into two sed invocations is a workaround.
241 | tr ' ' "$nl" < "$tmpdepfile" \
242 | | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
243 | | sed -e 's/$/ :/' >> "$depfile"
244 | rm -f "$tmpdepfile"
245 | ;;
246 |
247 | hp)
248 | # This case exists only to let depend.m4 do its work. It works by
249 | # looking at the text of this script. This case will never be run,
250 | # since it is checked for above.
251 | exit 1
252 | ;;
253 |
254 | sgi)
255 | if test "$libtool" = yes; then
256 | "$@" "-Wp,-MDupdate,$tmpdepfile"
257 | else
258 | "$@" -MDupdate "$tmpdepfile"
259 | fi
260 | stat=$?
261 | if test $stat -ne 0; then
262 | rm -f "$tmpdepfile"
263 | exit $stat
264 | fi
265 | rm -f "$depfile"
266 |
267 | if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
268 | echo "$object : \\" > "$depfile"
269 | # Clip off the initial element (the dependent). Don't try to be
270 | # clever and replace this with sed code, as IRIX sed won't handle
271 | # lines with more than a fixed number of characters (4096 in
272 | # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
273 | # the IRIX cc adds comments like '#:fec' to the end of the
274 | # dependency line.
275 | tr ' ' "$nl" < "$tmpdepfile" \
276 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
277 | | tr "$nl" ' ' >> "$depfile"
278 | echo >> "$depfile"
279 | # The second pass generates a dummy entry for each header file.
280 | tr ' ' "$nl" < "$tmpdepfile" \
281 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
282 | >> "$depfile"
283 | else
284 | make_dummy_depfile
285 | fi
286 | rm -f "$tmpdepfile"
287 | ;;
288 |
289 | xlc)
290 | # This case exists only to let depend.m4 do its work. It works by
291 | # looking at the text of this script. This case will never be run,
292 | # since it is checked for above.
293 | exit 1
294 | ;;
295 |
296 | aix)
297 | # The C for AIX Compiler uses -M and outputs the dependencies
298 | # in a .u file. In older versions, this file always lives in the
299 | # current directory. Also, the AIX compiler puts '$object:' at the
300 | # start of each line; $object doesn't have directory information.
301 | # Version 6 uses the directory in both cases.
302 | set_dir_from "$object"
303 | set_base_from "$object"
304 | if test "$libtool" = yes; then
305 | tmpdepfile1=$dir$base.u
306 | tmpdepfile2=$base.u
307 | tmpdepfile3=$dir.libs/$base.u
308 | "$@" -Wc,-M
309 | else
310 | tmpdepfile1=$dir$base.u
311 | tmpdepfile2=$dir$base.u
312 | tmpdepfile3=$dir$base.u
313 | "$@" -M
314 | fi
315 | stat=$?
316 | if test $stat -ne 0; then
317 | rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
318 | exit $stat
319 | fi
320 |
321 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
322 | do
323 | test -f "$tmpdepfile" && break
324 | done
325 | aix_post_process_depfile
326 | ;;
327 |
328 | tcc)
329 | # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
330 | # FIXME: That version still under development at the moment of writing.
331 | # Make that this statement remains true also for stable, released
332 | # versions.
333 | # It will wrap lines (doesn't matter whether long or short) with a
334 | # trailing '\', as in:
335 | #
336 | # foo.o : \
337 | # foo.c \
338 | # foo.h \
339 | #
340 | # It will put a trailing '\' even on the last line, and will use leading
341 | # spaces rather than leading tabs (at least since its commit 0394caf7
342 | # "Emit spaces for -MD").
343 | "$@" -MD -MF "$tmpdepfile"
344 | stat=$?
345 | if test $stat -ne 0; then
346 | rm -f "$tmpdepfile"
347 | exit $stat
348 | fi
349 | rm -f "$depfile"
350 | # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
351 | # We have to change lines of the first kind to '$object: \'.
352 | sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
353 | # And for each line of the second kind, we have to emit a 'dep.h:'
354 | # dummy dependency, to avoid the deleted-header problem.
355 | sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
356 | rm -f "$tmpdepfile"
357 | ;;
358 |
359 | ## The order of this option in the case statement is important, since the
360 | ## shell code in configure will try each of these formats in the order
361 | ## listed in this file. A plain '-MD' option would be understood by many
362 | ## compilers, so we must ensure this comes after the gcc and icc options.
363 | pgcc)
364 | # Portland's C compiler understands '-MD'.
365 | # Will always output deps to 'file.d' where file is the root name of the
366 | # source file under compilation, even if file resides in a subdirectory.
367 | # The object file name does not affect the name of the '.d' file.
368 | # pgcc 10.2 will output
369 | # foo.o: sub/foo.c sub/foo.h
370 | # and will wrap long lines using '\' :
371 | # foo.o: sub/foo.c ... \
372 | # sub/foo.h ... \
373 | # ...
374 | set_dir_from "$object"
375 | # Use the source, not the object, to determine the base name, since
376 | # that's sadly what pgcc will do too.
377 | set_base_from "$source"
378 | tmpdepfile=$base.d
379 |
380 | # For projects that build the same source file twice into different object
381 | # files, the pgcc approach of using the *source* file root name can cause
382 | # problems in parallel builds. Use a locking strategy to avoid stomping on
383 | # the same $tmpdepfile.
384 | lockdir=$base.d-lock
385 | trap "
386 | echo '$0: caught signal, cleaning up...' >&2
387 | rmdir '$lockdir'
388 | exit 1
389 | " 1 2 13 15
390 | numtries=100
391 | i=$numtries
392 | while test $i -gt 0; do
393 | # mkdir is a portable test-and-set.
394 | if mkdir "$lockdir" 2>/dev/null; then
395 | # This process acquired the lock.
396 | "$@" -MD
397 | stat=$?
398 | # Release the lock.
399 | rmdir "$lockdir"
400 | break
401 | else
402 | # If the lock is being held by a different process, wait
403 | # until the winning process is done or we timeout.
404 | while test -d "$lockdir" && test $i -gt 0; do
405 | sleep 1
406 | i=`expr $i - 1`
407 | done
408 | fi
409 | i=`expr $i - 1`
410 | done
411 | trap - 1 2 13 15
412 | if test $i -le 0; then
413 | echo "$0: failed to acquire lock after $numtries attempts" >&2
414 | echo "$0: check lockdir '$lockdir'" >&2
415 | exit 1
416 | fi
417 |
418 | if test $stat -ne 0; then
419 | rm -f "$tmpdepfile"
420 | exit $stat
421 | fi
422 | rm -f "$depfile"
423 | # Each line is of the form `foo.o: dependent.h',
424 | # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
425 | # Do two passes, one to just change these to
426 | # `$object: dependent.h' and one to simply `dependent.h:'.
427 | sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
428 | # Some versions of the HPUX 10.20 sed can't process this invocation
429 | # correctly. Breaking it into two sed invocations is a workaround.
430 | sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
431 | | sed -e 's/$/ :/' >> "$depfile"
432 | rm -f "$tmpdepfile"
433 | ;;
434 |
435 | hp2)
436 | # The "hp" stanza above does not work with aCC (C++) and HP's ia64
437 | # compilers, which have integrated preprocessors. The correct option
438 | # to use with these is +Maked; it writes dependencies to a file named
439 | # 'foo.d', which lands next to the object file, wherever that
440 | # happens to be.
441 | # Much of this is similar to the tru64 case; see comments there.
442 | set_dir_from "$object"
443 | set_base_from "$object"
444 | if test "$libtool" = yes; then
445 | tmpdepfile1=$dir$base.d
446 | tmpdepfile2=$dir.libs/$base.d
447 | "$@" -Wc,+Maked
448 | else
449 | tmpdepfile1=$dir$base.d
450 | tmpdepfile2=$dir$base.d
451 | "$@" +Maked
452 | fi
453 | stat=$?
454 | if test $stat -ne 0; then
455 | rm -f "$tmpdepfile1" "$tmpdepfile2"
456 | exit $stat
457 | fi
458 |
459 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
460 | do
461 | test -f "$tmpdepfile" && break
462 | done
463 | if test -f "$tmpdepfile"; then
464 | sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
465 | # Add 'dependent.h:' lines.
466 | sed -ne '2,${
467 | s/^ *//
468 | s/ \\*$//
469 | s/$/:/
470 | p
471 | }' "$tmpdepfile" >> "$depfile"
472 | else
473 | make_dummy_depfile
474 | fi
475 | rm -f "$tmpdepfile" "$tmpdepfile2"
476 | ;;
477 |
478 | tru64)
479 | # The Tru64 compiler uses -MD to generate dependencies as a side
480 | # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
481 | # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
482 | # dependencies in 'foo.d' instead, so we check for that too.
483 | # Subdirectories are respected.
484 | set_dir_from "$object"
485 | set_base_from "$object"
486 |
487 | if test "$libtool" = yes; then
488 | # Libtool generates 2 separate objects for the 2 libraries. These
489 | # two compilations output dependencies in $dir.libs/$base.o.d and
490 | # in $dir$base.o.d. We have to check for both files, because
491 | # one of the two compilations can be disabled. We should prefer
492 | # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
493 | # automatically cleaned when .libs/ is deleted, while ignoring
494 | # the former would cause a distcleancheck panic.
495 | tmpdepfile1=$dir$base.o.d # libtool 1.5
496 | tmpdepfile2=$dir.libs/$base.o.d # Likewise.
497 | tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
498 | "$@" -Wc,-MD
499 | else
500 | tmpdepfile1=$dir$base.d
501 | tmpdepfile2=$dir$base.d
502 | tmpdepfile3=$dir$base.d
503 | "$@" -MD
504 | fi
505 |
506 | stat=$?
507 | if test $stat -ne 0; then
508 | rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
509 | exit $stat
510 | fi
511 |
512 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
513 | do
514 | test -f "$tmpdepfile" && break
515 | done
516 | # Same post-processing that is required for AIX mode.
517 | aix_post_process_depfile
518 | ;;
519 |
520 | msvc7)
521 | if test "$libtool" = yes; then
522 | showIncludes=-Wc,-showIncludes
523 | else
524 | showIncludes=-showIncludes
525 | fi
526 | "$@" $showIncludes > "$tmpdepfile"
527 | stat=$?
528 | grep -v '^Note: including file: ' "$tmpdepfile"
529 | if test $stat -ne 0; then
530 | rm -f "$tmpdepfile"
531 | exit $stat
532 | fi
533 | rm -f "$depfile"
534 | echo "$object : \\" > "$depfile"
535 | # The first sed program below extracts the file names and escapes
536 | # backslashes for cygpath. The second sed program outputs the file
537 | # name when reading, but also accumulates all include files in the
538 | # hold buffer in order to output them again at the end. This only
539 | # works with sed implementations that can handle large buffers.
540 | sed < "$tmpdepfile" -n '
541 | /^Note: including file: *\(.*\)/ {
542 | s//\1/
543 | s/\\/\\\\/g
544 | p
545 | }' | $cygpath_u | sort -u | sed -n '
546 | s/ /\\ /g
547 | s/\(.*\)/'"$tab"'\1 \\/p
548 | s/.\(.*\) \\/\1:/
549 | H
550 | $ {
551 | s/.*/'"$tab"'/
552 | G
553 | p
554 | }' >> "$depfile"
555 | echo >> "$depfile" # make sure the fragment doesn't end with a backslash
556 | rm -f "$tmpdepfile"
557 | ;;
558 |
559 | msvc7msys)
560 | # This case exists only to let depend.m4 do its work. It works by
561 | # looking at the text of this script. This case will never be run,
562 | # since it is checked for above.
563 | exit 1
564 | ;;
565 |
566 | #nosideeffect)
567 | # This comment above is used by automake to tell side-effect
568 | # dependency tracking mechanisms from slower ones.
569 |
570 | dashmstdout)
571 | # Important note: in order to support this mode, a compiler *must*
572 | # always write the preprocessed file to stdout, regardless of -o.
573 | "$@" || exit $?
574 |
575 | # Remove the call to Libtool.
576 | if test "$libtool" = yes; then
577 | while test "X$1" != 'X--mode=compile'; do
578 | shift
579 | done
580 | shift
581 | fi
582 |
583 | # Remove '-o $object'.
584 | IFS=" "
585 | for arg
586 | do
587 | case $arg in
588 | -o)
589 | shift
590 | ;;
591 | $object)
592 | shift
593 | ;;
594 | *)
595 | set fnord "$@" "$arg"
596 | shift # fnord
597 | shift # $arg
598 | ;;
599 | esac
600 | done
601 |
602 | test -z "$dashmflag" && dashmflag=-M
603 | # Require at least two characters before searching for ':'
604 | # in the target name. This is to cope with DOS-style filenames:
605 | # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
606 | "$@" $dashmflag |
607 | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
608 | rm -f "$depfile"
609 | cat < "$tmpdepfile" > "$depfile"
610 | # Some versions of the HPUX 10.20 sed can't process this sed invocation
611 | # correctly. Breaking it into two sed invocations is a workaround.
612 | tr ' ' "$nl" < "$tmpdepfile" \
613 | | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
614 | | sed -e 's/$/ :/' >> "$depfile"
615 | rm -f "$tmpdepfile"
616 | ;;
617 |
618 | dashXmstdout)
619 | # This case only exists to satisfy depend.m4. It is never actually
620 | # run, as this mode is specially recognized in the preamble.
621 | exit 1
622 | ;;
623 |
624 | makedepend)
625 | "$@" || exit $?
626 | # Remove any Libtool call
627 | if test "$libtool" = yes; then
628 | while test "X$1" != 'X--mode=compile'; do
629 | shift
630 | done
631 | shift
632 | fi
633 | # X makedepend
634 | shift
635 | cleared=no eat=no
636 | for arg
637 | do
638 | case $cleared in
639 | no)
640 | set ""; shift
641 | cleared=yes ;;
642 | esac
643 | if test $eat = yes; then
644 | eat=no
645 | continue
646 | fi
647 | case "$arg" in
648 | -D*|-I*)
649 | set fnord "$@" "$arg"; shift ;;
650 | # Strip any option that makedepend may not understand. Remove
651 | # the object too, otherwise makedepend will parse it as a source file.
652 | -arch)
653 | eat=yes ;;
654 | -*|$object)
655 | ;;
656 | *)
657 | set fnord "$@" "$arg"; shift ;;
658 | esac
659 | done
660 | obj_suffix=`echo "$object" | sed 's/^.*\././'`
661 | touch "$tmpdepfile"
662 | ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
663 | rm -f "$depfile"
664 | # makedepend may prepend the VPATH from the source file name to the object.
665 | # No need to regex-escape $object, excess matching of '.' is harmless.
666 | sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
667 | # Some versions of the HPUX 10.20 sed can't process the last invocation
668 | # correctly. Breaking it into two sed invocations is a workaround.
669 | sed '1,2d' "$tmpdepfile" \
670 | | tr ' ' "$nl" \
671 | | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
672 | | sed -e 's/$/ :/' >> "$depfile"
673 | rm -f "$tmpdepfile" "$tmpdepfile".bak
674 | ;;
675 |
676 | cpp)
677 | # Important note: in order to support this mode, a compiler *must*
678 | # always write the preprocessed file to stdout.
679 | "$@" || exit $?
680 |
681 | # Remove the call to Libtool.
682 | if test "$libtool" = yes; then
683 | while test "X$1" != 'X--mode=compile'; do
684 | shift
685 | done
686 | shift
687 | fi
688 |
689 | # Remove '-o $object'.
690 | IFS=" "
691 | for arg
692 | do
693 | case $arg in
694 | -o)
695 | shift
696 | ;;
697 | $object)
698 | shift
699 | ;;
700 | *)
701 | set fnord "$@" "$arg"
702 | shift # fnord
703 | shift # $arg
704 | ;;
705 | esac
706 | done
707 |
708 | "$@" -E \
709 | | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
710 | -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
711 | | sed '$ s: \\$::' > "$tmpdepfile"
712 | rm -f "$depfile"
713 | echo "$object : \\" > "$depfile"
714 | cat < "$tmpdepfile" >> "$depfile"
715 | sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
716 | rm -f "$tmpdepfile"
717 | ;;
718 |
719 | msvisualcpp)
720 | # Important note: in order to support this mode, a compiler *must*
721 | # always write the preprocessed file to stdout.
722 | "$@" || exit $?
723 |
724 | # Remove the call to Libtool.
725 | if test "$libtool" = yes; then
726 | while test "X$1" != 'X--mode=compile'; do
727 | shift
728 | done
729 | shift
730 | fi
731 |
732 | IFS=" "
733 | for arg
734 | do
735 | case "$arg" in
736 | -o)
737 | shift
738 | ;;
739 | $object)
740 | shift
741 | ;;
742 | "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
743 | set fnord "$@"
744 | shift
745 | shift
746 | ;;
747 | *)
748 | set fnord "$@" "$arg"
749 | shift
750 | shift
751 | ;;
752 | esac
753 | done
754 | "$@" -E 2>/dev/null |
755 | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
756 | rm -f "$depfile"
757 | echo "$object : \\" > "$depfile"
758 | sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
759 | echo "$tab" >> "$depfile"
760 | sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
761 | rm -f "$tmpdepfile"
762 | ;;
763 |
764 | msvcmsys)
765 | # This case exists only to let depend.m4 do its work. It works by
766 | # looking at the text of this script. This case will never be run,
767 | # since it is checked for above.
768 | exit 1
769 | ;;
770 |
771 | none)
772 | exec "$@"
773 | ;;
774 |
775 | *)
776 | echo "Unknown depmode $depmode" 1>&2
777 | exit 1
778 | ;;
779 | esac
780 |
781 | exit 0
782 |
783 | # Local Variables:
784 | # mode: shell-script
785 | # sh-indentation: 2
786 | # eval: (add-hook 'write-file-hooks 'time-stamp)
787 | # time-stamp-start: "scriptversion="
788 | # time-stamp-format: "%:y-%02m-%02d.%02H"
789 | # time-stamp-time-zone: "UTC"
790 | # time-stamp-end: "; # UTC"
791 | # End:
792 |
--------------------------------------------------------------------------------
/build-aux/install-sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # install - install a program, script, or datafile
3 |
4 | scriptversion=2011-11-20.07; # UTC
5 |
6 | # This originates from X11R5 (mit/util/scripts/install.sh), which was
7 | # later released in X11R6 (xc/config/util/install.sh) with the
8 | # following copyright and license.
9 | #
10 | # Copyright (C) 1994 X Consortium
11 | #
12 | # Permission is hereby granted, free of charge, to any person obtaining a copy
13 | # of this software and associated documentation files (the "Software"), to
14 | # deal in the Software without restriction, including without limitation the
15 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16 | # sell copies of the Software, and to permit persons to whom the Software is
17 | # furnished to do so, subject to the following conditions:
18 | #
19 | # The above copyright notice and this permission notice shall be included in
20 | # all copies or substantial portions of the Software.
21 | #
22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
27 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 | #
29 | # Except as contained in this notice, the name of the X Consortium shall not
30 | # be used in advertising or otherwise to promote the sale, use or other deal-
31 | # ings in this Software without prior written authorization from the X Consor-
32 | # tium.
33 | #
34 | #
35 | # FSF changes to this file are in the public domain.
36 | #
37 | # Calling this script install-sh is preferred over install.sh, to prevent
38 | # 'make' implicit rules from creating a file called install from it
39 | # when there is no Makefile.
40 | #
41 | # This script is compatible with the BSD install script, but was written
42 | # from scratch.
43 |
44 | nl='
45 | '
46 | IFS=" "" $nl"
47 |
48 | # set DOITPROG to echo to test this script
49 |
50 | # Don't use :- since 4.3BSD and earlier shells don't like it.
51 | doit=${DOITPROG-}
52 | if test -z "$doit"; then
53 | doit_exec=exec
54 | else
55 | doit_exec=$doit
56 | fi
57 |
58 | # Put in absolute file names if you don't have them in your path;
59 | # or use environment vars.
60 |
61 | chgrpprog=${CHGRPPROG-chgrp}
62 | chmodprog=${CHMODPROG-chmod}
63 | chownprog=${CHOWNPROG-chown}
64 | cmpprog=${CMPPROG-cmp}
65 | cpprog=${CPPROG-cp}
66 | mkdirprog=${MKDIRPROG-mkdir}
67 | mvprog=${MVPROG-mv}
68 | rmprog=${RMPROG-rm}
69 | stripprog=${STRIPPROG-strip}
70 |
71 | posix_glob='?'
72 | initialize_posix_glob='
73 | test "$posix_glob" != "?" || {
74 | if (set -f) 2>/dev/null; then
75 | posix_glob=
76 | else
77 | posix_glob=:
78 | fi
79 | }
80 | '
81 |
82 | posix_mkdir=
83 |
84 | # Desired mode of installed file.
85 | mode=0755
86 |
87 | chgrpcmd=
88 | chmodcmd=$chmodprog
89 | chowncmd=
90 | mvcmd=$mvprog
91 | rmcmd="$rmprog -f"
92 | stripcmd=
93 |
94 | src=
95 | dst=
96 | dir_arg=
97 | dst_arg=
98 |
99 | copy_on_change=false
100 | no_target_directory=
101 |
102 | usage="\
103 | Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
104 | or: $0 [OPTION]... SRCFILES... DIRECTORY
105 | or: $0 [OPTION]... -t DIRECTORY SRCFILES...
106 | or: $0 [OPTION]... -d DIRECTORIES...
107 |
108 | In the 1st form, copy SRCFILE to DSTFILE.
109 | In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
110 | In the 4th, create DIRECTORIES.
111 |
112 | Options:
113 | --help display this help and exit.
114 | --version display version info and exit.
115 |
116 | -c (ignored)
117 | -C install only if different (preserve the last data modification time)
118 | -d create directories instead of installing files.
119 | -g GROUP $chgrpprog installed files to GROUP.
120 | -m MODE $chmodprog installed files to MODE.
121 | -o USER $chownprog installed files to USER.
122 | -s $stripprog installed files.
123 | -t DIRECTORY install into DIRECTORY.
124 | -T report an error if DSTFILE is a directory.
125 |
126 | Environment variables override the default commands:
127 | CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
128 | RMPROG STRIPPROG
129 | "
130 |
131 | while test $# -ne 0; do
132 | case $1 in
133 | -c) ;;
134 |
135 | -C) copy_on_change=true;;
136 |
137 | -d) dir_arg=true;;
138 |
139 | -g) chgrpcmd="$chgrpprog $2"
140 | shift;;
141 |
142 | --help) echo "$usage"; exit $?;;
143 |
144 | -m) mode=$2
145 | case $mode in
146 | *' '* | *' '* | *'
147 | '* | *'*'* | *'?'* | *'['*)
148 | echo "$0: invalid mode: $mode" >&2
149 | exit 1;;
150 | esac
151 | shift;;
152 |
153 | -o) chowncmd="$chownprog $2"
154 | shift;;
155 |
156 | -s) stripcmd=$stripprog;;
157 |
158 | -t) dst_arg=$2
159 | # Protect names problematic for 'test' and other utilities.
160 | case $dst_arg in
161 | -* | [=\(\)!]) dst_arg=./$dst_arg;;
162 | esac
163 | shift;;
164 |
165 | -T) no_target_directory=true;;
166 |
167 | --version) echo "$0 $scriptversion"; exit $?;;
168 |
169 | --) shift
170 | break;;
171 |
172 | -*) echo "$0: invalid option: $1" >&2
173 | exit 1;;
174 |
175 | *) break;;
176 | esac
177 | shift
178 | done
179 |
180 | if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
181 | # When -d is used, all remaining arguments are directories to create.
182 | # When -t is used, the destination is already specified.
183 | # Otherwise, the last argument is the destination. Remove it from $@.
184 | for arg
185 | do
186 | if test -n "$dst_arg"; then
187 | # $@ is not empty: it contains at least $arg.
188 | set fnord "$@" "$dst_arg"
189 | shift # fnord
190 | fi
191 | shift # arg
192 | dst_arg=$arg
193 | # Protect names problematic for 'test' and other utilities.
194 | case $dst_arg in
195 | -* | [=\(\)!]) dst_arg=./$dst_arg;;
196 | esac
197 | done
198 | fi
199 |
200 | if test $# -eq 0; then
201 | if test -z "$dir_arg"; then
202 | echo "$0: no input file specified." >&2
203 | exit 1
204 | fi
205 | # It's OK to call 'install-sh -d' without argument.
206 | # This can happen when creating conditional directories.
207 | exit 0
208 | fi
209 |
210 | if test -z "$dir_arg"; then
211 | do_exit='(exit $ret); exit $ret'
212 | trap "ret=129; $do_exit" 1
213 | trap "ret=130; $do_exit" 2
214 | trap "ret=141; $do_exit" 13
215 | trap "ret=143; $do_exit" 15
216 |
217 | # Set umask so as not to create temps with too-generous modes.
218 | # However, 'strip' requires both read and write access to temps.
219 | case $mode in
220 | # Optimize common cases.
221 | *644) cp_umask=133;;
222 | *755) cp_umask=22;;
223 |
224 | *[0-7])
225 | if test -z "$stripcmd"; then
226 | u_plus_rw=
227 | else
228 | u_plus_rw='% 200'
229 | fi
230 | cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
231 | *)
232 | if test -z "$stripcmd"; then
233 | u_plus_rw=
234 | else
235 | u_plus_rw=,u+rw
236 | fi
237 | cp_umask=$mode$u_plus_rw;;
238 | esac
239 | fi
240 |
241 | for src
242 | do
243 | # Protect names problematic for 'test' and other utilities.
244 | case $src in
245 | -* | [=\(\)!]) src=./$src;;
246 | esac
247 |
248 | if test -n "$dir_arg"; then
249 | dst=$src
250 | dstdir=$dst
251 | test -d "$dstdir"
252 | dstdir_status=$?
253 | else
254 |
255 | # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
256 | # might cause directories to be created, which would be especially bad
257 | # if $src (and thus $dsttmp) contains '*'.
258 | if test ! -f "$src" && test ! -d "$src"; then
259 | echo "$0: $src does not exist." >&2
260 | exit 1
261 | fi
262 |
263 | if test -z "$dst_arg"; then
264 | echo "$0: no destination specified." >&2
265 | exit 1
266 | fi
267 | dst=$dst_arg
268 |
269 | # If destination is a directory, append the input filename; won't work
270 | # if double slashes aren't ignored.
271 | if test -d "$dst"; then
272 | if test -n "$no_target_directory"; then
273 | echo "$0: $dst_arg: Is a directory" >&2
274 | exit 1
275 | fi
276 | dstdir=$dst
277 | dst=$dstdir/`basename "$src"`
278 | dstdir_status=0
279 | else
280 | # Prefer dirname, but fall back on a substitute if dirname fails.
281 | dstdir=`
282 | (dirname "$dst") 2>/dev/null ||
283 | expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
284 | X"$dst" : 'X\(//\)[^/]' \| \
285 | X"$dst" : 'X\(//\)$' \| \
286 | X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
287 | echo X"$dst" |
288 | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
289 | s//\1/
290 | q
291 | }
292 | /^X\(\/\/\)[^/].*/{
293 | s//\1/
294 | q
295 | }
296 | /^X\(\/\/\)$/{
297 | s//\1/
298 | q
299 | }
300 | /^X\(\/\).*/{
301 | s//\1/
302 | q
303 | }
304 | s/.*/./; q'
305 | `
306 |
307 | test -d "$dstdir"
308 | dstdir_status=$?
309 | fi
310 | fi
311 |
312 | obsolete_mkdir_used=false
313 |
314 | if test $dstdir_status != 0; then
315 | case $posix_mkdir in
316 | '')
317 | # Create intermediate dirs using mode 755 as modified by the umask.
318 | # This is like FreeBSD 'install' as of 1997-10-28.
319 | umask=`umask`
320 | case $stripcmd.$umask in
321 | # Optimize common cases.
322 | *[2367][2367]) mkdir_umask=$umask;;
323 | .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
324 |
325 | *[0-7])
326 | mkdir_umask=`expr $umask + 22 \
327 | - $umask % 100 % 40 + $umask % 20 \
328 | - $umask % 10 % 4 + $umask % 2
329 | `;;
330 | *) mkdir_umask=$umask,go-w;;
331 | esac
332 |
333 | # With -d, create the new directory with the user-specified mode.
334 | # Otherwise, rely on $mkdir_umask.
335 | if test -n "$dir_arg"; then
336 | mkdir_mode=-m$mode
337 | else
338 | mkdir_mode=
339 | fi
340 |
341 | posix_mkdir=false
342 | case $umask in
343 | *[123567][0-7][0-7])
344 | # POSIX mkdir -p sets u+wx bits regardless of umask, which
345 | # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
346 | ;;
347 | *)
348 | tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
349 | trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
350 |
351 | if (umask $mkdir_umask &&
352 | exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
353 | then
354 | if test -z "$dir_arg" || {
355 | # Check for POSIX incompatibilities with -m.
356 | # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
357 | # other-writable bit of parent directory when it shouldn't.
358 | # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
359 | ls_ld_tmpdir=`ls -ld "$tmpdir"`
360 | case $ls_ld_tmpdir in
361 | d????-?r-*) different_mode=700;;
362 | d????-?--*) different_mode=755;;
363 | *) false;;
364 | esac &&
365 | $mkdirprog -m$different_mode -p -- "$tmpdir" && {
366 | ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
367 | test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
368 | }
369 | }
370 | then posix_mkdir=:
371 | fi
372 | rmdir "$tmpdir/d" "$tmpdir"
373 | else
374 | # Remove any dirs left behind by ancient mkdir implementations.
375 | rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
376 | fi
377 | trap '' 0;;
378 | esac;;
379 | esac
380 |
381 | if
382 | $posix_mkdir && (
383 | umask $mkdir_umask &&
384 | $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
385 | )
386 | then :
387 | else
388 |
389 | # The umask is ridiculous, or mkdir does not conform to POSIX,
390 | # or it failed possibly due to a race condition. Create the
391 | # directory the slow way, step by step, checking for races as we go.
392 |
393 | case $dstdir in
394 | /*) prefix='/';;
395 | [-=\(\)!]*) prefix='./';;
396 | *) prefix='';;
397 | esac
398 |
399 | eval "$initialize_posix_glob"
400 |
401 | oIFS=$IFS
402 | IFS=/
403 | $posix_glob set -f
404 | set fnord $dstdir
405 | shift
406 | $posix_glob set +f
407 | IFS=$oIFS
408 |
409 | prefixes=
410 |
411 | for d
412 | do
413 | test X"$d" = X && continue
414 |
415 | prefix=$prefix$d
416 | if test -d "$prefix"; then
417 | prefixes=
418 | else
419 | if $posix_mkdir; then
420 | (umask=$mkdir_umask &&
421 | $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
422 | # Don't fail if two instances are running concurrently.
423 | test -d "$prefix" || exit 1
424 | else
425 | case $prefix in
426 | *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
427 | *) qprefix=$prefix;;
428 | esac
429 | prefixes="$prefixes '$qprefix'"
430 | fi
431 | fi
432 | prefix=$prefix/
433 | done
434 |
435 | if test -n "$prefixes"; then
436 | # Don't fail if two instances are running concurrently.
437 | (umask $mkdir_umask &&
438 | eval "\$doit_exec \$mkdirprog $prefixes") ||
439 | test -d "$dstdir" || exit 1
440 | obsolete_mkdir_used=true
441 | fi
442 | fi
443 | fi
444 |
445 | if test -n "$dir_arg"; then
446 | { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
447 | { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
448 | { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
449 | test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
450 | else
451 |
452 | # Make a couple of temp file names in the proper directory.
453 | dsttmp=$dstdir/_inst.$$_
454 | rmtmp=$dstdir/_rm.$$_
455 |
456 | # Trap to clean up those temp files at exit.
457 | trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
458 |
459 | # Copy the file name to the temp name.
460 | (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
461 |
462 | # and set any options; do chmod last to preserve setuid bits.
463 | #
464 | # If any of these fail, we abort the whole thing. If we want to
465 | # ignore errors from any of these, just make sure not to ignore
466 | # errors from the above "$doit $cpprog $src $dsttmp" command.
467 | #
468 | { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
469 | { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
470 | { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
471 | { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
472 |
473 | # If -C, don't bother to copy if it wouldn't change the file.
474 | if $copy_on_change &&
475 | old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
476 | new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
477 |
478 | eval "$initialize_posix_glob" &&
479 | $posix_glob set -f &&
480 | set X $old && old=:$2:$4:$5:$6 &&
481 | set X $new && new=:$2:$4:$5:$6 &&
482 | $posix_glob set +f &&
483 |
484 | test "$old" = "$new" &&
485 | $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
486 | then
487 | rm -f "$dsttmp"
488 | else
489 | # Rename the file to the real destination.
490 | $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
491 |
492 | # The rename failed, perhaps because mv can't rename something else
493 | # to itself, or perhaps because mv is so ancient that it does not
494 | # support -f.
495 | {
496 | # Now remove or move aside any old file at destination location.
497 | # We try this two ways since rm can't unlink itself on some
498 | # systems and the destination file might be busy for other
499 | # reasons. In this case, the final cleanup might fail but the new
500 | # file should still install successfully.
501 | {
502 | test ! -f "$dst" ||
503 | $doit $rmcmd -f "$dst" 2>/dev/null ||
504 | { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
505 | { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
506 | } ||
507 | { echo "$0: cannot unlink or rename $dst" >&2
508 | (exit 1); exit 1
509 | }
510 | } &&
511 |
512 | # Now rename the file to the real destination.
513 | $doit $mvcmd "$dsttmp" "$dst"
514 | }
515 | fi || exit 1
516 |
517 | trap '' 0
518 | fi
519 | done
520 |
521 | # Local variables:
522 | # eval: (add-hook 'write-file-hooks 'time-stamp)
523 | # time-stamp-start: "scriptversion="
524 | # time-stamp-format: "%:y-%02m-%02d.%02H"
525 | # time-stamp-time-zone: "UTC"
526 | # time-stamp-end: "; # UTC"
527 | # End:
528 |
--------------------------------------------------------------------------------
/build-aux/missing:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # Common wrapper for a few potentially missing GNU programs.
3 |
4 | scriptversion=2012-06-26.16; # UTC
5 |
6 | # Copyright (C) 1996-2013 Free Software Foundation, Inc.
7 | # Originally written by Fran,cois Pinard , 1996.
8 |
9 | # This program is free software; you can redistribute it and/or modify
10 | # it under the terms of the GNU General Public License as published by
11 | # the Free Software Foundation; either version 2, or (at your option)
12 | # any later version.
13 |
14 | # This program is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 |
19 | # You should have received a copy of the GNU General Public License
20 | # along with this program. If not, see .
21 |
22 | # As a special exception to the GNU General Public License, if you
23 | # distribute this file as part of a program that contains a
24 | # configuration script generated by Autoconf, you may include it under
25 | # the same distribution terms that you use for the rest of that program.
26 |
27 | if test $# -eq 0; then
28 | echo 1>&2 "Try '$0 --help' for more information"
29 | exit 1
30 | fi
31 |
32 | case $1 in
33 |
34 | --is-lightweight)
35 | # Used by our autoconf macros to check whether the available missing
36 | # script is modern enough.
37 | exit 0
38 | ;;
39 |
40 | --run)
41 | # Back-compat with the calling convention used by older automake.
42 | shift
43 | ;;
44 |
45 | -h|--h|--he|--hel|--help)
46 | echo "\
47 | $0 [OPTION]... PROGRAM [ARGUMENT]...
48 |
49 | Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
50 | to PROGRAM being missing or too old.
51 |
52 | Options:
53 | -h, --help display this help and exit
54 | -v, --version output version information and exit
55 |
56 | Supported PROGRAM values:
57 | aclocal autoconf autoheader autom4te automake makeinfo
58 | bison yacc flex lex help2man
59 |
60 | Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
61 | 'g' are ignored when checking the name.
62 |
63 | Send bug reports to ."
64 | exit $?
65 | ;;
66 |
67 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
68 | echo "missing $scriptversion (GNU Automake)"
69 | exit $?
70 | ;;
71 |
72 | -*)
73 | echo 1>&2 "$0: unknown '$1' option"
74 | echo 1>&2 "Try '$0 --help' for more information"
75 | exit 1
76 | ;;
77 |
78 | esac
79 |
80 | # Run the given program, remember its exit status.
81 | "$@"; st=$?
82 |
83 | # If it succeeded, we are done.
84 | test $st -eq 0 && exit 0
85 |
86 | # Also exit now if we it failed (or wasn't found), and '--version' was
87 | # passed; such an option is passed most likely to detect whether the
88 | # program is present and works.
89 | case $2 in --version|--help) exit $st;; esac
90 |
91 | # Exit code 63 means version mismatch. This often happens when the user
92 | # tries to use an ancient version of a tool on a file that requires a
93 | # minimum version.
94 | if test $st -eq 63; then
95 | msg="probably too old"
96 | elif test $st -eq 127; then
97 | # Program was missing.
98 | msg="missing on your system"
99 | else
100 | # Program was found and executed, but failed. Give up.
101 | exit $st
102 | fi
103 |
104 | perl_URL=http://www.perl.org/
105 | flex_URL=http://flex.sourceforge.net/
106 | gnu_software_URL=http://www.gnu.org/software
107 |
108 | program_details ()
109 | {
110 | case $1 in
111 | aclocal|automake)
112 | echo "The '$1' program is part of the GNU Automake package:"
113 | echo "<$gnu_software_URL/automake>"
114 | echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
115 | echo "<$gnu_software_URL/autoconf>"
116 | echo "<$gnu_software_URL/m4/>"
117 | echo "<$perl_URL>"
118 | ;;
119 | autoconf|autom4te|autoheader)
120 | echo "The '$1' program is part of the GNU Autoconf package:"
121 | echo "<$gnu_software_URL/autoconf/>"
122 | echo "It also requires GNU m4 and Perl in order to run:"
123 | echo "<$gnu_software_URL/m4/>"
124 | echo "<$perl_URL>"
125 | ;;
126 | esac
127 | }
128 |
129 | give_advice ()
130 | {
131 | # Normalize program name to check for.
132 | normalized_program=`echo "$1" | sed '
133 | s/^gnu-//; t
134 | s/^gnu//; t
135 | s/^g//; t'`
136 |
137 | printf '%s\n' "'$1' is $msg."
138 |
139 | configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
140 | case $normalized_program in
141 | autoconf*)
142 | echo "You should only need it if you modified 'configure.ac',"
143 | echo "or m4 files included by it."
144 | program_details 'autoconf'
145 | ;;
146 | autoheader*)
147 | echo "You should only need it if you modified 'acconfig.h' or"
148 | echo "$configure_deps."
149 | program_details 'autoheader'
150 | ;;
151 | automake*)
152 | echo "You should only need it if you modified 'Makefile.am' or"
153 | echo "$configure_deps."
154 | program_details 'automake'
155 | ;;
156 | aclocal*)
157 | echo "You should only need it if you modified 'acinclude.m4' or"
158 | echo "$configure_deps."
159 | program_details 'aclocal'
160 | ;;
161 | autom4te*)
162 | echo "You might have modified some maintainer files that require"
163 | echo "the 'automa4te' program to be rebuilt."
164 | program_details 'autom4te'
165 | ;;
166 | bison*|yacc*)
167 | echo "You should only need it if you modified a '.y' file."
168 | echo "You may want to install the GNU Bison package:"
169 | echo "<$gnu_software_URL/bison/>"
170 | ;;
171 | lex*|flex*)
172 | echo "You should only need it if you modified a '.l' file."
173 | echo "You may want to install the Fast Lexical Analyzer package:"
174 | echo "<$flex_URL>"
175 | ;;
176 | help2man*)
177 | echo "You should only need it if you modified a dependency" \
178 | "of a man page."
179 | echo "You may want to install the GNU Help2man package:"
180 | echo "<$gnu_software_URL/help2man/>"
181 | ;;
182 | makeinfo*)
183 | echo "You should only need it if you modified a '.texi' file, or"
184 | echo "any other file indirectly affecting the aspect of the manual."
185 | echo "You might want to install the Texinfo package:"
186 | echo "<$gnu_software_URL/texinfo/>"
187 | echo "The spurious makeinfo call might also be the consequence of"
188 | echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
189 | echo "want to install GNU make:"
190 | echo "<$gnu_software_URL/make/>"
191 | ;;
192 | *)
193 | echo "You might have modified some files without having the proper"
194 | echo "tools for further handling them. Check the 'README' file, it"
195 | echo "often tells you about the needed prerequisites for installing"
196 | echo "this package. You may also peek at any GNU archive site, in"
197 | echo "case some other package contains this missing '$1' program."
198 | ;;
199 | esac
200 | }
201 |
202 | give_advice "$1" | sed -e '1s/^/WARNING: /' \
203 | -e '2,$s/^/ /' >&2
204 |
205 | # Propagate the correct exit status (expected to be 127 for a program
206 | # not found, 63 for a program that failed due to version mismatch).
207 | exit $st
208 |
209 | # Local variables:
210 | # eval: (add-hook 'write-file-hooks 'time-stamp)
211 | # time-stamp-start: "scriptversion="
212 | # time-stamp-format: "%:y-%02m-%02d.%02H"
213 | # time-stamp-time-zone: "UTC"
214 | # time-stamp-end: "; # UTC"
215 | # End:
216 |
--------------------------------------------------------------------------------
/configure.ac:
--------------------------------------------------------------------------------
1 | # Prelude.
2 | AC_PREREQ([2.69])
3 | AC_CONFIG_AUX_DIR([build-aux])
4 | AC_CONFIG_SRCDIR([src/vbrute.c])
5 | AC_INIT([project-main], [0.1], [aidan.marlin+github@gmail.com])
6 | AM_INIT_AUTOMAKE([foreign -Wall -Werror])
7 | #PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
8 | PKG_CHECK_MODULES([LIBEVENT], [libevent >= 2.0])
9 | # Checks for programs.
10 | AC_PROG_CC
11 | AM_PROG_CC_C_O
12 | # Checks for libraries.
13 | #AC_CHECK_LIB([efence],[malloc],,AC_MSG_ERROR([Could not find malloc in efence lib]))
14 | # Checks for header files.
15 | # Checks for typedefs, structures, and compiler characteristics.
16 | # Checks for library functions.
17 | # Output files.
18 | AC_CONFIG_HEADERS([config.h])
19 | AC_CONFIG_FILES([Makefile src/Makefile])
20 | AC_OUTPUT
21 |
--------------------------------------------------------------------------------
/dist/DIST_TAR_HERE:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/vbrute/11dda8bde18f42b864a0a5533d2352debf06c85e/dist/DIST_TAR_HERE
--------------------------------------------------------------------------------
/src/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_LDFLAGS = -levent -Wall
2 |
3 | bin_PROGRAMS = vbrute
4 | vbrute_SOURCES = vbrute.c
5 |
--------------------------------------------------------------------------------
/src/vbrute.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include /* hostent */
5 | #include
6 | #include
7 | #include
8 |
9 | #define DEF_SIZE_DOMAIN 128
10 | #define DEF_SIZE_FILENAME 128
11 |
12 | #include "../src/vbrute.h"
13 |
14 | int argDebug, argTimeout = 5;
15 | char argDomainFile[DEF_SIZE_FILENAME], argIPFile[DEF_SIZE_FILENAME];
16 |
17 | int debugPrintf(char msg[1024], ...)
18 | {
19 | if (argDebug == 1)
20 | {
21 | va_list args;
22 | va_start(args, msg);
23 |
24 | vprintf(msg, args);
25 |
26 | va_end(args);
27 | }
28 |
29 | return 0;
30 | }
31 |
32 | int printResult(struct evhttp_request *req, Items *items)
33 | {
34 | /* domain, ip, response code, lengeth */
35 | printf("%-24.24s %-16.16s %-10u %-10.10s\n",items->domain[items->domainPtr],items->ip[items->ipPtr],req->response_code,evhttp_find_header(req->input_headers, "Content-Length"));
36 | }
37 |
38 | void reqhandler(struct evhttp_request *req, void *vItems)
39 | {
40 | /* Typecast */
41 | Items *items = (Items *) vItems;
42 |
43 | items->conn_finished = 1;
44 |
45 | if (req == NULL) {
46 | debugPrintf("timed out!\n");
47 | } else if (req->response_code == 0) {
48 | debugPrintf("connection refused!\n");
49 | } else {
50 | debugPrintf("success: %u %s\n", req->response_code, req->response_code_line);
51 | debugPrintf("var == %s\n", evhttp_find_header(req->input_headers, "Content-Length"));
52 | printResult(req,items);
53 | }
54 | event_loopexit(NULL);
55 | }
56 |
57 | void process_timeout(int fd, short event, void *vItems)
58 | {
59 | Items *items = (Items *) vItems;
60 | printf("%-24.24s %-16.16s *** Timed out ***\n",items->domain[items->domainPtr],items->ip[items->ipPtr]);
61 |
62 | if (items->conn_finished == 0) {
63 | evhttp_cancel_request(items->req);
64 | }
65 | }
66 |
67 | int doHTTPRequest(Items *items)
68 | {
69 | struct event ev;
70 | unsigned int port = 80;
71 |
72 | items->conn_finished = 0;
73 |
74 | debugPrintf("initializing libevent subsystem..\n");
75 | event_init();
76 |
77 | items->conn = evhttp_connection_new(items->ip[items->ipPtr], port);
78 | /* If user sets timeout > than this then the user will not know the site timed out ... */
79 | evhttp_connection_set_timeout(items->conn, 120);
80 |
81 | items->req = evhttp_request_new(reqhandler, items);
82 | evhttp_add_header(items->req->output_headers, "Host", items->domain[items->domainPtr]);
83 | evhttp_add_header(items->req->output_headers, "Content-Length", "0");
84 | evhttp_make_request(items->conn, items->req, EVHTTP_REQ_GET, "/");
85 |
86 | evtimer_set(&ev, process_timeout, (void*) items);
87 | evtimer_add(&ev, &items->config->tv);
88 |
89 | event_dispatch();
90 |
91 | return 0;
92 | }
93 |
94 | /*
95 | 1. Read in IP list and domain file
96 | 2. Visit each domain using IP list
97 | 3. Record response length and code for diff
98 |
99 | Need HTTPS support
100 | */
101 |
102 | char readFile(char *fileName, char itemArray[ITEMS_MAX][ITEM_LENGTH_MAX])
103 | {
104 | FILE *file;
105 | int c;
106 |
107 | if (!(file = fopen(fileName, "r")))
108 | {
109 | /* TODO Error function */
110 | printf("Could not open file\n");
111 | exit(1);
112 | }
113 |
114 | while(fgets(itemArray[c++],sizeof(itemArray[ITEMS_MAX]),file))
115 | {
116 | itemArray[c-1][strnlen(itemArray[c-1],ITEM_LENGTH_MAX)-1] = '\0';
117 | debugPrintf("readFile itemArray[c] == %s\n", itemArray[c-1]);
118 | }
119 |
120 | fclose(file);
121 |
122 | /* Array size */
123 | return c-1;
124 | }
125 |
126 | int showHelp()
127 | {
128 | printf("vbrute --domain-file --ip-file \n\n");
129 | printf("-d, --domain-file Specify file containing a list of domains you want to test\n");
130 | printf("-i, --ip-file Specify file containing a list of IP addresses you want to test\n");
131 | printf("-t, --timeout Specify request timeout. Default is 5 seconds\n");
132 |
133 | exit(1);
134 | }
135 |
136 | int assignArgs(int argc, char **argv)
137 | {
138 | /* Flag set by '--verbose'. */
139 | static int argVerboseFlag;
140 |
141 | int c;
142 |
143 | while (1)
144 | {
145 | static struct option long_options[] =
146 | {
147 | /* These options set a flag. */
148 | {"verbose", no_argument, &argVerboseFlag, 1},
149 | {"debug", no_argument, &argDebug, 1},
150 | //{"brief", no_argument, &argVerboseFlag, 0},
151 | /* These options don't set a flag.
152 | We distinguish them by their indices. */
153 | {"timeout", required_argument, 0, 't'},
154 | {"domain-file", required_argument, 0, 'd'},
155 | {"ip-file", required_argument, 0, 'i'},
156 | {0, 0, 0, 0}
157 | };
158 |
159 | /* getopt_long stores the option index here. */
160 | int option_index = 0;
161 |
162 | c = getopt_long(argc, argv, "t:d:i:", long_options, &option_index);
163 |
164 | debugPrintf("assignArgs argc == %d\n", argc);
165 |
166 | /* domain is only required argument (ip can be determined via domain) */
167 | if (argc == 1)
168 | {
169 | /* Only binary called */
170 | showHelp();
171 | }
172 |
173 | /* Detect the end of the options. */
174 | if (c == -1)
175 | break;
176 |
177 | switch (c)
178 | {
179 | case 0:
180 | /* If this option set a flag, do nothing else now. */
181 | if (long_options[option_index].flag != 0)
182 | break;
183 |
184 | debugPrintf("option %s", long_options[option_index].name);
185 | if (optarg)
186 | debugPrintf(" with arg %s", optarg);
187 | debugPrintf("\n");
188 | break;
189 |
190 | case 't':
191 | debugPrintf("option -t with value `%s'\n", optarg);
192 | /* Str to int TODO */
193 | char *endptr;
194 | argTimeout = strtol(optarg,&endptr,10);
195 | break;
196 |
197 | case 'd':
198 | debugPrintf("option -d with value `%s'\n", optarg);
199 | strncpy(argDomainFile, optarg, DEF_SIZE_FILENAME);
200 | break;
201 |
202 | case 'i':
203 | debugPrintf("option -i with value `%s'\n", optarg);
204 | strncpy(argIPFile, optarg, DEF_SIZE_FILENAME);
205 | break;
206 |
207 | case '?':
208 | /* getopt_long already printed an error message. */
209 | break;
210 |
211 | default:
212 | debugPrintf("assignArgs abort to be called\n");
213 | abort();
214 | }
215 | }
216 |
217 | /* Instead of reporting '--verbose'
218 | and '--brief' as they are encountered,
219 | we report the final status resulting from them. */
220 | if (argVerboseFlag)
221 | puts ("verbose flag is set");
222 |
223 | /* Print any remaining command line arguments (not options). */
224 | if (optind < argc)
225 | {
226 | debugPrintf ("non-option ARGV-elements: ");
227 | while (optind < argc)
228 | debugPrintf ("%s ", argv[optind++]);
229 | putchar ('\n');
230 | }
231 |
232 | /* Required arguments */
233 | if (argDomainFile[0] == '\0' || argIPFile[0] == '\0')
234 | {
235 | /* Only binary called */
236 | showHelp();
237 | }
238 |
239 | return 0;
240 | }
241 |
242 | int main(int argc, char **argv)
243 | {
244 | Items items;
245 | Config config;
246 |
247 | argDomainFile[0] = '\0';
248 | argIPFile[0] = '\0';
249 |
250 | assignArgs(argc,argv);
251 |
252 | items.config = &config;
253 |
254 | items.config->tv.tv_sec = argTimeout;
255 | items.config->tv.tv_usec = argTimeout * 1000;
256 |
257 | char domainFile[ITEM_LENGTH_MAX], ipFile[ITEM_LENGTH_MAX];
258 | int i, j, domainArraySize, ipArraySize;
259 |
260 | /* domain is 2d array */
261 | domainArraySize = readFile(argDomainFile,items.domain);
262 | /* ip is 2d array */
263 | ipArraySize = readFile(argIPFile,items.ip);
264 |
265 | printf("vbrute v0.1 by Aidan Marlin\n");
266 |
267 | /* for ips in file */
268 | for(items.ipPtr=0;items.ipPtr