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
4edf1a54
authored
Mar 14, 2021
by
Miguel Ángel González Gallardo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Clase Dato creada
parent
2f633d39
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
0 deletions
codigo/Dato.py
codigo/Gestor.py
codigo/Dato.py
0 → 100644
View file @
4edf1a54
import
datetime
from
datetime
import
date
,
datetime
import
time
def
modificarFecha
(
cade
):
cad
=
cade
if
"Jan"
in
cad
:
return
cad
.
replace
(
"Jan"
,
"1"
)
if
"Feb"
in
cad
:
return
cad
.
replace
(
"Feb"
,
"2"
)
if
"Mar"
in
cad
:
return
cad
.
replace
(
"Mar"
,
"3"
)
if
"Apr"
in
cad
:
return
cad
.
replace
(
"Apr"
,
"4"
)
if
"May"
in
cad
:
return
cad
.
replace
(
"May"
,
"5"
)
if
"Jun"
in
cad
:
return
cad
.
replace
(
"Jun"
,
"6"
)
if
"Jul"
in
cad
:
return
cad
.
replace
(
"Jul"
,
"7"
)
if
"Aug"
in
cad
:
return
cad
.
replace
(
"Aug"
,
"8"
)
if
"Sep"
in
cad
:
return
cad
.
replace
(
"Sep"
,
"9"
)
if
"Oct"
in
cad
:
return
cad
.
replace
(
"Oct"
,
"10"
)
if
"Nov"
in
cad
:
return
cad
.
replace
(
"Nov"
,
"11"
)
if
"Dec"
in
cad
:
return
cad
.
replace
(
"Dec"
,
"12"
)
class
Dato
:
#Atributos
hostRemoto
=
None
fecha
=
None
metodoPeticion
=
None
url
=
None
vProtocolo
=
None
statusCode
=
None
volumenTransf
=
None
marcaTiempo
=
None
def
__init__
(
self
,
cadena
):
c
=
0
aux
=
""
#Saco de la cadena el host remoto
while
cadena
[
c
]
!=
' '
:
aux
+=
cadena
[
c
]
c
+=
1
self
.
hostRemoto
=
aux
aux
=
""
#Situo el iterador para leer la fecha
while
cadena
[
c
]
!=
'['
:
c
+=
1
c
+=
1
#Leo fecha y hora
while
cadena
[
c
]
!=
' '
:
aux
+=
cadena
[
c
]
c
+=
1
c
+=
1
self
.
fecha
=
datetime
.
strptime
(
modificarFecha
(
aux
),
'
%
d/
%
m/
%
Y:
%
H:
%
M:
%
S'
)
aux
=
""
#Situo el iterador para leer el metodo de peticion
while
cadena
[
c
]
!=
'"'
:
c
+=
1
c
+=
1
#Leo el metodo de peticion
while
cadena
[
c
]
!=
' '
:
aux
+=
cadena
[
c
]
c
+=
1
c
+=
1
self
.
metodoPeticion
=
aux
aux
=
""
#Saco la url
while
cadena
[
c
]
!=
' '
:
aux
+=
cadena
[
c
]
c
+=
1
c
+=
1
self
.
url
=
aux
aux
=
""
#Leo la version del protocolo, el codigo de estado y volumen de transferencia
while
cadena
[
c
]
!=
'"'
:
aux
+=
cadena
[
c
]
c
+=
1
c
+=
2
self
.
vProtocolo
=
aux
aux
=
""
while
cadena
[
c
]
!=
' '
:
aux
+=
cadena
[
c
]
c
+=
1
c
+=
1
self
.
statusCode
=
aux
aux
=
""
while
c
<
len
(
cadena
)
and
cadena
[
c
]
!=
' '
:
aux
+=
cadena
[
c
]
c
+=
1
self
.
volumenTransf
=
aux
#Calculo la marca de tiempo
segReg
=
datetime
.
timestamp
(
self
.
fecha
)
segHoy
=
datetime
.
timestamp
(
datetime
.
now
())
self
.
marcaTiempo
=
int
(
segHoy
-
segReg
)
'''
prueba=Dato("in24.inetnebr.com - - [01/Aug/1995:00:00:01 -0400]
\"
GET /shuttle/missions/sts-68/news/sts-68-mcc-05.txt HTTP/1.0
\"
200 1839")
print(prueba.hostRemoto)
print(prueba.fecha)
print(prueba.metodoPeticion)
print(prueba.vProtocolo)
print(prueba.statusCode)
print(prueba.volumenTransf)
print(prueba.marcaTiempo)'''
\ No newline at end of file
codigo/Gestor.py
0 → 100644
View file @
4edf1a54
File mode changed
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