Sha256: 933758954b780aad5707aeddf55a2375e310492ed2e6f6248397bce0ae8a5984
Contents?: true
Size: 957 Bytes
Versions: 2
Compression:
Stored size: 957 Bytes
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'optparse' opts = {} OptionParser.new do |options| options.banner = "USAGE: #{$PROGRAM_NAME} [opts] " options.on('-iIP', '--bind-ip=IP', '<Optional - HTTP Bind IP to Listen> (Defaults to Localhost)') do |i| opts[:bind_ip] = i end options.on('-pPORT', '--port=PORT', '<Optional - HTTP Port to Listen (Defaults to 3333)>') do |p| opts[:port] = p end end.parse! bind_ip = opts[:bind_ip] || '127.0.0.1' port = opts[:port].to_i port = 3333 if port.zero? begin system( 'thin', 'start', '--adapter', 'file', '--address', bind_ip, '--port', port.to_s, '--threaded', '--debug' ) rescue RuntimeError puts "WARNING: Service Already Listening on TCP #{port}..." port = Random.rand(1_025..65_535) puts "Listen on #{bind_ip}:#{port}..." retry rescue SystemExit, Interrupt puts "\n#{File.basename($PROGRAM_NAME)} terminated." end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pwn-0.4.961 | bin/pwn_simple_http_server |
pwn-0.4.960 | bin/pwn_simple_http_server |