pax_global_header00006660000000000000000000000064151140422220014503gustar00rootroot0000000000000052 comment=e23fc0edb0ce3c0b4ca751adc187ee3a7270ef80 Obsidian-Covenant-bfbtester-e23fc0e/000077500000000000000000000000001511404222200174555ustar00rootroot00000000000000Obsidian-Covenant-bfbtester-e23fc0e/.gitignore000066400000000000000000000013571511404222200214530ustar00rootroot00000000000000# Prerequisites *.d # Object files *.o *.ko *.obj *.elf # Linker output *.ilk *.map *.exp # Precompiled Headers *.gch *.pch # Libraries *.lib *.a *.la *.lo # Shared objects (inc. Windows DLLs) *.dll *.so *.so.* *.dylib # Executables *.exe *.out *.app *.i*86 *.x86_64 *.hex # Debug files *.dSYM/ *.su *.idb *.pdb # Kernel Module Compile Results *.mod* *.cmd .tmp_versions/ modules.order Module.symvers Mkfile.old dkms.conf # debug information files *.dwo # Temp Files *cache src/bfbt/bfbtester src/config.h.in src/Makefile src/Makefile.in src/stamp-h.in src/bfbt/Makefile src/bfbt/Makefile.in aclocal.m4 compile config.guess config.h config.h.ini config.log config.status config.sub configure install-sh Makefile Makefile.in missing stamp-h1Obsidian-Covenant-bfbtester-e23fc0e/AUTHORS000066400000000000000000000004741511404222200205320ustar00rootroot00000000000000BFBTester: Brute Force Binary Tester Mike Heffner http://bfbtester.sourceforge.net AUTHOR - Mike Heffner - original developer and creator of BFBTester CONTRIBUTORS: - Bill Marquette - Solaris and OpenBSD testing/patches and other patch contributionsObsidian-Covenant-bfbtester-e23fc0e/COPYING000066400000000000000000000613111511404222200205120ustar00rootroot00000000000000 GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA. Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! Obsidian-Covenant-bfbtester-e23fc0e/INSTALL000066400000000000000000000411671511404222200205170ustar00rootroot00000000000000Installation Instructions ************************* Basic Installation ================== The following shell commands: test -f configure || ./bootstrap ./configure make make install should configure, build, and install this package. The first line, which bootstraps, is intended for developers; when building from distribution tarballs it does nothing and can be skipped. A package might name the bootstrapping script differently; if the name is ‘autogen.sh’, for example, the first line should say ‘./autogen.sh’ instead of ‘./bootstrap’. The following more-detailed instructions are generic; see the ‘README’ file for instructions specific to this package. Some packages provide this ‘INSTALL’ file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in the GNU Coding Standards. Many packages have scripts meant for developers instead of ordinary builders, as they may use developer tools that are less commonly installed, or they may access the network, which has privacy implications. These scripts attempt to bootstrap by building the ‘configure’ script and related files, possibly using developer tools or the network. Because the output of bootstrapping is system-independent, it is normally run by a package developer so that its output can be put into the distribution tarball and ordinary builders and users need not bootstrap. Some packages have commands like ‘./autopull.sh’ and ‘./autogen.sh’ that you can run instead of ‘./bootstrap’, for more fine-grained control over bootstrapping. The ‘configure’ script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a ‘Makefile’ in each directory of the package. It may also create one or more ‘.h’ files containing system-dependent definitions. Finally, it creates a script ‘config.status’ that you can run in the future to recreate the current configuration, and a file ‘config.log’ containing output useful for debugging ‘configure’. It can also use an optional file (typically called ‘config.cache’ and enabled with ‘--cache-file=config.cache’ or simply ‘-C’) that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how ‘configure’ could check whether to do them, and mail diffs or instructions to the address given in the ‘README’ so they can be considered for the next release. If you are using the cache, and at some point ‘config.cache’ contains results you don’t want to keep, you may remove or edit it. The ‘autoconf’ program generates ‘configure’ from the file ‘configure.ac’. Normally you should edit ‘configure.ac’ instead of editing ‘configure’ directly. The simplest way to compile this package is: 1. ‘cd’ to the directory containing the package’s source code. 2. If this is a developer checkout and file ‘configure’ does not yet exist, run the bootstrapping script (typically ‘./bootstrap’ or ‘./autogen.sh’) to bootstrap and create the file. You may need special developer tools and network access to bootstrap, and the network access may have privacy implications. 3. Type ‘./configure’ to configure the package for your system. This might take a while. While running, ‘configure’ prints messages telling which features it is checking for. 4. Type ‘make’ to compile the package. 5. Optionally, type ‘make check’ to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 6. Type ‘make install’ to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the ‘make install’ phase executed with root privileges. 7. Optionally, type ‘make installcheck’ to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior ‘make install’ required root privileges, verifies that the installation completed correctly. 8. You can remove the program binaries and object files from the source code directory by typing ‘make clean’. To also remove the files that ‘configure’ created (so you can compile the package for a different kind of computer), type ‘make distclean’. There is also a ‘make maintainer-clean’ target, but that is intended mainly for the package’s developers. If you use it, you may have to bootstrap again. 9. If the package follows the GNU Coding Standards, you can type ‘make uninstall’ to remove the installed files. Installation Prerequisites ========================== Installation requires a POSIX-like environment with a shell and at least the following standard utilities: awk cat cp diff echo expr false ls mkdir mv printf pwd rm rmdir sed sort test tr This package’s installation may need other standard utilities such as ‘grep’, ‘make’, ‘sleep’ and ‘touch’, along with compilers like ‘gcc’. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the ‘configure’ script does not know about. Run ‘./configure --help’ for details on some of the pertinent environment variables. You can give ‘configure’ initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=gcc CFLAGS=-g LIBS=-lposix See “Defining Variables” for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each system in their own directory. To do this, you can use GNU ‘make’. ‘cd’ to the directory where you want the object files and executables to go and run the ‘configure’ script. ‘configure’ automatically checks for the source code in the directory that ‘configure’ is in and in ‘..’. This is known as a “VPATH” build. With a non-GNU ‘make’, it is safer to compile the package for one system at a time in the source code directory. After you have installed the package for one system, use ‘make distclean’ before reconfiguring for another system. Some platforms, notably macOS, support “fat” or “universal” binaries, where a single binary can execute on different architectures. On these platforms you can configure and compile just once, with options specific to that platform. Installation Names ================== By default, ‘make install’ installs the package’s commands under ‘/usr/local/bin’, include files under ‘/usr/local/include’, etc. You can specify an installation prefix other than ‘/usr/local’ by giving ‘configure’ the option ‘--prefix=PREFIX’, where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option ‘--exec-prefix=PREFIX’ to ‘configure’, the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like ‘--bindir=DIR’ to specify different values for particular kinds of files. Run ‘configure --help’ for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of ‘${prefix}’, so that specifying just ‘--prefix’ will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to ‘configure’; however, many packages provide one or both of the following shortcuts of passing variable assignments to the ‘make install’ command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, ‘make install prefix=/alternate/directory’ will choose an alternate location for all directory configuration variables that were expressed in terms of ‘${prefix}’. Any directories that were specified during ‘configure’, but not in terms of ‘${prefix}’, must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the ‘DESTDIR’ variable. For example, ‘make install DESTDIR=/alternate/directory’ will prepend ‘/alternate/directory’ before all installation names. The approach of ‘DESTDIR’ overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of ‘${prefix}’ at ‘configure’ time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving ‘configure’ the option ‘--program-prefix=PREFIX’ or ‘--program-suffix=SUFFIX’. Some packages pay attention to ‘--enable-FEATURE’ and ‘--disable-FEATURE’ options to ‘configure’, where FEATURE indicates an optional part of the package. They may also pay attention to ‘--with-PACKAGE’ and ‘--without-PACKAGE’ options, where PACKAGE is something like ‘gnu-ld’. ‘./configure --help’ should mention the ‘--enable-...’ and ‘--with-...’ options that the package recognizes. Some packages offer the ability to configure how verbose the execution of ‘make’ will be. For these packages, running ‘./configure --enable-silent-rules’ sets the default to minimal output, which can be overridden with ‘make V=1’; while running ‘./configure --disable-silent-rules’ sets the default to verbose, which can be overridden with ‘make V=0’. Specifying a System Type ======================== By default ‘configure’ builds for the current system. To create binaries that can run on a different system type, specify a ‘--host=TYPE’ option along with compiler variables that specify how to generate object code for TYPE. For example, to create binaries intended to run on a 64-bit ARM processor: ./configure --host=aarch64-linux-gnu \ CC=aarch64-linux-gnu-gcc \ CXX=aarch64-linux-gnu-g++ If done on a machine that can execute these binaries (e.g., via ‘qemu-aarch64’, ‘$QEMU_LD_PREFIX’, and Linux’s ‘binfmt_misc’ capability), the build behaves like a native build. Otherwise it is a cross-build: ‘configure’ will make cross-compilation guesses instead of running test programs, and ‘make check’ will not work. A system type can either be a short name like ‘mingw64’, or a canonical name like ‘x86_64-pc-linux-gnu’. Canonical names have the form CPU-COMPANY-SYSTEM where SYSTEM is either OS or KERNEL-OS. To canonicalize and validate a system type, you can run the command ‘config.sub’, which is often squirreled away in a subdirectory like ‘build-aux’. For example: $ build-aux/config.sub arm64-linux aarch64-unknown-linux-gnu $ build-aux/config.sub riscv-lnx Invalid configuration 'riscv-lnx': OS 'lnx' not recognized You can look at the ‘config.sub’ file to see which types are recognized. If the file is absent, this package does not need the system type. If ‘configure’ fails with the diagnostic “cannot guess build type”. ‘config.sub’ did not recognize your system’s type. In this case, first fetch the newest versions of these files from the GNU config package (https://savannah.gnu.org/projects/config). If that fixes things, please report it to the maintainers of the package containing ‘configure’. Otherwise, you can try the configure option ‘--build=TYPE’ where TYPE comes close to your system type; also, please report the problem to . For more details about configuring system types, see the Autoconf documentation. Sharing Defaults ================ If you want to set default values for ‘configure’ scripts to share, you can create a site shell script called ‘config.site’ that gives default values for variables like ‘CC’, ‘cache_file’, and ‘prefix’. ‘configure’ looks for ‘PREFIX/share/config.site’ if it exists, then ‘PREFIX/etc/config.site’ if it exists. Or, you can set the ‘CONFIG_SITE’ environment variable to the location of the site script. A warning: not all ‘configure’ scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to ‘configure’. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the ‘configure’ command line, using ‘VAR=value’. For example: ./configure CC=/usr/local2/bin/gcc causes the specified ‘gcc’ to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for ‘CONFIG_SHELL’ due to an Autoconf limitation. Until the limitation is lifted, you can use this workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash ‘configure’ Invocation ====================== ‘configure’ recognizes the following options to control how it operates. ‘--help’ ‘-h’ Print a summary of all of the options to ‘configure’, and exit. ‘--help=short’ ‘--help=recursive’ Print a summary of the options unique to this package’s ‘configure’, and exit. The ‘short’ variant lists options used only in the top level, while the ‘recursive’ variant lists options also present in any nested packages. ‘--version’ ‘-V’ Print the version of Autoconf used to generate the ‘configure’ script, and exit. ‘--cache-file=FILE’ Enable the cache: use and save the results of the tests in FILE, traditionally ‘config.cache’. FILE defaults to ‘/dev/null’ to disable caching. ‘--config-cache’ ‘-C’ Alias for ‘--cache-file=config.cache’. ‘--srcdir=DIR’ Look for the package’s source code in directory DIR. Usually ‘configure’ can determine that directory automatically. ‘--prefix=DIR’ Use DIR as the installation prefix. See “Installation Names” for more details, including other options available for fine-tuning the installation locations. ‘--host=TYPE’ Build binaries for system TYPE. See “Specifying a System Type”. ‘--enable-FEATURE’ ‘--disable-FEATURE’ Enable or disable the optional FEATURE. See “Optional Features”. ‘--with-PACKAGE’ ‘--without-PACKAGE’ Use or omit PACKAGE when building. See “Optional Features”. ‘--quiet’ ‘--silent’ ‘-q’ Do not print messages saying which checks are being made. To suppress all normal output, redirect it to ‘/dev/null’ (any error messages will still be shown). ‘--no-create’ ‘-n’ Run the configure checks, but stop before creating any output files. ‘configure’ also recognizes several environment variables, and accepts some other, less widely useful, options. Run ‘configure --help’ for more details. Copyright notice ================ Copyright © 1994–1996, 1999–2002, 2004–2017, 2020–2025 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Obsidian-Covenant-bfbtester-e23fc0e/Makefile.am000066400000000000000000000000521511404222200215060ustar00rootroot00000000000000EXTRA_DIST = README COPYING SUBDIRS = src Obsidian-Covenant-bfbtester-e23fc0e/README.md000066400000000000000000000106521511404222200207400ustar00rootroot00000000000000# bfbtester ## Modernization Covenant This is a refactored and modernized edition of [bfbtester](https://sourceforge.net/projects/bfbtester/), a tool to perform checks of single and multiple argument command line overflows and environment variable overflows. Key changes: - ✅ Fixed errors caused by old libraries - ✅ Fixed warnings caused by old-style coding - ✅ Cleaned autoreconf rules - ✅ Refactored code to be used with latest gcc version ### Installation #### Dependencies Build dependencies: ``` gcc ``` #### From source ```bash git clone https://github.com/Obsidian-Covenant/bfbtester.git cd bfbtester autoreconf -i ./configure make sudo make install ``` ## README README for BFBTester 2.0-BETA Copyright 2000 Mike Heffner http://bfbtester.sourceforge.net -> I N T R O <- BFBTester is great for doing quick, proactive, security checks of binary programs. BFBTester will perform checks of single and multiple argument command line overflows and environment variable overflows. Versions 2.0-BETA and higher can also watch for tempfile creation activity to alert the user of any programs using unsafe tempfile names. While BFBTester can not test all overflows in software, it is useful for detecting initial mistakes that can red flag dangerous software. -> U S A G E <- The basic syntax for running BFBTester is: bfbtester [-htv] [-d level ] [-r rejects] [-o out-file] [-x max-execs] -asme file [file2 file3 ...] Must specify one or more of the following tests: -s Single Argument Test -m Multiple Argument Test -e Environment Variable Test -a Selects all tests Options: -h Print this message -t Enable tempfile monitoring -v Print version string -d level Set debug level (default = 0, max = 2) -r rejects Comma separated list of binaries to skip -o out-file Output to out-file rather than stdout -x max-execs Set maximum executables to run in parallel (default = 250) file Specific binary or a directory of binaries to test You must specify at least one test to run and you must specify either a binary or a directory. Executable selection is now done in one of several ways: If the executable filename is specified with a leading slash (an absolute path), no selection is used and the supplied absolute filename is used. If there is no leading slash in the filename the selection is made in one of two ways (in this order): 1) Prepend file name with $PWD and test accesiblity 2) Search through $PATH and find first accessible executable The first one to succeed is the executable choosen. If the filename found is a directory, we walk the directory (one level deep) looking for executable binaries. Symbolic links are followed. You can specify binaries to skip (useful when loading a whole directory) by using the -r option. Examples: bfbtester -s /usr/bin Run the single argument test on all binaries in folder /usr/bin. bfbtester -ta patch traceroute Run all tests against patch and traceroute and run the tempfile monitor. bfbtester -a ./bfbtester Tests bfbtester (provided it's in the same directory). Hope it works :) bfbtester -r kill /usr/bin/kill Does nothing. -> N O T E S <- The following is a crash report: *** Crash *** args: -D [05120] envs: (null) Signal: 11 ( Segmentation fault ) Core? Yes This means "/usr/bin/patch" crashed when fed with an "-D" and a word 5,120 characters long: $ /usr/bin/patch -D AAA...5,120 characters...AAA (Numbers in brackets mean replace with a word that many characters long) ALSO: BFBTester is very CPU intensive, and will open many files, so you probably don't want to run it on a production machine during it's busiest period. Just a warning... -> K N O W N B U G S <- [6/04/2000] - Been known to blow up on OpenBSD (pthread related). Workaround is to define LINUX in src/config.h. -> T O D O <- -> T H A N K S <- To... o Thomas Stromberg for developing SmashWidgets, from where I got the idea for BFBTester o Compaq for their great TestDrive servers at: http://www.testdrive.compaq.com/ o David Wheeler for suggesting I should put together some type of license and for listing BFBTester in the "Secure Programming for Linux and Unix HOWTO" available at: http://www.dwheeler.com/secure-programs/ o Bill Marquette for testing on Solaris and contributing patches Obsidian-Covenant-bfbtester-e23fc0e/VERSION000066400000000000000000000000061511404222200205210ustar00rootroot000000000000002.0.1 Obsidian-Covenant-bfbtester-e23fc0e/configure.ac000066400000000000000000000031621511404222200217450ustar00rootroot00000000000000dnl Process this file with autoconf to produce a configure script. dnl Package name + version AC_INIT([BFBTester], [2.1.0]) dnl A source file that must exist, used to sanity-check the build dir AC_CONFIG_SRCDIR([src/bfbt/bfbtester.c]) dnl Generate src/config.h from src/config.h.in AC_CONFIG_HEADERS([src/config.h]) dnl Custom config.h entries (used to be in acconfig.h) AC_DEFINE([SOLARIS], [1], [Define if building on Solaris]) AC_DEFINE([LINUX], [1], [Define if building on Linux]) AC_DEFINE([__USE_GNU], [1], [Define for GNU extensions, if needed]) dnl Canonicalize system type (same intent as before) AC_CANONICAL_HOST dnl Tell automake about the package AM_INIT_AUTOMAKE([foreign]) dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL dnl Checks for libraries. AC_CHECK_LIB(c_r, pthread_create, [LIBS="$LIBS -pthread"]) AC_CHECK_LIB(pthread, pthread_create) dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h pthread.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_INLINE AC_TYPE_PID_T AC_TYPE_SIZE_T AC_STRUCT_TM dnl Checks for library functions. AC_FUNC_VPRINTF AC_CHECK_FUNCS(gettimeofday strsignal strcspn strdup strerror strstr readdir_r, , AC_MSG_ERROR(Can't find needed function: $ac_func)) case $build_os in solaris*) AC_DEFINE([SOLARIS], [1], [Define if building on Solaris]) CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" ;; linux*) AC_DEFINE([LINUX], [1], [Define if building on Linux]) ;; esac AC_CONFIG_FILES([ Makefile src/Makefile src/bfbt/Makefile ]) AC_OUTPUT Obsidian-Covenant-bfbtester-e23fc0e/src/000077500000000000000000000000001511404222200202445ustar00rootroot00000000000000Obsidian-Covenant-bfbtester-e23fc0e/src/Makefile.am000066400000000000000000000000171511404222200222760ustar00rootroot00000000000000SUBDIRS = bfbt Obsidian-Covenant-bfbtester-e23fc0e/src/bfbt/000077500000000000000000000000001511404222200211615ustar00rootroot00000000000000Obsidian-Covenant-bfbtester-e23fc0e/src/bfbt/Makefile.am000066400000000000000000000003621511404222200232160ustar00rootroot00000000000000AM_CFLAGS = -Wall AUTOMAKE_OPTIONS = no-dependencies AM_CPPFLAGS = -I$(top_srcdir)/src/include bin_PROGRAMS = bfbtester bfbtester_SOURCES = \ bfbtester.c \ breaker.c \ data_stuff.c \ exec.c \ tempfiles.c \ utils.c Obsidian-Covenant-bfbtester-e23fc0e/src/bfbt/bfbtester.c000066400000000000000000000173341511404222200233150ustar00rootroot00000000000000 /* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: bfbtester.c,v 1.4.2.2 2001/01/22 05:31:12 fesnel Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #if defined(SOLARIS) && defined(__sun) #include /* for thr_setconcurrency */ #endif #include "datatypes.h" #include "data_stuff.h" #include "main.h" #include "breaker.h" #include "utils.h" #include "tempfiles.h" #define MAX_SIMULTANEOUS_EXECS 250 static void usage(char *progname); static void run_breaker(void); static void load_execs(char **av, ExecEntryStatus status, int flags, char *rejects); THREAD_DATA *q; FILE *fp_msg = NULL; int debug_level; extern int optind; extern char *optarg; int main( int ac, char ** av ) { char *progname, *rejects = NULL; int t_on = FALSE; /* tempfile monitoring */ int max_execs = MAX_SIMULTANEOUS_EXECS; int ch, flags = 0; if ((progname = strrchr(av[0], '/')) != NULL) progname++; else progname = av[0]; while ((ch = getopt(ac, av, "ad:ehmo:r:stvx:")) != -1) switch (ch) { case 'a': flags |= FLAGS_ALL; break; case 'd': debug_level = atoi(optarg); break; case 'e': flags |= FLAGS_ENV_TEST; break; case 'h': usage(progname); break; case 'm': flags |= FLAGS_MULTIPLE_ARG_TEST; break; case 'o': if ((fp_msg = fopen(optarg, "w")) == NULL) { printf("Can't open output file: %s\n", optarg); return -1; } break; case 'r': rejects = optarg; break; case 's': flags |= FLAGS_SINGLE_ARG_TEST; break; case 't': t_on = TRUE; break; case 'v': printf("%s v. %s\n", IDSTR, VERSTR); return 0; /* NO FALL-THROUGH */ case 'x': max_execs = atoi(optarg); break; default: usage(progname); /* NOTREACHED */ } ac -= optind; av += optind; if (fp_msg == NULL) fp_msg = stdout; if (!flags || *av == NULL) usage(progname); q = xcalloc(1, sizeof(THREAD_DATA)); q->max_execs = max_execs; q->mut = xmalloc(sizeof(pthread_mutex_t)); if (pthread_mutex_init(q->mut, NULL) != 0) bfbt_message(MSG_TYPE_ERRNO_ABORT, "mutex init"); #if defined(SOLARIS) && defined(__sun) { /* * On Solaris 2.5, threads are not timesliced so we * must increase the concurrency. */ int ret; if (t_on) ret = thr_setconcurrency(3); else ret = thr_setconcurrency(2); if (ret != 0) bfbt_message(MSG_TYPE_ERROR_ABORT, "Can't set thread concurrency"); } #endif /* SOLARIS && __sun */ if (t_on) tempfile_start(q); load_execs(av, EXEC_ENTRY_STATUS_TEST, flags, rejects); run_breaker(); return 0; } static void usage(char *progname) { printf("%s [-htv] [-d level ] [-r rejects] [-o out-file]\n" "%*s [-x max-execs] -asme file [file2 file3 ...]\n" "Must specify one or more of the following tests:\n" " -s Single Argument Test\n" " -m Multiple Argument Test\n" " -e Environment Variable Test\n" " -a Selects all tests\n" "Options:\n" " -h Print this message\n" " -t Enable tempfile monitoring\n" " -v Print version string\n" " -d level Set debug level (default = 0, max = 2)\n" " -r rejects Comma separated list of binaries to skip\n" " -o out-file Output to out-file rather than stdout\n" " -x max-execs Set maximum executables to run in parallel (default = %d)\n" "file Specific binary or a directory of binaries to test\n", progname, (int)strlen(progname), "", MAX_SIMULTANEOUS_EXECS); exit(2); } static void add_exec(char *filename, ExecEntryStatus status, int flags, char *rejects) { struct stat sb; /* Test if exec is to be rejected */ if (rejects) { char *ptr, *ptr2; if((ptr=strstr(rejects, filename))) if(ptr == rejects || *(ptr-1) == ' ' || *(ptr-1) == ',') if(*(ptr+strlen(filename)) == '\0' || *(ptr+strlen(filename)) == ' ' || *(ptr+strlen(filename)) == ',') return; if( (ptr2=strrchr(filename, '/')) && (ptr=strstr(rejects, ++ptr2)) ) if(ptr == rejects || *(ptr-1) == ' ' || *(ptr-1) == ',') if(*(ptr+strlen(ptr2)) == '\0' || *(ptr+strlen(ptr2)) == ' ' || *(ptr+strlen(ptr2)) == ',') return; } /* Test that executable file is valid and accessible */ if (stat(filename, &sb) == 0 && S_ISREG(sb.st_mode) && access(filename, F_OK|X_OK) == 0) /* If we get to here we are safe to add it */ ExecEntry_add(filename, &sb, status, flags); } /* XXX: This is somewhat of a mess */ static void load_execs(char **av, ExecEntryStatus status, int flags, char *rejects) { struct stat sb; char *filename; char *pwd = getenv("PWD"); for (; *av; av++) { /* Executable selection is done in one of several ways: * * If the executable filename is specified with a leading * slash (an absolute path), no selection is used and the * supplied absolute filename is used. * * If there is no leading slash in the filename the selection * is made in one of two ways (in this order): * 1) Prepend file name with $PWD and test accesiblity * 2) Search through $PATH and find first accessible executable * The first one to succeed is the executable choosen. * * If the filename found is a directory, we walk the directory (one * level deep) looking for executable binaries. * * Symbolic links are followed. */ /* already in full pathname form */ if (*av[0] == '/') filename = strdup(*av); /* test whether the executable is in the current directory */ else if (pwd && (filename = xmalloc(strlen(pwd) + strlen(*av) + 2)) && sprintf(filename, "%s%s%s", pwd, pwd[strlen(pwd)-1] == '/' ? "" : "/", *av) && access(filename, F_OK|X_OK) == 0) ; /* or in the user's PATH */ else filename = find_exec_in_path(*av); if (filename && stat(filename, &sb) == 0 && access(filename, F_OK|X_OK) == 0) { if (S_ISDIR(sb.st_mode)) { /* Walk directory */ DIR *dir; struct dirent *entry; char fname[MAXPATHLEN]; if ((dir = opendir(filename)) == NULL) { bfbt_message(MSG_TYPE_ERROR_WARN, "Can't open dir %s", filename); free(filename); continue; } while ((entry = readdir(dir)) != NULL) { if (snprintf(fname, sizeof(fname), "%s%s%s", filename, filename[strlen(filename)-1] == '/' ? "" : "/", entry->d_name) < (int)sizeof(fname)) { add_exec(fname, status, flags, rejects); } } closedir(dir); } else /* Treat as an executable */ add_exec(filename, status, flags, rejects); } else { if (filename) bfbt_message(MSG_TYPE_ERROR_WARN, "Can't access file: %s (%s)", filename, *av); else bfbt_message(MSG_TYPE_ERROR_WARN, "Can't find file: %s", *av); } if (filename) free(filename); } } static void run_breaker(void) { if (!ExecEntry_isempty()) { breaker_start(); breaker_wait(); } } Obsidian-Covenant-bfbtester-e23fc0e/src/bfbt/breaker.c000066400000000000000000000157601511404222200227510ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: breaker.c,v 1.9.2.1 2001/01/22 05:31:12 fesnel Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "datatypes.h" #include "breaker_data.h" #include "exec.h" #include "utils.h" #include "tempfiles.h" #include "data_stuff.h" extern THREAD_DATA *q; static void breaker_execute_command(ExecEntry *exec_entry, char ** args, char ** env) { int i; #ifdef LINUX if (q->current_execs > (q->max_execs / 2)) exec_poll(); #endif for(i=10000; execute_program(exec_entry, args, env) != 0 ; i*=3) { usleep(i); #ifdef LINUX exec_poll(); #endif } } static void breaker_test_singlearg(ExecEntry *entry) { char *args[4]= { entry->fullname, NULL, NULL, NULL }; char *long_arg; int i; int long_arg_len=50*1024+1, short_arg_len=5*1024+1; bfbt_message(MSG_TYPE_MESSAGE, " * Single argument testing"); long_arg = xcalloc(1, short_arg_len); memset(long_arg, 'A', short_arg_len-1); args[2]=long_arg; for(i=0; i < (sizeof(args_options)/sizeof(args_options[0])); i++){ args[1]=(char *)args_options[i]; breaker_execute_command(entry, args, NULL); } free(long_arg); long_arg = xcalloc(1, long_arg_len); memset(long_arg, 'A', long_arg_len-1); args[2]=long_arg; for(i=0; i < (sizeof(args_options)/sizeof(args_options[0])); i++){ args[1]=(char *)args_options[i]; breaker_execute_command(entry, args, NULL); } args[1]=long_arg; args[2]=NULL; breaker_execute_command(entry, args, NULL); free(long_arg); sleep(1); } static void breaker_test_multiplearg(ExecEntry *entry) { char *args[7]={NULL}; char *long_arg; int i,j; int arg_len=10*1024+1; /* only one arg */ args[0] = entry->fullname; bfbt_message(MSG_TYPE_MESSAGE, " * Multiple arguments testing"); long_arg = xcalloc(1, arg_len); memset(long_arg, 'A', arg_len-1); args[2] = long_arg; args[3] = long_arg; args[4] = NULL; for(i=0; i < (sizeof(args_options)/sizeof(args_options[0])); i++){ args[1]=(char *)args_options[i]; breaker_execute_command(entry, args, NULL); } args[2]=long_arg; args[4]=long_arg; args[5]=NULL; for(i=0; i < (sizeof(args_options)/sizeof(args_options[0])); i++){ args[1] = (char *)args_options[i]; for(j=0; j < (sizeof(args_options)/sizeof(args_options[0])); j++){ args[3] = (char *)args_options[j]; breaker_execute_command(entry, args, NULL); } } args[2]=long_arg; args[4]=long_arg; args[5]=long_arg; args[6]=NULL; for(i=0; i < (sizeof(args_options)/sizeof(args_options[0])); i++){ args[1] = (char *)args_options[i]; for(j=0; j < (sizeof(args_options)/sizeof(args_options[0])); j++){ args[3] = (char *)args_options[j]; breaker_execute_command(entry, args, NULL); } } args[1] = long_arg; args[2] = long_arg; args[3] = NULL; breaker_execute_command(entry, args, NULL); free(long_arg); sleep(1); } static void breaker_test_env(ExecEntry *entry) { char *args_arr[]={entry->fullname, NULL, NULL}; char *envs_arr[]={NULL, NULL}; char *long_arg, *long_arg2; int i, env_len; int long_arg_len=10*1024 + 1; bfbt_message(MSG_TYPE_MESSAGE, " * Environment variable testing"); long_arg = xcalloc(1, long_arg_len); long_arg2 = xcalloc(1, long_arg_len); memset(long_arg2, 'A', long_arg_len-1); envs_arr[0]=long_arg; for(i=0; i < (sizeof(envs)/sizeof(envs[0])); i++){ env_len = strlen(envs[i]); if(env_len+1 >= long_arg_len-1) continue; /*ahh!*/ strcpy(long_arg, envs[i]); long_arg[env_len] = '='; memset(long_arg+env_len+1, 'A', long_arg_len - env_len -1 -1); breaker_execute_command(entry, args_arr, envs_arr); /* env no args */ args_arr[1]=(char *)long_arg2; breaker_execute_command(entry, args_arr, envs_arr); args_arr[1]=NULL; } free(long_arg); free(long_arg2); } void breaker_tempfile_createcb(char *filename, struct stat *sb, void *data) { ExecEntry *entry = (ExecEntry *)data; bfbt_message(MSG_TYPE_MESSAGE, "[Tempfile: %s]+ \"%s\"", entry->fullname, filename); } void breaker_tempfile_removecb(char *filename, struct stat *sb, void *data) { ExecEntry *entry = (ExecEntry *)data; bfbt_message(MSG_TYPE_MESSAGE, "[Tempfile: %s]- \"%s\"", entry->fullname, filename); } static void breaker_runtests(ExecEntry *entry) { int test_flags = entry->test_flags; tempfile_request_add(breaker_tempfile_createcb, breaker_tempfile_removecb, (void *)entry); bfbt_message(MSG_TYPE_MESSAGE, "=> %s", entry->fullname); if (entry->filestat.st_mode & S_ISUID) bfbt_message(MSG_TYPE_MESSAGE, " (setuid: %d)", (int) entry->filestat.st_uid); if (entry->filestat.st_mode & S_ISGID) bfbt_message(MSG_TYPE_MESSAGE, " (setgid: %d)", (int) entry->filestat.st_gid); /* Single arg test */ if (test_flags & FLAGS_SINGLE_ARG_TEST) breaker_test_singlearg(entry); /* Multiple args test */ if (test_flags & FLAGS_MULTIPLE_ARG_TEST) breaker_test_multiplearg(entry); /* Environment variable test */ if (test_flags & FLAGS_ENV_TEST) breaker_test_env(entry); tempfile_request_subtract(); } /* Cleanup routine * Runs exec_poll() twice after 5 second delay */ static void breaker_cleanup(void * arg) { bfbt_message(MSG_TYPE_MESSAGE, "Cleaning up...might take a few seconds"); sleep(EXEC_TIMEOUT+1); exec_poll(); exec_poll(); } void * breaker_run(void *data) { ExecEntry *entry=NULL; entry = ExecEntry_getnext(&entry); while(entry) { if (entry->status == EXEC_ENTRY_STATUS_TEST){ gettimeofday(&entry->testtime, NULL); breaker_runtests(entry); entry->status = EXEC_ENTRY_STATUS_TESTED; } entry = ExecEntry_getnext(&entry); } #ifdef LINUX breaker_cleanup(NULL); #endif return NULL; } #ifndef LINUX static void * poll_execs(void *data) { pthread_cleanup_push(breaker_cleanup, NULL); for(;;){ exec_poll(); usleep(100000); pthread_testcancel(); } pthread_cleanup_pop(0); return NULL; } #endif /* LINUX */ void breaker_start(void) { if( pthread_create(&(q->run_thread), NULL, breaker_run, NULL) != 0 ) bfbt_message(MSG_TYPE_ERRNO_ABORT, "Can't create run thread"); #ifndef LINUX if( pthread_create(&(q->poll_thread), NULL, poll_execs, NULL) != 0 ) bfbt_message(MSG_TYPE_ERRNO_ABORT, "Can't create poll thread"); #endif } void breaker_wait(void) { pthread_join(q->run_thread, NULL); #ifndef LINUX pthread_cancel(q->poll_thread); pthread_join(q->poll_thread, NULL); #endif } Obsidian-Covenant-bfbtester-e23fc0e/src/bfbt/data_stuff.c000066400000000000000000000142651511404222200234550ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: data_stuff.c,v 1.4.2.2 2001/01/22 05:31:12 fesnel Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef LINUX #define _GNU_SOURCE #endif #include #include #include #include #include #include #include "datatypes.h" #include "data_stuff.h" #include "utils.h" #include "bfbt_queue.h" /* E X E C E N T R Y */ DLIST_HEAD(exec_entry_head, _exec_entry) ExecEntry_Head; static void ExecEntry_constructor(void) __attribute__ ((constructor)); static void ExecEntry_constructor(void) { DLIST_INIT(&ExecEntry_Head); } static inline void ExecEntry_init(ExecEntry *entry, struct stat *sb, char *fullname, ExecEntryStatus status, int test_flags) { entry->fullname = strdup(fullname); memcpy(&entry->filestat, sb, sizeof(entry->filestat)); entry->status = status; entry->test_flags = test_flags; entry->testtime.tv_sec = 0; entry->testtime.tv_usec = 0; } static void ExecEntry_destroy(ExecEntry *entry) { assert(entry != NULL); if (entry->fullname) free(entry->fullname); free(entry); } static inline int ExecEntry_compare(ExecEntry *e1, ExecEntry *e2) { if (e1->filestat.st_ino == e2->filestat.st_ino) return TRUE; else return FALSE; } ExecEntry * ExecEntry_add(char *name, struct stat *sb, ExecEntryStatus status, int test_flags) { ExecEntry *new; assert(name != NULL && sb != NULL); new = xmalloc(sizeof(ExecEntry)); ExecEntry_init(new, sb, name, status, test_flags); DLIST_INSERT_HEAD(&ExecEntry_Head, new, link); return new; } void ExecEntry_subtract(ExecEntry *entry) { assert(entry != NULL); DLIST_REMOVE(&ExecEntry_Head, entry, link); ExecEntry_destroy(entry); } ExecEntry * ExecEntry_getnext(ExecEntry **entry) { DLIST_GETNEXT(&ExecEntry_Head, entry, link); return *entry; } ExecEntry * ExecEntry_findbyname(char *name) { ExecEntry *entry = NULL; entry = ExecEntry_getnext(&entry); while (entry && strcmp(entry->fullname, name) != 0) entry = ExecEntry_getnext(&entry); return entry; } void ExecEntry_release(ExecEntry *entry) { DLIST_RELEASE(entry, link); } int ExecEntry_isempty(void) { return DLIST_ISEMPTY(&ExecEntry_Head); } /* T E S T E N T R Y */ DLIST_HEAD(test_entry_head, _test_entry) TestEntry_Head; static void TestEntry_constructor(void) __attribute__ ((constructor)); static void TestEntry_constructor(void) { DLIST_INIT(&TestEntry_Head); } extern char ** environ; static inline void TestEntry_init(TestEntry *entry, ExecEntry *parent, char **args, char **env) { assert(entry != NULL); entry->pid = -1; entry->status = 0; if ((entry->progname = strdup(parent->fullname)) == NULL) bfbt_message(MSG_TYPE_ERRNO_ABORT, "Out of memory"); entry->args = args; entry->args_str = args_to_str(entry->args); if (env) { entry->env = env_create(env); entry->env_flag = FALSE; entry->env_str = env_to_str(env); } else { entry->env = environ; entry->env_flag = TRUE; entry->env_str = NULL; } } void TestEntry_destroy(TestEntry *entry) { assert(entry != NULL); if (entry->progname) free(entry->progname); if (entry->args_str) free(entry->args_str); if (entry->env && entry->env_flag == FALSE) free(entry->env); if (entry->env_str) free(entry->env_str); free(entry); } TestEntry * TestEntry_create(ExecEntry *parent, char **args, char **env) { TestEntry *new; new = xmalloc(sizeof(TestEntry)); TestEntry_init(new, parent, args, env); return new; } void TestEntry_insert(TestEntry *entry) { assert(entry != NULL && entry->pid != -1); DLIST_INSERT_HEAD(&TestEntry_Head, entry, link); } void TestEntry_remove(TestEntry *entry) { assert(entry != NULL && entry->pid != -1); DLIST_REMOVE(&TestEntry_Head, entry, link); } TestEntry * TestEntry_getnext(TestEntry **entry) { DLIST_GETNEXT(&TestEntry_Head, entry, link); return *entry; } /* C R A S H R E P O R T S */ DLIST_HEAD(crashreport_slist_head, _crash_report) CrashReport_Head; static void CrashReport_constructor(void) __attribute__ ((constructor)); static void CrashReport_constructor(void) { DLIST_INIT(&CrashReport_Head); } static void CrashReport_init(CrashReport *report, TestEntry *test_entry) { report->progname = strdup(test_entry->progname); report->args_str = (test_entry->args_str ? strdup(test_entry->args_str) : NULL); report->env_str = (test_entry->env_str ? strdup(test_entry->env_str) : NULL); report->signal = (int)WTERMSIG(test_entry->status); report->didCore = (int)WCOREDUMP(test_entry->status); } static void CrashReport_destroy(CrashReport *report) { if (report->progname) free(report->progname); if (report->args_str) free(report->args_str); if (report->env_str) free(report->env_str); free(report); } CrashReport * CrashReport_add(TestEntry *test_entry) { CrashReport *new; assert(test_entry != NULL); new = xmalloc(sizeof(CrashReport)); CrashReport_init(new, test_entry); DLIST_INSERT_HEAD(&CrashReport_Head, new, link); return new; } void CrashReport_subtract(CrashReport *report) { assert(report != NULL); DLIST_REMOVE(&CrashReport_Head, report, link); CrashReport_destroy(report); } void CrashReport_log(CrashReport *report) { bfbt_message(MSG_TYPE_MESSAGE, "*** Crash <%s> ***\n" "args: %s\n" "envs: %s\n" "Signal: %d ( %s )\n" "Core? %s\n", report->progname, report->args_str ? report->args_str : "", report->env_str ? report->env_str : "", report->signal, strsignal(report->signal), report->didCore ? "Yes" : "No"); } Obsidian-Covenant-bfbtester-e23fc0e/src/bfbt/exec.c000066400000000000000000000103011511404222200222440ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: exec.c,v 1.4.2.1 2001/01/22 05:31:12 fesnel Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include "datatypes.h" #include "data_stuff.h" #include "exec.h" #include "utils.h" extern THREAD_DATA *q; typedef enum _exec_status ExecStatus; enum _exec_status { EXEC_STATUS_DONE, EXEC_STATUS_STALE, EXEC_STATUS_GARBAGE, EXEC_STATUS_NOTDONE }; int execute_program(ExecEntry *exec_entry, char ** args, char ** env) { TestEntry *test_entry; if( args == NULL ) return -1; if( q->current_execs >= q->max_execs ){ bfbt_message(MSG_TYPE_DEBUG_L1, "Hit maximum execs"); return -1; } test_entry = TestEntry_create(exec_entry, args, env); switch( test_entry->pid = fork() ){ case -1: bfbt_message(MSG_TYPE_ERROR_WARN, "Couldn't fork process"); TestEntry_destroy(test_entry); return (1); case 0: { pid_t pgid = getpid(); if (setpgid(pgid, pgid) != 0) /* XXX: should fail completely */ bfbt_message(MSG_TYPE_ERRNO_WARN, "Couldn't set process group"); } close(0); close(1); close(2); execve(test_entry->progname, test_entry->args, test_entry->env); /* if we get here then the execve() didn't work * NOTE: The error message will not print if we are * outputting to stdout/stderr */ bfbt_message(MSG_TYPE_ERRNO_WARN, "execve '%s'", test_entry->progname); _exit(2); default: gettimeofday(&(test_entry->tm), NULL); TestEntry_insert(test_entry); q->current_execs++; } return (0); } static void exec_kill(pid_t pid) { kill(-(pid), SIGKILL); } static ExecStatus exec_GetStatus(TestEntry *entry) { struct timeval tm; #define EXEC_STALE 20 /* seconds */ #define EXEC_GARBAGE (2 * EXEC_STALE) /* Entry is garbage -- orphan it */ if( waitpid(entry->pid, &(entry->status), WNOHANG) > 0 ) return EXEC_STATUS_DONE; gettimeofday(&tm, NULL); if (tm.tv_sec - entry->tm.tv_sec > EXEC_TIMEOUT){ exec_kill(entry->pid); if( waitpid(entry->pid, &(entry->status), WNOHANG) > 0 ) return EXEC_STATUS_DONE; } if (tm.tv_sec - entry->tm.tv_sec > EXEC_GARBAGE) return EXEC_STATUS_GARBAGE; if (tm.tv_sec - entry->tm.tv_sec > EXEC_STALE) return EXEC_STATUS_STALE; return EXEC_STATUS_NOTDONE; } static void exec_process_close(TestEntry *entry) { q->current_execs--; if( WIFEXITED(entry->status) ) ; /* nothing bad happened to it */ else if( WIFSIGNALED(entry->status) ){ /* we ignore SIGKILL and SIGPIPE */ if( WTERMSIG(entry->status) == SIGKILL || WTERMSIG(entry->status) == SIGPIPE){ return; } { /* we crashed -- record */ CrashReport * report = CrashReport_add(entry); CrashReport_log(report); } } else bfbt_message(MSG_TYPE_ERROR_WARN, "%s ended in unknown condition, status=%d", entry->progname, entry->status); } void exec_poll(void) { TestEntry *temp, *dead; temp = NULL; for (temp = TestEntry_getnext(&temp); temp;) switch (exec_GetStatus(temp)) { case EXEC_STATUS_NOTDONE: temp = TestEntry_getnext(&temp); break; case EXEC_STATUS_DONE: exec_process_close(temp); /* FALL THROUGH */ case EXEC_STATUS_GARBAGE: dead = temp; temp = TestEntry_getnext(&temp); TestEntry_remove(dead); TestEntry_destroy(dead); break; case EXEC_STATUS_STALE: break; } } Obsidian-Covenant-bfbtester-e23fc0e/src/bfbt/tempfiles.c000066400000000000000000000171651511404222200233270ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: tempfiles.c,v 1.4.2.1 2001/01/22 05:31:12 fesnel Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include "datatypes.h" #include "tempfiles.h" #include "utils.h" typedef struct _file_entry FileEntry; struct _file_entry { char *filename; /* excludes leading directories */ struct timeval tm; int statd; #ifdef SOLARIS uint32_t fileno; #else u_int32_t fileno; #endif /* SOLARIS */ struct stat sb; FileEntry *next; FileEntry *prev; }; typedef struct _tempfile_watch_request TempFileRequest; struct _tempfile_watch_request { pthread_mutex_t mutex; pthread_cond_t cond; int count; /* Number of requests - normally 0 or 1 */ int status; /* 0 - none, 1 - start up, 2 - running, 3 - shutting down */ TempfileCB create_cb; /* creation call back */ TempfileCB remove_cb; /* remove call back */ void *cb_data; /* user data */ }; static int initialized = FALSE; /* Set to true if we are using tempfile * monitoring */ static FileEntry *head = NULL; static FileEntry *tail = NULL; static TempFileRequest request = { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0, NULL, NULL, NULL }; static int isNew(struct dirent *entry) { FileEntry *entries = head; #ifdef SOLARIS while(entries && entry->d_ino > entries->fileno) #else while(entries && entry->d_fileno > entries->fileno) #endif /* SOLARIS */ entries = entries->next; if (entries && #ifdef SOLARIS entries->fileno == entry->d_ino #else entries->fileno == entry->d_fileno #endif ) return FALSE; else return TRUE; } static void addFile(struct dirent *entry, struct timeval tm) { FileEntry *new; new = xmalloc(sizeof(FileEntry)); new->filename = strdup(entry->d_name); new->tm = tm; #ifdef SOLARIS new->fileno = entry->d_ino; #else new->fileno = entry->d_fileno; #endif /* SOLARIS */ new->next = NULL; new->prev = NULL; if (head == NULL) /* tail also NULL */ head = tail = new; else if (new->fileno < head->fileno) { head->prev = new; new->next = head; head = new; } else if (new->fileno > tail->fileno) { new->prev = tail; tail->next = new; tail = new; } else { FileEntry *temp = head; while (new->fileno > temp->fileno) temp = temp->next; temp->prev->next = new; new->prev = temp->prev; new->next = temp; temp->prev = new; } /* call creation callback */ if (request.create_cb && request.count && (request.status == 2 || request.status == 3)) (*request.create_cb)(new->filename, &new->sb, request.cb_data); } static void updateFile(struct dirent *entry, struct timeval tm) { FileEntry *temp = head; /* At this point we know entry is in the list somewhere */ while (temp->fileno != #ifdef SOLARIS entry->d_ino #else entry->d_fileno #endif ) temp = temp->next; temp->tm = tm; } /* Unlinks from list -- does NOT free() node */ static void removeFile(FileEntry *entry) { if (entry->prev && entry->next) { entry->prev->next = entry->next; entry->next->prev = entry->prev; } else { if (head == entry) { if (entry->next) entry->next->prev = NULL; else /* one item list */ tail = NULL; head = entry->next; } else { /* (tail == entry) */ entry->prev->next = NULL; tail = entry->prev; } } /* call deletion callback */ if (request.remove_cb && request.count && (request.status == 2 || request.status == 3)) (*request.remove_cb)(entry->filename, &entry->sb, request.cb_data); } /* Free memory used by file */ static void deleteFile(FileEntry *entry) { if (entry->filename) free(entry->filename); free(entry); } static void AddOrUpdate(struct dirent *entry, struct timeval tm) { /* Add if entry is new or tag it as still available */ if (isNew(entry)) addFile(entry, tm); else updateFile(entry, tm); } static void tempfile_scandir(DIR *dir) { struct dirent *entry; struct timeval tm; FileEntry *temp, *dead; /* Timestamp for this scan: used to mark entries as "seen" */ gettimeofday(&tm, NULL); /* First pass: add new files / update existing ones */ while ((entry = readdir(dir)) != NULL) { AddOrUpdate(entry, tm); } /* Second pass: remove files that were not updated this round */ temp = head; while (temp) { if (memcmp(&temp->tm, &tm, sizeof(struct timeval)) != 0) { dead = temp; temp = temp->next; removeFile(dead); deleteFile(dead); } else { temp = temp->next; } } /* Rewind for next time */ rewinddir(dir); } static void tempfile_request_startup(void) { /* Already have mutex locked */ request.status = 2; pthread_cond_signal(&request.cond); } static void tempfile_request_shutdown(void) { /* Already have mutex locked */ request.status = 0; pthread_cond_signal(&request.cond); } static void * tempfile_watch(void *data) { char *dirname; DIR *dir; int lasttime = 0; if (!(dirname = getenv("BFBT_TMPDIR"))) dirname = "/tmp"; initialized = TRUE; if ((dir = opendir(dirname)) == NULL) bfbt_message(MSG_TYPE_ERROR_ABORT, "opendir: %s failed", dirname); while(1){ tempfile_scandir(dir); pthread_mutex_lock(&request.mutex); if (request.status == 1 || request.status == 3) { if (request.status == 1) { /* starting a new request */ if (lasttime) { tempfile_request_startup(); lasttime = 0; } else lasttime = 1; } else /* request.status == 3 */ { /* shutting down request */ if (lasttime) { tempfile_request_shutdown(); lasttime = 0; } else lasttime = 1; } } else while (request.status == 0) pthread_cond_wait(&request.cond, &request.mutex); pthread_mutex_unlock(&request.mutex); pthread_testcancel(); } return NULL; } int tempfile_request_add(TempfileCB create, TempfileCB remove, void *cbdata) { if (!initialized) return 0; pthread_mutex_lock(&request.mutex); if (request.count || request.status != 0) return -1; request.count = 1; request.status = 1; pthread_cond_signal(&request.cond); while (request.status == 1) pthread_cond_wait(&request.cond, &request.mutex); request.create_cb = create; request.remove_cb = remove; request.cb_data = cbdata; pthread_mutex_unlock(&request.mutex); return 0; } int tempfile_request_subtract(void) { if (!initialized) return 0; pthread_mutex_unlock(&request.mutex); if (!request.count || request.status != 2) return -1; request.status = 3; while (request.status == 3) pthread_cond_wait(&request.cond, &request.mutex); request.count--; request.create_cb = NULL; request.remove_cb = NULL; request.cb_data = NULL; pthread_mutex_unlock(&request.mutex); return 0; } void tempfile_start(THREAD_DATA *data) { if (pthread_create(&data->tempfile_thread, NULL, tempfile_watch, NULL) != 0) bfbt_message(MSG_TYPE_ERRNO_ABORT, "tempfile thread create"); } Obsidian-Covenant-bfbtester-e23fc0e/src/bfbt/utils.c000066400000000000000000000113751511404222200224740ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: utils.c,v 1.3.2.1 2001/01/22 05:31:12 fesnel Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include "datatypes.h" #include "utils.h" extern FILE *fp_msg; extern int debug_level; void __bfbt_message(MsgType type, const char *function, int line, const char *fmt, ...) { va_list args; if (type == MSG_TYPE_DEBUG_L1 && debug_level < 1) /* Level 1 */ return; if (type == MSG_TYPE_DEBUG_L2 && debug_level < 2) /* Level 2 */ return; va_start(args, fmt); if (type != MSG_TYPE_MESSAGE) fprintf(fp_msg, "[%s:%d] ", function, line); vfprintf(fp_msg, fmt, args); if (type == MSG_TYPE_ERRNO_ABORT || type == MSG_TYPE_ERRNO_WARN) fprintf(fp_msg, ": %s", strerror(errno)); fprintf(fp_msg, "\n"); if (type == MSG_TYPE_ERROR_ABORT || type == MSG_TYPE_ERRNO_ABORT) exit(1); va_end(args); } /* Searches the PATH environment variable for an absolute * filename for name. * Result must be free()'d */ char * find_exec_in_path(char *name) { char *str, *buf, *last, *path = getenv("PATH"); char filename[MAXPATHLEN]; assert(name != NULL && name[0] != '\0'); if (path) { if ((buf = strdup(path)) == NULL) bfbt_message(MSG_TYPE_ERROR_ABORT, "out of memory"); str = strtok_r(buf, ":", &last); for (;str;str = strtok_r(NULL, ":", &last)) { if (snprintf(filename, sizeof(filename), "%s%s%s", str, (str[strlen(str)-1] == '/' ? "" : "/"), name) >= sizeof(filename)) continue; if (access(filename, F_OK|X_OK) == 0) { free(buf); return strdup(filename); } } free(buf); } return NULL; } char * args_to_str(char **args) { char *str; char **temp; int i; #define LONG_ARG_FMT "[%5.5d]" #define LONG_ARG_LEN (sizeof("[12345]")-1) #define MAX_VALID_ARG_LEN 100 if (*(args+1) == NULL) return NULL; for (i = 0, temp = args+1; *temp; temp++) i += (strlen(*temp) > MAX_VALID_ARG_LEN ? LONG_ARG_LEN : strlen(*temp)) + 1; str = xcalloc(1, i); for (temp = args+1; *temp; temp++){ if (strlen(*temp) > MAX_VALID_ARG_LEN) { char long_str[LONG_ARG_LEN+1]; snprintf(long_str, LONG_ARG_LEN+1, LONG_ARG_FMT, (int)strlen(*temp)); strcat(str, long_str); } else strcat(str, *temp); if (*(temp+1)) strcat(str, " "); } return str; } char * env_to_str(char **env) { char **temp, *str; int i; #define LONG_ENV_FMT "[%5.5d]" #define LONG_ENV_LEN (sizeof("[12345]")-1) #define MAX_VALID_ENV_LEN 100 for (i = 0, temp = env; *temp; temp++) i += (strlen(*temp) > MAX_VALID_ENV_LEN ? (strcspn(*temp, "=") + 1 + LONG_ENV_LEN) : strlen(*temp)) + 1; str = xcalloc(1, i); for (temp = env; *temp; temp++) { if (strlen(*temp) > MAX_VALID_ENV_LEN) { char long_env[LONG_ENV_LEN+1]; i = strcspn(*temp, "="); strncat(str, *temp, i+1); snprintf(long_env, LONG_ENV_LEN+1, LONG_ENV_FMT, (int)strlen(*temp+i+1)); strcat(str, long_env); } else strcat(str, *temp); if (*(temp+1)) strcat(str, " "); } return str; } static inline int env_not_used(char **env, char *str) { int len = strcspn(str, "="); char **temp; for (temp = env; *temp; temp++) if (strncmp(*temp, str, len) == 0) return FALSE; return TRUE; } extern char ** environ; char ** env_create(char **env) { int i, j; char **temp, **temp2; /* NOTE: To save a few CPU cycles we malloc the sum of all entries * in env and environ, even if there may be duplicates in env and environ. * This will create a temporary 'n * sizeof(char *)' memory bloat, however * n will probably only be about 1 or 2. */ for (i = 0, temp = env; *temp; temp++, i++); for (temp = environ; *temp; temp++, i++); /* Merge env and environ */ temp2 = xcalloc(1, (i+1) * sizeof(*temp2)); for (j = 0, temp = env; *temp; j++, temp++) temp2[j] = *temp; for (temp = environ; *temp; temp++) if (env_not_used(env, *temp)) { temp2[j] = *temp; j++; } return temp2; } Obsidian-Covenant-bfbtester-e23fc0e/src/include/000077500000000000000000000000001511404222200216675ustar00rootroot00000000000000Obsidian-Covenant-bfbtester-e23fc0e/src/include/bfbt_queue.h000066400000000000000000000171031511404222200241630ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: bfbt_queue.h,v 1.2.2.1 2001/01/22 05:31:12 fesnel Exp $ */ #ifndef __BFBT_QUEUE_H__ #define __BFBT_QUEUE_H__ /* List macros derived from those in sys/queue.h */ /* DLIST: Double linked list with top pointer (thread protected) */ /* private: */ #define _DLIST_ISFIRST(elm, field) ((elm)->field.dle_prev == NULL) #define _DLIST_ISLAST(elm, field) ((elm)->field.dle_next == NULL) #define _DLIST_ISEMPTY(head) ((head)->dlh_first == NULL) #define _DLIST_FIRST(head) ((head)->dlh_first) #define _DLIST_NEXT(elm, field) ((elm)->field.dle_next) #define _DLIST_PREV(elm, field) ((elm)->field.dle_prev) #define _DLIST_INIT_ENTRY(elm, field) do { \ pthread_mutex_init(&(elm)->field.dle_access, NULL); \ (elm)->field.dle_reader_count = 0; \ (elm)->field.dle_writer_count = 0; \ pthread_cond_init(&(elm)->field.dle_reader_wait, NULL); \ pthread_cond_init(&(elm)->field.dle_writer_wait, NULL); \ } while (0) #define _DLIST_DESTROY_ENTRY(elm, field) do { \ pthread_mutex_destroy(&(elm)->field.dle_access); \ pthread_cond_destroy(&(elm)->field.dle_reader_wait); \ pthread_cond_destroy(&(elm)->field.dle_writer_wait); \ } while (0) #define _DLIST_READ_ACCESS(elm, field) do { \ pthread_mutex_lock(&(elm)->field.dle_access); \ while ((elm)->field.dle_writer_count) \ pthread_cond_wait(&(elm)->field.dle_reader_wait, &(elm)->field.dle_access);\ (elm)->field.dle_reader_count++; \ pthread_mutex_unlock(&(elm)->field.dle_access); \ } while (0) #define _DLIST_READ_DEACCESS(elm, field) do { \ pthread_mutex_lock(&(elm)->field.dle_access); \ (elm)->field.dle_reader_count--; \ if ((elm)->field.dle_writer_count && (elm)->field.dle_reader_count == 0)\ pthread_cond_broadcast(&(elm)->field.dle_writer_wait); \ pthread_mutex_unlock(&(elm)->field.dle_access); \ } while (0) #define _DLIST_WRITE_ACCESS(elm, field) do { \ pthread_mutex_lock(&(elm)->field.dle_access); \ (elm)->field.dle_writer_count++; \ while ((elm)->field.dle_reader_count) \ pthread_cond_wait(&(elm)->field.dle_writer_wait, &(elm)->field.dle_access);\ pthread_mutex_unlock(&(elm)->field.dle_access); \ } while (0) #define _DLIST_WRITE_DEACCESS(elm, field) do { \ pthread_mutex_lock(&(elm)->field.dle_access); \ (elm)->field.dle_writer_count--; \ if ((elm)->field.dle_reader_count /* && (elm)->field.dle_writer_count == 0 */)\ pthread_cond_broadcast(&(elm)->field.dle_reader_wait); \ pthread_mutex_unlock(&(elm)->field.dle_access); \ } while (0) /* public: */ #define DLIST_HEAD(name, type) \ struct name { \ struct type *dlh_first; /* first element */ \ pthread_mutex_t dlh_access; /* protect head */ \ pthread_mutex_t dlh_ops; /* synchronize insertion/deletion ops */\ } #define DLIST_HEAD_INITIALIZER(head) \ { NULL, PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER } #define DLIST_ENTRY(type) \ struct { \ struct type *dle_next; /* next element */ \ struct type *dle_prev; /* previous element */ \ pthread_mutex_t dle_access; /* protect entry */ \ unsigned int dle_reader_count; /* readers of current entry */ \ unsigned int dle_writer_count; /* writers of current entry */ \ pthread_cond_t dle_reader_wait; /* wait if write is in progress */ \ pthread_cond_t dle_writer_wait; /* wait if read is in progress */ \ } #define DLIST_INIT(head) do { \ (head)->dlh_first = NULL; \ pthread_mutex_init(&(head)->dlh_access, NULL); \ pthread_mutex_init(&(head)->dlh_ops, NULL); \ } while (0) #define DLIST_DESTROY(head) do { \ pthread_mutex_destroy(&(head)->dlh_ops); \ pthread_mutex_destroy(&(head)->dlh_access); \ } while(0) #define DLIST_INSERT_HEAD(head, elm, field) do { \ _DLIST_INIT_ENTRY((elm), field); \ pthread_mutex_lock(&(head)->dlh_ops); \ pthread_mutex_lock(&(head)->dlh_access); \ _DLIST_WRITE_ACCESS((elm), field); \ if (! _DLIST_ISEMPTY((head))) { \ _DLIST_WRITE_ACCESS(_DLIST_FIRST((head)), field); \ _DLIST_PREV(_DLIST_FIRST((head)), field) = (elm); \ _DLIST_WRITE_DEACCESS(_DLIST_FIRST((head)), field); \ } \ _DLIST_NEXT((elm), field) = _DLIST_FIRST((head)); \ _DLIST_PREV((elm), field) = NULL; \ _DLIST_FIRST((head)) = (elm); \ _DLIST_WRITE_DEACCESS((elm), field); \ pthread_mutex_unlock(&(head)->dlh_access); \ pthread_mutex_unlock(&(head)->dlh_ops); \ } while (0) #define DLIST_REMOVE(head, elm, field) do { \ /* Caller must assure no one will remove \ * this element before we do \ */ \ pthread_mutex_lock(&(head)->dlh_ops); \ if (_DLIST_ISFIRST((elm), field)) { \ pthread_mutex_lock(&(head)->dlh_access); \ _DLIST_FIRST((head)) = _DLIST_NEXT((elm), field); \ } else { \ _DLIST_WRITE_ACCESS(_DLIST_PREV((elm), field), field); \ _DLIST_NEXT(_DLIST_PREV((elm), field), field) = _DLIST_NEXT((elm), field);\ } \ _DLIST_WRITE_ACCESS((elm), field); \ if (! _DLIST_ISLAST((elm), field)) { \ /* XXX: We don't write-lock next element, however we don't \ * go backwards in queue so it isn't too bad \ */ \ /*_DLIST_WRITE_ACCESS(_DLIST_NEXT((elm), field), field);*/ \ _DLIST_PREV(_DLIST_NEXT((elm), field), field) = _DLIST_PREV((elm), field);\ /*_DLIST_WRITE_DEACCESS(_DLIST_NEXT((elm), field), field);*/ \ } \ _DLIST_WRITE_DEACCESS((elm), field); \ if (_DLIST_ISFIRST((elm), field)) \ pthread_mutex_unlock(&(head)->dlh_access); \ else \ _DLIST_WRITE_DEACCESS(_DLIST_PREV((elm), field), field); \ pthread_mutex_unlock(&(head)->dlh_ops); \ _DLIST_DESTROY_ENTRY((elm), field); \ } while (0) #define DLIST_GETNEXT(head, p_elm, field) do { \ if (*(p_elm) == NULL) { /* start at top */ \ pthread_mutex_lock(&(head)->dlh_access); \ *(p_elm) = _DLIST_FIRST((head)); \ if (*(p_elm) != NULL) \ _DLIST_READ_ACCESS(*(p_elm), field); \ pthread_mutex_unlock(&(head)->dlh_access); \ } else if (_DLIST_ISLAST(*(p_elm), field)) { \ _DLIST_READ_DEACCESS(*(p_elm), field); \ *(p_elm) = NULL; \ } else { \ *(p_elm) = _DLIST_NEXT(*(p_elm), field); \ _DLIST_READ_ACCESS(*(p_elm), field); \ _DLIST_READ_DEACCESS(_DLIST_PREV(*(p_elm), field), field); \ } \ } while (0) #define DLIST_RELEASE(elm, field) _DLIST_READ_DEACCESS((elm), field) /* This macro shouldn't be used for any purpose other than to test * the instantaneous `emptyness' of a list */ #define DLIST_ISEMPTY(head) _DLIST_ISEMPTY((head)) #endif /* __BFBT_QUEUE_H__ */ Obsidian-Covenant-bfbtester-e23fc0e/src/include/breaker.h000066400000000000000000000017431511404222200234600ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: breaker.h,v 1.2.2.1 2001/01/22 05:31:12 fesnel Exp $ */ #ifndef __BREAKER_H__ #define __BREAKER_H__ void breaker_start(void); void breaker_wait(void); #endif /* __BREAKER_H__ */ Obsidian-Covenant-bfbtester-e23fc0e/src/include/breaker_data.h000066400000000000000000000126411511404222200244500ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: breaker_data.h,v 1.2.2.1 2001/01/22 05:31:12 fesnel Exp $ */ #ifndef __BREAKER_DATA_H__ #define __BREAKER_DATA_H__ const char *args_options[] = { \ /* one characters */ "-0","-1","-2","-3","-4","-5", "-6","-7","-8","-9","-@","-A", "-B","-C","-D","-E","-F","-G", "-H","-I","-J","-K","-L","-M", "-N","-O","-P","-Q","-R","-S", "-T","-U","-V","-W","-X","-Y", "-Z","-a","-b","-c","-d","-e", "-f","-g","-h","-i","-j","-k", "-l","-m","-n","-o","-p","-q", "-r","-s","-t","-u","-v","-w", "-x","-y","-z" }; /* various environment variables */ const char *envs[] = { \ "USER", "MAIL", "HOME", "ENV", "MORE", "TOP","CVSROOT", "OLDPWD", "WMAKER_BIN_NAME", "PAGER", "RSTAR_NO_WARN", "OPTIND", "LOGNAME", "WINDOWID", "MAILHOST","SHOPTYPE", "TERM", "BLOCKSIZE", "DISPLAY","OPENSSL_CONF", "PWD", "TERMCAP", "EDITOR", "POSIXLY_CORRECT", "BC_ENV_ARGS", "BC_LINE_LENGTH", "GNUTARGET","GENOCIDED", "COLUMNS", "EMULATION_ENVIRON", "TARGET_ENVIRON", "LD_RUN_PATH", "LD_LIBRARY_PATH", "TMPDIR","KRB5_CONFIG", "TMP", "TEMP", "CVS_SERVER", "CVS_CLIENT_PORT", "CVS_CLIENT_LOG", "CVS_RSH", "IGNORE_ENV", "CVS_PASSFILE", "CVS_PASSWORD","TMPDIR_ENV","SCSI_MODES", "EDITOR1_ENV", "EDITOR2_ENV","EDITOR3_ENV","QUERY_STRING" "CVSROOT_ENV", "CVSREAD_ENV", "CVSREADONLYFS_ENV", "CVS_OPTIONS", "CVSUMASK_ENV", "CVS_SERVER_SLEEP", "WRAPPER_ENV", "DIFF_OPTIONS", "DIFF","GETARGMANDOC", "NAME, ENV_NAME", "LANG", "SUNPRO_DEPENDENCIES", "DEPENDENCIES_OUTPUT","COLLECT_NO_DEMANGLE","SSL_CIPHER", "COLLECT_GCC_OPTIONS", "COLLECT_GCC", "COMPILER_PATH", "LIBRARY_PATH", "TLINK_VERBOSE", "SHELL","SSLEAY_CONF", "PATH", "HISTSIZE", "GDBHISTFILE", "PS2", "EMACS", "_POSIX_OPTION_ORDER", "TZ", "PATCH_GET", "AFSLIBPATH", "SIMPLE_BACKUP_SUFFIX", "PATCH_VERSION_CONTROL","RMT", "VERSION_CONTROL", "INFOPATH", "INFO_PRINT_COMMAND", "LINES", "USERNAME", "AFS_SYSCALL", "HZ", "GREP_OPTIONS", "SYSTEM", "MANROFFSEQ","KRBTKFILE", "MANSECT", "MANLOCALES", "MANPATH", "PATCH_INDEX_FIRST", "COMSPEC", "TAPE", "MODEMS", "MUSIC_CD", "CD_DRIVE", "DISC", "CDPLAY", "CHANGER_ENV_VAR", "LC_CTYPE", "LS_COLWIDTHS", "LC_TIME", "AWKPATH", "LOCALDEF", "DSTKEYPATH", "NET_ORDER", "HES_DOMAIN", "IRPD_HOST_ENV", "LOCALDOMAIN", "LCD_TYPE", "CVS_LOCAL_BRANCH_NUM", "PROFDIR", "UDICONF", "KERB_DBG", "GTAGSWARNING", "GTAGSDBPATH", "GTAGSROOT", "KRBCONFDIR", "GTAGSLIBPATH", "BROWSER", "GTAGSCONF", "GTAGSLABEL", "GROFF_COMMAND_PREFIX", "GROFF_FONT_PATH", "GROFF_TYPESETTER", "KRB4PRINCIPAL", "GROFF_TMPDIR_ENVVAR","TMPDIR_ENVVAR","REFER","RANDFILE", "FONTPATH_ENV_VAR","KRB5CCNAME","BUFMOD_FIXED","EL_SIZE", "ABCDE", "MOUSE_BUTTONS_123", "NCURSES_NO_PADDING", "BAUDRATE", "CC", "TERMINFO", "TERMINFO_DIRS","FAITH_NS", "TERMPATH", "NCURSES_NO_SETBUF", "KEYBOARD", "HACKDIR", "LC_MESSAGES", "CSCOPE_DIRS", "NEXINIT", "EXINIT", "TTYPROMPT", "PERL_BADFREE", "PERL_DESTRUCT_LEVEL", "PERL5OPT", "PERL_DEBUG_MSTATS", "PERL5LIB", "PERLLIB", "YYDEBUG", "TERMCAP_COLORS", "PERL5DB", "LANGUAGE", "LC_ALL", "LC_COLLATE", "LC_NUMERIC", "PERL_BADLANG", "PERL_DL_NONLAZY", "HOSTALIASES", "GAI", "USE_UNICODE", "HACKPAGER", "MAGIC", "HACKOPTIONS", "INVENT", "VISUAL", "MAILREADER", "ROGUEOPTS", "WOTD", "SAILNAME", "LIBDIR", "DIALOGRC", "RCSLOCALID", "RCSINCEXC", "RCSINIT", "LDSO", "OBJFORMAT", "RES_OPTIONS", "NLSPATH", "REMOTE", "MALLOC_OPTIONS", "LIBC_R_DEBUG", "DEBUGTTY","MAKE", "HTTP_PROXY", "FTP_TIMEOUT", "LD_BIND_NOW", "LD_DEBUG", "LD_PRELOAD", "LD_TRACE_LOADED_OBJECTS", "LD_TRACE_LOADED_OBJECTS_PROGNAME", "SYSINSTALL_DEBUG", "LD_TRACE_LOADED_OBJECTS_FMT1", "VINUM_DATEFORMAT", "LD_TRACE_LOADED_OBJECTS_FMT2", "VINUM_HISTORY", "PROM_E_BOOTED_DEV", "PROM_E_BOOTED_OSFLAGS","PHONES", "PROM_E_BOOTED_FILE", "kernelname", "PROM_E_TTY_DEV", "rootdev", "currdev", "autoboot_delay", "bootfile", "DOS_KERNEL", "MINUSKVAR", "FTP_PASSWORD", "FTP_LOGIN", "FTP_PROXY", "HTTP_TIMEOUT", "HTTP_AUTH", "HTTP_PROXY_AUTH", "FINGER", "REPLYTO", "FTPSERVERPORT", "LOCATE_PATH", "MACHINE","MACHINE_ARCH", "MAKEOBJDIRPREFIX", "MAKEOBJDIR", "MAKEFLAGS", "OBJFORMAT_PATH", "NLSPROVIDER", "V_TERMCAP", "PRINTER", "PACKAGESITE", "_TOP", "PKG_DBDIR", "PKG_ADD_BASE", "PKG_PATH", "PKG_TMPDIR", "CONNECT", "EL_EDITOR", "PW_SCAN_BIG_IDS" }; #endif /* __BREAKER_DATA_H__ */ Obsidian-Covenant-bfbtester-e23fc0e/src/include/data_stuff.h000066400000000000000000000032621511404222200241630ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: data_stuff.h,v 1.2.2.2 2001/01/22 05:31:12 fesnel Exp $ */ #ifndef __DATA_STUFF_H__ #define __DATA_STUFF_H__ ExecEntry * ExecEntry_add(char *name, struct stat *sb, ExecEntryStatus status, int test_flags); void ExecEntry_subtract(ExecEntry *entry); void ExecEntry_remove(ExecEntry *entry); ExecEntry * ExecEntry_getnext(ExecEntry **entry); ExecEntry * ExecEntry_findbyname(char *name); void ExecEntry_release(ExecEntry *entry); int ExecEntry_isempty(void); void TestEntry_destroy(TestEntry *entry); TestEntry * TestEntry_create(ExecEntry *parent, char **args, char **env); void TestEntry_insert(TestEntry *entry); void TestEntry_remove(TestEntry *entry); TestEntry * TestEntry_getnext(TestEntry **entry); CrashReport * CrashReport_add(TestEntry *test_entry); void CrashReport_subtract(CrashReport *report); void CrashReport_log(CrashReport *report); #endif /* __DATA_STUFF_H__ */ Obsidian-Covenant-bfbtester-e23fc0e/src/include/datatypes.h000066400000000000000000000053641511404222200240460ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: datatypes.h,v 1.2.2.1 2001/01/22 05:31:12 fesnel Exp $ */ #ifndef __DATATYPES_H__ #define __DATATYPES_H__ #include #include #include "bfbt_queue.h" #include typedef struct _crash_report CrashReport; struct _crash_report { char *progname; char *args_str; char *env_str; int signal; int didCore; DLIST_ENTRY(_crash_report) link; }; typedef enum _exec_entry_status ExecEntryStatus; enum _exec_entry_status { EXEC_ENTRY_STATUS_NOTHING, /* Exec has been added but doesn't * need/want testing (mainly for GUI) */ EXEC_ENTRY_STATUS_TEST, /* Exec needs testing on next pass */ EXEC_ENTRY_STATUS_TESTED /* Test has been run at specified time */ }; typedef struct _exec_entry ExecEntry; struct _exec_entry { char *fullname; /* absolute file path */ ExecEntryStatus status; int test_flags; struct stat filestat; struct timeval testtime; DLIST_ENTRY(_exec_entry) link; }; typedef struct _test_entry TestEntry; struct _test_entry { pid_t pid; int status; /* as used with wait() */ char *progname; char **args; char *args_str; /* string version */ char **env; char *env_str; /* string version of extra args (ie. overrides) */ int env_flag; /* if (TRUE) - using environ and 'env' above * shouldn't be free()'d */ struct timeval tm; /* start time */ DLIST_ENTRY(_test_entry) link; }; typedef struct _thread_data THREAD_DATA; struct _thread_data { pthread_mutex_t *mut; pthread_t run_thread; pthread_t poll_thread; pthread_t tempfile_thread; int current_execs; int max_execs; }; #ifdef TRUE #undef TRUE #undef FALSE #endif #define FALSE (1 == 0) #define TRUE (!FALSE) #ifndef MAXPATHLEN #define MAXPATHLEN 1024 #endif #define FLAGS_SINGLE_ARG_TEST (1<<0) #define FLAGS_MULTIPLE_ARG_TEST (1<<1) #define FLAGS_ENV_TEST (1<<2) #define FLAGS_ALL (FLAGS_SINGLE_ARG_TEST|FLAGS_MULTIPLE_ARG_TEST|FLAGS_ENV_TEST) #endif /* __DATATYPES_H__ */ Obsidian-Covenant-bfbtester-e23fc0e/src/include/exec.h000066400000000000000000000020541511404222200227650ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: exec.h,v 1.2.2.1 2001/01/22 05:31:12 fesnel Exp $ */ #ifndef __EXEC_H__ #define __EXEC_H__ int execute_program (ExecEntry *exec_entry, char ** args, char ** env); void exec_poll (void); #define EXEC_TIMEOUT 5 /* seconds */ #endif /* __EXEC_H__ */ Obsidian-Covenant-bfbtester-e23fc0e/src/include/main.h000066400000000000000000000017601511404222200227700ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: main.h,v 1.2.2.1 2001/01/22 05:31:12 fesnel Exp $ */ #ifndef __MAIN_H__ #define __MAIN_H__ #define IDSTR "BFBTester: Brute Force Binary Tester" #define VERSTR VERSION #endif /* __MAIN_H__ */ Obsidian-Covenant-bfbtester-e23fc0e/src/include/tempfiles.h000066400000000000000000000022231511404222200240270ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: tempfiles.h,v 1.2.2.1 2001/01/22 05:31:12 fesnel Exp $ */ #ifndef __TEMPFILES_H__ #define __TEMPFILES_H__ typedef void (*TempfileCB)(char *, struct stat *, void *data); int tempfile_request_add(TempfileCB create, TempfileCB remove, void *cbdata); int tempfile_request_subtract(void); void tempfile_start(THREAD_DATA *data); #endif /* __TEMPFILES_H__ */ Obsidian-Covenant-bfbtester-e23fc0e/src/include/utils.h000066400000000000000000000047071511404222200232100ustar00rootroot00000000000000/* BFBTester -- Brute Force Binary Tester Copyright (C) 2000 Mike Heffner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: utils.h,v 1.6.2.1 2001/01/22 05:31:12 fesnel Exp $ */ #ifndef __UTILS_H__ #define __UTILS_H__ typedef enum _msg_type MsgType; enum _msg_type { MSG_TYPE_ERROR_ABORT, MSG_TYPE_ERROR_WARN, MSG_TYPE_ERRNO_ABORT, MSG_TYPE_ERRNO_WARN, MSG_TYPE_MESSAGE, /* no function/line output */ MSG_TYPE_DEBUG_L1, MSG_TYPE_DEBUG_L2 }; #ifdef __GNUC__ #define bfbt_message(type, args...) \ __bfbt_message(type, __PRETTY_FUNCTION__, __LINE__, args) void __bfbt_message(MsgType type, const char *function, int line, const char *fmt, ...) __attribute__ ((format (printf, 4, 5))); #else #define bfbt_message(type, fmt, args...) \ __bfbt_message(type, __FUNCTION__, __LINE__, fmt, ##args) void __bfbt_message(MsgType type, const char *function, int line, const char *fmt, ...); #endif /* __GNUC__ */ /* Memory allocators */ #define xmalloc(a) _xmalloc(a, __FUNCTION__, __LINE__) static __inline__ void * _xmalloc(size_t size, const char *function, int line) { void *temp; temp = malloc(size); if (!temp) bfbt_message(MSG_TYPE_ERRNO_ABORT, "Malloc failed at [%s:%d]", function, line); return temp; } #define xcalloc(a, b) _xcalloc(a, b, __FUNCTION__, __LINE__) static __inline__ void * _xcalloc(size_t number, size_t size, const char *function, int line) { void *temp; temp = calloc(number, size); if (!temp) bfbt_message(MSG_TYPE_ERRNO_ABORT, "Calloc failed at [%s:%d]", function, line); return temp; } char * find_exec_in_path(char *name); char * args_to_str(char **args); char * env_to_str(char **env); char ** env_create(char **env); #endif /* __UTILS_H__ */