Mnage
darcs-hash:20050812105313-dc76e-b52abd1eeea2ad29e129ca60ec9f3cb6c2320e91.gz
This commit is contained in:
parent
06f117f556
commit
ac7a677e19
5 changed files with 0 additions and 195 deletions
|
@ -1,7 +0,0 @@
|
|||
jour=/root/journal/journal
|
||||
echo >> ${jour}
|
||||
echo `date +"%d/%m/%Y %T"` _ `who am i|cut -d' ' -f1|cut -d'!' -f2` |tee -a $jour
|
||||
echo Taper et finir par Enter, C-d.
|
||||
cat >> /root/journal/journal
|
||||
echo >> /root/journal/journal
|
||||
|
63
fwtool.pl
63
fwtool.pl
|
@ -1,63 +0,0 @@
|
|||
#!/usr/bin/perl -w
|
||||
##
|
||||
## fwtool.pl
|
||||
##
|
||||
## Made by tab
|
||||
## Login <tab@crans.org>
|
||||
##
|
||||
## Started on Sun Dec 2 19:11:06 2001 tab
|
||||
## Last update dim 03 fév 2002 21:17:55 CET Nicolas STRANSKY
|
||||
##
|
||||
|
||||
use strict;
|
||||
|
||||
my $paireipmac = "/CRANS/generated/ether/pairesMAC-IP.txt";
|
||||
my $blacklist = "/CRANS/confs/blacklist.cf";
|
||||
|
||||
sub iptables
|
||||
{
|
||||
my ($string) = @_;
|
||||
system("/sbin/iptables ".$string."\n");
|
||||
}
|
||||
|
||||
sub mac
|
||||
{
|
||||
open MACFILE, $paireipmac;
|
||||
while (my $line = <MACFILE>) {
|
||||
my ($mac, $ip) = (split " ", $line)[0,1];
|
||||
my $ipclass = (split /\./, $ip)[2];
|
||||
iptables("-A S".$ipclass." -s ".$ip." -m mac --mac-source ".$mac." -j ACCEPT");
|
||||
}
|
||||
close(MACFILE);
|
||||
}
|
||||
|
||||
sub blacklist
|
||||
{
|
||||
open LIST, $blacklist;
|
||||
|
||||
while (my $line = <LIST>) {
|
||||
my ($fd1) = (split "#", $line)[0];
|
||||
if (!($fd1 =~ /^$/))
|
||||
{
|
||||
my ($ip, $port) = (split ":", $fd1);
|
||||
my @tab = split ",", $port;
|
||||
iptables("-A LIST -s ".$ip." -j BLACKLIST");
|
||||
foreach my $i (@tab) {
|
||||
iptables("-A BLACKLIST -p tcp -s ".$ip." --dport ".$i." -j ACCEPT");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
close(LIST);
|
||||
}
|
||||
|
||||
if (@ARGV != 1)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ($ARGV[0] eq 'blacklist')
|
||||
{ blacklist(); }
|
||||
elsif ($ARGV[0] eq 'mac')
|
||||
{ mac(); }
|
||||
|
108
if-traffic
108
if-traffic
|
@ -1,108 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
# Hey, c'est du -*- python-*-, ça !
|
||||
#
|
||||
# Ecrit mi-février par Chep pour les besoins locaux...
|
||||
#
|
||||
|
||||
import string,shelve,pickle,sys
|
||||
|
||||
def tuple_to_dico(tup) :
|
||||
"construit un dictionnaire à partir du tuple d'une interface"
|
||||
fields={ 0:'in', 1:'inp', 2:'ierr', 3:'idrop', 4:'ififo', 5:'iframe', 6:'icompressed',
|
||||
7:'imulticast', 8:'out', 9:'outp', 10:'oerr', 11:'odrop', 12:'ofifo', 13:'cols',
|
||||
14:'carrier', 15:'ocompressed' }
|
||||
dic = {}
|
||||
for n in fields.keys() :
|
||||
dic[ fields[n] ] = data[ n ]
|
||||
if dic['outp']: dic['colr'] = long((100 * dic['cols']) / dic['outp'])
|
||||
else: dic['colr'] = 0L
|
||||
|
||||
dic['npi'] = dic['ierr']+dic['idrop'] + dic['ififo'] + dic['iframe'] +dic['icompressed']
|
||||
dic['npo'] = dic['oerr']+dic['odrop']+dic['ofifo']+dic['carrier']+dic['ocompressed']
|
||||
|
||||
dic['mnpi'] = 1000 * dic['npi']
|
||||
dic['mnpo'] = 1000 * dic['npo']
|
||||
dic['unpi'] = 1000 * dic['mnpi']
|
||||
dic['unpo'] = 1000 * dic['mnpo']
|
||||
|
||||
if dic['inp']: dic['npir'] = long((100 * dic['npi']) / dic['inp'])
|
||||
else:
|
||||
if dic['ierr']: dic['npir'] = 99L # erreurs et pas de paquets entrants !
|
||||
else: dic['npir'] = 0L
|
||||
if dic['outp']: dic['npor'] = long((100 * dic['npo']) / dic['outp'])
|
||||
else:
|
||||
if dic['oerr']: dic['npor'] = 99L
|
||||
else: dic['npor'] = 0L
|
||||
|
||||
# totaux dans les deux sens (tnp = total nasty pkts,tgp = total good pkts)
|
||||
dic['tnp'] = dic['npi'] + dic['npo']
|
||||
dic['tgp'] = dic['inp'] + dic['outp']
|
||||
return dic
|
||||
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
sys.stderr.write("""usage: %s ethN [var1] [var2] [long ifname]\n
|
||||
var1 and var2 can be :
|
||||
in: incoming bytes
|
||||
out: outgoing bytes
|
||||
cols: collisions
|
||||
inp: incoming packets
|
||||
outp: outgoing packets
|
||||
colr: collision ratio, in percent (cols / outp)
|
||||
npi : incoming 'nasty' packets
|
||||
npo : outgoing 'nasty' packets
|
||||
mnpi : 1000 * npi
|
||||
mnpo : 1000 * npo
|
||||
npir: incoming 'nasty' packet ratio
|
||||
npor: outgoing 'nasty' packet ratio
|
||||
|
||||
default var1 and var2 are in,out.
|
||||
Result is to be fed to MRTG.
|
||||
""" % (sys.argv[0]))
|
||||
sys.exit(0)
|
||||
|
||||
iface = sys.argv[1]
|
||||
ifname = iface
|
||||
|
||||
if len(sys.argv) > 2:
|
||||
var1 = sys.argv[2]
|
||||
if len(sys.argv) > 3:
|
||||
var2 = sys.argv[3]
|
||||
if len(sys.argv) > 4:
|
||||
ifname = sys.argv[4]
|
||||
else: var2 = 'out'
|
||||
else:
|
||||
var1 = 'in'
|
||||
var2 = 'out'
|
||||
|
||||
fd = open('/proc/net/dev','r')
|
||||
sl = fd.readlines()
|
||||
fd.close()
|
||||
|
||||
Ifaces = {}
|
||||
for s in sl:
|
||||
ln = string.split(s,':')
|
||||
if len(ln) < 2: continue
|
||||
data = string.split(ln[1])
|
||||
try :
|
||||
n = long(data[1])
|
||||
except : continue
|
||||
for k in range(len(data)):
|
||||
data[k] = long(data[k])
|
||||
Ifaces[string.strip(ln[0])] = tuple_to_dico(data)
|
||||
|
||||
i = Ifaces[iface]
|
||||
|
||||
# python1.5 fait str(1234L) =="1234L", il faut enlever le L..
|
||||
ver=sys.version[0]
|
||||
if ver[0]=='1' :
|
||||
s1 = str( i[var1])[:-1]
|
||||
s2 = str( i[var2])[:-1]
|
||||
else :
|
||||
s1 = str( i[var1])
|
||||
s2 = str( i[var2])
|
||||
|
||||
print "%s\n%s\n\n%s" % (s1, s2 ,ifname)
|
||||
|
||||
|
5
modifetc
5
modifetc
|
@ -1,5 +0,0 @@
|
|||
# utilisation : " . =modifetc "
|
||||
|
||||
alias cvcommit='cvs commit | grep -v "^?"'
|
||||
CVSROOT="/usr/cvs-rep"
|
||||
export CVSROOT
|
12
supercvs
12
supercvs
|
@ -1,12 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# OS Pas propre mais c'est pas moi qui ait commencé...
|
||||
#
|
||||
|
||||
if false && [ `id -g` != 102 ] && [ X$CVSROOT = "X/home/httpd/CVS-Repository" ]; then
|
||||
echo "Faire 'newgrp webcvs' avant de commencer !!!"
|
||||
exit 1
|
||||
fi
|
||||
exec /usr/bin/cvs ${1+"$@"}
|
||||
# -P pour ne pas recreer les repertoires vides.
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue