├── .gitignore ├── .gitmodules ├── COPYING ├── Makefile.am ├── README.md ├── autogen.sh ├── backend ├── Makefile.am ├── deps │ ├── json_spirit │ │ ├── .json_spirit_utils.h.swp │ │ ├── CMakeLists.txt │ │ ├── json_spirit.h │ │ ├── json_spirit.vcproj │ │ ├── json_spirit_error_position.h │ │ ├── json_spirit_reader.cpp │ │ ├── json_spirit_reader.h │ │ ├── json_spirit_reader_template.h │ │ ├── json_spirit_stream_reader.h │ │ ├── json_spirit_utils.h │ │ ├── json_spirit_value.cpp │ │ ├── json_spirit_value.h │ │ ├── json_spirit_writer.cpp │ │ ├── json_spirit_writer.h │ │ └── json_spirit_writer_template.h │ └── winpcap │ │ ├── include │ │ ├── Packet32.h │ │ ├── Win32-Extensions.h │ │ ├── bittypes.h │ │ ├── ip6_misc.h │ │ ├── pcap-bpf.h │ │ ├── pcap-namedb.h │ │ ├── pcap-stdinc.h │ │ ├── pcap.h │ │ ├── pcap │ │ │ ├── bluetooth.h │ │ │ ├── bpf.h │ │ │ ├── namedb.h │ │ │ ├── pcap.h │ │ │ ├── sll.h │ │ │ ├── usb.h │ │ │ └── vlan.h │ │ └── remote-ext.h │ │ └── lib │ │ ├── Packet.dll │ │ └── wpcap.dll └── src │ ├── abstract_platform.hpp │ ├── config.h │ ├── firesheep_platform.hpp │ ├── http_packet.cpp │ ├── http_packet.hpp │ ├── http_sniffer.cpp │ ├── http_sniffer.hpp │ ├── interface_info.hpp │ ├── libfiresheep.cpp │ ├── linux_platform.cpp │ ├── linux_platform.hpp │ ├── main.cpp │ ├── osx_platform.cpp │ ├── osx_platform.hpp │ ├── tcpip.h │ ├── unix_platform.hpp │ ├── windows_platform.cpp │ └── windows_platform.hpp ├── boost.m4 ├── configure.ac ├── scripts └── runfoxrun.sh └── xpi ├── chrome.manifest ├── chrome ├── content │ ├── about.xul │ ├── browserOverlay.js │ ├── browserOverlay.xul │ ├── customizeToolbarOverlay.xul │ ├── preferences │ │ ├── advancedPane.xul │ │ ├── capturePane.js │ │ ├── capturePane.xul │ │ ├── prefsWindow.xul │ │ ├── websiteEditor.js │ │ ├── websiteEditor.xul │ │ ├── websitesPane.js │ │ └── websitesPane.xul │ ├── sidebar.js │ └── sidebar.xul ├── locale │ └── en-US │ │ ├── about.dtd │ │ ├── options.dtd │ │ ├── overlay.dtd │ │ └── overlay.properties └── skin │ ├── bottombar_bg.png │ ├── bottombar_handle.png │ ├── default_avatar.jpg │ ├── details_button.png │ ├── details_button_pressed.png │ ├── menu_button.png │ ├── menu_button_pressed.png │ ├── overlay.css │ ├── preferences-osx.css │ ├── preferences.css │ ├── prefs-advanced.png │ ├── prefs-capture.png │ ├── prefs-websites.png │ ├── sidebar-osx.css │ ├── sidebar-win.css │ ├── sidebar.css │ └── toolbar-button.png ├── defaults └── preferences │ └── prefs.js ├── handlers ├── akfdemo.js ├── amazon.js ├── basecamp.js ├── bitly.js ├── cisco.js ├── cnet.js ├── enom.js ├── evernote.js ├── facebook.js ├── fiverr.js ├── flickr.js ├── foursquare.js ├── google.js ├── gowalla.js ├── groupme.js ├── hackernews.js ├── harvest.js ├── linkedin.js ├── live.js ├── nytimes.js ├── posterous.js ├── quora.js ├── reddit.js ├── sandiego_toorcon.js ├── shutterstock.js ├── stackoverflow.js ├── tumblr.js ├── twitter.js ├── vimeo.js ├── wordpress.js ├── yahoo.js └── yelp.js ├── install.rdf └── modules ├── Firesheep.js ├── FiresheepBackend.js ├── FiresheepConfig.js ├── FiresheepResult.js ├── FiresheepSession.js └── util ├── Base64.js ├── CookieMonster.js ├── FileTail.js ├── Observers.js ├── Preferences.js ├── RailsHelper.js ├── RubyMarshal.js ├── ScriptParser.js ├── Utils.js └── underscore.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.m4 3 | libtool 4 | ltmain.sh 5 | depcomp 6 | autom4te.cache/* 7 | config.guess 8 | config.log 9 | config.status 10 | config.sub 11 | configure 12 | install-sh 13 | Makefile 14 | Makefile.in 15 | missing 16 | 17 | backend/backend 18 | backend/.libs 19 | backend/.deps 20 | backend/*.o 21 | backend/*.lo 22 | backend/*.la 23 | 24 | xpi/components 25 | xpi/backend 26 | xpi/platform 27 | 28 | build/ 29 | 30 | *.suo 31 | *.ncb 32 | *.user 33 | *.swp 34 | *~ 35 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "backend/deps/http-parser"] 2 | path = backend/deps/http-parser 3 | url = https://github.com/joyent/http-parser 4 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I . 2 | 3 | SUBDIRS = backend 4 | 5 | XPI_OUT_DIR = $(top_builddir)/build 6 | XPI = $(XPI_OUT_DIR)/Firesheep-$(FIRESHEEP_PLATFORM).xpi 7 | 8 | PLATFORM_DEST = $(top_builddir)/xpi/platform/$(FIRESHEEP_PLATFORM) 9 | FIRESHEEP_BACKEND = $(PLATFORM_DEST)/firesheep-backend 10 | LIBFIRESHEEP = $(PLATFORM_DEST)/libfiresheep.$(DLL_EXT) 11 | 12 | all: platform zip 13 | 14 | platform: 15 | mkdir -p $(PLATFORM_DEST) 16 | cp $(top_builddir)/backend/backend $(FIRESHEEP_BACKEND) 17 | cp $(top_builddir)/backend/.libs/libfiresheep.$(DLL_EXT) $(LIBFIRESHEEP) 18 | 19 | #if PLATFORM_WIN32 20 | # cp -f `which cygwin1.dll` $(PLATFORM_DEST) 21 | # cp -f `which cygstdc++-6.dll` $(PLATFORM_DEST) 22 | # cp -f `which cyggcc_s-1.dll` $(PLATFORM_DEST) 23 | #endif 24 | 25 | zip: 26 | mkdir -p $(XPI_OUT_DIR) 27 | rm -f $(XPI) 28 | cd xpi && zip -r ../$(XPI) * 29 | 30 | clean-local: 31 | rm -f $(FIRESHEEP_BACKEND) $(LIBFIRESHEEP) $(XPI) 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Firesheep 2 | 3 | ### **THIS BRANCH IS A WORK-IN-PROGRESS! Use the 'stable' branch (requires Firefox 3.x) instead!** 4 | 5 | A Firefox extension that demonstrates HTTP session hijacking attacks. 6 | 7 | Created by: 8 | 9 | * Eric Butler 10 | 11 | Contributors: 12 | 13 | * Ian Gallagher 14 | * Michajlo Matijkiw 15 | * Nick Kossifidis 16 | 17 | ## Building 18 | 19 | Start by grabbing the code using Git. If you're planning to contribute, fork the project on GitHub. 20 | 21 | $ git clone https://github.com/codebutler/firesheep.git 22 | $ cd firesheep 23 | $ git submodule update --init 24 | 25 | See instructions for your platform below. When done, an xpi will be created inside the `build` directory. Load the extension into Firefox by dragging it into the Addons page. 26 | 27 | ### Mac OS X 28 | 29 | 1. Install build dependencies using [Homebrew][1] (`brew install autoconf automake libtool boost`). 30 | 2. Run `./autogen.sh` 31 | 3. Run `make`! 32 | 33 | ### Ubuntu Linux 34 | 35 | 1. Install build dependencies (`sudo apt-get install autoconf libtool libpcap-dev libboost-all-dev libudev-dev`). 36 | 2. Run `./autogen.sh` then `make`. 37 | 38 | ### Windows 39 | 40 | This has so far only been tested on Windows XP (32-bit), however the binaries work fine on Windows 7 too. If you can help simplify this process please let me know. 41 | 42 | 1. You'll need Microsoft Visual Studio 2005. The express edition should work too, but this hasn't been tested. Newer versions of Visual Studio should also work, but the Makefiles might need a bit of tweaking. Patches in this area greatly appreciated. 43 | 2. Install [Cygwin][3], selecting the following packages: `automake-1.11`, `gcc-g++`. 44 | 3. Install [BoostPro][4]. Choose *Visual C++ 8.0* and *Multithreaded debug, static runtime*. 45 | 4. Install [WinPcap][6]. 46 | 5. From a Cygwin command prompt: Run `./autogen.sh` then run `make`! 47 | 48 | [1]: http://mxcl.github.com/homebrew/ 49 | [3]: http://www.cygwin.com/ 50 | [4]: http://www.boostpro.com/download/ 51 | [5]: http://en.wikipedia.org/wiki/Promiscuous_mode 52 | [6]: http://www.winpcap.org/install/default.htm 53 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | test -n "$srcdir" || srcdir=`dirname "$0"` 4 | test -n "$srcdir" || srcdir=. 5 | autoreconf --force --install --verbose "$srcdir" 6 | test -n "$NOCONFIGURE" || "$srcdir/configure" "$@" 7 | 8 | -------------------------------------------------------------------------------- /backend/Makefile.am: -------------------------------------------------------------------------------- 1 | INCLUDES = \ 2 | -I deps/ \ 3 | -I deps/http-parser \ 4 | -I deps/json_spirit 5 | 6 | #CXXFLAGS = \ 7 | # -Wall \ 8 | # -g -O0 9 | 10 | bin_PROGRAMS = backend 11 | lib_LTLIBRARIES = libfiresheep.la 12 | 13 | backend_SOURCES = \ 14 | src/main.cpp 15 | 16 | backend_LDADD = \ 17 | libfiresheep.la 18 | 19 | backend_LDFLAGS = -static 20 | 21 | libfiresheep_la_SOURCES = \ 22 | src/libfiresheep.cpp \ 23 | src/http_sniffer.cpp \ 24 | src/http_packet.cpp \ 25 | deps/http-parser/http_parser.c 26 | 27 | if PLATFORM_OSX 28 | CXXFLAGS += -DPLATFORM_OSX -arch i386 -arch x86_64 -I/usr/include -I/usr/local/include 29 | libfiresheep_la_SOURCES += src/osx_platform.cpp 30 | libfiresheep_la_LDFLAGS = -framework Security 31 | libfiresheep_la_LDFLAGS += -framework SystemConfiguration 32 | libfiresheep_la_LDFLAGS += -framework CoreFoundation 33 | libfiresheep_la_LIBADD = $(PCAP_LIBS) $(BOOST_FORMAT_LIBS) $(BOOST_STRING_ALGO_LIBS) 34 | endif 35 | if PLATFORM_WIN32 36 | CXXFLAGS += -DPLATFORM_WIN32 37 | #LIBFIRESHEEP_SOURCES += src/windows_platform.cpp 38 | #LIBFIRESHEEP_CFLAGS += -I"/c/Program Files/boost/boost_1_44" 39 | #LIBFIRESHEEP_CFLAGS += -I"deps/winpcap/include" 40 | #LIBFIRESHEEP_CFLAGS += -L"deps/winpcap/lib" 41 | #LIBFIRESHEEP_LIBS += -lwpcap 42 | endif 43 | if PLATFORM_LINUX 44 | CXXFLAGS += -DPLATFORM_LINUX 45 | libfiresheep_la_SOURCES += src/linux_platform.cpp 46 | libfiresheep_la_CXXFLAGS = $(PCAP_CFLAGS) $(BOOST_CPPFLAGS) $(UDEV_CFLAGS) 47 | libfiresheep_la_CFLAGS = $(libfiresheep_la_CXXFLAGS) 48 | libfiresheep_la_LIBADD = $(PCAP_LIBS) $(BOOST_FORMAT_LIBS) $(BOOST_STRING_ALGO_LIBS) $(UDEV_LIBS) 49 | endif 50 | 51 | CFLAGS += $(CXXFLAGS) 52 | -------------------------------------------------------------------------------- /backend/deps/json_spirit/.json_spirit_utils.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/firesheep/cbc05797309431b5e4acad604550fa665d49bb67/backend/deps/json_spirit/.json_spirit_utils.h.swp -------------------------------------------------------------------------------- /backend/deps/json_spirit/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(JSON_SPIRIT_SRCS 2 | json_spirit_reader.cpp 3 | json_spirit_value.cpp 4 | json_spirit_writer.cpp) 5 | 6 | FIND_PACKAGE(Boost 1.34 REQUIRED) 7 | INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR}) 8 | 9 | ADD_LIBRARY(json_spirit STATIC ${JSON_SPIRIT_SRCS}) 10 | 11 | -------------------------------------------------------------------------------- /backend/deps/json_spirit/json_spirit.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT 2 | #define JSON_SPIRIT 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_value.h" 14 | #include "json_spirit_reader.h" 15 | #include "json_spirit_writer.h" 16 | #include "json_spirit_utils.h" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /backend/deps/json_spirit/json_spirit.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 54 | 57 | 60 | 63 | 66 | 69 | 72 | 75 | 78 | 81 | 82 | 90 | 93 | 96 | 99 | 102 | 105 | 118 | 121 | 124 | 127 | 130 | 133 | 136 | 139 | 142 | 145 | 146 | 147 | 148 | 149 | 150 | 155 | 158 | 159 | 162 | 163 | 164 | 169 | 172 | 173 | 176 | 177 | 180 | 181 | 184 | 185 | 188 | 189 | 192 | 193 | 196 | 197 | 200 | 201 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | -------------------------------------------------------------------------------- /backend/deps/json_spirit/json_spirit_error_position.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT_ERROR_POSITION 2 | #define JSON_SPIRIT_ERROR_POSITION 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include 14 | 15 | namespace json_spirit 16 | { 17 | // An Error_position exception is thrown by the "read_or_throw" functions below on finding an error. 18 | // Note the "read_or_throw" functions are around 3 times slower than the standard functions "read" 19 | // functions that return a bool. 20 | // 21 | struct Error_position 22 | { 23 | Error_position(); 24 | Error_position( unsigned int line, unsigned int column, const std::string& reason ); 25 | bool operator==( const Error_position& lhs ) const; 26 | unsigned int line_; 27 | unsigned int column_; 28 | std::string reason_; 29 | }; 30 | 31 | inline Error_position::Error_position() 32 | : line_( 0 ) 33 | , column_( 0 ) 34 | { 35 | } 36 | 37 | inline Error_position::Error_position( unsigned int line, unsigned int column, const std::string& reason ) 38 | : line_( line ) 39 | , column_( column ) 40 | , reason_( reason ) 41 | { 42 | } 43 | 44 | inline bool Error_position::operator==( const Error_position& lhs ) const 45 | { 46 | if( this == &lhs ) return true; 47 | 48 | return ( reason_ == lhs.reason_ ) && 49 | ( line_ == lhs.line_ ) && 50 | ( column_ == lhs.column_ ); 51 | } 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /backend/deps/json_spirit/json_spirit_reader.cpp: -------------------------------------------------------------------------------- 1 | // Copyright John W. Wilkinson 2007 - 2009. 2 | // Distributed under the MIT License, see accompanying file LICENSE.txt 3 | 4 | // json spirit version 4.03 5 | 6 | #include "json_spirit_reader.h" 7 | #include "json_spirit_reader_template.h" 8 | 9 | using namespace json_spirit; 10 | 11 | bool json_spirit::read( const std::string& s, Value& value ) 12 | { 13 | return read_string( s, value ); 14 | } 15 | 16 | void json_spirit::read_or_throw( const std::string& s, Value& value ) 17 | { 18 | read_string_or_throw( s, value ); 19 | } 20 | 21 | bool json_spirit::read( std::istream& is, Value& value ) 22 | { 23 | return read_stream( is, value ); 24 | } 25 | 26 | void json_spirit::read_or_throw( std::istream& is, Value& value ) 27 | { 28 | read_stream_or_throw( is, value ); 29 | } 30 | 31 | bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ) 32 | { 33 | return read_range( begin, end, value ); 34 | } 35 | 36 | void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ) 37 | { 38 | begin = read_range_or_throw( begin, end, value ); 39 | } 40 | 41 | #ifndef BOOST_NO_STD_WSTRING 42 | 43 | bool json_spirit::read( const std::wstring& s, wValue& value ) 44 | { 45 | return read_string( s, value ); 46 | } 47 | 48 | void json_spirit::read_or_throw( const std::wstring& s, wValue& value ) 49 | { 50 | read_string_or_throw( s, value ); 51 | } 52 | 53 | bool json_spirit::read( std::wistream& is, wValue& value ) 54 | { 55 | return read_stream( is, value ); 56 | } 57 | 58 | void json_spirit::read_or_throw( std::wistream& is, wValue& value ) 59 | { 60 | read_stream_or_throw( is, value ); 61 | } 62 | 63 | bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ) 64 | { 65 | return read_range( begin, end, value ); 66 | } 67 | 68 | void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ) 69 | { 70 | begin = read_range_or_throw( begin, end, value ); 71 | } 72 | 73 | #endif 74 | 75 | bool json_spirit::read( const std::string& s, mValue& value ) 76 | { 77 | return read_string( s, value ); 78 | } 79 | 80 | void json_spirit::read_or_throw( const std::string& s, mValue& value ) 81 | { 82 | read_string_or_throw( s, value ); 83 | } 84 | 85 | bool json_spirit::read( std::istream& is, mValue& value ) 86 | { 87 | return read_stream( is, value ); 88 | } 89 | 90 | void json_spirit::read_or_throw( std::istream& is, mValue& value ) 91 | { 92 | read_stream_or_throw( is, value ); 93 | } 94 | 95 | bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ) 96 | { 97 | return read_range( begin, end, value ); 98 | } 99 | 100 | void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ) 101 | { 102 | begin = read_range_or_throw( begin, end, value ); 103 | } 104 | 105 | #ifndef BOOST_NO_STD_WSTRING 106 | 107 | bool json_spirit::read( const std::wstring& s, wmValue& value ) 108 | { 109 | return read_string( s, value ); 110 | } 111 | 112 | void json_spirit::read_or_throw( const std::wstring& s, wmValue& value ) 113 | { 114 | read_string_or_throw( s, value ); 115 | } 116 | 117 | bool json_spirit::read( std::wistream& is, wmValue& value ) 118 | { 119 | return read_stream( is, value ); 120 | } 121 | 122 | void json_spirit::read_or_throw( std::wistream& is, wmValue& value ) 123 | { 124 | read_stream_or_throw( is, value ); 125 | } 126 | 127 | bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ) 128 | { 129 | return read_range( begin, end, value ); 130 | } 131 | 132 | void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ) 133 | { 134 | begin = read_range_or_throw( begin, end, value ); 135 | } 136 | 137 | #endif 138 | -------------------------------------------------------------------------------- /backend/deps/json_spirit/json_spirit_reader.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT_READER 2 | #define JSON_SPIRIT_READER 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_value.h" 14 | #include "json_spirit_error_position.h" 15 | #include 16 | 17 | namespace json_spirit 18 | { 19 | // functions to reads a JSON values 20 | 21 | bool read( const std::string& s, Value& value ); 22 | bool read( std::istream& is, Value& value ); 23 | bool read( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ); 24 | 25 | void read_or_throw( const std::string& s, Value& value ); 26 | void read_or_throw( std::istream& is, Value& value ); 27 | void read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ); 28 | 29 | #ifndef BOOST_NO_STD_WSTRING 30 | 31 | bool read( const std::wstring& s, wValue& value ); 32 | bool read( std::wistream& is, wValue& value ); 33 | bool read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ); 34 | 35 | void read_or_throw( const std::wstring& s, wValue& value ); 36 | void read_or_throw( std::wistream& is, wValue& value ); 37 | void read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ); 38 | 39 | #endif 40 | 41 | bool read( const std::string& s, mValue& value ); 42 | bool read( std::istream& is, mValue& value ); 43 | bool read( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ); 44 | 45 | void read_or_throw( const std::string& s, mValue& value ); 46 | void read_or_throw( std::istream& is, mValue& value ); 47 | void read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ); 48 | 49 | #ifndef BOOST_NO_STD_WSTRING 50 | 51 | bool read( const std::wstring& s, wmValue& value ); 52 | bool read( std::wistream& is, wmValue& value ); 53 | bool read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ); 54 | 55 | void read_or_throw( const std::wstring& s, wmValue& value ); 56 | void read_or_throw( std::wistream& is, wmValue& value ); 57 | void read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ); 58 | 59 | #endif 60 | } 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /backend/deps/json_spirit/json_spirit_stream_reader.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT_READ_STREAM 2 | #define JSON_SPIRIT_READ_STREAM 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_reader_template.h" 14 | 15 | namespace json_spirit 16 | { 17 | // these classes allows you to read multiple top level contiguous values from a stream, 18 | // the normal stream read functions have a bug that prevent multiple top level values 19 | // from being read unless they are separated by spaces 20 | 21 | template< class Istream_type, class Value_type > 22 | class Stream_reader 23 | { 24 | public: 25 | 26 | Stream_reader( Istream_type& is ) 27 | : iters_( is ) 28 | { 29 | } 30 | 31 | bool read_next( Value_type& value ) 32 | { 33 | return read_range( iters_.begin_, iters_.end_, value ); 34 | } 35 | 36 | private: 37 | 38 | typedef Multi_pass_iters< Istream_type > Mp_iters; 39 | 40 | Mp_iters iters_; 41 | }; 42 | 43 | template< class Istream_type, class Value_type > 44 | class Stream_reader_thrower 45 | { 46 | public: 47 | 48 | Stream_reader_thrower( Istream_type& is ) 49 | : iters_( is ) 50 | , posn_begin_( iters_.begin_, iters_.end_ ) 51 | , posn_end_( iters_.end_, iters_.end_ ) 52 | { 53 | } 54 | 55 | void read_next( Value_type& value ) 56 | { 57 | posn_begin_ = read_range_or_throw( posn_begin_, posn_end_, value ); 58 | } 59 | 60 | private: 61 | 62 | typedef Multi_pass_iters< Istream_type > Mp_iters; 63 | typedef spirit_namespace::position_iterator< typename Mp_iters::Mp_iter > Posn_iter_t; 64 | 65 | Mp_iters iters_; 66 | Posn_iter_t posn_begin_, posn_end_; 67 | }; 68 | } 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /backend/deps/json_spirit/json_spirit_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT_UTILS 2 | #define JSON_SPIRIT_UTILS 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_value.h" 14 | #include 15 | 16 | namespace json_spirit 17 | { 18 | template< class Obj_t, class Map_t > 19 | void obj_to_map( const Obj_t& obj, Map_t& mp_obj ) 20 | { 21 | mp_obj.clear(); 22 | 23 | for( typename Obj_t::const_iterator i = obj.begin(); i != obj.end(); ++i ) 24 | { 25 | mp_obj[ i->name_ ] = i->value_; 26 | } 27 | } 28 | 29 | template< class Obj_t, class Map_t > 30 | void map_to_obj( const Map_t& mp_obj, Obj_t& obj ) 31 | { 32 | obj.clear(); 33 | 34 | for( typename Map_t::const_iterator i = mp_obj.begin(); i != mp_obj.end(); ++i ) 35 | { 36 | obj.push_back( typename Obj_t::value_type( i->first, i->second ) ); 37 | } 38 | } 39 | 40 | typedef std::map< std::string, Value > Mapped_obj; 41 | 42 | #ifndef BOOST_NO_STD_WSTRING 43 | typedef std::map< std::wstring, wValue > wMapped_obj; 44 | #endif 45 | 46 | template< class Object_type, class String_type > 47 | const typename Object_type::value_type::Value_type& find_value( const Object_type& obj, const String_type& name ) 48 | { 49 | for( typename Object_type::const_iterator i = obj.begin(); i != obj.end(); ++i ) 50 | { 51 | if( i->name_ == name ) 52 | { 53 | return i->value_; 54 | } 55 | } 56 | 57 | return Object_type::value_type::Value_type::null; 58 | } 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /backend/deps/json_spirit/json_spirit_value.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 John W Wilkinson 2 | 3 | This source code can be used for any purpose as long as 4 | this comment is retained. */ 5 | 6 | // json spirit version 2.00 7 | 8 | #include "json_spirit_value.h" 9 | -------------------------------------------------------------------------------- /backend/deps/json_spirit/json_spirit_writer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright John W. Wilkinson 2007 - 2009. 2 | // Distributed under the MIT License, see accompanying file LICENSE.txt 3 | 4 | // json spirit version 4.03 5 | 6 | #include "json_spirit_writer.h" 7 | #include "json_spirit_writer_template.h" 8 | 9 | void json_spirit::write( const Value& value, std::ostream& os ) 10 | { 11 | write_stream( value, os, false ); 12 | } 13 | 14 | void json_spirit::write_formatted( const Value& value, std::ostream& os ) 15 | { 16 | write_stream( value, os, true ); 17 | } 18 | 19 | std::string json_spirit::write( const Value& value ) 20 | { 21 | return write_string( value, false ); 22 | } 23 | 24 | std::string json_spirit::write_formatted( const Value& value ) 25 | { 26 | return write_string( value, true ); 27 | } 28 | 29 | #ifndef BOOST_NO_STD_WSTRING 30 | 31 | void json_spirit::write( const wValue& value, std::wostream& os ) 32 | { 33 | write_stream( value, os, false ); 34 | } 35 | 36 | void json_spirit::write_formatted( const wValue& value, std::wostream& os ) 37 | { 38 | write_stream( value, os, true ); 39 | } 40 | 41 | std::wstring json_spirit::write( const wValue& value ) 42 | { 43 | return write_string( value, false ); 44 | } 45 | 46 | std::wstring json_spirit::write_formatted( const wValue& value ) 47 | { 48 | return write_string( value, true ); 49 | } 50 | 51 | #endif 52 | 53 | void json_spirit::write( const mValue& value, std::ostream& os ) 54 | { 55 | write_stream( value, os, false ); 56 | } 57 | 58 | void json_spirit::write_formatted( const mValue& value, std::ostream& os ) 59 | { 60 | write_stream( value, os, true ); 61 | } 62 | 63 | std::string json_spirit::write( const mValue& value ) 64 | { 65 | return write_string( value, false ); 66 | } 67 | 68 | std::string json_spirit::write_formatted( const mValue& value ) 69 | { 70 | return write_string( value, true ); 71 | } 72 | 73 | #ifndef BOOST_NO_STD_WSTRING 74 | 75 | void json_spirit::write( const wmValue& value, std::wostream& os ) 76 | { 77 | write_stream( value, os, false ); 78 | } 79 | 80 | void json_spirit::write_formatted( const wmValue& value, std::wostream& os ) 81 | { 82 | write_stream( value, os, true ); 83 | } 84 | 85 | std::wstring json_spirit::write( const wmValue& value ) 86 | { 87 | return write_string( value, false ); 88 | } 89 | 90 | std::wstring json_spirit::write_formatted( const wmValue& value ) 91 | { 92 | return write_string( value, true ); 93 | } 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /backend/deps/json_spirit/json_spirit_writer.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT_WRITER 2 | #define JSON_SPIRIT_WRITER 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_value.h" 14 | #include 15 | 16 | namespace json_spirit 17 | { 18 | // functions to convert JSON Values to text, 19 | // the "formatted" versions add whitespace to format the output nicely 20 | 21 | void write ( const Value& value, std::ostream& os ); 22 | void write_formatted( const Value& value, std::ostream& os ); 23 | std::string write ( const Value& value ); 24 | std::string write_formatted( const Value& value ); 25 | 26 | #ifndef BOOST_NO_STD_WSTRING 27 | 28 | void write ( const wValue& value, std::wostream& os ); 29 | void write_formatted( const wValue& value, std::wostream& os ); 30 | std::wstring write ( const wValue& value ); 31 | std::wstring write_formatted( const wValue& value ); 32 | 33 | #endif 34 | 35 | void write ( const mValue& value, std::ostream& os ); 36 | void write_formatted( const mValue& value, std::ostream& os ); 37 | std::string write ( const mValue& value ); 38 | std::string write_formatted( const mValue& value ); 39 | 40 | #ifndef BOOST_NO_STD_WSTRING 41 | 42 | void write ( const wmValue& value, std::wostream& os ); 43 | void write_formatted( const wmValue& value, std::wostream& os ); 44 | std::wstring write ( const wmValue& value ); 45 | std::wstring write_formatted( const wmValue& value ); 46 | 47 | #endif 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /backend/deps/winpcap/include/Win32-Extensions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) 3 | * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 3. Neither the name of the Politecnico di Torino, CACE Technologies 16 | * nor the names of its contributors may be used to endorse or promote 17 | * products derived from this software without specific prior written 18 | * permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | 34 | #ifndef __WIN32_EXTENSIONS_H__ 35 | #define __WIN32_EXTENSIONS_H__ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /* Definitions */ 42 | 43 | /*! 44 | \brief A queue of raw packets that will be sent to the network with pcap_sendqueue_transmit(). 45 | */ 46 | struct pcap_send_queue 47 | { 48 | u_int maxlen; ///< Maximum size of the the queue, in bytes. This variable contains the size of the buffer field. 49 | u_int len; ///< Current size of the queue, in bytes. 50 | char *buffer; ///< Buffer containing the packets to be sent. 51 | }; 52 | 53 | typedef struct pcap_send_queue pcap_send_queue; 54 | 55 | /*! 56 | \brief This typedef is a support for the pcap_get_airpcap_handle() function 57 | */ 58 | #if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_) 59 | #define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ 60 | typedef struct _AirpcapHandle *PAirpcapHandle; 61 | #endif 62 | 63 | #define BPF_MEM_EX_IMM 0xc0 64 | #define BPF_MEM_EX_IND 0xe0 65 | 66 | /*used for ST*/ 67 | #define BPF_MEM_EX 0xc0 68 | #define BPF_TME 0x08 69 | 70 | #define BPF_LOOKUP 0x90 71 | #define BPF_EXECUTE 0xa0 72 | #define BPF_INIT 0xb0 73 | #define BPF_VALIDATE 0xc0 74 | #define BPF_SET_ACTIVE 0xd0 75 | #define BPF_RESET 0xe0 76 | #define BPF_SET_MEMORY 0x80 77 | #define BPF_GET_REGISTER_VALUE 0x70 78 | #define BPF_SET_REGISTER_VALUE 0x60 79 | #define BPF_SET_WORKING 0x50 80 | #define BPF_SET_ACTIVE_READ 0x40 81 | #define BPF_SET_AUTODELETION 0x30 82 | #define BPF_SEPARATION 0xff 83 | 84 | /* Prototypes */ 85 | pcap_send_queue* pcap_sendqueue_alloc(u_int memsize); 86 | 87 | void pcap_sendqueue_destroy(pcap_send_queue* queue); 88 | 89 | int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data); 90 | 91 | u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync); 92 | 93 | HANDLE pcap_getevent(pcap_t *p); 94 | 95 | struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size); 96 | 97 | int pcap_setuserbuffer(pcap_t *p, int size); 98 | 99 | int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks); 100 | 101 | int pcap_live_dump_ended(pcap_t *p, int sync); 102 | 103 | int pcap_offline_filter(struct bpf_program *prog, const struct pcap_pkthdr *header, const u_char *pkt_data); 104 | 105 | int pcap_start_oem(char* err_str, int flags); 106 | 107 | PAirpcapHandle pcap_get_airpcap_handle(pcap_t *p); 108 | 109 | #ifdef __cplusplus 110 | } 111 | #endif 112 | 113 | #endif //__WIN32_EXTENSIONS_H__ 114 | -------------------------------------------------------------------------------- /backend/deps/winpcap/include/bittypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999 WIDE Project. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the project nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | */ 29 | #ifndef _BITTYPES_H 30 | #define _BITTYPES_H 31 | 32 | #ifndef HAVE_U_INT8_T 33 | 34 | #if SIZEOF_CHAR == 1 35 | typedef unsigned char u_int8_t; 36 | typedef signed char int8_t; 37 | #elif SIZEOF_INT == 1 38 | typedef unsigned int u_int8_t; 39 | typedef signed int int8_t; 40 | #else /* XXX */ 41 | #error "there's no appropriate type for u_int8_t" 42 | #endif 43 | #define HAVE_U_INT8_T 1 44 | #define HAVE_INT8_T 1 45 | 46 | #endif /* HAVE_U_INT8_T */ 47 | 48 | #ifndef HAVE_U_INT16_T 49 | 50 | #if SIZEOF_SHORT == 2 51 | typedef unsigned short u_int16_t; 52 | typedef signed short int16_t; 53 | #elif SIZEOF_INT == 2 54 | typedef unsigned int u_int16_t; 55 | typedef signed int int16_t; 56 | #elif SIZEOF_CHAR == 2 57 | typedef unsigned char u_int16_t; 58 | typedef signed char int16_t; 59 | #else /* XXX */ 60 | #error "there's no appropriate type for u_int16_t" 61 | #endif 62 | #define HAVE_U_INT16_T 1 63 | #define HAVE_INT16_T 1 64 | 65 | #endif /* HAVE_U_INT16_T */ 66 | 67 | #ifndef HAVE_U_INT32_T 68 | 69 | #if SIZEOF_INT == 4 70 | typedef unsigned int u_int32_t; 71 | typedef signed int int32_t; 72 | #elif SIZEOF_LONG == 4 73 | typedef unsigned long u_int32_t; 74 | typedef signed long int32_t; 75 | #elif SIZEOF_SHORT == 4 76 | typedef unsigned short u_int32_t; 77 | typedef signed short int32_t; 78 | #else /* XXX */ 79 | #error "there's no appropriate type for u_int32_t" 80 | #endif 81 | #define HAVE_U_INT32_T 1 82 | #define HAVE_INT32_T 1 83 | 84 | #endif /* HAVE_U_INT32_T */ 85 | 86 | #ifndef HAVE_U_INT64_T 87 | #if SIZEOF_LONG_LONG == 8 88 | typedef unsigned long long u_int64_t; 89 | typedef long long int64_t; 90 | #elif defined(_MSC_EXTENSIONS) 91 | typedef unsigned _int64 u_int64_t; 92 | typedef _int64 int64_t; 93 | #elif SIZEOF_INT == 8 94 | typedef unsigned int u_int64_t; 95 | #elif SIZEOF_LONG == 8 96 | typedef unsigned long u_int64_t; 97 | #elif SIZEOF_SHORT == 8 98 | typedef unsigned short u_int64_t; 99 | #else /* XXX */ 100 | #error "there's no appropriate type for u_int64_t" 101 | #endif 102 | 103 | #endif /* HAVE_U_INT64_T */ 104 | 105 | #ifndef PRId64 106 | #ifdef _MSC_EXTENSIONS 107 | #define PRId64 "I64d" 108 | #else /* _MSC_EXTENSIONS */ 109 | #define PRId64 "lld" 110 | #endif /* _MSC_EXTENSIONS */ 111 | #endif /* PRId64 */ 112 | 113 | #ifndef PRIo64 114 | #ifdef _MSC_EXTENSIONS 115 | #define PRIo64 "I64o" 116 | #else /* _MSC_EXTENSIONS */ 117 | #define PRIo64 "llo" 118 | #endif /* _MSC_EXTENSIONS */ 119 | #endif /* PRIo64 */ 120 | 121 | #ifndef PRIx64 122 | #ifdef _MSC_EXTENSIONS 123 | #define PRIx64 "I64x" 124 | #else /* _MSC_EXTENSIONS */ 125 | #define PRIx64 "llx" 126 | #endif /* _MSC_EXTENSIONS */ 127 | #endif /* PRIx64 */ 128 | 129 | #ifndef PRIu64 130 | #ifdef _MSC_EXTENSIONS 131 | #define PRIu64 "I64u" 132 | #else /* _MSC_EXTENSIONS */ 133 | #define PRIu64 "llu" 134 | #endif /* _MSC_EXTENSIONS */ 135 | #endif /* PRIu64 */ 136 | 137 | #endif /* _BITTYPES_H */ 138 | -------------------------------------------------------------------------------- /backend/deps/winpcap/include/ip6_misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1993, 1994, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that: (1) source code distributions 7 | * retain the above copyright notice and this paragraph in its entirety, (2) 8 | * distributions including binary code include the above copyright notice and 9 | * this paragraph in its entirety in the documentation or other materials 10 | * provided with the distribution, and (3) all advertising materials mentioning 11 | * features or use of this software display the following acknowledgement: 12 | * ``This product includes software developed by the University of California, 13 | * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 | * the University nor the names of its contributors may be used to endorse 15 | * or promote products derived from this software without specific prior 16 | * written permission. 17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 | * 21 | * @(#) $Header: /tcpdump/master/libpcap/Win32/Include/ip6_misc.h,v 1.5 2006-01-22 18:02:18 gianluca Exp $ (LBL) 22 | */ 23 | 24 | /* 25 | * This file contains a collage of declarations for IPv6 from FreeBSD not present in Windows 26 | */ 27 | 28 | #include 29 | 30 | #include 31 | 32 | #ifndef __MINGW32__ 33 | #define IN_MULTICAST(a) IN_CLASSD(a) 34 | #endif 35 | 36 | #define IN_EXPERIMENTAL(a) ((((u_int32_t) (a)) & 0xf0000000) == 0xf0000000) 37 | 38 | #define IN_LOOPBACKNET 127 39 | 40 | #if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) 41 | /* IPv6 address */ 42 | struct in6_addr 43 | { 44 | union 45 | { 46 | u_int8_t u6_addr8[16]; 47 | u_int16_t u6_addr16[8]; 48 | u_int32_t u6_addr32[4]; 49 | } in6_u; 50 | #define s6_addr in6_u.u6_addr8 51 | #define s6_addr16 in6_u.u6_addr16 52 | #define s6_addr32 in6_u.u6_addr32 53 | #define s6_addr64 in6_u.u6_addr64 54 | }; 55 | 56 | #define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } 57 | #define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } 58 | #endif /* __MINGW32__ */ 59 | 60 | 61 | #if (defined _MSC_VER) || (defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF)) 62 | typedef unsigned short sa_family_t; 63 | #endif 64 | 65 | 66 | #if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) 67 | 68 | #define __SOCKADDR_COMMON(sa_prefix) \ 69 | sa_family_t sa_prefix##family 70 | 71 | /* Ditto, for IPv6. */ 72 | struct sockaddr_in6 73 | { 74 | __SOCKADDR_COMMON (sin6_); 75 | u_int16_t sin6_port; /* Transport layer port # */ 76 | u_int32_t sin6_flowinfo; /* IPv6 flow information */ 77 | struct in6_addr sin6_addr; /* IPv6 address */ 78 | }; 79 | 80 | #define IN6_IS_ADDR_V4MAPPED(a) \ 81 | ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \ 82 | (((u_int32_t *) (a))[2] == htonl (0xffff))) 83 | 84 | #define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff) 85 | 86 | #define IN6_IS_ADDR_LINKLOCAL(a) \ 87 | ((((u_int32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000)) 88 | 89 | #define IN6_IS_ADDR_LOOPBACK(a) \ 90 | (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \ 91 | ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1)) 92 | #endif /* __MINGW32__ */ 93 | 94 | #define ip6_vfc ip6_ctlun.ip6_un2_vfc 95 | #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow 96 | #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen 97 | #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt 98 | #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim 99 | #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim 100 | 101 | #define nd_rd_type nd_rd_hdr.icmp6_type 102 | #define nd_rd_code nd_rd_hdr.icmp6_code 103 | #define nd_rd_cksum nd_rd_hdr.icmp6_cksum 104 | #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] 105 | 106 | /* 107 | * IPV6 extension headers 108 | */ 109 | #define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ 110 | #define IPPROTO_IPV6 41 /* IPv6 header. */ 111 | #define IPPROTO_ROUTING 43 /* IPv6 routing header */ 112 | #define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ 113 | #define IPPROTO_ESP 50 /* encapsulating security payload */ 114 | #define IPPROTO_AH 51 /* authentication header */ 115 | #define IPPROTO_ICMPV6 58 /* ICMPv6 */ 116 | #define IPPROTO_NONE 59 /* IPv6 no next header */ 117 | #define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ 118 | #define IPPROTO_PIM 103 /* Protocol Independent Multicast. */ 119 | 120 | #define IPV6_RTHDR_TYPE_0 0 121 | 122 | /* Option types and related macros */ 123 | #define IP6OPT_PAD1 0x00 /* 00 0 00000 */ 124 | #define IP6OPT_PADN 0x01 /* 00 0 00001 */ 125 | #define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ 126 | #define IP6OPT_JUMBO_LEN 6 127 | #define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */ 128 | 129 | #define IP6OPT_RTALERT_LEN 4 130 | #define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ 131 | #define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ 132 | #define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ 133 | #define IP6OPT_MINLEN 2 134 | 135 | #define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */ 136 | #define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */ 137 | #define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */ 138 | #define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ 139 | #define IP6OPT_EID 0x8a /* 10 0 01010 */ 140 | 141 | #define IP6OPT_TYPE(o) ((o) & 0xC0) 142 | #define IP6OPT_TYPE_SKIP 0x00 143 | #define IP6OPT_TYPE_DISCARD 0x40 144 | #define IP6OPT_TYPE_FORCEICMP 0x80 145 | #define IP6OPT_TYPE_ICMP 0xC0 146 | 147 | #define IP6OPT_MUTABLE 0x20 148 | 149 | 150 | #if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF) 151 | #ifndef EAI_ADDRFAMILY 152 | struct addrinfo { 153 | int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ 154 | int ai_family; /* PF_xxx */ 155 | int ai_socktype; /* SOCK_xxx */ 156 | int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ 157 | size_t ai_addrlen; /* length of ai_addr */ 158 | char *ai_canonname; /* canonical name for hostname */ 159 | struct sockaddr *ai_addr; /* binary address */ 160 | struct addrinfo *ai_next; /* next structure in linked list */ 161 | }; 162 | #endif 163 | #endif /* __MINGW32__ */ 164 | -------------------------------------------------------------------------------- /backend/deps/winpcap/include/pcap-bpf.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * This code is derived from the Stanford/CMU enet packet filter, 6 | * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7 | * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 8 | * Berkeley Laboratory. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 3. All advertising materials mentioning features or use of this software 19 | * must display the following acknowledgement: 20 | * This product includes software developed by the University of 21 | * California, Berkeley and its contributors. 22 | * 4. Neither the name of the University nor the names of its contributors 23 | * may be used to endorse or promote products derived from this software 24 | * without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 | * SUCH DAMAGE. 37 | * 38 | * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.50 2007/04/01 21:43:55 guy Exp $ (LBL) 39 | */ 40 | 41 | /* 42 | * For backwards compatibility. 43 | * 44 | * Note to OS vendors: do NOT get rid of this file! Some applications 45 | * might expect to be able to include . 46 | */ 47 | #include 48 | -------------------------------------------------------------------------------- /backend/deps/winpcap/include/pcap-namedb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1994, 1996 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by the Computer Systems 16 | * Engineering Group at Lawrence Berkeley Laboratory. 17 | * 4. Neither the name of the University nor of the Laboratory may be used 18 | * to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | * 33 | * @(#) $Header: /tcpdump/master/libpcap/pcap-namedb.h,v 1.13 2006/10/04 18:13:32 guy Exp $ (LBL) 34 | */ 35 | 36 | /* 37 | * For backwards compatibility. 38 | * 39 | * Note to OS vendors: do NOT get rid of this file! Some applications 40 | * might expect to be able to include . 41 | */ 42 | #include 43 | -------------------------------------------------------------------------------- /backend/deps/winpcap/include/pcap-stdinc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy) 3 | * Copyright (c) 2005 - 2009 CACE Technologies, Inc. Davis (California) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 3. Neither the name of the Politecnico di Torino nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * @(#) $Header: /tcpdump/master/libpcap/pcap-stdinc.h,v 1.10.2.1 2008-10-06 15:38:39 gianluca Exp $ (LBL) 32 | */ 33 | 34 | #define SIZEOF_CHAR 1 35 | #define SIZEOF_SHORT 2 36 | #define SIZEOF_INT 4 37 | #ifndef _MSC_EXTENSIONS 38 | #define SIZEOF_LONG_LONG 8 39 | #endif 40 | 41 | /* 42 | * Avoids a compiler warning in case this was already defined 43 | * (someone defined _WINSOCKAPI_ when including 'windows.h', in order 44 | * to prevent it from including 'winsock.h') 45 | */ 46 | #ifdef _WINSOCKAPI_ 47 | #undef _WINSOCKAPI_ 48 | #endif 49 | #include 50 | 51 | #include 52 | 53 | #include "bittypes.h" 54 | #include 55 | #include 56 | 57 | #ifndef __MINGW32__ 58 | #include "IP6_misc.h" 59 | #endif 60 | 61 | #define caddr_t char* 62 | 63 | #if _MSC_VER < 1500 64 | #define snprintf _snprintf 65 | #define vsnprintf _vsnprintf 66 | #define strdup _strdup 67 | #endif 68 | 69 | #define inline __inline 70 | 71 | #ifdef __MINGW32__ 72 | #include 73 | #else /*__MINGW32__*/ 74 | /* MSVC compiler */ 75 | #ifndef _UINTPTR_T_DEFINED 76 | #ifdef _WIN64 77 | typedef unsigned __int64 uintptr_t; 78 | #else 79 | typedef _W64 unsigned int uintptr_t; 80 | #endif 81 | #define _UINTPTR_T_DEFINED 82 | #endif 83 | 84 | #ifndef _INTPTR_T_DEFINED 85 | #ifdef _WIN64 86 | typedef __int64 intptr_t; 87 | #else 88 | typedef _W64 int intptr_t; 89 | #endif 90 | #define _INTPTR_T_DEFINED 91 | #endif 92 | 93 | #endif /*__MINGW32__*/ 94 | -------------------------------------------------------------------------------- /backend/deps/winpcap/include/pcap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1993, 1994, 1995, 1996, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by the Computer Systems 16 | * Engineering Group at Lawrence Berkeley Laboratory. 17 | * 4. Neither the name of the University nor of the Laboratory may be used 18 | * to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | * 33 | * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.59 2006/10/04 18:09:22 guy Exp $ (LBL) 34 | */ 35 | 36 | /* 37 | * For backwards compatibility. 38 | * 39 | * Note to OS vendors: do NOT get rid of this file! Many applications 40 | * expect to be able to include , and at least some of them 41 | * go through contortions in their configure scripts to try to detect 42 | * OSes that have "helpfully" moved pcap.h to without 43 | * leaving behind a file. 44 | */ 45 | #include 46 | -------------------------------------------------------------------------------- /backend/deps/winpcap/include/pcap/bluetooth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Paolo Abeni (Italy) 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote 15 | * products derived from this software without specific prior written 16 | * permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * bluetooth data struct 31 | * By Paolo Abeni 32 | * 33 | * @(#) $Header: /tcpdump/master/libpcap/pcap/bluetooth.h,v 1.1 2007/09/22 02:10:17 guy Exp $ 34 | */ 35 | 36 | #ifndef _PCAP_BLUETOOTH_STRUCTS_H__ 37 | #define _PCAP_BLUETOOTH_STRUCTS_H__ 38 | 39 | /* 40 | * Header prepended libpcap to each bluetooth h:4 frame. 41 | * fields are in network byte order 42 | */ 43 | typedef struct _pcap_bluetooth_h4_header { 44 | u_int32_t direction; /* if first bit is set direction is incoming */ 45 | } pcap_bluetooth_h4_header; 46 | 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /backend/deps/winpcap/include/pcap/namedb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1994, 1996 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by the Computer Systems 16 | * Engineering Group at Lawrence Berkeley Laboratory. 17 | * 4. Neither the name of the University nor of the Laboratory may be used 18 | * to endorse or promote products derived from this software without 19 | * specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | * 33 | * @(#) $Header: /tcpdump/master/libpcap/pcap/namedb.h,v 1.1 2006/10/04 18:09:22 guy Exp $ (LBL) 34 | */ 35 | 36 | #ifndef lib_pcap_namedb_h 37 | #define lib_pcap_namedb_h 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | /* 44 | * As returned by the pcap_next_etherent() 45 | * XXX this stuff doesn't belong in this interface, but this 46 | * library already must do name to address translation, so 47 | * on systems that don't have support for /etc/ethers, we 48 | * export these hooks since they'll 49 | */ 50 | struct pcap_etherent { 51 | u_char addr[6]; 52 | char name[122]; 53 | }; 54 | #ifndef PCAP_ETHERS_FILE 55 | #define PCAP_ETHERS_FILE "/etc/ethers" 56 | #endif 57 | struct pcap_etherent *pcap_next_etherent(FILE *); 58 | u_char *pcap_ether_hostton(const char*); 59 | u_char *pcap_ether_aton(const char *); 60 | 61 | bpf_u_int32 **pcap_nametoaddr(const char *); 62 | #ifdef INET6 63 | struct addrinfo *pcap_nametoaddrinfo(const char *); 64 | #endif 65 | bpf_u_int32 pcap_nametonetaddr(const char *); 66 | 67 | int pcap_nametoport(const char *, int *, int *); 68 | int pcap_nametoportrange(const char *, int *, int *, int *); 69 | int pcap_nametoproto(const char *); 70 | int pcap_nametoeproto(const char *); 71 | int pcap_nametollc(const char *); 72 | /* 73 | * If a protocol is unknown, PROTO_UNDEF is returned. 74 | * Also, pcap_nametoport() returns the protocol along with the port number. 75 | * If there are ambiguous entried in /etc/services (i.e. domain 76 | * can be either tcp or udp) PROTO_UNDEF is returned. 77 | */ 78 | #define PROTO_UNDEF -1 79 | 80 | /* XXX move these to pcap-int.h? */ 81 | int __pcap_atodn(const char *, bpf_u_int32 *); 82 | int __pcap_atoin(const char *, bpf_u_int32 *); 83 | u_short __pcap_nametodnaddr(const char *); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /backend/deps/winpcap/include/pcap/sll.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * This code is derived from the Stanford/CMU enet packet filter, 6 | * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7 | * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 8 | * Berkeley Laboratory. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 3. All advertising materials mentioning features or use of this software 19 | * must display the following acknowledgement: 20 | * This product includes software developed by the University of 21 | * California, Berkeley and its contributors. 22 | * 4. Neither the name of the University nor the names of its contributors 23 | * may be used to endorse or promote products derived from this software 24 | * without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 | * SUCH DAMAGE. 37 | * 38 | * @(#) $Header: /tcpdump/master/libpcap/pcap/sll.h,v 1.2.2.1 2008-05-30 01:36:06 guy Exp $ (LBL) 39 | */ 40 | 41 | /* 42 | * For captures on Linux cooked sockets, we construct a fake header 43 | * that includes: 44 | * 45 | * a 2-byte "packet type" which is one of: 46 | * 47 | * LINUX_SLL_HOST packet was sent to us 48 | * LINUX_SLL_BROADCAST packet was broadcast 49 | * LINUX_SLL_MULTICAST packet was multicast 50 | * LINUX_SLL_OTHERHOST packet was sent to somebody else 51 | * LINUX_SLL_OUTGOING packet was sent *by* us; 52 | * 53 | * a 2-byte Ethernet protocol field; 54 | * 55 | * a 2-byte link-layer type; 56 | * 57 | * a 2-byte link-layer address length; 58 | * 59 | * an 8-byte source link-layer address, whose actual length is 60 | * specified by the previous value. 61 | * 62 | * All fields except for the link-layer address are in network byte order. 63 | * 64 | * DO NOT change the layout of this structure, or change any of the 65 | * LINUX_SLL_ values below. If you must change the link-layer header 66 | * for a "cooked" Linux capture, introduce a new DLT_ type (ask 67 | * "tcpdump-workers@lists.tcpdump.org" for one, so that you don't give it 68 | * a value that collides with a value already being used), and use the 69 | * new header in captures of that type, so that programs that can 70 | * handle DLT_LINUX_SLL captures will continue to handle them correctly 71 | * without any change, and so that capture files with different headers 72 | * can be told apart and programs that read them can dissect the 73 | * packets in them. 74 | */ 75 | 76 | #ifndef lib_pcap_sll_h 77 | #define lib_pcap_sll_h 78 | 79 | /* 80 | * A DLT_LINUX_SLL fake link-layer header. 81 | */ 82 | #define SLL_HDR_LEN 16 /* total header length */ 83 | #define SLL_ADDRLEN 8 /* length of address field */ 84 | 85 | struct sll_header { 86 | u_int16_t sll_pkttype; /* packet type */ 87 | u_int16_t sll_hatype; /* link-layer address type */ 88 | u_int16_t sll_halen; /* link-layer address length */ 89 | u_int8_t sll_addr[SLL_ADDRLEN]; /* link-layer address */ 90 | u_int16_t sll_protocol; /* protocol */ 91 | }; 92 | 93 | /* 94 | * The LINUX_SLL_ values for "sll_pkttype"; these correspond to the 95 | * PACKET_ values on Linux, but are defined here so that they're 96 | * available even on systems other than Linux, and so that they 97 | * don't change even if the PACKET_ values change. 98 | */ 99 | #define LINUX_SLL_HOST 0 100 | #define LINUX_SLL_BROADCAST 1 101 | #define LINUX_SLL_MULTICAST 2 102 | #define LINUX_SLL_OTHERHOST 3 103 | #define LINUX_SLL_OUTGOING 4 104 | 105 | /* 106 | * The LINUX_SLL_ values for "sll_protocol"; these correspond to the 107 | * ETH_P_ values on Linux, but are defined here so that they're 108 | * available even on systems other than Linux. We assume, for now, 109 | * that the ETH_P_ values won't change in Linux; if they do, then: 110 | * 111 | * if we don't translate them in "pcap-linux.c", capture files 112 | * won't necessarily be readable if captured on a system that 113 | * defines ETH_P_ values that don't match these values; 114 | * 115 | * if we do translate them in "pcap-linux.c", that makes life 116 | * unpleasant for the BPF code generator, as the values you test 117 | * for in the kernel aren't the values that you test for when 118 | * reading a capture file, so the fixup code run on BPF programs 119 | * handed to the kernel ends up having to do more work. 120 | * 121 | * Add other values here as necessary, for handling packet types that 122 | * might show up on non-Ethernet, non-802.x networks. (Not all the ones 123 | * in the Linux "if_ether.h" will, I suspect, actually show up in 124 | * captures.) 125 | */ 126 | #define LINUX_SLL_P_802_3 0x0001 /* Novell 802.3 frames without 802.2 LLC header */ 127 | #define LINUX_SLL_P_802_2 0x0004 /* 802.2 frames (not D/I/X Ethernet) */ 128 | 129 | #endif 130 | -------------------------------------------------------------------------------- /backend/deps/winpcap/include/pcap/usb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Paolo Abeni (Italy) 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote 15 | * products derived from this software without specific prior written 16 | * permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * Basic USB data struct 31 | * By Paolo Abeni 32 | * 33 | * @(#) $Header: /tcpdump/master/libpcap/pcap/usb.h,v 1.6 2007/09/22 02:06:08 guy Exp $ 34 | */ 35 | 36 | #ifndef _PCAP_USB_STRUCTS_H__ 37 | #define _PCAP_USB_STRUCTS_H__ 38 | 39 | /* 40 | * possible transfer mode 41 | */ 42 | #define URB_TRANSFER_IN 0x80 43 | #define URB_ISOCHRONOUS 0x0 44 | #define URB_INTERRUPT 0x1 45 | #define URB_CONTROL 0x2 46 | #define URB_BULK 0x3 47 | 48 | /* 49 | * possible event type 50 | */ 51 | #define URB_SUBMIT 'S' 52 | #define URB_COMPLETE 'C' 53 | #define URB_ERROR 'E' 54 | 55 | /* 56 | * USB setup header as defined in USB specification. 57 | * Appears at the front of each packet in DLT_USB captures. 58 | */ 59 | typedef struct _usb_setup { 60 | u_int8_t bmRequestType; 61 | u_int8_t bRequest; 62 | u_int16_t wValue; 63 | u_int16_t wIndex; 64 | u_int16_t wLength; 65 | } pcap_usb_setup; 66 | 67 | 68 | /* 69 | * Header prepended by linux kernel to each event. 70 | * Appears at the front of each packet in DLT_USB_LINUX captures. 71 | */ 72 | typedef struct _usb_header { 73 | u_int64_t id; 74 | u_int8_t event_type; 75 | u_int8_t transfer_type; 76 | u_int8_t endpoint_number; 77 | u_int8_t device_address; 78 | u_int16_t bus_id; 79 | char setup_flag;/*if !=0 the urb setup header is not present*/ 80 | char data_flag; /*if !=0 no urb data is present*/ 81 | int64_t ts_sec; 82 | int32_t ts_usec; 83 | int32_t status; 84 | u_int32_t urb_len; 85 | u_int32_t data_len; /* amount of urb data really present in this event*/ 86 | pcap_usb_setup setup; 87 | } pcap_usb_header; 88 | 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /backend/deps/winpcap/include/pcap/vlan.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by the University of 16 | * California, Berkeley and its contributors. 17 | * 4. Neither the name of the University nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | * 33 | * @(#) $Header: /tcpdump/master/libpcap/pcap/vlan.h,v 1.1.2.2 2008-08-06 07:45:59 guy Exp $ 34 | */ 35 | 36 | #ifndef lib_pcap_vlan_h 37 | #define lib_pcap_vlan_h 38 | 39 | struct vlan_tag { 40 | u_int16_t vlan_tpid; /* ETH_P_8021Q */ 41 | u_int16_t vlan_tci; /* VLAN TCI */ 42 | }; 43 | 44 | #define VLAN_TAG_LEN 4 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /backend/deps/winpcap/lib/Packet.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/firesheep/cbc05797309431b5e4acad604550fa665d49bb67/backend/deps/winpcap/lib/Packet.dll -------------------------------------------------------------------------------- /backend/deps/winpcap/lib/wpcap.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codebutler/firesheep/cbc05797309431b5e4acad604550fa665d49bb67/backend/deps/winpcap/lib/wpcap.dll -------------------------------------------------------------------------------- /backend/src/abstract_platform.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // abstract_platform.h: Functions for unix-like platforms. 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | #ifndef FIRESHEEP_ABSTRACT_PLATFORM_H 24 | #define FIRESHEEP_ABSTRACT_PLATFORM_H 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | #include "interface_info.hpp" 34 | 35 | using namespace std; 36 | 37 | class AbstractPlatform 38 | { 39 | public: 40 | virtual bool is_root() = 0; 41 | virtual bool check_permissions() = 0; 42 | virtual void fix_permissions() = 0; 43 | virtual bool run_privileged() = 0; 44 | virtual vector interfaces() = 0; 45 | 46 | virtual InterfaceInfo primary_interface() 47 | { 48 | return InterfaceInfo(); 49 | } 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /backend/src/config.h: -------------------------------------------------------------------------------- 1 | // 2 | // config.h 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | #ifndef FIRESHEEP_CONFIG_H 24 | #define FIRESHEEP_CONFIG_H 25 | 26 | #define WS_VAR_IMPORT extern 27 | 28 | #endif -------------------------------------------------------------------------------- /backend/src/firesheep_platform.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // firesheep_platform.hpp 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | #include "abstract_platform.hpp" 24 | 25 | #ifdef PLATFORM_WIN32 26 | #include "windows_platform.hpp" 27 | #define PLATFORM WindowsPlatform 28 | #elif PLATFORM_OSX 29 | #include "osx_platform.hpp" 30 | #define PLATFORM OSXPlatform 31 | #elif PLATFORM_LINUX 32 | #include "linux_platform.hpp" 33 | #define PLATFORM LinuxPlatform 34 | #else 35 | #error "no suitable platform" 36 | #endif 37 | -------------------------------------------------------------------------------- /backend/src/http_packet.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // http_packet.cpp - C++ wrapper for http header parser. 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | #include "http_packet.hpp" 24 | 25 | HttpPacket::HttpPacket(string from, string to) 26 | : m_from(from), m_to(to), m_complete(false) 27 | { 28 | memset(&m_settings, 0, sizeof(m_settings)); 29 | m_settings.on_header_field = header_field_cb_wrapper; 30 | m_settings.on_header_value = header_value_cb_wrapper; 31 | m_settings.on_path = path_cb_wrapper; 32 | m_settings.on_query_string = query_string_cb_wrapper; 33 | m_settings.on_headers_complete = headers_complete_cb_wrapper; 34 | m_settings.on_message_complete = message_complete_cb_wrapper; 35 | 36 | http_parser_init(&m_parser, HTTP_REQUEST); 37 | m_parser.data = this; 38 | } 39 | 40 | bool HttpPacket::parse(const char *payload, int payload_size) 41 | { 42 | if (payload_size > 0) { 43 | int len = http_parser_execute(&m_parser, &m_settings, payload, payload_size); 44 | return (m_parser.state != 1 && len == payload_size); 45 | } 46 | return false; 47 | } 48 | 49 | bool HttpPacket::isComplete() 50 | { 51 | return m_complete; 52 | } 53 | 54 | string HttpPacket::from() 55 | { 56 | return m_from; 57 | } 58 | 59 | string HttpPacket::to() 60 | { 61 | return m_to; 62 | } 63 | 64 | string HttpPacket::host() 65 | { 66 | return get_header("host"); 67 | } 68 | 69 | string HttpPacket::method() 70 | { 71 | return http_method_str((enum http_method) m_parser.method); 72 | } 73 | 74 | string HttpPacket::path() 75 | { 76 | return m_path; 77 | } 78 | 79 | string HttpPacket::query() 80 | { 81 | return m_query; 82 | } 83 | 84 | string HttpPacket::user_agent() 85 | { 86 | return get_header("user-agent"); 87 | } 88 | 89 | string HttpPacket::cookies() 90 | { 91 | return get_header("cookie"); 92 | } 93 | 94 | HeaderMap HttpPacket::headers() 95 | { 96 | return m_headers; 97 | } 98 | 99 | void HttpPacket::add_header(string name, string value) 100 | { 101 | HeaderMap::iterator iter; 102 | iter = m_headers.find(name); 103 | if (iter == m_headers.end()) { 104 | m_headers[name] = value; 105 | } else { 106 | // FIXME: Technically this is allowed in certain situations, but I doubt 107 | // any browsers would do this. 108 | // http://github.com/ry/node/blob/master/lib/http.js#L219 109 | cerr << "Ignoring duplicate header: " << name << endl; 110 | cerr << " Old: " << m_headers[name] << endl; 111 | cerr << " New: " << value << endl; 112 | } 113 | } 114 | 115 | string HttpPacket::get_header(string name) 116 | { 117 | HeaderMap::iterator iter; 118 | iter = m_headers.find(name); 119 | if (iter != m_headers.end()) 120 | return iter->second; 121 | else 122 | return string(); 123 | } 124 | 125 | int HttpPacket::path_cb(const char *buf, size_t len) 126 | { 127 | m_path.append(buf, len); 128 | return 0; 129 | } 130 | 131 | int HttpPacket::query_string_cb(const char *buf, size_t len) 132 | { 133 | m_query.append(buf, len); 134 | return 0; 135 | } 136 | 137 | int HttpPacket::header_field_cb(const char *buf, size_t len) 138 | { 139 | string str(buf, len); 140 | boost::to_lower(str); 141 | 142 | if (!m_tmp_header_value.empty()) { 143 | add_header(m_tmp_header_name, m_tmp_header_value); 144 | m_tmp_header_name.clear(); 145 | m_tmp_header_value.clear(); 146 | } 147 | 148 | m_tmp_header_name.append(str); 149 | 150 | return 0; 151 | } 152 | 153 | int HttpPacket::header_value_cb(const char *buf, size_t len) 154 | { 155 | m_tmp_header_value.append(buf, len); 156 | return 0; 157 | } 158 | 159 | int HttpPacket::headers_complete_cb() 160 | { 161 | if (!m_tmp_header_value.empty()) { 162 | add_header(m_tmp_header_name, m_tmp_header_value); 163 | m_tmp_header_name.clear(); 164 | m_tmp_header_value.clear(); 165 | } 166 | return 1; // Skip body 167 | } 168 | 169 | int HttpPacket::message_complete_cb() 170 | { 171 | m_complete = true; 172 | return 0; 173 | } 174 | -------------------------------------------------------------------------------- /backend/src/http_packet.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // http_packet.h - C++ wrapper for http header parser. 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | #ifndef FIRESHEEP_HTTP_PACKET_H 24 | #define FIRESHEEP_HTTP_PACKET_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include "http-parser/http_parser.h" 32 | 33 | using namespace std; 34 | 35 | #define HTTP_PARSER_DATA_CALLBACK(NAME) \ 36 | static int NAME##_cb_wrapper (http_parser *parser, const char *buf, size_t len) { \ 37 | HttpPacket *packet = (HttpPacket *)parser; \ 38 | return packet->NAME##_cb(buf, len); \ 39 | } \ 40 | int NAME##_cb(const char *buf, size_t len); 41 | 42 | #define HTTP_PARSER_CALLBACK(NAME) \ 43 | static int NAME##_cb_wrapper (http_parser *parser) { \ 44 | HttpPacket *packet = (HttpPacket *)parser; \ 45 | return packet->NAME##_cb(); \ 46 | } \ 47 | int NAME##_cb(); 48 | 49 | typedef map HeaderMap; 50 | 51 | class HttpPacket { 52 | public: 53 | HttpPacket(string from, string to); 54 | bool parse(const char *payload, int payload_size); 55 | 56 | bool isComplete(); 57 | 58 | string from(); 59 | string to(); 60 | string host(); 61 | string method(); 62 | string path(); 63 | string user_agent(); 64 | string query(); 65 | string cookies(); 66 | 67 | HeaderMap headers(); 68 | 69 | private: 70 | http_parser m_parser; 71 | http_parser_settings m_settings; 72 | string m_from; 73 | string m_to; 74 | string m_url; 75 | string m_path; 76 | string m_query; 77 | HeaderMap m_headers; 78 | string m_tmp_header_name; 79 | string m_tmp_header_value; 80 | bool m_complete; 81 | 82 | HTTP_PARSER_DATA_CALLBACK(url); 83 | HTTP_PARSER_DATA_CALLBACK(header_field); 84 | HTTP_PARSER_DATA_CALLBACK(header_value); 85 | HTTP_PARSER_DATA_CALLBACK(path); 86 | HTTP_PARSER_DATA_CALLBACK(query_string); 87 | HTTP_PARSER_CALLBACK(headers_complete); 88 | HTTP_PARSER_CALLBACK(message_complete); 89 | 90 | void add_header(string name, string value); 91 | string get_header(string name); 92 | }; 93 | 94 | typedef void (*http_packet_cb) (HttpPacket*); 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /backend/src/http_sniffer.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // http_sniffer.h 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // Nick kossifidis 10 | // 11 | // This program is free software: you can redistribute it and/or modify 12 | // it under the terms of the GNU General Public License as published by 13 | // the Free Software Foundation, either version 3 of the License, or 14 | // (at your option) any later version. 15 | // 16 | // This program is distributed in the hope that it will be useful, 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU General Public License 22 | // along with this program. If not, see . 23 | 24 | #ifndef FIRESHEEP_HTTP_SNIFFER_H 25 | #define FIRESHEEP_HTTP_SNIFFER_H 26 | 27 | #include 28 | #include 29 | #include "http_packet.hpp" 30 | 31 | using namespace std; 32 | 33 | typedef map PacketCacheMap; 34 | 35 | class HttpSniffer 36 | { 37 | public: 38 | HttpSniffer (string iface, string filter, http_packet_cb callback); 39 | void start(); 40 | 41 | protected: 42 | string m_iface; 43 | string m_filter; 44 | http_packet_cb m_callback; 45 | bool m_wifimon; 46 | 47 | static void got_packet_wrapper(u_char *user, const struct pcap_pkthdr *header, const u_char *packet) { 48 | HttpSniffer *sniffer = (HttpSniffer *) user; 49 | sniffer->got_packet(header, packet); 50 | } 51 | 52 | private: 53 | PacketCacheMap m_pending_packets; 54 | void got_packet(const struct pcap_pkthdr *header, const u_char *packet); 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /backend/src/interface_info.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // interface_info.hpp: Information about a network interface. 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | #ifndef FIRESHEEP_INTERFACE_INFO_H 24 | #define FIRESHEEP_INTERFACE_INFO_H 25 | 26 | #include 27 | #include 28 | 29 | using namespace std; 30 | 31 | class InterfaceInfo 32 | { 33 | public: 34 | InterfaceInfo(string id, string name, string type) 35 | : m_id(id), m_name(name), m_type(type) 36 | { 37 | boost::to_lower(m_type); 38 | } 39 | 40 | InterfaceInfo() 41 | : m_id(""), m_name(""), m_type("") 42 | { 43 | } 44 | 45 | InterfaceInfo(const InterfaceInfo &other) 46 | : m_id(other.m_id), m_name(other.m_name), m_type(other.m_type) 47 | { 48 | } 49 | 50 | string id() { 51 | return m_id; 52 | } 53 | 54 | string name() { 55 | return m_name; 56 | } 57 | 58 | string type() { 59 | return m_type; 60 | } 61 | 62 | private: 63 | string m_id; 64 | string m_name; 65 | string m_type; 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /backend/src/libfiresheep.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // libfiresheep.cpp 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2011 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | #include "firesheep_platform.hpp" 24 | #include "json_spirit_writer_template.h" 25 | 26 | 27 | // Local utilities 28 | static json_spirit::Object interfaces_obj(vector &interfaces); 29 | static json_spirit::Object iface_obj(InterfaceInfo &iface); 30 | static char *encoded_value(json_spirit::Value value); 31 | 32 | 33 | // C API for jsctypes. 34 | extern "C" { 35 | char* list_interfaces(const char** error) { 36 | try { 37 | PLATFORM platform(""); 38 | char *encoded = NULL; 39 | 40 | vector interfaces = platform.interfaces(); 41 | json_spirit::Object data_obj = interfaces_obj(interfaces); 42 | encoded = encoded_value(json_spirit::Value(data_obj)); 43 | 44 | return encoded; 45 | } catch (std::exception const &e) { 46 | *error = strdup(e.what()); 47 | return NULL; 48 | } 49 | } 50 | 51 | char *primary_interface(const char **error) { 52 | try { 53 | PLATFORM platform(""); 54 | json_spirit::Value value; 55 | char *encoded = NULL; 56 | 57 | InterfaceInfo iface = platform.primary_interface(); 58 | if (!iface.id().empty()) 59 | value = json_spirit::Value(iface_obj(iface)); 60 | else 61 | value = json_spirit::Value(); 62 | 63 | encoded = encoded_value(value); 64 | 65 | return encoded; 66 | } catch (std::exception const &e) { 67 | *error = strdup(e.what()); 68 | return NULL; 69 | } 70 | } 71 | 72 | int run_privileged(const char *backend_path, const char **error) { 73 | try { 74 | PLATFORM platform(backend_path); 75 | if (!platform.check_permissions()) { 76 | return platform.run_privileged(); 77 | } 78 | return true; 79 | } catch (std::exception const &e) { 80 | *error = strdup(e.what()); 81 | return false; 82 | } 83 | } 84 | } 85 | 86 | 87 | static json_spirit::Object interfaces_obj(vector &interfaces) 88 | { 89 | vector::iterator iter; 90 | json_spirit::Object data_obj; 91 | 92 | for (iter = interfaces.begin(); iter != interfaces.end(); ++iter) { 93 | InterfaceInfo iface = *iter; 94 | json_spirit::Object iface_obj; 95 | iface_obj.push_back(json_spirit::Pair("name", iface.name())); 96 | iface_obj.push_back(json_spirit::Pair("type", iface.type())); 97 | data_obj.push_back(json_spirit::Pair(iface.id(), iface_obj)); 98 | } 99 | 100 | return data_obj; 101 | } 102 | 103 | 104 | static json_spirit::Object iface_obj(InterfaceInfo &iface) 105 | { 106 | json_spirit::Object iface_obj; 107 | 108 | iface_obj.push_back(json_spirit::Pair("id", iface.id())); 109 | iface_obj.push_back(json_spirit::Pair("name", iface.name())); 110 | iface_obj.push_back(json_spirit::Pair("type", iface.type())); 111 | 112 | return iface_obj; 113 | } 114 | 115 | 116 | static char *encoded_value(json_spirit::Value value) 117 | { 118 | string str; 119 | char *cstr = NULL; 120 | 121 | str = json_spirit::write_string(value, false); 122 | 123 | cstr = new char [str.size() + 1]; 124 | strcpy(cstr, str.c_str()); 125 | 126 | return cstr; 127 | } 128 | -------------------------------------------------------------------------------- /backend/src/linux_platform.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // linux_platform.cpp: Linux functions 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Michajlo Matijkiw 9 | // Nick Kossifidis 10 | // Eric Butler 11 | // 12 | // This program is free software: you can redistribute it and/or modify 13 | // it under the terms of the GNU General Public License as published by 14 | // the Free Software Foundation, either version 3 of the License, or 15 | // (at your option) any later version. 16 | // 17 | // This program is distributed in the hope that it will be useful, 18 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU General Public License 23 | // along with this program. If not, see . 24 | 25 | #include 26 | #include 27 | #include 28 | #include "linux_platform.hpp" 29 | #include 30 | #include 31 | #include 32 | 33 | using namespace std; 34 | using namespace boost; 35 | 36 | LinuxPlatform::LinuxPlatform(string path) : UnixPlatform(path) { } 37 | 38 | bool LinuxPlatform::run_privileged() 39 | { 40 | string cmd = string("/usr/bin/pkexec "); 41 | cmd += this->path(); 42 | cmd += " --fix-permissions"; 43 | 44 | int ret = system(cmd.c_str()); 45 | return (ret == 0); 46 | } 47 | 48 | vector LinuxPlatform::interfaces() 49 | { 50 | vector result; 51 | 52 | struct udev *udev; 53 | struct udev_enumerate *enumerate; 54 | struct udev_list_entry *devices, *dev_list_entry; 55 | struct udev_device *dev; 56 | 57 | udev = udev_new(); 58 | 59 | if (!udev) 60 | throw runtime_error("udev_new() failed"); 61 | 62 | enumerate = udev_enumerate_new(udev); 63 | udev_enumerate_add_match_subsystem(enumerate, "net"); 64 | udev_enumerate_scan_devices(enumerate); 65 | devices = udev_enumerate_get_list_entry(enumerate); 66 | 67 | udev_list_entry_foreach(dev_list_entry, devices) { 68 | const char *path; 69 | const char *utype; 70 | path = udev_list_entry_get_name(dev_list_entry); 71 | dev = udev_device_new_from_syspath(udev, path); 72 | 73 | string iface(udev_device_get_sysname(dev)); 74 | string type = "ethernet"; 75 | string vendor = ""; 76 | string product = iface == "lo" ? "Loopback" : "Unknown"; 77 | 78 | utype = udev_device_get_devtype(dev); 79 | 80 | if (!utype) 81 | type = "ethernet"; 82 | else if (!strncmp(utype, "wlan", strlen(utype))) 83 | type = "ieee80211"; 84 | 85 | struct udev_list_entry *list_entry; 86 | udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(dev)) { 87 | const char *key = udev_list_entry_get_name(list_entry); 88 | if (!strncmp(key, "ID_MODEL_FROM_DATABASE", strlen(key))) 89 | product = udev_list_entry_get_value(list_entry); 90 | if (!strncmp(key, "ID_VENDOR_FROM_DATABASE", strlen(key))) 91 | vendor = udev_list_entry_get_value(list_entry); 92 | } 93 | 94 | string description(str(format("%s %s") % vendor % product)); 95 | InterfaceInfo info(iface, description, type); 96 | result.push_back(info); 97 | 98 | udev_device_unref(dev); 99 | } 100 | udev_enumerate_unref(enumerate); 101 | udev_unref(udev); 102 | 103 | return result; 104 | } 105 | 106 | -------------------------------------------------------------------------------- /backend/src/linux_platform.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // linux_platform.h: Linux functions 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Michajlo Matijkiw 9 | // Eric Butler 10 | // 11 | // This program is free software: you can redistribute it and/or modify 12 | // it under the terms of the GNU General Public License as published by 13 | // the Free Software Foundation, either version 3 of the License, or 14 | // (at your option) any later version. 15 | // 16 | // This program is distributed in the hope that it will be useful, 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU General Public License 22 | // along with this program. If not, see . 23 | 24 | #ifndef FIRESHEEP_LINUX_PLATFORM_H 25 | #define FIRESHEEP_LINUX_PLATFORM_H 26 | 27 | #include "unix_platform.hpp" 28 | #include "interface_info.hpp" 29 | 30 | class LinuxPlatform : public UnixPlatform { 31 | public: 32 | LinuxPlatform(string); 33 | bool run_privileged(); 34 | vector interfaces(); 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /backend/src/main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // main.cpp 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | #include 24 | 25 | #include "http_sniffer.hpp" 26 | #include "http_packet.hpp" 27 | #include "json_spirit_writer_template.h" 28 | #include "firesheep_platform.hpp" 29 | 30 | void received_packet(HttpPacket *packet); 31 | 32 | int main(int argc, const char *argv[]) 33 | { 34 | try { 35 | vectorsargv(argv, argv + argc); 36 | 37 | PLATFORM platform(sargv[0]); 38 | 39 | if (argc > 1) { 40 | if (argv[1] == string("--fix-permissions")) { 41 | if (!platform.is_root()) { 42 | cerr << "Must be run as root." << endl; 43 | return EXIT_FAILURE; 44 | } 45 | if (!platform.check_permissions()) { 46 | platform.fix_permissions(); 47 | } 48 | return EXIT_SUCCESS; 49 | } 50 | } 51 | 52 | if (!platform.is_root()) { 53 | cerr << "Run --fix-permissions first." << endl; 54 | return EXIT_FAILURE; 55 | } 56 | 57 | if (argc < 3) { 58 | cerr << "Syntax: " << argv[0] << " iface capture_filter [output_file error_file]" << endl; 59 | return EXIT_FAILURE; 60 | } 61 | 62 | string iface(argv[1]); 63 | string filter(argv[2]); 64 | 65 | if (argc > 4) { 66 | freopen(string(argv[3]).c_str(), "w", stdout); 67 | freopen(string(argv[4]).c_str(), "w", stderr); 68 | 69 | // rw-rw-rw- 70 | mode_t mode = S_IFREG | 71 | S_IRUSR | S_IWUSR | 72 | S_IRGRP | S_IWGRP | 73 | S_IROTH | S_IWOTH; 74 | 75 | fchmod(fileno(stdout), mode); 76 | fchmod(fileno(stderr), mode); 77 | } 78 | 79 | HttpSniffer sniffer(iface, filter, received_packet); 80 | sniffer.start(); 81 | 82 | } catch (exception &e) { 83 | cerr << e.what() << endl; 84 | return EXIT_FAILURE; 85 | } 86 | 87 | return EXIT_SUCCESS; 88 | } 89 | 90 | void received_packet(HttpPacket *packet) 91 | { 92 | json_spirit::Object data_obj; 93 | data_obj.push_back(json_spirit::Pair("from", packet->from())); 94 | data_obj.push_back(json_spirit::Pair("to", packet->to())); 95 | data_obj.push_back(json_spirit::Pair("method", packet->method())); 96 | data_obj.push_back(json_spirit::Pair("path", packet->path())); 97 | data_obj.push_back(json_spirit::Pair("query", packet->query())); 98 | data_obj.push_back(json_spirit::Pair("host", packet->host())); 99 | data_obj.push_back(json_spirit::Pair("cookies", packet->cookies())); 100 | data_obj.push_back(json_spirit::Pair("userAgent", packet->user_agent())); 101 | 102 | string data = json_spirit::write_string(json_spirit::Value(data_obj), false); 103 | cout << data << endl; 104 | } 105 | -------------------------------------------------------------------------------- /backend/src/osx_platform.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // osx_platform.cpp: Mac OS X functions 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | #include 24 | #include "osx_platform.hpp" 25 | 26 | #include 27 | #include 28 | 29 | 30 | // Our client ID for various OS X APIs. 31 | static CFStringRef kFiresheepClientID = CFSTR("com.codebutler.firesheep.backend"); 32 | 33 | 34 | OSXPlatform::OSXPlatform(string path) : UnixPlatform(path) { } 35 | 36 | bool OSXPlatform::run_privileged() 37 | { 38 | AuthorizationRef auth = NULL; 39 | OSStatus err; 40 | AuthorizationFlags flags; 41 | 42 | const char *path = this->path().c_str(); 43 | 44 | flags = kAuthorizationFlagExtendRights | kAuthorizationFlagInteractionAllowed; 45 | 46 | err = AuthorizationCreate(NULL, NULL, flags, &auth); 47 | if (err != errAuthorizationSuccess) 48 | throw runtime_error(str(boost::format("osx_run_privileged: AuthorizationCreate() failed: %ld.") % (long int)err)); 49 | 50 | char *args[] = { (char *) "--fix-permissions", NULL }; 51 | 52 | err = AuthorizationExecuteWithPrivileges(auth, path, kAuthorizationFlagDefaults, args, NULL); 53 | AuthorizationFree(auth, kAuthorizationFlagDefaults); 54 | if (err == errAuthorizationCanceled) 55 | return false; 56 | else if (err != errAuthorizationSuccess) 57 | throw runtime_error(str(boost::format("osx_run_privileged: AuthorizationExecuteWithPrivileges() failed: %ld") % (long int)err)); 58 | else { 59 | int child; 60 | wait(&child); 61 | } 62 | 63 | return true; 64 | } 65 | 66 | vector OSXPlatform::interfaces() 67 | { 68 | vector result; 69 | 70 | SCPreferencesRef prefs = SCPreferencesCreate(NULL, kFiresheepClientID, NULL); 71 | SCNetworkSetRef set = SCNetworkSetCopyCurrent(prefs); 72 | CFArrayRef services = SCNetworkSetCopyServices(set); 73 | 74 | int arraySize = CFArrayGetCount(services); 75 | for (int i = 0; i < arraySize; i++) { 76 | SCNetworkServiceRef service = (SCNetworkServiceRef) CFArrayGetValueAtIndex(services, i); 77 | 78 | if (this->is_service_relevant(service)) 79 | result.push_back(this->service_info(service)); 80 | } 81 | 82 | CFRelease(services); 83 | CFRelease(set); 84 | CFRelease(prefs); 85 | 86 | return result; 87 | } 88 | 89 | InterfaceInfo OSXPlatform::primary_interface() 90 | { 91 | SCPreferencesRef prefs = NULL; 92 | SCDynamicStoreRef store = NULL; 93 | CFStringRef key = NULL; 94 | CFDictionaryRef ipv4State = NULL; 95 | CFStringRef serviceID = NULL; 96 | SCNetworkServiceRef service = NULL; 97 | InterfaceInfo info; 98 | 99 | store = SCDynamicStoreCreate(kCFAllocatorDefault, kFiresheepClientID, NULL, NULL); 100 | prefs = SCPreferencesCreate(kCFAllocatorDefault, kFiresheepClientID, NULL); 101 | 102 | if (store != NULL && prefs != NULL) 103 | key = SCDynamicStoreKeyCreateNetworkGlobalEntity(kCFAllocatorDefault, kSCDynamicStoreDomainState, kSCEntNetIPv4); 104 | 105 | if (key != NULL) 106 | ipv4State = (CFDictionaryRef) SCDynamicStoreCopyValue(store, key); 107 | 108 | if (ipv4State != NULL) 109 | serviceID = (CFStringRef )CFDictionaryGetValue(ipv4State, kSCDynamicStorePropNetPrimaryService); 110 | 111 | if (serviceID != NULL) 112 | service = (SCNetworkServiceRef) SCNetworkServiceCopy(prefs, serviceID); 113 | 114 | if (this->is_service_relevant(service)) 115 | info = this->service_info(service); 116 | 117 | if (service != NULL) 118 | CFRelease(service); 119 | if (ipv4State != NULL) 120 | CFRelease(ipv4State); 121 | if (prefs != NULL) 122 | CFRelease(prefs); 123 | if (store != NULL) 124 | CFRelease(store); 125 | 126 | return info; 127 | } 128 | 129 | bool OSXPlatform::is_service_relevant(SCNetworkServiceRef service) 130 | { 131 | SCNetworkInterfaceRef iface = NULL; 132 | CFStringRef type = NULL; 133 | bool is_relevant = false; 134 | 135 | if (service != NULL && SCNetworkServiceGetEnabled(service)) 136 | iface = SCNetworkServiceGetInterface(service); 137 | 138 | if (iface != NULL) 139 | type = SCNetworkInterfaceGetInterfaceType(iface); 140 | 141 | if (type != NULL) 142 | { 143 | if (CFStringCompare(type, CFSTR("Ethernet"), 0) == kCFCompareEqualTo) 144 | is_relevant = true; 145 | else if (CFStringCompare(type, CFSTR("IEEE80211"), 0) == kCFCompareEqualTo) 146 | is_relevant = true; 147 | } 148 | 149 | return is_relevant; 150 | } 151 | 152 | InterfaceInfo OSXPlatform::service_info(SCNetworkServiceRef service) 153 | { 154 | SCNetworkInterfaceRef iface = NULL; 155 | CFStringRef bsdName = NULL, serviceName = NULL, type = NULL; 156 | 157 | iface = SCNetworkServiceGetInterface(service); 158 | 159 | bsdName = SCNetworkInterfaceGetBSDName(iface); 160 | serviceName = SCNetworkServiceGetName(service); 161 | type = SCNetworkInterfaceGetInterfaceType(iface); 162 | 163 | return InterfaceInfo(stringFromCFString(bsdName), stringFromCFString(serviceName), stringFromCFString(type)); 164 | } 165 | 166 | string OSXPlatform::stringFromCFString(CFStringRef cfString, CFStringEncoding encoding) 167 | { 168 | char *cstring = NULL; 169 | int maxLen = NULL; 170 | string result; 171 | 172 | if (cfString != NULL) { 173 | maxLen = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfString), encoding); 174 | cstring = (char *)alloca(maxLen + 1); 175 | CFStringGetCString(cfString, cstring, maxLen, encoding); 176 | result = cstring; 177 | } 178 | 179 | return result; 180 | } 181 | -------------------------------------------------------------------------------- /backend/src/osx_platform.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // osx_platform.h: Mac OS X functions 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | #ifndef FIRESHEEP_OSX_PLATFORM_H 24 | #define FIRESHEEP_OSX_PLATFORM_H 25 | 26 | #include "unix_platform.hpp" 27 | #include "interface_info.hpp" 28 | 29 | #include 30 | #include 31 | 32 | 33 | class OSXPlatform : public UnixPlatform { 34 | public: 35 | OSXPlatform(string); 36 | bool run_privileged(); 37 | vector interfaces(); 38 | InterfaceInfo primary_interface(); 39 | 40 | protected: 41 | bool is_service_relevant(SCNetworkServiceRef service); 42 | InterfaceInfo service_info(SCNetworkServiceRef service); 43 | string stringFromCFString(CFStringRef cfString, CFStringEncoding encoding=kCFStringEncodingUTF8); 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /backend/src/tcpip.h: -------------------------------------------------------------------------------- 1 | // 2 | // tcpip.h 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // Nick kossifidis 10 | // 11 | // This program is free software: you can redistribute it and/or modify 12 | // it under the terms of the GNU General Public License as published by 13 | // the Free Software Foundation, either version 3 of the License, or 14 | // (at your option) any later version. 15 | // 16 | // This program is distributed in the hope that it will be useful, 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU General Public License 22 | // along with this program. If not, see . 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | /* default snap length (maximum bytes per packet to capture) */ 29 | #define SNAP_LEN 1518 30 | 31 | /* ethernet headers are always exactly 14 bytes [1] */ 32 | #define SIZE_ETHERNET 14 33 | 34 | /* Ethernet addresses are 6 bytes */ 35 | #define ETHER_ADDR_LEN 6 36 | 37 | /* Support __packed__ on visual studio */ 38 | #ifdef PLATFORM_WIN32 39 | #define PACK_START __pragma(pack(push, 1)) 40 | #define PACK_END __pragma(pack(pop)) 41 | #else 42 | #define PACK_START 43 | #define PACK_END __attribute__((__packed__)); 44 | #endif 45 | 46 | /* Radiotap header */ 47 | PACK_START 48 | struct radiotap_header { 49 | u_int8_t it_version; /* set to 0 */ 50 | u_int8_t it_pad; 51 | u_int16_t it_len; /* entire length */ 52 | u_int32_t it_present; /* fields present */ 53 | }PACK_END; 54 | 55 | 56 | /* SNAP LLC header */ 57 | PACK_START 58 | struct snap_llc_header 59 | { 60 | u_int8_t dsap; 61 | u_int8_t ssap; 62 | u_int8_t ctl; 63 | u_int16_t org; 64 | u_int8_t org2; 65 | u_int16_t ether_type; /* ethernet type */ 66 | }PACK_END; 67 | 68 | 69 | /* 802.11 Generic header */ 70 | PACK_START 71 | struct wifi_header { 72 | u_int16_t fc; 73 | u_int16_t duration; 74 | u_int8_t da[6]; 75 | u_int8_t sa[6]; 76 | u_int8_t bssid[6]; 77 | u_int16_t seq_ctrl; 78 | }PACK_END; 79 | 80 | /* 81 | * Bits in the frame control field. 82 | */ 83 | #define FC_TYPE(fc) (((fc) >> 2) & 0x3) 84 | #define FC_SUBTYPE(fc) (((fc) >> 4) & 0xF) 85 | #define FC_TO_DS(fc) ((fc) & 0x0100) 86 | #define FC_FROM_DS(fc) ((fc) & 0x0200) 87 | 88 | /* Type data */ 89 | #define T_DATA 0x2 90 | 91 | /* Subtype QoS data */ 92 | #define DATA_FRAME_IS_QOS(x) ((x) & 0x08) 93 | 94 | /* Ethernet header */ 95 | PACK_START 96 | struct sniff_ethernet { 97 | u_char ether_dhost[ETHER_ADDR_LEN]; /* destination host address */ 98 | u_char ether_shost[ETHER_ADDR_LEN]; /* source host address */ 99 | u_short ether_type; /* IP? ARP? RARP? etc */ 100 | }PACK_END; 101 | 102 | #define ETHERTYPE_IP 0x0800 /* IP protocol */ 103 | #define ETHERTYPE_IPV6 0x86dd /* IPv6 */ 104 | 105 | /* IP header */ 106 | PACK_START 107 | struct sniff_ip { 108 | u_char ip_vhl; /* version << 4 | header length >> 2 */ 109 | u_char ip_tos; /* type of service */ 110 | u_short ip_len; /* total length */ 111 | u_short ip_id; /* identification */ 112 | u_short ip_off; /* fragment offset field */ 113 | #define IP_RF 0x8000 /* reserved fragment flag */ 114 | #define IP_DF 0x4000 /* dont fragment flag */ 115 | #define IP_MF 0x2000 /* more fragments flag */ 116 | #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ 117 | u_char ip_ttl; /* time to live */ 118 | u_char ip_p; /* protocol */ 119 | u_short ip_sum; /* checksum */ 120 | struct in_addr ip_src,ip_dst; /* source and dest address */ 121 | }PACK_END; 122 | #define IP_HL(ip) (((ip)->ip_vhl) & 0x0f) 123 | #define IP_V(ip) (((ip)->ip_vhl) >> 4) 124 | 125 | PACK_START 126 | struct sniff_ip6 { 127 | union { 128 | struct ip6_hdrctl { 129 | u_int32_t ip6_un1_flow; // 20 bits of flow-ID 130 | u_int16_t ip6_un1_plen; // payload length 131 | u_int8_t ip6_un1_nxt; // next header 132 | u_int8_t ip6_un1_hlim; // hop limit 133 | } ip6_un1; 134 | u_int8_t ip6_un2_vfc; // 4 bits version, top 4 bits class 135 | } ip6_ctlun; 136 | struct in6_addr ip6_src; // source address 137 | struct in6_addr ip6_dst; // destination address 138 | }PACK_END; 139 | 140 | #define ip6_vfc ip6_ctlun.ip6_un2_vfc 141 | #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow 142 | #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen 143 | #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt 144 | #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim 145 | #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim 146 | 147 | /* TCP header */ 148 | typedef u_int tcp_seq; 149 | 150 | PACK_START 151 | struct sniff_tcp { 152 | u_short th_sport; /* source port */ 153 | u_short th_dport; /* destination port */ 154 | tcp_seq th_seq; /* sequence number */ 155 | tcp_seq th_ack; /* acknowledgement number */ 156 | u_char th_offx2; /* data offset, rsvd */ 157 | #define TH_OFF(th) (((th)->th_offx2 & 0xf0) >> 4) 158 | u_char th_flags; 159 | #define TH_FIN 0x01 160 | #define TH_SYN 0x02 161 | #define TH_RST 0x04 162 | #define TH_PUSH 0x08 163 | #define TH_ACK 0x10 164 | #define TH_URG 0x20 165 | #define TH_ECE 0x40 166 | #define TH_CWR 0x80 167 | #define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR) 168 | u_short th_win; /* window */ 169 | u_short th_sum; /* checksum */ 170 | u_short th_urp; /* urgent pointer */ 171 | }PACK_END; 172 | 173 | #undef PACK_START 174 | #undef PACK_END 175 | -------------------------------------------------------------------------------- /backend/src/unix_platform.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // unix_platform.h: Functions for unix-like platforms. 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | #ifndef FIRESHEEP_UNIX_PLATFORM_H 24 | #define FIRESHEEP_UNIX_PLATFORM_H 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | #include 32 | #ifdef PLATFORM_LINUX 33 | #include 34 | #else 35 | #include 36 | #endif 37 | #include 38 | #include 39 | #include "abstract_platform.hpp" 40 | #include "interface_info.hpp" 41 | 42 | using namespace std; 43 | 44 | // r-sr-xr-x 45 | static const mode_t MODE = S_IFREG | S_ISUID | S_IRUSR | S_IXUSR | 46 | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; 47 | 48 | class UnixPlatform : public AbstractPlatform 49 | { 50 | public: 51 | UnixPlatform(string path) 52 | : m_path(path) 53 | { 54 | } 55 | 56 | bool is_root() { 57 | return geteuid() == 0; 58 | } 59 | 60 | bool check_permissions() { 61 | int err; 62 | struct stat file_stat; 63 | 64 | err = stat(this->path().c_str(), &file_stat); 65 | if (err == -1) 66 | throw runtime_error("stat() failed"); 67 | 68 | if ((file_stat.st_mode & S_ISUID) && file_stat.st_uid != 0) 69 | throw runtime_error("backend is setuid but owner is not root!"); 70 | 71 | return (file_stat.st_uid == 0 && (file_stat.st_mode & S_ISUID)); 72 | } 73 | 74 | void fix_permissions() { 75 | int err; 76 | int fd; 77 | 78 | const char *path = this->path().c_str(); 79 | 80 | // Open the file. 81 | fd = open(path, O_RDONLY, 0); 82 | if (fd < 0) 83 | throw runtime_error(str(boost::format("fix_permissions: open() failed: %d.") % errno)); 84 | 85 | // Ensure file is owned by root. 86 | err = fchown(fd, 0, -1); 87 | if (err == -1) 88 | throw runtime_error(str(boost::format("fix_permissions: fchown() failed: %d.") % errno)); 89 | 90 | // Ensure setuid bit is enabled. 91 | err = fchmod(fd, MODE); 92 | if (err == -1) 93 | throw runtime_error(str(boost::format("fix_permissions: fchmod() failed: %d.") % errno)); 94 | 95 | // Close file. 96 | err = close(fd); 97 | if (err == -1) 98 | throw runtime_error(str(boost::format("fix_permissions: close() failed: %d.") % errno)); 99 | } 100 | 101 | virtual bool run_privileged() = 0; 102 | virtual vector interfaces() = 0; 103 | 104 | protected: 105 | string path() { 106 | if (m_path.empty()) 107 | throw runtime_error("path is empty"); 108 | 109 | char path[PATH_MAX]; 110 | if (!realpath(m_path.c_str(), path)) 111 | throw runtime_error(str(boost::format("realpath() failed: %d\n") % errno)); 112 | return m_path; 113 | } 114 | 115 | private: 116 | string m_path; 117 | }; 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /backend/src/windows_platform.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // windows_platform.cpp: Functions for Windows platforms. 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | #include 24 | #include 25 | #include "windows_platform.hpp" 26 | #include "interface_info.hpp" 27 | #include "pcap.h" 28 | using namespace std; 29 | 30 | WindowsPlatform::WindowsPlatform(vector) 31 | { 32 | // FIXME 33 | } 34 | 35 | bool WindowsPlatform::is_root() 36 | { 37 | // FIXME 38 | return true; 39 | } 40 | 41 | bool WindowsPlatform::check_permissions() 42 | { 43 | // FIXME 44 | return true; 45 | } 46 | 47 | void WindowsPlatform::fix_permissions() { 48 | // FIXME 49 | } 50 | 51 | bool WindowsPlatform::run_privileged() { 52 | // FIXME 53 | return true; 54 | } 55 | 56 | vector WindowsPlatform::interfaces() 57 | { 58 | vector results; 59 | 60 | pcap_if_t *alldevs; 61 | pcap_if_t *d; 62 | char errbuf[PCAP_ERRBUF_SIZE+1]; 63 | 64 | if (pcap_findalldevs(&alldevs, errbuf) == -1) { 65 | throw runtime_error(str(boost::format("Error in pcap_findalldevs: %s") % errbuf)); 66 | } 67 | 68 | for (d = alldevs; d; d = d->next) { 69 | string id(d->name); 70 | boost::replace_all(id, "\\", "\\\\"); 71 | boost::replace_all(id, "{", "\\{"); 72 | boost::replace_all(id, "}", "\\}"); 73 | InterfaceInfo info(id, (string(d->description)), "ethernet"); 74 | results.push_back(info); 75 | } 76 | 77 | pcap_freealldevs(alldevs); 78 | 79 | return results; 80 | } 81 | -------------------------------------------------------------------------------- /backend/src/windows_platform.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // windows_platform.hpp: Functions for Windows platforms. 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | #ifndef FIRESHEEP_WINDOWS_PLATFORM_H 24 | #define FIRESHEEP_WINDOWS_PLATFORM_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include "abstract_platform.hpp" 30 | #include "interface_info.hpp" 31 | 32 | using namespace std; 33 | 34 | class WindowsPlatform : public AbstractPlatform 35 | { 36 | public: 37 | WindowsPlatform(vector); 38 | bool is_root(); 39 | bool check_permissions(); 40 | void fix_permissions(); 41 | bool run_privileged(); 42 | vector interfaces(); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | # 2 | # configure.ac 3 | # 4 | # Authors: 5 | # Eric Butler 6 | # Nick Kossifidis 7 | # 8 | # This file is part of Firesheep. 9 | # 10 | # This program is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program. If not, see . 22 | 23 | AC_INIT([Firesheep], [0.1], [eric@codebutler.com], 24 | [firesheep], [http://codebutler.github.com/firesheep]) 25 | AC_PROG_CC([clang gcc]) 26 | AC_PREREQ([2.61]) 27 | AM_INIT_AUTOMAKE([foreign]) 28 | 29 | AC_PROG_LIBTOOL 30 | AC_PROG_CXX([clang++ g++]) 31 | 32 | # A common source of problems. 33 | if test ! -d backend/deps/http-parser; then 34 | AC_MSG_ERROR([http-parser missing, did you read the README?]) 35 | fi 36 | 37 | # OSX doesn't come with pkg-config, but PKG_CHECK_MODULES has to be defined to something to avoid errors. 38 | m4_define_default([PKG_CHECK_MODULES], [AC_MSG_FAILURE([pkg-config was not found])]) 39 | 40 | AC_CANONICAL_HOST 41 | AC_CANONICAL_TARGET 42 | 43 | case "$build_cpu" in 44 | i[[3456]]86*) 45 | build_arch="x86" 46 | ;; 47 | amd64*|x86_64*) 48 | build_arch="x86_64" 49 | ;; 50 | esac 51 | 52 | case "$host_os" in 53 | cygwin) 54 | DLL_EXT="dll" 55 | FIRESHEEP_PLATFORM_NAME=WIN32 56 | FIRESHEEP_PLATFORM="WINNT_x86-msvc" 57 | ;; 58 | darwin*) 59 | DLL_EXT="dylib" 60 | FIRESHEEP_PLATFORM_NAME=OSX 61 | FIRESHEEP_PLATFORM="osx" 62 | CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.6" 63 | ;; 64 | linux*) 65 | DLL_EXT="so" 66 | FIRESHEEP_PLATFORM_NAME=LINUX 67 | FIRESHEEP_PLATFORM="Linux_${build_arch}-gcc3" 68 | ;; 69 | esac 70 | 71 | AC_SUBST(DLL_EXT) 72 | AC_SUBST(FIRESHEEP_PLATFORM) 73 | AC_SUBST(FIRESHEEP_PLATFORM_NAME) 74 | 75 | AM_CONDITIONAL(PLATFORM_WIN32, test x$FIRESHEEP_PLATFORM_NAME = xWIN32) 76 | AM_CONDITIONAL(PLATFORM_OSX, test x$FIRESHEEP_PLATFORM_NAME = xOSX) 77 | AM_CONDITIONAL(PLATFORM_LINUX, test x$FIRESHEEP_PLATFORM_NAME = xLINUX) 78 | 79 | # BEGIN PCAP LIBS 80 | AC_PATH_PROG([PCAP_CONFIG], [pcap-config], [no], [$PATH]) 81 | if test "x$PCAP_CONFIG" = "xno"; then 82 | AC_MSG_ERROR([pcap-config not found (libpcap not installed ?)]) 83 | fi 84 | 85 | PCAP_LIBS=`pcap-config --libs` 86 | AC_SUBST(PCAP_LIBS) 87 | PCAP_CFLAGS=`pcap-config --cflags` 88 | AC_SUBST(PCAP_FLAGS) 89 | # END PCAP LIBS 90 | 91 | # BEGIN BOOST LIBS 92 | # Specific version ? 93 | #BOOST_REQUIRE([1.40]) 94 | BOOST_REQUIRE 95 | AC_SUBST(BOOST_CPPFLAGS) 96 | BOOST_FORMAT 97 | AC_SUBST(BOOST_FORMAT_LIBS) 98 | BOOST_STRING_ALGO 99 | AC_SUBST(BOOST_STRING_ALGO_LIBS) 100 | # END BOOST LIBS 101 | 102 | if test x$FIRESHEEP_PLATFORM_NAME = xLINUX; then 103 | PKG_CHECK_MODULES(UDEV, [libudev]) 104 | AC_SUBST(UDEV_CFLAGS) 105 | AC_SUBST(UDEV_LIBS) 106 | fi 107 | 108 | CXXFLAGS="-Wall -g -O0" 109 | AC_SUBST(CXXFLAGS) 110 | 111 | AC_CONFIG_FILES([ 112 | Makefile 113 | backend/Makefile 114 | ]) 115 | 116 | AC_OUTPUT 117 | 118 | echo " 119 | Firesheep-$VERSION 120 | 121 | Platform: ${FIRESHEEP_PLATFORM} 122 | " 123 | -------------------------------------------------------------------------------- /scripts/runfoxrun.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #export NSPR_LOG_MODULES=all:5 4 | #export NSPR_LOG_MODULES=nsNativeModuleLoader:5 5 | export NO_EM_RESTART=1 6 | export MOZ_NO_REMOTE 7 | export MOZ_CRASHREPORTER_DISABLE=1 8 | 9 | /Applications/Firefox.app/Contents/MacOS/firefox-bin 10 | -------------------------------------------------------------------------------- /xpi/chrome.manifest: -------------------------------------------------------------------------------- 1 | content firesheep chrome/content/ 2 | skin firesheep classic/1.0 chrome/skin/ 3 | locale firesheep en-US chrome/locale/en-US/ 4 | 5 | overlay chrome://browser/content/browser.xul chrome://firesheep/content/browserOverlay.xul 6 | overlay chrome://global/content/customizeToolbar.xul chrome://firesheep/content/customizeToolbarOverlay.xul 7 | 8 | style chrome://firesheep/content/sidebar.xul chrome://firesheep/skin/sidebar-osx.css OS=Darwin 9 | style chrome://firesheep/content/preferences/prefsWindow.xul chrome://firesheep/skin/preferences-osx.css OS=Darwin 10 | 11 | style chrome://firesheep/content/sidebar.xul chrome://firesheep/skin/sidebar-win.css OS=WINNT 12 | 13 | resource firesheep modules/ 14 | -------------------------------------------------------------------------------- /xpi/chrome/content/about.xul: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /xpi/chrome/content/browserOverlay.js: -------------------------------------------------------------------------------- 1 | // 2 | // browserOverlay.js 3 | // Part of the Firesheep project. 4 | // 5 | // Copyright (C) 2010 Eric Butler 6 | // 7 | // Authors: 8 | // Eric Butler 9 | // 10 | // This program is free software: you can redistribute it and/or modify 11 | // it under the terms of the GNU General Public License as published by 12 | // the Free Software Foundation, either version 3 of the License, or 13 | // (at your option) any later version. 14 | // 15 | // This program is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | // GNU General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU General Public License 21 | // along with this program. If not, see . 22 | 23 | Components.utils.import('resource://firesheep/util/Observers.js'); 24 | Components.utils.import('resource://firesheep/Firesheep.js'); 25 | Components.utils.import('resource://firesheep/util/Preferences.js'); 26 | 27 | var FiresheepUI = { 28 | onLoad: function() { 29 | if (!Preferences.isSet('firesheep.first_run')) { 30 | toggleSidebar('viewSidebar_firesheep', true); 31 | var welcomeUrl = "http://codebutler.github.com/firesheep/welcome.html"; 32 | window.gBrowser.selectedTab = window.gBrowser.addTab(welcomeUrl); 33 | Preferences.set('firesheep.first_run', false); 34 | } 35 | }, 36 | 37 | toggleSidebar: function (e) { 38 | toggleSidebar('viewSidebar_firesheep'); 39 | }, 40 | 41 | showPrefs: function () { 42 | // https://wiki.mozilla.org/XUL:Windows#Preferences_Windows 43 | 44 | var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); 45 | var instantApply = prefs.getBoolPref("browser.preferences.instantApply", false); 46 | var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal"); 47 | 48 | var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); 49 | var win = wm.getMostRecentWindow("Firesheep:Preferences"); 50 | if (win) { 51 | win.focus(); 52 | } else { 53 | var url = 'chrome://firesheep/content/preferences/prefsWindow.xul'; 54 | window.openDialog(url, "Firesheep Preferences", features); 55 | } 56 | } 57 | }; 58 | 59 | window.addEventListener("load", FiresheepUI.onLoad, false); 60 | -------------------------------------------------------------------------------- /xpi/chrome/content/browserOverlay.xul: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 26 | 27 | 28 | 29 | 30 |