从Bash中的AV输出文件生成用户列表

时间:2014-04-02 10:04:13

标签: bash

我想生成在公共HTML中使用恶意软件的用户列表

我正在使用avgscan进行扫描,

/opt/avg/av/bin/avgscan -a -c --ignerrors --report=avoutput.txt

但它会生成类似

的报告
/home/someuser/mail/info/cur/1395054106.H396740P84180,S=47470:2,S:/form_ident.rar  Trojan horse Inject2.WPP
/home/someuser/public_html/__swift/files/attach_pq2ar348en1z435o5jhqy37de2xfb391  Trojan horse Zbot.BMI

我尝试了一些东西,但它没有锻炼,因为列表也有/备份文件夹,我不想被列入清单 我只需要用户列表,该怎么办?

1 个答案:

答案 0 :(得分:1)

#!/bin/bash
    in="your_av_report file.txt" # in this case avoutput.txt

    a=$(cat $in | grep -i "/mail/" | grep -v "/backup/" | cut -d'/' -f3 | awk '!a[$0]++' | uniq)
    b=$cat $in | grep -i "/public_html/" | grep -v "/backup/" | cut -d'/' -f3 | awk '!a[$0]++' | uniq)
    echo $a >>foo.txt
    echo $b >>foo.txt

我希望它有助于:)