Loga Usuários!
Publicado por Leonardo Berbert Gomes 30/12/2004
[ Hits: 5.589 ]
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"
HCrawler 3.0 - crawler escrito em Python 3
Bot que baixa o KDE 3.4 e a QT para o Slackware 10.1
CotDolar - Cotação do dólar em Python
Nenhum coment�rio foi encontrado.
Servidor de Backup com Ubuntu Server 24.04 LTS, RAID e Duplicati (Dell PowerEdge T420)
Visualizar câmeras IP ONVIF no Linux sem necessidade de instalar aplicativos
Atualizar Debian Online de uma Versão para outra
Instalar driver Nvidia no Debian 13
Redimensionando, espelhando, convertendo e rotacionando imagens com script
Debian 13 Trixie para Iniciantes
Convertendo pacotes DEB que usam ZSTD (Padrão Novo) para XZ (Padrão Antigo)
baschrc customizado pegeui vários. (3)
Rust é o "C da nossa geração"? (8)