├── AUTHORS ├── NEWS ├── README ├── ChangeLog ├── xpi ├── chrome │ ├── skin │ │ ├── overlay.css │ │ ├── preferences-osx.css │ │ ├── bottombar_bg.png │ │ ├── menu_button.png │ │ ├── default_avatar.jpg │ │ ├── details_button.png │ │ ├── prefs-advanced.png │ │ ├── prefs-capture.png │ │ ├── prefs-websites.png │ │ ├── toolbar-button.png │ │ ├── bottombar_handle.png │ │ ├── menu_button_pressed.png │ │ ├── details_button_pressed.png │ │ ├── preferences.css │ │ ├── sidebar-osx.css │ │ └── sidebar.css │ ├── locale │ │ └── en-US │ │ │ ├── overlay.properties │ │ │ ├── about.dtd │ │ │ ├── overlay.dtd │ │ │ └── options.dtd │ └── content │ │ ├── preferences │ │ ├── websiteEditor.xul │ │ ├── capturePane.xul │ │ ├── advancedPane.xul │ │ ├── prefsWindow.xul │ │ ├── websitesPane.xul │ │ ├── websiteEditor.js │ │ └── capturePane.js │ │ ├── ff-overlay.js │ │ ├── about.xul │ │ ├── ff-overlay.xul │ │ └── ff-sidebar.xul ├── handlers │ ├── enom.js │ ├── hackernews.js │ ├── bitly.js │ ├── gowalla.js │ ├── amazon.js │ ├── cnet.js │ ├── yahoo.js │ ├── slicemanager.js │ ├── flickr.js │ ├── facebook.js │ ├── tumblr.js │ ├── nytimes.js │ ├── cisco.js │ ├── evernote.js │ ├── sandiego_toorcon.js │ ├── yelp.js │ ├── dropbox.js │ ├── live.js │ ├── github.js │ ├── pivotal.js │ ├── wordpress.js │ ├── basecamp.js │ ├── harvest.js │ ├── foursquare.js │ ├── google.js │ └── twitter.js ├── chrome.manifest ├── defaults │ └── preferences │ │ └── prefs.js ├── modules │ ├── util │ │ ├── RailsHelper.js │ │ ├── Base64.js │ │ ├── CookieMonster.js │ │ └── ScriptParser.js │ ├── FiresheepConfig.js │ └── FiresheepSession.js └── install.rdf ├── backend ├── deps │ ├── winpcap │ │ ├── lib │ │ │ ├── wpcap.dll │ │ │ └── Packet.dll │ │ └── include │ │ │ ├── pcap │ │ │ ├── bluetooth.h │ │ │ ├── vlan.h │ │ │ ├── usb.h │ │ │ └── namedb.h │ │ │ ├── pcap-namedb.h │ │ │ ├── pcap.h │ │ │ ├── pcap-bpf.h │ │ │ ├── pcap-stdinc.h │ │ │ ├── Win32-Extensions.h │ │ │ └── bittypes.h │ └── json_spirit │ │ ├── .json_spirit_utils.h.swp │ │ ├── json_spirit_value.cpp │ │ ├── CMakeLists.txt │ │ ├── json_spirit.h │ │ ├── json_spirit_error_position.h │ │ ├── json_spirit_utils.h │ │ ├── json_spirit_writer.h │ │ ├── json_spirit_stream_reader.h │ │ ├── json_spirit_writer.cpp │ │ ├── json_spirit_reader.h │ │ └── json_spirit_reader.cpp ├── src │ ├── config.h │ ├── osx_platform.hpp │ ├── windows_platform.hpp │ ├── abstract_platform.hpp │ ├── interface_info.hpp │ ├── http_sniffer.hpp │ ├── windows_platform.cpp │ ├── http_packet.hpp │ ├── tcpip.h │ ├── unix_platform.hpp │ ├── osx_platform.cpp │ ├── main.cpp │ └── http_packet.cpp └── Makefile.am ├── .gitmodules ├── autogen.sh ├── scripts └── runfoxrun.sh ├── .gitignore ├── Makefile.am ├── mozpopen ├── mozpopen.sln ├── Makefile.am ├── MozPopenModule.cpp ├── MozPopen.idl ├── win32 │ ├── boost │ │ ├── process │ │ │ ├── config.hpp │ │ │ ├── environment.hpp │ │ │ ├── win32_context.hpp │ │ │ ├── win32_operations.hpp │ │ │ ├── status.hpp │ │ │ ├── posix_operations.hpp │ │ │ ├── posix_status.hpp │ │ │ ├── posix_context.hpp │ │ │ ├── self.hpp │ │ │ ├── pistream.hpp │ │ │ ├── postream.hpp │ │ │ ├── win32_child.hpp │ │ │ └── process.hpp │ │ └── process.hpp │ ├── MozPopenProcess.h │ └── MozPopenProcess.cpp └── unix │ ├── MozPopenProcess.h │ └── MozPopenProcess.cpp └── configure.ac /AUTHORS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /xpi/chrome/skin/overlay.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /xpi/chrome/skin/preferences-osx.css: -------------------------------------------------------------------------------- 1 | prefwindow { 2 | height: auto !important; 3 | } 4 | -------------------------------------------------------------------------------- /xpi/chrome/skin/bottombar_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/xpi/chrome/skin/bottombar_bg.png -------------------------------------------------------------------------------- /xpi/chrome/skin/menu_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/xpi/chrome/skin/menu_button.png -------------------------------------------------------------------------------- /backend/deps/winpcap/lib/wpcap.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/backend/deps/winpcap/lib/wpcap.dll -------------------------------------------------------------------------------- /xpi/chrome/skin/default_avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/xpi/chrome/skin/default_avatar.jpg -------------------------------------------------------------------------------- /xpi/chrome/skin/details_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/xpi/chrome/skin/details_button.png -------------------------------------------------------------------------------- /xpi/chrome/skin/prefs-advanced.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/xpi/chrome/skin/prefs-advanced.png -------------------------------------------------------------------------------- /xpi/chrome/skin/prefs-capture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/xpi/chrome/skin/prefs-capture.png -------------------------------------------------------------------------------- /xpi/chrome/skin/prefs-websites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/xpi/chrome/skin/prefs-websites.png -------------------------------------------------------------------------------- /xpi/chrome/skin/toolbar-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/xpi/chrome/skin/toolbar-button.png -------------------------------------------------------------------------------- /backend/deps/winpcap/lib/Packet.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/backend/deps/winpcap/lib/Packet.dll -------------------------------------------------------------------------------- /xpi/chrome/skin/bottombar_handle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/xpi/chrome/skin/bottombar_handle.png -------------------------------------------------------------------------------- /xpi/chrome/skin/menu_button_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/xpi/chrome/skin/menu_button_pressed.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "backend/deps/http-parser"] 2 | path = backend/deps/http-parser 3 | url = git://github.com/ry/http-parser.git 4 | -------------------------------------------------------------------------------- /xpi/chrome/skin/details_button_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/xpi/chrome/skin/details_button_pressed.png -------------------------------------------------------------------------------- /xpi/chrome/locale/en-US/overlay.properties: -------------------------------------------------------------------------------- 1 | extensions.firesheep@codebutler.com.description=Demonstrate HTTP session hijacking attacks from Firefox. -------------------------------------------------------------------------------- /backend/deps/json_spirit/.json_spirit_utils.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basuke/firesheep/master/backend/deps/json_spirit/.json_spirit_utils.h.swp -------------------------------------------------------------------------------- /xpi/chrome/locale/en-US/about.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /xpi/chrome/locale/en-US/overlay.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /xpi/handlers/enom.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Eric Butler 3 | register({ 4 | name: 'Enom', 5 | domains: [ 'enom.com' ], 6 | sessionCookieNames: [ 'OatmealCookie', 'EmailAddress' ], 7 | 8 | identifyUser: function () { 9 | this.userName = this.firstPacket.cookies['OatmealCookie'].split(';')[0]; 10 | } 11 | }); -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | aclocal.m4 3 | autom4te.cache/* 4 | config.guess 5 | config.log 6 | config.status 7 | config.sub 8 | configure 9 | install-sh 10 | Makefile 11 | Makefile.in 12 | missing 13 | 14 | xpi/components 15 | xpi/backend 16 | xpi/platform 17 | mozpopen/MozPopen.h 18 | mozpopen/Debug 19 | 20 | build/ 21 | 22 | *.suo 23 | *.ncb 24 | *.user 25 | *.swp 26 | *~ 27 | -------------------------------------------------------------------------------- /xpi/handlers/hackernews.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Eric Butler 3 | register({ 4 | name: 'Hacker News', 5 | domains: [ 'news.ycombinator.com' ], 6 | sessionCookieNames: [ 'user' ], 7 | 8 | identifyUser: function () { 9 | var resp = this.httpGet(this.siteUrl); 10 | this.userName = resp.body.querySelectorAll(".pagetop a")[7].innerHTML; 11 | } 12 | }); -------------------------------------------------------------------------------- /xpi/handlers/bitly.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Ian Gallagher 3 | register({ 4 | name: 'bit.ly', 5 | url: 'http://bit.ly/', 6 | domains: [ 'bit.ly' ], 7 | sessionCookieNames: [ 'user' ], 8 | 9 | identifyUser: function() { 10 | var resp = this.httpGet(this.siteUrl); 11 | this.userName = resp.body.querySelectorAll("#loginContainer a")[0].textContent; 12 | } 13 | }); 14 | -------------------------------------------------------------------------------- /xpi/chrome/locale/en-US/options.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /xpi/handlers/gowalla.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Ian Gallagher 3 | 4 | register({ 5 | name: 'Gowalla', 6 | url: 'https://gowalla.com/home', 7 | domains: [ 'gowalla.com' ], 8 | sessionCookieNames: [ '__utma' ], 9 | 10 | identifyUser: function () { 11 | var resp = this.httpGet(this.siteUrl); 12 | this.userName = resp.body.querySelectorAll('.contentnode a')[1].textContent; 13 | } 14 | }); 15 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = mozpopen backend 2 | 3 | all: zip 4 | 5 | CHMOD=chmod 755 $(top_builddir)/xpi/platform/Darwin_x86-gcc3/firesheep-backend 6 | 7 | zip: 8 | mkdir -p $(top_builddir)/build 9 | rm -f $(top_builddir)/build/firesheep.xpi 10 | if PLATFORM_OSX 11 | $(CHMOD) || sudo $(CHMOD) 12 | endif 13 | cd xpi && zip -r ../build/firesheep.xpi * 14 | 15 | clean-local: 16 | rm -f $(top_builddir)/build/firesheep.xpi 17 | -------------------------------------------------------------------------------- /xpi/chrome/skin/preferences.css: -------------------------------------------------------------------------------- 1 | prefwindow { 2 | height: 350px; 3 | } 4 | 5 | caption { 6 | font-weight: bold; 7 | } 8 | 9 | #websitesPane splitter { 10 | -moz-appearance: none; 11 | width: 1px; 12 | min-width: 1px; 13 | background: #B4B4B4; 14 | } 15 | 16 | #websitesPane textbox { 17 | -moz-appearance: none; 18 | margin: 0; 19 | border: 0; 20 | } 21 | 22 | #scriptText { 23 | font-family: monospace; 24 | } -------------------------------------------------------------------------------- /xpi/handlers/amazon.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Ian Gallagher 3 | register({ 4 | name: 'Amazon.com', 5 | url: 'http://www.amazon.com/', 6 | domains: [ 'amazon.com' ], 7 | sessionCookieNames: [ 'x-main' ], 8 | 9 | identifyUser: function() { 10 | var resp = this.httpGet(this.siteUrl); 11 | this.userName = resp.body.querySelector(".navGreeting").textContent.split(', ')[1].slice(0, -1); 12 | } 13 | }); 14 | -------------------------------------------------------------------------------- /xpi/handlers/cnet.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Ian Gallagher 3 | 4 | register({ 5 | name: 'CNET', 6 | url: 'http://www.cnet.com/', 7 | domains: [ 'cnet.com' ], 8 | sessionCookieNames: [ 'urs_sessionId' ], 9 | 10 | identifyUser: function () { 11 | var resp = this.httpGet('http://www.cnet.com/profile/'); 12 | this.userName = resp.body.querySelector("#overviewHead h1").textContent.slice(9, -1); 13 | } 14 | }); 15 | -------------------------------------------------------------------------------- /xpi/handlers/yahoo.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Joe Basirico 3 | register({ 4 | name: 'Yahoo', 5 | url: 'http://www.yahoo.com', 6 | domains: [ 'yahoo.com' ], 7 | sessionCookieNames: [ 'T', 'Y' ], 8 | 9 | identifyUser: function () { 10 | var resp = this.httpGet(this.siteUrl); 11 | this.userName = resp.body.querySelector('.y-ln-1').alt; 12 | this.userAvatar = resp.body.querySelector('.y-ln-1').src; 13 | } 14 | }); -------------------------------------------------------------------------------- /xpi/handlers/slicemanager.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Ian Gallagher 3 | register({ 4 | name: 'Slicehost SliceManager', 5 | url: 'https://manage.slicehost.com/slices', 6 | domains: [ 'manage.slicehost.com' ], 7 | sessionCookieNames: [ '_coach_session_id' ], 8 | 9 | identifyUser: function () { 10 | var resp = this.httpGet(this.siteUrl); 11 | this.userName = resp.body.querySelector("#welcome a").textContent; 12 | } 13 | }); 14 | -------------------------------------------------------------------------------- /xpi/handlers/flickr.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Ian Gallagher 3 | register({ 4 | name: 'Flickr', 5 | url: 'http://www.flickr.com/me', 6 | domains: [ 'flickr.com' ], 7 | sessionCookieNames: [ 'cookie_session' ], 8 | 9 | identifyUser: function () { 10 | var resp = this.httpGet(this.siteUrl); 11 | var path = resp.request.channel.URI.path; 12 | this.userName = path.split('/')[2]; 13 | this.userAvatar = resp.body.querySelector('.Buddy img').src; 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /xpi/handlers/facebook.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Eric Butler 3 | register({ 4 | name: 'Facebook', 5 | url: 'http://www.facebook.com/home.php', 6 | domains: [ 'facebook.com' ], 7 | sessionCookieNames: [ 'xs', 'c_user', 'sid' ], 8 | 9 | identifyUser: function () { 10 | var resp = this.httpGet(this.siteUrl); 11 | this.userName = resp.body.querySelector('#navAccountName').innerHTML; 12 | this.userAvatar = resp.body.querySelector('#navAccountPic img').src; 13 | } 14 | }); -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /xpi/handlers/tumblr.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Joe Basirico 3 | register({ 4 | name: 'tumblr.com', 5 | url: 'http://www.tumblr.com/', 6 | icon: 'http://assets.tumblr.com/images/favicon.gif?2', 7 | domains: [ 'tumblr.com' ], 8 | sessionCookieNames: [ 'pfp' ], 9 | 10 | identifyUser: function() { 11 | var prefs = this.httpGet(this.siteUrl + 'preferences'); 12 | this.userName = prefs.body.querySelector('input#user_email.text_field').value; 13 | 14 | //todo add code to grab usericon 15 | } 16 | }); -------------------------------------------------------------------------------- /xpi/handlers/nytimes.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Ian Gallagher 3 | register({ 4 | name: 'New York Times', 5 | url: 'http://www.nytimes.com/', 6 | domains: [ 'nytimes.com' ], 7 | sessionCookieNames: [ 'NYT-S', 'nyt-d' ], 8 | 9 | processPacket: function () { 10 | var nyt_d = this.firstPacket.cookies['nyt-d']; 11 | this.sessionId = nyt_d; 12 | }, 13 | 14 | identifyUser: function() { 15 | var resp = this.httpGet(this.siteUrl); 16 | this.userName = resp.body.querySelectorAll("#memberTools a")[1].innerHTML; 17 | } 18 | }); 19 | -------------------------------------------------------------------------------- /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/ff-overlay.xul 6 | style chrome://firesheep/content/ff-sidebar.xul chrome://firesheep/skin/sidebar-osx.css OS=Darwin 7 | style chrome://firesheep/content/preferences/prefsWindow.xul chrome://firesheep/skin/preferences-osx.css OS=Darwin 8 | 9 | resource firesheep modules/ -------------------------------------------------------------------------------- /xpi/handlers/cisco.js: -------------------------------------------------------------------------------- 1 | register({ 2 | name: 'Cisco', 3 | url: 'http://tools.cisco.com/RPF/profile/profile_management.do', 4 | domains: [ 'cisco.com' ], 5 | sessionCookieNames: [ 'SMIDENTITY' ], 6 | identifyUser: function () { 7 | var resp = this.httpGet(this.siteUrl); 8 | var userId = resp.body.querySelectorAll('.contentbold')[0].textContent 9 | var realName = resp.body.querySelectorAll('.contentbold')[1].textContent 10 | var email = resp.body.querySelectorAll('.contentbold')[2].textContent 11 | this.userName = userId + " (" + realName + ")"; 12 | } 13 | }); -------------------------------------------------------------------------------- /xpi/handlers/evernote.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Ian Gallagher 3 | register({ 4 | name: 'Evernote', 5 | url: 'https://www.evernote.com/Home.action', 6 | domains: [ 'evernote.com' ], 7 | sessionCookieNames: [ 'auth' ], 8 | 9 | processPacket: function () { 10 | var utma_cookie = this.firstPacket.cookies['__utma']; 11 | this.sessionId = utma_cookie; 12 | }, 13 | 14 | identifyUser: function () { 15 | var resp = this.httpGet(this.siteUrl); 16 | this.userName = resp.body.querySelectorAll("#nav td")[2].textContent.match(/Sign out \((.*)\).*/)[1]; 17 | } 18 | }); 19 | -------------------------------------------------------------------------------- /xpi/handlers/sandiego_toorcon.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Ian Gallagher 3 | register({ 4 | name: 'ToorCon: San Diego', 5 | domains: [ 'sandiego.toorcon.org' ], 6 | sessionCookieNames: [ '8cbdc47e247b091e401585ac21099eb6' ], 7 | spoofUserAgent: true, 8 | 9 | identifyUser: function () { 10 | var resp = this.httpGet('http://sandiego.toorcon.org/index.php?option=com_comprofiler'); 11 | this.userName = resp.body.querySelector("#cbProfileTitle").textContent.replace(/ Profile Page$/g, ""); 12 | this.userAvatar = resp.body.querySelector('.cbPosMiddle img').src; 13 | } 14 | }); 15 | -------------------------------------------------------------------------------- /xpi/handlers/yelp.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Ian Gallagher 3 | 4 | register({ 5 | name: 'Yelp', 6 | url: 'http://www.yelp.com/', 7 | domains: [ 'yelp.com' ], 8 | // Google Analytics cookie __utma is supposed to stay the same forever per user/domain. 9 | // This does however break if a Yelp user logs out, you'll have to start a new capture. 10 | sessionCookieNames: [ '__utma' ], 11 | 12 | identifyUser: function () { 13 | var resp = this.httpGet(this.siteUrl); 14 | this.userName = resp.body.querySelector('#user_identify .header-link').textContent; 15 | this.userAvatar = resp.body.querySelector('.pB-ss img').src; 16 | } 17 | }); 18 | -------------------------------------------------------------------------------- /xpi/handlers/dropbox.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Ian Gallagher 3 | // Dropbox seems to have recently started issuing cookies with the Secure flag set, 4 | // so this handler will not be too useful. But for people who have login sessions 5 | // more than a few weeks old at the time of it's writing, or just something odd that 6 | // happens, it will work. 7 | 8 | register({ 9 | name: 'Dropbox', 10 | url: 'https://www.dropbox.com/home#:::', 11 | domains: [ 'dropbox.com' ], 12 | sessionCookieNames: [ 'lid' ], 13 | 14 | identifyUser: function () { 15 | var resp = this.httpGet(this.siteUrl); 16 | this.userName = resp.body.querySelector("#topnav strong").textContent; 17 | } 18 | }); 19 | -------------------------------------------------------------------------------- /xpi/handlers/live.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Ian Gallagher 3 | register({ 4 | name: 'Windows Live', 5 | url: 'http://live.com', 6 | domains: [ 'live.com' ], 7 | sessionCookieNames: [ 8 | 'MSPProf', 9 | 'MSPAuth', 10 | 'RPSTAuth', 11 | 'NAP', 12 | /* 13 | 'BP', 14 | 'MH', 15 | 'LD', 16 | 'mkt0', 17 | 'wlidperf', 18 | 'ANON', 19 | 'MUID', 20 | 'wlp', 21 | //'UIC', 22 | 'wla42', 23 | 'HIC' 24 | */ 25 | ], 26 | 27 | identifyUser: function () { 28 | //var resp = this.httpGet(this.siteUrl); 29 | //this.userName = resp.body.querySelector("#idWinLiveIdValue").textContent.trim(); 30 | this.userName = "Alice, or perhaps Bob"; 31 | } 32 | }); 33 | -------------------------------------------------------------------------------- /xpi/handlers/github.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Eric Butler 3 | register({ 4 | name: 'GitHub', 5 | domains: [ 'github.com' ], 6 | sessionCookieNames: [ '_github_ses' ], 7 | 8 | processPacket: function () { 9 | var cookie = this.firstPacket.cookies['_github_ses']; 10 | var railsSession = RailsHelper.parseSessionCookie(cookie); 11 | if (!railsSession.user) { 12 | this.sessionId = null; 13 | return; 14 | } 15 | this.sessionId = railsSession.fingerprint; 16 | this.firstPacket._github_ses = railsSession; 17 | }, 18 | 19 | identifyUser: function () { 20 | var resp = this.httpGet(this.siteUrl); 21 | this.userName = resp.body.querySelector('.name').textContent; 22 | this.userAvatar = resp.body.querySelector('.avatarname img').src; 23 | } 24 | }); -------------------------------------------------------------------------------- /xpi/handlers/pivotal.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Eric Butler 3 | register({ 4 | name: 'Pivotal Tracker', 5 | url: 'http://www.pivotaltracker.com/dashboard', 6 | sessionCookieNames: [ '_myapp_session' ], 7 | domains: [ 'pivotaltracker.com' ], 8 | 9 | processPacket: function () { 10 | var cookie = this.firstPacket.cookies['_myapp_session']; 11 | var railsSession = RailsHelper.parseSessionCookie(cookie); 12 | if (!railsSession.signin_person_id) { 13 | this.sessionId = null; 14 | return; 15 | } 16 | this.sessionId = railsSession.session_id; 17 | this.firstPacket._myapp_session = railsSession; 18 | }, 19 | 20 | identifyUser: function () { 21 | var resp = this.httpGet(this.siteUrl); 22 | this.userName = resp.body.querySelector('.welcome_message').textContent.replace('Welcome,', '').trim(); 23 | } 24 | }); -------------------------------------------------------------------------------- /xpi/handlers/wordpress.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Eric Butler 3 | 4 | register({ 5 | name: 'Wordpress', 6 | 7 | matchPacket: function (packet) { 8 | for (var cookieName in packet.cookies) { 9 | if (cookieName.match(/^wordpress_[0-9a-fA-F]{32}$/)) { 10 | return true; 11 | } 12 | } 13 | }, 14 | 15 | processPacket: function () { 16 | this.siteUrl += 'wp-admin/'; 17 | 18 | for (var cookieName in this.firstPacket.cookies) { 19 | if (cookieName.match(/^wordpress_[0-9a-fA-F]{32}$/)) { 20 | this.sessionId = this.firstPacket.cookies[cookieName]; 21 | break; 22 | } 23 | } 24 | }, 25 | 26 | identifyUser: function () { 27 | var resp = this.httpGet(this.siteUrl); 28 | this.userName = resp.body.querySelectorAll('#user_info a')[0].textContent; 29 | this.siteName = 'Wordpress (' + this.firstPacket.host + ')'; 30 | } 31 | }); 32 | -------------------------------------------------------------------------------- /mozpopen/mozpopen.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mozpopen", "mozpopen.vcproj", "{92B3BEF2-3BEE-4B1B-9CF4-327497ED73DF}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {92B3BEF2-3BEE-4B1B-9CF4-327497ED73DF}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {92B3BEF2-3BEE-4B1B-9CF4-327497ED73DF}.Debug|Win32.Build.0 = Debug|Win32 14 | {92B3BEF2-3BEE-4B1B-9CF4-327497ED73DF}.Release|Win32.ActiveCfg = Release|Win32 15 | {92B3BEF2-3BEE-4B1B-9CF4-327497ED73DF}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /xpi/handlers/basecamp.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Eric Butler 3 | register({ 4 | name: 'Basecamp', 5 | domains: [ 'basecamphq.com' ], 6 | sessionCookieNames: [ "_basecamp_session", "session_token" ], 7 | 8 | processPacket: function () { 9 | this.siteUrl = 'http://' + this.firstPacket.host; 10 | this.siteName = 'Basecamp (' + this.firstPacket.host.split('.')[0] + ')'; 11 | 12 | var cookie = this.firstPacket.cookies['_basecamp_session']; 13 | var railsSession = RailsHelper.parseSessionCookie(cookie); 14 | if (!railsSession.user_id) { 15 | this.sessionId = null; 16 | return; 17 | } 18 | this.sessionId = railsSession.session_id; 19 | this.firstPacket._basecamp_session = railsSession; 20 | }, 21 | 22 | identifyUser: function () { 23 | var resp = this.httpGet(this.siteUrl + '/identity/edit'); 24 | this.userName = resp.body.querySelector('#settings_signout_and_help .name').textContent; 25 | } 26 | }); -------------------------------------------------------------------------------- /xpi/handlers/harvest.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Eric Butler 3 | register({ 4 | name: 'Harvest', 5 | domains: [ 'harvestapp.com' ], 6 | sessionCookieNames: [ '_enc_sess' ], 7 | 8 | processPacket: function () { 9 | this.siteUrl = 'http://' + this.firstPacket.host; 10 | 11 | var cookie = this.firstPacket.cookies['_enc_sess']; 12 | var railsSession = RailsHelper.parseSessionCookie(cookie); 13 | if (!railsSession.user_id) { 14 | this.sessionId = null; 15 | return; 16 | } 17 | this.sessionId = railsSession.session_id; 18 | this.firstPacket._enc_sess = railsSession; 19 | }, 20 | 21 | identifyUser: function () { 22 | var resp = this.httpGet(this.siteUrl); 23 | var user = resp.body.querySelector("#login-info").firstChild.textContent.trim(); 24 | var company = resp.body.querySelector('#company-name').textContent.trim(); 25 | this.userName = user; 26 | this.siteName = 'Harvest (' + company + ')'; 27 | } 28 | }); -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /xpi/handlers/foursquare.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Eric Butler 3 | register({ 4 | name: 'Foursquare', 5 | url: 'http://foursquare.com/', 6 | domains: [ 'foursquare.com' ], 7 | sessionCookieNames: [ 'ext_id', 'XSESSIONID' ], 8 | 9 | processPacket: function () { 10 | var cookie = this.firstPacket.cookies['ext_id']; 11 | this.sessionId = cookie; 12 | }, 13 | 14 | identifyUser: function () { 15 | var resp = this.httpGet(this.siteUrl); 16 | var path = resp.request.channel.URI.path; 17 | var userId = path.split('/')[2]; 18 | 19 | // Maybe this is useful for something in the future..? 20 | this.userId = userId; 21 | 22 | // Get image object for user avatar (contains their name, too!) 23 | var user_img = resp.body.querySelector('.withImage img'); 24 | this.userName = user_img.alt; 25 | this.userAvatar = user_img.src; 26 | if (this.userAvatar.substr(0, 4) != 'http') { 27 | this.userAvatar = 'http://foursquare.com/' + this.userAvatar; 28 | } 29 | }, 30 | }); 31 | -------------------------------------------------------------------------------- /xpi/chrome/skin/sidebar-osx.css: -------------------------------------------------------------------------------- 1 | firesheepSidebar { 2 | -moz-appearance: none; 3 | background: transparent; 4 | } 5 | 6 | #firesheepSidebar #toolbar { 7 | background: -moz-linear-gradient(top, #EDEDED, #D8D8D8); 8 | border-bottom: 1px solid #B8B8B8; 9 | } 10 | 11 | #firesheepSidebar #toolbar button { 12 | -moz-appearance: none; 13 | border: 1px solid #7F7F7F; 14 | -moz-border-radius: 10px; 15 | background: -moz-linear-gradient(top, #FFF, #BBB); 16 | min-width: 0px; 17 | min-height: 0px; 18 | -moz-padding-start: 5px; 19 | -moz-padding-end: 5px; 20 | margin: 0; 21 | padding: 2px 0; 22 | } 23 | 24 | #firesheepSidebar #toolbar button:active { 25 | background: -moz-linear-gradient(top, #BBB, #FFF); 26 | } 27 | 28 | #firesheepSidebar richlistbox { 29 | background: transparent; 30 | } 31 | 32 | #bottombar { 33 | background: white url(chrome://firesheep/skin/bottombar_bg.png) repeat-x; 34 | border-top: 0 !important; 35 | } 36 | 37 | #bottombar button { 38 | } 39 | 40 | #splitterHandle { 41 | background: url(chrome://firesheep/skin/bottombar_handle.png) no-repeat; 42 | min-width: 15px; 43 | max-width: 15px; 44 | display: block !important; 45 | } -------------------------------------------------------------------------------- /xpi/handlers/google.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Ian Gallagher 3 | register({ 4 | name: 'Google', 5 | url: 'http://www.google.com/', 6 | domains: [ 'google.com' ], 7 | sessionCookieNames: [ 'SID', 'NID', 'HSID', 'PREF' ], 8 | 9 | processPacket: function () { 10 | var hsid = this.firstPacket.cookies['HSID']; 11 | this.sessionId = hsid; 12 | }, 13 | 14 | identifyUser: function() { 15 | var resp = this.httpGet(this.siteUrl); 16 | this.userName = resp.body.querySelector(".gb4").textContent; 17 | 18 | // Grab avatar from Google Profiles page, if they have one 19 | var avatar_element; 20 | try { 21 | var profile = this.httpGet('http://www.google.com/profiles/me'); 22 | avatar_element = profile.body.querySelector('.ll_profilephoto.photo'); 23 | } 24 | catch(err) { 25 | // They likley don't have a profile setup, no avatar for us :( 26 | avatar_element = null; 27 | } 28 | 29 | if (avatar_element) { 30 | this.userAvatar = avatar_element.src; 31 | if (this.userAvatar.substr(0, 4) != 'http') { 32 | this.userAvatar = 'http://www.google.com' + this.userAvatar; 33 | } 34 | } 35 | } 36 | }); 37 | -------------------------------------------------------------------------------- /xpi/defaults/preferences/prefs.js: -------------------------------------------------------------------------------- 1 | // 2 | // prefs.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 | pref("firesheep.capture_interface", ""); 24 | pref("firesheep.capture_filter", "tcp port 80"); 25 | pref("firesheep.first_run", true); 26 | 27 | // https://developer.mozilla.org/en/Localizing_extension_descriptions 28 | pref("extensions.firesheep@codebutler.com.description", "chrome://firesheep/locale/overlay.properties"); -------------------------------------------------------------------------------- /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 | class OSXPlatform : public UnixPlatform { 30 | public: 31 | OSXPlatform(vector); 32 | bool run_privileged(); 33 | vector interfaces(); 34 | }; 35 | 36 | #endif -------------------------------------------------------------------------------- /mozpopen/Makefile.am: -------------------------------------------------------------------------------- 1 | DEST = $(top_builddir)/xpi/components 2 | 3 | if PLATFORM_WIN32 4 | PLAT_DEST = $(top_builddir)/xpi/platform/WINNT_x86-msvc/components 5 | 6 | all: vcbuild 7 | 8 | vcbuild: 9 | mkdir -p $(DEST) 10 | mkdir -p $(PLAT_DEST) 11 | "/cygdrive/c/Program Files/Microsoft Visual Studio 8/VC/vcpackages/vcbuild.exe" /r mozpopen.vcproj debug 12 | 13 | clean: 14 | "/cygdrive/c/Program Files/Microsoft Visual Studio 8/VC/vcpackages/vcbuild.exe" /c mozpopen.vcproj debug 15 | 16 | .PHONY: vcbuild 17 | endif 18 | if PLATFORM_OSX 19 | SOURCES = MozPopenModule.cpp unix/MozPopenProcess.cpp 20 | PLAT_DEST = $(top_builddir)/xpi/platform/Darwin_x86-gcc3/components 21 | CFLAGS += -Iunix/ -I. 22 | COMPONENT_NAME = MozPopen 23 | XPT = $(DEST)/$(COMPONENT_NAME).xpt 24 | LIB = $(PLAT_DEST)/$(COMPONENT_NAME).dylib 25 | 26 | all: $(XPT) $(COMPONENT_NAME).h $(LIB) 27 | 28 | $(COMPONENT_NAME).h: $(COMPONENT_NAME).idl 29 | $(XPIDL) -m header $(XPIDL_FLAGS) -e $@ $(COMPONENT_NAME).idl 30 | 31 | $(XPT): $(COMPONENT_NAME).idl 32 | mkdir -p $(DEST) 33 | $(XPIDL) -m typelib $(XPIDL_FLAGS) -e $@ $(COMPONENT_NAME).idl 34 | 35 | $(LIB): $(SOURCES) 36 | mkdir -p $(PLAT_DEST) 37 | $(CXX) -shared -fno-rtti -fPIC $(SOURCES) $(CFLAGS) $(MOZ_CFLAGS) $(MOZ_LIBS) -o $@ 38 | 39 | clean: 40 | rm -f $(COMPONENT).xpt $(COMPONENT).dylib 41 | endif 42 | -------------------------------------------------------------------------------- /mozpopen/MozPopenModule.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * MozPopenModule.cpp 3 | * 4 | * Authors: 5 | * Eric Butler 6 | * 7 | * This file is part of Firesheep. 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | * 22 | */ 23 | 24 | #include "nsIGenericFactory.h" 25 | #include "nsIModule.h" 26 | #include "MozPopen.h" 27 | #include "MozPopenProcess.h" 28 | 29 | NS_GENERIC_FACTORY_CONSTRUCTOR(MozPopenProcess) 30 | 31 | static const nsModuleComponentInfo components[] = 32 | { 33 | { 34 | MOZPOPEN_PROCESS_CLASSNAME, 35 | MOZPOPEN_PROCESS_CID, 36 | MOZPOPEN_PROCESS_CONTRACTID, 37 | MozPopenProcessConstructor 38 | } 39 | }; 40 | 41 | NS_IMPL_NSGETMODULE(MozPopenModule, components) -------------------------------------------------------------------------------- /mozpopen/MozPopen.idl: -------------------------------------------------------------------------------- 1 | /* 2 | * MozPopen.idl 3 | * 4 | * Authors: 5 | * Eric Butler 6 | * 7 | * This file is part of Firesheep. 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | * 22 | */ 23 | 24 | #include "nsISupports.idl" 25 | #include "nsIArray.idl" 26 | 27 | [scriptable, uuid(3b066efc-b07f-481e-9dd5-7330fa914eb1)] 28 | interface IMozPopenProcess : nsISupports 29 | { 30 | void Init(in string exec, 31 | [array, size_is(argCount)] in string args, 32 | in unsigned long argCount); 33 | 34 | void Start(); 35 | void Stop(); 36 | boolean IsRunning(); 37 | PRUint16 Wait(); 38 | AUTF8String ReadOutputLine(); 39 | AUTF8String ReadErrorLine(); 40 | }; -------------------------------------------------------------------------------- /xpi/handlers/twitter.js: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Eric Butler 3 | Components.utils.import('resource://firesheep/util/RailsHelper.js'); 4 | 5 | register({ 6 | name: 'Twitter', 7 | domains: [ 'twitter.com' ], 8 | sessionCookieNames: [ '_twitter_sess', 'auth_token' ], 9 | 10 | processPacket: function () { 11 | var cookie = this.firstPacket.cookies['_twitter_sess']; 12 | 13 | var railsSession = RailsHelper.parseSessionCookie(cookie); 14 | 15 | // A Twitter session cookie contains information other than just user id, 16 | // and is constantly changing. Override ID to include only user info, 17 | // avoiding duplicate results for the same person. 18 | this.sessionId = railsSession.user + railsSession.password_token; 19 | 20 | // Store around for debugging purposes. 21 | this.firstPacket._twitter_sess = railsSession; 22 | }, 23 | 24 | identifyUser: function () { 25 | var resp = this.httpGet(this.siteUrl); 26 | if (resp.body.querySelector('#me_name')) { 27 | // Old Twitter 28 | this.userName = resp.body.querySelector('#me_name').innerHTML; 29 | this.userAvatar = resp.body.querySelector('.user_icon img').src; 30 | } else { 31 | // New Twitter 32 | this.userName = resp.body.querySelector('#screen-name').innerHTML.replace(/^\s+|\s+$/g, ""); 33 | this.userAvatar = resp.body.querySelector('#profile-image img').src; 34 | } 35 | } 36 | }); -------------------------------------------------------------------------------- /xpi/modules/util/RailsHelper.js: -------------------------------------------------------------------------------- 1 | // 2 | // RailsHelper.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/Base64.js'); 24 | Components.utils.import('resource://firesheep/util/RubyMarshal.js'); 25 | 26 | var EXPORTED_SYMBOLS = [ 'RailsHelper' ]; 27 | 28 | var RailsHelper = { 29 | parseSessionCookie: function (cookieValue) { 30 | cookieValue = unescape(cookieValue.replace('+', ' ')); 31 | var data = cookieValue.split('--')[0]; 32 | data = unescape(unescape(data)); 33 | data = data.replace(/\n/g, ''); 34 | data = Base64.decode(data); 35 | 36 | var rubyMarshal = new RubyMarshal(); 37 | return rubyMarshal.load(data); 38 | } 39 | }; -------------------------------------------------------------------------------- /xpi/install.rdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | firesheep@codebutler.com 5 | 2 6 | Firesheep 7 | 0.1 8 | Eric Butler 9 | 10 | chrome://firesheep/content/about.xul 11 | chrome://firesheep/content/preferences/prefsWindow.xul 12 | http://codebutler.github.com/firesheep 13 | http://codebutler.github.com/firesheep/update.rdf 14 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx0jVpi2A7WnvIDJlqYFlSk+9Ny6ccmRSFShlcpmjqfEGYDJFNLnXERSHhNGIVYArBhHkunwWyZJ4Es4kUZ6BGE0IbEIPhJPgD18DCdgRwFL+ts9sn+2DWxd0KrU62P9phCNcsvrlL+G+O/znSoBYDeiMS0OrGN5HcftwdReHaMQIDAQAB 15 | true 16 | Darwin_x86-gcc3 17 | WINNT_x86-msvc 18 | 19 | 20 | {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 21 | 3.6.10 22 | 3.6.* 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /backend/Makefile.am: -------------------------------------------------------------------------------- 1 | SOURCES = \ 2 | src/main.cpp \ 3 | src/http_sniffer.cpp \ 4 | src/http_packet.cpp \ 5 | deps/http-parser/http_parser.c 6 | 7 | CFLAGS += \ 8 | -DHAVE_STDARG_H \ 9 | -Wall \ 10 | -include src/config.h \ 11 | -g 12 | 13 | INCLUDES = \ 14 | -I deps/ \ 15 | -I deps/http-parser \ 16 | -I deps/json_spirit 17 | 18 | if PLATFORM_OSX 19 | SOURCES += src/osx_platform.cpp 20 | CFLAGS += -DPLATFORM_OSX 21 | CFLAGS += -framework Security 22 | CFLAGS += -framework SystemConfiguration 23 | CFLAGS += -framework CoreFoundation 24 | CFLAGS += -I/usr/local/include 25 | LIBS += -lpcap 26 | DEST = $(top_builddir)/xpi/platform/Darwin_x86-gcc3 27 | endif 28 | if PLATFORM_WIN32 29 | SOURCES += src/windows_platform.cpp 30 | CFLAGS += -DPLATFORM_WIN32 31 | CFLAGS += -I"/c/Program Files/boost/boost_1_44" 32 | CFLAGS += -I"deps/winpcap/include" 33 | CFLAGS += -L"deps/winpcap/lib" 34 | LIBS += -lwpcap 35 | DEST = $(top_builddir)/xpi/platform/WINNT_x86-msvc 36 | endif 37 | 38 | TARGET = $(DEST)/firesheep-backend 39 | 40 | all: $(TARGET) 41 | 42 | $(TARGET): $(SOURCES) Makefile 43 | mkdir -p $(DEST) 44 | rm -f $@ 45 | $(CXX) $(CFLAGS) $(INCLUDES) $(LIBS) -o $@ $(SOURCES) 46 | 47 | if PLATFORM_WIN32 48 | cp -f `which cygwin1.dll` $(DEST) 49 | cp -f `which cygstdc++-6.dll` $(DEST) 50 | cp -f `which cyggcc_s-1.dll` $(DEST) 51 | endif 52 | 53 | clean: 54 | rm -f $(TARGET) 55 | -------------------------------------------------------------------------------- /mozpopen/win32/boost/process/config.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Boost.Process 3 | // ~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2006, 2007 Julio M. Merino Vidal 6 | // Copyright (c) 2008, 2009 Boris Schaeling 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | /** 13 | * \file boost/process/config.hpp 14 | * 15 | * Defines macros that are used by the library's code to determine the 16 | * operating system it is running under and the features it supports. 17 | */ 18 | 19 | #ifndef BOOST_PROCESS_CONFIG_HPP 20 | #define BOOST_PROCESS_CONFIG_HPP 21 | 22 | #include 23 | #include 24 | 25 | #if defined(BOOST_POSIX_API) || defined(BOOST_PROCESS_DOXYGEN) 26 | # if !defined(BOOST_PROCESS_POSIX_PATH_MAX) 27 | /** 28 | * The macro BOOST_PROCESS_POSIX_PATH_MAX is set to a positive integer 29 | * value which specifies the system's maximal supported path length. 30 | * By default it is set to 259. You should set the macro to PATH_MAX 31 | * which should be defined in limits.h provided by your operating system 32 | * if you experience problems when instantiating a context. The 33 | * constructor of basic_work_directory_context tries to find out 34 | * dynamically the maximal supported path length but uses 35 | * BOOST_PROCESS_POSIX_PATH_MAX if it fails. 36 | */ 37 | # define BOOST_PROCESS_POSIX_PATH_MAX 259 38 | # endif 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /xpi/chrome/skin/sidebar.css: -------------------------------------------------------------------------------- 1 | #firesheepSidebar #toolbar { 2 | padding: 6px; 3 | border-bottom: 1px solid threedshadow; 4 | } 5 | 6 | #firesheepSidebar richlistbox { 7 | margin: 0; 8 | -moz-appearance: none; 9 | } 10 | 11 | #detailsTree { 12 | -moz-appearance: none; 13 | margin: 0; 14 | border: 0; 15 | height: 150px; 16 | } 17 | 18 | #detailsTree treechildren::-moz-tree-cell-text(nullValue) { 19 | color: #333; 20 | font-style: italic; 21 | } 22 | 23 | #detailsTree treechildren::-moz-tree-cell-text(nullValue, selected) { 24 | color: white; 25 | } 26 | 27 | splitter { 28 | -moz-appearance: none; 29 | min-height: 0; 30 | height: 1px; 31 | background: #B4B4B4; 32 | } 33 | 34 | #bottombar { 35 | border-top: 1px solid threedshadow; 36 | } 37 | 38 | #bottombar button { 39 | -moz-appearance: none; 40 | border: 0; 41 | padding: 0; 42 | margin: 0px 0 0 -1px !important; 43 | min-height: 23px; 44 | max-height: 23px; 45 | } 46 | 47 | #toggleDetailsButton { 48 | background: url(chrome://firesheep/skin/details_button.png); 49 | min-width: 33px; 50 | max-width: 33px; 51 | } 52 | 53 | #toggleDetailsButton:active { 54 | background: url(chrome://firesheep/skin/details_button_pressed.png); 55 | } 56 | 57 | #showMenuButton { 58 | background: url(chrome://firesheep/skin/menu_button.png); 59 | min-width: 32px; 60 | max-width: 32px; 61 | } 62 | 63 | #showMenuButton:active { 64 | background: url(chrome://firesheep/skin/menu_button_pressed.png); 65 | } 66 | 67 | #splitterHandle { 68 | display: none !important; 69 | } -------------------------------------------------------------------------------- /xpi/chrome/content/preferences/websiteEditor.xul: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 27 | 28 | 29 | ; 88 | doc.appendChild(script); 89 | } 90 | 91 | Utils.writeAllText(this.configFile, doc.toXMLString()); 92 | 93 | if (this._isLoaded) 94 | Observers.notify('FiresheepConfig', { action: 'scripts_changed' }); 95 | } 96 | }; -------------------------------------------------------------------------------- /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/src/tcpip.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | /* default snap length (maximum bytes per packet to capture) */ 6 | #define SNAP_LEN 1518 7 | 8 | /* ethernet headers are always exactly 14 bytes [1] */ 9 | #define SIZE_ETHERNET 14 10 | 11 | /* Ethernet addresses are 6 bytes */ 12 | #define ETHER_ADDR_LEN 6 13 | 14 | /* Ethernet header */ 15 | struct sniff_ethernet { 16 | u_char ether_dhost[ETHER_ADDR_LEN]; /* destination host address */ 17 | u_char ether_shost[ETHER_ADDR_LEN]; /* source host address */ 18 | u_short ether_type; /* IP? ARP? RARP? etc */ 19 | }; 20 | 21 | #define ETHERTYPE_IP 0x0800 /* IP protocol */ 22 | #define ETHERTYPE_IPV6 0x86dd /* IPv6 */ 23 | 24 | /* IP header */ 25 | struct sniff_ip { 26 | u_char ip_vhl; /* version << 4 | header length >> 2 */ 27 | u_char ip_tos; /* type of service */ 28 | u_short ip_len; /* total length */ 29 | u_short ip_id; /* identification */ 30 | u_short ip_off; /* fragment offset field */ 31 | #define IP_RF 0x8000 /* reserved fragment flag */ 32 | #define IP_DF 0x4000 /* dont fragment flag */ 33 | #define IP_MF 0x2000 /* more fragments flag */ 34 | #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ 35 | u_char ip_ttl; /* time to live */ 36 | u_char ip_p; /* protocol */ 37 | u_short ip_sum; /* checksum */ 38 | struct in_addr ip_src,ip_dst; /* source and dest address */ 39 | }; 40 | #define IP_HL(ip) (((ip)->ip_vhl) & 0x0f) 41 | #define IP_V(ip) (((ip)->ip_vhl) >> 4) 42 | 43 | struct sniff_ip6 { 44 | union { 45 | struct ip6_hdrctl { 46 | u_int32_t ip6_un1_flow; // 20 bits of flow-ID 47 | u_int16_t ip6_un1_plen; // payload length 48 | u_int8_t ip6_un1_nxt; // next header 49 | u_int8_t ip6_un1_hlim; // hop limit 50 | } ip6_un1; 51 | u_int8_t ip6_un2_vfc; // 4 bits version, top 4 bits class 52 | } ip6_ctlun; 53 | struct in6_addr ip6_src; // source address 54 | struct in6_addr ip6_dst; // destination address 55 | }; 56 | 57 | #define ip6_vfc ip6_ctlun.ip6_un2_vfc 58 | #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow 59 | #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen 60 | #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt 61 | #define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim 62 | #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim 63 | 64 | /* TCP header */ 65 | typedef u_int tcp_seq; 66 | 67 | struct sniff_tcp { 68 | u_short th_sport; /* source port */ 69 | u_short th_dport; /* destination port */ 70 | tcp_seq th_seq; /* sequence number */ 71 | tcp_seq th_ack; /* acknowledgement number */ 72 | u_char th_offx2; /* data offset, rsvd */ 73 | #define TH_OFF(th) (((th)->th_offx2 & 0xf0) >> 4) 74 | u_char th_flags; 75 | #define TH_FIN 0x01 76 | #define TH_SYN 0x02 77 | #define TH_RST 0x04 78 | #define TH_PUSH 0x08 79 | #define TH_ACK 0x10 80 | #define TH_URG 0x20 81 | #define TH_ECE 0x40 82 | #define TH_CWR 0x80 83 | #define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR) 84 | u_short th_win; /* window */ 85 | u_short th_sum; /* checksum */ 86 | u_short th_urp; /* urgent pointer */ 87 | }; -------------------------------------------------------------------------------- /backend/src/unix_platform.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // osx_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 | #include 33 | #include 34 | #include 35 | #include "abstract_platform.hpp" 36 | #include "interface_info.hpp" 37 | 38 | using namespace std; 39 | 40 | // r-sr-xr-x 41 | static const mode_t MODE = S_IFREG | S_ISUID | S_IRUSR | S_IXUSR | 42 | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; 43 | 44 | class UnixPlatform : public AbstractPlatform 45 | { 46 | public: 47 | UnixPlatform(vector args) 48 | : m_args(args) 49 | { 50 | char path[PATH_MAX]; 51 | if (!realpath(args[0].c_str(), path)) 52 | throw runtime_error(str(boost::format("realpath() failed: %d\n") % errno)); 53 | 54 | m_path = string(path); 55 | } 56 | 57 | bool is_root() 58 | { 59 | return geteuid() == 0; 60 | } 61 | 62 | bool check_permissions() { 63 | int err; 64 | struct stat file_stat; 65 | 66 | err = stat(m_path.c_str(), &file_stat); 67 | if (err == -1) 68 | throw runtime_error("stat() failed"); 69 | 70 | return (file_stat.st_mode == MODE); 71 | } 72 | 73 | void fix_permissions() { 74 | int err; 75 | int fd; 76 | 77 | const char *path = m_path.c_str(); 78 | 79 | // Open the file. 80 | fd = open(path, O_RDONLY, 0); 81 | if (fd < 0) 82 | throw runtime_error(str(boost::format("fix_permissions: open() failed: %d.") % errno)); 83 | 84 | // Ensure file is owned by root. 85 | err = fchown(fd, 0, -1); 86 | if (err == -1) 87 | throw runtime_error(str(boost::format("fix_permissions: fchown() failed: %d.") % errno)); 88 | 89 | // Ensure setuid bit is enabled. 90 | err = fchmod(fd, MODE); 91 | if (err == -1) 92 | throw runtime_error(str(boost::format("fix_permissions: fchmod() failed: %d.") % errno)); 93 | 94 | // Close file. 95 | err = close(fd); 96 | if (err == -1) 97 | throw runtime_error(str(boost::format("fix_permissions: close() failed: %d.") % errno)); 98 | } 99 | 100 | virtual bool run_privileged() = 0; 101 | virtual vector interfaces() = 0; 102 | 103 | protected: 104 | string path() { 105 | return m_path; 106 | } 107 | 108 | private: 109 | string m_path; 110 | vector m_args; 111 | }; 112 | 113 | #endif -------------------------------------------------------------------------------- /mozpopen/win32/MozPopenProcess.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * MozPopenProcess.cpp 3 | * 4 | * Authors: 5 | * Eric Butler 6 | * 7 | * This file is part of Firesheep. 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | * 22 | */ 23 | 24 | #include "nsStringAPI.h" 25 | #include "MozPopen.h" 26 | #include "MozPopenProcess.h" 27 | 28 | NS_IMPL_ISUPPORTS1(MozPopenProcess, IMozPopenProcess) 29 | 30 | MozPopenProcess::MozPopenProcess() 31 | : mIsRunning(false) 32 | { 33 | } 34 | 35 | NS_IMETHODIMP 36 | MozPopenProcess::Init(const char* exec, const char **args, PRUint32 argCount) 37 | { 38 | try { 39 | mExec = std::string(exec); 40 | mArgs = std::vector(args, args + argCount); 41 | mArgs.insert(mArgs.begin(), exec); 42 | return NS_OK; 43 | } catch (...) { 44 | return NS_ERROR_FAILURE; 45 | } 46 | } 47 | 48 | MozPopenProcess::~MozPopenProcess() { } 49 | 50 | NS_IMETHODIMP 51 | MozPopenProcess::Start() 52 | { 53 | try { 54 | mContext.stdout_behavior = boost::process::capture_stream(); 55 | mContext.stderr_behavior = boost::process::capture_stream(); 56 | mChild = boost::process::launch(mExec, mArgs, mContext); 57 | 58 | mIsRunning = true; 59 | 60 | return NS_OK; 61 | } catch (...) { 62 | return NS_ERROR_FAILURE; 63 | } 64 | } 65 | 66 | NS_IMETHODIMP 67 | MozPopenProcess::Stop() 68 | { 69 | if (!mIsRunning) 70 | return NS_OK; 71 | 72 | try { 73 | mChild.terminate(); 74 | mIsRunning = !mChild.wait().exited(); 75 | return NS_OK; 76 | } catch (...) { 77 | return NS_ERROR_FAILURE; 78 | } 79 | } 80 | 81 | NS_IMETHODIMP 82 | MozPopenProcess::IsRunning(PRBool *_retval) 83 | { 84 | *_retval = mIsRunning; 85 | return NS_OK; 86 | } 87 | 88 | NS_IMETHODIMP 89 | MozPopenProcess::ReadOutputLine(nsACString &aLine) 90 | { 91 | try { 92 | mChild.get_stdout().clear(); 93 | std::string line; 94 | if (std::getline(mChild.get_stdout(), line)) 95 | aLine.Assign(line.c_str(), line.size()); 96 | return NS_OK; 97 | } catch (...) { 98 | return NS_ERROR_FAILURE; 99 | } 100 | } 101 | 102 | NS_IMETHODIMP 103 | MozPopenProcess::ReadErrorLine(nsACString &aLine) 104 | { 105 | try { 106 | mChild.get_stderr().clear(); 107 | std::string line; 108 | if (std::getline(mChild.get_stderr(), line)) { 109 | aLine.Assign(line.c_str(), line.size()); 110 | } 111 | return NS_OK; 112 | } catch (...) { 113 | return NS_ERROR_FAILURE; 114 | } 115 | } 116 | 117 | NS_IMETHODIMP 118 | MozPopenProcess::Wait(PRUint16 *anInt) 119 | { 120 | try { 121 | mChild.get_stdout().close(); 122 | *anInt = mChild.wait().exit_status(); 123 | return NS_OK; 124 | } catch (...) { 125 | return NS_ERROR_FAILURE; 126 | } 127 | } -------------------------------------------------------------------------------- /mozpopen/win32/boost/process/posix_status.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Boost.Process 3 | // ~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2006, 2007 Julio M. Merino Vidal 6 | // Copyright (c) 2008, 2009 Boris Schaeling 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | /** 13 | * \file boost/process/posix_status.hpp 14 | * 15 | * Includes the declaration of the posix_status class. 16 | */ 17 | 18 | #ifndef BOOST_PROCESS_POSIX_STATUS_HPP 19 | #define BOOST_PROCESS_POSIX_STATUS_HPP 20 | 21 | #include 22 | 23 | #if defined(BOOST_POSIX_API) 24 | # include 25 | #elif defined(BOOST_WINDOWS_API) 26 | #else 27 | # error "Unsupported platform." 28 | #endif 29 | 30 | #include 31 | #include 32 | 33 | namespace boost { 34 | namespace process { 35 | 36 | /** 37 | * Status returned by a finalized %child process on a POSIX system. 38 | * 39 | * This class represents the %status returned by a child process after it 40 | * has terminated. It contains some methods not available in the status 41 | * class that provide information only available in POSIX systems. 42 | */ 43 | class posix_status : public status 44 | { 45 | public: 46 | /** 47 | * Creates a posix_status object from an existing status object. 48 | * 49 | * Creates a new status object representing the exit status of a 50 | * child process. The construction is done based on an existing 51 | * status object which already contains all the available 52 | * information: this class only provides controlled access to it. 53 | */ 54 | posix_status(const status &s) 55 | : status(s) 56 | { 57 | } 58 | 59 | /** 60 | * Returns whether the process exited due to an external 61 | * signal. 62 | */ 63 | bool signaled() const 64 | { 65 | return WIFSIGNALED(flags_); 66 | } 67 | 68 | /** 69 | * If signaled, returns the terminating signal code. 70 | * 71 | * If the process was signaled, returns the terminating signal code. 72 | * 73 | * \pre signaled() is true. 74 | */ 75 | int term_signal() const 76 | { 77 | BOOST_ASSERT(signaled()); 78 | 79 | return WTERMSIG(flags_); 80 | } 81 | 82 | /** 83 | * If signaled, returns whether the process dumped core. 84 | * 85 | * If the process was signaled, returns whether the process 86 | * produced a core dump. 87 | * 88 | * \pre signaled() is true. 89 | */ 90 | bool dumped_core() const 91 | { 92 | BOOST_ASSERT(signaled()); 93 | 94 | #ifdef WCOREDUMP 95 | return WCOREDUMP(flags_); 96 | #else 97 | return false; 98 | #endif 99 | } 100 | 101 | /** 102 | * Returns whether the process was stopped by an external 103 | * signal. 104 | */ 105 | bool stopped() const 106 | { 107 | return WIFSTOPPED(flags_); 108 | } 109 | 110 | /** 111 | * If stopped, returns the stop signal code. 112 | * 113 | * If the process was stopped, returns the stop signal code. 114 | * 115 | * \pre stopped() is true. 116 | */ 117 | int stop_signal() const 118 | { 119 | BOOST_ASSERT(stopped()); 120 | 121 | return WSTOPSIG(flags_); 122 | } 123 | }; 124 | 125 | } 126 | } 127 | 128 | #endif 129 | -------------------------------------------------------------------------------- /mozpopen/win32/boost/process/posix_context.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Boost.Process 3 | // ~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2006, 2007 Julio M. Merino Vidal 6 | // Copyright (c) 2008, 2009 Boris Schaeling 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | /** 13 | * \file boost/process/posix_context.hpp 14 | * 15 | * Includes the declaration of the posix_context class. 16 | */ 17 | 18 | #ifndef BOOST_PROCESS_POSIX_CONTEXT_HPP 19 | #define BOOST_PROCESS_POSIX_CONTEXT_HPP 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace boost { 28 | namespace process { 29 | 30 | /** 31 | * Holds a mapping between native file descriptors and their corresponding 32 | * pipes to set up communication between the parent and the %child process. 33 | */ 34 | typedef std::map behavior_map; 35 | 36 | template 37 | class posix_basic_context : public basic_work_directory_context, public environment_context 38 | { 39 | public: 40 | /** 41 | * Constructs a new POSIX-specific context. 42 | * 43 | * Constructs a new context. It is configured as follows: 44 | * * All communcation channels with the child process are closed. 45 | * * There are no channel mergings. 46 | * * The initial work directory of the child processes is set to the 47 | * current working directory. 48 | * * The environment variables table is empty. 49 | * * The credentials are the same as those of the current process. 50 | */ 51 | posix_basic_context() 52 | : uid(::getuid()), 53 | euid(::geteuid()), 54 | gid(::getgid()), 55 | egid(::getegid()) 56 | { 57 | } 58 | 59 | /** 60 | * List of input streams that will be redirected. 61 | */ 62 | behavior_map input_behavior; 63 | 64 | /** 65 | * List of output streams that will be redirected. 66 | */ 67 | behavior_map output_behavior; 68 | 69 | /** 70 | * The user credentials. 71 | * 72 | * UID that specifies the user credentials to use to run the %child 73 | * process. Defaults to the current UID. 74 | */ 75 | uid_t uid; 76 | 77 | /** 78 | * The effective user credentials. 79 | * 80 | * EUID that specifies the effective user credentials to use to run 81 | * the %child process. Defaults to the current EUID. 82 | */ 83 | uid_t euid; 84 | 85 | /** 86 | * The group credentials. 87 | * 88 | * GID that specifies the group credentials to use to run the %child 89 | * process. Defaults to the current GID. 90 | */ 91 | gid_t gid; 92 | 93 | /** 94 | * The effective group credentials. 95 | * 96 | * EGID that specifies the effective group credentials to use to run 97 | * the %child process. Defaults to the current EGID. 98 | */ 99 | gid_t egid; 100 | 101 | /** 102 | * The chroot directory, if any. 103 | * 104 | * Specifies the directory in which the %child process is chrooted 105 | * before execution. Empty if this feature is not desired. 106 | */ 107 | Path chroot; 108 | }; 109 | 110 | /** 111 | * Default instantiation of posix_basic_context. 112 | */ 113 | typedef posix_basic_context posix_context; 114 | 115 | } 116 | } 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /xpi/modules/FiresheepSession.js: -------------------------------------------------------------------------------- 1 | // 2 | // FiresheepSession.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/util/Utils.js'); 25 | Components.utils.import('resource://firesheep/FiresheepWorker.js'); 26 | 27 | var EXPORTED_SYMBOLS = [ 'FiresheepSession' ]; 28 | 29 | function FiresheepSession (fs, iface, filter) { 30 | this._core = fs; 31 | this._iface = iface; 32 | this._filter = filter; 33 | this._resultCache = {}; 34 | this._handlers = fs.handlers; 35 | } 36 | 37 | FiresheepSession.prototype = { 38 | start: function () { 39 | try { 40 | if (this.isCapturing) 41 | return; 42 | 43 | // Ensure the binary is actually executable. 44 | var osString = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS; 45 | if (osString != 'WINNT') { 46 | // FIXME: This should really use chmod(2) directly. 47 | Utils.runCommand('chmod', [ 'a+x', this._core.backendPath ]); 48 | 49 | // Tell backend to repair owner/setuid. Wil return succesfully if everything is already OK. 50 | this._process = Cc["@codebutler.com/mozpopen/process;1"].createInstance(Ci.IMozPopenProcess); 51 | this._process.Init(this._core.backendPath, [ '--fix-permissions' ], 1); 52 | this._process.Start(); 53 | var exitCode = this._process.Wait(); 54 | if (exitCode != 0) { 55 | throw "Failed to fix permissions"; 56 | } 57 | } 58 | 59 | this._process = Cc["@codebutler.com/mozpopen/process;1"].createInstance(Ci.IMozPopenProcess); 60 | this._process.Init(this._core.backendPath, [ this._iface, this._filter ], 2); 61 | this._process.Start(); 62 | if (this._process.IsRunning()) { 63 | this._thread = Cc["@mozilla.org/thread-manager;1"].getService().newThread(0); 64 | this._thread.dispatch(new FiresheepWorker(this), Ci.nsIThread.DISPATCH_NORMAL); 65 | } else { 66 | throw "Failed to start capture."; 67 | } 68 | } catch (e) { 69 | this.handleError(e); 70 | } 71 | }, 72 | 73 | stop: function () { 74 | if (!this.isCapturing) 75 | return; 76 | 77 | if (this._process.IsRunning()) 78 | this._process.Stop(); 79 | 80 | this._process = null; 81 | this._thread = null; 82 | 83 | Observers.notify('Firesheep', { action: 'capture_stopped' }); 84 | }, 85 | 86 | get isCapturing () { 87 | return !!this._process 88 | }, 89 | 90 | /* Called by worker */ 91 | postResult: function (result) { 92 | this._core._handleResult.apply(this._core, [ result ]); 93 | }, 94 | 95 | handleError: function (e) { 96 | dump('Error: ' + e + '\n'); 97 | Observers.notify('Firesheep', { action: 'error', error: e }); 98 | this.stop(); 99 | } 100 | }; 101 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mozpopen/win32/boost/process/self.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Boost.Process 3 | // ~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2006, 2007 Julio M. Merino Vidal 6 | // Copyright (c) 2008, 2009 Boris Schaeling 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | /** 13 | * \file boost/process/self.hpp 14 | * 15 | * Includes the declaration of the self class. 16 | */ 17 | 18 | #ifndef BOOST_PROCESS_SELF_HPP 19 | #define BOOST_PROCESS_SELF_HPP 20 | 21 | #include 22 | 23 | #if defined(BOOST_POSIX_API) 24 | # include 25 | #elif defined(BOOST_WINDOWS_API) 26 | # include 27 | #else 28 | # error "Unsupported platform." 29 | #endif 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #if defined(BOOST_POSIX_API) 39 | extern "C" 40 | { 41 | extern char **environ; 42 | } 43 | #endif 44 | 45 | namespace boost { 46 | namespace process { 47 | 48 | /** 49 | * Generic implementation of the Process concept. 50 | * 51 | * The self singleton provides access to the current process. 52 | */ 53 | class self : public process, boost::noncopyable 54 | { 55 | public: 56 | /** 57 | * Returns the self instance representing the caller's process. 58 | */ 59 | static self &get_instance() 60 | { 61 | static self *instance = 0; 62 | if (!instance) 63 | instance = new self; 64 | return *instance; 65 | } 66 | 67 | /** 68 | * Returns the current environment. 69 | * 70 | * Returns the current process' environment variables. Modifying the 71 | * returned object has no effect on the current environment. 72 | */ 73 | static environment get_environment() 74 | { 75 | environment e; 76 | 77 | #if defined(BOOST_POSIX_API) 78 | char **env = ::environ; 79 | while (*env) 80 | { 81 | std::string s = *env; 82 | std::string::size_type pos = s.find('='); 83 | e.insert(boost::process::environment::value_type(s.substr(0, pos), s.substr(pos + 1))); 84 | ++env; 85 | } 86 | #elif defined(BOOST_WINDOWS_API) 87 | #ifdef GetEnvironmentStrings 88 | #undef GetEnvironmentStrings 89 | #endif 90 | char *environ = ::GetEnvironmentStrings(); 91 | if (!environ) 92 | boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::self::get_environment: GetEnvironmentStrings failed")); 93 | try 94 | { 95 | char *env = environ; 96 | while (*env) 97 | { 98 | std::string s = env; 99 | std::string::size_type pos = s.find('='); 100 | e.insert(boost::process::environment::value_type(s.substr(0, pos), s.substr(pos + 1))); 101 | env += s.size() + 1; 102 | } 103 | } 104 | catch (...) 105 | { 106 | ::FreeEnvironmentStringsA(environ); 107 | throw; 108 | } 109 | ::FreeEnvironmentStringsA(environ); 110 | #endif 111 | 112 | return e; 113 | } 114 | 115 | private: 116 | /** 117 | * Constructs a new self object. 118 | * 119 | * Creates a new self object that represents the current process. 120 | */ 121 | self() : 122 | #if defined(BOOST_POSIX_API) 123 | process(::getpid()) 124 | #elif defined(BOOST_WINDOWS_API) 125 | process(::GetCurrentProcessId()) 126 | #endif 127 | { 128 | } 129 | }; 130 | 131 | } 132 | } 133 | 134 | #endif 135 | -------------------------------------------------------------------------------- /mozpopen/win32/boost/process/pistream.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Boost.Process 3 | // ~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2006, 2007 Julio M. Merino Vidal 6 | // Copyright (c) 2008, 2009 Boris Schaeling 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | /** 13 | * \file boost/process/pistream.hpp 14 | * 15 | * Includes the declaration of the pistream class. 16 | */ 17 | 18 | #ifndef BOOST_PROCESS_PISTREAM_HPP 19 | #define BOOST_PROCESS_PISTREAM_HPP 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace boost { 27 | namespace process { 28 | 29 | /** 30 | * Child process' output stream. 31 | * 32 | * The pistream class represents an output communication channel with the 33 | * child process. The child process writes data to this stream and the 34 | * parent process can read it through the pistream object. In other 35 | * words, from the child's point of view, the communication channel is an 36 | * output one, but from the parent's point of view it is an input one; 37 | * hence the confusing pistream name. 38 | * 39 | * pistream objects cannot be copied because they own the file handle 40 | * they use to communicate with the child and because they buffer data 41 | * that flows through the communication channel. 42 | * 43 | * A pistream object behaves as a std::istream stream in all senses. 44 | * The class is only provided because it must provide a method to let 45 | * the caller explicitly close the communication channel. 46 | * 47 | * \remark Blocking remarks: Functions that read data from this 48 | * stream can block if the associated file handle blocks during 49 | * the read. As this class is used to communicate with child 50 | * processes through anonymous pipes, the most typical blocking 51 | * condition happens when the child has no more data to send to 52 | * the pipe's system buffer. When this happens, the buffer 53 | * eventually empties and the system blocks until the writer 54 | * generates some data. 55 | */ 56 | class pistream : public std::istream, public boost::noncopyable 57 | { 58 | public: 59 | /** 60 | * Creates a new process' output stream. 61 | * 62 | * Given a file handle, this constructor creates a new pistream 63 | * object that owns the given file handle \a fh. Ownership of 64 | * \a fh is transferred to the created pistream object. 65 | * 66 | * \pre \a fh is valid. 67 | * \post \a fh is invalid. 68 | * \post The new pistream object owns \a fh. 69 | */ 70 | explicit pistream(detail::file_handle &fh) 71 | : std::istream(0), 72 | handle_(fh), 73 | systembuf_(handle_.get()) 74 | { 75 | rdbuf(&systembuf_); 76 | } 77 | 78 | /** 79 | * Returns the file handle managed by this stream. 80 | * 81 | * The file handle must not be copied. Copying invalidates 82 | * the source file handle making the pistream unusable. 83 | */ 84 | detail::file_handle &handle() 85 | { 86 | return handle_; 87 | } 88 | 89 | /** 90 | * Closes the file handle managed by this stream. 91 | * 92 | * Explicitly closes the file handle managed by this stream. This 93 | * function can be used by the user to tell the child process it's 94 | * not willing to receive more data. 95 | */ 96 | void close() 97 | { 98 | handle_.close(); 99 | } 100 | 101 | private: 102 | /** 103 | * The file handle managed by this stream. 104 | */ 105 | detail::file_handle handle_; 106 | 107 | /** 108 | * The systembuf object used to manage this stream's data. 109 | */ 110 | detail::systembuf systembuf_; 111 | }; 112 | 113 | } 114 | } 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /mozpopen/win32/boost/process/postream.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Boost.Process 3 | // ~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2006, 2007 Julio M. Merino Vidal 6 | // Copyright (c) 2008, 2009 Boris Schaeling 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | /** 13 | * \file boost/process/postream.hpp 14 | * 15 | * Includes the declaration of the postream class. 16 | */ 17 | 18 | #ifndef BOOST_PROCESS_POSTREAM_HPP 19 | #define BOOST_PROCESS_POSTREAM_HPP 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace boost { 27 | namespace process { 28 | 29 | /** 30 | * Child process' input stream. 31 | * 32 | * The postream class represents an input communication channel with the 33 | * child process. The child process reads data from this stream and the 34 | * parent process can write to it through the postream object. In other 35 | * words, from the child's point of view, the communication channel is an 36 | * input one, but from the parent's point of view it is an output one; 37 | * hence the confusing postream name. 38 | * 39 | * postream objects cannot be copied because they own the file handle 40 | * they use to communicate with the child and because they buffer data 41 | * that flows through the communication channel. 42 | * 43 | * A postream object behaves as a std::ostream stream in all senses. 44 | * The class is only provided because it must provide a method to let 45 | * the caller explicitly close the communication channel. 46 | * 47 | * \remark Blocking remarks: Functions that write data to this 48 | * stream can block if the associated file handle blocks during 49 | * the write. As this class is used to communicate with child 50 | * processes through anonymous pipes, the most typical blocking 51 | * condition happens when the child is not processing the data 52 | * in the pipe's system buffer. When this happens, the buffer 53 | * eventually fills up and the system blocks until the reader 54 | * consumes some data, leaving some new room. 55 | */ 56 | class postream : public std::ostream, public boost::noncopyable 57 | { 58 | public: 59 | /** 60 | * Creates a new process' input stream. 61 | * 62 | * Given a file handle, this constructor creates a new postream 63 | * object that owns the given file handle \a fh. Ownership of 64 | * \a fh is transferred to the created postream object. 65 | * 66 | * \pre \a fh is valid. 67 | * \post \a fh is invalid. 68 | * \post The new postream object owns \a fh. 69 | */ 70 | explicit postream(detail::file_handle &fh) 71 | : std::ostream(0), 72 | handle_(fh), 73 | systembuf_(handle_.get()) 74 | { 75 | rdbuf(&systembuf_); 76 | } 77 | 78 | /** 79 | * Returns the file handle managed by this stream. 80 | * 81 | * The file handle must not be copied. Copying invalidates 82 | * the source file handle making the postream unusable. 83 | */ 84 | detail::file_handle &handle() 85 | { 86 | return handle_; 87 | } 88 | 89 | /** 90 | * Closes the file handle managed by this stream. 91 | * 92 | * Explicitly closes the file handle managed by this stream. This 93 | * function can be used by the user to tell the child process there 94 | * is no more data to send. 95 | */ 96 | void close() 97 | { 98 | systembuf_.sync(); 99 | handle_.close(); 100 | } 101 | 102 | private: 103 | /** 104 | * The file handle managed by this stream. 105 | */ 106 | detail::file_handle handle_; 107 | 108 | /** 109 | * The systembuf object used to manage this stream's data. 110 | */ 111 | detail::systembuf systembuf_; 112 | }; 113 | 114 | } 115 | } 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /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/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 | #include 29 | #include 30 | 31 | OSXPlatform::OSXPlatform(vector argv) : UnixPlatform(argv) { } 32 | 33 | bool OSXPlatform::run_privileged() 34 | { 35 | AuthorizationRef auth = NULL; 36 | OSStatus err; 37 | AuthorizationFlags flags; 38 | 39 | const char *path = this->path().c_str(); 40 | 41 | flags = kAuthorizationFlagExtendRights | kAuthorizationFlagInteractionAllowed; 42 | 43 | err = AuthorizationCreate(NULL, NULL, flags, &auth); 44 | if (err != errAuthorizationSuccess) 45 | throw runtime_error(str(boost::format("osx_run_privileged: AuthorizationCreate() failed: %ld.") % (long int)err)); 46 | 47 | char *args[] = { "--fix-permissions", NULL }; 48 | 49 | err = AuthorizationExecuteWithPrivileges(auth, path, kAuthorizationFlagDefaults, args, NULL); 50 | AuthorizationFree(auth, kAuthorizationFlagDefaults); 51 | if (err == errAuthorizationCanceled) 52 | return false; 53 | else if (err != errAuthorizationSuccess) 54 | throw runtime_error(str(boost::format("osx_run_privileged: AuthorizationExecuteWithPrivileges() failed: %ld") % (long int)err)); 55 | else { 56 | int child; 57 | wait(&child); 58 | } 59 | 60 | return true; 61 | } 62 | 63 | vector OSXPlatform::interfaces() 64 | { 65 | vector result; 66 | 67 | CFStringRef name = CFSTR("com.codebutler.firesheep.backend"); 68 | SCPreferencesRef prefs = SCPreferencesCreate(NULL, name, NULL); 69 | 70 | SCNetworkSetRef set = SCNetworkSetCopyCurrent(prefs); 71 | CFArrayRef services = SCNetworkSetCopyServices(set); 72 | 73 | int arraySize = CFArrayGetCount(services); 74 | for (int i = 0; i < arraySize; i++) { 75 | SCNetworkServiceRef service = (SCNetworkServiceRef) CFArrayGetValueAtIndex(services, i); 76 | 77 | if (SCNetworkServiceGetEnabled(service)) { 78 | SCNetworkInterfaceRef iface = SCNetworkServiceGetInterface(service); 79 | 80 | CFStringRef serviceName = SCNetworkServiceGetName(service); 81 | char cServiceName[(CFStringGetLength(serviceName) * 4) + 1]; 82 | CFStringGetCString(serviceName, cServiceName, sizeof(cServiceName), kCFStringEncodingUTF8); 83 | 84 | CFStringRef type = SCNetworkInterfaceGetInterfaceType(iface); 85 | if (CFStringCompare(type, CFSTR("Ethernet"), 0) == kCFCompareEqualTo || 86 | CFStringCompare(type, CFSTR("IEEE80211"), 0) == kCFCompareEqualTo) { 87 | 88 | char cType[(CFStringGetLength(type) * 4) + 1]; 89 | CFStringGetCString(type, cType, sizeof(cType), kCFStringEncodingUTF8); 90 | 91 | CFStringRef bsdName = SCNetworkInterfaceGetBSDName(iface); 92 | char cBsdName[(CFStringGetLength(bsdName) * 4) + 1]; 93 | CFStringGetCString(bsdName, cBsdName, sizeof(cBsdName), kCFStringEncodingUTF8); 94 | 95 | InterfaceInfo info((string(cBsdName)), (string(cServiceName)), (string(cType))); 96 | result.push_back(info); 97 | } 98 | } 99 | } 100 | 101 | CFRelease(services); 102 | CFRelease(set); 103 | CFRelease(prefs); 104 | 105 | return result; 106 | } -------------------------------------------------------------------------------- /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 "http_sniffer.hpp" 24 | #include "http_packet.hpp" 25 | #include "abstract_platform.hpp" 26 | #include "json_spirit_writer_template.h" 27 | 28 | #ifdef PLATFORM_WIN32 29 | #include "windows_platform.hpp" 30 | #else 31 | #include "osx_platform.hpp" 32 | #endif 33 | 34 | void received_packet(HttpPacket *packet); 35 | void list_interfaces(AbstractPlatform *platform); 36 | 37 | int main(int argc, const char *argv[]) 38 | { 39 | vectorsargv(argv, argv + argc); 40 | 41 | #ifdef PLATFORM_WIN32 42 | WindowsPlatform platform(sargv); 43 | #else 44 | OSXPlatform platform(sargv); 45 | #endif 46 | 47 | if (argc > 1) { 48 | if (argv[1] == string("--fix-permissions")) { 49 | if (platform.is_root()) { 50 | if (platform.check_permissions()) { 51 | /* Nothing to do */ 52 | return EXIT_SUCCESS; 53 | } else { 54 | platform.fix_permissions(); 55 | return EXIT_SUCCESS; 56 | } 57 | } else { 58 | bool success = platform.run_privileged(); 59 | return (success) ? EXIT_SUCCESS : EXIT_FAILURE; 60 | } 61 | } else if (argv[1] == string("--list-interfaces")) { 62 | list_interfaces(&platform); 63 | return EXIT_SUCCESS; 64 | } 65 | } 66 | 67 | if (!platform.is_root()) { 68 | cerr << "Run --fix-permissions first." << endl; 69 | return EXIT_FAILURE; 70 | } 71 | 72 | if (argc < 3) { 73 | cerr << "Syntax: " << argv[0] << " " << endl; 74 | return EXIT_FAILURE; 75 | } 76 | 77 | string iface(argv[1]); 78 | string filter(argv[2]); 79 | 80 | try { 81 | HttpSniffer sniffer(iface, filter, received_packet); 82 | sniffer.start(); 83 | } catch (exception &e) { 84 | cerr << e.what() << endl; 85 | return EXIT_FAILURE; 86 | } 87 | 88 | return EXIT_SUCCESS; 89 | } 90 | 91 | void received_packet(HttpPacket *packet) 92 | { 93 | json_spirit::Object data_obj; 94 | data_obj.push_back(json_spirit::Pair("from", packet->from())); 95 | data_obj.push_back(json_spirit::Pair("to", packet->to())); 96 | data_obj.push_back(json_spirit::Pair("method", packet->method())); 97 | data_obj.push_back(json_spirit::Pair("path", packet->path())); 98 | data_obj.push_back(json_spirit::Pair("query", packet->query())); 99 | data_obj.push_back(json_spirit::Pair("host", packet->host())); 100 | data_obj.push_back(json_spirit::Pair("cookies", packet->cookies())); 101 | data_obj.push_back(json_spirit::Pair("userAgent", packet->user_agent())); 102 | 103 | string data = json_spirit::write_string(json_spirit::Value(data_obj), false); 104 | cout << data << endl; 105 | } 106 | 107 | void list_interfaces(AbstractPlatform *platform) 108 | { 109 | json_spirit::Object data_obj; 110 | 111 | vector interfaces = platform->interfaces(); 112 | vector::iterator iter; 113 | for (iter = interfaces.begin(); iter != interfaces.end(); ++iter) { 114 | InterfaceInfo iface = *iter; 115 | 116 | json_spirit::Object iface_obj; 117 | iface_obj.push_back(json_spirit::Pair("name", iface.name())); 118 | iface_obj.push_back(json_spirit::Pair("type", iface.type())); 119 | 120 | data_obj.push_back(json_spirit::Pair(iface.id(), iface_obj)); 121 | } 122 | 123 | string data = json_spirit::write_string(json_spirit::Value(data_obj), false); 124 | cout << data << endl; 125 | } 126 | -------------------------------------------------------------------------------- /mozpopen/win32/boost/process/win32_child.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Boost.Process 3 | // ~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2006, 2007 Julio M. Merino Vidal 6 | // Copyright (c) 2008, 2009 Boris Schaeling 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | /** 13 | * \file boost/process/win32_child.hpp 14 | * 15 | * Includes the declaration of the win32_child class. 16 | */ 17 | 18 | #ifndef BOOST_PROCESS_WIN32_CHILD_HPP 19 | #define BOOST_PROCESS_WIN32_CHILD_HPP 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace boost { 26 | namespace process { 27 | 28 | /** 29 | * Windows implementation of the Child concept. 30 | * 31 | * The win32_child class implements the Child concept in a Windows 32 | * operating system. 33 | * 34 | * A Windows child differs from a regular %child (represented by a 35 | * child object) in that it holds additional information about a process. 36 | * Aside from the standard handle, it also includes a handle to the 37 | * process' main thread, together with identifiers to both entities. 38 | * 39 | * This class is built on top of the generic child so as to allow its 40 | * trivial adoption. When a program is changed to use the 41 | * Windows-specific context (win32_context), it will most certainly need 42 | * to migrate its use of the child class to win32_child. Doing so is only 43 | * a matter of redefining the appropriate object and later using the 44 | * required extra features: there should be no need to modify the existing 45 | * code (e.g. method calls) in any other way. 46 | */ 47 | class win32_child : public child 48 | { 49 | public: 50 | /** 51 | * Constructs a new Windows child object representing a just 52 | * spawned %child process. 53 | * 54 | * Creates a new %child object that represents the process described by 55 | * the \a pi structure. 56 | * 57 | * The \a fhstdin, \a fhstdout and \a fhstderr parameters hold the 58 | * communication streams used to interact with the %child process if 59 | * the launcher configured redirections. See the parent class' 60 | * constructor for more details on these. 61 | * 62 | * \see child 63 | */ 64 | win32_child(const PROCESS_INFORMATION &pi, detail::file_handle fhstdin, detail::file_handle fhstdout, detail::file_handle fhstderr) 65 | : child(pi.dwProcessId, fhstdin, fhstdout, fhstderr, pi.hProcess), 66 | process_information_(pi), 67 | thread_handle_(process_information_.hThread) 68 | { 69 | } 70 | 71 | /** 72 | * Returns the process handle. 73 | * 74 | * Returns a process-specific handle that can be used to access the 75 | * process. This is the value of the \a hProcess field in the 76 | * PROCESS_INFORMATION structure returned by CreateProcess(). 77 | * 78 | * \see get_id() 79 | */ 80 | HANDLE get_handle() const 81 | { 82 | return process_information_.hProcess; 83 | } 84 | 85 | /** 86 | * Returns the primary thread's handle. 87 | * 88 | * Returns a handle to the primary thread of the new process. This is 89 | * the value of the \a hThread field in the PROCESS_INFORMATION 90 | * structure returned by CreateProcess(). 91 | * 92 | * \see get_primary_thread_id() 93 | */ 94 | HANDLE get_primary_thread_handle() const 95 | { 96 | return process_information_.hThread; 97 | } 98 | 99 | /** 100 | * Returns the primary thread's identifier. 101 | * 102 | * Returns a system-wide value that identifies the process's primary 103 | * thread. This is the value of the \a dwThreadId field in the 104 | * PROCESS_INFORMATION structure returned by CreateProcess(). 105 | * 106 | * \see get_primary_thread_handle() 107 | */ 108 | DWORD get_primary_thread_id() const 109 | { 110 | return process_information_.dwThreadId; 111 | } 112 | 113 | private: 114 | /** 115 | * Windows-specific process information. 116 | */ 117 | PROCESS_INFORMATION process_information_; 118 | 119 | /** 120 | * Thread handle owned by RAII object. 121 | */ 122 | detail::file_handle thread_handle_; 123 | }; 124 | 125 | } 126 | } 127 | 128 | #endif 129 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mozpopen/win32/boost/process/process.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Boost.Process 3 | // ~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2006, 2007 Julio M. Merino Vidal 6 | // Copyright (c) 2008, 2009 Boris Schaeling 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | /** 13 | * \file boost/process/process.hpp 14 | * 15 | * Includes the declaration of the process class. 16 | */ 17 | 18 | #ifndef BOOST_PROCESS_PROCESS_HPP 19 | #define BOOST_PROCESS_PROCESS_HPP 20 | 21 | #include 22 | 23 | #if defined(BOOST_POSIX_API) 24 | # include 25 | # include 26 | #elif defined(BOOST_WINDOWS_API) 27 | # include 28 | # include 29 | #else 30 | # error "Unsupported platform." 31 | #endif 32 | 33 | #include 34 | #include 35 | 36 | namespace boost { 37 | namespace process { 38 | 39 | /** 40 | * Generic implementation of the Process concept. 41 | * 42 | * The process class implements the Process concept in an operating system 43 | * agnostic way. 44 | */ 45 | class process 46 | { 47 | public: 48 | #if defined(BOOST_PROCESS_DOXYGEN) 49 | /** 50 | * Opaque name for the native process' identifier type. 51 | * 52 | * Each operating system identifies processes using a specific type. 53 | * The \a id_type type is used to transparently refer to a process 54 | * regardless of the operating system in which this class is used. 55 | * 56 | * This type is guaranteed to be an integral type on all supported 57 | * platforms. 58 | */ 59 | typedef NativeProcessId id_type; 60 | #elif defined(BOOST_POSIX_API) 61 | typedef pid_t id_type; 62 | #elif defined(BOOST_WINDOWS_API) 63 | typedef DWORD id_type; 64 | #endif 65 | 66 | /** 67 | * Constructs a new process object. 68 | * 69 | * Creates a new process object that represents a running process 70 | * within the system. 71 | */ 72 | process(id_type id) 73 | : id_(id) 74 | { 75 | } 76 | 77 | /** 78 | * Returns the process' identifier. 79 | */ 80 | id_type get_id() const 81 | { 82 | return id_; 83 | } 84 | 85 | /** 86 | * Terminates the process execution. 87 | * 88 | * Forces the termination of the process execution. Some platforms 89 | * allow processes to ignore some external termination notifications 90 | * or to capture them for a proper exit cleanup. You can set the 91 | * \a force flag to true in them to force their termination regardless 92 | * of any exit handler. 93 | * 94 | * After this call, accessing this object can be dangerous because the 95 | * process identifier may have been reused by a different process. It 96 | * might still be valid, though, if the process has refused to die. 97 | * 98 | * \throw boost::system::system_error If the system call used to 99 | * terminate the process fails. 100 | */ 101 | void terminate(bool force = false) const 102 | { 103 | #if defined(BOOST_POSIX_API) 104 | if (::kill(id_, force ? SIGKILL : SIGTERM) == -1) 105 | boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::process::terminate: kill(2) failed")); 106 | #elif defined(BOOST_WINDOWS_API) 107 | HANDLE h = ::OpenProcess(PROCESS_TERMINATE, FALSE, id_); 108 | if (h == NULL) 109 | boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: OpenProcess failed")); 110 | if (!::TerminateProcess(h, EXIT_FAILURE)) 111 | { 112 | ::CloseHandle(h); 113 | boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: TerminateProcess failed")); 114 | } 115 | if (!::CloseHandle(h)) 116 | boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: CloseHandle failed")); 117 | #endif 118 | } 119 | 120 | private: 121 | /** 122 | * The process' identifier. 123 | */ 124 | id_type id_; 125 | }; 126 | 127 | } 128 | } 129 | 130 | #endif 131 | -------------------------------------------------------------------------------- /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 | } --------------------------------------------------------------------------------