First commit
This commit is contained in:
commit
ab9d36e6ec
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
{"nonce":2912274208777723537,"last_updated":{"seconds":1693331088,"nanos":625452000}}
|
|
@ -0,0 +1 @@
|
||||||
|
{"type":"resolve","resolvedModuleId":"replit","inputHash":"","resolutionPath":["replit"],"error":"","Changed":true}
|
|
@ -0,0 +1 @@
|
||||||
|
{"type":"resolve","resolvedModuleId":"ruby-3.2","inputHash":"","resolutionPath":["ruby-3.2"],"error":"","Changed":true}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -0,0 +1,56 @@
|
||||||
|
*.gem
|
||||||
|
*.rbc
|
||||||
|
/.config
|
||||||
|
/coverage/
|
||||||
|
/InstalledFiles
|
||||||
|
/pkg/
|
||||||
|
/spec/reports/
|
||||||
|
/spec/examples.txt
|
||||||
|
/test/tmp/
|
||||||
|
/test/version_tmp/
|
||||||
|
/tmp/
|
||||||
|
|
||||||
|
# Used by dotenv library to load environment variables.
|
||||||
|
# .env
|
||||||
|
|
||||||
|
# Ignore Byebug command history file.
|
||||||
|
.byebug_history
|
||||||
|
|
||||||
|
## Specific to RubyMotion:
|
||||||
|
.dat*
|
||||||
|
.repl_history
|
||||||
|
build/
|
||||||
|
*.bridgesupport
|
||||||
|
build-iPhoneOS/
|
||||||
|
build-iPhoneSimulator/
|
||||||
|
|
||||||
|
## Specific to RubyMotion (use of CocoaPods):
|
||||||
|
#
|
||||||
|
# We recommend against adding the Pods directory to your .gitignore. However
|
||||||
|
# you should judge for yourself, the pros and cons are mentioned at:
|
||||||
|
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||||
|
#
|
||||||
|
# vendor/Pods/
|
||||||
|
|
||||||
|
## Documentation cache and generated files:
|
||||||
|
/.yardoc/
|
||||||
|
/_yardoc/
|
||||||
|
/doc/
|
||||||
|
/rdoc/
|
||||||
|
|
||||||
|
## Environment normalization:
|
||||||
|
/.bundle/
|
||||||
|
/vendor/bundle
|
||||||
|
/lib/bundler/man/
|
||||||
|
|
||||||
|
# for a library or gem, you might want to ignore these files since the code is
|
||||||
|
# intended to run in multiple environments; otherwise, check them in:
|
||||||
|
# Gemfile.lock
|
||||||
|
# .ruby-version
|
||||||
|
# .ruby-gemset
|
||||||
|
|
||||||
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
||||||
|
.rvmrc
|
||||||
|
|
||||||
|
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
||||||
|
# .rubocop-https?--*
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="RUBY_MODULE" version="4">
|
||||||
|
<component name="ModuleRunConfigurationManager">
|
||||||
|
<shared />
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.bundle" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="ruby-3.3.1-p55" jdkType="RUBY_SDK" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.5.9, ruby-3.3.1-p55) [gem]" level="application" />
|
||||||
|
</component>
|
||||||
|
</module>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MaterialThemeProjectNewConfig">
|
||||||
|
<option name="metadata">
|
||||||
|
<MTProjectMetadataState>
|
||||||
|
<option name="migrated" value="true" />
|
||||||
|
<option name="pristineConfig" value="false" />
|
||||||
|
<option name="userId" value="193687b7:18f7c61f726:-7ffe" />
|
||||||
|
</MTProjectMetadataState>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/ApacheLogStats.iml" filepath="$PROJECT_DIR$/.idea/ApacheLogStats.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,10 @@
|
||||||
|
run = "bundle exec ruby main.rb"
|
||||||
|
hidden = [".bundle"]
|
||||||
|
entrypoint = "main.rb"
|
||||||
|
modules = ["ruby-3.2:v6-20240209-9e3a339"]
|
||||||
|
|
||||||
|
[nix]
|
||||||
|
channel = "stable-23_11"
|
||||||
|
|
||||||
|
[gitHubImport]
|
||||||
|
requiredFiles = [".replit", "replit.nix"]
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":2,"languages":{"ruby-bundler":{"specfileHash":"0bee94fb9969f7de9b9f4407817dd18c","lockfileHash":"57de5e0f5e5c8e06679014ee543bbb6f"}}}
|
|
@ -0,0 +1,5 @@
|
||||||
|
source "https://rubygems.org"
|
||||||
|
|
||||||
|
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
||||||
|
|
||||||
|
# gem "rails"
|
|
@ -0,0 +1,12 @@
|
||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
x64-mingw-ucrt
|
||||||
|
x86_64-linux
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
2.5.9
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Ruby - Análise de ficheiros de auditoria Apache - UFCD 9191
|
||||||
|
|
||||||
|
## Objetivos do programa
|
||||||
|
|
||||||
|
- **Objetivo 1**: Número de contactos que um determinado IP realizou
|
||||||
|
- **Objetivo 2**: Quais IPs resultaram no maior número de erros de cliente (400-499)
|
||||||
|
- **Objetivo 3**: Agrupar por tipo de cliente e saber que tipos de clientes contactam mais o site
|
||||||
|
|
||||||
|
### Sub-objetivos
|
||||||
|
|
||||||
|
-
|
|
@ -0,0 +1,38 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
logfile = File.open("teambuilder.pt.log")
|
||||||
|
data = logfile.read
|
||||||
|
lines = data.split("\n")
|
||||||
|
|
||||||
|
# Gets the IP address from the string
|
||||||
|
def get_line_ip(line)
|
||||||
|
pattern = /\b(?:\d{1,3}\.){3}\d{1,3}\b/
|
||||||
|
line.match(pattern)[0] if line.match(pattern)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Gets the number of times an IP contacted the site
|
||||||
|
def times_appeared_single(ips, ip_to_check)
|
||||||
|
counter = 0
|
||||||
|
ips.each do |ip|
|
||||||
|
if ip == ip_to_check
|
||||||
|
counter += 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
[counter]
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_code_by_ip(ip_address)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_user_agent(ip)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
ips = []
|
||||||
|
lines.each do | line |
|
||||||
|
previous_ip = ""
|
||||||
|
ips << get_line_ip(line)
|
||||||
|
end
|
||||||
|
|
||||||
|
puts times_appeared_single(ips, "3.94.209.170")
|
|
@ -0,0 +1,2 @@
|
||||||
|
{"error":".zip archives do not support non-regular files","level":"error","msg":"unable to write file .cache/replit/modules/replit","time":"2024-05-15T11:23:28Z"}
|
||||||
|
{"error":".zip archives do not support non-regular files","level":"error","msg":"unable to write file .cache/replit/modules/ruby-3.2","time":"2024-05-15T11:23:28Z"}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue