├── .babelrc
├── .eslintrc
├── .gitignore
├── LICENSE
├── README.md
├── app.js
├── doc
└── example.png
├── icon.png
├── index.html
├── index.js
├── openssl.cnf
├── package.json
├── phoenixmatrix.json
├── src
├── actions
│ ├── config.js
│ └── requests.js
├── app.js
├── components
│ ├── Footer.jsx
│ ├── Header.jsx
│ ├── HttpHeaders.jsx
│ ├── LeftSection.jsx
│ ├── MainSection.jsx
│ ├── PhoenixMatrixApp.jsx
│ ├── Proxy.jsx
│ ├── RequestBody.jsx
│ ├── RequestDetail.jsx
│ ├── RequestDetailHeader.jsx
│ ├── RequestList.jsx
│ ├── RequestListItem.jsx
│ ├── ResponseDetail.jsx
│ ├── Splitter.jsx
│ └── VerticalButtonBar.jsx
├── constants
│ ├── config-constants.js
│ └── request-constants.js
├── dispatchers
│ └── AppDispatcher.js
├── lib
│ ├── angular.js
│ ├── certificate.js
│ ├── config.js
│ ├── helpers.js
│ ├── proxyFactory.js
│ └── pure.js
├── main.js
└── reducers
│ ├── config.js
│ ├── index.js
│ └── requests.js
├── stylesheets
├── splitter.less
└── style.less
├── vendor
├── bootstrap
│ ├── css
│ │ ├── bootstrap-theme.min.css
│ │ └── bootstrap.min.css
│ ├── fonts
│ │ ├── glyphicons-halflings-regular.eot
│ │ ├── glyphicons-halflings-regular.svg
│ │ ├── glyphicons-halflings-regular.ttf
│ │ └── glyphicons-halflings-regular.woff
│ ├── js
│ │ └── bootstrap.min.js
│ └── less
│ │ ├── mixins.less
│ │ ├── mixins
│ │ ├── alerts.less
│ │ ├── background-variant.less
│ │ ├── border-radius.less
│ │ ├── buttons.less
│ │ ├── center-block.less
│ │ ├── clearfix.less
│ │ ├── forms.less
│ │ ├── gradients.less
│ │ ├── grid-framework.less
│ │ ├── grid.less
│ │ ├── hide-text.less
│ │ ├── image.less
│ │ ├── labels.less
│ │ ├── list-group.less
│ │ ├── nav-divider.less
│ │ ├── nav-vertical-align.less
│ │ ├── opacity.less
│ │ ├── pagination.less
│ │ ├── panels.less
│ │ ├── progress-bar.less
│ │ ├── reset-filter.less
│ │ ├── resize.less
│ │ ├── responsive-visibility.less
│ │ ├── size.less
│ │ ├── tab-focus.less
│ │ ├── table-row.less
│ │ ├── text-emphasis.less
│ │ ├── text-overflow.less
│ │ └── vendor-prefixes.less
│ │ └── variables.less
├── font-awesome
│ ├── css
│ │ └── font-awesome.css
│ └── fonts
│ │ ├── FontAwesome.otf
│ │ ├── fontawesome-webfont.eot
│ │ ├── fontawesome-webfont.svg
│ │ ├── fontawesome-webfont.ttf
│ │ ├── fontawesome-webfont.woff
│ │ └── fontawesome-webfont.woff2
└── jquery
│ ├── jquery.min.js
│ └── jquery.min.map
└── webpack.config.babel.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [ "react", "es2015-node5", "stage-1" ],
3 | "plugins": [ "transform-runtime"]
4 | }
5 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "eslint-config-airbnb", // https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb/.eslintrc
3 | "rules": {
4 | "max-len": [2, 117, 2], // Max length where things generally fit in a github code view width
5 | "comma-dangle": [2, "never"], // There's good reason to enforce comma dangling, but it throws people off.
6 | "strict": [2, "function"], // For now, we're not using modules, so strict has to be applied to a self executing function
7 | "no-extra-strict": 0, // Disabling legacy rule. Above rule overwrites it.
8 | "func-names": 0, // Most functions are named automatically in ES6.
9 | "no-console": 2, // the following rules are warnings in AirBNB. We make them errors.
10 | "no-undef": 2,
11 | "no-debugger": 2,
12 | "no-alert": 2,
13 | "space-in-parens": [2, "never"], // Enforce lack of spaces inside parens entirely for style reasons
14 | "object-curly-spacing": [2, "never"], // Enforce spaces inside curleys entirely for style reasons
15 | "arrow-spacing": 2, // Enforce spaces around arrow functions entirely for style reasons
16 | "no-constant-condition": 2,
17 | "eqeqeq": [2, "allow-null"],
18 | "no-eq-null": 0,
19 | "no-undef": 2,
20 | "strict": 0,
21 | "react/jsx-curly-spacing": [2, "never"],
22 | "no-unused-expressions": 0,
23 | "indent": [2, 2, {"SwitchCase": 0}]
24 | },
25 | "ecmaFeatures": {
26 | "modules": true,
27 | "generators": true,
28 | "experimentalObjectRestSpread": true
29 | },
30 | "globals": {
31 | "chai": true,
32 | "expect": true,
33 | "sinon": true
34 | },
35 | "env": {
36 | "mocha": true,
37 | "worker": true,
38 | "jquery": true,
39 | "node": true,
40 | "commonjs": true
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .idea
3 | certificate
4 | npm-debug.log
5 | dist
6 | git
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Francois Ward
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | PhoenixMatrix web development proxy
2 | ===================================
3 |
4 | [](https://gitter.im/Phoenixmatrix/phoenixmatrix-proxy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5 |
6 | _v0.2.4 technical preview_
7 |
8 | Web debugging proxy in the spirit of Fiddler and Charles Proxy, written in JavaScript with [Electron Shell](http://electron.atom.io/)
9 | and node.
10 |
11 | Tested on MacOSX El Captan, Windows 8.1/10 and Ubuntu 14. Expected to break often.
12 |
13 | ## Release notes
14 |
15 | **v0.2.5**
16 | * Migrated to Webpack and some cleanup. Turns out I'm so addicted to Webpack I can't avoid it even when I have CommonJS available.
17 |
18 | **v0.2.4**
19 | * Refactor to Redux, making future improvement easier to implement.
20 | * Still very messy from all the previous transitions, and not currently using Redux best practice: you probably don't want to copy this code :)
21 |
22 | **v0.2.3**
23 | * Updated some dependencies to work with the latest version of Electron
24 | * With this update, modern browsers shouldn't choke on the TLS version anymore.
25 | * Regression: A lot of deprecation errors to deal with, and the development mode toolbar now shows up. Next release should clean things up.
26 |
27 | **v0.2.2**
28 | * Some rendering performance improvements
29 | * No more OpenSSL dependency (using the fantastic [forge](https://github.com/digitalbazaar/forge))
30 | * That means Windows users can now launch PhoenixMatrix from powershell, cmd.exe, whatever. It "just works" on all 3 major platforms.
31 | * Since the certificates are now generated in javascript synchronously, there's few performance blips the first time. This will be addressed in the future.
32 |
33 | **v0.2.1**
34 | * Migrated from Angular to React
35 |
36 | **v0.2.0**
37 | * Moved from nw.js to Electron Shell
38 | * Updated to the latest version of Babel
39 | * Updated Babel transformer blacklist for features iojs supports natively to clean up the generated code
40 | * Removed a bunch of hacks for cross platform support that are no longer necessary for Electron Shell.
41 |
42 | ## Warning: Technical Preview
43 | This is a technical preview at best!!
44 |
45 | The UI is far from finished, the code is a mess, there's a lot of bugs. Expect crashes, slowness, and generally an
46 | unfinished product feel. It 'works' when stars are aligned, and that's as much as you should expect.
47 |
48 | Again, the code is a mess. Please don't look at it and email me that its bad. For now my priority was to get things working.
49 |
50 | ### Features
51 |
52 | 
53 |
54 | * Works with all major browsers
55 | * Works on all operating systems that Electron Shell (formerly Atom Shell) supports. Sorry Windows XP!
56 | * Supports both http and https
57 | * Allows real time https decryption with no scary warning (not even from Chrome!)
58 | * Handles gzipped responses (doesn't yet decode base64 encoded bodies though. That's coming)
59 | * Dynamically creates its own certificates for https decryption. No need to fiddle with OpenSSL! No OpenSSL dependencies whatsoever.
60 | * Secure! The certificate authority is created on the fly the first time you launch PhoenixMatrix. No one else will have the private key.
61 | * Free and open source the MIT license. Feel free to hack it up.
62 | * Built on open web technology. JavaScript, CSS, node.js (well, Electron Shell uses a fork of io.js. Close enough!).
63 | * Uses the latest EcmaScript 6 features, including generators, for [better asyncronous code](http://eng.localytics.com/better-asynchronous-javascript/)
64 |
65 | ### Setup
66 | * Clone this repo
67 | * Open a command prompt and navigate to the location where you cloned it.
68 | * Run `npm install`. Electron Shell will be downloaded here, so expect a big download.
69 | * Run `gulp`
70 | * You should now see the GUI application. Setup the proxy in your browser of choice (or in your application), and you're good to go!
71 | * From now on you can use `npm start` to run PhoenixMatrix without rebuilding everything.
72 |
73 | ### Configuring your browser to use the proxy
74 |
75 | Different browsers and operating systems use different methods of configuring proxies. For IE, Safari and Chrome in Windows and MacOSX, configure
76 | the proxy from the system settings/control panel. For FireFox, configure the proxy in the options -> advanced under network. The default port is 3002 but
77 | can be configured
78 |
79 | Exclude SSl/HTTPS from using the proxy if you don't need it and/or don't want to go through the steps to configure a certificate for man-in-the-middle decryption.
80 |
81 | For https support, after running PhoenixMatrix, look in the certificate folder where you cloned the repo. Import `ca.crt` in your browser (Firefox)
82 | or as a system certificate for most other browsers/operating systems. If prompted, the certificate only need to be used for websites. On Windows, the certificate needs to
83 | be configured in the Trusted Certificate Authorities (you can just double click the certificate to launch the wizard). You may need to restart PhoenixMatrix and/or your browser after doing this.
84 |
85 | PhoenixMatrix uses a certificate authority to generate individual server certificates, so only the one certificate needs to be installed.
86 |
87 | **if your pages aren't loading**: If after installing the certificate in your browser, pages aren't loading, close PhoenixMatrix andor your browser and restart it/them. Seems like the invalid certificate
88 | behavior of some browsers leave the proxy in a weird state
89 |
90 | ### Configuration
91 |
92 | The available options can be found in phoenixmatrix.json, in JSON format (duh!).
93 | * `includeConnect`: if you want to see http CONNECT requests, which will happen whenever you try to make an https request while using the proxy.
94 | * `proxyPort`: used to configure which port the proxy listens to. Make sure to use a free port. Default to 3002.
95 | * `httpsProxyPort`: used to configure on which port the https proxy listens to. This is only used internally and will not work
96 | if you point your browser to it directly.
97 | * `certificateExpiration`: how many days should the generated certificates be valid for
98 |
99 | ### Hacking and debugging PhoenixMatrix
100 |
101 | PhoenixMatrix is built on top of Electron Shell, which in turn is built on top of Chromium and iojs.
102 | This means you can easily add features or hack it up the same way you would a web page built with React and node/iojs.
103 |
104 | Like the Chrome browser, Electron Shell supports the devtools you know: with the window focused, just hit ctrl+shift+i (command+shift+i on mac)!
105 |
106 | ### Caveats
107 | * On MacOSX, when using the trackpad, scrolling isn't as smooth as it should be.
108 | * As of the technical preview, it is not possible to directly disable https support. If you don't want to setup the certificate, ensure your browser is not
109 | configured to use the proxy for HTTPS if you do not want it to stop you from browsing https sites during development.
110 | * The proxy currently only checks individual server certificate expiration dates to regenerate them. If you get an error that the CA certificate isn't valid
111 | even though you imported it, just delete the content of the certificate folder, restart PhoenixMatrix and import ca.crt again
112 | * Expect the code to change a LOT from now on. This was hacked up quickly to get things working. If you make a fork, don't expect to easily be able to merge from
113 | upstream for very long.
114 | * Doesn't support old HTTP versions, web sockets, HTTP/2, old servers or uncommon network setups.
115 |
116 | ### Thanks, inspiration and resources
117 |
118 | Inspiration taken from the following projects (I don't use the, but I learnt a lot from the source). Thanks! :
119 | * [node-http-proxy](https://github.com/nodejitsu/node-http-proxy)
120 | * [pem](https://github.com/andris9/pem)
121 |
122 | Splitter was ported to React from [bg-splitter](https://github.com/blackgate/bg-splitter). Thanks!
123 | My port isn't polished enough to warrant its own repo, but if anyone is interested, I can do so.
124 |
125 | ### License
126 |
127 | The MIT License (MIT)
128 |
129 | Copyright (c) 2015 Francois Ward
130 |
131 | Permission is hereby granted, free of charge, to any person obtaining a copy
132 | of this software and associated documentation files (the "Software"), to deal
133 | in the Software without restriction, including without limitation the rights
134 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
135 | copies of the Software, and to permit persons to whom the Software is
136 | furnished to do so, subject to the following conditions:
137 |
138 | The above copyright notice and this permission notice shall be included in all
139 | copies or substantial portions of the Software.
140 |
141 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
142 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
143 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
144 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
145 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
146 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
147 | SOFTWARE.
148 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | // This will eventually become a command line version of the proxy. For now though, it's very broken.
2 |
3 | var proxyFactory = require('./src/lib/proxy');
4 |
5 | var onRequest = function(data) {
6 | console.log('request: ' + data.method + ' ' + data.url);
7 | };
8 |
9 | var onResponse = function(data) {
10 | console.log('response: ' + data.method + ' ' + data.url);
11 | };
12 |
13 | var httpProxy;
14 | proxyFactory.createHttpProxy({port: 3002}).then(function(proxy) {
15 | httpProxy = proxy;
16 | proxy.on('proxyRequest', onRequest);
17 | proxy.on('proxyResponse', onResponse);
18 | proxy.on('proxyConnect', function(data) {
19 | console.log('connect request: ' + data.state + ' ' + data.url + ':' + data.port);
20 | });
21 | return proxyFactory.createHttpsProxy({port: 8443});
22 | })
23 | .then(function(httpsProxy) {
24 | httpsProxy.on('proxyRequest', onRequest);
25 | httpsProxy.on('proxyResponse', onResponse);
26 | httpProxy.enableHttpsProxy(httpsProxy);
27 | });
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/doc/example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Phoenixmatrix/phoenixmatrix-proxy/0edb2448571e4627a1c51bf571998e2db86963dc/doc/example.png
--------------------------------------------------------------------------------
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Phoenixmatrix/phoenixmatrix-proxy/0edb2448571e4627a1c51bf571998e2db86963dc/icon.png
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |