Loga Usuários!
Publicado por Leonardo Berbert Gomes 30/12/2004
[ Hits: 5.715 ]
Homepage: https://www.linkedin.com/in/leoberbert
Script CGI em Python, que
tem a função de logar os
acessos a uma página da Web.
#!../CGIpython/cgipython
import os, sys, string
logfilename = "/absolute/path/to/log/file/directory/"
# change the directory path
exc_list = ["xxx.xxx.xxx.xxx", "xxx.xxx.xxx.xxx"]
#exc_list = []
# the list of machines to exclude from logging
######### And now the tricky bit #############
# Get input
infolist = sys.argv[1:] + [ os.popen('date').read(),
os.environ.get("REMOTE_ADDR", "--noaddr--"),
os.environ.get("HTTP_USER_AGENT", "--noagent--"),
os.environ.get("HTTP_REFERER", "--noreferer--"),
'\n']
# print infolist
out = string.join(infolist, ' : ')
address = os.environ.get("REMOTE_ADDR", "noaddr")
logfilename += (address + ".dat")
if address not in exc_list:
open(logfilename,'a').write(out)
print "Content-type: text/html\n\n"
Script em Python 3.6 para fazer scrape de uma URL exportando métricas no formato Prometheus
hdns - Enumerador de diretórios
CotDolar - Cotação do dólar em Python
Nenhum comentário foi encontrado.
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
[Resolvido] VirtualBox can't enable the AMD-V extension
Como verificar a saúde dos discos no Linux
Como instalar , particionar, formatar e montar um HD adicional no Linux?
Como automatizar sua instalação do Ubuntu para desenvolvimento de software.
Não consigo instalar distro antiga no virtualbox nem direto no hd (11)
Quais os códigos mais dificeis que vcs sabem fazer? (12)
systemd-resol... precisa ser reiniciado periodicamente [RESOLVIDO] (7)









