From f3ecb586d77bafa5b86d5863941c575a4445f2f9 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 02:59:58 +0200 Subject: [PATCH 01/17] =?UTF-8?q?Creado=20script=20para=20obtener=20inform?= =?UTF-8?q?aci=C3=B3n=20del=20sistema?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sistema/Informacion_Sistema.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Sistema/Informacion_Sistema.py diff --git a/Sistema/Informacion_Sistema.py b/Sistema/Informacion_Sistema.py new file mode 100644 index 0000000..e69de29 From 409d76e74c42616c7ef3c2112a13ad08e471d387 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 03:00:30 +0200 Subject: [PATCH 02/17] Cabecera del script --- Sistema/Informacion_Sistema.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sistema/Informacion_Sistema.py b/Sistema/Informacion_Sistema.py index e69de29..7858758 100644 --- a/Sistema/Informacion_Sistema.py +++ b/Sistema/Informacion_Sistema.py @@ -0,0 +1,14 @@ +#!/usr/bin/python +# -*- encoding: utf-8 -*- + +####################################### +# ### Raúl Caro Pastorino ### # +## ## ## ## +### # https://github.com/fryntiz/ # ### +## ## ## ## +# ### www.fryntiz.es ### # +####################################### + +############################## +## LIBRERÍAS ## +############################## From c8ef0c7651c5342515c8940ec40b1303e0f2b988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Caro=20Pastorino?= Date: Thu, 26 Oct 2017 03:01:59 +0200 Subject: [PATCH 03/17] Deleted file to ninja ide project --- python.nja | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 python.nja diff --git a/python.nja b/python.nja deleted file mode 100644 index b874d0e..0000000 --- a/python.nja +++ /dev/null @@ -1,29 +0,0 @@ -{ - "mainFile": "", - "use-tabs": true, - "venv": "", - "relatedProjects": [], - "name": "Python", - "license": "GNU General Public License v3", - "url": "", - "pythonPath": "python", - "preExecScript": "", - "additional_builtins": [], - "programParams": "", - "indentation": 4, - "PYTHONPATH": "", - "supported-extensions": [ - ".py", - ".html", - ".jpg", - ".png", - ".ui", - ".css", - ".json", - ".js", - ".ini" - ], - "project-type": "", - "postExecScript": "", - "description": "" -} \ No newline at end of file From 2a73b98b2200d5766f06aba052489b6fcf9772eb Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 03:06:24 +0200 Subject: [PATCH 04/17] =?UTF-8?q?A=C3=B1adido=20objetivo=20del=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sistema/Informacion_Sistema.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sistema/Informacion_Sistema.py b/Sistema/Informacion_Sistema.py index 7858758..7fe83f1 100644 --- a/Sistema/Informacion_Sistema.py +++ b/Sistema/Informacion_Sistema.py @@ -9,6 +9,10 @@ # ### www.fryntiz.es ### # ####################################### +# Script que contiene una clase, la cual al instanciarla creará +# un objeto con todos los datos del sistema que estamos usando +# de forma que será accesible desde fuera + ############################## ## LIBRERÍAS ## ############################## From 2f5522f9a6d2c14e10109aee0c2f5ad5e91a2db7 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 10:04:54 +0200 Subject: [PATCH 05/17] =?UTF-8?q?Creado=20archivo=20con=20cabecera=20b?= =?UTF-8?q?=C3=A1sica?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Internet/Info_IP.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Internet/Info_IP.py diff --git a/Internet/Info_IP.py b/Internet/Info_IP.py new file mode 100644 index 0000000..17a5e96 --- /dev/null +++ b/Internet/Info_IP.py @@ -0,0 +1,15 @@ +#!/usr/bin/python +# -*- encoding: utf-8 -*- + +####################################### +# ### Raúl Caro Pastorino ### # +## ## ## ## +### # https://github.com/fryntiz/ # ### +## ## ## ## +# ### www.fryntiz.es ### # +####################################### + + +############################## +## LIBRERÍAS ## +############################## From 93a3b6acb34f61ade9e1cb0f12b94902d4c4c2a5 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 10:08:34 +0200 Subject: [PATCH 06/17] =?UTF-8?q?Creada=20clase=20y=20funci=C3=B3n=20para?= =?UTF-8?q?=20obtener=20usuario=20actual?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sistema/Informacion_Sistema.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sistema/Informacion_Sistema.py b/Sistema/Informacion_Sistema.py index 7fe83f1..7c2314c 100644 --- a/Sistema/Informacion_Sistema.py +++ b/Sistema/Informacion_Sistema.py @@ -12,7 +12,17 @@ # Script que contiene una clase, la cual al instanciarla creará # un objeto con todos los datos del sistema que estamos usando # de forma que será accesible desde fuera +# Sistema operativo → Linux ############################## ## LIBRERÍAS ## ############################## +import os + + +class info(): + + # Obtener nombre para el usuario actual + def getUser(self): + user = os.getlogin() + return user From fb64ca4d8bb38d24cd4453c53429fbc18e2ee824 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 10:09:05 +0200 Subject: [PATCH 07/17] =?UTF-8?q?Funci=C3=B3n=20para=20obtener=20fecha=20y?= =?UTF-8?q?=20hora=20actual=20del=20sistema?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sistema/Informacion_Sistema.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sistema/Informacion_Sistema.py b/Sistema/Informacion_Sistema.py index 7c2314c..b221fd5 100644 --- a/Sistema/Informacion_Sistema.py +++ b/Sistema/Informacion_Sistema.py @@ -18,6 +18,7 @@ ## LIBRERÍAS ## ############################## import os +import datetime class info(): @@ -26,3 +27,8 @@ class info(): def getUser(self): user = os.getlogin() return user + + # Obtener Fecha y Hora actual en el sistema + def getFullDate(self): + fecha = datetime.datetime.today() + return fecha From bd5c878d9c5119090e75238082cd8dc23cc7c09c Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 10:09:33 +0200 Subject: [PATCH 08/17] =?UTF-8?q?A=C3=B1adida=20funci=C3=B3n=20para=20obte?= =?UTF-8?q?ner=20nombre=20del=20equipo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sistema/Informacion_Sistema.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sistema/Informacion_Sistema.py b/Sistema/Informacion_Sistema.py index b221fd5..26e8622 100644 --- a/Sistema/Informacion_Sistema.py +++ b/Sistema/Informacion_Sistema.py @@ -28,6 +28,11 @@ def getUser(self): user = os.getlogin() return user + # Obtener nombre del Equipo + def getSysName(self): + sysName = os.uname()[1] + return sysName + # Obtener Fecha y Hora actual en el sistema def getFullDate(self): fecha = datetime.datetime.today() From 70423ae88ec7d988b48eb473e040883edcfed852 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 10:09:58 +0200 Subject: [PATCH 09/17] =?UTF-8?q?A=C3=B1adida=20funci=C3=B3n=20para=20obte?= =?UTF-8?q?ner=20nombre=20del=20sistema=20operativo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sistema/Informacion_Sistema.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sistema/Informacion_Sistema.py b/Sistema/Informacion_Sistema.py index 26e8622..1a4b582 100644 --- a/Sistema/Informacion_Sistema.py +++ b/Sistema/Informacion_Sistema.py @@ -33,6 +33,11 @@ def getSysName(self): sysName = os.uname()[1] return sysName + # Obtener tipo del Sistema Operativo + def getSysType(self): + sysType = os.uname()[0] + return sysType + # Obtener Fecha y Hora actual en el sistema def getFullDate(self): fecha = datetime.datetime.today() From defd21744b460953ffef5b9dfc61b2baf209f364 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 10:10:20 +0200 Subject: [PATCH 10/17] =?UTF-8?q?A=C3=B1adida=20funci=C3=B3n=20para=20obte?= =?UTF-8?q?ner=20el=20nombre=20del=20Kernel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sistema/Informacion_Sistema.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sistema/Informacion_Sistema.py b/Sistema/Informacion_Sistema.py index 1a4b582..23b1e0f 100644 --- a/Sistema/Informacion_Sistema.py +++ b/Sistema/Informacion_Sistema.py @@ -38,6 +38,11 @@ def getSysType(self): sysType = os.uname()[0] return sysType + # Obtener Versión del Kernel + def getSysKernel(self): + sysKernel = os.uname()[2] + return sysKernel + # Obtener Fecha y Hora actual en el sistema def getFullDate(self): fecha = datetime.datetime.today() From ac867a42b64790c7682043c1518666c44fab9260 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 10:10:43 +0200 Subject: [PATCH 11/17] =?UTF-8?q?Obtener=20Nombre=20del=20sistema=20Operat?= =?UTF-8?q?ivo,=20Kernel=20y=20fecha=20de=20actualizaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sistema/Informacion_Sistema.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sistema/Informacion_Sistema.py b/Sistema/Informacion_Sistema.py index 23b1e0f..925b16a 100644 --- a/Sistema/Informacion_Sistema.py +++ b/Sistema/Informacion_Sistema.py @@ -43,6 +43,11 @@ def getSysKernel(self): sysKernel = os.uname()[2] return sysKernel + # Obtener Nombre del sistema Operativo, Kernel y fecha de actualización + def getSysInfo(self): + sysInfo = os.uname()[3] + return sysInfo + # Obtener Fecha y Hora actual en el sistema def getFullDate(self): fecha = datetime.datetime.today() From 295d8a74db0b7e846bddf7905cd684d8915c2274 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 10:10:58 +0200 Subject: [PATCH 12/17] =?UTF-8?q?Funci=C3=B3n=20para=20Obtener=20arquitect?= =?UTF-8?q?ura=20del=20Sistema=20Operativo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sistema/Informacion_Sistema.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sistema/Informacion_Sistema.py b/Sistema/Informacion_Sistema.py index 925b16a..5222d1d 100644 --- a/Sistema/Informacion_Sistema.py +++ b/Sistema/Informacion_Sistema.py @@ -48,6 +48,11 @@ def getSysInfo(self): sysInfo = os.uname()[3] return sysInfo + # Obtener arquitectura del Sistema Operativo + def getSysArch(self): + sysArch = os.uname()[4] + return sysArch + # Obtener Fecha y Hora actual en el sistema def getFullDate(self): fecha = datetime.datetime.today() From 58e3e2710421590544c08c3a206e6d31c9a2a818 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 10:17:10 +0200 Subject: [PATCH 13/17] Ignorando archivos compilados (pyc) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 48c0738..3094f5f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /python.nja +*.pyc From 79296f906a47a12bfa74e421dc77f070672467b4 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 10:42:04 +0200 Subject: [PATCH 14/17] =?UTF-8?q?A=C3=B1adido=20objetivo=20del=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Internet/Info_IP.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Internet/Info_IP.py b/Internet/Info_IP.py index 17a5e96..f4699a6 100644 --- a/Internet/Info_IP.py +++ b/Internet/Info_IP.py @@ -9,6 +9,9 @@ # ### www.fryntiz.es ### # ####################################### +# Función para obtener información sobre una IP pasada como parámetro +# En caso de no recibir una IP tomará nuestra IP pública +# Se depende del paquete "geoiplookup" en el sistema operativo ############################## ## LIBRERÍAS ## From 71fec24f1102b14a0149429e86f527a23a04478b Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 10:42:28 +0200 Subject: [PATCH 15/17] =?UTF-8?q?Se=20crea=20el=20pa=C3=ADs=20con=20los=20?= =?UTF-8?q?datos=20extraidos=20y=20se=20limpia?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Internet/Info_IP.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Internet/Info_IP.py b/Internet/Info_IP.py index f4699a6..d3031c9 100644 --- a/Internet/Info_IP.py +++ b/Internet/Info_IP.py @@ -16,3 +16,13 @@ ############################## ## LIBRERÍAS ## ############################## +import commands + +def getPais(IP): + + # Extraer cadena con el pais + pais = commands.getoutput("geoiplookup " + str(IP)) + + # Limpiar País + pais = pais.split('\n')[0].split(': ')[1] + From 102b6d908840a1f2004089e3207f0d8432a1c390 Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 10:43:03 +0200 Subject: [PATCH 16/17] Se avisa si no existe instalado geoiplookup --- Internet/Info_IP.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Internet/Info_IP.py b/Internet/Info_IP.py index d3031c9..123ce93 100644 --- a/Internet/Info_IP.py +++ b/Internet/Info_IP.py @@ -26,3 +26,11 @@ def getPais(IP): # Limpiar País pais = pais.split('\n')[0].split(': ')[1] + # Si no está instalado el programa "geoiplookup" + if pais == "sh: geoiplookup: not found": + print("Necesitas instalar geoiplookup para poder continuar") + pais = '' + #Cuando ocurre un error o extrae cadena no válida + elif len(str(pais)) > 200: + print("No ha sido posible conseguir el país para la IP → " + str(IP)) + pais = '' From d8530390890d98f83065611a998d96dcf9b9a90c Mon Sep 17 00:00:00 2001 From: fryntiz Date: Thu, 26 Oct 2017 10:43:36 +0200 Subject: [PATCH 17/17] =?UTF-8?q?Se=20devuelve=20el=20pa=C3=ADs=20y=20se?= =?UTF-8?q?=20llama=20como=20ejemplo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Internet/Info_IP.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Internet/Info_IP.py b/Internet/Info_IP.py index 123ce93..412b813 100644 --- a/Internet/Info_IP.py +++ b/Internet/Info_IP.py @@ -34,3 +34,8 @@ def getPais(IP): elif len(str(pais)) > 200: print("No ha sido posible conseguir el país para la IP → " + str(IP)) pais = '' + + # Devuelve el país o la cadena vacía + return pais + +print getPais('8.8.8.8')