feat(args): add option to specify log file to parse
This commit is contained in:
parent
690de4bad6
commit
4cd97100eb
12
main.rb
12
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)
|
||||
|
Loading…
Reference in New Issue
Block a user