Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
779 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
#!/usr/bin/php | ||
|
||
<?php | ||
|
||
/* | ||
* File : agenda.php | ||
* Mantenedor : Ataliba de Oliveira Teixeira < ataliba em ataliba ponto eti ponto br ) | ||
* | ||
* ---------------------------------------------------------------- | ||
* | ||
* Programa que faz o básico, ou seja, procura um número de telefone ( ramal ), em uma lista | ||
* pré-cadastrada em um txt que tem um padrão específico. | ||
* Na realidade, a idéia é ter um comando simples que faça a busca do telefone de alguém. | ||
* A primeira versao vai ser feita em PHP, mas tendo em vista o Python ser uma linguagem mais | ||
* tranquila para a criação de comandos deste tipo, em breve solto a versão em Python. | ||
* | ||
* ---------------------------------------------------------------- | ||
* | ||
* Para instalação : | ||
* | ||
* Para instalar é só executar os seguintes passos : | ||
* | ||
* Primeiro, procure aonde está o binário do php em seu sistema : | ||
* # whereis php | ||
* Edite a primeira linha do programa com este resultado. | ||
* Depois, efetue os seguintes passos : | ||
* # mv agenda.php /usr/bin/agenda | ||
* # chmod 755 /usr/bin/agenda | ||
* | ||
* ----------------------------------------------------------------- | ||
* | ||
* Changelog : | ||
* | ||
* 20-06-2006 : Primeira versão pública do script | ||
* | ||
* ----------------------------------------------------------------- | ||
* | ||
* Licensa : | ||
* | ||
* GPLv2 | ||
* | ||
*/ | ||
|
||
// constantes do programa | ||
$tmphome = shell_exec("echo \$HOME"); | ||
|
||
$HOME = str_replace("\n","",$tmphome); | ||
|
||
define("DATABASE_FILE","$HOME/.agendatabajara"); | ||
define("VERSION","0.1"); | ||
|
||
// funcoes do programa | ||
|
||
function print_help() | ||
{ | ||
echo "Agenda - Pequena agenda de ramais em PHP \n" | ||
."Version ".VERSION."\n" | ||
."Usage : \n" | ||
." add - adicionar um número na agenda \n" | ||
." find - procura um nome na agenda \n \n"; | ||
|
||
} | ||
|
||
function find_telef($nome) | ||
{ | ||
if(!file_exists(DATABASE_FILE)) | ||
{ | ||
echo "Você ainda não tem uma base de usuários ... \n "; | ||
} | ||
|
||
if(!($fp = fopen(DATABASE_FILE, "r+"))) | ||
{ | ||
|
||
echo "Impossivel abrir o arquivo $txtsarchive para leitura \n"; | ||
|
||
return; | ||
} | ||
|
||
while(!feof($fp)) | ||
{ | ||
$text = fgets($fp, 500); | ||
if($text == NULL || $text == "") | ||
{ | ||
return; | ||
} | ||
else | ||
{ | ||
$agenda = explode("|",$text); | ||
} | ||
$pos = strpos("$agenda[0]","$nome"); | ||
|
||
if(is_int($pos)) | ||
{ | ||
echo "Nome : $agenda[0] / Ramal : $agenda[1] \n"; | ||
} | ||
|
||
} | ||
|
||
fclose($fp); | ||
|
||
} | ||
|
||
|
||
function insert_telef($nome,$ramal) | ||
{ | ||
|
||
$data = "$nome|$ramal\n"; | ||
|
||
$arquivo = DATABASE_FILE; | ||
|
||
$abre = fopen($arquivo, "a+"); | ||
$salva = fwrite($abre, $data); | ||
fclose($abre); | ||
|
||
|
||
} | ||
|
||
|
||
// corpo principal do programa | ||
|
||
if($argc < 2 ) | ||
print_help(); | ||
|
||
if($argc > 1 ) | ||
{ | ||
$option = $argv[1]; | ||
} | ||
else | ||
{ | ||
$option = ""; | ||
} | ||
|
||
switch($option) | ||
{ | ||
case "add": | ||
if($argc < 4 ) | ||
{ | ||
print_help(); | ||
} | ||
else | ||
{ | ||
$nome = $argv[2]; | ||
$telefone = $argv[3]; | ||
insert_telef($nome,$telefone); | ||
|
||
} | ||
|
||
break; | ||
|
||
case "find": | ||
|
||
if($argc < 3 ) | ||
{ | ||
print_help(); | ||
} | ||
else | ||
{ | ||
$nome = $argv[2]; | ||
find_telef($nome); | ||
|
||
} | ||
|
||
break; | ||
|
||
default: | ||
print_help(); | ||
break; | ||
|
||
} | ||
|
||
|
||
?> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/bin/sh | ||
# | ||
# sareatualiza.sh - atualizacao de regras do rules emporium | ||
# | ||
# HomePage : http://www.ataliba.eti.br | ||
# Autor : Ataliba Teixeira < ataliba em ataliba ponto eti ponto br | ||
################################################# | ||
# Uso : | ||
# Copie este arquivo para um dos diretórios cron do SlackwareBox | ||
# cron.daily / cron.weekly / cron.monthly | ||
# e dê permissão de execução ao mesmo | ||
# chmod 755 sareatualiza.sh | ||
# | ||
################################################## | ||
# | ||
|
||
|
||
{ | ||
SPAMDIR=/tmp/spamassassin | ||
|
||
mkdir $SPAMDIR | ||
|
||
cd $SPAMDIR | ||
|
||
wget http://www.rulesemporium.com/rules/72_sare_redirect_post3.0.0.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_evilnum0.cf | ||
wget http://www.rulesemporium.com/rules/70_sare_evilnum1.cf | ||
wget http://www.rulesemporium.com/rules/70_sare_evilnum2.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_bayes_poison_nxm.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_html0.cf | ||
wget http://www.rulesemporium.com/rules/70_sare_html1.cf | ||
wget http://www.rulesemporium.com/rules/70_sare_html2.cf | ||
wget http://www.rulesemporium.com/rules/70_sare_html3.cf | ||
wget http://www.rulesemporium.com/rules/70_sare_html_eng.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_header.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_specific.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_adult.cf | ||
|
||
wget http://www.rulesemporium.com/rules/72_sare_bml_post25x.cf | ||
|
||
wget http://www.rulesemporium.com/rules/99_sare_fraud_post25x.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_spoof.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_random.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sc_top200.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_oem.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_genlsubj.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_highrisk.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_unsub.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_uri0.cf | ||
wget http://www.rulesemporium.com/rules/70_sare_uri1.cf | ||
wget http://www.rulesemporium.com/rules/70_sare_uri2.cf | ||
wget http://www.rulesemporium.com/rules/70_sare_uri3.cf | ||
wget http://www.rulesemporium.com/rules/70_sare_uri4.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_whitelist.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_obfu.cf | ||
wget http://www.rulesemporium.com/rules/70_sare_obfu2.cf | ||
wget http://www.rulesemporium.com/rules/70_sare_obfu3.cf | ||
wget http://www.rulesemporium.com/rules/70_sare_obfu4.cf | ||
|
||
wget http://www.rulesemporium.com/rules/70_sare_stocks.cf | ||
|
||
mv * /usr/share/spamassassin | ||
|
||
PID=`ps ax | grep "/usr/bin/spamd -L" | grep -v grep |awk -F" " '{print $1}'` | ||
|
||
kill -9 $PID | ||
|
||
cd ~ | ||
|
||
rm -rf $SPAMDIR | ||
|
||
|
||
} & | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#!/bin/sh | ||
# file : bind.sh | ||
######################################################## | ||
# Author : Philippe Chadefaux 10 Jan 2002 | ||
# Modified by : Ataliba Teixeira on 18 Aug 2005 | ||
# Webpage : http://cerebro.freeshell.org | ||
# | ||
######################################################## | ||
# | ||
# An rc script to reload, start and other options to | ||
# manage the bind service on OpenBSD or other BSD systems | ||
# | ||
# to use this script : | ||
# /bin/bind (stop|start|reload|restart|status) | ||
# | ||
# To install this script copy, type this commands : | ||
# # mv bind.sh /bin/bind | ||
# # chmod 755 /bin/bind | ||
# | ||
######################################################## | ||
# Changelog : | ||
# | ||
# 18 Aug 2005 - Public version available on internet | ||
# | ||
######################################################## | ||
# License : | ||
# | ||
# Under GPL License | ||
# | ||
######################################################## | ||
|
||
case "$1" in | ||
start) | ||
|
||
if [ -x /var/run/named.pid ] | ||
then | ||
$0 stop | ||
fi | ||
|
||
/usr/sbin/named -t /var/named -u named | ||
echo -e "Starting Bind.... " | ||
sleep 2 | ||
if [ \( -e /var/run/named.pid \) ] | ||
then | ||
echo -e "Ok\n" | ||
logger -t "Bind" "Starting Bind" | ||
else | ||
echo -e "Failed\n" | ||
logger -t "Bind" "Bind start failed" | ||
fi | ||
;; | ||
stop) | ||
if [ \( -e /var/run/named.pid \) ] | ||
then | ||
PID=`cat /var/run/named.pid` | ||
kill -9 $PID | ||
sleep 2 | ||
fi | ||
if [ "`/bin/ps -axc |grep named | grep -v grep`" != "" ] | ||
then | ||
PIDON=`/bin/ps -axc | grep named | grep -v grep | awk '{print $1}'` | ||
kill -9 $PIDON | ||
sleep 2 | ||
fi | ||
|
||
if [ "`/bin/ps -axc |grep named | grep -v grep`" != "" ] | ||
then | ||
$0 stop | ||
fi | ||
|
||
if [ -x /var/run/named.pid ] | ||
then | ||
rm -f /var/run/named.pid | ||
fi | ||
|
||
echo -e "Bind stopped ....\n" | ||
logger -t "Bind" "Bind Stopped" | ||
|
||
;; | ||
reload) | ||
if [ \( -e /var/run/named.pid \) ] | ||
then | ||
|
||
TEST=`/bin/ps -axc |grep named | grep -v grep |wc -l` | ||
if [ $TEST != 1 ] | ||
then | ||
|
||
echo -e "Several sessions of Bind are launched TEST $TEST\n" | ||
echo -e "Service restarted ....!" | ||
$0 start | ||
else | ||
PID=`cat /var/run/named.pid` | ||
kill -HUP $PID | ||
echo -e "If your have this error, your think to increment the serial number ..!\n" | ||
echo -e "Reload the database....\n" | ||
logger -t "Bind" "Bind Reload make" | ||
fi | ||
fi | ||
;; | ||
restart) | ||
$0 start | ||
;; | ||
status) | ||
if [ \( -e /var/run/named.pid \) ] | ||
then | ||
PID=`cat /var/run/named.pid` | ||
echo -e "Bind is running (pid $PID)....\n" | ||
ETAT=`/usr/sbin/host -t SOA openbsd-edu.net` | ||
echo -e "$ETAT\n" | ||
else | ||
echo -e "Bind is not running\n" | ||
fi | ||
;; | ||
*) | ||
echo "Usage: $0 ( start | stop | reload | restart | status )" | ||
exit 1 | ||
esac | ||
|
||
exit 0 |
Oops, something went wrong.