├── 50k-bots
├── LICENSE
├── Makefile.am
├── Makefile.in
├── README.md
├── aclocal.m4
├── browserlist.txt
├── config.guess
├── config.h.in
├── config.sub
├── configure
├── configure.ac
├── depcomp
├── install-sh
├── man
├── Makefile.am
├── Makefile.in
└── bonesi.1
├── missing
├── mkinstalldirs
├── src
├── Makefile.am
├── Makefile.in
├── bonesi.c
├── http.h
└── tcpoptions.h
└── urllist.txt
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/Makefile.am:
--------------------------------------------------------------------------------
1 | AUTOMAKE_OPTIONS = foreign
2 | SUBDIRS = src man
3 | EXTRA_DIST = 50k-bots LICENSE browserlist.txt urllist.txt
4 |
--------------------------------------------------------------------------------
/Makefile.in:
--------------------------------------------------------------------------------
1 | # Makefile.in generated by automake 1.15.1 from Makefile.am.
2 | # @configure_input@
3 |
4 | # Copyright (C) 1994-2017 Free Software Foundation, Inc.
5 |
6 | # This Makefile.in is free software; the Free Software Foundation
7 | # gives unlimited permission to copy and/or distribute it,
8 | # with or without modifications, as long as this notice is preserved.
9 |
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 | # PARTICULAR PURPOSE.
14 |
15 | @SET_MAKE@
16 | VPATH = @srcdir@
17 | am__is_gnu_make = { \
18 | if test -z '$(MAKELEVEL)'; then \
19 | false; \
20 | elif test -n '$(MAKE_HOST)'; then \
21 | true; \
22 | elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
23 | true; \
24 | else \
25 | false; \
26 | fi; \
27 | }
28 | am__make_running_with_option = \
29 | case $${target_option-} in \
30 | ?) ;; \
31 | *) echo "am__make_running_with_option: internal error: invalid" \
32 | "target option '$${target_option-}' specified" >&2; \
33 | exit 1;; \
34 | esac; \
35 | has_opt=no; \
36 | sane_makeflags=$$MAKEFLAGS; \
37 | if $(am__is_gnu_make); then \
38 | sane_makeflags=$$MFLAGS; \
39 | else \
40 | case $$MAKEFLAGS in \
41 | *\\[\ \ ]*) \
42 | bs=\\; \
43 | sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
44 | | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
45 | esac; \
46 | fi; \
47 | skip_next=no; \
48 | strip_trailopt () \
49 | { \
50 | flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
51 | }; \
52 | for flg in $$sane_makeflags; do \
53 | test $$skip_next = yes && { skip_next=no; continue; }; \
54 | case $$flg in \
55 | *=*|--*) continue;; \
56 | -*I) strip_trailopt 'I'; skip_next=yes;; \
57 | -*I?*) strip_trailopt 'I';; \
58 | -*O) strip_trailopt 'O'; skip_next=yes;; \
59 | -*O?*) strip_trailopt 'O';; \
60 | -*l) strip_trailopt 'l'; skip_next=yes;; \
61 | -*l?*) strip_trailopt 'l';; \
62 | -[dEDm]) skip_next=yes;; \
63 | -[JT]) skip_next=yes;; \
64 | esac; \
65 | case $$flg in \
66 | *$$target_option*) has_opt=yes; break;; \
67 | esac; \
68 | done; \
69 | test $$has_opt = yes
70 | am__make_dryrun = (target_option=n; $(am__make_running_with_option))
71 | am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
72 | pkgdatadir = $(datadir)/@PACKAGE@
73 | pkgincludedir = $(includedir)/@PACKAGE@
74 | pkglibdir = $(libdir)/@PACKAGE@
75 | pkglibexecdir = $(libexecdir)/@PACKAGE@
76 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
77 | install_sh_DATA = $(install_sh) -c -m 644
78 | install_sh_PROGRAM = $(install_sh) -c
79 | install_sh_SCRIPT = $(install_sh) -c
80 | INSTALL_HEADER = $(INSTALL_DATA)
81 | transform = $(program_transform_name)
82 | NORMAL_INSTALL = :
83 | PRE_INSTALL = :
84 | POST_INSTALL = :
85 | NORMAL_UNINSTALL = :
86 | PRE_UNINSTALL = :
87 | POST_UNINSTALL = :
88 | subdir = .
89 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
90 | am__aclocal_m4_deps = $(top_srcdir)/configure.ac
91 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
92 | $(ACLOCAL_M4)
93 | DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
94 | $(am__configure_deps) $(am__DIST_COMMON)
95 | am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
96 | configure.lineno config.status.lineno
97 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
98 | CONFIG_HEADER = config.h
99 | CONFIG_CLEAN_FILES =
100 | CONFIG_CLEAN_VPATH_FILES =
101 | AM_V_P = $(am__v_P_@AM_V@)
102 | am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
103 | am__v_P_0 = false
104 | am__v_P_1 = :
105 | AM_V_GEN = $(am__v_GEN_@AM_V@)
106 | am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
107 | am__v_GEN_0 = @echo " GEN " $@;
108 | am__v_GEN_1 =
109 | AM_V_at = $(am__v_at_@AM_V@)
110 | am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
111 | am__v_at_0 = @
112 | am__v_at_1 =
113 | SOURCES =
114 | DIST_SOURCES =
115 | RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
116 | ctags-recursive dvi-recursive html-recursive info-recursive \
117 | install-data-recursive install-dvi-recursive \
118 | install-exec-recursive install-html-recursive \
119 | install-info-recursive install-pdf-recursive \
120 | install-ps-recursive install-recursive installcheck-recursive \
121 | installdirs-recursive pdf-recursive ps-recursive \
122 | tags-recursive uninstall-recursive
123 | am__can_run_installinfo = \
124 | case $$AM_UPDATE_INFO_DIR in \
125 | n|no|NO) false;; \
126 | *) (install-info --version) >/dev/null 2>&1;; \
127 | esac
128 | RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
129 | distclean-recursive maintainer-clean-recursive
130 | am__recursive_targets = \
131 | $(RECURSIVE_TARGETS) \
132 | $(RECURSIVE_CLEAN_TARGETS) \
133 | $(am__extra_recursive_targets)
134 | AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
135 | cscope distdir dist dist-all distcheck
136 | am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
137 | $(LISP)config.h.in
138 | # Read a list of newline-separated strings from the standard input,
139 | # and print each of them once, without duplicates. Input order is
140 | # *not* preserved.
141 | am__uniquify_input = $(AWK) '\
142 | BEGIN { nonempty = 0; } \
143 | { items[$$0] = 1; nonempty = 1; } \
144 | END { if (nonempty) { for (i in items) print i; }; } \
145 | '
146 | # Make sure the list of sources is unique. This is necessary because,
147 | # e.g., the same source file might be shared among _SOURCES variables
148 | # for different programs/libraries.
149 | am__define_uniq_tagged_files = \
150 | list='$(am__tagged_files)'; \
151 | unique=`for i in $$list; do \
152 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
153 | done | $(am__uniquify_input)`
154 | ETAGS = etags
155 | CTAGS = ctags
156 | CSCOPE = cscope
157 | DIST_SUBDIRS = $(SUBDIRS)
158 | am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in compile \
159 | config.guess config.sub depcomp install-sh missing \
160 | mkinstalldirs
161 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
162 | distdir = $(PACKAGE)-$(VERSION)
163 | top_distdir = $(distdir)
164 | am__remove_distdir = \
165 | if test -d "$(distdir)"; then \
166 | find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
167 | && rm -rf "$(distdir)" \
168 | || { sleep 5 && rm -rf "$(distdir)"; }; \
169 | else :; fi
170 | am__post_remove_distdir = $(am__remove_distdir)
171 | am__relativize = \
172 | dir0=`pwd`; \
173 | sed_first='s,^\([^/]*\)/.*$$,\1,'; \
174 | sed_rest='s,^[^/]*/*,,'; \
175 | sed_last='s,^.*/\([^/]*\)$$,\1,'; \
176 | sed_butlast='s,/*[^/]*$$,,'; \
177 | while test -n "$$dir1"; do \
178 | first=`echo "$$dir1" | sed -e "$$sed_first"`; \
179 | if test "$$first" != "."; then \
180 | if test "$$first" = ".."; then \
181 | dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
182 | dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
183 | else \
184 | first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
185 | if test "$$first2" = "$$first"; then \
186 | dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
187 | else \
188 | dir2="../$$dir2"; \
189 | fi; \
190 | dir0="$$dir0"/"$$first"; \
191 | fi; \
192 | fi; \
193 | dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
194 | done; \
195 | reldir="$$dir2"
196 | DIST_ARCHIVES = $(distdir).tar.gz
197 | GZIP_ENV = --best
198 | DIST_TARGETS = dist-gzip
199 | distuninstallcheck_listfiles = find . -type f -print
200 | am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
201 | | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
202 | distcleancheck_listfiles = find . -type f -print
203 | ACLOCAL = @ACLOCAL@
204 | AMTAR = @AMTAR@
205 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
206 | AUTOCONF = @AUTOCONF@
207 | AUTOHEADER = @AUTOHEADER@
208 | AUTOMAKE = @AUTOMAKE@
209 | AWK = @AWK@
210 | CC = @CC@
211 | CCDEPMODE = @CCDEPMODE@
212 | CFLAGS = @CFLAGS@
213 | CPP = @CPP@
214 | CPPFLAGS = @CPPFLAGS@
215 | CYGPATH_W = @CYGPATH_W@
216 | DEFS = @DEFS@
217 | DEPDIR = @DEPDIR@
218 | ECHO_C = @ECHO_C@
219 | ECHO_N = @ECHO_N@
220 | ECHO_T = @ECHO_T@
221 | EGREP = @EGREP@
222 | EXEEXT = @EXEEXT@
223 | GREP = @GREP@
224 | INSTALL = @INSTALL@
225 | INSTALL_DATA = @INSTALL_DATA@
226 | INSTALL_PROGRAM = @INSTALL_PROGRAM@
227 | INSTALL_SCRIPT = @INSTALL_SCRIPT@
228 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
229 | LDFLAGS = @LDFLAGS@
230 | LIBOBJS = @LIBOBJS@
231 | LIBS = @LIBS@
232 | LTLIBOBJS = @LTLIBOBJS@
233 | MAKEINFO = @MAKEINFO@
234 | MKDIR_P = @MKDIR_P@
235 | OBJEXT = @OBJEXT@
236 | PACKAGE = @PACKAGE@
237 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
238 | PACKAGE_NAME = @PACKAGE_NAME@
239 | PACKAGE_STRING = @PACKAGE_STRING@
240 | PACKAGE_TARNAME = @PACKAGE_TARNAME@
241 | PACKAGE_URL = @PACKAGE_URL@
242 | PACKAGE_VERSION = @PACKAGE_VERSION@
243 | PATH_SEPARATOR = @PATH_SEPARATOR@
244 | SET_MAKE = @SET_MAKE@
245 | SHELL = @SHELL@
246 | STRIP = @STRIP@
247 | VERSION = @VERSION@
248 | abs_builddir = @abs_builddir@
249 | abs_srcdir = @abs_srcdir@
250 | abs_top_builddir = @abs_top_builddir@
251 | abs_top_srcdir = @abs_top_srcdir@
252 | ac_ct_CC = @ac_ct_CC@
253 | am__include = @am__include@
254 | am__leading_dot = @am__leading_dot@
255 | am__quote = @am__quote@
256 | am__tar = @am__tar@
257 | am__untar = @am__untar@
258 | bindir = @bindir@
259 | build_alias = @build_alias@
260 | builddir = @builddir@
261 | datadir = @datadir@
262 | datarootdir = @datarootdir@
263 | docdir = @docdir@
264 | dvidir = @dvidir@
265 | exec_prefix = @exec_prefix@
266 | host_alias = @host_alias@
267 | htmldir = @htmldir@
268 | includedir = @includedir@
269 | infodir = @infodir@
270 | install_sh = @install_sh@
271 | libdir = @libdir@
272 | libexecdir = @libexecdir@
273 | localedir = @localedir@
274 | localstatedir = @localstatedir@
275 | mandir = @mandir@
276 | mkdir_p = @mkdir_p@
277 | oldincludedir = @oldincludedir@
278 | pdfdir = @pdfdir@
279 | prefix = @prefix@
280 | program_transform_name = @program_transform_name@
281 | psdir = @psdir@
282 | runstatedir = @runstatedir@
283 | sbindir = @sbindir@
284 | sharedstatedir = @sharedstatedir@
285 | srcdir = @srcdir@
286 | sysconfdir = @sysconfdir@
287 | target_alias = @target_alias@
288 | top_build_prefix = @top_build_prefix@
289 | top_builddir = @top_builddir@
290 | top_srcdir = @top_srcdir@
291 | AUTOMAKE_OPTIONS = foreign
292 | SUBDIRS = src man
293 | EXTRA_DIST = 50k-bots LICENSE browserlist.txt urllist.txt
294 | all: config.h
295 | $(MAKE) $(AM_MAKEFLAGS) all-recursive
296 |
297 | .SUFFIXES:
298 | am--refresh: Makefile
299 | @:
300 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
301 | @for dep in $?; do \
302 | case '$(am__configure_deps)' in \
303 | *$$dep*) \
304 | echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
305 | $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
306 | && exit 0; \
307 | exit 1;; \
308 | esac; \
309 | done; \
310 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
311 | $(am__cd) $(top_srcdir) && \
312 | $(AUTOMAKE) --foreign Makefile
313 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
314 | @case '$?' in \
315 | *config.status*) \
316 | echo ' $(SHELL) ./config.status'; \
317 | $(SHELL) ./config.status;; \
318 | *) \
319 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
320 | cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
321 | esac;
322 |
323 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
324 | $(SHELL) ./config.status --recheck
325 |
326 | $(top_srcdir)/configure: $(am__configure_deps)
327 | $(am__cd) $(srcdir) && $(AUTOCONF)
328 | $(ACLOCAL_M4): $(am__aclocal_m4_deps)
329 | $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
330 | $(am__aclocal_m4_deps):
331 |
332 | config.h: stamp-h1
333 | @test -f $@ || rm -f stamp-h1
334 | @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
335 |
336 | stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
337 | @rm -f stamp-h1
338 | cd $(top_builddir) && $(SHELL) ./config.status config.h
339 | $(srcdir)/config.h.in: $(am__configure_deps)
340 | ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
341 | rm -f stamp-h1
342 | touch $@
343 |
344 | distclean-hdr:
345 | -rm -f config.h stamp-h1
346 |
347 | # This directory's subdirectories are mostly independent; you can cd
348 | # into them and run 'make' without going through this Makefile.
349 | # To change the values of 'make' variables: instead of editing Makefiles,
350 | # (1) if the variable is set in 'config.status', edit 'config.status'
351 | # (which will cause the Makefiles to be regenerated when you run 'make');
352 | # (2) otherwise, pass the desired values on the 'make' command line.
353 | $(am__recursive_targets):
354 | @fail=; \
355 | if $(am__make_keepgoing); then \
356 | failcom='fail=yes'; \
357 | else \
358 | failcom='exit 1'; \
359 | fi; \
360 | dot_seen=no; \
361 | target=`echo $@ | sed s/-recursive//`; \
362 | case "$@" in \
363 | distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
364 | *) list='$(SUBDIRS)' ;; \
365 | esac; \
366 | for subdir in $$list; do \
367 | echo "Making $$target in $$subdir"; \
368 | if test "$$subdir" = "."; then \
369 | dot_seen=yes; \
370 | local_target="$$target-am"; \
371 | else \
372 | local_target="$$target"; \
373 | fi; \
374 | ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
375 | || eval $$failcom; \
376 | done; \
377 | if test "$$dot_seen" = "no"; then \
378 | $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
379 | fi; test -z "$$fail"
380 |
381 | ID: $(am__tagged_files)
382 | $(am__define_uniq_tagged_files); mkid -fID $$unique
383 | tags: tags-recursive
384 | TAGS: tags
385 |
386 | tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
387 | set x; \
388 | here=`pwd`; \
389 | if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
390 | include_option=--etags-include; \
391 | empty_fix=.; \
392 | else \
393 | include_option=--include; \
394 | empty_fix=; \
395 | fi; \
396 | list='$(SUBDIRS)'; for subdir in $$list; do \
397 | if test "$$subdir" = .; then :; else \
398 | test ! -f $$subdir/TAGS || \
399 | set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
400 | fi; \
401 | done; \
402 | $(am__define_uniq_tagged_files); \
403 | shift; \
404 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
405 | test -n "$$unique" || unique=$$empty_fix; \
406 | if test $$# -gt 0; then \
407 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
408 | "$$@" $$unique; \
409 | else \
410 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
411 | $$unique; \
412 | fi; \
413 | fi
414 | ctags: ctags-recursive
415 |
416 | CTAGS: ctags
417 | ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
418 | $(am__define_uniq_tagged_files); \
419 | test -z "$(CTAGS_ARGS)$$unique" \
420 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
421 | $$unique
422 |
423 | GTAGS:
424 | here=`$(am__cd) $(top_builddir) && pwd` \
425 | && $(am__cd) $(top_srcdir) \
426 | && gtags -i $(GTAGS_ARGS) "$$here"
427 | cscope: cscope.files
428 | test ! -s cscope.files \
429 | || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
430 | clean-cscope:
431 | -rm -f cscope.files
432 | cscope.files: clean-cscope cscopelist
433 | cscopelist: cscopelist-recursive
434 |
435 | cscopelist-am: $(am__tagged_files)
436 | list='$(am__tagged_files)'; \
437 | case "$(srcdir)" in \
438 | [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
439 | *) sdir=$(subdir)/$(srcdir) ;; \
440 | esac; \
441 | for i in $$list; do \
442 | if test -f "$$i"; then \
443 | echo "$(subdir)/$$i"; \
444 | else \
445 | echo "$$sdir/$$i"; \
446 | fi; \
447 | done >> $(top_builddir)/cscope.files
448 |
449 | distclean-tags:
450 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
451 | -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
452 |
453 | distdir: $(DISTFILES)
454 | $(am__remove_distdir)
455 | test -d "$(distdir)" || mkdir "$(distdir)"
456 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
457 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
458 | list='$(DISTFILES)'; \
459 | dist_files=`for file in $$list; do echo $$file; done | \
460 | sed -e "s|^$$srcdirstrip/||;t" \
461 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
462 | case $$dist_files in \
463 | */*) $(MKDIR_P) `echo "$$dist_files" | \
464 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
465 | sort -u` ;; \
466 | esac; \
467 | for file in $$dist_files; do \
468 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
469 | if test -d $$d/$$file; then \
470 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
471 | if test -d "$(distdir)/$$file"; then \
472 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
473 | fi; \
474 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
475 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
476 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
477 | fi; \
478 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
479 | else \
480 | test -f "$(distdir)/$$file" \
481 | || cp -p $$d/$$file "$(distdir)/$$file" \
482 | || exit 1; \
483 | fi; \
484 | done
485 | @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
486 | if test "$$subdir" = .; then :; else \
487 | $(am__make_dryrun) \
488 | || test -d "$(distdir)/$$subdir" \
489 | || $(MKDIR_P) "$(distdir)/$$subdir" \
490 | || exit 1; \
491 | dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
492 | $(am__relativize); \
493 | new_distdir=$$reldir; \
494 | dir1=$$subdir; dir2="$(top_distdir)"; \
495 | $(am__relativize); \
496 | new_top_distdir=$$reldir; \
497 | echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
498 | echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
499 | ($(am__cd) $$subdir && \
500 | $(MAKE) $(AM_MAKEFLAGS) \
501 | top_distdir="$$new_top_distdir" \
502 | distdir="$$new_distdir" \
503 | am__remove_distdir=: \
504 | am__skip_length_check=: \
505 | am__skip_mode_fix=: \
506 | distdir) \
507 | || exit 1; \
508 | fi; \
509 | done
510 | -test -n "$(am__skip_mode_fix)" \
511 | || find "$(distdir)" -type d ! -perm -755 \
512 | -exec chmod u+rwx,go+rx {} \; -o \
513 | ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
514 | ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
515 | ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
516 | || chmod -R a+r "$(distdir)"
517 | dist-gzip: distdir
518 | tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
519 | $(am__post_remove_distdir)
520 |
521 | dist-bzip2: distdir
522 | tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
523 | $(am__post_remove_distdir)
524 |
525 | dist-lzip: distdir
526 | tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
527 | $(am__post_remove_distdir)
528 |
529 | dist-xz: distdir
530 | tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
531 | $(am__post_remove_distdir)
532 |
533 | dist-tarZ: distdir
534 | @echo WARNING: "Support for distribution archives compressed with" \
535 | "legacy program 'compress' is deprecated." >&2
536 | @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
537 | tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
538 | $(am__post_remove_distdir)
539 |
540 | dist-shar: distdir
541 | @echo WARNING: "Support for shar distribution archives is" \
542 | "deprecated." >&2
543 | @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
544 | shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
545 | $(am__post_remove_distdir)
546 |
547 | dist-zip: distdir
548 | -rm -f $(distdir).zip
549 | zip -rq $(distdir).zip $(distdir)
550 | $(am__post_remove_distdir)
551 |
552 | dist dist-all:
553 | $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
554 | $(am__post_remove_distdir)
555 |
556 | # This target untars the dist file and tries a VPATH configuration. Then
557 | # it guarantees that the distribution is self-contained by making another
558 | # tarfile.
559 | distcheck: dist
560 | case '$(DIST_ARCHIVES)' in \
561 | *.tar.gz*) \
562 | eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
563 | *.tar.bz2*) \
564 | bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
565 | *.tar.lz*) \
566 | lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
567 | *.tar.xz*) \
568 | xz -dc $(distdir).tar.xz | $(am__untar) ;;\
569 | *.tar.Z*) \
570 | uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
571 | *.shar.gz*) \
572 | eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
573 | *.zip*) \
574 | unzip $(distdir).zip ;;\
575 | esac
576 | chmod -R a-w $(distdir)
577 | chmod u+w $(distdir)
578 | mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
579 | chmod a-w $(distdir)
580 | test -d $(distdir)/_build || exit 0; \
581 | dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
582 | && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
583 | && am__cwd=`pwd` \
584 | && $(am__cd) $(distdir)/_build/sub \
585 | && ../../configure \
586 | $(AM_DISTCHECK_CONFIGURE_FLAGS) \
587 | $(DISTCHECK_CONFIGURE_FLAGS) \
588 | --srcdir=../.. --prefix="$$dc_install_base" \
589 | && $(MAKE) $(AM_MAKEFLAGS) \
590 | && $(MAKE) $(AM_MAKEFLAGS) dvi \
591 | && $(MAKE) $(AM_MAKEFLAGS) check \
592 | && $(MAKE) $(AM_MAKEFLAGS) install \
593 | && $(MAKE) $(AM_MAKEFLAGS) installcheck \
594 | && $(MAKE) $(AM_MAKEFLAGS) uninstall \
595 | && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
596 | distuninstallcheck \
597 | && chmod -R a-w "$$dc_install_base" \
598 | && ({ \
599 | (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
600 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
601 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
602 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
603 | distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
604 | } || { rm -rf "$$dc_destdir"; exit 1; }) \
605 | && rm -rf "$$dc_destdir" \
606 | && $(MAKE) $(AM_MAKEFLAGS) dist \
607 | && rm -rf $(DIST_ARCHIVES) \
608 | && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
609 | && cd "$$am__cwd" \
610 | || exit 1
611 | $(am__post_remove_distdir)
612 | @(echo "$(distdir) archives ready for distribution: "; \
613 | list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
614 | sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
615 | distuninstallcheck:
616 | @test -n '$(distuninstallcheck_dir)' || { \
617 | echo 'ERROR: trying to run $@ with an empty' \
618 | '$$(distuninstallcheck_dir)' >&2; \
619 | exit 1; \
620 | }; \
621 | $(am__cd) '$(distuninstallcheck_dir)' || { \
622 | echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
623 | exit 1; \
624 | }; \
625 | test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
626 | || { echo "ERROR: files left after uninstall:" ; \
627 | if test -n "$(DESTDIR)"; then \
628 | echo " (check DESTDIR support)"; \
629 | fi ; \
630 | $(distuninstallcheck_listfiles) ; \
631 | exit 1; } >&2
632 | distcleancheck: distclean
633 | @if test '$(srcdir)' = . ; then \
634 | echo "ERROR: distcleancheck can only run from a VPATH build" ; \
635 | exit 1 ; \
636 | fi
637 | @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
638 | || { echo "ERROR: files left in build directory after distclean:" ; \
639 | $(distcleancheck_listfiles) ; \
640 | exit 1; } >&2
641 | check-am: all-am
642 | check: check-recursive
643 | all-am: Makefile config.h
644 | installdirs: installdirs-recursive
645 | installdirs-am:
646 | install: install-recursive
647 | install-exec: install-exec-recursive
648 | install-data: install-data-recursive
649 | uninstall: uninstall-recursive
650 |
651 | install-am: all-am
652 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
653 |
654 | installcheck: installcheck-recursive
655 | install-strip:
656 | if test -z '$(STRIP)'; then \
657 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
658 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
659 | install; \
660 | else \
661 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
662 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
663 | "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
664 | fi
665 | mostlyclean-generic:
666 |
667 | clean-generic:
668 |
669 | distclean-generic:
670 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
671 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
672 |
673 | maintainer-clean-generic:
674 | @echo "This command is intended for maintainers to use"
675 | @echo "it deletes files that may require special tools to rebuild."
676 | clean: clean-recursive
677 |
678 | clean-am: clean-generic mostlyclean-am
679 |
680 | distclean: distclean-recursive
681 | -rm -f $(am__CONFIG_DISTCLEAN_FILES)
682 | -rm -f Makefile
683 | distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
684 |
685 | dvi: dvi-recursive
686 |
687 | dvi-am:
688 |
689 | html: html-recursive
690 |
691 | html-am:
692 |
693 | info: info-recursive
694 |
695 | info-am:
696 |
697 | install-data-am:
698 |
699 | install-dvi: install-dvi-recursive
700 |
701 | install-dvi-am:
702 |
703 | install-exec-am:
704 |
705 | install-html: install-html-recursive
706 |
707 | install-html-am:
708 |
709 | install-info: install-info-recursive
710 |
711 | install-info-am:
712 |
713 | install-man:
714 |
715 | install-pdf: install-pdf-recursive
716 |
717 | install-pdf-am:
718 |
719 | install-ps: install-ps-recursive
720 |
721 | install-ps-am:
722 |
723 | installcheck-am:
724 |
725 | maintainer-clean: maintainer-clean-recursive
726 | -rm -f $(am__CONFIG_DISTCLEAN_FILES)
727 | -rm -rf $(top_srcdir)/autom4te.cache
728 | -rm -f Makefile
729 | maintainer-clean-am: distclean-am maintainer-clean-generic
730 |
731 | mostlyclean: mostlyclean-recursive
732 |
733 | mostlyclean-am: mostlyclean-generic
734 |
735 | pdf: pdf-recursive
736 |
737 | pdf-am:
738 |
739 | ps: ps-recursive
740 |
741 | ps-am:
742 |
743 | uninstall-am:
744 |
745 | .MAKE: $(am__recursive_targets) all install-am install-strip
746 |
747 | .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
748 | am--refresh check check-am clean clean-cscope clean-generic \
749 | cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
750 | dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
751 | distcheck distclean distclean-generic distclean-hdr \
752 | distclean-tags distcleancheck distdir distuninstallcheck dvi \
753 | dvi-am html html-am info info-am install install-am \
754 | install-data install-data-am install-dvi install-dvi-am \
755 | install-exec install-exec-am install-html install-html-am \
756 | install-info install-info-am install-man install-pdf \
757 | install-pdf-am install-ps install-ps-am install-strip \
758 | installcheck installcheck-am installdirs installdirs-am \
759 | maintainer-clean maintainer-clean-generic mostlyclean \
760 | mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
761 | uninstall-am
762 |
763 | .PRECIOUS: Makefile
764 |
765 |
766 | # Tell versions [3.59,3.63) of GNU make to not export all variables.
767 | # Otherwise a system limit (for SysV at least) may be exceeded.
768 | .NOEXPORT:
769 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | BoNeSi
2 | ======
3 |
4 | **BoNeSi**, the DDoS Botnet Simulator is a Tool to simulate Botnet Traffic in a testbed environment on the wire. It is designed to study the effect of DDoS attacks.
5 |
6 | _What traffic can be generated?_
7 | **BoNeSi** generates ICMP, UDP and TCP (HTTP) flooding attacks from a defined botnet size (different IP addresses). **BoNeSi** is highly configurable and rates, data volume, source IP addresses, URLs and other parameters can be configured.
8 |
9 | _What makes it different from other tools?_
10 | There are plenty of other tools out there to spoof IP addresses with UDP and ICMP, but for TCP spoofing, there is no solution. **BoNeSi** is the first tool to simulate HTTP-GET floods from large-scale bot networks. **BoNeSi** also tries to avoid to generate packets with easy identifiable patterns (which can be filtered out easily).
11 |
12 | _Where can I run **BoNeSi**?_
13 | We highly recommend to run **BoNeSi** in a closed testbed environment. However, UDP and ICMP attacks could be run in the internet as well, but you should be carefull. HTTP-Flooding attacks can not be simulated in the internet, because answers from the webserver must be routed back to the host running **BoNeSi**.
14 |
15 | _How does TCP Spoofing work?_
16 | **BoNeSi** sniffs for TCP packets on the network interface and responds to all packets in order to establish TCP connections. For this feature, it is necessary, that all traffic from the target webserver is routed back to the host running **BoNeSi**
17 |
18 | _How good is the perfomance of **BoNeSi**?_
19 | We focused very much on performance in order to simulate big botnets. On an AMD Opteron with 2Ghz we were able to generate up to 150,000 packets per second. On a more recent AMD Phenom II X6 1100T with 3.3Ghz you can generate 300,000 pps (running on 2 cores).
20 |
21 | _Are **BoNeSi** attacks successful?_
22 | Yes, they are very successful. UDP/ ICMP attacks can easily fill the bandwidth and HTTP-Flooding attacks knock out webservers fast. We also tested **BoNeSi** against state-of-the-art commercial DDoS mitigation systems and where able to either crash them or hiding the attack from being detected.
23 |
24 | A demo video of BoNeSi in action can be found here.
25 |
26 | Detailed Information
27 | --------------------
28 |
29 | BoNeSi is a network traffic generator for different protocol types.
30 | The attributes of the created packets and connections can be controlled by
31 | several parameters like send rate or payload size or they are determined by chance.
32 | It spoofs the source ip addresses even when generating tcp traffic. Therefor it
33 | includes a simple tcp-stack to handle tcp connections in promiscuous mode.
34 | For correct work, one has to ensure that the response packets are routed to the
35 | host at which BoNeSi is running. Therefore BoNeSi cannot used in arbitrary
36 | network infrastructures.
37 | The most advanced kind of traffic that can be generated are http requests.
38 |
39 | **TCP/HTTP**
40 | In order to make the http requests more realistic, several things are determined
41 | by chance:
42 | - source port
43 | - ttl: 3..255
44 | - tcp options: out of seven different real life options
45 | with different lengths and probabilities
46 | - user agent for http header: out of a by file given list
47 | (an example file is included, see below)
48 |
49 |
50 | Copyright 2006-2007 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz
51 | This is free software. Licensed under the Apache License, Version 2.0.
52 | There is NO WARRANTY, to the extent permitted by law.
53 |
54 |
55 | Installation
56 | ------------
57 |
58 | :~$ ./configure
59 | :~$ make
60 | :~$ make install
61 |
62 |
63 | Usage
64 | -----
65 |
66 | :~$ bonesi [OPTION...]
67 |
68 | Options:
69 |
70 | -i, --ips=FILENAME filename with ip list
71 | -p, --protocol=PROTO udp (default), icmp or tcp
72 | -r, --send_rate=NUM packets per second, 0 = infinite (default)
73 | -s, --payload_size=SIZE size of the paylod, (default: 32)
74 | -o, --stats_file=FILENAME filename for the statistics, (default: 'stats')
75 | -c, --max_packets=NUM maximum number of packets (requests at tcp/http), 0 = infinite (default)
76 | --integer IPs are integers in host byte order instead of in dotted notation
77 | -t, --max_bots=NUM determine max_bots in the 24bit prefix randomly (1-256)
78 | -u, --url=URL the url (default: '/') (only for tcp/http)
79 | -l, --url_list=FILENAME filename with url list (only for tcp/http)
80 | -b, --useragent_list=FILENAME filename with useragent list (only for tcp/http)
81 | -d, --device=DEVICE network listening device (only for tcp/http, e.g. eth1)
82 | -m, --mtu=NUM set MTU, (default 1500). Currently only when using TCP.
83 | -f, --frag=NUM set fragmentation mode (0=IP, 1=TCP, default: 0). Currently only when using TCP.
84 | -v, --verbose print additional debug messages
85 | -h, --help print help message and exit
86 |
87 |
88 | Additionally Included Example Files
89 | -----------------------------------
90 |
91 | 50k-bots
92 | * 50,000 ip addresses generated randomly to use with --ips option
93 |
94 | browserlist.txt
95 | * several browser identifications to use with --useragentlist option
96 |
97 | urllist.txt
98 | * several urls to use with --urllist option
99 |
100 | Copyright/ License/ Credits
101 | ---------------------------
102 |
103 | Copyright 2006-2007 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz
104 | Copyright 2008-2015 Markus Goldstein
105 |
106 | This is free software. Licensed under the [Apache License, Version 2.0](LICENSE).
107 | There is NO WARRANTY, to the extent permitted by law.
108 |
109 | 
110 |
111 |
--------------------------------------------------------------------------------
/browserlist.txt:
--------------------------------------------------------------------------------
1 | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.8) Gecko/20071004 Iceweasel/2.0.0.8 (Debian-2.0.0.6+2.0.0.8-Oetch1)
2 | Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1
3 | Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
4 | Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)
5 | Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; {1C69E7AA-C14E-200E-5A77-8EAB2D667A07})
6 | Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; acc=baadshah; acc=none; freenet DSL 1.1; (none))
7 | Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
8 | Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.51
9 | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1
10 | Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; snprtz|S26320700000083|2600#Service Pack 1#2#5#154321|isdn)
11 | Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Alexa Toolbar; mxie; .NET CLR 1.1.4322)
12 | Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; fr-FR; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
13 | Mozilla/5.0 (Macintosh; U; PPC Mac OS X; ja-jp) AppleWebKit/417.9 (KHTML, like Gecko) Safari/417.8
14 | Opera/9.00 (Windows NT 5.1; U; en)
15 | Mozilla/3.01 (compatible;)
16 | Mozilla/5.0 (Windows; U; Windows NT 5.0; ja-JP; rv:1.7.12) Gecko/20050919 Firefox/1.0.7
17 | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20051010 Firefox/1.0.7 (Ubuntu package 1.0.7)
18 |
--------------------------------------------------------------------------------
/config.h.in:
--------------------------------------------------------------------------------
1 | /* config.h.in. Generated from configure.ac by autoheader. */
2 |
3 | /* Define to 1 if you have the `bzero' function. */
4 | #undef HAVE_BZERO
5 |
6 | /* Define to 1 if you have the `gettimeofday' function. */
7 | #undef HAVE_GETTIMEOFDAY
8 |
9 | /* Define to 1 if you have the header file. */
10 | #undef HAVE_INTTYPES_H
11 |
12 | /* Define to 1 if you have the `net' library (-lnet). */
13 | #undef HAVE_LIBNET
14 |
15 | /* Define to 1 if you have the header file. */
16 | #undef HAVE_LIBNET_H
17 |
18 | /* Define to 1 if you have the `pcap' library (-lpcap). */
19 | #undef HAVE_LIBPCAP
20 |
21 | /* Define to 1 if you have the `pthread' library (-lpthread). */
22 | #undef HAVE_LIBPTHREAD
23 |
24 | /* Define to 1 if your system has a GNU libc compatible `malloc' function, and
25 | to 0 otherwise. */
26 | #undef HAVE_MALLOC
27 |
28 | /* Define to 1 if you have the header file. */
29 | #undef HAVE_MEMORY_H
30 |
31 | /* Define to 1 if you have the header file. */
32 | #undef HAVE_PCAP_H
33 |
34 | /* Define to 1 if you have the header file. */
35 | #undef HAVE_PTHREAD_H
36 |
37 | /* Define to 1 if you have the header file. */
38 | #undef HAVE_STDINT_H
39 |
40 | /* Define to 1 if you have the header file. */
41 | #undef HAVE_STDLIB_H
42 |
43 | /* Define to 1 if you have the header file. */
44 | #undef HAVE_STRINGS_H
45 |
46 | /* Define to 1 if you have the header file. */
47 | #undef HAVE_STRING_H
48 |
49 | /* Define to 1 if you have the `strncasecmp' function. */
50 | #undef HAVE_STRNCASECMP
51 |
52 | /* Define to 1 if you have the `strrchr' function. */
53 | #undef HAVE_STRRCHR
54 |
55 | /* Define to 1 if you have the header file. */
56 | #undef HAVE_SYS_STAT_H
57 |
58 | /* Define to 1 if you have the header file. */
59 | #undef HAVE_SYS_TYPES_H
60 |
61 | /* Define to 1 if you have the header file. */
62 | #undef HAVE_UNISTD_H
63 |
64 | /* Name of package */
65 | #undef PACKAGE
66 |
67 | /* Define to the address where bug reports for this package should be sent. */
68 | #undef PACKAGE_BUGREPORT
69 |
70 | /* Define to the full name of this package. */
71 | #undef PACKAGE_NAME
72 |
73 | /* Define to the full name and version of this package. */
74 | #undef PACKAGE_STRING
75 |
76 | /* Define to the one symbol short name of this package. */
77 | #undef PACKAGE_TARNAME
78 |
79 | /* Define to the home page for this package. */
80 | #undef PACKAGE_URL
81 |
82 | /* Define to the version of this package. */
83 | #undef PACKAGE_VERSION
84 |
85 | /* Define to 1 if you have the ANSI C header files. */
86 | #undef STDC_HEADERS
87 |
88 | /* Define to 1 if you can safely include both and . */
89 | #undef TIME_WITH_SYS_TIME
90 |
91 | /* Version number of package */
92 | #undef VERSION
93 |
94 | /* Define for Solaris 2.5.1 so the uint32_t typedef from ,
95 | , or is not used. If the typedef were allowed, the
96 | #define below would cause a syntax error. */
97 | #undef _UINT32_T
98 |
99 | /* Define to empty if `const' does not conform to ANSI C. */
100 | #undef const
101 |
102 | /* Define to `__inline__' or `__inline' if that's what the C compiler
103 | calls it, or to nothing if 'inline' is not supported under any name. */
104 | #ifndef __cplusplus
105 | #undef inline
106 | #endif
107 |
108 | /* Define to rpl_malloc if the replacement function should be used. */
109 | #undef malloc
110 |
111 | /* Define to `unsigned int' if does not define. */
112 | #undef size_t
113 |
114 | /* Define to `int' if does not define. */
115 | #undef ssize_t
116 |
117 | /* Define to the type of an unsigned integer type of width exactly 32 bits if
118 | such a type exists and the standard includes do not define it. */
119 | #undef uint32_t
120 |
--------------------------------------------------------------------------------
/config.sub:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # Configuration validation subroutine script.
3 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
5 | # Inc.
6 |
7 | timestamp='2006-07-02'
8 |
9 | # This file is (in principle) common to ALL GNU software.
10 | # The presence of a machine in this file suggests that SOME GNU software
11 | # can handle that machine. It does not imply ALL GNU software can.
12 | #
13 | # This file is free software; you can redistribute it and/or modify
14 | # it under the terms of the GNU General Public License as published by
15 | # the Free Software Foundation; either version 2 of the License, or
16 | # (at your option) any later version.
17 | #
18 | # This program is distributed in the hope that it will be useful,
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | # GNU General Public License for more details.
22 | #
23 | # You should have received a copy of the GNU General Public License
24 | # along with this program; if not, write to the Free Software
25 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
26 | # 02110-1301, USA.
27 | #
28 | # As a special exception to the GNU General Public License, if you
29 | # distribute this file as part of a program that contains a
30 | # configuration script generated by Autoconf, you may include it under
31 | # the same distribution terms that you use for the rest of that program.
32 |
33 |
34 | # Please send patches to . Submit a context
35 | # diff and a properly formatted ChangeLog entry.
36 | #
37 | # Configuration subroutine to validate and canonicalize a configuration type.
38 | # Supply the specified configuration type as an argument.
39 | # If it is invalid, we print an error message on stderr and exit with code 1.
40 | # Otherwise, we print the canonical config type on stdout and succeed.
41 |
42 | # This file is supposed to be the same for all GNU packages
43 | # and recognize all the CPU types, system types and aliases
44 | # that are meaningful with *any* GNU software.
45 | # Each package is responsible for reporting which valid configurations
46 | # it does not support. The user should be able to distinguish
47 | # a failure to support a valid configuration from a meaningless
48 | # configuration.
49 |
50 | # The goal of this file is to map all the various variations of a given
51 | # machine specification into a single specification in the form:
52 | # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
53 | # or in some cases, the newer four-part form:
54 | # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
55 | # It is wrong to echo any other type of specification.
56 |
57 | me=`echo "$0" | sed -e 's,.*/,,'`
58 |
59 | usage="\
60 | Usage: $0 [OPTION] CPU-MFR-OPSYS
61 | $0 [OPTION] ALIAS
62 |
63 | Canonicalize a configuration name.
64 |
65 | Operation modes:
66 | -h, --help print this help, then exit
67 | -t, --time-stamp print date of last modification, then exit
68 | -v, --version print version number, then exit
69 |
70 | Report bugs and patches to ."
71 |
72 | version="\
73 | GNU config.sub ($timestamp)
74 |
75 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
76 | Free Software Foundation, Inc.
77 |
78 | This is free software; see the source for copying conditions. There is NO
79 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
80 |
81 | help="
82 | Try \`$me --help' for more information."
83 |
84 | # Parse command line
85 | while test $# -gt 0 ; do
86 | case $1 in
87 | --time-stamp | --time* | -t )
88 | echo "$timestamp" ; exit ;;
89 | --version | -v )
90 | echo "$version" ; exit ;;
91 | --help | --h* | -h )
92 | echo "$usage"; exit ;;
93 | -- ) # Stop option processing
94 | shift; break ;;
95 | - ) # Use stdin as input.
96 | break ;;
97 | -* )
98 | echo "$me: invalid option $1$help"
99 | exit 1 ;;
100 |
101 | *local*)
102 | # First pass through any local machine types.
103 | echo $1
104 | exit ;;
105 |
106 | * )
107 | break ;;
108 | esac
109 | done
110 |
111 | case $# in
112 | 0) echo "$me: missing argument$help" >&2
113 | exit 1;;
114 | 1) ;;
115 | *) echo "$me: too many arguments$help" >&2
116 | exit 1;;
117 | esac
118 |
119 | # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
120 | # Here we must recognize all the valid KERNEL-OS combinations.
121 | maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
122 | case $maybe_os in
123 | nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
124 | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
125 | storm-chaos* | os2-emx* | rtmk-nova*)
126 | os=-$maybe_os
127 | basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
128 | ;;
129 | *)
130 | basic_machine=`echo $1 | sed 's/-[^-]*$//'`
131 | if [ $basic_machine != $1 ]
132 | then os=`echo $1 | sed 's/.*-/-/'`
133 | else os=; fi
134 | ;;
135 | esac
136 |
137 | ### Let's recognize common machines as not being operating systems so
138 | ### that things like config.sub decstation-3100 work. We also
139 | ### recognize some manufacturers as not being operating systems, so we
140 | ### can provide default operating systems below.
141 | case $os in
142 | -sun*os*)
143 | # Prevent following clause from handling this invalid input.
144 | ;;
145 | -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
146 | -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
147 | -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
148 | -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
149 | -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
150 | -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
151 | -apple | -axis | -knuth | -cray)
152 | os=
153 | basic_machine=$1
154 | ;;
155 | -sim | -cisco | -oki | -wec | -winbond)
156 | os=
157 | basic_machine=$1
158 | ;;
159 | -scout)
160 | ;;
161 | -wrs)
162 | os=-vxworks
163 | basic_machine=$1
164 | ;;
165 | -chorusos*)
166 | os=-chorusos
167 | basic_machine=$1
168 | ;;
169 | -chorusrdb)
170 | os=-chorusrdb
171 | basic_machine=$1
172 | ;;
173 | -hiux*)
174 | os=-hiuxwe2
175 | ;;
176 | -sco6)
177 | os=-sco5v6
178 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
179 | ;;
180 | -sco5)
181 | os=-sco3.2v5
182 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
183 | ;;
184 | -sco4)
185 | os=-sco3.2v4
186 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
187 | ;;
188 | -sco3.2.[4-9]*)
189 | os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
190 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
191 | ;;
192 | -sco3.2v[4-9]*)
193 | # Don't forget version if it is 3.2v4 or newer.
194 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
195 | ;;
196 | -sco5v6*)
197 | # Don't forget version if it is 3.2v4 or newer.
198 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
199 | ;;
200 | -sco*)
201 | os=-sco3.2v2
202 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
203 | ;;
204 | -udk*)
205 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
206 | ;;
207 | -isc)
208 | os=-isc2.2
209 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
210 | ;;
211 | -clix*)
212 | basic_machine=clipper-intergraph
213 | ;;
214 | -isc*)
215 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
216 | ;;
217 | -lynx*)
218 | os=-lynxos
219 | ;;
220 | -ptx*)
221 | basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
222 | ;;
223 | -windowsnt*)
224 | os=`echo $os | sed -e 's/windowsnt/winnt/'`
225 | ;;
226 | -psos*)
227 | os=-psos
228 | ;;
229 | -mint | -mint[0-9]*)
230 | basic_machine=m68k-atari
231 | os=-mint
232 | ;;
233 | esac
234 |
235 | # Decode aliases for certain CPU-COMPANY combinations.
236 | case $basic_machine in
237 | # Recognize the basic CPU types without company name.
238 | # Some are omitted here because they have special meanings below.
239 | 1750a | 580 \
240 | | a29k \
241 | | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
242 | | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
243 | | am33_2.0 \
244 | | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
245 | | bfin \
246 | | c4x | clipper \
247 | | d10v | d30v | dlx | dsp16xx \
248 | | fr30 | frv \
249 | | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
250 | | i370 | i860 | i960 | ia64 \
251 | | ip2k | iq2000 \
252 | | m32c | m32r | m32rle | m68000 | m68k | m88k \
253 | | maxq | mb | microblaze | mcore \
254 | | mips | mipsbe | mipseb | mipsel | mipsle \
255 | | mips16 \
256 | | mips64 | mips64el \
257 | | mips64vr | mips64vrel \
258 | | mips64orion | mips64orionel \
259 | | mips64vr4100 | mips64vr4100el \
260 | | mips64vr4300 | mips64vr4300el \
261 | | mips64vr5000 | mips64vr5000el \
262 | | mips64vr5900 | mips64vr5900el \
263 | | mipsisa32 | mipsisa32el \
264 | | mipsisa32r2 | mipsisa32r2el \
265 | | mipsisa64 | mipsisa64el \
266 | | mipsisa64r2 | mipsisa64r2el \
267 | | mipsisa64sb1 | mipsisa64sb1el \
268 | | mipsisa64sr71k | mipsisa64sr71kel \
269 | | mipstx39 | mipstx39el \
270 | | mn10200 | mn10300 \
271 | | mt \
272 | | msp430 \
273 | | nios | nios2 \
274 | | ns16k | ns32k \
275 | | or32 \
276 | | pdp10 | pdp11 | pj | pjl \
277 | | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
278 | | pyramid \
279 | | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
280 | | sh64 | sh64le \
281 | | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
282 | | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
283 | | spu | strongarm \
284 | | tahoe | thumb | tic4x | tic80 | tron \
285 | | v850 | v850e \
286 | | we32k \
287 | | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
288 | | z8k)
289 | basic_machine=$basic_machine-unknown
290 | ;;
291 | m6811 | m68hc11 | m6812 | m68hc12)
292 | # Motorola 68HC11/12.
293 | basic_machine=$basic_machine-unknown
294 | os=-none
295 | ;;
296 | m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
297 | ;;
298 | ms1)
299 | basic_machine=mt-unknown
300 | ;;
301 |
302 | # We use `pc' rather than `unknown'
303 | # because (1) that's what they normally are, and
304 | # (2) the word "unknown" tends to confuse beginning users.
305 | i*86 | x86_64)
306 | basic_machine=$basic_machine-pc
307 | ;;
308 | # Object if more than one company name word.
309 | *-*-*)
310 | echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
311 | exit 1
312 | ;;
313 | # Recognize the basic CPU types with company name.
314 | 580-* \
315 | | a29k-* \
316 | | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
317 | | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
318 | | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
319 | | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
320 | | avr-* | avr32-* \
321 | | bfin-* | bs2000-* \
322 | | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
323 | | clipper-* | craynv-* | cydra-* \
324 | | d10v-* | d30v-* | dlx-* \
325 | | elxsi-* \
326 | | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
327 | | h8300-* | h8500-* \
328 | | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
329 | | i*86-* | i860-* | i960-* | ia64-* \
330 | | ip2k-* | iq2000-* \
331 | | m32c-* | m32r-* | m32rle-* \
332 | | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
333 | | m88110-* | m88k-* | maxq-* | mcore-* \
334 | | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
335 | | mips16-* \
336 | | mips64-* | mips64el-* \
337 | | mips64vr-* | mips64vrel-* \
338 | | mips64orion-* | mips64orionel-* \
339 | | mips64vr4100-* | mips64vr4100el-* \
340 | | mips64vr4300-* | mips64vr4300el-* \
341 | | mips64vr5000-* | mips64vr5000el-* \
342 | | mips64vr5900-* | mips64vr5900el-* \
343 | | mipsisa32-* | mipsisa32el-* \
344 | | mipsisa32r2-* | mipsisa32r2el-* \
345 | | mipsisa64-* | mipsisa64el-* \
346 | | mipsisa64r2-* | mipsisa64r2el-* \
347 | | mipsisa64sb1-* | mipsisa64sb1el-* \
348 | | mipsisa64sr71k-* | mipsisa64sr71kel-* \
349 | | mipstx39-* | mipstx39el-* \
350 | | mmix-* \
351 | | mt-* \
352 | | msp430-* \
353 | | nios-* | nios2-* \
354 | | none-* | np1-* | ns16k-* | ns32k-* \
355 | | orion-* \
356 | | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
357 | | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
358 | | pyramid-* \
359 | | romp-* | rs6000-* \
360 | | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
361 | | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
362 | | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
363 | | sparclite-* \
364 | | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
365 | | tahoe-* | thumb-* \
366 | | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
367 | | tron-* \
368 | | v850-* | v850e-* | vax-* \
369 | | we32k-* \
370 | | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
371 | | xstormy16-* | xtensa-* \
372 | | ymp-* \
373 | | z8k-*)
374 | ;;
375 | # Recognize the various machine names and aliases which stand
376 | # for a CPU type and a company and sometimes even an OS.
377 | 386bsd)
378 | basic_machine=i386-unknown
379 | os=-bsd
380 | ;;
381 | 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
382 | basic_machine=m68000-att
383 | ;;
384 | 3b*)
385 | basic_machine=we32k-att
386 | ;;
387 | a29khif)
388 | basic_machine=a29k-amd
389 | os=-udi
390 | ;;
391 | abacus)
392 | basic_machine=abacus-unknown
393 | ;;
394 | adobe68k)
395 | basic_machine=m68010-adobe
396 | os=-scout
397 | ;;
398 | alliant | fx80)
399 | basic_machine=fx80-alliant
400 | ;;
401 | altos | altos3068)
402 | basic_machine=m68k-altos
403 | ;;
404 | am29k)
405 | basic_machine=a29k-none
406 | os=-bsd
407 | ;;
408 | amd64)
409 | basic_machine=x86_64-pc
410 | ;;
411 | amd64-*)
412 | basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
413 | ;;
414 | amdahl)
415 | basic_machine=580-amdahl
416 | os=-sysv
417 | ;;
418 | amiga | amiga-*)
419 | basic_machine=m68k-unknown
420 | ;;
421 | amigaos | amigados)
422 | basic_machine=m68k-unknown
423 | os=-amigaos
424 | ;;
425 | amigaunix | amix)
426 | basic_machine=m68k-unknown
427 | os=-sysv4
428 | ;;
429 | apollo68)
430 | basic_machine=m68k-apollo
431 | os=-sysv
432 | ;;
433 | apollo68bsd)
434 | basic_machine=m68k-apollo
435 | os=-bsd
436 | ;;
437 | aux)
438 | basic_machine=m68k-apple
439 | os=-aux
440 | ;;
441 | balance)
442 | basic_machine=ns32k-sequent
443 | os=-dynix
444 | ;;
445 | c90)
446 | basic_machine=c90-cray
447 | os=-unicos
448 | ;;
449 | convex-c1)
450 | basic_machine=c1-convex
451 | os=-bsd
452 | ;;
453 | convex-c2)
454 | basic_machine=c2-convex
455 | os=-bsd
456 | ;;
457 | convex-c32)
458 | basic_machine=c32-convex
459 | os=-bsd
460 | ;;
461 | convex-c34)
462 | basic_machine=c34-convex
463 | os=-bsd
464 | ;;
465 | convex-c38)
466 | basic_machine=c38-convex
467 | os=-bsd
468 | ;;
469 | cray | j90)
470 | basic_machine=j90-cray
471 | os=-unicos
472 | ;;
473 | craynv)
474 | basic_machine=craynv-cray
475 | os=-unicosmp
476 | ;;
477 | cr16c)
478 | basic_machine=cr16c-unknown
479 | os=-elf
480 | ;;
481 | crds | unos)
482 | basic_machine=m68k-crds
483 | ;;
484 | crisv32 | crisv32-* | etraxfs*)
485 | basic_machine=crisv32-axis
486 | ;;
487 | cris | cris-* | etrax*)
488 | basic_machine=cris-axis
489 | ;;
490 | crx)
491 | basic_machine=crx-unknown
492 | os=-elf
493 | ;;
494 | da30 | da30-*)
495 | basic_machine=m68k-da30
496 | ;;
497 | decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
498 | basic_machine=mips-dec
499 | ;;
500 | decsystem10* | dec10*)
501 | basic_machine=pdp10-dec
502 | os=-tops10
503 | ;;
504 | decsystem20* | dec20*)
505 | basic_machine=pdp10-dec
506 | os=-tops20
507 | ;;
508 | delta | 3300 | motorola-3300 | motorola-delta \
509 | | 3300-motorola | delta-motorola)
510 | basic_machine=m68k-motorola
511 | ;;
512 | delta88)
513 | basic_machine=m88k-motorola
514 | os=-sysv3
515 | ;;
516 | djgpp)
517 | basic_machine=i586-pc
518 | os=-msdosdjgpp
519 | ;;
520 | dpx20 | dpx20-*)
521 | basic_machine=rs6000-bull
522 | os=-bosx
523 | ;;
524 | dpx2* | dpx2*-bull)
525 | basic_machine=m68k-bull
526 | os=-sysv3
527 | ;;
528 | ebmon29k)
529 | basic_machine=a29k-amd
530 | os=-ebmon
531 | ;;
532 | elxsi)
533 | basic_machine=elxsi-elxsi
534 | os=-bsd
535 | ;;
536 | encore | umax | mmax)
537 | basic_machine=ns32k-encore
538 | ;;
539 | es1800 | OSE68k | ose68k | ose | OSE)
540 | basic_machine=m68k-ericsson
541 | os=-ose
542 | ;;
543 | fx2800)
544 | basic_machine=i860-alliant
545 | ;;
546 | genix)
547 | basic_machine=ns32k-ns
548 | ;;
549 | gmicro)
550 | basic_machine=tron-gmicro
551 | os=-sysv
552 | ;;
553 | go32)
554 | basic_machine=i386-pc
555 | os=-go32
556 | ;;
557 | h3050r* | hiux*)
558 | basic_machine=hppa1.1-hitachi
559 | os=-hiuxwe2
560 | ;;
561 | h8300hms)
562 | basic_machine=h8300-hitachi
563 | os=-hms
564 | ;;
565 | h8300xray)
566 | basic_machine=h8300-hitachi
567 | os=-xray
568 | ;;
569 | h8500hms)
570 | basic_machine=h8500-hitachi
571 | os=-hms
572 | ;;
573 | harris)
574 | basic_machine=m88k-harris
575 | os=-sysv3
576 | ;;
577 | hp300-*)
578 | basic_machine=m68k-hp
579 | ;;
580 | hp300bsd)
581 | basic_machine=m68k-hp
582 | os=-bsd
583 | ;;
584 | hp300hpux)
585 | basic_machine=m68k-hp
586 | os=-hpux
587 | ;;
588 | hp3k9[0-9][0-9] | hp9[0-9][0-9])
589 | basic_machine=hppa1.0-hp
590 | ;;
591 | hp9k2[0-9][0-9] | hp9k31[0-9])
592 | basic_machine=m68000-hp
593 | ;;
594 | hp9k3[2-9][0-9])
595 | basic_machine=m68k-hp
596 | ;;
597 | hp9k6[0-9][0-9] | hp6[0-9][0-9])
598 | basic_machine=hppa1.0-hp
599 | ;;
600 | hp9k7[0-79][0-9] | hp7[0-79][0-9])
601 | basic_machine=hppa1.1-hp
602 | ;;
603 | hp9k78[0-9] | hp78[0-9])
604 | # FIXME: really hppa2.0-hp
605 | basic_machine=hppa1.1-hp
606 | ;;
607 | hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
608 | # FIXME: really hppa2.0-hp
609 | basic_machine=hppa1.1-hp
610 | ;;
611 | hp9k8[0-9][13679] | hp8[0-9][13679])
612 | basic_machine=hppa1.1-hp
613 | ;;
614 | hp9k8[0-9][0-9] | hp8[0-9][0-9])
615 | basic_machine=hppa1.0-hp
616 | ;;
617 | hppa-next)
618 | os=-nextstep3
619 | ;;
620 | hppaosf)
621 | basic_machine=hppa1.1-hp
622 | os=-osf
623 | ;;
624 | hppro)
625 | basic_machine=hppa1.1-hp
626 | os=-proelf
627 | ;;
628 | i370-ibm* | ibm*)
629 | basic_machine=i370-ibm
630 | ;;
631 | # I'm not sure what "Sysv32" means. Should this be sysv3.2?
632 | i*86v32)
633 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
634 | os=-sysv32
635 | ;;
636 | i*86v4*)
637 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
638 | os=-sysv4
639 | ;;
640 | i*86v)
641 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
642 | os=-sysv
643 | ;;
644 | i*86sol2)
645 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
646 | os=-solaris2
647 | ;;
648 | i386mach)
649 | basic_machine=i386-mach
650 | os=-mach
651 | ;;
652 | i386-vsta | vsta)
653 | basic_machine=i386-unknown
654 | os=-vsta
655 | ;;
656 | iris | iris4d)
657 | basic_machine=mips-sgi
658 | case $os in
659 | -irix*)
660 | ;;
661 | *)
662 | os=-irix4
663 | ;;
664 | esac
665 | ;;
666 | isi68 | isi)
667 | basic_machine=m68k-isi
668 | os=-sysv
669 | ;;
670 | m88k-omron*)
671 | basic_machine=m88k-omron
672 | ;;
673 | magnum | m3230)
674 | basic_machine=mips-mips
675 | os=-sysv
676 | ;;
677 | merlin)
678 | basic_machine=ns32k-utek
679 | os=-sysv
680 | ;;
681 | mingw32)
682 | basic_machine=i386-pc
683 | os=-mingw32
684 | ;;
685 | miniframe)
686 | basic_machine=m68000-convergent
687 | ;;
688 | *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
689 | basic_machine=m68k-atari
690 | os=-mint
691 | ;;
692 | mips3*-*)
693 | basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
694 | ;;
695 | mips3*)
696 | basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
697 | ;;
698 | monitor)
699 | basic_machine=m68k-rom68k
700 | os=-coff
701 | ;;
702 | morphos)
703 | basic_machine=powerpc-unknown
704 | os=-morphos
705 | ;;
706 | msdos)
707 | basic_machine=i386-pc
708 | os=-msdos
709 | ;;
710 | ms1-*)
711 | basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
712 | ;;
713 | mvs)
714 | basic_machine=i370-ibm
715 | os=-mvs
716 | ;;
717 | ncr3000)
718 | basic_machine=i486-ncr
719 | os=-sysv4
720 | ;;
721 | netbsd386)
722 | basic_machine=i386-unknown
723 | os=-netbsd
724 | ;;
725 | netwinder)
726 | basic_machine=armv4l-rebel
727 | os=-linux
728 | ;;
729 | news | news700 | news800 | news900)
730 | basic_machine=m68k-sony
731 | os=-newsos
732 | ;;
733 | news1000)
734 | basic_machine=m68030-sony
735 | os=-newsos
736 | ;;
737 | news-3600 | risc-news)
738 | basic_machine=mips-sony
739 | os=-newsos
740 | ;;
741 | necv70)
742 | basic_machine=v70-nec
743 | os=-sysv
744 | ;;
745 | next | m*-next )
746 | basic_machine=m68k-next
747 | case $os in
748 | -nextstep* )
749 | ;;
750 | -ns2*)
751 | os=-nextstep2
752 | ;;
753 | *)
754 | os=-nextstep3
755 | ;;
756 | esac
757 | ;;
758 | nh3000)
759 | basic_machine=m68k-harris
760 | os=-cxux
761 | ;;
762 | nh[45]000)
763 | basic_machine=m88k-harris
764 | os=-cxux
765 | ;;
766 | nindy960)
767 | basic_machine=i960-intel
768 | os=-nindy
769 | ;;
770 | mon960)
771 | basic_machine=i960-intel
772 | os=-mon960
773 | ;;
774 | nonstopux)
775 | basic_machine=mips-compaq
776 | os=-nonstopux
777 | ;;
778 | np1)
779 | basic_machine=np1-gould
780 | ;;
781 | nsr-tandem)
782 | basic_machine=nsr-tandem
783 | ;;
784 | op50n-* | op60c-*)
785 | basic_machine=hppa1.1-oki
786 | os=-proelf
787 | ;;
788 | openrisc | openrisc-*)
789 | basic_machine=or32-unknown
790 | ;;
791 | os400)
792 | basic_machine=powerpc-ibm
793 | os=-os400
794 | ;;
795 | OSE68000 | ose68000)
796 | basic_machine=m68000-ericsson
797 | os=-ose
798 | ;;
799 | os68k)
800 | basic_machine=m68k-none
801 | os=-os68k
802 | ;;
803 | pa-hitachi)
804 | basic_machine=hppa1.1-hitachi
805 | os=-hiuxwe2
806 | ;;
807 | paragon)
808 | basic_machine=i860-intel
809 | os=-osf
810 | ;;
811 | pbd)
812 | basic_machine=sparc-tti
813 | ;;
814 | pbb)
815 | basic_machine=m68k-tti
816 | ;;
817 | pc532 | pc532-*)
818 | basic_machine=ns32k-pc532
819 | ;;
820 | pc98)
821 | basic_machine=i386-pc
822 | ;;
823 | pc98-*)
824 | basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
825 | ;;
826 | pentium | p5 | k5 | k6 | nexgen | viac3)
827 | basic_machine=i586-pc
828 | ;;
829 | pentiumpro | p6 | 6x86 | athlon | athlon_*)
830 | basic_machine=i686-pc
831 | ;;
832 | pentiumii | pentium2 | pentiumiii | pentium3)
833 | basic_machine=i686-pc
834 | ;;
835 | pentium4)
836 | basic_machine=i786-pc
837 | ;;
838 | pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
839 | basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
840 | ;;
841 | pentiumpro-* | p6-* | 6x86-* | athlon-*)
842 | basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
843 | ;;
844 | pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
845 | basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
846 | ;;
847 | pentium4-*)
848 | basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
849 | ;;
850 | pn)
851 | basic_machine=pn-gould
852 | ;;
853 | power) basic_machine=power-ibm
854 | ;;
855 | ppc) basic_machine=powerpc-unknown
856 | ;;
857 | ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
858 | ;;
859 | ppcle | powerpclittle | ppc-le | powerpc-little)
860 | basic_machine=powerpcle-unknown
861 | ;;
862 | ppcle-* | powerpclittle-*)
863 | basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
864 | ;;
865 | ppc64) basic_machine=powerpc64-unknown
866 | ;;
867 | ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
868 | ;;
869 | ppc64le | powerpc64little | ppc64-le | powerpc64-little)
870 | basic_machine=powerpc64le-unknown
871 | ;;
872 | ppc64le-* | powerpc64little-*)
873 | basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
874 | ;;
875 | ps2)
876 | basic_machine=i386-ibm
877 | ;;
878 | pw32)
879 | basic_machine=i586-unknown
880 | os=-pw32
881 | ;;
882 | rdos)
883 | basic_machine=i386-pc
884 | os=-rdos
885 | ;;
886 | rom68k)
887 | basic_machine=m68k-rom68k
888 | os=-coff
889 | ;;
890 | rm[46]00)
891 | basic_machine=mips-siemens
892 | ;;
893 | rtpc | rtpc-*)
894 | basic_machine=romp-ibm
895 | ;;
896 | s390 | s390-*)
897 | basic_machine=s390-ibm
898 | ;;
899 | s390x | s390x-*)
900 | basic_machine=s390x-ibm
901 | ;;
902 | sa29200)
903 | basic_machine=a29k-amd
904 | os=-udi
905 | ;;
906 | sb1)
907 | basic_machine=mipsisa64sb1-unknown
908 | ;;
909 | sb1el)
910 | basic_machine=mipsisa64sb1el-unknown
911 | ;;
912 | sei)
913 | basic_machine=mips-sei
914 | os=-seiux
915 | ;;
916 | sequent)
917 | basic_machine=i386-sequent
918 | ;;
919 | sh)
920 | basic_machine=sh-hitachi
921 | os=-hms
922 | ;;
923 | sh64)
924 | basic_machine=sh64-unknown
925 | ;;
926 | sparclite-wrs | simso-wrs)
927 | basic_machine=sparclite-wrs
928 | os=-vxworks
929 | ;;
930 | sps7)
931 | basic_machine=m68k-bull
932 | os=-sysv2
933 | ;;
934 | spur)
935 | basic_machine=spur-unknown
936 | ;;
937 | st2000)
938 | basic_machine=m68k-tandem
939 | ;;
940 | stratus)
941 | basic_machine=i860-stratus
942 | os=-sysv4
943 | ;;
944 | sun2)
945 | basic_machine=m68000-sun
946 | ;;
947 | sun2os3)
948 | basic_machine=m68000-sun
949 | os=-sunos3
950 | ;;
951 | sun2os4)
952 | basic_machine=m68000-sun
953 | os=-sunos4
954 | ;;
955 | sun3os3)
956 | basic_machine=m68k-sun
957 | os=-sunos3
958 | ;;
959 | sun3os4)
960 | basic_machine=m68k-sun
961 | os=-sunos4
962 | ;;
963 | sun4os3)
964 | basic_machine=sparc-sun
965 | os=-sunos3
966 | ;;
967 | sun4os4)
968 | basic_machine=sparc-sun
969 | os=-sunos4
970 | ;;
971 | sun4sol2)
972 | basic_machine=sparc-sun
973 | os=-solaris2
974 | ;;
975 | sun3 | sun3-*)
976 | basic_machine=m68k-sun
977 | ;;
978 | sun4)
979 | basic_machine=sparc-sun
980 | ;;
981 | sun386 | sun386i | roadrunner)
982 | basic_machine=i386-sun
983 | ;;
984 | sv1)
985 | basic_machine=sv1-cray
986 | os=-unicos
987 | ;;
988 | symmetry)
989 | basic_machine=i386-sequent
990 | os=-dynix
991 | ;;
992 | t3e)
993 | basic_machine=alphaev5-cray
994 | os=-unicos
995 | ;;
996 | t90)
997 | basic_machine=t90-cray
998 | os=-unicos
999 | ;;
1000 | tic54x | c54x*)
1001 | basic_machine=tic54x-unknown
1002 | os=-coff
1003 | ;;
1004 | tic55x | c55x*)
1005 | basic_machine=tic55x-unknown
1006 | os=-coff
1007 | ;;
1008 | tic6x | c6x*)
1009 | basic_machine=tic6x-unknown
1010 | os=-coff
1011 | ;;
1012 | tx39)
1013 | basic_machine=mipstx39-unknown
1014 | ;;
1015 | tx39el)
1016 | basic_machine=mipstx39el-unknown
1017 | ;;
1018 | toad1)
1019 | basic_machine=pdp10-xkl
1020 | os=-tops20
1021 | ;;
1022 | tower | tower-32)
1023 | basic_machine=m68k-ncr
1024 | ;;
1025 | tpf)
1026 | basic_machine=s390x-ibm
1027 | os=-tpf
1028 | ;;
1029 | udi29k)
1030 | basic_machine=a29k-amd
1031 | os=-udi
1032 | ;;
1033 | ultra3)
1034 | basic_machine=a29k-nyu
1035 | os=-sym1
1036 | ;;
1037 | v810 | necv810)
1038 | basic_machine=v810-nec
1039 | os=-none
1040 | ;;
1041 | vaxv)
1042 | basic_machine=vax-dec
1043 | os=-sysv
1044 | ;;
1045 | vms)
1046 | basic_machine=vax-dec
1047 | os=-vms
1048 | ;;
1049 | vpp*|vx|vx-*)
1050 | basic_machine=f301-fujitsu
1051 | ;;
1052 | vxworks960)
1053 | basic_machine=i960-wrs
1054 | os=-vxworks
1055 | ;;
1056 | vxworks68)
1057 | basic_machine=m68k-wrs
1058 | os=-vxworks
1059 | ;;
1060 | vxworks29k)
1061 | basic_machine=a29k-wrs
1062 | os=-vxworks
1063 | ;;
1064 | w65*)
1065 | basic_machine=w65-wdc
1066 | os=-none
1067 | ;;
1068 | w89k-*)
1069 | basic_machine=hppa1.1-winbond
1070 | os=-proelf
1071 | ;;
1072 | xbox)
1073 | basic_machine=i686-pc
1074 | os=-mingw32
1075 | ;;
1076 | xps | xps100)
1077 | basic_machine=xps100-honeywell
1078 | ;;
1079 | ymp)
1080 | basic_machine=ymp-cray
1081 | os=-unicos
1082 | ;;
1083 | z8k-*-coff)
1084 | basic_machine=z8k-unknown
1085 | os=-sim
1086 | ;;
1087 | none)
1088 | basic_machine=none-none
1089 | os=-none
1090 | ;;
1091 |
1092 | # Here we handle the default manufacturer of certain CPU types. It is in
1093 | # some cases the only manufacturer, in others, it is the most popular.
1094 | w89k)
1095 | basic_machine=hppa1.1-winbond
1096 | ;;
1097 | op50n)
1098 | basic_machine=hppa1.1-oki
1099 | ;;
1100 | op60c)
1101 | basic_machine=hppa1.1-oki
1102 | ;;
1103 | romp)
1104 | basic_machine=romp-ibm
1105 | ;;
1106 | mmix)
1107 | basic_machine=mmix-knuth
1108 | ;;
1109 | rs6000)
1110 | basic_machine=rs6000-ibm
1111 | ;;
1112 | vax)
1113 | basic_machine=vax-dec
1114 | ;;
1115 | pdp10)
1116 | # there are many clones, so DEC is not a safe bet
1117 | basic_machine=pdp10-unknown
1118 | ;;
1119 | pdp11)
1120 | basic_machine=pdp11-dec
1121 | ;;
1122 | we32k)
1123 | basic_machine=we32k-att
1124 | ;;
1125 | sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
1126 | basic_machine=sh-unknown
1127 | ;;
1128 | sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
1129 | basic_machine=sparc-sun
1130 | ;;
1131 | cydra)
1132 | basic_machine=cydra-cydrome
1133 | ;;
1134 | orion)
1135 | basic_machine=orion-highlevel
1136 | ;;
1137 | orion105)
1138 | basic_machine=clipper-highlevel
1139 | ;;
1140 | mac | mpw | mac-mpw)
1141 | basic_machine=m68k-apple
1142 | ;;
1143 | pmac | pmac-mpw)
1144 | basic_machine=powerpc-apple
1145 | ;;
1146 | *-unknown)
1147 | # Make sure to match an already-canonicalized machine name.
1148 | ;;
1149 | *)
1150 | echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
1151 | exit 1
1152 | ;;
1153 | esac
1154 |
1155 | # Here we canonicalize certain aliases for manufacturers.
1156 | case $basic_machine in
1157 | *-digital*)
1158 | basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
1159 | ;;
1160 | *-commodore*)
1161 | basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
1162 | ;;
1163 | *)
1164 | ;;
1165 | esac
1166 |
1167 | # Decode manufacturer-specific aliases for certain operating systems.
1168 |
1169 | if [ x"$os" != x"" ]
1170 | then
1171 | case $os in
1172 | # First match some system type aliases
1173 | # that might get confused with valid system types.
1174 | # -solaris* is a basic system type, with this one exception.
1175 | -solaris1 | -solaris1.*)
1176 | os=`echo $os | sed -e 's|solaris1|sunos4|'`
1177 | ;;
1178 | -solaris)
1179 | os=-solaris2
1180 | ;;
1181 | -svr4*)
1182 | os=-sysv4
1183 | ;;
1184 | -unixware*)
1185 | os=-sysv4.2uw
1186 | ;;
1187 | -gnu/linux*)
1188 | os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
1189 | ;;
1190 | # First accept the basic system types.
1191 | # The portable systems comes first.
1192 | # Each alternative MUST END IN A *, to match a version number.
1193 | # -sysv* is not here because it comes later, after sysvr4.
1194 | -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1195 | | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
1196 | | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
1197 | | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1198 | | -aos* \
1199 | | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
1200 | | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1201 | | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
1202 | | -openbsd* | -solidbsd* \
1203 | | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
1204 | | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
1205 | | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
1206 | | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1207 | | -chorusos* | -chorusrdb* \
1208 | | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1209 | | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
1210 | | -uxpv* | -beos* | -mpeix* | -udk* \
1211 | | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
1212 | | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
1213 | | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
1214 | | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
1215 | | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
1216 | | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
1217 | | -skyos* | -haiku* | -rdos* | -toppers*)
1218 | # Remember, each alternative MUST END IN *, to match a version number.
1219 | ;;
1220 | -qnx*)
1221 | case $basic_machine in
1222 | x86-* | i*86-*)
1223 | ;;
1224 | *)
1225 | os=-nto$os
1226 | ;;
1227 | esac
1228 | ;;
1229 | -nto-qnx*)
1230 | ;;
1231 | -nto*)
1232 | os=`echo $os | sed -e 's|nto|nto-qnx|'`
1233 | ;;
1234 | -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
1235 | | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
1236 | | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
1237 | ;;
1238 | -mac*)
1239 | os=`echo $os | sed -e 's|mac|macos|'`
1240 | ;;
1241 | -linux-dietlibc)
1242 | os=-linux-dietlibc
1243 | ;;
1244 | -linux*)
1245 | os=`echo $os | sed -e 's|linux|linux-gnu|'`
1246 | ;;
1247 | -sunos5*)
1248 | os=`echo $os | sed -e 's|sunos5|solaris2|'`
1249 | ;;
1250 | -sunos6*)
1251 | os=`echo $os | sed -e 's|sunos6|solaris3|'`
1252 | ;;
1253 | -opened*)
1254 | os=-openedition
1255 | ;;
1256 | -os400*)
1257 | os=-os400
1258 | ;;
1259 | -wince*)
1260 | os=-wince
1261 | ;;
1262 | -osfrose*)
1263 | os=-osfrose
1264 | ;;
1265 | -osf*)
1266 | os=-osf
1267 | ;;
1268 | -utek*)
1269 | os=-bsd
1270 | ;;
1271 | -dynix*)
1272 | os=-bsd
1273 | ;;
1274 | -acis*)
1275 | os=-aos
1276 | ;;
1277 | -atheos*)
1278 | os=-atheos
1279 | ;;
1280 | -syllable*)
1281 | os=-syllable
1282 | ;;
1283 | -386bsd)
1284 | os=-bsd
1285 | ;;
1286 | -ctix* | -uts*)
1287 | os=-sysv
1288 | ;;
1289 | -nova*)
1290 | os=-rtmk-nova
1291 | ;;
1292 | -ns2 )
1293 | os=-nextstep2
1294 | ;;
1295 | -nsk*)
1296 | os=-nsk
1297 | ;;
1298 | # Preserve the version number of sinix5.
1299 | -sinix5.*)
1300 | os=`echo $os | sed -e 's|sinix|sysv|'`
1301 | ;;
1302 | -sinix*)
1303 | os=-sysv4
1304 | ;;
1305 | -tpf*)
1306 | os=-tpf
1307 | ;;
1308 | -triton*)
1309 | os=-sysv3
1310 | ;;
1311 | -oss*)
1312 | os=-sysv3
1313 | ;;
1314 | -svr4)
1315 | os=-sysv4
1316 | ;;
1317 | -svr3)
1318 | os=-sysv3
1319 | ;;
1320 | -sysvr4)
1321 | os=-sysv4
1322 | ;;
1323 | # This must come after -sysvr4.
1324 | -sysv*)
1325 | ;;
1326 | -ose*)
1327 | os=-ose
1328 | ;;
1329 | -es1800*)
1330 | os=-ose
1331 | ;;
1332 | -xenix)
1333 | os=-xenix
1334 | ;;
1335 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1336 | os=-mint
1337 | ;;
1338 | -aros*)
1339 | os=-aros
1340 | ;;
1341 | -kaos*)
1342 | os=-kaos
1343 | ;;
1344 | -zvmoe)
1345 | os=-zvmoe
1346 | ;;
1347 | -none)
1348 | ;;
1349 | *)
1350 | # Get rid of the `-' at the beginning of $os.
1351 | os=`echo $os | sed 's/[^-]*-//'`
1352 | echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
1353 | exit 1
1354 | ;;
1355 | esac
1356 | else
1357 |
1358 | # Here we handle the default operating systems that come with various machines.
1359 | # The value should be what the vendor currently ships out the door with their
1360 | # machine or put another way, the most popular os provided with the machine.
1361 |
1362 | # Note that if you're going to try to match "-MANUFACTURER" here (say,
1363 | # "-sun"), then you have to tell the case statement up towards the top
1364 | # that MANUFACTURER isn't an operating system. Otherwise, code above
1365 | # will signal an error saying that MANUFACTURER isn't an operating
1366 | # system, and we'll never get to this point.
1367 |
1368 | case $basic_machine in
1369 | spu-*)
1370 | os=-elf
1371 | ;;
1372 | *-acorn)
1373 | os=-riscix1.2
1374 | ;;
1375 | arm*-rebel)
1376 | os=-linux
1377 | ;;
1378 | arm*-semi)
1379 | os=-aout
1380 | ;;
1381 | c4x-* | tic4x-*)
1382 | os=-coff
1383 | ;;
1384 | # This must come before the *-dec entry.
1385 | pdp10-*)
1386 | os=-tops20
1387 | ;;
1388 | pdp11-*)
1389 | os=-none
1390 | ;;
1391 | *-dec | vax-*)
1392 | os=-ultrix4.2
1393 | ;;
1394 | m68*-apollo)
1395 | os=-domain
1396 | ;;
1397 | i386-sun)
1398 | os=-sunos4.0.2
1399 | ;;
1400 | m68000-sun)
1401 | os=-sunos3
1402 | # This also exists in the configure program, but was not the
1403 | # default.
1404 | # os=-sunos4
1405 | ;;
1406 | m68*-cisco)
1407 | os=-aout
1408 | ;;
1409 | mips*-cisco)
1410 | os=-elf
1411 | ;;
1412 | mips*-*)
1413 | os=-elf
1414 | ;;
1415 | or32-*)
1416 | os=-coff
1417 | ;;
1418 | *-tti) # must be before sparc entry or we get the wrong os.
1419 | os=-sysv3
1420 | ;;
1421 | sparc-* | *-sun)
1422 | os=-sunos4.1.1
1423 | ;;
1424 | *-be)
1425 | os=-beos
1426 | ;;
1427 | *-haiku)
1428 | os=-haiku
1429 | ;;
1430 | *-ibm)
1431 | os=-aix
1432 | ;;
1433 | *-knuth)
1434 | os=-mmixware
1435 | ;;
1436 | *-wec)
1437 | os=-proelf
1438 | ;;
1439 | *-winbond)
1440 | os=-proelf
1441 | ;;
1442 | *-oki)
1443 | os=-proelf
1444 | ;;
1445 | *-hp)
1446 | os=-hpux
1447 | ;;
1448 | *-hitachi)
1449 | os=-hiux
1450 | ;;
1451 | i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1452 | os=-sysv
1453 | ;;
1454 | *-cbm)
1455 | os=-amigaos
1456 | ;;
1457 | *-dg)
1458 | os=-dgux
1459 | ;;
1460 | *-dolphin)
1461 | os=-sysv3
1462 | ;;
1463 | m68k-ccur)
1464 | os=-rtu
1465 | ;;
1466 | m88k-omron*)
1467 | os=-luna
1468 | ;;
1469 | *-next )
1470 | os=-nextstep
1471 | ;;
1472 | *-sequent)
1473 | os=-ptx
1474 | ;;
1475 | *-crds)
1476 | os=-unos
1477 | ;;
1478 | *-ns)
1479 | os=-genix
1480 | ;;
1481 | i370-*)
1482 | os=-mvs
1483 | ;;
1484 | *-next)
1485 | os=-nextstep3
1486 | ;;
1487 | *-gould)
1488 | os=-sysv
1489 | ;;
1490 | *-highlevel)
1491 | os=-bsd
1492 | ;;
1493 | *-encore)
1494 | os=-bsd
1495 | ;;
1496 | *-sgi)
1497 | os=-irix
1498 | ;;
1499 | *-siemens)
1500 | os=-sysv4
1501 | ;;
1502 | *-masscomp)
1503 | os=-rtu
1504 | ;;
1505 | f30[01]-fujitsu | f700-fujitsu)
1506 | os=-uxpv
1507 | ;;
1508 | *-rom68k)
1509 | os=-coff
1510 | ;;
1511 | *-*bug)
1512 | os=-coff
1513 | ;;
1514 | *-apple)
1515 | os=-macos
1516 | ;;
1517 | *-atari*)
1518 | os=-mint
1519 | ;;
1520 | *)
1521 | os=-none
1522 | ;;
1523 | esac
1524 | fi
1525 |
1526 | # Here we handle the case where we know the os, and the CPU type, but not the
1527 | # manufacturer. We pick the logical manufacturer.
1528 | vendor=unknown
1529 | case $basic_machine in
1530 | *-unknown)
1531 | case $os in
1532 | -riscix*)
1533 | vendor=acorn
1534 | ;;
1535 | -sunos*)
1536 | vendor=sun
1537 | ;;
1538 | -aix*)
1539 | vendor=ibm
1540 | ;;
1541 | -beos*)
1542 | vendor=be
1543 | ;;
1544 | -hpux*)
1545 | vendor=hp
1546 | ;;
1547 | -mpeix*)
1548 | vendor=hp
1549 | ;;
1550 | -hiux*)
1551 | vendor=hitachi
1552 | ;;
1553 | -unos*)
1554 | vendor=crds
1555 | ;;
1556 | -dgux*)
1557 | vendor=dg
1558 | ;;
1559 | -luna*)
1560 | vendor=omron
1561 | ;;
1562 | -genix*)
1563 | vendor=ns
1564 | ;;
1565 | -mvs* | -opened*)
1566 | vendor=ibm
1567 | ;;
1568 | -os400*)
1569 | vendor=ibm
1570 | ;;
1571 | -ptx*)
1572 | vendor=sequent
1573 | ;;
1574 | -tpf*)
1575 | vendor=ibm
1576 | ;;
1577 | -vxsim* | -vxworks* | -windiss*)
1578 | vendor=wrs
1579 | ;;
1580 | -aux*)
1581 | vendor=apple
1582 | ;;
1583 | -hms*)
1584 | vendor=hitachi
1585 | ;;
1586 | -mpw* | -macos*)
1587 | vendor=apple
1588 | ;;
1589 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1590 | vendor=atari
1591 | ;;
1592 | -vos*)
1593 | vendor=stratus
1594 | ;;
1595 | esac
1596 | basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
1597 | ;;
1598 | esac
1599 |
1600 | echo $basic_machine$os
1601 | exit
1602 |
1603 | # Local variables:
1604 | # eval: (add-hook 'write-file-hooks 'time-stamp)
1605 | # time-stamp-start: "timestamp='"
1606 | # time-stamp-format: "%:y-%02m-%02d"
1607 | # time-stamp-end: "'"
1608 | # End:
1609 |
--------------------------------------------------------------------------------
/configure.ac:
--------------------------------------------------------------------------------
1 | # -*- Autoconf -*-
2 | # Process this file with autoconf to produce a configure script.
3 |
4 | AC_PREREQ(2.61)
5 | AC_INIT([BoNeSi], [0.3.1], [Markus-Go@users.noreply.github.com])
6 | AM_INIT_AUTOMAKE
7 | AC_OUTPUT(Makefile src/Makefile man/Makefile)
8 | AC_CONFIG_SRCDIR([src/bonesi.c])
9 | AM_CONFIG_HEADER(config.h)
10 |
11 |
12 | # Checks for programs.
13 | AC_PROG_CC
14 |
15 | # Checks for libraries.
16 | AC_CHECK_LIB(pcap, pcap_open_live)
17 | AC_CHECK_LIB(pthread, pthread_create)
18 | AC_CHECK_LIB(net, libnet_init)
19 |
20 | # Checks for header files.
21 | AC_HEADER_STDC
22 | AC_CHECK_HEADERS([stdlib.h string.h unistd.h pthread.h pcap.h libnet.h],,AC_MSG_ERROR(header missing))
23 |
24 | # Checks for typedefs, structures, and compiler characteristics.
25 | AC_C_CONST
26 | AC_C_INLINE
27 | AC_TYPE_SIZE_T
28 | AC_TYPE_SSIZE_T
29 | AC_HEADER_TIME
30 | AC_TYPE_UINT32_T
31 |
32 | # Checks for library functions.
33 | AC_FUNC_MALLOC
34 | AC_CHECK_FUNCS([bzero gettimeofday strncasecmp strrchr])
35 |
36 | AC_OUTPUT
37 |
--------------------------------------------------------------------------------
/depcomp:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # depcomp - compile a program generating dependencies as side-effects
3 |
4 | scriptversion=2006-10-15.18
5 |
6 | # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
7 | # Foundation, Inc.
8 |
9 | # This program is free software; you can redistribute it and/or modify
10 | # it under the terms of the GNU General Public License as published by
11 | # the Free Software Foundation; either version 2, or (at your option)
12 | # any later version.
13 |
14 | # This program is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 |
19 | # You should have received a copy of the GNU General Public License
20 | # along with this program; if not, write to the Free Software
21 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 | # 02110-1301, USA.
23 |
24 | # As a special exception to the GNU General Public License, if you
25 | # distribute this file as part of a program that contains a
26 | # configuration script generated by Autoconf, you may include it under
27 | # the same distribution terms that you use for the rest of that program.
28 |
29 | # Originally written by Alexandre Oliva .
30 |
31 | case $1 in
32 | '')
33 | echo "$0: No command. Try \`$0 --help' for more information." 1>&2
34 | exit 1;
35 | ;;
36 | -h | --h*)
37 | cat <<\EOF
38 | Usage: depcomp [--help] [--version] PROGRAM [ARGS]
39 |
40 | Run PROGRAMS ARGS to compile a file, generating dependencies
41 | as side-effects.
42 |
43 | Environment variables:
44 | depmode Dependency tracking mode.
45 | source Source file read by `PROGRAMS ARGS'.
46 | object Object file output by `PROGRAMS ARGS'.
47 | DEPDIR directory where to store dependencies.
48 | depfile Dependency file to output.
49 | tmpdepfile Temporary file to use when outputing dependencies.
50 | libtool Whether libtool is used (yes/no).
51 |
52 | Report bugs to .
53 | EOF
54 | exit $?
55 | ;;
56 | -v | --v*)
57 | echo "depcomp $scriptversion"
58 | exit $?
59 | ;;
60 | esac
61 |
62 | if test -z "$depmode" || test -z "$source" || test -z "$object"; then
63 | echo "depcomp: Variables source, object and depmode must be set" 1>&2
64 | exit 1
65 | fi
66 |
67 | # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
68 | depfile=${depfile-`echo "$object" |
69 | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
70 | tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
71 |
72 | rm -f "$tmpdepfile"
73 |
74 | # Some modes work just like other modes, but use different flags. We
75 | # parameterize here, but still list the modes in the big case below,
76 | # to make depend.m4 easier to write. Note that we *cannot* use a case
77 | # here, because this file can only contain one case statement.
78 | if test "$depmode" = hp; then
79 | # HP compiler uses -M and no extra arg.
80 | gccflag=-M
81 | depmode=gcc
82 | fi
83 |
84 | if test "$depmode" = dashXmstdout; then
85 | # This is just like dashmstdout with a different argument.
86 | dashmflag=-xM
87 | depmode=dashmstdout
88 | fi
89 |
90 | case "$depmode" in
91 | gcc3)
92 | ## gcc 3 implements dependency tracking that does exactly what
93 | ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
94 | ## it if -MD -MP comes after the -MF stuff. Hmm.
95 | ## Unfortunately, FreeBSD c89 acceptance of flags depends upon
96 | ## the command line argument order; so add the flags where they
97 | ## appear in depend2.am. Note that the slowdown incurred here
98 | ## affects only configure: in makefiles, %FASTDEP% shortcuts this.
99 | for arg
100 | do
101 | case $arg in
102 | -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
103 | *) set fnord "$@" "$arg" ;;
104 | esac
105 | shift # fnord
106 | shift # $arg
107 | done
108 | "$@"
109 | stat=$?
110 | if test $stat -eq 0; then :
111 | else
112 | rm -f "$tmpdepfile"
113 | exit $stat
114 | fi
115 | mv "$tmpdepfile" "$depfile"
116 | ;;
117 |
118 | gcc)
119 | ## There are various ways to get dependency output from gcc. Here's
120 | ## why we pick this rather obscure method:
121 | ## - Don't want to use -MD because we'd like the dependencies to end
122 | ## up in a subdir. Having to rename by hand is ugly.
123 | ## (We might end up doing this anyway to support other compilers.)
124 | ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
125 | ## -MM, not -M (despite what the docs say).
126 | ## - Using -M directly means running the compiler twice (even worse
127 | ## than renaming).
128 | if test -z "$gccflag"; then
129 | gccflag=-MD,
130 | fi
131 | "$@" -Wp,"$gccflag$tmpdepfile"
132 | stat=$?
133 | if test $stat -eq 0; then :
134 | else
135 | rm -f "$tmpdepfile"
136 | exit $stat
137 | fi
138 | rm -f "$depfile"
139 | echo "$object : \\" > "$depfile"
140 | alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
141 | ## The second -e expression handles DOS-style file names with drive letters.
142 | sed -e 's/^[^:]*: / /' \
143 | -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
144 | ## This next piece of magic avoids the `deleted header file' problem.
145 | ## The problem is that when a header file which appears in a .P file
146 | ## is deleted, the dependency causes make to die (because there is
147 | ## typically no way to rebuild the header). We avoid this by adding
148 | ## dummy dependencies for each header file. Too bad gcc doesn't do
149 | ## this for us directly.
150 | tr ' ' '
151 | ' < "$tmpdepfile" |
152 | ## Some versions of gcc put a space before the `:'. On the theory
153 | ## that the space means something, we add a space to the output as
154 | ## well.
155 | ## Some versions of the HPUX 10.20 sed can't process this invocation
156 | ## correctly. Breaking it into two sed invocations is a workaround.
157 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
158 | rm -f "$tmpdepfile"
159 | ;;
160 |
161 | hp)
162 | # This case exists only to let depend.m4 do its work. It works by
163 | # looking at the text of this script. This case will never be run,
164 | # since it is checked for above.
165 | exit 1
166 | ;;
167 |
168 | sgi)
169 | if test "$libtool" = yes; then
170 | "$@" "-Wp,-MDupdate,$tmpdepfile"
171 | else
172 | "$@" -MDupdate "$tmpdepfile"
173 | fi
174 | stat=$?
175 | if test $stat -eq 0; then :
176 | else
177 | rm -f "$tmpdepfile"
178 | exit $stat
179 | fi
180 | rm -f "$depfile"
181 |
182 | if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
183 | echo "$object : \\" > "$depfile"
184 |
185 | # Clip off the initial element (the dependent). Don't try to be
186 | # clever and replace this with sed code, as IRIX sed won't handle
187 | # lines with more than a fixed number of characters (4096 in
188 | # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
189 | # the IRIX cc adds comments like `#:fec' to the end of the
190 | # dependency line.
191 | tr ' ' '
192 | ' < "$tmpdepfile" \
193 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
194 | tr '
195 | ' ' ' >> $depfile
196 | echo >> $depfile
197 |
198 | # The second pass generates a dummy entry for each header file.
199 | tr ' ' '
200 | ' < "$tmpdepfile" \
201 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
202 | >> $depfile
203 | else
204 | # The sourcefile does not contain any dependencies, so just
205 | # store a dummy comment line, to avoid errors with the Makefile
206 | # "include basename.Plo" scheme.
207 | echo "#dummy" > "$depfile"
208 | fi
209 | rm -f "$tmpdepfile"
210 | ;;
211 |
212 | aix)
213 | # The C for AIX Compiler uses -M and outputs the dependencies
214 | # in a .u file. In older versions, this file always lives in the
215 | # current directory. Also, the AIX compiler puts `$object:' at the
216 | # start of each line; $object doesn't have directory information.
217 | # Version 6 uses the directory in both cases.
218 | stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
219 | tmpdepfile="$stripped.u"
220 | if test "$libtool" = yes; then
221 | "$@" -Wc,-M
222 | else
223 | "$@" -M
224 | fi
225 | stat=$?
226 |
227 | if test -f "$tmpdepfile"; then :
228 | else
229 | stripped=`echo "$stripped" | sed 's,^.*/,,'`
230 | tmpdepfile="$stripped.u"
231 | fi
232 |
233 | if test $stat -eq 0; then :
234 | else
235 | rm -f "$tmpdepfile"
236 | exit $stat
237 | fi
238 |
239 | if test -f "$tmpdepfile"; then
240 | outname="$stripped.o"
241 | # Each line is of the form `foo.o: dependent.h'.
242 | # Do two passes, one to just change these to
243 | # `$object: dependent.h' and one to simply `dependent.h:'.
244 | sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
245 | sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
246 | else
247 | # The sourcefile does not contain any dependencies, so just
248 | # store a dummy comment line, to avoid errors with the Makefile
249 | # "include basename.Plo" scheme.
250 | echo "#dummy" > "$depfile"
251 | fi
252 | rm -f "$tmpdepfile"
253 | ;;
254 |
255 | icc)
256 | # Intel's C compiler understands `-MD -MF file'. However on
257 | # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
258 | # ICC 7.0 will fill foo.d with something like
259 | # foo.o: sub/foo.c
260 | # foo.o: sub/foo.h
261 | # which is wrong. We want:
262 | # sub/foo.o: sub/foo.c
263 | # sub/foo.o: sub/foo.h
264 | # sub/foo.c:
265 | # sub/foo.h:
266 | # ICC 7.1 will output
267 | # foo.o: sub/foo.c sub/foo.h
268 | # and will wrap long lines using \ :
269 | # foo.o: sub/foo.c ... \
270 | # sub/foo.h ... \
271 | # ...
272 |
273 | "$@" -MD -MF "$tmpdepfile"
274 | stat=$?
275 | if test $stat -eq 0; then :
276 | else
277 | rm -f "$tmpdepfile"
278 | exit $stat
279 | fi
280 | rm -f "$depfile"
281 | # Each line is of the form `foo.o: dependent.h',
282 | # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
283 | # Do two passes, one to just change these to
284 | # `$object: dependent.h' and one to simply `dependent.h:'.
285 | sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
286 | # Some versions of the HPUX 10.20 sed can't process this invocation
287 | # correctly. Breaking it into two sed invocations is a workaround.
288 | sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
289 | sed -e 's/$/ :/' >> "$depfile"
290 | rm -f "$tmpdepfile"
291 | ;;
292 |
293 | hp2)
294 | # The "hp" stanza above does not work with aCC (C++) and HP's ia64
295 | # compilers, which have integrated preprocessors. The correct option
296 | # to use with these is +Maked; it writes dependencies to a file named
297 | # 'foo.d', which lands next to the object file, wherever that
298 | # happens to be.
299 | # Much of this is similar to the tru64 case; see comments there.
300 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
301 | test "x$dir" = "x$object" && dir=
302 | base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
303 | if test "$libtool" = yes; then
304 | tmpdepfile1=$dir$base.d
305 | tmpdepfile2=$dir.libs/$base.d
306 | "$@" -Wc,+Maked
307 | else
308 | tmpdepfile1=$dir$base.d
309 | tmpdepfile2=$dir$base.d
310 | "$@" +Maked
311 | fi
312 | stat=$?
313 | if test $stat -eq 0; then :
314 | else
315 | rm -f "$tmpdepfile1" "$tmpdepfile2"
316 | exit $stat
317 | fi
318 |
319 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
320 | do
321 | test -f "$tmpdepfile" && break
322 | done
323 | if test -f "$tmpdepfile"; then
324 | sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
325 | # Add `dependent.h:' lines.
326 | sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
327 | else
328 | echo "#dummy" > "$depfile"
329 | fi
330 | rm -f "$tmpdepfile" "$tmpdepfile2"
331 | ;;
332 |
333 | tru64)
334 | # The Tru64 compiler uses -MD to generate dependencies as a side
335 | # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
336 | # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
337 | # dependencies in `foo.d' instead, so we check for that too.
338 | # Subdirectories are respected.
339 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
340 | test "x$dir" = "x$object" && dir=
341 | base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
342 |
343 | if test "$libtool" = yes; then
344 | # With Tru64 cc, shared objects can also be used to make a
345 | # static library. This mechanism is used in libtool 1.4 series to
346 | # handle both shared and static libraries in a single compilation.
347 | # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
348 | #
349 | # With libtool 1.5 this exception was removed, and libtool now
350 | # generates 2 separate objects for the 2 libraries. These two
351 | # compilations output dependencies in $dir.libs/$base.o.d and
352 | # in $dir$base.o.d. We have to check for both files, because
353 | # one of the two compilations can be disabled. We should prefer
354 | # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
355 | # automatically cleaned when .libs/ is deleted, while ignoring
356 | # the former would cause a distcleancheck panic.
357 | tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
358 | tmpdepfile2=$dir$base.o.d # libtool 1.5
359 | tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
360 | tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
361 | "$@" -Wc,-MD
362 | else
363 | tmpdepfile1=$dir$base.o.d
364 | tmpdepfile2=$dir$base.d
365 | tmpdepfile3=$dir$base.d
366 | tmpdepfile4=$dir$base.d
367 | "$@" -MD
368 | fi
369 |
370 | stat=$?
371 | if test $stat -eq 0; then :
372 | else
373 | rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
374 | exit $stat
375 | fi
376 |
377 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
378 | do
379 | test -f "$tmpdepfile" && break
380 | done
381 | if test -f "$tmpdepfile"; then
382 | sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
383 | # That's a tab and a space in the [].
384 | sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
385 | else
386 | echo "#dummy" > "$depfile"
387 | fi
388 | rm -f "$tmpdepfile"
389 | ;;
390 |
391 | #nosideeffect)
392 | # This comment above is used by automake to tell side-effect
393 | # dependency tracking mechanisms from slower ones.
394 |
395 | dashmstdout)
396 | # Important note: in order to support this mode, a compiler *must*
397 | # always write the preprocessed file to stdout, regardless of -o.
398 | "$@" || exit $?
399 |
400 | # Remove the call to Libtool.
401 | if test "$libtool" = yes; then
402 | while test $1 != '--mode=compile'; do
403 | shift
404 | done
405 | shift
406 | fi
407 |
408 | # Remove `-o $object'.
409 | IFS=" "
410 | for arg
411 | do
412 | case $arg in
413 | -o)
414 | shift
415 | ;;
416 | $object)
417 | shift
418 | ;;
419 | *)
420 | set fnord "$@" "$arg"
421 | shift # fnord
422 | shift # $arg
423 | ;;
424 | esac
425 | done
426 |
427 | test -z "$dashmflag" && dashmflag=-M
428 | # Require at least two characters before searching for `:'
429 | # in the target name. This is to cope with DOS-style filenames:
430 | # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
431 | "$@" $dashmflag |
432 | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
433 | rm -f "$depfile"
434 | cat < "$tmpdepfile" > "$depfile"
435 | tr ' ' '
436 | ' < "$tmpdepfile" | \
437 | ## Some versions of the HPUX 10.20 sed can't process this invocation
438 | ## correctly. Breaking it into two sed invocations is a workaround.
439 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
440 | rm -f "$tmpdepfile"
441 | ;;
442 |
443 | dashXmstdout)
444 | # This case only exists to satisfy depend.m4. It is never actually
445 | # run, as this mode is specially recognized in the preamble.
446 | exit 1
447 | ;;
448 |
449 | makedepend)
450 | "$@" || exit $?
451 | # Remove any Libtool call
452 | if test "$libtool" = yes; then
453 | while test $1 != '--mode=compile'; do
454 | shift
455 | done
456 | shift
457 | fi
458 | # X makedepend
459 | shift
460 | cleared=no
461 | for arg in "$@"; do
462 | case $cleared in
463 | no)
464 | set ""; shift
465 | cleared=yes ;;
466 | esac
467 | case "$arg" in
468 | -D*|-I*)
469 | set fnord "$@" "$arg"; shift ;;
470 | # Strip any option that makedepend may not understand. Remove
471 | # the object too, otherwise makedepend will parse it as a source file.
472 | -*|$object)
473 | ;;
474 | *)
475 | set fnord "$@" "$arg"; shift ;;
476 | esac
477 | done
478 | obj_suffix="`echo $object | sed 's/^.*\././'`"
479 | touch "$tmpdepfile"
480 | ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
481 | rm -f "$depfile"
482 | cat < "$tmpdepfile" > "$depfile"
483 | sed '1,2d' "$tmpdepfile" | tr ' ' '
484 | ' | \
485 | ## Some versions of the HPUX 10.20 sed can't process this invocation
486 | ## correctly. Breaking it into two sed invocations is a workaround.
487 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
488 | rm -f "$tmpdepfile" "$tmpdepfile".bak
489 | ;;
490 |
491 | cpp)
492 | # Important note: in order to support this mode, a compiler *must*
493 | # always write the preprocessed file to stdout.
494 | "$@" || exit $?
495 |
496 | # Remove the call to Libtool.
497 | if test "$libtool" = yes; then
498 | while test $1 != '--mode=compile'; do
499 | shift
500 | done
501 | shift
502 | fi
503 |
504 | # Remove `-o $object'.
505 | IFS=" "
506 | for arg
507 | do
508 | case $arg in
509 | -o)
510 | shift
511 | ;;
512 | $object)
513 | shift
514 | ;;
515 | *)
516 | set fnord "$@" "$arg"
517 | shift # fnord
518 | shift # $arg
519 | ;;
520 | esac
521 | done
522 |
523 | "$@" -E |
524 | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
525 | -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
526 | sed '$ s: \\$::' > "$tmpdepfile"
527 | rm -f "$depfile"
528 | echo "$object : \\" > "$depfile"
529 | cat < "$tmpdepfile" >> "$depfile"
530 | sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
531 | rm -f "$tmpdepfile"
532 | ;;
533 |
534 | msvisualcpp)
535 | # Important note: in order to support this mode, a compiler *must*
536 | # always write the preprocessed file to stdout, regardless of -o,
537 | # because we must use -o when running libtool.
538 | "$@" || exit $?
539 | IFS=" "
540 | for arg
541 | do
542 | case "$arg" in
543 | "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
544 | set fnord "$@"
545 | shift
546 | shift
547 | ;;
548 | *)
549 | set fnord "$@" "$arg"
550 | shift
551 | shift
552 | ;;
553 | esac
554 | done
555 | "$@" -E |
556 | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
557 | rm -f "$depfile"
558 | echo "$object : \\" > "$depfile"
559 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
560 | echo " " >> "$depfile"
561 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
562 | rm -f "$tmpdepfile"
563 | ;;
564 |
565 | none)
566 | exec "$@"
567 | ;;
568 |
569 | *)
570 | echo "Unknown depmode $depmode" 1>&2
571 | exit 1
572 | ;;
573 | esac
574 |
575 | exit 0
576 |
577 | # Local Variables:
578 | # mode: shell-script
579 | # sh-indentation: 2
580 | # eval: (add-hook 'write-file-hooks 'time-stamp)
581 | # time-stamp-start: "scriptversion="
582 | # time-stamp-format: "%:y-%02m-%02d.%02H"
583 | # time-stamp-end: "$"
584 | # End:
585 |
--------------------------------------------------------------------------------
/install-sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # install - install a program, script, or datafile
4 | #
5 | # This originates from X11R5 (mit/util/scripts/install.sh), which was
6 | # later released in X11R6 (xc/config/util/install.sh) with the
7 | # following copyright and license.
8 | #
9 | # Copyright (C) 1994 X Consortium
10 | #
11 | # Permission is hereby granted, free of charge, to any person obtaining a copy
12 | # of this software and associated documentation files (the "Software"), to
13 | # deal in the Software without restriction, including without limitation the
14 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
15 | # sell copies of the Software, and to permit persons to whom the Software is
16 | # furnished to do so, subject to the following conditions:
17 | #
18 | # The above copyright notice and this permission notice shall be included in
19 | # all copies or substantial portions of the Software.
20 | #
21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
25 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
26 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 | #
28 | # Except as contained in this notice, the name of the X Consortium shall not
29 | # be used in advertising or otherwise to promote the sale, use or other deal-
30 | # ings in this Software without prior written authorization from the X Consor-
31 | # tium.
32 | #
33 | #
34 | # FSF changes to this file are in the public domain.
35 | #
36 | # Calling this script install-sh is preferred over install.sh, to prevent
37 | # `make' implicit rules from creating a file called install from it
38 | # when there is no Makefile.
39 | #
40 | # This script is compatible with the BSD install script, but was written
41 | # from scratch. It can only install one file at a time, a restriction
42 | # shared with many OS's install programs.
43 |
44 |
45 | # set DOITPROG to echo to test this script
46 |
47 | # Don't use :- since 4.3BSD and earlier shells don't like it.
48 | doit="${DOITPROG-}"
49 |
50 |
51 | # put in absolute paths if you don't have them in your path; or use env. vars.
52 |
53 | mvprog="${MVPROG-mv}"
54 | cpprog="${CPPROG-cp}"
55 | chmodprog="${CHMODPROG-chmod}"
56 | chownprog="${CHOWNPROG-chown}"
57 | chgrpprog="${CHGRPPROG-chgrp}"
58 | stripprog="${STRIPPROG-strip}"
59 | rmprog="${RMPROG-rm}"
60 | mkdirprog="${MKDIRPROG-mkdir}"
61 |
62 | transformbasename=""
63 | transform_arg=""
64 | instcmd="$mvprog"
65 | chmodcmd="$chmodprog 0755"
66 | chowncmd=""
67 | chgrpcmd=""
68 | stripcmd=""
69 | rmcmd="$rmprog -f"
70 | mvcmd="$mvprog"
71 | src=""
72 | dst=""
73 | dir_arg=""
74 |
75 | while [ x"$1" != x ]; do
76 | case $1 in
77 | -c) instcmd="$cpprog"
78 | shift
79 | continue;;
80 |
81 | -d) dir_arg=true
82 | shift
83 | continue;;
84 |
85 | -m) chmodcmd="$chmodprog $2"
86 | shift
87 | shift
88 | continue;;
89 |
90 | -o) chowncmd="$chownprog $2"
91 | shift
92 | shift
93 | continue;;
94 |
95 | -g) chgrpcmd="$chgrpprog $2"
96 | shift
97 | shift
98 | continue;;
99 |
100 | -s) stripcmd="$stripprog"
101 | shift
102 | continue;;
103 |
104 | -t=*) transformarg=`echo $1 | sed 's/-t=//'`
105 | shift
106 | continue;;
107 |
108 | -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
109 | shift
110 | continue;;
111 |
112 | *) if [ x"$src" = x ]
113 | then
114 | src=$1
115 | else
116 | # this colon is to work around a 386BSD /bin/sh bug
117 | :
118 | dst=$1
119 | fi
120 | shift
121 | continue;;
122 | esac
123 | done
124 |
125 | if [ x"$src" = x ]
126 | then
127 | echo "install: no input file specified"
128 | exit 1
129 | else
130 | true
131 | fi
132 |
133 | if [ x"$dir_arg" != x ]; then
134 | dst=$src
135 | src=""
136 |
137 | if [ -d $dst ]; then
138 | instcmd=:
139 | chmodcmd=""
140 | else
141 | instcmd=mkdir
142 | fi
143 | else
144 |
145 | # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
146 | # might cause directories to be created, which would be especially bad
147 | # if $src (and thus $dsttmp) contains '*'.
148 |
149 | if [ -f $src -o -d $src ]
150 | then
151 | true
152 | else
153 | echo "install: $src does not exist"
154 | exit 1
155 | fi
156 |
157 | if [ x"$dst" = x ]
158 | then
159 | echo "install: no destination specified"
160 | exit 1
161 | else
162 | true
163 | fi
164 |
165 | # If destination is a directory, append the input filename; if your system
166 | # does not like double slashes in filenames, you may need to add some logic
167 |
168 | if [ -d $dst ]
169 | then
170 | dst="$dst"/`basename $src`
171 | else
172 | true
173 | fi
174 | fi
175 |
176 | ## this sed command emulates the dirname command
177 | dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
178 |
179 | # Make sure that the destination directory exists.
180 | # this part is taken from Noah Friedman's mkinstalldirs script
181 |
182 | # Skip lots of stat calls in the usual case.
183 | if [ ! -d "$dstdir" ]; then
184 | defaultIFS='
185 | '
186 | IFS="${IFS-${defaultIFS}}"
187 |
188 | oIFS="${IFS}"
189 | # Some sh's can't handle IFS=/ for some reason.
190 | IFS='%'
191 | set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
192 | IFS="${oIFS}"
193 |
194 | pathcomp=''
195 |
196 | while [ $# -ne 0 ] ; do
197 | pathcomp="${pathcomp}${1}"
198 | shift
199 |
200 | if [ ! -d "${pathcomp}" ] ;
201 | then
202 | $mkdirprog "${pathcomp}"
203 | else
204 | true
205 | fi
206 |
207 | pathcomp="${pathcomp}/"
208 | done
209 | fi
210 |
211 | if [ x"$dir_arg" != x ]
212 | then
213 | $doit $instcmd $dst &&
214 |
215 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
216 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
217 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
218 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
219 | else
220 |
221 | # If we're going to rename the final executable, determine the name now.
222 |
223 | if [ x"$transformarg" = x ]
224 | then
225 | dstfile=`basename $dst`
226 | else
227 | dstfile=`basename $dst $transformbasename |
228 | sed $transformarg`$transformbasename
229 | fi
230 |
231 | # don't allow the sed command to completely eliminate the filename
232 |
233 | if [ x"$dstfile" = x ]
234 | then
235 | dstfile=`basename $dst`
236 | else
237 | true
238 | fi
239 |
240 | # Make a temp file name in the proper directory.
241 |
242 | dsttmp=$dstdir/#inst.$$#
243 |
244 | # Move or copy the file name to the temp name
245 |
246 | $doit $instcmd $src $dsttmp &&
247 |
248 | trap "rm -f ${dsttmp}" 0 &&
249 |
250 | # and set any options; do chmod last to preserve setuid bits
251 |
252 | # If any of these fail, we abort the whole thing. If we want to
253 | # ignore errors from any of these, just make sure not to ignore
254 | # errors from the above "$doit $instcmd $src $dsttmp" command.
255 |
256 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
257 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
258 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
259 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
260 |
261 | # Now rename the file to the real destination.
262 |
263 | $doit $rmcmd -f $dstdir/$dstfile &&
264 | $doit $mvcmd $dsttmp $dstdir/$dstfile
265 |
266 | fi &&
267 |
268 |
269 | exit 0
270 |
--------------------------------------------------------------------------------
/man/Makefile.am:
--------------------------------------------------------------------------------
1 | dist_man_MANS = bonesi.1
2 |
--------------------------------------------------------------------------------
/man/Makefile.in:
--------------------------------------------------------------------------------
1 | # Makefile.in generated by automake 1.15.1 from Makefile.am.
2 | # @configure_input@
3 |
4 | # Copyright (C) 1994-2017 Free Software Foundation, Inc.
5 |
6 | # This Makefile.in is free software; the Free Software Foundation
7 | # gives unlimited permission to copy and/or distribute it,
8 | # with or without modifications, as long as this notice is preserved.
9 |
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 | # PARTICULAR PURPOSE.
14 |
15 | @SET_MAKE@
16 | VPATH = @srcdir@
17 | am__is_gnu_make = { \
18 | if test -z '$(MAKELEVEL)'; then \
19 | false; \
20 | elif test -n '$(MAKE_HOST)'; then \
21 | true; \
22 | elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
23 | true; \
24 | else \
25 | false; \
26 | fi; \
27 | }
28 | am__make_running_with_option = \
29 | case $${target_option-} in \
30 | ?) ;; \
31 | *) echo "am__make_running_with_option: internal error: invalid" \
32 | "target option '$${target_option-}' specified" >&2; \
33 | exit 1;; \
34 | esac; \
35 | has_opt=no; \
36 | sane_makeflags=$$MAKEFLAGS; \
37 | if $(am__is_gnu_make); then \
38 | sane_makeflags=$$MFLAGS; \
39 | else \
40 | case $$MAKEFLAGS in \
41 | *\\[\ \ ]*) \
42 | bs=\\; \
43 | sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
44 | | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
45 | esac; \
46 | fi; \
47 | skip_next=no; \
48 | strip_trailopt () \
49 | { \
50 | flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
51 | }; \
52 | for flg in $$sane_makeflags; do \
53 | test $$skip_next = yes && { skip_next=no; continue; }; \
54 | case $$flg in \
55 | *=*|--*) continue;; \
56 | -*I) strip_trailopt 'I'; skip_next=yes;; \
57 | -*I?*) strip_trailopt 'I';; \
58 | -*O) strip_trailopt 'O'; skip_next=yes;; \
59 | -*O?*) strip_trailopt 'O';; \
60 | -*l) strip_trailopt 'l'; skip_next=yes;; \
61 | -*l?*) strip_trailopt 'l';; \
62 | -[dEDm]) skip_next=yes;; \
63 | -[JT]) skip_next=yes;; \
64 | esac; \
65 | case $$flg in \
66 | *$$target_option*) has_opt=yes; break;; \
67 | esac; \
68 | done; \
69 | test $$has_opt = yes
70 | am__make_dryrun = (target_option=n; $(am__make_running_with_option))
71 | am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
72 | pkgdatadir = $(datadir)/@PACKAGE@
73 | pkgincludedir = $(includedir)/@PACKAGE@
74 | pkglibdir = $(libdir)/@PACKAGE@
75 | pkglibexecdir = $(libexecdir)/@PACKAGE@
76 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
77 | install_sh_DATA = $(install_sh) -c -m 644
78 | install_sh_PROGRAM = $(install_sh) -c
79 | install_sh_SCRIPT = $(install_sh) -c
80 | INSTALL_HEADER = $(INSTALL_DATA)
81 | transform = $(program_transform_name)
82 | NORMAL_INSTALL = :
83 | PRE_INSTALL = :
84 | POST_INSTALL = :
85 | NORMAL_UNINSTALL = :
86 | PRE_UNINSTALL = :
87 | POST_UNINSTALL = :
88 | subdir = man
89 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
90 | am__aclocal_m4_deps = $(top_srcdir)/configure.ac
91 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
92 | $(ACLOCAL_M4)
93 | DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
94 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
95 | CONFIG_HEADER = $(top_builddir)/config.h
96 | CONFIG_CLEAN_FILES =
97 | CONFIG_CLEAN_VPATH_FILES =
98 | AM_V_P = $(am__v_P_@AM_V@)
99 | am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
100 | am__v_P_0 = false
101 | am__v_P_1 = :
102 | AM_V_GEN = $(am__v_GEN_@AM_V@)
103 | am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
104 | am__v_GEN_0 = @echo " GEN " $@;
105 | am__v_GEN_1 =
106 | AM_V_at = $(am__v_at_@AM_V@)
107 | am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
108 | am__v_at_0 = @
109 | am__v_at_1 =
110 | SOURCES =
111 | DIST_SOURCES =
112 | am__can_run_installinfo = \
113 | case $$AM_UPDATE_INFO_DIR in \
114 | n|no|NO) false;; \
115 | *) (install-info --version) >/dev/null 2>&1;; \
116 | esac
117 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
118 | am__vpath_adj = case $$p in \
119 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
120 | *) f=$$p;; \
121 | esac;
122 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
123 | am__install_max = 40
124 | am__nobase_strip_setup = \
125 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
126 | am__nobase_strip = \
127 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
128 | am__nobase_list = $(am__nobase_strip_setup); \
129 | for p in $$list; do echo "$$p $$p"; done | \
130 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
131 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
132 | if (++n[$$2] == $(am__install_max)) \
133 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
134 | END { for (dir in files) print dir, files[dir] }'
135 | am__base_list = \
136 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
137 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
138 | am__uninstall_files_from_dir = { \
139 | test -z "$$files" \
140 | || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
141 | || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
142 | $(am__cd) "$$dir" && rm -f $$files; }; \
143 | }
144 | man1dir = $(mandir)/man1
145 | am__installdirs = "$(DESTDIR)$(man1dir)"
146 | NROFF = nroff
147 | MANS = $(dist_man_MANS)
148 | am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
149 | am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \
150 | $(top_srcdir)/mkinstalldirs
151 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
152 | ACLOCAL = @ACLOCAL@
153 | AMTAR = @AMTAR@
154 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
155 | AUTOCONF = @AUTOCONF@
156 | AUTOHEADER = @AUTOHEADER@
157 | AUTOMAKE = @AUTOMAKE@
158 | AWK = @AWK@
159 | CC = @CC@
160 | CCDEPMODE = @CCDEPMODE@
161 | CFLAGS = @CFLAGS@
162 | CPP = @CPP@
163 | CPPFLAGS = @CPPFLAGS@
164 | CYGPATH_W = @CYGPATH_W@
165 | DEFS = @DEFS@
166 | DEPDIR = @DEPDIR@
167 | ECHO_C = @ECHO_C@
168 | ECHO_N = @ECHO_N@
169 | ECHO_T = @ECHO_T@
170 | EGREP = @EGREP@
171 | EXEEXT = @EXEEXT@
172 | GREP = @GREP@
173 | INSTALL = @INSTALL@
174 | INSTALL_DATA = @INSTALL_DATA@
175 | INSTALL_PROGRAM = @INSTALL_PROGRAM@
176 | INSTALL_SCRIPT = @INSTALL_SCRIPT@
177 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
178 | LDFLAGS = @LDFLAGS@
179 | LIBOBJS = @LIBOBJS@
180 | LIBS = @LIBS@
181 | LTLIBOBJS = @LTLIBOBJS@
182 | MAKEINFO = @MAKEINFO@
183 | MKDIR_P = @MKDIR_P@
184 | OBJEXT = @OBJEXT@
185 | PACKAGE = @PACKAGE@
186 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
187 | PACKAGE_NAME = @PACKAGE_NAME@
188 | PACKAGE_STRING = @PACKAGE_STRING@
189 | PACKAGE_TARNAME = @PACKAGE_TARNAME@
190 | PACKAGE_URL = @PACKAGE_URL@
191 | PACKAGE_VERSION = @PACKAGE_VERSION@
192 | PATH_SEPARATOR = @PATH_SEPARATOR@
193 | SET_MAKE = @SET_MAKE@
194 | SHELL = @SHELL@
195 | STRIP = @STRIP@
196 | VERSION = @VERSION@
197 | abs_builddir = @abs_builddir@
198 | abs_srcdir = @abs_srcdir@
199 | abs_top_builddir = @abs_top_builddir@
200 | abs_top_srcdir = @abs_top_srcdir@
201 | ac_ct_CC = @ac_ct_CC@
202 | am__include = @am__include@
203 | am__leading_dot = @am__leading_dot@
204 | am__quote = @am__quote@
205 | am__tar = @am__tar@
206 | am__untar = @am__untar@
207 | bindir = @bindir@
208 | build_alias = @build_alias@
209 | builddir = @builddir@
210 | datadir = @datadir@
211 | datarootdir = @datarootdir@
212 | docdir = @docdir@
213 | dvidir = @dvidir@
214 | exec_prefix = @exec_prefix@
215 | host_alias = @host_alias@
216 | htmldir = @htmldir@
217 | includedir = @includedir@
218 | infodir = @infodir@
219 | install_sh = @install_sh@
220 | libdir = @libdir@
221 | libexecdir = @libexecdir@
222 | localedir = @localedir@
223 | localstatedir = @localstatedir@
224 | mandir = @mandir@
225 | mkdir_p = @mkdir_p@
226 | oldincludedir = @oldincludedir@
227 | pdfdir = @pdfdir@
228 | prefix = @prefix@
229 | program_transform_name = @program_transform_name@
230 | psdir = @psdir@
231 | runstatedir = @runstatedir@
232 | sbindir = @sbindir@
233 | sharedstatedir = @sharedstatedir@
234 | srcdir = @srcdir@
235 | sysconfdir = @sysconfdir@
236 | target_alias = @target_alias@
237 | top_build_prefix = @top_build_prefix@
238 | top_builddir = @top_builddir@
239 | top_srcdir = @top_srcdir@
240 | dist_man_MANS = bonesi.1
241 | all: all-am
242 |
243 | .SUFFIXES:
244 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
245 | @for dep in $?; do \
246 | case '$(am__configure_deps)' in \
247 | *$$dep*) \
248 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
249 | && { if test -f $@; then exit 0; else break; fi; }; \
250 | exit 1;; \
251 | esac; \
252 | done; \
253 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \
254 | $(am__cd) $(top_srcdir) && \
255 | $(AUTOMAKE) --gnu man/Makefile
256 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
257 | @case '$?' in \
258 | *config.status*) \
259 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
260 | *) \
261 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
262 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
263 | esac;
264 |
265 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
266 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
267 |
268 | $(top_srcdir)/configure: $(am__configure_deps)
269 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
270 | $(ACLOCAL_M4): $(am__aclocal_m4_deps)
271 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
272 | $(am__aclocal_m4_deps):
273 | install-man1: $(dist_man_MANS)
274 | @$(NORMAL_INSTALL)
275 | @list1=''; \
276 | list2='$(dist_man_MANS)'; \
277 | test -n "$(man1dir)" \
278 | && test -n "`echo $$list1$$list2`" \
279 | || exit 0; \
280 | echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
281 | $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
282 | { for i in $$list1; do echo "$$i"; done; \
283 | if test -n "$$list2"; then \
284 | for i in $$list2; do echo "$$i"; done \
285 | | sed -n '/\.1[a-z]*$$/p'; \
286 | fi; \
287 | } | while read p; do \
288 | if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
289 | echo "$$d$$p"; echo "$$p"; \
290 | done | \
291 | sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
292 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
293 | sed 'N;N;s,\n, ,g' | { \
294 | list=; while read file base inst; do \
295 | if test "$$base" = "$$inst"; then list="$$list $$file"; else \
296 | echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
297 | $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
298 | fi; \
299 | done; \
300 | for i in $$list; do echo "$$i"; done | $(am__base_list) | \
301 | while read files; do \
302 | test -z "$$files" || { \
303 | echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
304 | $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
305 | done; }
306 |
307 | uninstall-man1:
308 | @$(NORMAL_UNINSTALL)
309 | @list=''; test -n "$(man1dir)" || exit 0; \
310 | files=`{ for i in $$list; do echo "$$i"; done; \
311 | l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
312 | sed -n '/\.1[a-z]*$$/p'; \
313 | } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
314 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
315 | dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
316 | tags TAGS:
317 |
318 | ctags CTAGS:
319 |
320 | cscope cscopelist:
321 |
322 |
323 | distdir: $(DISTFILES)
324 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
325 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
326 | list='$(DISTFILES)'; \
327 | dist_files=`for file in $$list; do echo $$file; done | \
328 | sed -e "s|^$$srcdirstrip/||;t" \
329 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
330 | case $$dist_files in \
331 | */*) $(MKDIR_P) `echo "$$dist_files" | \
332 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
333 | sort -u` ;; \
334 | esac; \
335 | for file in $$dist_files; do \
336 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
337 | if test -d $$d/$$file; then \
338 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
339 | if test -d "$(distdir)/$$file"; then \
340 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
341 | fi; \
342 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
343 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
344 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
345 | fi; \
346 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
347 | else \
348 | test -f "$(distdir)/$$file" \
349 | || cp -p $$d/$$file "$(distdir)/$$file" \
350 | || exit 1; \
351 | fi; \
352 | done
353 | check-am: all-am
354 | check: check-am
355 | all-am: Makefile $(MANS)
356 | installdirs:
357 | for dir in "$(DESTDIR)$(man1dir)"; do \
358 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \
359 | done
360 | install: install-am
361 | install-exec: install-exec-am
362 | install-data: install-data-am
363 | uninstall: uninstall-am
364 |
365 | install-am: all-am
366 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
367 |
368 | installcheck: installcheck-am
369 | install-strip:
370 | if test -z '$(STRIP)'; then \
371 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
372 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
373 | install; \
374 | else \
375 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
376 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
377 | "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
378 | fi
379 | mostlyclean-generic:
380 |
381 | clean-generic:
382 |
383 | distclean-generic:
384 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
385 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
386 |
387 | maintainer-clean-generic:
388 | @echo "This command is intended for maintainers to use"
389 | @echo "it deletes files that may require special tools to rebuild."
390 | clean: clean-am
391 |
392 | clean-am: clean-generic mostlyclean-am
393 |
394 | distclean: distclean-am
395 | -rm -f Makefile
396 | distclean-am: clean-am distclean-generic
397 |
398 | dvi: dvi-am
399 |
400 | dvi-am:
401 |
402 | html: html-am
403 |
404 | html-am:
405 |
406 | info: info-am
407 |
408 | info-am:
409 |
410 | install-data-am: install-man
411 |
412 | install-dvi: install-dvi-am
413 |
414 | install-dvi-am:
415 |
416 | install-exec-am:
417 |
418 | install-html: install-html-am
419 |
420 | install-html-am:
421 |
422 | install-info: install-info-am
423 |
424 | install-info-am:
425 |
426 | install-man: install-man1
427 |
428 | install-pdf: install-pdf-am
429 |
430 | install-pdf-am:
431 |
432 | install-ps: install-ps-am
433 |
434 | install-ps-am:
435 |
436 | installcheck-am:
437 |
438 | maintainer-clean: maintainer-clean-am
439 | -rm -f Makefile
440 | maintainer-clean-am: distclean-am maintainer-clean-generic
441 |
442 | mostlyclean: mostlyclean-am
443 |
444 | mostlyclean-am: mostlyclean-generic
445 |
446 | pdf: pdf-am
447 |
448 | pdf-am:
449 |
450 | ps: ps-am
451 |
452 | ps-am:
453 |
454 | uninstall-am: uninstall-man
455 |
456 | uninstall-man: uninstall-man1
457 |
458 | .MAKE: install-am install-strip
459 |
460 | .PHONY: all all-am check check-am clean clean-generic cscopelist-am \
461 | ctags-am distclean distclean-generic distdir dvi dvi-am html \
462 | html-am info info-am install install-am install-data \
463 | install-data-am install-dvi install-dvi-am install-exec \
464 | install-exec-am install-html install-html-am install-info \
465 | install-info-am install-man install-man1 install-pdf \
466 | install-pdf-am install-ps install-ps-am install-strip \
467 | installcheck installcheck-am installdirs maintainer-clean \
468 | maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
469 | pdf-am ps ps-am tags-am uninstall uninstall-am uninstall-man \
470 | uninstall-man1
471 |
472 | .PRECIOUS: Makefile
473 |
474 |
475 | # Tell versions [3.59,3.63) of GNU make to not export all variables.
476 | # Otherwise a system limit (for SysV at least) may be exceeded.
477 | .NOEXPORT:
478 |
--------------------------------------------------------------------------------
/man/bonesi.1:
--------------------------------------------------------------------------------
1 | .TH "BoNeSi" 1
2 | .SH NAME
3 | BoNeSi \- the DDoS Botnet Simulator
4 | .SH SYNOPSIS
5 | .B bonesi
6 | [\fIOPTION\fR]... dst_ip:port
7 | .SH DESCRIPTION
8 | .B BoNeSi
9 | is a DDoS Botnet Simulator for different protocol types.
10 | The attributes of the created packets and connections can be controlled by
11 | several parameters like packet rate or payload size. It spoofs the source IP
12 | addresses even when generating TCP traffic (HTTP-GET attack). Therefor it
13 | includes a simple TCP stack to handle tcp connections in promiscuous mode.
14 | In a working installation, one has to ensure that the response packets from
15 | the server are routed to the
16 | host running BoNeSi. Due to this limitation BoNeSi cannot be used in arbitrary
17 | network infrastructures running HTTP-GET attacks.
18 | The most advanced kind of traffic that can be generated are HTTP requests.
19 | .SH TCP/HTTP
20 | In order to make the http requests more realistic, several things are determined
21 | by chance:
22 | .br
23 | - \fBsource port:\fR out of range defined in code
24 | .br
25 | - \fBttl\fR: 3..255
26 | .br
27 | - \fBtcp options\fR: out of seven different real life options with different
28 | lengths and probabilities
29 | .br
30 | - \fBuser agent for http header\fR: out of a given list from a file
31 | .SH OPTIONS
32 | .TP
33 | \fB\-i, \-\-ips\fR=\fIFILENAME\fR
34 | read ip addresses from this file
35 | .TP
36 | \fB\-p, \-\-protocol\fR=\fIPROTO\fR
37 | udp (default), icmp or tcp
38 | .TP
39 | \fB\-r, \-\-send_rate\fR=\fINUM\fR
40 | packets per second, 0 = infinite (default)
41 | .TP
42 | \fB\-s, \-\-playload_size\fR=\fIBYTES\fR
43 | size of the paylod, (default: 32)
44 | .TP
45 | \fB\-o, \-\-stats_file\fR=\fIFILENAME\fR
46 | filename for the statistics, (default: 'stats')
47 | .TP
48 | \fB\-c, \-\-max_packets\fR=\fINUM\fR
49 | maximum number of packets (requests at tcp/http)
50 | .br
51 | 0 = infinite (default)
52 | .TP
53 | \fB\-\-integer
54 | IPs are integers in host byte order instead of in dotted notation
55 | .TP
56 | \fB\-t, \-\-max_bots\fR=\fINUM\fR
57 | determine max_bots in the 24bit prefix randomly (1-256)
58 | .TP
59 | \fB\-u, \-\-url\fR=\fIURL\fR
60 | the url (default: '/') (only for tcp/http)
61 | .TP
62 | \fB\-l, \-\-url_list\fR=\fIFILENAME\fR
63 | filename with url list (only for tcp/http)
64 | .TP
65 | \fB\-b, \-\-useragent_list\fR=\fIFILENAME\fR
66 | filename with useragent list (only for tcp/http)
67 | .TP
68 | \fB\-d, \-\-device\fR=\fIDEVICE\fR
69 | network listening device (only for tcp/http)
70 | .TP
71 | \fB\-v, \-\-verbose
72 | print additional debug messages
73 | .TP
74 | \fB\-h, \-\-help
75 | print the help message and exit
76 | .SH EXAMPLES
77 | \fBSend 2 udp packets per second with a payload of 1200bytes to host 192.168.2.1 on port 2405:
78 | .br
79 | \fRbonesi -p udp -s 1200 -r 2 -i 50k-bots 192.168.2.1:2405
80 | .P
81 | \fBSend as many as possible, but only 100 in total udp packets with a payload of 10bytes to host 192.168.2.1 on port 2405:
82 | .br
83 | \fRbonesi -p udp -s 10 -c 100 -i 50k-bots 192.168.2.1:2405
84 | .P
85 | \fBRequest http://192.168.2.1/site.html 1000 times per second via eth1:
86 | .br
87 | \fRbonesi -p tcp -r 1000 -i 50k-bots -u /site.html -d eth1 192.168.2.1:80
88 | .SH AUTHOR
89 | Written by Matthias Reif, Markus Goldstein and Christian Jansohn
90 | .SH REPORTING BUGS
91 | Report bugs to .
92 | .SH COPYRIGHT
93 | Copyright 2008 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz
94 | or its licensors, as applicable.
95 | .P
96 | This is free software. Licensed under the Apache License, Version 2.0.
97 | There is NO WARRANTY, to the extent permitted by law.
98 |
--------------------------------------------------------------------------------
/missing:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # Common stub for a few missing GNU programs while installing.
3 | # Copyright (C) 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
4 | # Franc,ois Pinard , 1996.
5 |
6 | # This program is free software; you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation; either version 2, or (at your option)
9 | # any later version.
10 |
11 | # This program is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 |
16 | # You should have received a copy of the GNU General Public License
17 | # along with this program; if not, write to the Free Software
18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 | # 02111-1307, USA.
20 |
21 | if test $# -eq 0; then
22 | echo 1>&2 "Try \`$0 --help' for more information"
23 | exit 1
24 | fi
25 |
26 | # In the cases where this matters, `missing' is being run in the
27 | # srcdir already.
28 | if test -f configure.in; then
29 | configure_ac=configure.ac
30 | else
31 | configure_ac=configure.in
32 | fi
33 |
34 | case "$1" in
35 |
36 | -h|--h|--he|--hel|--help)
37 | echo "\
38 | $0 [OPTION]... PROGRAM [ARGUMENT]...
39 |
40 | Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
41 | error status if there is no known handling for PROGRAM.
42 |
43 | Options:
44 | -h, --help display this help and exit
45 | -v, --version output version information and exit
46 |
47 | Supported PROGRAM values:
48 | aclocal touch file \`aclocal.m4'
49 | autoconf touch file \`configure'
50 | autoheader touch file \`config.h.in'
51 | automake touch all \`Makefile.in' files
52 | bison create \`y.tab.[ch]', if possible, from existing .[ch]
53 | flex create \`lex.yy.c', if possible, from existing .c
54 | lex create \`lex.yy.c', if possible, from existing .c
55 | makeinfo touch the output file
56 | yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
57 | ;;
58 |
59 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
60 | echo "missing - GNU libit 0.0"
61 | ;;
62 |
63 | -*)
64 | echo 1>&2 "$0: Unknown \`$1' option"
65 | echo 1>&2 "Try \`$0 --help' for more information"
66 | exit 1
67 | ;;
68 |
69 | aclocal*)
70 | echo 1>&2 "\
71 | WARNING: \`$1' is missing on your system. You should only need it if
72 | you modified \`acinclude.m4' or \`$configure_ac'. You might want
73 | to install the \`Automake' and \`Perl' packages. Grab them from
74 | any GNU archive site."
75 | touch aclocal.m4
76 | ;;
77 |
78 | autoconf)
79 | echo 1>&2 "\
80 | WARNING: \`$1' is missing on your system. You should only need it if
81 | you modified \`$configure_ac'. You might want to install the
82 | \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
83 | archive site."
84 | touch configure
85 | ;;
86 |
87 | autoheader)
88 | echo 1>&2 "\
89 | WARNING: \`$1' is missing on your system. You should only need it if
90 | you modified \`acconfig.h' or \`$configure_ac'. You might want
91 | to install the \`Autoconf' and \`GNU m4' packages. Grab them
92 | from any GNU archive site."
93 | files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' $configure_ac`
94 | test -z "$files" && files="config.h"
95 | touch_files=
96 | for f in $files; do
97 | case "$f" in
98 | *:*) touch_files="$touch_files "`echo "$f" |
99 | sed -e 's/^[^:]*://' -e 's/:.*//'`;;
100 | *) touch_files="$touch_files $f.in";;
101 | esac
102 | done
103 | touch $touch_files
104 | ;;
105 |
106 | automake*)
107 | echo 1>&2 "\
108 | WARNING: \`$1' is missing on your system. You should only need it if
109 | you modified \`Makefile.am', \`acinclude.m4' or \`$configure_ac'.
110 | You might want to install the \`Automake' and \`Perl' packages.
111 | Grab them from any GNU archive site."
112 | find . -type f -name Makefile.am -print |
113 | sed 's/\.am$/.in/' |
114 | while read f; do touch "$f"; done
115 | ;;
116 |
117 | bison|yacc)
118 | echo 1>&2 "\
119 | WARNING: \`$1' is missing on your system. You should only need it if
120 | you modified a \`.y' file. You may need the \`Bison' package
121 | in order for those modifications to take effect. You can get
122 | \`Bison' from any GNU archive site."
123 | rm -f y.tab.c y.tab.h
124 | if [ $# -ne 1 ]; then
125 | eval LASTARG="\${$#}"
126 | case "$LASTARG" in
127 | *.y)
128 | SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
129 | if [ -f "$SRCFILE" ]; then
130 | cp "$SRCFILE" y.tab.c
131 | fi
132 | SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
133 | if [ -f "$SRCFILE" ]; then
134 | cp "$SRCFILE" y.tab.h
135 | fi
136 | ;;
137 | esac
138 | fi
139 | if [ ! -f y.tab.h ]; then
140 | echo >y.tab.h
141 | fi
142 | if [ ! -f y.tab.c ]; then
143 | echo 'main() { return 0; }' >y.tab.c
144 | fi
145 | ;;
146 |
147 | lex|flex)
148 | echo 1>&2 "\
149 | WARNING: \`$1' is missing on your system. You should only need it if
150 | you modified a \`.l' file. You may need the \`Flex' package
151 | in order for those modifications to take effect. You can get
152 | \`Flex' from any GNU archive site."
153 | rm -f lex.yy.c
154 | if [ $# -ne 1 ]; then
155 | eval LASTARG="\${$#}"
156 | case "$LASTARG" in
157 | *.l)
158 | SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
159 | if [ -f "$SRCFILE" ]; then
160 | cp "$SRCFILE" lex.yy.c
161 | fi
162 | ;;
163 | esac
164 | fi
165 | if [ ! -f lex.yy.c ]; then
166 | echo 'main() { return 0; }' >lex.yy.c
167 | fi
168 | ;;
169 |
170 | makeinfo)
171 | echo 1>&2 "\
172 | WARNING: \`$1' is missing on your system. You should only need it if
173 | you modified a \`.texi' or \`.texinfo' file, or any other file
174 | indirectly affecting the aspect of the manual. The spurious
175 | call might also be the consequence of using a buggy \`make' (AIX,
176 | DU, IRIX). You might want to install the \`Texinfo' package or
177 | the \`GNU make' package. Grab either from any GNU archive site."
178 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
179 | if test -z "$file"; then
180 | file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
181 | file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
182 | fi
183 | touch $file
184 | ;;
185 |
186 | *)
187 | echo 1>&2 "\
188 | WARNING: \`$1' is needed, and you do not seem to have it handy on your
189 | system. You might have modified some files without having the
190 | proper tools for further handling them. Check the \`README' file,
191 | it often tells you about the needed prerequirements for installing
192 | this package. You may also peek at any GNU archive site, in case
193 | some other package would contain this missing \`$1' program."
194 | exit 1
195 | ;;
196 | esac
197 |
198 | exit 0
199 |
--------------------------------------------------------------------------------
/mkinstalldirs:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # mkinstalldirs --- make directory hierarchy
3 | # Author: Noah Friedman
4 | # Created: 1993-05-16
5 | # Public domain
6 |
7 | # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
8 |
9 | errstatus=0
10 |
11 | for file
12 | do
13 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
14 | shift
15 |
16 | pathcomp=
17 | for d
18 | do
19 | pathcomp="$pathcomp$d"
20 | case "$pathcomp" in
21 | -* ) pathcomp=./$pathcomp ;;
22 | esac
23 |
24 | if test ! -d "$pathcomp"; then
25 | echo "mkdir $pathcomp"
26 |
27 | mkdir "$pathcomp" || lasterr=$?
28 |
29 | if test ! -d "$pathcomp"; then
30 | errstatus=$lasterr
31 | fi
32 | fi
33 |
34 | pathcomp="$pathcomp/"
35 | done
36 | done
37 |
38 | exit $errstatus
39 |
40 | # mkinstalldirs ends here
41 |
--------------------------------------------------------------------------------
/src/Makefile.am:
--------------------------------------------------------------------------------
1 |
2 | bin_PROGRAMS = bonesi
3 | bonesi_SOURCES = bonesi.c tcpoptions.h http.h
4 |
5 |
--------------------------------------------------------------------------------
/src/Makefile.in:
--------------------------------------------------------------------------------
1 | # Makefile.in generated by automake 1.15.1 from Makefile.am.
2 | # @configure_input@
3 |
4 | # Copyright (C) 1994-2017 Free Software Foundation, Inc.
5 |
6 | # This Makefile.in is free software; the Free Software Foundation
7 | # gives unlimited permission to copy and/or distribute it,
8 | # with or without modifications, as long as this notice is preserved.
9 |
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 | # PARTICULAR PURPOSE.
14 |
15 | @SET_MAKE@
16 |
17 | VPATH = @srcdir@
18 | am__is_gnu_make = { \
19 | if test -z '$(MAKELEVEL)'; then \
20 | false; \
21 | elif test -n '$(MAKE_HOST)'; then \
22 | true; \
23 | elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
24 | true; \
25 | else \
26 | false; \
27 | fi; \
28 | }
29 | am__make_running_with_option = \
30 | case $${target_option-} in \
31 | ?) ;; \
32 | *) echo "am__make_running_with_option: internal error: invalid" \
33 | "target option '$${target_option-}' specified" >&2; \
34 | exit 1;; \
35 | esac; \
36 | has_opt=no; \
37 | sane_makeflags=$$MAKEFLAGS; \
38 | if $(am__is_gnu_make); then \
39 | sane_makeflags=$$MFLAGS; \
40 | else \
41 | case $$MAKEFLAGS in \
42 | *\\[\ \ ]*) \
43 | bs=\\; \
44 | sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
45 | | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
46 | esac; \
47 | fi; \
48 | skip_next=no; \
49 | strip_trailopt () \
50 | { \
51 | flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
52 | }; \
53 | for flg in $$sane_makeflags; do \
54 | test $$skip_next = yes && { skip_next=no; continue; }; \
55 | case $$flg in \
56 | *=*|--*) continue;; \
57 | -*I) strip_trailopt 'I'; skip_next=yes;; \
58 | -*I?*) strip_trailopt 'I';; \
59 | -*O) strip_trailopt 'O'; skip_next=yes;; \
60 | -*O?*) strip_trailopt 'O';; \
61 | -*l) strip_trailopt 'l'; skip_next=yes;; \
62 | -*l?*) strip_trailopt 'l';; \
63 | -[dEDm]) skip_next=yes;; \
64 | -[JT]) skip_next=yes;; \
65 | esac; \
66 | case $$flg in \
67 | *$$target_option*) has_opt=yes; break;; \
68 | esac; \
69 | done; \
70 | test $$has_opt = yes
71 | am__make_dryrun = (target_option=n; $(am__make_running_with_option))
72 | am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
73 | pkgdatadir = $(datadir)/@PACKAGE@
74 | pkgincludedir = $(includedir)/@PACKAGE@
75 | pkglibdir = $(libdir)/@PACKAGE@
76 | pkglibexecdir = $(libexecdir)/@PACKAGE@
77 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
78 | install_sh_DATA = $(install_sh) -c -m 644
79 | install_sh_PROGRAM = $(install_sh) -c
80 | install_sh_SCRIPT = $(install_sh) -c
81 | INSTALL_HEADER = $(INSTALL_DATA)
82 | transform = $(program_transform_name)
83 | NORMAL_INSTALL = :
84 | PRE_INSTALL = :
85 | POST_INSTALL = :
86 | NORMAL_UNINSTALL = :
87 | PRE_UNINSTALL = :
88 | POST_UNINSTALL = :
89 | bin_PROGRAMS = bonesi$(EXEEXT)
90 | subdir = src
91 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
92 | am__aclocal_m4_deps = $(top_srcdir)/configure.ac
93 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
94 | $(ACLOCAL_M4)
95 | DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
96 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
97 | CONFIG_HEADER = $(top_builddir)/config.h
98 | CONFIG_CLEAN_FILES =
99 | CONFIG_CLEAN_VPATH_FILES =
100 | am__installdirs = "$(DESTDIR)$(bindir)"
101 | PROGRAMS = $(bin_PROGRAMS)
102 | am_bonesi_OBJECTS = bonesi.$(OBJEXT)
103 | bonesi_OBJECTS = $(am_bonesi_OBJECTS)
104 | bonesi_LDADD = $(LDADD)
105 | AM_V_P = $(am__v_P_@AM_V@)
106 | am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
107 | am__v_P_0 = false
108 | am__v_P_1 = :
109 | AM_V_GEN = $(am__v_GEN_@AM_V@)
110 | am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
111 | am__v_GEN_0 = @echo " GEN " $@;
112 | am__v_GEN_1 =
113 | AM_V_at = $(am__v_at_@AM_V@)
114 | am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
115 | am__v_at_0 = @
116 | am__v_at_1 =
117 | DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
118 | depcomp = $(SHELL) $(top_srcdir)/depcomp
119 | am__depfiles_maybe = depfiles
120 | am__mv = mv -f
121 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
122 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
123 | AM_V_CC = $(am__v_CC_@AM_V@)
124 | am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
125 | am__v_CC_0 = @echo " CC " $@;
126 | am__v_CC_1 =
127 | CCLD = $(CC)
128 | LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
129 | AM_V_CCLD = $(am__v_CCLD_@AM_V@)
130 | am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
131 | am__v_CCLD_0 = @echo " CCLD " $@;
132 | am__v_CCLD_1 =
133 | SOURCES = $(bonesi_SOURCES)
134 | DIST_SOURCES = $(bonesi_SOURCES)
135 | am__can_run_installinfo = \
136 | case $$AM_UPDATE_INFO_DIR in \
137 | n|no|NO) false;; \
138 | *) (install-info --version) >/dev/null 2>&1;; \
139 | esac
140 | am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
141 | # Read a list of newline-separated strings from the standard input,
142 | # and print each of them once, without duplicates. Input order is
143 | # *not* preserved.
144 | am__uniquify_input = $(AWK) '\
145 | BEGIN { nonempty = 0; } \
146 | { items[$$0] = 1; nonempty = 1; } \
147 | END { if (nonempty) { for (i in items) print i; }; } \
148 | '
149 | # Make sure the list of sources is unique. This is necessary because,
150 | # e.g., the same source file might be shared among _SOURCES variables
151 | # for different programs/libraries.
152 | am__define_uniq_tagged_files = \
153 | list='$(am__tagged_files)'; \
154 | unique=`for i in $$list; do \
155 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
156 | done | $(am__uniquify_input)`
157 | ETAGS = etags
158 | CTAGS = ctags
159 | am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
160 | $(top_srcdir)/mkinstalldirs
161 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
162 | ACLOCAL = @ACLOCAL@
163 | AMTAR = @AMTAR@
164 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
165 | AUTOCONF = @AUTOCONF@
166 | AUTOHEADER = @AUTOHEADER@
167 | AUTOMAKE = @AUTOMAKE@
168 | AWK = @AWK@
169 | CC = @CC@
170 | CCDEPMODE = @CCDEPMODE@
171 | CFLAGS = @CFLAGS@
172 | CPP = @CPP@
173 | CPPFLAGS = @CPPFLAGS@
174 | CYGPATH_W = @CYGPATH_W@
175 | DEFS = @DEFS@
176 | DEPDIR = @DEPDIR@
177 | ECHO_C = @ECHO_C@
178 | ECHO_N = @ECHO_N@
179 | ECHO_T = @ECHO_T@
180 | EGREP = @EGREP@
181 | EXEEXT = @EXEEXT@
182 | GREP = @GREP@
183 | INSTALL = @INSTALL@
184 | INSTALL_DATA = @INSTALL_DATA@
185 | INSTALL_PROGRAM = @INSTALL_PROGRAM@
186 | INSTALL_SCRIPT = @INSTALL_SCRIPT@
187 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
188 | LDFLAGS = @LDFLAGS@
189 | LIBOBJS = @LIBOBJS@
190 | LIBS = @LIBS@
191 | LTLIBOBJS = @LTLIBOBJS@
192 | MAKEINFO = @MAKEINFO@
193 | MKDIR_P = @MKDIR_P@
194 | OBJEXT = @OBJEXT@
195 | PACKAGE = @PACKAGE@
196 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
197 | PACKAGE_NAME = @PACKAGE_NAME@
198 | PACKAGE_STRING = @PACKAGE_STRING@
199 | PACKAGE_TARNAME = @PACKAGE_TARNAME@
200 | PACKAGE_URL = @PACKAGE_URL@
201 | PACKAGE_VERSION = @PACKAGE_VERSION@
202 | PATH_SEPARATOR = @PATH_SEPARATOR@
203 | SET_MAKE = @SET_MAKE@
204 | SHELL = @SHELL@
205 | STRIP = @STRIP@
206 | VERSION = @VERSION@
207 | abs_builddir = @abs_builddir@
208 | abs_srcdir = @abs_srcdir@
209 | abs_top_builddir = @abs_top_builddir@
210 | abs_top_srcdir = @abs_top_srcdir@
211 | ac_ct_CC = @ac_ct_CC@
212 | am__include = @am__include@
213 | am__leading_dot = @am__leading_dot@
214 | am__quote = @am__quote@
215 | am__tar = @am__tar@
216 | am__untar = @am__untar@
217 | bindir = @bindir@
218 | build_alias = @build_alias@
219 | builddir = @builddir@
220 | datadir = @datadir@
221 | datarootdir = @datarootdir@
222 | docdir = @docdir@
223 | dvidir = @dvidir@
224 | exec_prefix = @exec_prefix@
225 | host_alias = @host_alias@
226 | htmldir = @htmldir@
227 | includedir = @includedir@
228 | infodir = @infodir@
229 | install_sh = @install_sh@
230 | libdir = @libdir@
231 | libexecdir = @libexecdir@
232 | localedir = @localedir@
233 | localstatedir = @localstatedir@
234 | mandir = @mandir@
235 | mkdir_p = @mkdir_p@
236 | oldincludedir = @oldincludedir@
237 | pdfdir = @pdfdir@
238 | prefix = @prefix@
239 | program_transform_name = @program_transform_name@
240 | psdir = @psdir@
241 | runstatedir = @runstatedir@
242 | sbindir = @sbindir@
243 | sharedstatedir = @sharedstatedir@
244 | srcdir = @srcdir@
245 | sysconfdir = @sysconfdir@
246 | target_alias = @target_alias@
247 | top_build_prefix = @top_build_prefix@
248 | top_builddir = @top_builddir@
249 | top_srcdir = @top_srcdir@
250 | bonesi_SOURCES = bonesi.c tcpoptions.h http.h
251 | all: all-am
252 |
253 | .SUFFIXES:
254 | .SUFFIXES: .c .o .obj
255 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
256 | @for dep in $?; do \
257 | case '$(am__configure_deps)' in \
258 | *$$dep*) \
259 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
260 | && { if test -f $@; then exit 0; else break; fi; }; \
261 | exit 1;; \
262 | esac; \
263 | done; \
264 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
265 | $(am__cd) $(top_srcdir) && \
266 | $(AUTOMAKE) --gnu src/Makefile
267 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
268 | @case '$?' in \
269 | *config.status*) \
270 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
271 | *) \
272 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
273 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
274 | esac;
275 |
276 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
277 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
278 |
279 | $(top_srcdir)/configure: $(am__configure_deps)
280 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
281 | $(ACLOCAL_M4): $(am__aclocal_m4_deps)
282 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
283 | $(am__aclocal_m4_deps):
284 | install-binPROGRAMS: $(bin_PROGRAMS)
285 | @$(NORMAL_INSTALL)
286 | @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
287 | if test -n "$$list"; then \
288 | echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
289 | $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
290 | fi; \
291 | for p in $$list; do echo "$$p $$p"; done | \
292 | sed 's/$(EXEEXT)$$//' | \
293 | while read p p1; do if test -f $$p \
294 | ; then echo "$$p"; echo "$$p"; else :; fi; \
295 | done | \
296 | sed -e 'p;s,.*/,,;n;h' \
297 | -e 's|.*|.|' \
298 | -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
299 | sed 'N;N;N;s,\n, ,g' | \
300 | $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
301 | { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
302 | if ($$2 == $$4) files[d] = files[d] " " $$1; \
303 | else { print "f", $$3 "/" $$4, $$1; } } \
304 | END { for (d in files) print "f", d, files[d] }' | \
305 | while read type dir files; do \
306 | if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
307 | test -z "$$files" || { \
308 | echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
309 | $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
310 | } \
311 | ; done
312 |
313 | uninstall-binPROGRAMS:
314 | @$(NORMAL_UNINSTALL)
315 | @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
316 | files=`for p in $$list; do echo "$$p"; done | \
317 | sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
318 | -e 's/$$/$(EXEEXT)/' \
319 | `; \
320 | test -n "$$list" || exit 0; \
321 | echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
322 | cd "$(DESTDIR)$(bindir)" && rm -f $$files
323 |
324 | clean-binPROGRAMS:
325 | -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
326 |
327 | bonesi$(EXEEXT): $(bonesi_OBJECTS) $(bonesi_DEPENDENCIES) $(EXTRA_bonesi_DEPENDENCIES)
328 | @rm -f bonesi$(EXEEXT)
329 | $(AM_V_CCLD)$(LINK) $(bonesi_OBJECTS) $(bonesi_LDADD) $(LIBS)
330 |
331 | mostlyclean-compile:
332 | -rm -f *.$(OBJEXT)
333 |
334 | distclean-compile:
335 | -rm -f *.tab.c
336 |
337 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bonesi.Po@am__quote@
338 |
339 | .c.o:
340 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
341 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
342 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
343 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
344 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
345 |
346 | .c.obj:
347 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
348 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
349 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
350 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
351 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
352 |
353 | ID: $(am__tagged_files)
354 | $(am__define_uniq_tagged_files); mkid -fID $$unique
355 | tags: tags-am
356 | TAGS: tags
357 |
358 | tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
359 | set x; \
360 | here=`pwd`; \
361 | $(am__define_uniq_tagged_files); \
362 | shift; \
363 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
364 | test -n "$$unique" || unique=$$empty_fix; \
365 | if test $$# -gt 0; then \
366 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
367 | "$$@" $$unique; \
368 | else \
369 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
370 | $$unique; \
371 | fi; \
372 | fi
373 | ctags: ctags-am
374 |
375 | CTAGS: ctags
376 | ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
377 | $(am__define_uniq_tagged_files); \
378 | test -z "$(CTAGS_ARGS)$$unique" \
379 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
380 | $$unique
381 |
382 | GTAGS:
383 | here=`$(am__cd) $(top_builddir) && pwd` \
384 | && $(am__cd) $(top_srcdir) \
385 | && gtags -i $(GTAGS_ARGS) "$$here"
386 | cscopelist: cscopelist-am
387 |
388 | cscopelist-am: $(am__tagged_files)
389 | list='$(am__tagged_files)'; \
390 | case "$(srcdir)" in \
391 | [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
392 | *) sdir=$(subdir)/$(srcdir) ;; \
393 | esac; \
394 | for i in $$list; do \
395 | if test -f "$$i"; then \
396 | echo "$(subdir)/$$i"; \
397 | else \
398 | echo "$$sdir/$$i"; \
399 | fi; \
400 | done >> $(top_builddir)/cscope.files
401 |
402 | distclean-tags:
403 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
404 |
405 | distdir: $(DISTFILES)
406 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
407 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
408 | list='$(DISTFILES)'; \
409 | dist_files=`for file in $$list; do echo $$file; done | \
410 | sed -e "s|^$$srcdirstrip/||;t" \
411 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
412 | case $$dist_files in \
413 | */*) $(MKDIR_P) `echo "$$dist_files" | \
414 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
415 | sort -u` ;; \
416 | esac; \
417 | for file in $$dist_files; do \
418 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
419 | if test -d $$d/$$file; then \
420 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
421 | if test -d "$(distdir)/$$file"; then \
422 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
423 | fi; \
424 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
425 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
426 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
427 | fi; \
428 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
429 | else \
430 | test -f "$(distdir)/$$file" \
431 | || cp -p $$d/$$file "$(distdir)/$$file" \
432 | || exit 1; \
433 | fi; \
434 | done
435 | check-am: all-am
436 | check: check-am
437 | all-am: Makefile $(PROGRAMS)
438 | installdirs:
439 | for dir in "$(DESTDIR)$(bindir)"; do \
440 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \
441 | done
442 | install: install-am
443 | install-exec: install-exec-am
444 | install-data: install-data-am
445 | uninstall: uninstall-am
446 |
447 | install-am: all-am
448 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
449 |
450 | installcheck: installcheck-am
451 | install-strip:
452 | if test -z '$(STRIP)'; then \
453 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
454 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
455 | install; \
456 | else \
457 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
458 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
459 | "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
460 | fi
461 | mostlyclean-generic:
462 |
463 | clean-generic:
464 |
465 | distclean-generic:
466 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
467 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
468 |
469 | maintainer-clean-generic:
470 | @echo "This command is intended for maintainers to use"
471 | @echo "it deletes files that may require special tools to rebuild."
472 | clean: clean-am
473 |
474 | clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
475 |
476 | distclean: distclean-am
477 | -rm -rf ./$(DEPDIR)
478 | -rm -f Makefile
479 | distclean-am: clean-am distclean-compile distclean-generic \
480 | distclean-tags
481 |
482 | dvi: dvi-am
483 |
484 | dvi-am:
485 |
486 | html: html-am
487 |
488 | html-am:
489 |
490 | info: info-am
491 |
492 | info-am:
493 |
494 | install-data-am:
495 |
496 | install-dvi: install-dvi-am
497 |
498 | install-dvi-am:
499 |
500 | install-exec-am: install-binPROGRAMS
501 |
502 | install-html: install-html-am
503 |
504 | install-html-am:
505 |
506 | install-info: install-info-am
507 |
508 | install-info-am:
509 |
510 | install-man:
511 |
512 | install-pdf: install-pdf-am
513 |
514 | install-pdf-am:
515 |
516 | install-ps: install-ps-am
517 |
518 | install-ps-am:
519 |
520 | installcheck-am:
521 |
522 | maintainer-clean: maintainer-clean-am
523 | -rm -rf ./$(DEPDIR)
524 | -rm -f Makefile
525 | maintainer-clean-am: distclean-am maintainer-clean-generic
526 |
527 | mostlyclean: mostlyclean-am
528 |
529 | mostlyclean-am: mostlyclean-compile mostlyclean-generic
530 |
531 | pdf: pdf-am
532 |
533 | pdf-am:
534 |
535 | ps: ps-am
536 |
537 | ps-am:
538 |
539 | uninstall-am: uninstall-binPROGRAMS
540 |
541 | .MAKE: install-am install-strip
542 |
543 | .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
544 | clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \
545 | distclean distclean-compile distclean-generic distclean-tags \
546 | distdir dvi dvi-am html html-am info info-am install \
547 | install-am install-binPROGRAMS install-data install-data-am \
548 | install-dvi install-dvi-am install-exec install-exec-am \
549 | install-html install-html-am install-info install-info-am \
550 | install-man install-pdf install-pdf-am install-ps \
551 | install-ps-am install-strip installcheck installcheck-am \
552 | installdirs maintainer-clean maintainer-clean-generic \
553 | mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
554 | ps ps-am tags tags-am uninstall uninstall-am \
555 | uninstall-binPROGRAMS
556 |
557 | .PRECIOUS: Makefile
558 |
559 |
560 | # Tell versions [3.59,3.63) of GNU make to not export all variables.
561 | # Otherwise a system limit (for SysV at least) may be exceeded.
562 | .NOEXPORT:
563 |
--------------------------------------------------------------------------------
/src/bonesi.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2006-2007 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz
3 | *
4 | * You may not use this file except under the terms of the accompanying license.
5 | *
6 | * Unless required by applicable law or agreed to in writing, software
7 | * distributed under the License is distributed on an "AS IS" BASIS,
8 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 | * See the License for the specific language governing permissions and
10 | * limitations under the License.
11 | *
12 | * Project: BoNeSi
13 | * File: bonesi.c
14 | * Purpose: a DDoS Botnet Simulator for spoofing ICMP,UDP attacks and HTTP-GET floods
15 | * Responsible: Markus Goldstein
16 | * Primary Repository: https://github.com/Markus-Go/bonesi
17 | * Web Sites: madm.dfki.de, www.goldiges.de
18 | */
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 |
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 |
38 | #include "tcpoptions.h"
39 | #include "http.h"
40 |
41 | #define STATS_SIZE 60
42 |
43 | static const u_int32_t WINDOW_SIZE = 4096;
44 | static const u_int16_t IP_ID = 0;
45 | static const time_t TIMEOUT = 5;
46 |
47 | // the port range to avoid conflicts with other programs running in
48 | // promiscuous mode, e.g. other instances of BoNeSi running in parallel
49 | static const u_int16_t MIN_PORT = 10000;
50 | static const u_int16_t MAX_PORT = 35534; // use 65534 instead of 65535 to avoid compiler warning on comparison
51 |
52 | static u_int32_t finishedCount = 0;
53 | static u_int32_t resetCount = 0;
54 |
55 | /// to keep track of the connections
56 | typedef enum{NOT_CONNECTED,CONNECTING,ESTABLISHED,CLOSED} CONNECTION_STATUS;
57 |
58 | typedef struct {
59 | CONNECTION_STATUS status;
60 | //// for timeouts
61 | time_t startTime;
62 | ///index to referer in urlarray urls
63 | int referer;
64 | ///index to useragent in useragents
65 | int useragent;
66 | ///index to url number
67 | int url;
68 | ///payload offset
69 | int pload_offset;
70 | } Connection;
71 |
72 | unsigned long cnt;
73 | int secondCounter;
74 | u_int32_t dstIp, srcIp; //global variables for src and dest IP in network format!
75 | u_short srcPort, dstPort;
76 | libnet_ptag_t ipTag = 0;
77 | libnet_ptag_t udpTag = 0;
78 | libnet_ptag_t icmpTag = 0;
79 | int ipSize;
80 | int payloadSize = 32;
81 | unsigned char *payload;
82 | int rate = 0;
83 | char* filename = NULL; //filename of ip list
84 | char* urlfilename = NULL; //filename of url list
85 | char* useragentfilename = NULL; // filename of useragent list
86 | char* device = NULL;
87 | char* addr = NULL;
88 | int stats[STATS_SIZE];
89 | int success[STATS_SIZE];
90 | int currStat;
91 | char* statsFilename = "stats";
92 | int proto= IPPROTO_UDP;
93 | int integer = 0;
94 | int toggle = 0;
95 | int maxPackets = 0;
96 | int url_flag = 0; //flag to indicate if a url has been specified with parameter -u
97 | char request[URL_SIZE];
98 | unsigned int MTU = 0;
99 | unsigned int fragMode = 99;
100 |
101 | pthread_t pcapThread;
102 | extern char *optarg;
103 |
104 | void parseArgs(int argc, char *argv[]);
105 | void printArgs();
106 | void buildIp(size_t ipSize, libnet_t *libnetHandle, libnet_ptag_t ipTag, u_int32_t srcIp);
107 | void printIp(u_int32_t ip);
108 | void* startPcap(void* arg);
109 | void acknowledge(libnet_t *libnetHandle, pcap_t* pcapHandle);
110 | void readIps();
111 | int getIp(FILE *file, u_int32_t* ip);
112 | ssize_t getline(char **lineptr, size_t *n, FILE *stream);
113 | void initTcpOptions();
114 | void sendAck(libnet_t *libnetHandle, const struct iphdr* ip, const struct tcphdr* tcp, u_int32_t key);
115 |
116 | unsigned long numIps;
117 | u_int32_t** srcIpsSpoof;
118 | char** useragents;
119 | int nuseragents = 0;
120 | Url_array urls;
121 | int rp_filter = NULL;
122 | void INThandler(int);
123 |
124 | TcpOption tcpOptions[NUM_TCP_OPTIONS];
125 |
126 | Connection connections[65536*256];
127 |
128 | // more output messages
129 | int verbose = 0;
130 |
131 | int main(int argc, char *argv[]) {
132 | srand(time(NULL)*getpid());
133 | parseArgs(argc, argv);
134 |
135 | char buf[1024];
136 | FILE *f = NULL;
137 | extern int errno;
138 | signal(SIGINT, INThandler);
139 |
140 | // we need to disable revesered path, otherwise we cannot spoof
141 | f = fopen("/proc/sys/net/ipv4/conf/all/rp_filter", "r");
142 | if(!f) {
143 | fprintf(stderr, "Can't open proc file system: %s. Make sure to disable rp_filter manually.\n", strerror( errno ));
144 | }
145 | else {
146 | if (!fgets(buf, 1023, f)) {
147 | fprintf(stderr, "Can't read proc file system. Permissions?");
148 | }
149 | rp_filter = atoi(buf);
150 | fclose(f);
151 | }
152 |
153 | if (rp_filter == 1) {
154 | f = fopen("/proc/sys/net/ipv4/conf/all/rp_filter", "w");
155 | if(!f) {
156 | fprintf(stderr, "Can't open proc file system: %s. Make sure to disable rp_filter manually.\n", strerror( errno ));
157 | }
158 | else {
159 | fprintf(f,"0");
160 | fclose(f);
161 | }
162 | }
163 |
164 | char errbuf[LIBNET_ERRBUF_SIZE];
165 | libnet_t *libnetHandle = libnet_init(LIBNET_RAW4, device, errbuf);
166 | if (libnetHandle == NULL) {
167 | fprintf(stderr, "libnet_init() failed: %s\n", errbuf);
168 | exit(EXIT_FAILURE);
169 | }
170 | if ((dstIp = libnet_name2addr4(libnetHandle, addr, LIBNET_RESOLVE)) == -1) {
171 | fprintf(stderr, "Bad destination IP address: %s\n", addr);
172 | libnet_destroy(libnetHandle);
173 | exit(EXIT_FAILURE);
174 | }
175 | free(addr);
176 | printArgs();
177 |
178 | if(filename) {
179 | readIps();
180 | } else {
181 | numIps = 1;
182 | srcIpsSpoof = (u_int32_t**)malloc(sizeof(u_int32_t*));
183 | srcIpsSpoof[0] = (u_int32_t*)malloc(sizeof(u_int32_t)*2);
184 | srcIpsSpoof[0][0] = ntohl(libnet_get_ipaddr4(libnetHandle));
185 | srcIpsSpoof[0][1] = 0;
186 | }
187 |
188 | if(urlfilename){
189 | urls = readURLs(urlfilename, verbose);
190 | }
191 |
192 | // -- for testing --
193 | if(verbose) {
194 | int s = urls.size;
195 | printf("Size of url array: %d\n",s);
196 | int i;
197 | for (i=0; i 0) {
224 | interval = (int)(1000000.0f / (float)rate);
225 | }
226 |
227 | cnt = 0; // total packet/request counter
228 | int ipIndex = 0;
229 |
230 | if(proto == IPPROTO_TCP) {
231 | initTcpOptions(tcpOptions);
232 | pthread_attr_t attr;
233 | pthread_attr_init(&attr);
234 | pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
235 | pthread_create(&pcapThread, &attr, &startPcap, NULL);
236 | // -- give the pcap thread time to settle down --
237 | sleep(1);
238 | u_int32_t i;
239 | for(i=0; i<65536*256; i++) {
240 | connections[i].status = NOT_CONNECTED;
241 | connections[i].startTime = 0; // not started
242 | connections[i].referer = -1; // no referer used
243 | connections[i].useragent = rand()%nuseragents;
244 | }
245 | }
246 |
247 | struct timeval startTime, endTime, tmpTime;
248 | long second = 0;
249 | secondCounter = 0;
250 | long totalCounter = 0;
251 | while ( !maxPackets || (cnt < maxPackets)) {
252 | u_int32_t* entry = srcIpsSpoof[ipIndex];
253 | srcIp = entry[0];
254 | if (entry[1] > 0) {
255 | srcIp = srcIp - (srcIp % 256)+ entry[(rand() % entry[1]) + 2];
256 | }
257 | u_int32_t e = (srcIp & 0xFF) << 16;
258 | srcIp = htonl(srcIp);
259 |
260 | cnt++;
261 | gettimeofday(&startTime, NULL);
262 |
263 | // -- search valid src port --
264 | int portSearchCnt = 0;
265 | do {
266 | srcPort = (rand() % (MAX_PORT-MIN_PORT)) + MIN_PORT;
267 | portSearchCnt++;
268 | if((portSearchCnt >= 10000) && (portSearchCnt % 10000 == 0)) {
269 | printf("%d port search iterations\n", portSearchCnt);
270 | }
271 | }while( (proto == IPPROTO_TCP) // request tracking only on tcp
272 | && (connections[srcPort|e].status != NOT_CONNECTED) // port free?
273 | && ((time(NULL) - connections[srcPort|e].startTime) <= TIMEOUT) // port use timed out (probably packet loss)
274 | );
275 |
276 | size_t ipSize = 0;
277 | u_int8_t tcpOptionsIndex = 0;
278 | u_int32_t tcpLen;
279 | switch (proto) {
280 | case IPPROTO_ICMP:
281 | if((icmpTag = libnet_build_icmpv4_echo( ICMP_ECHO, 0, 0, 0x42, 0x42,
282 | payload, payloadSize, libnetHandle, 0)) == -1 ) {
283 | fprintf(stderr, "Can't build icmp header: %s\n", libnet_geterror(libnetHandle));
284 | }
285 | ipSize = payloadSize + LIBNET_ICMPV4_ECHO_H;
286 | break;
287 | case IPPROTO_TCP:
288 | tcpOptionsIndex = randTcpOptionsIndex(tcpOptions);
289 | libnet_build_tcp_options(tcpOptions[tcpOptionsIndex].options,tcpOptions[tcpOptionsIndex].length,libnetHandle,0);
290 | tcpLen = LIBNET_IPV4_H + LIBNET_TCP_H;
291 | tcpLen += tcpOptions[tcpOptionsIndex].length - 20;
292 | if(libnet_build_tcp(srcPort, dstPort, rand(), 0, TH_SYN, WINDOW_SIZE, 0, 0,
293 | tcpLen, 0, 0, libnetHandle, 0) == -1) {
294 | fprintf(stderr, "Can't build tcp header: %s\n", libnet_geterror(libnetHandle));
295 | }
296 | connections[srcPort|e].status = CONNECTING; //port is used. syn sent
297 | connections[srcPort|e].startTime = time(NULL); // store time for timeout
298 | ipSize = LIBNET_TCP_H;
299 | break;
300 | default:
301 | if((udpTag = libnet_build_udp(srcPort, dstPort,
302 | LIBNET_UDP_H + payloadSize, 0,
303 | payload, payloadSize, libnetHandle, 0)) == -1) {
304 | fprintf(stderr, "Can't build UDP header: %s\n", libnet_geterror(libnetHandle));
305 | }
306 | ipSize = payloadSize + LIBNET_UDP_H;
307 | break;
308 | }
309 | buildIp(ipSize, libnetHandle, ipTag, srcIp);
310 |
311 | if (libnet_write(libnetHandle) == -1) {
312 | fprintf(stderr, "Can't send IP packet: %s\n", libnet_geterror(libnetHandle));
313 | return EXIT_FAILURE;
314 | }
315 | libnet_clear_packet(libnetHandle);
316 |
317 | secondCounter++;
318 | totalCounter++;
319 |
320 | // -- if we don't send with unlimited rate, we have to wait a little bit --
321 | if (rate > 0) {
322 | gettimeofday(&endTime, NULL);
323 | long wait = interval - (((endTime.tv_sec - startTime.tv_sec)
324 | * 1000000) + (endTime.tv_usec - startTime.tv_usec));
325 | // -- usleep only works correctly with times above a certain threshold --
326 | if(wait > 10000) {
327 | usleep(wait);
328 | // -- if delay too short for usleep, use a 'do-nothing-loop'
329 | } else {
330 | long delay = 0;
331 | while (delay < wait) {
332 | gettimeofday(&tmpTime, NULL);
333 | delay = (((tmpTime.tv_sec - endTime.tv_sec) * 1000000)
334 | + (tmpTime.tv_usec - endTime.tv_usec));
335 | }
336 | }
337 | }
338 |
339 | // -- print stats every second --
340 | gettimeofday(&endTime, NULL);
341 | second += (((endTime.tv_sec - startTime.tv_sec) * 1000000)
342 | + (endTime.tv_usec - startTime.tv_usec));
343 | if (second >= 1000000) {
344 | printf("%d %s in %f seconds\n", secondCounter,
345 | proto==IPPROTO_TCP?"requests":"packets",second / 1000000.0f);
346 | if(proto == IPPROTO_TCP) {
347 | u_int32_t fc = finishedCount; // copy it to minimize error due asynchronous threads
348 | finishedCount = 0;
349 | success[currStat] = fc;
350 | printf("\t%u finished correctly\n", fc);
351 |
352 | fc = resetCount;
353 | resetCount = 0;
354 | printf("\t%u resets received\n", fc);
355 | }
356 | if (statsFilename) {
357 | stats[currStat] = secondCounter;
358 | if ((statsFile = fopen(statsFilename, "w")) == NULL) {
359 | fprintf(stderr,"Stats file %s could not be opened.\n", statsFilename);
360 | } else {
361 | int i;
362 | for (i=1; i<=STATS_SIZE; i++) {
363 | int t = -STATS_SIZE + i;
364 | int packets = stats[(currStat+i)%STATS_SIZE];
365 | int traffic = 0;
366 | if(proto == IPPROTO_TCP) {
367 | traffic = success[(currStat+i)%STATS_SIZE];
368 | } else {
369 | traffic = packets * (LIBNET_IPV4_H + ipSize) * 8;
370 | traffic /= 1024 * 1024;
371 | }
372 | fprintf(statsFile, "%d %d %d\n", t, packets, traffic);
373 | }
374 | }
375 | fclose(statsFile);
376 | currStat++;
377 | currStat %= STATS_SIZE;
378 | }
379 | secondCounter = 0;
380 | second = 0;
381 | }
382 | ipIndex >= numIps-1 ? ipIndex = 0 : ipIndex++;
383 | }
384 |
385 | libnet_destroy(libnetHandle);
386 | free(payload);
387 | /*free(stats);*/
388 | printf("%lu %s sent\n", totalCounter, proto==IPPROTO_TCP?"requests ":"packets");
389 | if(proto == IPPROTO_TCP) {
390 | pthread_join(pcapThread, NULL);
391 | }
392 | // set rp_filter back to original value ...
393 | if (rp_filter == 1) {
394 | f = fopen("/proc/sys/net/ipv4/conf/all/rp_filter", "w");
395 | if(!f) {
396 | fprintf(stderr, "Can't open proc file system: %s. Make sure to disable rp_filter manually.\n", strerror( errno ));
397 | }
398 | else {
399 | fprintf(f,"1");
400 | fclose(f);
401 | }
402 | }
403 | return EXIT_SUCCESS;
404 | }
405 |
406 | /**
407 | * reads ips from file and stores them into a local data structure
408 | */
409 | void readIps() {
410 | FILE *file;
411 | if ( (file = fopen(filename, "r")) == NULL) {
412 | fprintf(stderr,"File %s could not be opened.\n", filename);
413 | exit(EXIT_FAILURE);
414 | }
415 | printf("reading file...");
416 | fflush(stdout);
417 | numIps = 0;
418 | while ((getIp(file, &srcIp)) && !feof(file)) {
419 | numIps++;
420 | }
421 | rewind(file);
422 | srcIpsSpoof = (u_int32_t**)malloc(numIps * sizeof(u_int32_t*));
423 | unsigned long cnt = 0;
424 | while (!feof(file) && (getIp(file, &srcIp))) {
425 | int nbr = 0;
426 | if (toggle > 0) {
427 | nbr = (rand() % toggle) + 1;
428 | }
429 | u_int32_t* entry = (u_int32_t*)malloc(sizeof(u_int32_t)*(nbr+2));
430 | entry[0] = srcIp;
431 | entry[1] = nbr;
432 | int i;
433 | for (i = 0; i < nbr; i++) {
434 | entry[i+2] = rand() % 256;
435 | }
436 | srcIpsSpoof[cnt++] = entry;
437 | }
438 | fclose(file);
439 | printf("done\n");
440 | }
441 |
442 | /**
443 | * reads the next ip from a given file
444 | * @param file the file to read from
445 | * @param ip where to store the read ip
446 | * @return 1 on success, 1 otherwise
447 | */
448 | int getIp(FILE *file, u_int32_t* ip) {
449 | if (integer) {
450 | if (fscanf(file, "%u", ip) != 1) {
451 | return 0;
452 | }
453 | } else {
454 | int ips[5];
455 | if (fscanf(file, "%u.%u.%u.%u", &ips[0], &ips[1], &ips[2], &ips[3]) != 4) {
456 | return 0;
457 | }
458 | *ip = (u_int32_t) (ips[0]*256*256*256+ips[1]*256*256+ips[2]*256+ips[3]);
459 | }
460 | return 1;
461 | }
462 |
463 | /**
464 | * @return the number of a by string given protocol
465 | */
466 | int getProto(char* name) {
467 | if (!strncasecmp(name, "udp", 3)) {
468 | return IPPROTO_UDP;
469 | } else if (!strncasecmp(name, "icmp", 4)) {
470 | return IPPROTO_ICMP;
471 | } else if (!strncasecmp(name, "tcp", 3)) {
472 | return IPPROTO_TCP;
473 | } else {
474 | fprintf(stderr, "unknown ip protocol: %s\n", name);
475 | exit(EXIT_FAILURE);
476 | }
477 | }
478 |
479 | /**
480 | * prints the usage, available parameters, .. of the program
481 | */
482 | void printUsage(int argc, char *argv[]) {
483 | printf("Usage: %s [OPTION...] \n\n", argv[0]);
484 | printf(" Options:\n\n");
485 | printf(" -i, --ips=FILENAME filename with ip list\n");
486 | printf(" -p, --protocol=PROTO udp (default), icmp or tcp\n");
487 | printf(" -r, --send_rate=NUM packets per second, 0 = infinite (default)\n");
488 | printf(" -s, --payload_size=SIZE size of the paylod, (default: 32)\n");
489 | printf(" -o, --stats_file=FILENAME filename for the statistics, (default: 'stats')\n");
490 | printf(" -c, --max_packets=NUM maximum number of packets (requests at tcp/http), 0 = infinite (default)\n");
491 | printf(" --integer IPs are integers in host byte order instead of in dotted notation\n");
492 | printf(" -t, --max_bots=NUM determine max_bots in the 24bit prefix randomly (1-256)\n");
493 | printf(" -u, --url=URL the url (default: '/') (only for tcp/http)\n");
494 | printf(" -l, --url_list=FILENAME filename with url list (only for tcp/http)\n");
495 | printf(" -b, --useragent_list=FILENAME filename with useragent list (only for tcp/http)\n");
496 | printf(" -d, --device=DEVICE network listening device (only for tcp/http)\n");
497 | printf(" -m, --mtu=NUM set MTU, (default 1500)\n");
498 | printf(" -f, --frag=NUM set fragmentation mode (0=IP, 1=TCP, default: 0)\n");
499 | printf(" -v, --verbose print additional debug messages\n");
500 | printf(" -h, --help print this message and exit\n");
501 |
502 | printf("\n");
503 | }
504 |
505 | /**
506 | * parses the arguments passed to the programm and stores the values in the
507 | * according global variables
508 | */
509 | void parseArgs(int argc, char *argv[]) {
510 | if(argc<2)
511 | printUsage(argc, argv);
512 | static struct option long_options[] = {
513 | {"protocol", required_argument, 0, 'p'},
514 | {"paylod_size", required_argument, 0, 's'},
515 | {"ips", required_argument, 0, 'i'},
516 | {"send_rate", required_argument, 0, 'r'},
517 | {"stats_file", required_argument, 0, 'o'},
518 | {"max_packets", required_argument, 0, 'c'},
519 | {"max_bots", required_argument, 0, 't'},
520 | {"url", required_argument, 0, 'u'},
521 | {"url_list", required_argument, 0, 'l'},
522 | {"useragent_list", required_argument, 0, 'b'},
523 | {"device", required_argument, 0, 'd'},
524 | {"integer", no_argument, &integer, 1},
525 | {"mtu", no_argument, 0, 'm'},
526 | {"frag", no_argument, 0, 'f'},
527 | {"verbose", no_argument, 0, 'v'},
528 | {"help", no_argument, 0, 'h'},
529 | {0, 0, 0, 0}
530 | };
531 | dstIp = 0;
532 | dstPort = 0;
533 | filename = NULL; //filename of ips
534 | urlfilename = NULL; //filename of urls
535 | int c;
536 | int option_index = 0;
537 | char* portStart;
538 | request[0] = '\0';
539 | Url u;
540 | u.host[0] = '\0';
541 | u.path[0] = '\0';
542 | u.protocol [0] = '\0';
543 | while ((c = getopt_long(argc, argv, ":b:s:r:p:i:o:c:t:hvu:l:d:m:f:",long_options, &option_index)) != -1) {
544 | switch (c) {
545 | case 'b':
546 | useragentfilename = optarg;
547 | break;
548 | case 's':
549 | payloadSize = abs(atoi(optarg));
550 | break;
551 | case 'r':
552 | rate = abs(atoi(optarg));
553 | break;
554 | case 'i':
555 | filename = optarg;
556 | break;
557 | case 'o':
558 | statsFilename = optarg;
559 | break;
560 | case 'p':
561 | proto = getProto(optarg);
562 | break;
563 | case 'c':
564 | maxPackets = abs(atoi(optarg));
565 | break;
566 | case 't':
567 | toggle = abs(atoi(optarg));
568 | break;
569 | case 'h':
570 | printUsage(argc, argv);
571 | exit(EXIT_SUCCESS);
572 | break;
573 | case 'v':
574 | verbose = 1;
575 | break;
576 | case 'u':
577 | url_flag = 1;
578 | sscanf(optarg,"%50[^:/]://%2000[^/]/%s", u.protocol, u.host, u.path);
579 | //sprintf(u.url, "%s/%s",u.host,u.path);
580 | //sprintf(request, "GET %s HTTP/1.0\r\nConnection: close\r\n\r\n", optarg);
581 | //char buffer[4096];
582 | break;
583 | case 'l':
584 | urlfilename = optarg;
585 | break;
586 | case 'd':
587 | device = optarg;
588 | break;
589 | case 'm':
590 | MTU = ((abs(atoi(optarg))+7)/8)*8;
591 | break;
592 | case 'f':
593 | fragMode= abs(atoi(optarg));
594 | if (fragMode != 0 && fragMode != 1) fragMode = 0;
595 | break;
596 | }
597 | }
598 | // -- parse destination address and port --
599 | if (option_index < argc) {
600 | char* v = argv[argc-1];
601 | portStart = strrchr(v, ':');
602 | if (portStart == NULL) {
603 | fprintf(stderr, "Bad destination port: %s\n", v);
604 | exit(EXIT_FAILURE);
605 | }
606 | dstPort = (u_short)atoi(portStart + 1);
607 | addr = (char*)malloc(portStart-v+1);
608 | strncpy(addr, v, portStart-v);
609 | addr[portStart-v] = '\0';
610 | } else {
611 | printUsage(argc, argv);
612 | exit(EXIT_FAILURE);
613 | }
614 | if (proto == IPPROTO_TCP && !device) {
615 | printf("-d necessary for tcp\n");
616 | exit(EXIT_FAILURE);
617 | }
618 | if (url_flag && urlfilename){
619 | printf("Warning: both -l and -u; The URL given with -u will not be used!\n");
620 | }
621 | if(!url_flag){
622 | strcpy(u.protocol,"http");
623 | strcpy(u.host,"www.google.de");
624 | }
625 | if (!urlfilename){
626 | urls.size = 1;
627 | Url* urllist;
628 | urllist = malloc(1*sizeof(Url));
629 | urllist[0] = u;
630 | urls.urls = urllist;
631 | }
632 | if (!useragentfilename){
633 | printf("Warning: There is noch File with useragent names! ");
634 | useragents = (char**)malloc(sizeof(char*));
635 | useragents[0] = (char*)malloc(USERAGENT_SIZE);
636 | strcpy(useragents[0],"Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.8) Gecko/20071004 Iceweasel/2.0.0.8 (Debian-2.0.0.6+2.0.0.8-Oetch1)");
637 | nuseragents = 1;
638 | printf("The user-agent:\n %s\nwill be used.\n", useragents[0]);
639 | }
640 | if (proto != IPPROTO_TCP && (MTU != 0 || fragMode != 99)) {
641 | printf("-f and -m (Fragmentation support) only for TCP available\n");
642 | exit(EXIT_FAILURE);
643 | }
644 | else {
645 | // set defaults if TCP and fragmentation not set.
646 | if (MTU == 0) {
647 | MTU = 1500;
648 | }
649 | if (fragMode == 99) {
650 | fragMode = 0;
651 | }
652 | }
653 | }
654 |
655 | /**
656 | * prints the values of (almost) every parameter
657 | */
658 | void printArgs() {
659 | printf("dstIp: %d.%d.%d.%d\n", dstIp & 0xFF, (dstIp >> 8) & 0xFF, (dstIp >> 16) & 0xFF, (dstIp >> 24) & 0xFF);
660 | printf("dstPort: %d\n", dstPort);
661 | printf("protocol: %d\n", proto);
662 | printf("payloadSize: %d\n", payloadSize);
663 | if (proto == IPPROTO_TCP) {
664 | printf("MTU: %d\n", MTU);
665 | (fragMode > 0) ? printf("fragment mode: TCP\n")
666 | : printf("fragment mode: IP\n");
667 | }
668 | (rate > 0) ? printf("rate: %d\n", rate)
669 | : printf("rate: infinite\n");
670 | printf("ips: %s\n", filename);
671 | printf("urls: %s\n", urlfilename);
672 | printf("useragents:: %s\n", useragentfilename);
673 | printf("stats file: %s\n", statsFilename);
674 | printf("device: %s\n", device);
675 | (maxPackets > 0) ? printf("maxPackets: %d\n", maxPackets)
676 | : printf("maxPackets: infinite\n");
677 | printf("format: ");
678 | integer ? printf("integer\n") : printf("dotted\n");
679 | printf("toggle: ");
680 | toggle ? printf("yes: max %d bots\n", toggle) : printf("no\n");
681 | /* should not be necessarry anymore
682 | if(proto == IPPROTO_TCP) {
683 | if(request[0]=='\0')
684 | strcpy(request, "GET / HTTP/1.0\r\nConnection: close\r\n\r\n");
685 | printf("request: %s\n", request);
686 | }
687 | */
688 | }
689 |
690 | /**
691 | * builds the ip packet with libnet
692 | * mainly a (unnecessary?) wrapper for libnet_build_ipv4
693 | */
694 | void buildIp(size_t ipSize, libnet_t *libnetHandle, libnet_ptag_t ipTag, u_int32_t srcIp) {
695 | ipTag = libnet_build_ipv4(
696 | LIBNET_IPV4_H + ipSize,
697 | 0, /* TOS */
698 | IP_ID,
699 | 0, /* IP Frag */
700 | (rand() % 253) + 3, /* TTL */
701 | proto,
702 | 0, /* checksum */
703 | srcIp, dstIp,
704 | NULL, /* payload */
705 | 0, /* payload size */
706 | libnetHandle, ipTag);
707 | if(ipTag == -1) {
708 | fprintf(stderr, "Can't build IP header: %s\n", libnet_geterror(libnetHandle));
709 | }
710 | }
711 |
712 | /**
713 | * prints an ip in integer notation in dotted notation
714 | */
715 | void printIp(u_int32_t ip) {
716 | printf("%d.%d.%d.%d\n", (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, (ip >> 8) & 0xFF, ip & 0xFF);
717 | }
718 |
719 | /**
720 | * entry point for the pcap capture thread
721 | */
722 | void* startPcap(void* arg) {
723 | char pcapErrbuf[PCAP_ERRBUF_SIZE];
724 | char libnetErrbuf[LIBNET_ERRBUF_SIZE];
725 | libnet_t *libnetHandle = libnet_init(LIBNET_RAW4, device, libnetErrbuf);
726 | if (libnetHandle == NULL) {
727 | fprintf(stderr, "libnet_init() failed: %s\n", libnetErrbuf);
728 | exit(EXIT_FAILURE);
729 | }
730 | bpf_u_int32 mask, net;
731 | struct bpf_program bpf;
732 | char filter[256];
733 | char* device = (char*)libnet_getdevice(libnetHandle);
734 | sprintf(filter,"tcp and src host %d.%d.%d.%d and src port %u",
735 | dstIp & 0xFF, (dstIp >> 8) & 0xFF, (dstIp >> 16) & 0xFF, (dstIp >> 24) & 0xFF, dstPort);
736 |
737 | /* Find the properties for the device */
738 | if (pcap_lookupnet(device, &net, &mask, pcapErrbuf) == -1) {
739 | fprintf(stderr, "Couldn't get netmask for device %s: %s\n", device, pcapErrbuf);
740 | net = 0;
741 | mask = 0;
742 | return NULL;
743 | }
744 | /* Open the session in promiscuous mode without timeout */
745 | pcap_t* pcapHandle = pcap_open_live(device, BUFSIZ, 1, 0, pcapErrbuf);
746 | if (pcapHandle == 0) {
747 | fprintf(stderr, "Couldn't open device %s: %s\n", device, pcapErrbuf);
748 | return NULL;
749 | }
750 | /* Compile and apply the filter */
751 | if (pcap_compile(pcapHandle, &bpf, filter, 0, net) == -1) {
752 | fprintf(stderr, "Couldn't parse filter %s: %s\n", filter, pcap_geterr(pcapHandle));
753 | return NULL;
754 | }
755 | if (pcap_setfilter(pcapHandle, &bpf) == -1) {
756 | fprintf(stderr, "Couldn't install filter %s: %s\n", filter, pcap_geterr(pcapHandle));
757 | return NULL;
758 | }
759 | pcap_freecode(&bpf);
760 | while (1) {
761 | acknowledge(libnetHandle, pcapHandle);
762 | }
763 | }
764 |
765 | /**
766 | * handler for received packets
767 | * sends the answering packets if needed
768 | */
769 | void acknowledge(libnet_t *libnetHandle, pcap_t* pcapHandle) {
770 | static struct pcap_pkthdr header;
771 | static const u_char *sniffedPacket;
772 | static const struct iphdr* ip;
773 | static const struct tcphdr* tcp;
774 | unsigned int max_pload_size;
775 | int packet_pload_size, total_pload_size;
776 | int pload_offset;
777 | u_int8_t *p;
778 |
779 | //printf("achnowledge\n");
780 | //static size_t x = 0;
781 | sniffedPacket = pcap_next(pcapHandle, &header);
782 | if (!sniffedPacket) {
783 | //fprintf(stderr, "Error sniffing packet: %s\n", pcap_geterr(pcapHandle));
784 | return;
785 | }
786 | ip = (struct iphdr*) (sniffedPacket + sizeof(struct ether_header));
787 | u_int32_t sIp = ip->daddr; //IP we want to send to
788 | tcp = (struct tcphdr*) (sniffedPacket + sizeof(struct ether_header) + sizeof(struct iphdr));
789 |
790 | // used for connection tracking
791 | u_int16_t origSrcPort = ntohs(tcp->dest);
792 | u_int32_t key = ((u_int32_t)origSrcPort) | ((ntohl(ip->daddr) & 0xFF) << 16);
793 |
794 | // -- check if we are responsible for this packet --
795 | if(origSrcPort < MIN_PORT || origSrcPort > MAX_PORT || connections[key].status == NOT_CONNECTED) {
796 | return;
797 | }
798 |
799 | //check if RST flag is sent
800 | if (tcp->rst){ // the connection has been reset, so we have to start again with the 3 way handshake and send a SYN
801 |
802 | resetCount++;
803 |
804 | // -- answer only resets on a fully established connection --
805 | // -- (resets on a 'CONNECTING' connections means 'connection refused') --
806 | if(connections[key].status == ESTABLISHED) {
807 | int tcpOptionsIndex = randTcpOptionsIndex(tcpOptions);
808 | libnet_clear_packet(libnetHandle);
809 | libnet_build_tcp_options(tcpOptions[tcpOptionsIndex].options,tcpOptions[tcpOptionsIndex].length,libnetHandle,0);
810 | int tcpLen = LIBNET_IPV4_H + LIBNET_TCP_H;
811 | tcpLen += tcpOptions[tcpOptionsIndex].length - 20;
812 | if(libnet_build_tcp(origSrcPort, dstPort, rand(), 0, TH_SYN, WINDOW_SIZE, 0, 0,
813 | tcpLen, 0, 0, libnetHandle, 0) == -1) {
814 | fprintf(stderr, "Can't build tcp header: %s\n", libnet_geterror(libnetHandle));
815 | }
816 | connections[key].status = CONNECTING; //port is used. syn sent
817 | connections[key].startTime = time(NULL); // store time for timeout
818 | ipSize = LIBNET_TCP_H;
819 |
820 | buildIp(ipSize, libnetHandle, ipTag, sIp);
821 |
822 | if (libnet_write(libnetHandle) == -1) {
823 | fprintf(stderr, "Can't send IP packet: %s\n", libnet_geterror(libnetHandle));
824 | } else {
825 | cnt++;
826 | secondCounter++;
827 | }
828 | }
829 | // -- first data packet -> request --
830 | } else if (tcp->syn && tcp->ack) {
831 | connections[key].status = ESTABLISHED;
832 |
833 | // -- ack and request in separated packets --
834 | sendAck(libnetHandle, ip, tcp, key);
835 |
836 | // get url with random number
837 | int url_number = rand() % urls.size;
838 | int ref_number = connections[key].referer;
839 | int useragent_number = connections[key].useragent;
840 |
841 | //to ensure that the referer has not the same host and path as the requested file
842 | while((url_number==ref_number)&&(urls.size > 1)){
843 | url_number = rand() % urls.size;
844 | if(verbose) {
845 | printf("While: url: %d, ref: %d\n", url_number, ref_number);
846 | }
847 | }
848 |
849 | // build the request with url, referer and useragent numbers
850 | buildRequest(request, url_number, ref_number, useragent_number, urls, useragents);
851 |
852 | if(verbose) {
853 | printf("%s\n",request);
854 | }
855 |
856 | uint32_t remoteAck = ntohl(tcp->ack_seq);
857 | uint32_t remoteSeq = ntohl(tcp->seq);
858 | max_pload_size = (MTU - LIBNET_IPV4_H - LIBNET_TCP_H);
859 | max_pload_size -= (max_pload_size % 8);
860 | total_pload_size = strlen(request);
861 | if (max_pload_size > total_pload_size) {
862 | // -- packet is smaller than MTU --
863 | if(urls.size > 1){
864 | connections[key].referer = url_number;
865 | }
866 | libnet_clear_packet(libnetHandle);
867 | if(libnet_build_tcp(origSrcPort, dstPort, remoteAck, remoteSeq+1,
868 | TH_ACK, WINDOW_SIZE, 0, 0, LIBNET_IPV4_H + LIBNET_TCP_H - 20 + total_pload_size,
869 | (unsigned char*)request, total_pload_size, libnetHandle, 0)==-1) {
870 | fprintf(stderr, "Can't build tcp header: %s\n", libnet_geterror(libnetHandle));
871 | }
872 | buildIp(total_pload_size, libnetHandle, 0, sIp);
873 | if (libnet_write(libnetHandle) == -1) {
874 | fprintf(stderr, "Can't send tcp ack/fin packet: %s\n", libnet_geterror(libnetHandle));
875 | }
876 | } else {
877 | // -- fragmentation goes here --
878 | if (fragMode == 0) {
879 | // -- using IP fragmentation --
880 | if(urls.size > 1){
881 | connections[key].referer = url_number;
882 | }
883 |
884 | int hdr_offset = IP_MF;
885 | u_int16_t ip_id;
886 | u_int32_t pkt_chksum, pbuf_size, pbuf_size2;
887 | libnet_ptag_t tcp_tag, ip_tag;
888 | struct libnet_ipv4_hdr *iph_p;
889 | struct libnet_tcp_hdr *tcph_p;
890 | u_int8_t *packet;
891 |
892 | libnet_clear_packet(libnetHandle);
893 | ip_id = (u_int16_t)libnet_get_prand(LIBNET_PR16);
894 | packet_pload_size = max_pload_size;
895 |
896 | tcp_tag = libnet_build_tcp(origSrcPort, dstPort, remoteAck, remoteSeq+1,
897 | TH_ACK, WINDOW_SIZE, 0, 0, LIBNET_IPV4_H + LIBNET_TCP_H - 20 + total_pload_size,
898 | (unsigned char*)request, total_pload_size, libnetHandle, 0);
899 | if(tcp_tag==-1) {
900 | fprintf(stderr, "Can't build tcp header: %s\n", libnet_geterror(libnetHandle));
901 | }
902 |
903 | ip_tag = libnet_build_ipv4(
904 | LIBNET_IPV4_H + total_pload_size,
905 | 0, /* TOS */
906 | ip_id,
907 | 0, /* IP Frag */
908 | (rand() % 253) + 3, /* TTL */
909 | proto,
910 | 0, /* checksum */
911 | sIp, dstIp,
912 | NULL, /* payload */
913 | 0, /* payload size */
914 | libnetHandle, ipTag);
915 | if (ip_tag == -1) {
916 | fprintf(stderr, "Can't build ipv4 header: %s\n", libnet_geterror(libnetHandle));
917 | }
918 |
919 | u_int8_t *pkt_buf;
920 |
921 | pbuf_size = libnet_getpbuf_size(libnetHandle, ip_tag);
922 | pbuf_size2 = libnet_getpbuf_size(libnetHandle, tcp_tag);
923 | pkt_buf = malloc(pbuf_size+pbuf_size2+total_pload_size);
924 |
925 | p = pkt_buf;
926 | packet = libnet_getpbuf(libnetHandle, ip_tag);
927 | memcpy(p, packet, pbuf_size);
928 | p += pbuf_size;
929 | packet = libnet_getpbuf(libnetHandle, tcp_tag);
930 | memcpy(p, packet, pbuf_size2);
931 | p += pbuf_size2;
932 | memcpy(p, request, total_pload_size);
933 |
934 | iph_p = (struct libnet_ipv4_hdr *)(pkt_buf);
935 | tcph_p = (struct libnet_tcp_hdr *)(pkt_buf + (iph_p->ip_hl << 2));
936 | libnet_do_checksum(libnetHandle, pkt_buf, IPPROTO_TCP, pbuf_size2+total_pload_size);
937 |
938 | libnet_clear_packet(libnetHandle);
939 |
940 | p = (u_int8_t *)tcph_p;
941 | total_pload_size += pbuf_size2;
942 |
943 | if (libnet_build_ipv4(
944 | LIBNET_IPV4_H + packet_pload_size,
945 | 0, /* TOS */
946 | ip_id,
947 | hdr_offset, /* IP Frag */
948 | (rand() % 253) + 3, /* TTL */
949 | proto,
950 | 0, /* checksum */
951 | sIp, dstIp,
952 | (unsigned char *)p, /* payload */
953 | packet_pload_size, /* payload size */
954 | libnetHandle, ipTag) == -1) {
955 | fprintf(stderr, "Can't build ipv4 header: %s\n", libnet_geterror(libnetHandle));
956 | }
957 | if (libnet_write(libnetHandle) == -1) {
958 | fprintf(stderr, "Can't send tcp ack/fin packet: %s\n", libnet_geterror(libnetHandle));
959 | }
960 | pload_offset = packet_pload_size;
961 | libnet_clear_packet(libnetHandle);
962 |
963 | max_pload_size = (MTU - LIBNET_IPV4_H);
964 | max_pload_size -= (max_pload_size % 8);
965 |
966 | while (total_pload_size > pload_offset) {
967 | if (max_pload_size > (total_pload_size - pload_offset)) {
968 | hdr_offset = pload_offset/8;
969 | packet_pload_size = total_pload_size - pload_offset;
970 | } else {
971 | hdr_offset = IP_MF + pload_offset/8;
972 | packet_pload_size = max_pload_size;
973 | }
974 | if (libnet_build_ipv4(
975 | LIBNET_IPV4_H + packet_pload_size,
976 | 0, /* TOS */
977 | ip_id,
978 | hdr_offset, /* IP Frag */
979 | (rand() % 253) + 3, /* TTL */
980 | proto,
981 | 0, /* checksum */
982 | sIp, dstIp,
983 | (unsigned char*)(p + pload_offset), /* payload */
984 | packet_pload_size, /* payload size */
985 | libnetHandle, ipTag) == -1) {
986 | fprintf(stderr, "Can't build ipv4 header: %s\n", libnet_geterror(libnetHandle));
987 | }
988 | if (libnet_write(libnetHandle) == -1) {
989 | fprintf(stderr, "Can't send tcp ack/fin packet: %s\n", libnet_geterror(libnetHandle));
990 | }
991 | pload_offset += packet_pload_size;
992 | libnet_clear_packet(libnetHandle);
993 | }
994 | free(pkt_buf);
995 | } else if (fragMode == 1) {
996 | // -- using TCP fragments --
997 | libnet_clear_packet(libnetHandle);
998 |
999 | // we send only first packet here, all the others will be sent in Ack handler
1000 | if(libnet_build_tcp(origSrcPort, dstPort, remoteAck, remoteSeq+1,
1001 | TH_ACK, WINDOW_SIZE, 0, 0, LIBNET_IPV4_H + LIBNET_TCP_H - 20 + max_pload_size,
1002 | (unsigned char*)request, max_pload_size, libnetHandle, 0)==-1) {
1003 | fprintf(stderr, "Can't build tcp header: %s\n", libnet_geterror(libnetHandle));
1004 | }
1005 | buildIp(max_pload_size, libnetHandle, 0, sIp);
1006 | if (libnet_write(libnetHandle) == -1) {
1007 | fprintf(stderr, "Can't send tcp ack/fin packet: %s\n", libnet_geterror(libnetHandle));
1008 | }
1009 | libnet_clear_packet(libnetHandle);
1010 |
1011 | connections[key].pload_offset = max_pload_size;
1012 | connections[key].url = url_number; }
1013 | }
1014 | // -- acknowledge every but reset packets and the final ack packet --
1015 | } else if(! tcp->rst && connections[key].status == CONNECTING) {
1016 | sendAck(libnetHandle, ip, tcp, key);
1017 | } else if(! tcp->rst && connections[key].status == ESTABLISHED) {
1018 | if (fragMode == 1) {
1019 | if (tcp->ack) {
1020 |
1021 | max_pload_size = (MTU - LIBNET_IPV4_H - LIBNET_TCP_H);
1022 | max_pload_size -= (max_pload_size % 8);
1023 |
1024 | uint32_t remoteAck = htonl(tcp->ack_seq);
1025 | uint32_t remoteSeq = htonl(tcp->seq);
1026 |
1027 | int url_number = connections[key].url;
1028 | int ref_number = connections[key].referer;
1029 | int useragent_number = connections[key].useragent;
1030 | buildRequest(request, url_number, ref_number, useragent_number, urls, useragents);
1031 | p = (unsigned char *)request;
1032 | total_pload_size = strlen(request);
1033 | pload_offset = connections[key].pload_offset;
1034 |
1035 | if ((total_pload_size - pload_offset) == 0) {
1036 | sendAck(libnetHandle, ip, tcp, key);
1037 | connections[key].status = CLOSED;
1038 | if(urls.size > 1){
1039 | connections[key].referer = url_number;
1040 | }
1041 | } else {
1042 | if (max_pload_size > (total_pload_size - pload_offset)) {
1043 | packet_pload_size = total_pload_size - pload_offset;
1044 | } else {
1045 | packet_pload_size = max_pload_size;
1046 | }
1047 |
1048 | libnet_clear_packet(libnetHandle);
1049 | if(libnet_build_tcp(origSrcPort, dstPort, remoteAck, remoteSeq,
1050 | TH_ACK, WINDOW_SIZE, 0, 0, LIBNET_IPV4_H + LIBNET_TCP_H - 20 + packet_pload_size,
1051 | (unsigned char*)(p + pload_offset), packet_pload_size, libnetHandle, 0)==-1) {
1052 | fprintf(stderr, "Can't build tcp header _ : %s\n", libnet_geterror(libnetHandle));
1053 | }
1054 | buildIp(packet_pload_size, libnetHandle, 0, sIp);
1055 | if (libnet_write(libnetHandle) == -1) {
1056 | fprintf(stderr, "Can't send tcp ack/fin packet: %s\n", libnet_geterror(libnetHandle));
1057 | }
1058 | libnet_clear_packet(libnetHandle);
1059 |
1060 | connections[key].pload_offset = pload_offset + packet_pload_size;
1061 | }
1062 | }
1063 | } else {
1064 | sendAck(libnetHandle, ip, tcp, key);
1065 | }
1066 | // -- connection probably closed -> 'clear' port --
1067 | } else if (tcp->ack) {
1068 | connections[key].status = NOT_CONNECTED; // no connection
1069 | finishedCount++;
1070 | }
1071 | }
1072 |
1073 | void sendAck(libnet_t *libnetHandle, const struct iphdr* ip, const struct tcphdr* tcp, u_int32_t key) {
1074 |
1075 | libnet_clear_packet(libnetHandle);
1076 |
1077 | size_t ackSize = ntohs(ip->tot_len) - ((short)ip->ihl * 4) - ((short)tcp->doff * 4); // size of payload
1078 |
1079 | if(tcp->fin || tcp->syn)
1080 | ackSize += 1;
1081 |
1082 | if(ackSize>0) {
1083 | u_int32_t lastSeq = ntohl(tcp->ack_seq);
1084 | u_int32_t lastAck = ntohl(tcp->seq) + ackSize;
1085 | u_int8_t flags = TH_ACK;
1086 |
1087 | if(tcp->fin) {
1088 | flags |= TH_FIN;
1089 | connections[key].status = CLOSED; //fin
1090 | }
1091 |
1092 | if(libnet_build_tcp(ntohs(tcp->dest), dstPort, lastSeq, lastAck,
1093 | flags, WINDOW_SIZE, 0, 0, LIBNET_IPV4_H + LIBNET_TCP_H - 20,
1094 | 0, 0, libnetHandle, 0) == -1 ) {
1095 | fprintf(stderr, "Can't build tcp header: %s\n", libnet_geterror(libnetHandle));
1096 | }
1097 | buildIp(0, libnetHandle, 0, ip->daddr);
1098 | if (libnet_write(libnetHandle) == -1) {
1099 | fprintf(stderr, "Can't send tcp ack packet: %s\n", libnet_geterror(libnetHandle));
1100 | }
1101 | }
1102 | }
1103 |
1104 | void INThandler(int sig) {
1105 | char buf[1024];
1106 | FILE *f = NULL;
1107 | extern int errno;
1108 |
1109 | signal(sig, SIG_IGN);
1110 | if (rp_filter == 1) {
1111 | f = fopen("/proc/sys/net/ipv4/conf/all/rp_filter", "w");
1112 | if(!f) {
1113 | fprintf(stderr, "Can't open proc file system: %s. Make sure to disable rp_filter manually.\n", strerror( errno ));
1114 | }
1115 | else {
1116 | fprintf(f,"1");
1117 | fclose(f);
1118 | }
1119 | }
1120 | exit(EXIT_SUCCESS);
1121 | }
1122 |
--------------------------------------------------------------------------------
/src/http.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2006-2007 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz
3 | *
4 | * You may not use this file except under the terms of the accompanying license.
5 | *
6 | * Unless required by applicable law or agreed to in writing, software
7 | * distributed under the License is distributed on an "AS IS" BASIS,
8 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 | * See the License for the specific language governing permissions and
10 | * limitations under the License.
11 | *
12 | * Project: BoNeSi
13 | * File: http.h
14 | * Purpose: support for HTTP-GET attacks
15 | * Responsible: Markus Goldstein
16 | * Primary Repository: https://github.com/Markus-Go/bonesi
17 | * Web Sites: madm.dfki.de, www.goldiges.de
18 | */
19 |
20 |
21 | #ifndef HTTP_H_
22 | #define HTTP_H_
23 |
24 | #include
25 | ssize_t getline(char **lineptr, size_t *n, FILE *stream);
26 |
27 | #define URL_SIZE 4096
28 | static const int USERAGENT_SIZE = 150;
29 |
30 | typedef struct{
31 | char protocol[50];
32 | char host[2000];
33 | char path[2000];
34 | //char url[URL_SIZE];
35 | } Url;
36 |
37 | typedef struct{
38 | int size;
39 | Url* urls;
40 | } Url_array;
41 |
42 |
43 | /**
44 | * reads a single url from a given text file
45 | * @return the url
46 | */
47 | Url getURL(FILE *file){
48 | char buffer[URL_SIZE];
49 | Url u;
50 | u.host[0] = '\0';
51 | u.path[0] = '\0';
52 | u.protocol [0] = '\0';
53 | int r = fscanf(file, "%4096s\n", buffer);
54 | if(sscanf(buffer,"%50[^:/]://%2000[^/]/%2000s", u.protocol, u.host, u.path) != 3) {
55 | u.path[0] = '\0';
56 | }
57 | //sprintf(u.url, "%s/%s",u.host,u.path);
58 | return u;
59 | }
60 |
61 | /**
62 | * reads urls from a text file and stores them in an array
63 | */
64 | Url_array readURLs(const char* urlfilename, int verbose){
65 | FILE *file;
66 | Url* urllist;
67 | if ((file = fopen(urlfilename, "r")) == NULL) {
68 | fprintf(stderr,"File %s could not be opened.\n", urlfilename);
69 | exit(EXIT_FAILURE);
70 | }
71 | printf("reading urls file... ");
72 | fflush(stdout);
73 | int url_count = 0;
74 | char buffer[URL_SIZE];
75 | while(!feof(file)){
76 | int r = fscanf(file, "%4096s\n", buffer);
77 | if(strlen(buffer) > 4) // > 4 'cause there are at least 4 characters in our template
78 | url_count++;
79 | }
80 | rewind(file);
81 | urllist = malloc(url_count*sizeof(Url));
82 | int i = 0;
83 | while(!feof(file)){
84 | Url u = getURL(file) ;
85 | if(u.path[0] != '\0') {
86 | urllist[i] = u;
87 | i++;
88 | }
89 | }
90 | fclose(file);
91 | printf("done\n");
92 | if(verbose) {
93 | printf("The URLs are: \n");
94 | int j;
95 | for(j=0; j=0){
124 | strcat(request,"Connection: close\r\n");
125 | sprintf(referer,"Referer: %s/%s\r\n\r\n",urls.urls[nref].host,urls.urls[nref].path);
126 | strcat(request,referer);
127 | }
128 | else{
129 | strcat(request,"Connection: close\r\n\r\n");
130 | }
131 | }
132 |
133 | /**
134 | * reads the user agents from a text file and stores them in an array
135 | */
136 | int readUserAgents(char*** useragents, const char* useragentfilename){
137 | FILE *file;
138 | char* buffer;
139 | if ( (file = fopen(useragentfilename, "r")) == NULL) {
140 | fprintf(stderr,"File %s could not be opened.\n", useragentfilename);
141 | exit(EXIT_FAILURE);
142 | }
143 | printf("reading user agents file...");
144 | fflush(stdout);
145 | int count = 0;
146 | size_t len = 0;
147 | ssize_t read;
148 | while((read = getline(&buffer,&len,file))!=-1) {
149 | count++;
150 | }
151 | rewind(file);
152 | *useragents = (char**)malloc(sizeof(char*)*count);
153 | count = 0;
154 | fflush(stdout);
155 | while((read = getline(&buffer,&len,file))!=-1) {
156 | buffer[strlen(buffer)-1] = '\0';
157 | (*useragents)[count] = (char*)malloc(USERAGENT_SIZE);
158 | strcpy((*useragents)[count],buffer);
159 | count++;
160 | }
161 | fclose(file);
162 | printf("done\n");
163 | return count;
164 | }
165 |
166 | #endif /*HTTP_H_*/
167 |
--------------------------------------------------------------------------------
/src/tcpoptions.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2006-2007 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz
3 | *
4 | * You may not use this file except under the terms of the accompanying license.
5 | *
6 | * Unless required by applicable law or agreed to in writing, software
7 | * distributed under the License is distributed on an "AS IS" BASIS,
8 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 | * See the License for the specific language governing permissions and
10 | * limitations under the License.
11 | *
12 | * Project: BoNeSi
13 | * File: tcpoptions.h
14 | * Purpose: support for the options field in the tcp header
15 | * Responsible: Markus Goldstein
16 | * Primary Repository: https://github.com/Markus-Go/bonesi
17 | * Web Sites: madm.dfki.de, www.goldiges.de
18 | */
19 |
20 | #ifndef TCPOPTIONS_H_
21 | #define TCPOPTIONS_H_
22 |
23 | #define NUM_TCP_OPTIONS 7
24 |
25 | typedef struct{
26 | u_int8_t length;
27 | u_int8_t* options;
28 | float prob;
29 | } TcpOption;
30 |
31 | inline static void initTcpOptions(TcpOption tcpOptions[]) {
32 | tcpOptions[0].prob = 0.46f / 3.f;
33 | tcpOptions[0].length = 20;
34 | tcpOptions[0].options = (u_int8_t*)malloc(tcpOptions[0].length);
35 | memcpy(tcpOptions[0].options,
36 | "\003\003\012\001\002\004\001\011\010\012\077\077\077\077\000\000\000\000\000\000",
37 | // 03 03 0a 01 02 04 01 09 08 0a
38 | // 3f 3f 3f 3f 00 00 00 00 00 00
39 | tcpOptions[0].length);
40 |
41 | tcpOptions[1].prob = 0.46f / 3.f;
42 | tcpOptions[1].length = 20;
43 | tcpOptions[1].options = (u_int8_t*)malloc(tcpOptions[1].length);
44 | memcpy(tcpOptions[1].options,
45 | "\002\004\005\264\001\003\003\000\001\001\010\012\000\165\012\042\000\000\000\000",
46 | // 02 04 05 b4 01 03 03 00 01 01
47 | // 08 0a 00 75 0a 22 00 00 00 00
48 | tcpOptions[1].length);
49 |
50 | tcpOptions[2].prob = 0.46f / 3.f;
51 | tcpOptions[2].length = 20;
52 | tcpOptions[2].options = (u_int8_t*)malloc(tcpOptions[2].length);
53 | memcpy(tcpOptions[2].options,
54 | "\002\004\005\226\004\002\010\012\155\264\137\256\000\000\000\000\001\003\003\000",
55 | // 02 04 05 96 04 02 08 0a 6d b4
56 | // 5f ae 00 00 00 00 01 03 03 00
57 | tcpOptions[2].length);
58 |
59 | tcpOptions[3].prob = 0.38f / 2.f;
60 | tcpOptions[3].length = 8;
61 | tcpOptions[3].options = (u_int8_t*)malloc(tcpOptions[3].length);
62 | memcpy(tcpOptions[3].options,
63 | "\002\004\005\354\001\004\002",
64 | // 02 04 04 ec 01 01 04 02
65 | tcpOptions[3].length);
66 |
67 | tcpOptions[4].prob = 0.38f / 2.f;
68 | tcpOptions[4].length = 8;
69 | tcpOptions[4].options = (u_int8_t*)malloc(tcpOptions[4].length);
70 | memcpy(tcpOptions[4].options,
71 | "\002\004\005\264\001\004\002",
72 | // 02 04 05 b4 01 01 04 02
73 | tcpOptions[4].length);
74 |
75 | tcpOptions[5].prob = 0.05f;
76 | tcpOptions[5].length = 12;
77 | tcpOptions[5].options = (u_int8_t*)malloc(tcpOptions[5].length);
78 | memcpy(tcpOptions[5].options,
79 | "\002\004\005\264\001\003\003\002\001\001\004\002",
80 | // 02 04 05 b4 01 03 03 02 01 01 04 02
81 | tcpOptions[5].length);
82 |
83 | tcpOptions[6].prob = 0.1f;
84 | tcpOptions[6].length = 24;
85 | tcpOptions[6].options = (u_int8_t*)malloc(tcpOptions[6].length);
86 | memcpy(tcpOptions[6].options,
87 | "\002\004\005\172\001\003\003\000\001\001\010\012\121\140\216\150\000\000\000\000\004\002\000\000",
88 | // 02 04 05 7a 01 03 03 00 01 01
89 | // 08 0a 51 60 8e 68 00 00 00 00 04 02 00 00
90 | tcpOptions[6].length);
91 | }
92 |
93 | static int randTcpOptionsIndex(TcpOption tcpOptions[]) {
94 | float tcpOptionsProb = rand() / (float)RAND_MAX;
95 | int tcpOptionsIndex;
96 | for(tcpOptionsIndex=0; tcpOptionsIndex