Welcome to mirror list, hosted at ThFree Co, Russian Federation.

helper_show « include - github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6cda210337fa430f4688947bacd2e628f7b89d8b (plain)
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
156
157
158
159
160
161
162
163
164
#!/bin/sh

#################################################################################
#
#   Lynis
# ------------------
#
# Copyright 2007-2013, Michael Boelen
# Copyright 2013-2016, CISOfy
#
# Website  : https://cisofy.com
# Blog     : http://linux-audit.com
# GitHub   : https://github.com/CISOfy/lynis
#
# Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
# welcome to redistribute it under the terms of the GNU General Public License.
# See LICENSE file for usage of this software.
#
######################################################################
#
# Helper program to share details
#
######################################################################
#
# How to use:
# ------------
# Run: lynis show <option>
#
######################################################################

COMMANDS="audit show update"
OPTIONS="--auditor\n--check-all (-c)\n--config\n--cronjob (--cron)\n--debug\n--developer\n--help (-h)\n--info\n--license-key --log-file\n--manpage_(--man)\n--no-colors --no-log\n--pentest\n--profile\n--plugins-dir\n--quiet (-q)\n--quick (-Q)\n--report-file\n--reverse-colors\n--tests\n--tests-category\n--upload\n--verbose\n--version (-V)\n--view-categories"

SHOW_ARGS="commands help license man options pidfile plugindir profiles release releasedate tests version"
SHOW_HELP="lynis show ${BROWN}commands${NORMAL}          (all available commands)
lynis show ${BROWN}help${NORMAL}              (detailed information about arguments)
lynis show ${BROWN}license${NORMAL}           (license details)
lynis show ${BROWN}man${NORMAL}               (show help)
lynis show ${BROWN}options${NORMAL}           (available flags and options)
lynis show ${BROWN}pidfile${NORMAL}           (active file to stored process ID)
lynis show ${BROWN}plugindir${NORMAL}         (directory with plugins)
lynis show ${BROWN}profiles${NORMAL}          (discovered profiles)
lynis show ${BROWN}release${NORMAL}           (version)
lynis show ${BROWN}releasedate${NORMAL}       (date of release)
lynis show ${BROWN}tests skipped${NORMAL}     (which tests to skip according profile)
lynis show ${BROWN}version${NORMAL}           (${PROGRAM_NAME} version)"

AUDIT_ARGS="( dockerfile | system )"
AUDIT_HELP="
  audit ${CYAN}dockerfile${NORMAL}

  Perform audit on a Docker build file
  ${GRAY}Usage:${NORMAL} lynis audit dockerfile ${BROWN}<file>${NORMAL}


  audit ${CYAN}system${NORMAL}

  Perform system audit
  ${DARKGRAY}Usage:${NORMAL} lynis audit system
"

UPDATE_ARGS="info release"

SHOW_TESTS_ARGS="skipped"

COMMANDS_AUDIT_SYSTEM_USAGE="Usage: lynis audit system"
COMMANDS_AUDIT_SYSTEM_FUNCTION="Function: performs a security audit of the system"

if [ $# -gt 0 ]; then
    case $1 in
        "commands")
            if [ $# -eq 1 ]; then
                echo "\n${WHITE}Commands:${NORMAL}"
                for I in ${COMMANDS}; do
                    echo "lynis ${CYAN}${I}${NORMAL}"
                done
                echo ""
              else
                shift
                if [ $# -eq 1 ]; then
                    case $1 in
                        "audit") echo "${AUDIT_HELP}" ;;
                        "show") echo "${SHOW_HELP}" ;;
                        *) echo "Unknown argument for 'commands'"
                    esac
                  else
                    shift
                    case $1 in
                        "dockerfile")
                            echo "Usage: lynis audit dockerfile <file>"
                        ;;
                        "system")
                            echo "${COMMANDS_AUDIT_SYSTEM_USAGE}\n${COMMANDS_AUDIT_SYSTEM_FUNCTION}\n"
                        ;;
                        *)
                            echo "Unknown argument for 'commands'"
                        ;;
                    esac
                fi
            fi
            ;;
        "help")
            if [ $# -eq 1 ]; then
                echo "${WHITE}Commands${NORMAL}:"
                for I in ${COMMANDS}; do
                    echo "lynis ${CYAN}${I}${NORMAL}"
                done
                echo ""
                echo "${WHITE}Options${NORMAL}:\n${BLUE}${OPTIONS}${NORMAL}"
              else
                shift
                case $1 in
                   "audit") echo "${AUDIT_HELP}" ;;
                   "show") echo "${SHOW_ARGS}" ;;
                   "update") echo "${UPDATE_ARGS}" ;;
                   "?") echo "${SHOW_ARGS}" ;;
                   *) echo "Invalid argument provided for lynis show help" ;;
                esac
            fi
            ;;

        "license")              echo "${PROGRAM_LICENSE}" ;;
        "man")                  echo "Use ./lynis --man or man lynis" ;;
        "options")              echo "${OPTIONS}" ;;
        "pidfile")              echo "${PIDFILE}" ;;
        "profile" | "profiles") for I in ${PROFILES}; do echo ${I}; done ;;
        "plugindir")            echo "${PLUGINDIR}" ;;
        "release" | "version")  echo "${PROGRAM_VERSION}" ;;
        "releasedate")          echo "${PROGRAM_RELEASE_DATE}" ;;
        "tests")
            if [ $# -gt 0 ]; then
                shift
                case $1 in
                   "skipped") echo "${SKIP_TESTS}" ;;
                   *) echo "Invalid argument provided to lynis show tests\n\n"
                   echo "Suggestions:\n"
                   for I in ${SHOW_TESTS_ARGS}; do
                       echo "lynis show tests ${I}"
                   done
                   ;;
                esac
              else
                echo "Need more arguments"
            fi
            ;;
        "?")                    echo "${SHOW_ARGS}" ;;
        *)                      echo "Unknown option" ;;
    esac
  else
    echo "\n  ${WHITE}Provide an additional argument${NORMAL}\n\n"
    for I in ${SHOW_ARGS}; do
        echo "    lynis show ${BROWN}${I}${NORMAL}"
    done
    echo "\n"
fi


ExitClean

# More additions:
# - categories
# - workdir

# The End