Skip to content

Commit

Permalink
[Change] add new flag: -E|--dump-report
Browse files Browse the repository at this point in the history
- This dumps the report to stdout instead of trying to open an editor.
  • Loading branch information
samsalisbury committed May 1, 2020
1 parent 31b6484 commit 660a251
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ option gives a detailed summary of usage options:
e.g: maldet --report 050910-1534.21135
e.g: maldet --report SCANID [email protected]

-D, --dump-report SCANID
Similar to -e/--report except dumps the report to stdout instead.
e.g: maldet --dump-report
e.g: maldet --dump-report 050910-1534.21135

-s, --restore FILE|SCANID
Restore file from quarantine queue to orginal path or restore all items from
a specific SCANID
Expand Down
16 changes: 16 additions & 0 deletions files/internals/functions
Original file line number Diff line number Diff line change
Expand Up @@ -696,15 +696,31 @@ view_report() {
fi
if [ "$rid" == "" ] && [ -f "$sessdir/session.last" ]; then
rid=`cat $sessdir/session.last`
if [ "$2" == "dump" ]; then
cat $sessdir/session.$rid
exit
fi
$EDITOR $sessdir/session.$rid
elif [ -f "$sessdir/session.$rid" ]; then
if [ "$2" == "dump" ]; then
cat $sessdir/session.$rid
exit
fi
$EDITOR $sessdir/session.$rid
else
echo "{report} no report found, aborting."
exit
fi
}

dump_report() {
rid="$1"
if [ rid == "" ]; then
rid=`cat sessdir/session.last`
fi
view_report $rid dump
}

view() {
echo "Viewing last 50 lines from $maldet_log:"
tail -n 50 $maldet_log
Expand Down
5 changes: 5 additions & 0 deletions files/maldet
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ else
shift
view_report "$1" "$2"
;;
-E|--dump-report)
header
shift
dump_report "$1"
;;
-p|--purge)
header
purge
Expand Down
8 changes: 7 additions & 1 deletion files/maldet.1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ maldet \- Linux Malware Detect
.PP
maldet [\-h|\-\-help] [\-a|\-\-scan\-all PATH] [\-r|\-\-scan\-recent PATH DAYS] [\-f|\-\-file\-list PATH]
[\-i|\-\-include\-regex] [\-x|\-\-exclude\-regex] [\-b|\-\-background] [\-m|\-\-monitor] [\-k|\-\-kill\-monitor]
[\-c|\-\-checkout] [\-q|\-\-quarantine] [\-s|\-\-restore] [\-n|\-\-clean] [\-l|\-\-log] [\-e|\-\-report]
[\-c|\-\-checkout] [\-q|\-\-quarantine] [\-s|\-\-restore] [\-n|\-\-clean] [\-l|\-\-log] [\-e|\-\-report] [\-E|\-\-dump\-report]
[\-u|\-\-update\-sigs]
.SH DESCRIPTION
Linux Malware Detect is a malware scanner for Linux released under the GNU GPLv2 license, that is designed around the threats faced in shared hosted environments. It uses threat data from network edge intrusion detection systems to extract malware that is actively being used in attacks and generates signatures for detection. In addition, threat data is also derived from user submissions with the LMD checkout feature and from malware community resources. The signatures that LMD uses are MD5 file hashes and HEX pattern matches, they are also easily exported to any number of detection tools such as ClamAV.
Expand Down Expand Up @@ -187,6 +187,12 @@ e.g: maldet \fB\-\-report\fR list
e.g: maldet \fB\-\-report\fR 050910\-1534.21135
e.g: maldet \fB\-\-report\fR SCANID [email protected]
.HP
\fB\-e\fR, \fB\-\-dump-report\fR SCANID
.IP
Similar to \-\-report but dumps the report to stdout instead.
e.g: maldet \fB\-\-dump\-report\fR
e.g: maldet \fB\-\-dump\-report\fR 050910\-1534.21135
.HP
\fB\-s\fR, \fB\-\-restore\fR FILE|SCANID
.IP
Restore file from quarantine queue to orginal path or restore all items from
Expand Down

0 comments on commit 660a251

Please sign in to comment.