From e252bc8ef6796a1f58cb02880cb8a1d200827476 Mon Sep 17 00:00:00 2001 From: Fosocles <45002379+Fosocles@users.noreply.github.com> Date: Thu, 30 Apr 2020 11:32:56 +0300 Subject: [PATCH] Add help and version content for awk.py (#1341) * Update awk.py --- src/cowrie/commands/awk.py | 64 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/src/cowrie/commands/awk.py b/src/cowrie/commands/awk.py index 609d0b76..cb2e0881 100644 --- a/src/cowrie/commands/awk.py +++ b/src/cowrie/commands/awk.py @@ -1,5 +1,6 @@ # Copyright (c) 2010 Michel Oosterhof # See the COPYRIGHT file for more information +# Contributor: Fosocles """ awk command @@ -46,7 +47,7 @@ class command_awk(HoneyPotCommand): self.exit() return elif o in "--version": - self.help() + self.version() self.exit() return elif o in ("-n", "--number"): @@ -168,7 +169,66 @@ class command_awk(HoneyPotCommand): def help(self): self.write( - """TODO: awk help message + """Usage: awk [POSIX or GNU style options] -f progfile [--] file ... +Usage: awk [POSIX or GNU style options] [--] 'program' file ... +POSIX options: GNU long options: (standard) + -f progfile --file=progfile + -F fs --field-separator=fs + -v var=val --assign=var=val +Short options: GNU long options: (extensions) + -b --characters-as-bytes + -c --traditional + -C --copyright + -d[file] --dump-variables[=file] + -D[file] --debug[=file] + -e 'program-text' --source='program-text' + -E file --exec=file + -g --gen-pot + -h --help + -i includefile --include=includefile + -l library --load=library + -L[fatal|invalid] --lint[=fatal|invalid] + -M --bignum + -N --use-lc-numeric + -n --non-decimal-data + -o[file] --pretty-print[=file] + -O --optimize + -p[file] --profile[=file] + -P --posix + -r --re-interval + -S --sandbox + -t --lint-old + -V --version + +To report bugs, see node `Bugs' in `gawk.info', which is +section `Reporting Problems and Bugs' in the printed version. + +gawk is a pattern scanning and processing language. +By default it reads standard input and writes standard output. + +Examples: + gawk '{ sum += $1 }; END { print sum }' file + gawk -F: '{ print $1 }' /etc/passwd +""" + ) + + def version(self): + self.write( + """GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2) +Copyright (C) 1989, 1991-2016 Free Software Foundation. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see http://www.gnu.org/licenses/. """ )