
Я новичок в Ubuntu и пользуюсь им уже пару недель. Недавно я столкнулся с проблемой, когда мне нужно было отобразить определенные данные в файле. Вот вывод, отображаемый на терминале.
Potential vulnerability found (CVE-2009-4028)
CVSS Score is 6.8
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2009-4030)
CVSS Score is 4.4
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2009-5026)
CVSS Score is 6.8
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0075)
CVSS Score is 1.7
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0087)
CVSS Score is 4.0
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0101)
CVSS Score is 4.0
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0102)
CVSS Score is 4.0
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0112)
CVSS Score is 3.5
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0113)
CVSS Score is 5.5
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0114)
CVSS Score is 3.0
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0115)
CVSS Score is 4.0
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0116)
CVSS Score is 4.9
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0118)
CVSS Score is 4.9
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0119)
CVSS Score is 4.0
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0120)
CVSS Score is 4.0
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0484)
CVSS Score is 4.0
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0485)
CVSS Score is 4.0
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0490)
CVSS Score is 4.0
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0492)
CVSS Score is 2.1
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0540)
CVSS Score is 4.0
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0553)
CVSS Score is 7.5
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0574)
CVSS Score is 4.0
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2012-0583)
CVSS Score is 4.0
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2013-1492)
CVSS Score is 7.5
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2013-1506)
CVSS Score is 2.8
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Potential vulnerability found (CVE-2013-1521)
CVSS Score is 6.5
Full vulnerability match (incl. edition/language)
File "/usr/sbin/mysqld" (CPE = cpe:/a:mysql:mysql:5.1:::) on host glynis-desktop (key glynis-desktop)
Я намерен отобразить только поле «Потенциальная уязвимость найдена» и соответствующую оценку. Кажется, там около 9995 записей, и я хотел бы отобразить их все.
Я использую эту команду на данный момент
awk '/CVSS Score is/ < /Potential vulnerability found/' output.txt
но это, кажется, отображает только имя уязвимости или оценку. Как мне отобразить это в файле (текст, excel) так, чтобы отображались все уязвимости и соответствующая оценка.
Любая помощь будет оценена по достоинству. Спасибо.
решение1
Вы можете использоватьgrep
:
grep -E "Potential vulnerability found|CVSS Score is" input_file
Если вы хотите сохранить вывод в текстовом файле, то используйте:
grep -E "Potential vulnerability found|CVSS Score is" input_file > output_file