pax_global_header 0000666 0000000 0000000 00000000064 14222600140 0014501 g ustar 00root root 0000000 0000000 52 comment=ea161b050991b92f8d17e6fb6fb4cfae8cf1915d
nethogs-0.8.7/ 0000775 0000000 0000000 00000000000 14222600140 0013164 5 ustar 00root root 0000000 0000000 nethogs-0.8.7/.cproject 0000664 0000000 0000000 00000076062 14222600140 0015011 0 ustar 00root root 0000000 0000000
make
all
true
true
true
make
all
true
true
true
nethogs-0.8.7/.github/ 0000775 0000000 0000000 00000000000 14222600140 0014524 5 ustar 00root root 0000000 0000000 nethogs-0.8.7/.github/FUNDING.yml 0000664 0000000 0000000 00000001202 14222600140 0016334 0 ustar 00root root 0000000 0000000 # These are supported funding model platforms
github: [raboof]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
nethogs-0.8.7/.gitignore 0000664 0000000 0000000 00000000176 14222600140 0015160 0 ustar 00root root 0000000 0000000 nethogs
conninode_test
decpcap_test
TAGS
*.o
*~
nethogs.project
libnethogs.so.*
libnethogs.a
results/
build/
nethogs.egg-info
nethogs-0.8.7/.project 0000664 0000000 0000000 00000004603 14222600140 0014636 0 ustar 00root root 0000000 0000000
nethogs
org.eclipse.cdt.managedbuilder.core.genmakebuilder
clean,full,incremental,
?name?
org.eclipse.cdt.make.core.append_environment
true
org.eclipse.cdt.make.core.autoBuildTarget
all
org.eclipse.cdt.make.core.buildArguments
org.eclipse.cdt.make.core.buildCommand
make
org.eclipse.cdt.make.core.buildLocation
${workspace_loc:/nethogs/Debug}
org.eclipse.cdt.make.core.cleanBuildTarget
clean
org.eclipse.cdt.make.core.contents
org.eclipse.cdt.make.core.activeConfigSettings
org.eclipse.cdt.make.core.enableAutoBuild
false
org.eclipse.cdt.make.core.enableCleanBuild
true
org.eclipse.cdt.make.core.enableFullBuild
true
org.eclipse.cdt.make.core.fullBuildTarget
all
org.eclipse.cdt.make.core.stopOnError
true
org.eclipse.cdt.make.core.useDefaultBuildCmd
true
org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
org.eclipse.cdt.core.ccnature
org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
org.eclipse.cdt.managedbuilder.core.managedBuildNature
org.eclipse.cdt.core.cnature
nethogs-0.8.7/.travis.yml 0000664 0000000 0000000 00000000226 14222600140 0015275 0 ustar 00root root 0000000 0000000 language: cpp
addons:
apt:
packages:
- libpcap0.8-dev
script: make && make libnethogs
os:
- linux
- osx
arch:
- amd64
- ppc64le
nethogs-0.8.7/COPYING 0000664 0000000 0000000 00000043254 14222600140 0014227 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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
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.
Copyright (C)
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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) year 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.
, 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 Lesser General
Public License instead of this License.
nethogs-0.8.7/DESIGN 0000664 0000000 0000000 00000002262 14222600140 0014062 0 ustar 00root root 0000000 0000000 Rough design notes:
decpcap handles pcap. nethogs.cpp asks to be notified of all IPv4 or IPv6
TCP packets.
the IP callbacks store the source and destination addresses into the user
data. The TCP callback makes a Packet out of it, finds the Connection
corresponding to that packet, and adds the packet to the connection.
If no connection is found, a new one is constructed, and the process
related to that connection is found though getProcess.
If needed, the screen is refreshed.
If, in getProcess, no corresponding process is found, the connection is
added to the 'unknown' process.
To prevent connections from accidentally ending up in the 'unknown' process,
and then staying there indefinitely, we should maybe walk though
the unknownproc's connections whenever the connection-to-inode table is
refreshed.
And maybe, while there are still unknown connections, the connection-to-inode
table should be updated regularly.
There are some global data structures:
connection.cpp:
connections. 'ConnList' list containing all currently known connections.
A connection removes itself from the global 'connections' list in its
destructor.
processes. 'ProcList *' containing all processes.
nethogs-0.8.7/INSTALL 0000664 0000000 0000000 00000000212 14222600140 0014210 0 ustar 00root root 0000000 0000000 make ; make install
you need the 'libpcap-dev' and 'libpcap' packages.
let me know if you have any other problems on nethogs@bzzt.net
nethogs-0.8.7/Makefile 0000664 0000000 0000000 00000002513 14222600140 0014625 0 ustar 00root root 0000000 0000000 export VERSION := $(shell ./determineVersion.sh)
#export PREFIX := /usr
export PREFIX ?= /usr/local
all: decpcap_test test nethogs
.PHONY: tgz release check install install_lib install_dev uninstall uninstall_lib nethogs libnethogs decpcap_test test clean all
tgz: clean
git archive --prefix="nethogs-$(VERSION)/" -o "../nethogs-$(VERSION).tar.gz" HEAD
release: clean
git tag -s v$(RELEASE) -m "Release $(RELEASE)"
git archive --prefix="nethogs-$(RELEASE)/" -o "../nethogs-$(RELEASE).tar.gz" "v$(RELEASE)"
gpg --armor --detach-sign "../nethogs-$(RELEASE).tar.gz"
git push --tags
echo "now upload the detached signature ../nethogs-$(RELEASE).tar.gz.asc to https://github.com/raboof/nethogs/releases/new?tag=v$(VERSION)"
check:
$(MAKE) -C src -f MakeApp.mk $@
install:
$(MAKE) -C src -f MakeApp.mk $@
$(MAKE) -C doc $@
install_lib:
$(MAKE) -C src -f MakeLib.mk install
install_dev:
$(MAKE) -C src -f MakeLib.mk $@
uninstall:
$(MAKE) -C src -f MakeApp.mk $@
$(MAKE) -C doc $@
uninstall_lib:
$(MAKE) -C src -f MakeLib.mk uninstall
nethogs:
$(MAKE) -C src -f MakeApp.mk $@
libnethogs:
$(MAKE) -C src -f MakeLib.mk all
decpcap_test:
$(MAKE) -C src -f MakeApp.mk $@
test:
$(MAKE) -C src -f MakeApp.mk $@
clean:
$(MAKE) -C src -f MakeApp.mk $@
$(MAKE) -C src -f MakeLib.mk $@
format:
clang-format -i src/*.c src/*.cpp src/*.h
nethogs-0.8.7/README.decpcap.txt 0000664 0000000 0000000 00000005113 14222600140 0016260 0 ustar 00root root 0000000 0000000 This is a brainstorm about a libpcap-wrapper.
It should make it possible to add callbacks requesting specific packets, for example asking
for all TCP packets, whether they are sent over IPv4 or IPv6.
Return value of the callback specifies of the packet should 'fall through', i.e.,
if it should be sent to other callbacks, too.
give the programmer the opportunity to let packages re-enter the 'stream'.
Callbacks should be called from high to low level. When a callback returns 'true', no lower
callbacks should be called. The payload is available in a nice struct (union?), too.
= Examples - how it'd work =
== For the developers of the lib ==
When the sniffer is started, we learn what kind of packets are on the wire
(ethernet, ppp, etc) and start pcap. Whenever a packet arrives, it is parsed.
After parsing, if a callback is defined for this type of packet, the callback
is pushed onto a stack. After that the payload is parsed. This goes on until
the payload is, as far as we're concerned, raw data. Then the callbacks on
the stack are called, until one of them returns 'true' ('done parsing this
packet')
Undefined callbacks move the parser to the next level.
-- alternatively --
When the sniffer is started, we learn what kind of packets are on the wire
(ethernet, ppp, etc) and start pcap. Whenever a packet arrives, it is parsed.
After parsing, if a callback is defined for this type of packet, that
callback is called. If it returns 'true', the packet is 'done', and discarded.
If it returns 'false', it's passed on to the next level, leaving any changes
to the user data intact.
== For the users of the lib ==
If you want to sniff only tcp packets, add a callback for the 'packet_tcp'
packet type. If you also want to count the total amount of IP traffic, make
sure the 'packet_tcp' handler returns 'false' - that means after the tcp
callback the packet will go on and be presented to the IP callback also.
If you want to sniff specifically IPv4 TCP packets, you add a callback for
IPv4 that calls the function to parse the payload directly, and then returns
'false'.
If you modify the 'user' data in top-level callbacks which return 'false',
-- alternatively --
If you want to sniff only tcp packets, simply only add a callback for
'dp_packet_tcp'. If, on top of that, you also want to count the total amount
of IP traffic, make sure it returns 'false' and return.
If you want to sniff specifically IPv4 TCP packets, you can do 2 things:
add a 'true'-returning callback to everything else apart from IPv4 (which
is ugly), or only add a callback for IPv4 and call the TCP-parsing code
by hand.
nethogs-0.8.7/README.md 0000664 0000000 0000000 00000013402 14222600140 0014443 0 ustar 00root root 0000000 0000000 Nethogs
=======
[](https://travis-ci.org/raboof/nethogs)
Introduction
------------
NetHogs is a small 'net top' tool. Instead of breaking the traffic down per protocol or per subnet, like most tools do, **it groups bandwidth by process**.

NetHogs does not rely on a special kernel module to be loaded. If there's suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this. This makes it easy to identify programs that have gone wild and are suddenly taking up your bandwidth.
Since NetHogs heavily relies on `/proc`, most features are only available on Linux.
NetHogs can be built on Mac OS X and FreeBSD, but it will only show connections, not processes.
Status
------
Nethogs is a mature piece of software included in most Linux distributions.
Ideas for features, as well as [open bugs](https://github.com/raboof/nethogs/issues?q=is%3Aopen+is%3Aissue), can be found on [issues' label:enhancement](https://github.com/raboof/nethogs/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement).
### Downloading
You can clone this repo or get a source release from
https://github.com/raboof/nethogs/releases
### Building from source
Nethogs depends on `ncurses` for the text-based interface and `libpcap` for user-level packet capture. So you need to install both **development libraries** before building nethogs.
#### Debian/Ubuntu
apt-get install build-essential libncurses5-dev libpcap-dev
#### Yum-based distro's
yum install gcc-c++ libpcap-devel.x86_64 libpcap.x86_64 "ncurses*"
#### Getting the source
The master branch is intended to be stable at all times:
git clone https://github.com/raboof/nethogs
#### Building
After that, simply
make
sudo ./src/nethogs
#### Installing
##### For all distributions
sudo make install
hash -r
sudo nethogs
##### On Debian
sudo apt-get install checkinstall
sudo checkinstall -D make install
sudo dpkg -i nethogs*.deb
#### Upgrading
When upgrading (or downgrading), you can simply install the new version 'over'
the old one.
#### Uninstalling
If you want to remove Nethogs from your system, you can:
sudo make uninstall
### Running without root
In order to be run by a non-root user, nethogs needs the `cap_net_admin` and `cap_net_raw` capabilities. These can be set on the executable by using the `setcap` command, as follows:
sudo setcap "cap_net_admin,cap_net_raw+pe" /usr/local/sbin/nethogs
Coding standards
----------------
We use the [LLVM coding standards](http://llvm.org/docs/CodingStandards.html),
with the exception that we do allow 'return' after 'else' if it makes the code
more readable.
Note to contributors: feel free to request more exceptions and we'll list them
here.
Not all code currently adheres to this standard. Pull requests fixing style
are welcome, and do write new code in the proper style, but please do not
mix style fixes and new functionality in one pull request.
When writing new code, at least run 'make format' to have clang-format fix
some superficial style aspects.
libnethogs
----------
Apart from the 'nethogs' tool, this codebase now also builds as a 'libnethogs'
library. This is highly experimental, and we expect to break source and binary
compatibility while we look for the right abstraction points. Packaging
libnethogs as an independent package is currently discouraged, as the chance
of different applications successfully using the same libnethogs are slim.
Build it with `make libnethogs`, install with `make install_lib` or `make install_dev`.
libnethogs is being used in https://github.com/mb-gh/gnethogs
links
-----
Nethogs monitors traffic going to/from a machine, per process. Other tools rather monitor what kind of traffic travels to, from or through a machine, etcetera. I'll try to link to such tools here. By all means open an issue/PR if you know another:
* [nettop](http://srparish.net/scripts/) shows packet types, sorts by either size or number of packets.
* [ettercap](http://ettercap.sf.net/) is a network sniffer/interceptor/logger for ethernet
* [darkstat](http://purl.org/net/darkstat/) breaks down traffic by host, protocol, etc. Geared towards analysing traffic gathered over a longer period, rather than `live' viewing.
* [iftop](http://ex-parrot.com/~pdw/iftop/) shows network traffic by service and host
* [ifstat](http://gael.roualland.free.fr/ifstat/) shows network traffic by interface in a vmstat/iostat-like manner
* [gnethogs](https://github.com/mbfoss/gnethogs) GTK-based GUI (work-in-progress)
* [nethogs-qt](http://slist.lilotux.net/linux/nethogs-qt/index_en.html) Qt-based GUI
* [hogwatch](https://github.com/akshayKMR/hogwatch) A bandwidth monitor(per process) with graphs for desktop/web.
* [iptraf-ng](https://github.com/iptraf-ng/iptraf-ng) is a console-based network monitoring program for Linux that displays information about IP traffic.
* [nettop (by Emanuele Oriani)](http://nettop.youlink.org/) is a simple process/network usage report for Linux.
* [iptstate](https://www.phildev.net/iptstate/index.shtml) is a top-like interface to your netfilter connection-tracking table.
* [flowtop](http://netsniff-ng.org/) is a top-like netfilter connection tracking tool.
* [BusyTasks](https://www.pling.com/p/1201835) is a Java-based app using top, iotop and nethogs as backend.
* [bandwhich](https://github.com/imsnif/bandwhich) is a terminal bandwidth utilization tool.
* [sniffer](https://github.com/chenjiandongx/sniffer) is a modern alternative network traffic sniffer.
License
-------
Copyright 2004-2005, 2008, 2010-2012, 2015 Arnout Engelen
License: nethogs may be redistributed under the terms of the GPLv2 or any
later version. See the COPYING file for the license text.
nethogs-0.8.7/determineVersion.sh 0000775 0000000 0000000 00000000155 14222600140 0017046 0 ustar 00root root 0000000 0000000 #!/bin/bash
(git describe --tags 2>/dev/null || pwd | sed -e "s/.*\\///" | sed -e "s/[^-]*//") | tail -c +2
nethogs-0.8.7/doc/ 0000775 0000000 0000000 00000000000 14222600140 0013731 5 ustar 00root root 0000000 0000000 nethogs-0.8.7/doc/BUILDING.md 0000664 0000000 0000000 00000000504 14222600140 0015447 0 ustar 00root root 0000000 0000000 To test building on FreeBSD:
vagrant init freebsd/FreeBSD-10.3-RELEASE
vagrant up --provider virtualbox
This may show an error related to MAC addresses, but just try again:
vagrant up
vagrant ssh
sudo pkg install git gmake
git clone https://github.com/raboof/nethogs
cd nethogs
gmake
sudo ./src/nethogs
nethogs-0.8.7/doc/Makefile 0000664 0000000 0000000 00000000566 14222600140 0015400 0 ustar 00root root 0000000 0000000 all:
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),FreeBSD)
ifeq ($(PREFIX),/usr/local)
man8 := $(PREFIX)/man/man8
else
man8 := $(PREFIX)/share/man/man8
endif
else
man8 := $(PREFIX)/share/man/man8
endif
install: nethogs.8
install -d -m 755 $(DESTDIR)$(man8)
install -m 644 nethogs.8 $(DESTDIR)$(man8)
uninstall:
rm $(DESTDIR)$(man8)/nethogs.8 || true
nethogs-0.8.7/doc/RELEASING.md 0000664 0000000 0000000 00000000033 14222600140 0015560 0 ustar 00root root 0000000 0000000 RELEASE=0.8.4 make release
nethogs-0.8.7/doc/nethogs.8 0000664 0000000 0000000 00000005553 14222600140 0015501 0 ustar 00root root 0000000 0000000 .\" This page Copyright (C) 2004 Fabian Frederick
.\" Content based on Nethogs homepage by Arnout Engelen
.TH NETHOGS 8 "14 February 2004"
.SH NAME
nethogs \- Net top tool grouping bandwidth per process
.SH SYNOPSIS
.ft B
.B nethogs
.RB [ "\-V" ]
.RB [ "\-h" ]
.RB [ "\-x" ]
.RB [ "\-d seconds" ]
.RB [ "\-v mode" ]
.RB [ "\-c count" ]
.RB [ "\-t" ]
.RB [ "\-p" ]
.RB [ "\-s" ]
.RB [ "\-a" ]
.RB [ "\-l" ]
.RB [ "\-f filter" ]
.RB [ "\-C" ]
.RB [ "\-b" ]
.RB [ "\-g period" ]
.RB [ "\-P pid" ]
.RI [device(s)]
.SH DESCRIPTION
NetHogs is a small 'net top' tool. Instead of breaking the traffic down per protocol or per subnet, like most such tools do, it groups bandwidth by process - and does not rely on a special kernel module to be loaded. So if there's suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this, and if it's some kind of spinning process, kill it.
.SS Options
.TP
\fB-V\fP
prints version.
.TP
\fB-h\fP
prints available commands usage.
.TP
\fB-x\fP
bughunt mode - implies tracemode.
.TP
\fB-d\fP
delay for update refresh rate in seconds. default is 1.
.TP
\fB-v\fP
view mode (0 = KB/s, 1 = total KB, 2 = total B, 3 = total MB, 4 = MB/s, 5 = GB/s). default is 0.
.TP
\fB-c\fP
number of updates. default is 0 (unlimited).
.TP
\fB-t\fP
tracemode.
.TP
\fB-p\fP
sniff in promiscuous mode (not recommended).
.TP
\fB-s\fP
sort output by sent column.
.TP
\fB-l\fP
display command line.
.TP
\fB-a\fP
monitor all devices, even loopback/stopped ones.
.TP
\fB-C\fP
capture TCP and UDP.
.TP
\fB-b\fP
Display the program basename.
.TP
\fB-g\fP
garbage collection period in number of refresh. default is 50.
.TP
\fB-P\fP
Show only processes with the specified pid(s).
.TP
\fB-f\fP
EXPERIMENTAL: specify string pcap filter (like tcpdump). This may be removed or changed in a future version.
.TP
.PP
.I device(s)
to monitor. default is all interfaces up and running excluding loopback
.SH "INTERACTIVE CONTROL"
.TP
q
quit
.TP
s
sort by SENT traffic
.TP
r
sort by RECEIVED traffic
.TP
l
display command line
.TP
b
display the program basename
.TP
m
switch between total (KB, B, MB) and throughput (KB/s, MB/s, GB/s) mode
.RE
.SH "RUNNING WITHOUT ROOT"
In order to be run by an unprivileged user,
.B nethogs
needs the
.I cap_net_admin
and
.I cap_net_raw
capabilities. These can be set on the executable by using the
.BR setcap (8)
command, as follows:
.PP
.in +4n
.EX
sudo setcap "cap_net_admin,cap_net_raw+pe" /usr/local/sbin/nethogs
.EE
.in
.SH "Notes"
1. When using the -P option, in a case where a process exited (normally or abruptly), Nethogs does not track that it exited. So, the operating system might create
a new process (for another program) with the same pid. In this case, this new process will be shown by Nethogs.
.SH "SEE ALSO"
.I netstat(8) tcpdump(1) pcap(3)
.SH AUTHOR
.nf
Written by Arnout Engelen .
nethogs-0.8.7/doc/screenshot.png 0000664 0000000 0000000 00000331032 14222600140 0016616 0 ustar 00root root 0000000 0000000 ‰PNG
IHDR é ^ 8ã[ 3äzTXtRaw profile type exif xÚœk–7®¬ÿs=¾Ã! r;ƒ3üów•,Ër·WßÓj[riïL&" 0ÝùŸÿwÝ¿þõ¯Cð.—Öë¨Õó¿<òˆ“?tÿùß|ÿ>¿¿ÿáã×OÿôsWÎ×#¿'~OŸ¿èõó{øþù×¾“?•Ÿ.Ô÷×_¬?ÿÅÈŸßcÿåBŸõø¤éÏöu¡ñu¡?¾.0?åëèíçGXçóû×÷?ÛÀ?NÿÊýÏËþË7vÏ
÷I1ž’çß1ÅÏ’þ .Í÷ý»êƒïÏ9%þÓ÷JØßí“ÿiUîW«üøÓ/ViýÇýÉ(©~>áøÁŸ7³þøý·?å—Ÿ]н-þéÎiÿp‡?ýܯx~}œïîµîî=Ÿ§›¹²¥õ롾ñý‰.¶<½¯U~5þ)ü¹½_ƒ_Ýὓ›ß~ñk‡Ç'Cf¸á¼ßwØ,1ǿǸ1”~ÖS‹#îäÆÌúnli$KkmÌ›øiü±–ðî;ÞívèÜØŸ$Ê6÷ÅÖîüÿà×ß^è^¹vì3¹P'â¡”h¬2 ãô¨{óÞgc‰ŸƒY¢¤š¦ib«°á?-w|h–Tr)¥–VzeÖTs-µÖV~³¥–[iµµÖÛh³§ž{éµ·Þ]}Ž8àXFmô1ÆœÜtråÉ·'˜sÅ•V^eÕÕV_cÍûì¼Ë®»íîöØÓ¢%'¬Z³nÃæ W:ù”SO;ýŒ3/®vÓÍ·ÜzÛíwÜùÃjÁ}Ìú—_ÿÜjáÛjñYJl?¬ÆW[û¾DœÙ‹Å°x“pè(›ùrŽN¦“ÍüˆDE‰¬²È8d1,˜Oˆå†¶ûÃr²›ËùÿËnñÛrN¦û¿°œ“éþÆrµÛo¬fÊ6Û'÷,¤0Ô¦úDø0«ÕµÙ¶nÍÓWœf¹²Qéµ=³ëkWŸú™3žöH΋IÜí°ß%æÜÀ±¶«¥ÅÞæØ¶Ùš S¬K¾Öwi³ätW2{‘®bpÖfË2Ø=ØnVg\ëvÖRíü¬w\”KŸë¸<§?¥w‚ömC1Ô6 ·rOÃ/[cµ“1PÑæ×ÂÓòÄ-ΈüàWHظîyùZXm®Öf6¶åéIþXˆ-ÇÜöI€@=ê»&_—¥n|§`6ÿÅ‚]Û,‡³~ÎNwÌÔNÉÓ€“…oU›vØ2F,ín×ðÿŽénÍ—žÓÛ±èB]eßä;asýÁ§Všu³ÏûÆ9ìnxh« ;°£·~z±7~Ôú B›uÅì;zÛ\ã^¿Ù‚dµ:ÿIÐãj»ö5ýìåiýlÜ|kwzEUX(.ë9÷ZVï‡ <5ïDT‰aC°Á9Ç`y«ó0¥í´"ÛíðÑË%“®RrœaÚ¶¹kÁJD,†¶vÄÕ÷-›™¿³±ÛTxK(§áó.ãåÛVæN¦Mâg®3›µ—”[ÈzX²V]ê™ùàü¹{öS³ûÊ!ëæëÕ;Ï,mù‹¿˜×Œ\h¦ÚâÝ=Ž Y¾fºqk;·—ãnÃ(‘
5¶Ü¿ðÎpg›Mêx%_h3ôK›ÊøÐP¬žt[u¶°Š…5*ö¬DHa£¼×YÚúÅ6xÛä¯Gd[„%ØÝ¸ƒåZî=Ù™ÑZÛq„bPãq–ИÏh}¸Å"üöy€ÌóÊ)ò…—ŒXÀ
–æÝ%No´‰;âXˆÃ•UEiæX=<5Ʋ¡·¸;îhòªo7SVwÏÓ¾ýŒgŽñœëU×O,ƒnåËw¡ÛÒ eò<‰öT?ÜÌhÊcÕ9±™¿ƒÈèÜŒM |lâò¥%ÖÁ
YÇËpÿnw»jÇ“]Ú:úúN‰ðäSßK—ÈÅzÁMþ†1 †;5<äv{ Èc¤øï×C#Þ³ï¨pœ!üÅÈ,
‡—·ÔÒµÏ[OÖj1¶©ò÷v™'%'ÆœªìØ}Hºßß=îWö˜ö6ûÚ÷›Þßï©\¥¯füM³87æO
“ª)×¶Š»ŒsIŸ\ YâKþ¶ >áu{YÔ÷{jTĆcN{Ùì{/ÿÈôçïg•BýëÓºŸ7²|9…CL„Ð é!$±ëÉ’«s¾a1ÔR@)åØÄ`A aü“Íî§?Y+½›xLH1üŠIè|Bšs€ã68¤òë׆‘ƒ/a„10²ÐHmË”‹fm|ФðÓŽß/}¶q¿GrñL]~l<ˆ&E¯R…“\6±WíbGïáÃ]E
hžxå}¶ pÛlöR\0‹ü„$`1À¨4iÒÛ
õŽh.|#Â]ù&׆´ `ÁÄ9‘&Ð#°3°ØÑARÏteŽ<æñn§x÷=‹r€6çHâ¾AO¸øÛáì
®FÁ veƒ 6‡}HÙ<$N8ÑáŽ]¸09’àâ_à&SOÛ¥@uáBë´€n˜P¸ö‚°.w!¨!Â` k'Ò_½psü¦ˆJB¢o0›¿&1¡½ ‡ 9É·Éc=æ0t§Ÿ£WüD¿ðÀ‰*ºÐÙ=<ÒÇÎÁ*ïá©ý£TY~K½iÜ`I» d|¤éIa·‰M‚óƒ\
È?@.Ùš<‘\Rü *²e~<'‘£µÑ¡Ð•ÉŽ™Tdú…Ê“‰ “ŸK” $S}$æî€±Í*áÌ5+×ÎÑGš_8Q<8¹ˆ˜ rÂ.˜T…˜í:š
€L‚Às·Ã´±Ë¹%Íq:òŒÀ»22°?”¢Ýõå/Ê áUŽ•¡>–ˆÔXŽ¨Ø·ÂÈ;+Æd¬Íˆ£($Jhp¶¬Xå¡‹~d
‹³0°Ôªn“ðÎXx )Àà#`éPæ:€]…å–³%e3î1á§®tp*W¯
S6°êÄ žZ`›0Ì‚SÇÛ¡“,k š°p’xC¢ +VàÑwv]á8ÎÊÌzdfbšÆ6•£È¶þ.¼¨+œ¹õ ‚AÊ„ì}/v¶ÜT€gÀ†ì7$â\…ˆR-irc¸’[݆³)\|Np«)&ä7Vc;ÁèéÁrô°?ÔFÿŽ Š0/Ò0©rpì
Ã9¢$uðÇ^…(8 ZÃs 0‚-x²ºðeì–©ˆº!E¨Š“»uHÃf rCwfSƳ/1ζJíÆÄEAµD-Ÿˆ¸ä»n‚ÎŒ^9ª{–w‹Œ—ôÀ3Dµ|Q!Ä8‹X6á’`ëˆü½ D,¬R͆Wb³jpy¿¢pÝ!µ=ì=ß%½€×S@Æ÷$NyXï¥s}áàS¯¶LàÃ&L¤Ÿ
.ÀwkKü#¯8‡çnŠ˜be=U]Éð|haèB]¶¥QG¨BçÓ(Žˆà;&D„cÄ÷Äâ ¤Bàˆ'Æ,58YjÝ!†ÍÇš$´\"ªÈ0‚bUy(F“EöÛ`„
ËHa(åá
ûìñ.òÁU›ÊB¨#‘×YnY$„éE´ùŸ¡d‚($[ìW˜SñªÊW