Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Miguel Ángel González Gallardo
/
AnalizadorLogs
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e18bd50e
authored
Mar 16, 2021
by
Miguel Ángel González Gallardo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
e-Spidering incorporado
parent
651fb1a1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
codigo/Gestor.py
codigo/Gestor.py
View file @
e18bd50e
...
@@ -2,6 +2,18 @@
...
@@ -2,6 +2,18 @@
import
Dato
import
Dato
from
Dato
import
Dato
from
Dato
import
Dato
def
eSpidering
(
reg
):
aQuitar
=
[
"spider"
,
"bot"
,
"crawler"
]
c
=
0
for
r
in
reg
:
for
q
in
aQuitar
:
if
q
in
r
.
hostRemoto
.
lower
():
reg
.
pop
(
c
)
c
+=
1
return
reg
def
identificacionUsuarios
(
reg
):
def
identificacionUsuarios
(
reg
):
aux
=
[]
aux
=
[]
ret
=
[]
ret
=
[]
...
@@ -24,7 +36,7 @@ def identificacionUsuarios(reg):
...
@@ -24,7 +36,7 @@ def identificacionUsuarios(reg):
return
ret
return
ret
def
leerFicheroLog
(
ruta
):
def
leerFicheroLog
(
ruta
,
espidering
):
registros
=
[]
registros
=
[]
f
=
open
(
ruta
,
"r"
)
f
=
open
(
ruta
,
"r"
)
total
=
0
total
=
0
...
@@ -35,10 +47,12 @@ def leerFicheroLog(ruta):
...
@@ -35,10 +47,12 @@ def leerFicheroLog(ruta):
except
:
except
:
continue
continue
f
.
close
()
f
.
close
()
if
espidering
:
registros
=
eSpidering
(
registros
)
print
(
"Procesados "
,
len
(
registros
),
" registros"
)
print
(
"Procesados "
,
len
(
registros
),
" registros"
)
return
registros
return
registros
def
leerFicheroLogEliminarFiltradas
(
ruta
,
extensionesNoDeseadas
):
def
leerFicheroLogEliminarFiltradas
(
ruta
,
extensionesNoDeseadas
,
espidering
):
registros
=
[]
registros
=
[]
f
=
open
(
ruta
,
"r"
)
f
=
open
(
ruta
,
"r"
)
total
=
0
total
=
0
...
@@ -55,10 +69,12 @@ def leerFicheroLogEliminarFiltradas(ruta,extensionesNoDeseadas):
...
@@ -55,10 +69,12 @@ def leerFicheroLogEliminarFiltradas(ruta,extensionesNoDeseadas):
except
:
except
:
continue
continue
f
.
close
()
f
.
close
()
if
espidering
:
registros
=
eSpidering
(
registros
)
print
(
"Procesados "
,
len
(
registros
),
" registros"
)
print
(
"Procesados "
,
len
(
registros
),
" registros"
)
return
registros
return
registros
def
leerFicheroLogAceptarFiltradas
(
ruta
,
extensionesNoDeseadas
):
def
leerFicheroLogAceptarFiltradas
(
ruta
,
extensionesNoDeseadas
,
espidering
):
registros
=
[]
registros
=
[]
f
=
open
(
ruta
,
"r"
)
f
=
open
(
ruta
,
"r"
)
total
=
0
total
=
0
...
@@ -75,10 +91,12 @@ def leerFicheroLogAceptarFiltradas(ruta,extensionesNoDeseadas):
...
@@ -75,10 +91,12 @@ def leerFicheroLogAceptarFiltradas(ruta,extensionesNoDeseadas):
except
:
except
:
continue
continue
f
.
close
()
f
.
close
()
if
espidering
:
registros
=
eSpidering
(
registros
)
print
(
"Procesados "
,
len
(
registros
),
" registros"
)
print
(
"Procesados "
,
len
(
registros
),
" registros"
)
return
registros
return
registros
registros
=
leerFicheroLog
(
"../access_log_Aug95_reducido"
)
registros
=
leerFicheroLog
(
"../access_log_Aug95_reducido"
,
True
)
registros
=
identificacionUsuarios
(
registros
)
registros
=
identificacionUsuarios
(
registros
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment