diff --git a/main.rb b/main.rb index 9c59f35..07d9580 100644 --- a/main.rb +++ b/main.rb @@ -4,10 +4,20 @@ require 'date' require_relative 'utils/http_codes' require_relative 'utils/date_for_humans' -logfile = File.open('teambuilder.pt.log') +args = ARGV + +if args[0] == '--parse' || args[0] == '-p' + puts("[!] Opening log file at #{args[1]}") + logfile = File.open(args[1]) +else + puts('[!] Log file path not provided, assuming default access.log') + logfile = File.open('access.log', 'a') +end + data = logfile.read lines = data.split("\n") + # Gets the IP address from the string # Note: sometimes the function can fetch the UA version as an IP address def get_line_ip(line)