Skip to content
This repository was archived by the owner on Mar 13, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/python.nja
*.pyc
41 changes: 41 additions & 0 deletions Internet/Info_IP.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/python
# -*- encoding: utf-8 -*-

#######################################
# ### Raúl Caro Pastorino ### #
## ## ## ##
### # https://github.com/fryntiz/ # ###
## ## ## ##
# ### 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 ##
##############################
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]

# 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 = ''

# Devuelve el país o la cadena vacía
return pais

print getPais('8.8.8.8')
59 changes: 59 additions & 0 deletions Sistema/Informacion_Sistema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/python
# -*- encoding: utf-8 -*-

#######################################
# ### Raúl Caro Pastorino ### #
## ## ## ##
### # https://github.com/fryntiz/ # ###
## ## ## ##
# ### 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
# Sistema operativo → Linux

##############################
## LIBRERÍAS ##
##############################
import os
import datetime


class info():

# Obtener nombre para el usuario actual
def getUser(self):
user = os.getlogin()
return user

# Obtener nombre del Equipo
def getSysName(self):
sysName = os.uname()[1]
return sysName

# Obtener tipo del Sistema Operativo
def getSysType(self):
sysType = os.uname()[0]
return sysType

# Obtener Versión del Kernel
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 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()
return fecha
29 changes: 0 additions & 29 deletions python.nja

This file was deleted.