UNPKG

beef-npm

Version:

Node.js package to install and interact with BeEF (Browser Exploitation Framework)

3,071 lines (433 loc) 29.1 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Namespace: webrtc</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Namespace: webrtc</h1> <section> <header> <h2>webrtc</h2> </header> <article> <div class="container-overview"> <div class="description"><p>Manage the WebRTC peer to peer communication channels. This objects contains all the necessary client-side WebRTC components, allowing browsers to use WebRTC to communicate with each other. To provide signaling, the WebRTC extension sets up custom listeners. /rtcsignal - for sending RTC signalling information between peers /rtcmessage - for client-side rtc messages to be submitted back into beef and logged.</p> <p>To ensure signaling gets back to the peers, the hook.js dynamic construction also includes the signalling.</p> <p>This is all mostly a Proof of Concept</p></div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line8">line 8</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Members</h3> <h4 class="name" id=".beefrtcs"><span class="type-signature">(static) </span>beefrtcs<span class="type-signature"></span></h4> <div class="description"> <p>To handle multiple peers - we need to have a hash of Beefwebrtc objects. The key is the peer id.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line27">line 27</a> </li></ul></dd> </dl> <h4 class="name" id=".globalrtc"><span class="type-signature">(static) </span>globalrtc<span class="type-signature"></span></h4> <div class="description"> <p>To handle multiple Peers - we have to have a global hash of RTCPeerConnection objects these objects persist outside of everything else. The key is the peer id.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line33">line 33</a> </li></ul></dd> </dl> <h4 class="name" id=".rtcrecvchan"><span class="type-signature">(static) </span>rtcrecvchan<span class="type-signature"></span></h4> <div class="description"> <p>To handle multiple event channels - we need to have a global hash of these. The key is the peer id</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line45">line 45</a> </li></ul></dd> </dl> <h4 class="name" id=".rtcstealth"><span class="type-signature">(static) </span>rtcstealth<span class="type-signature"></span></h4> <div class="description"> <p>stealth should only be initiated from one peer - this global variable will contain: false - i.e not stealthed; or <peerid> - i.e. the id of the browser which initiated stealth mode</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line40">line 40</a> </li></ul></dd> </dl> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".Beefwebrtc"><span class="type-signature">(static) </span>Beefwebrtc<span class="signature">(initiator, peer, turnjson, stunservers, verbparam)</span><span class="type-signature"></span></h4> <div class="description"> <p>Beefwebrtc object - wraps everything together for a peer connection One of these per peer connection, and will be stored in the beefrtc global hash</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>initiator</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>peer</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>turnjson</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>stunservers</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>verbparam</code></td> <td class="type"> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line57">line 57</a> </li></ul></dd> </dl> <h4 class="name" id="calleeStart"><span class="type-signature">(static) </span>Beefwebrtc#calleeStart<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Check for messages - which includes signaling from a calling peer - this gets kicked off in maybeStart()</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line529">line 529</a> </li></ul></dd> </dl> <h4 class="name" id="createPeerConnection"><span class="type-signature">(static) </span>Beefwebrtc#createPeerConnection<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Try and establish the RTC connection</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line136">line 136</a> </li></ul></dd> </dl> <h4 class="name" id="doAnswer"><span class="type-signature">(static) </span>Beefwebrtc#doAnswer<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>As part of the processSignalingMessage function, we check for 'offers' from peers. If there's an offer, we answer, as below</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line621">line 621</a> </li></ul></dd> </dl> <h4 class="name" id="doCall"><span class="type-signature">(static) </span>Beefwebrtc#doCall<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>RTC - create an offer - the caller runs this, while the receiver runs calleeStart()</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line460">line 460</a> </li></ul></dd> </dl> <h4 class="name" id="execCmd"><span class="type-signature">(static) </span>Beefwebrtc#execCmd<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>How the browser executes received JS (this is pretty hacky)</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line415">line 415</a> </li></ul></dd> </dl> <h4 class="name" id="forceTurn"><span class="type-signature">(static) </span>Beefwebrtc#forceTurn<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Forces the TURN configuration (we can't query that computeengine thing because it's CORS is restrictive) These values are now simply passed in from the config.yaml for the webrtc extension</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line119">line 119</a> </li></ul></dd> </dl> <h4 class="name" id="goStealth"><span class="type-signature">(static) </span>Beefwebrtc#goStealth<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>This is the function when a peer tells us to go into stealth by sending a dataChannel message of &quot;!gostealth&quot;</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line314">line 314</a> </li></ul></dd> </dl> <h4 class="name" id="iceCandidateType"><span class="type-signature">(static) </span>Beefwebrtc#iceCandidateType<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Helper method to determine what kind of ICE Candidate we've received</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line630">line 630</a> </li></ul></dd> </dl> <h4 class="name" id="initialize"><span class="type-signature">(static) </span>Beefwebrtc#initialize<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Initialize the object</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line86">line 86</a> </li></ul></dd> </dl> <h4 class="name" id="maybeStart"><span class="type-signature">(static) </span>Beefwebrtc#maybeStart<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Try and initiate, will check that system hasn't started, and that signaling is ready, and that TURN servers are ready</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line434">line 434</a> </li></ul></dd> </dl> <h4 class="name" id="mergeConstraints"><span class="type-signature">(static) </span>Beefwebrtc#mergeConstraints<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Helper method to merge SDP constraints</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line472">line 472</a> </li></ul></dd> </dl> <h4 class="name" id="noteIceCandidate"><span class="type-signature">(static) </span>Beefwebrtc#noteIceCandidate<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Used to record ICS candidates locally</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line245">line 245</a> </li></ul></dd> </dl> <h4 class="name" id="onAddIceCandidateError"><span class="type-signature">(static) </span>Beefwebrtc#onAddIceCandidateError<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Event handler for unsuccessful addition of ICE Candidates</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line652">line 652</a> </li></ul></dd> </dl> <h4 class="name" id="onAddIceCandidateSuccess"><span class="type-signature">(static) </span>Beefwebrtc#onAddIceCandidateSuccess<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Event handler for successful addition of ICE Candidates</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line644">line 644</a> </li></ul></dd> </dl> <h4 class="name" id="onCreateSessionDescriptionError"><span class="type-signature">(static) </span>Beefwebrtc#onCreateSessionDescriptionError<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>If the browser can't build an SDP</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line513">line 513</a> </li></ul></dd> </dl> <h4 class="name" id="onDataChannel"><span class="type-signature">(static) </span>Beefwebrtc#onDataChannel<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>When a data channel has been established - within here is the message handling function as well</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line345">line 345</a> </li></ul></dd> </dl> <h4 class="name" id="onIceCandidate"><span class="type-signature">(static) </span>Beefwebrtc#onIceCandidate<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>When the PeerConnection receives a new ICE Candidate</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line165">line 165</a> </li></ul></dd> </dl> <h4 class="name" id="onIceConnectionStateChanged"><span class="type-signature">(static) </span>Beefwebrtc#onIceConnectionStateChanged<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>When the ICE Connection State changes - this is useful to determine connection statuses with peers.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line265">line 265</a> </li></ul></dd> </dl> <h4 class="name" id="onRemoteHangup"><span class="type-signature">(static) </span>Beefwebrtc#onRemoteHangup<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>If a peer hangs up (we bring down the peerconncetion via the stop() method)</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line660">line 660</a> </li></ul></dd> </dl> <h4 class="name" id="onSetRemoteDescriptionSuccess"><span class="type-signature">(static) </span>Beefwebrtc#onSetRemoteDescriptionSuccess<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>If the browser successfully sets a remote description</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line521">line 521</a> </li></ul></dd> </dl> <h4 class="name" id="onSignalingStateChanged"><span class="type-signature">(static) </span>Beefwebrtc#onSignalingStateChanged<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>When the signalling state changes. We don't actually do anything with this except log it.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line257">line 257</a> </li></ul></dd> </dl> <h4 class="name" id="processMessage"><span class="type-signature">(static) </span>Beefwebrtc#processMessage<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>For all rtc signalling messages we receive as part of hook.js polling - we have to process them with this function This will either add messages to the msgQueue and try and kick off maybeStart - or it'll call processSignalingMessage against the message directly</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line196">line 196</a> </li></ul></dd> </dl> <h4 class="name" id="processSignalingMessage"><span class="type-signature">(static) </span>Beefwebrtc#processSignalingMessage<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Process messages, this is how we handle the signaling messages, such as candidate info, offers, answers</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line540">line 540</a> </li></ul></dd> </dl> <h4 class="name" id="sendPeerMsg"><span class="type-signature">(static) </span>Beefwebrtc#sendPeerMsg<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Shortcut function to SEND a data messsage</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line425">line 425</a> </li></ul></dd> </dl> <h4 class="name" id="sendSignalMsg"><span class="type-signature">(static) </span>Beefwebrtc#sendSignalMsg<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Send a signalling message ..</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line235">line 235</a> </li></ul></dd> </dl> <h4 class="name" id="setRemote"><span class="type-signature">(static) </span>Beefwebrtc#setRemote<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Used to set the RTC remote session</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line612">line 612</a> </li></ul></dd> </dl> <h4 class="name" id="stop"><span class="type-signature">(static) </span>Beefwebrtc#stop<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Bring down the peer connection</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line671">line 671</a> </li></ul></dd> </dl> <h4 class="name" id=".rtcpollPeer"><span class="type-signature">(static) </span>rtcpollPeer<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>This is the actual poller when in stealth, it is global as well because we're using the setTimeout to execute it</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="webrtc.js.html">webrtc.js</a>, <a href="webrtc.js.html#line327">line 327</a> </li></ul></dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="BeefJS.html">BeefJS</a></li><li><a href="beef.are.html">are</a></li><li><a href="beef.browser.html">browser</a></li><li><a href="beef.browser.cookie.html">cookie</a></li><li><a href="beef.browser.popup.html">popup</a></li><li><a href="beef.dom.html">dom</a></li><li><a href="beef.encode.base64.html">base64</a></li><li><a href="beef.encode.json.html">json</a></li><li><a href="beef.geolocation.html">geolocation</a></li><li><a href="beef.hardware.html">hardware</a></li><li><a href="beef.init.html">init</a></li><li><a href="beef.logger.html">logger</a></li><li><a href="beef.mitb.html">mitb</a></li><li><a href="beef.net.html">net</a></li><li><a href="beef.net.connection.html">connection</a></li><li><a href="beef.net.cors.html">cors</a></li><li><a href="beef.net.dns.html">dns</a></li><li><a href="beef.net.local.html">local</a></li><li><a href="beef.net.portscanner.html">portscanner</a></li><li><a href="beef.net.requester.html">requester</a></li><li><a href="beef.net.xssrays.html">xssrays</a></li><li><a href="beef.os.html">os</a></li><li><a href="beef.session.html">session</a></li><li><a href="beef.timeout.html">timeout</a></li><li><a href="beef.updater.html">updater</a></li><li><a href="beef.webrtc.html">webrtc</a></li><li><a href="beef.websocket.html">websocket</a></li></ul><h3>Global</h3><ul><li><a href="global.html#platform">platform</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Wed Oct 23 2024 16:03:46 GMT+1000 (Australian Eastern Standard Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>