My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# ----------------------------------------------------------------------------
# http://... - vários
# Mostra os últimos 5 avisos de segurança de sistemas de Linux/UNIX.
# Suportados: Debian Fedora FreeBSD Gentoo Mandriva Slackware Suse Ubuntu.
# Uso: zzsecurity [distros]
# Ex.: zzsecutiry
# zzsecurity fedora
# zzsecurity debian gentoo
#
# Autor: Thobias Salazar Trevisan, www.thobias.org
# Desde: 2004-12-23
# Licença: GPL
# Requisitos: zzminusculas
# ----------------------------------------------------------------------------
zzsecurity ()
{
zzzz -h security "$1" && return

local url limite distros
local n=5
local ano=$(date '+%Y')
local distros='debian fedora freebsd gentoo mandriva slackware suse ubuntu'

limite="sed ${n}q"

[ "$1" ] && distros=$(echo $* | zzminusculas)

# Debian
if zztool grep_var debian "$distros"
then
url='http://www.debian.org'
echo
zztool eco '** Atualizações Debian woody'
echo "$url"
$ZZWWWDUMP "$url" |
sed -n '
/Security Advisories/,/_______/ {
/\[[0-9]/ s/^ *//p
}' |
$limite
fi

# Slackware
if zztool grep_var slackware "$distros"
then
echo
zztool eco '** Atualizações Slackware'
url="http://www.slackware.com/security/list.php?l=slackware-security&y=$ano"
echo "$url"
$ZZWWWDUMP "$url" |
sed '
/[0-9]\{4\}-[0-9][0-9]/!d
s/\[sla.*ty\]//
s/^ *//' |
$limite
fi

# Gentoo
if zztool grep_var gentoo "$distros"
then
echo
zztool eco '** Atualizações Gentoo'
url='http://www.gentoo.org/security/en/index.xml'
echo "$url"
$ZZWWWDUMP "$url" |
sed -n '
s/^ *//
/^GLSA/, /^$/ !d
/[0-9]\{4\}/ {
s/\([-0-9]* \) *[a-zA-Z]* *\(.*[^ ]\) *[0-9][0-9]* *$/\1\2/
p
}' |
$limite
fi

# Mandriva
if zztool grep_var mandriva "$distros"
then
echo
zztool eco '** Atualizações Mandriva'
url='http://www.mandriva.com/en/rss/feed/security'
echo "$url"
$ZZWWWHTML "$url" |
sed -n '/<title>/{
s/<[^>]*>//g
s/^ *//
/^Mandriva/d
p
}' |
$limite
fi

# Suse
if zztool grep_var suse "$distros"
then
echo
zztool eco '** Atualizações Suse'
url='http://www.novell.com/linux/security/advisories.html'
echo "$url"
$ZZWWWDUMP "$url" |
sed -n 's/^.* \([0-9][0-9] *... *[0-9][0-9][0-9][0-9]\)/\1/p' |
$limite
fi

# Fedora
if zztool grep_var fedora "$distros"
then
echo
zztool eco '** Atualizações Fedora'
url='http://www.linuxsecurity.com/content/blogcategory/89/102/'
echo "$url"
$ZZWWWHTML "$url" |
sed -n '
/contentpagetitle/ {
# O título está na próxima linha
n
# Remove TABs e espaços do início
s/^[^A-Za-z0-9]*//
# Remove </a>
s|</a>||
# Mostra o resultado
p
}' |
$limite
fi

# FreeBSD
if zztool grep_var freebsd "$distros"
then
echo
zztool eco '** Atualizações FreeBSD'
url='http://www.freebsd.org/security/advisories.rdf'
echo "$url"
$ZZWWWDUMP "$url" |
sed -n '
/<title>/ {
s/<[^>]*>//g
s/^ *//
/BSD-SA/p
}' |
$limite
fi

# Ubuntu
if zztool grep_var ubuntu "$distros"
then
url='http://www.ubuntu.com/usn/rss.xml'
echo
zztool eco '** Atualizações Ubuntu'
echo "$url"
$ZZWWWHTML "$url" |
sed -n '/item/,$ s@.*<title>\(.*\)@\1@p' |
$limite
fi
}

Change log

r710 by aureliojargas on Mar 29, 2012   Diff
SEGURANÇA: $1 colocado entre aspas na
chamada padrão zzzz -h de todas as
funções.
Go to: 
Sign in to write a code review

Older revisions

r706 by aureliojargas on Mar 29, 2012   Diff
lint: é desnecessário colocar $()
dentro de aspas.
r669 by aureliojargas on Mar 28, 2012   Diff
lint: removendo espaços inúteis. Parte
2.
r474 by aureliojargas on May 20, 2011   Diff
Adicionado campo Requisitos: em todas
as funções que ainda faltavam. Agora o
campo Requisitos: é confiável, e pode
ser verificado com o novo script
'requisitos'.
All revisions of this file

File info

Size: 3294 bytes, 155 lines
Powered by Google Project Hosting