Class: BetterCap::Network::Servers::HTTPD
- Inherits:
-
Object
- Object
- BetterCap::Network::Servers::HTTPD
- Defined in:
- lib/bettercap/network/servers/httpd.rb
Overview
Simple HTTP server class used to serve static assets when needed.
Instance Method Summary collapse
-
#initialize(port = 8081, path = './') ⇒ HTTPD
constructor
Initialize the HTTP server with the specified tcp
port
usingpath
as the document root. -
#start ⇒ Object
Start the server.
-
#stop ⇒ Object
Stop the server.
Constructor Details
#initialize(port = 8081, path = './') ⇒ HTTPD
Initialize the HTTP server with the specified tcp port
using path
as the document root.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/bettercap/network/servers/httpd.rb', line 22 def initialize( port = 8081, path = './' ) @port = port @path = path begin @server = WEBrick::HTTPServer.new( Port: @port, DocumentRoot: @path, Logger: WEBrick::Log.new("/dev/null"), AccessLog: [] ) rescue Errno::EADDRINUSE raise BetterCap::Error, "[HTTPD] It looks like there's another process listening on port #{@port}, please chose a different port." end end |