VirüsTOTAL Projesi : VirüsTOTAL Puanlama Sistemi

Programlama ve Script dilleri konusunda bilgi paylaşım alanıdır.
Cevapla
Kullanıcı avatarı
TRWE_2012
Zettabyte1
Zettabyte1
Mesajlar: 15150
Kayıt: 25 Eyl 2013, 13:38
cinsiyet: Erkek
Teşekkür etti: 2506 kez
Teşekkür edildi: 5302 kez

VirüsTOTAL Projesi : VirüsTOTAL Puanlama Sistemi

Mesaj gönderen TRWE_2012 »

Merhabalar
Resim
WindowsOS Versiyonu : PowerShell
Resim
HTML Çıktısı :
Resim
GNU/Linux OS - Bash Shell Versiyon....
Resim
HTML Çıktısı :
Resim
ŞİMDİ BETİKLERİ VERELİM...

KOD İÇERİK -1 : WindowsOS PS1 Betiği = VirusTotal_Reliability_Score_v6.ps1

Kod: Tümünü seç

# =============================================================================
# VirusTotal_Reliability_Score.ps1  (v6)
#
# Plain logic scoring:
#   CLEAN  [C]  = +100
#   VIRUS  [V]  = -100
#
# Algebraic formula:
#   GK = (CLEAN_count x +100) + (VIRUS_count x -100)
#
# GK > 0  -->  "BU NESNE TEMIZDİR"
# GK < 0  -->  "BU NESNE ZARARLI BULUNDURUYOR, KULLANMAYIN SİLİN...!!!"
# GK = 0  -->  HESAPLAMA SONUCU EŞİT
#
# User defines AV list at startup.
# Input: [C] = CLEAN   [V] = VIRUS   (single keypress, no ENTER needed)
# =============================================================================

# --- SINGLE KEY INPUT --------------------------------------------------------
function Read-CVKey {
    while ($true) {
        $key = [System.Console]::ReadKey($true)
        $ch  = $key.KeyChar.ToString().ToUpper()
        if ($ch -eq "C") { Write-Host "CLEAN" -ForegroundColor Green; return "CLEAN" }
        if ($ch -eq "V") { Write-Host "VIRUS" -ForegroundColor Red;   return "VIRUS" }
    }
}

# --- OUTPUT PATH -------------------------------------------------------------
function Read-OutputPath {
    Write-Host ""
    Write-Host "  HTML report save path:" -ForegroundColor Cyan
    Write-Host ("  Example : C:\Users\{0}\Desktop\report.html" -f $env:USERNAME) -ForegroundColor DarkGray
    Write-Host "  ENTER   : Desktop (default)" -ForegroundColor DarkGray
    Write-Host ""
    $raw = (Read-Host "  Path").Trim()

    if ([string]::IsNullOrWhiteSpace($raw)) {
        $raw = [System.IO.Path]::Combine(
            [System.Environment]::GetFolderPath("Desktop"),
            "VirusTotal_Report.html"
        )
        Write-Host ("  Default: {0}" -f $raw) -ForegroundColor DarkGray
    }

    if ([System.IO.Directory]::Exists($raw)) {
        $raw = [System.IO.Path]::Combine($raw, "VirusTotal_Report.html")
    }
    if (-not $raw.EndsWith(".html", [StringComparison]::OrdinalIgnoreCase)) {
        $raw += ".html"
    }
    $dir = [System.IO.Path]::GetDirectoryName($raw)
    if (-not [System.IO.Directory]::Exists($dir)) {
        try   { [System.IO.Directory]::CreateDirectory($dir) | Out-Null }
        catch {
            Write-Host "  [WARN] Directory not found, falling back to Desktop." -ForegroundColor Yellow
            $raw = [System.IO.Path]::Combine(
                [System.Environment]::GetFolderPath("Desktop"),
                "VirusTotal_Report.html"
            )
        }
    }
    return $raw
}

# --- AV LIST -----------------------------------------------------------------
function Read-AVList {
    Write-Host ""
    Write-Host "  Define antivirus list:" -ForegroundColor Cyan
    Write-Host "  Type one name per line. Empty line = done." -ForegroundColor DarkGray
    Write-Host ""
    $list = @()
    $idx  = 1
    while ($true) {
        $name = (Read-Host ("  AV #{0,2}" -f $idx)).Trim()
        if ([string]::IsNullOrWhiteSpace($name)) {
            if ($list.Count -eq 0) { Write-Host "  At least one entry required." -ForegroundColor Yellow; continue }
            break
        }
        $list += $name
        $idx++
    }
    return $list
}

# =============================================================================
# MAIN
# =============================================================================
Clear-Host
Write-Host ""
Write-Host "  ================================================================" -ForegroundColor Cyan
Write-Host "    VirusTotal Reliability Score Calculator  (v6)" -ForegroundColor Cyan
Write-Host "  ================================================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "  Scoring logic :" -ForegroundColor DarkGray
Write-Host "    [C]  CLEAN  =  +100" -ForegroundColor Green
Write-Host "    [V]  VIRUS  =  -100" -ForegroundColor Red
Write-Host ""
Write-Host "  Formula: GK = (CLEAN x +100) + (VIRUS x -100)" -ForegroundColor DarkGray
Write-Host "    GK > 0  -->  TEMIZ" -ForegroundColor Green
Write-Host "    GK < 0  -->  ZARARLI" -ForegroundColor Red
Write-Host "    GK = 0  -->  ESIT (karar verilemiyor)" -ForegroundColor Yellow
Write-Host ""

# Step 1 — save path
$outputPath = Read-OutputPath

# Step 2 — AV list
$avList = Read-AVList
$total  = $avList.Count

# Step 3 — collect results
Write-Host ""
Write-Host "  ================================================================" -ForegroundColor Cyan
Write-Host ("  Enter results  ({0} engines)" -f $total) -ForegroundColor Cyan
Write-Host "  ================================================================" -ForegroundColor Cyan
Write-Host ""

$results = @()
$i = 0
foreach ($avName in $avList) {
    $i++
    Write-Host -NoNewline ("  {0,2}/{1}  {2,-22}  [C/V]: " -f $i, $total, $avName)
    $status = Read-CVKey
    $score  = if ($status -eq "CLEAN") { 100 } else { -100 }
    $results += [PSCustomObject]@{ Name=$avName; Status=$status; Score=$score }
}

# Step 4 — calculate
$cleanCount = ($results | Where-Object { $_.Status -eq "CLEAN" }).Count
$virusCount = ($results | Where-Object { $_.Status -eq "VIRUS" }).Count
$GK         = ($cleanCount * 100) + ($virusCount * -100)

# Formula strings
$terms         = $results | ForEach-Object { if ($_.Score -ge 0) {"+100"} else {"-100"} }
$formulaLong   = "GK = " + ($terms -join " + ") + " = $GK"
$formulaShort  = "GK = ($cleanCount x +100) + ($virusCount x -100) = $GK"

# Verdict
if ($GK -gt 0) {
    $verdict = "BU NESNE TEMIZDİR"
    $vColor  = "Green"
    $vClass  = "safe"
} elseif ($GK -lt 0) {
    $verdict = "BU NESNE ZARARLI BULUNDURUYOR, KULLANMAYIN SİLİN...!!!"
    $vColor  = "Red"
    $vClass  = "infected"
} else {
    $verdict = "HESAPLAMA SONUCU EŞİT -- Karar verilemiyor (GK = 0)"
    $vColor  = "Yellow"
    $vClass  = "equal"
}

# Step 5 — terminal output
Write-Host ""
Write-Host "  ================================================================" -ForegroundColor Cyan
Write-Host "  Results" -ForegroundColor Cyan
Write-Host "  ================================================================" -ForegroundColor Cyan
Write-Host ""
Write-Host ("  {0,-22}  {1,-8}  {2}" -f "Antivirus","Status","Score") -ForegroundColor DarkGray
Write-Host ("  {0,-22}  {1,-8}  {2}" -f "----------------------","--------","------") -ForegroundColor DarkGray
foreach ($r in $results) {
    $sc = if ($r.Score -ge 0) { "+$($r.Score)" } else { "$($r.Score)" }
    $fc = if ($r.Status -eq "CLEAN") { "Green" } else { "Red" }
    Write-Host -NoNewline ("  {0,-22}  " -f $r.Name)
    Write-Host -NoNewline ("{0,-8}  " -f $r.Status) -ForegroundColor $fc
    Write-Host $sc
}
Write-Host ("  {0,-22}  {1,-8}  {2}" -f "----------------------","--------","------") -ForegroundColor DarkGray
$gkStr = if ($GK -ge 0) { "+$GK" } else { "$GK" }
Write-Host ("  {0,-22}  {1,-8}  {2}" -f "TOTAL (GK)","","$gkStr") -ForegroundColor Cyan
Write-Host ""
Write-Host ("  CLEAN : {0} engine(s)" -f $cleanCount) -ForegroundColor Green
Write-Host ("  VIRUS : {0} engine(s)" -f $virusCount) -ForegroundColor Red
Write-Host ""
Write-Host "  Algebraic formula:" -ForegroundColor DarkCyan
Write-Host ("  {0}" -f $formulaShort) -ForegroundColor Cyan
Write-Host ("  {0}" -f $formulaLong)  -ForegroundColor Cyan
Write-Host ""
Write-Host ("  VERDICT: {0}" -f $verdict) -ForegroundColor $vColor
Write-Host ""

# Step 6 — HTML
$tableRows = ""
foreach ($r in $results) {
    $sc      = if ($r.Score -ge 0) { "+$($r.Score)" } else { "$($r.Score)" }
    $stClass = if ($r.Status -eq "CLEAN") { "clean" } else { "virus" }
    $tableRows += "<tr><td>$([System.Security.SecurityElement]::Escape($r.Name))</td>"
    $tableRows += "<td class='$stClass'>$($r.Status)</td>"
    $tableRows += "<td class='sc'>$sc</td></tr>`n"
}

$vBg     = @{safe="#e8f5e9"; infected="#ffebee"; equal="#fff9c4"}[$vClass]
$vBorder = @{safe="#4caf50"; infected="#f44336"; equal="#fbc02d"}[$vClass]
$vFg     = @{safe="#1b5e20"; infected="#b71c1c"; equal="#f57f17"}[$vClass]

$fShortHtml = [System.Security.SecurityElement]::Escape($formulaShort)
$fLongHtml  = [System.Security.SecurityElement]::Escape($formulaLong)
$vHtml      = [System.Security.SecurityElement]::Escape($verdict)
$genDate    = Get-Date -Format "yyyy-MM-dd HH:mm:ss"

$html = @"
<!DOCTYPE html>
<html>
<head>
<meta charset="ANSI">
<title>VirusTotal Reliability Report</title>
<style>
  body  { font-family:Arial,sans-serif; margin:32px; background:#f4f4f4; }
  h1    { color:#1a237e; border-bottom:3px solid #1a237e; padding-bottom:8px; }
  h2    { color:#333; margin-top:28px; }
  table { border-collapse:collapse; width:100%; background:white;
          margin:16px 0; box-shadow:0 1px 4px rgba(0,0,0,.15); }
  th,td { border:1px solid #ddd; padding:10px 16px; text-align:left; }
  th    { background:#1a237e; color:white; }
  tr:nth-child(even) { background:#f9f9f9; }
  .clean { color:#2e7d32; font-weight:bold; }
  .virus { color:#c62828; font-weight:bold; }
  .sc    { font-family:monospace; text-align:center; }
  .totrow{ background:#e8eaf6 !important; font-weight:bold; }
  .formula { font-family:monospace; background:#e8eaf6;
             border-left:4px solid #3f51b5; padding:12px 18px;
             margin:12px 0; white-space:pre-wrap; line-height:1.8; }
  .verdict { padding:20px 24px; margin:28px 0; border-radius:6px;
             border-left:6px solid; font-size:1.15em; font-weight:bold; }
  .meta { color:#666; font-size:.9em; }
</style>
</head>
<body>
<h1>VirusTotal Reliability Score Report (v6)</h1>
<p class="meta">Generated : $genDate</p>
<p class="meta">Total engines : $total &nbsp;|&nbsp;
   <span style="color:#2e7d32">CLEAN : $cleanCount</span> &nbsp;|&nbsp;
   <span style="color:#c62828">VIRUS : $virusCount</span></p>

<h2>Scan Results</h2>
<table>
  <tr><th>Antivirus</th><th>Status</th><th>Score</th></tr>
  $tableRows
  <tr class="totrow">
    <td colspan="2" style="text-align:right">TOTAL &nbsp;(GK)</td>
    <td class="sc">$gkStr</td>
  </tr>
</table>

<h2>Algebraic Calculation</h2>
<p>
  <span style="color:#2e7d32;font-weight:bold">CLEAN&nbsp;=&nbsp;+100</span>
  &nbsp;&nbsp;|&nbsp;&nbsp;
  <span style="color:#c62828;font-weight:bold">VIRUS&nbsp;=&nbsp;&minus;100</span>
</p>
<div class="formula">$fShortHtml
$fLongHtml</div>

<div class="verdict" style="background:$vBg; border-color:$vBorder; color:$vFg">
  GK = $gkStr<br><br>
  $vHtml
</div>
</body>
</html>
"@

# Step 7 — write
try {
    [System.IO.File]::WriteAllText($outputPath, $html, [System.Text.Encoding]::UTF8)
    $sz = (Get-Item $outputPath).Length
    Write-Host "  [OK] HTML report saved." -ForegroundColor Green
    Write-Host ("  File : {0}" -f $outputPath) -ForegroundColor Cyan
    Write-Host ("  Size : {0} bytes" -f $sz) -ForegroundColor DarkGray
} catch {
    Write-Host ("  [ERROR] {0}" -f $_.Exception.Message) -ForegroundColor Red
    Read-Host "`nPress ENTER to exit."
    exit 1
}

# Step 8 — open
try   { Start-Process $outputPath; Write-Host "  [OK] Opened in browser." -ForegroundColor Green }
catch { Write-Host ("  [WARN] {0}" -f $_.Exception.Message) -ForegroundColor Yellow }

Write-Host ""
Read-Host "`nPress ENTER to exit."
KOD İÇERİK -2 : GNU/LinuxOS- Bash Shell Betiği = virustotal_reliability_score.sh

Kod: Tümünü seç

#!/usr/bin/env bash
# =============================================================================
# virustotal_reliability_score.sh  (v1 - Bash)
#
# Plain logic scoring:
#   CLEAN  [C]  = +100
#   VIRUS  [V]  = -100
#
# Algebraic formula:
#   GK = (CLEAN_count x +100) + (VIRUS_count x -100)
#
# GK > 0  -->  "BU NESNE TEMIZDIR"
# GK < 0  -->  "BU NESNE ZARARLI BULUNDURUYOR, KULLANMAYIN SILIN...!!!"
# GK = 0  -->  Esit sonuc
#
# User defines AV list at startup.
# Input: [C] = CLEAN   [V] = VIRUS   (single keypress, no ENTER needed)
# =============================================================================

export LANG=tr_TR.UTF-8
export LC_ALL=tr_TR.UTF-8

# --- ANSI COLOURS ------------------------------------------------------------
C_CYAN="\033[0;36m"
C_DCYAN="\033[0;36m"
C_GREEN="\033[0;32m"
C_RED="\033[0;31m"
C_YELLOW="\033[0;33m"
C_GRAY="\033[0;37m"
C_DGRAY="\033[1;30m"
C_WHITE="\033[1;37m"
C_RESET="\033[0m"
C_BOLD="\033[1m"

# --- SINGLE KEYPRESS C or V --------------------------------------------------
read_cv_key() {
    # Returns "CLEAN" or "VIRUS" via global variable: CV_RESULT
    while true; do
        # Read exactly one character without echo, no ENTER needed
        IFS= read -r -s -n1 key
        key_upper=$(echo "$key" | tr '[:lower:]' '[:upper:]')
        if [[ "$key_upper" == "C" ]]; then
            echo -e "${C_GREEN}CLEAN${C_RESET}"
            CV_RESULT="CLEAN"
            return
        elif [[ "$key_upper" == "V" ]]; then
            echo -e "${C_RED}VIRUS${C_RESET}"
            CV_RESULT="VIRUS"
            return
        fi
        # Any other key: ignore silently
    done
}

# --- OUTPUT PATH -------------------------------------------------------------
read_output_path() {
    echo ""
    echo -e "  ${C_CYAN}HTML report save path:${C_RESET}"
    echo -e "  ${C_DGRAY}Example : /home/$USER/Desktop/report.html${C_RESET}"
    echo -e "  ${C_DGRAY}ENTER   : current directory (default)${C_RESET}"
    echo ""
    read -r -p "  Path: " raw
    raw="${raw//\~/$HOME}"      # expand ~ manually

    if [[ -z "$raw" ]]; then
        raw="$(pwd)/VirusTotal_Report.html"
        echo -e "  ${C_DGRAY}Default: $raw${C_RESET}"
    fi

    # If directory given, append filename
    if [[ -d "$raw" ]]; then
        raw="${raw%/}/VirusTotal_Report.html"
    fi

    # Ensure .html extension
    if [[ "${raw,,}" != *.html ]]; then
        raw="${raw}.html"
    fi

    # Ensure parent directory exists
    dir="$(dirname "$raw")"
    if [[ ! -d "$dir" ]]; then
        if mkdir -p "$dir" 2>/dev/null; then
            echo -e "  ${C_DGRAY}Directory created: $dir${C_RESET}"
        else
            echo -e "  ${C_YELLOW}[WARN] Cannot create directory, falling back to current dir.${C_RESET}"
            raw="$(pwd)/VirusTotal_Report.html"
        fi
    fi

    OUTPUT_PATH="$raw"
}

# --- AV LIST -----------------------------------------------------------------
read_av_list() {
    echo ""
    echo -e "  ${C_CYAN}Define antivirus list:${C_RESET}"
    echo -e "  ${C_DGRAY}Type one name per line. Empty line = done.${C_RESET}"
    echo ""

    AV_LIST=()
    local idx=1
    while true; do
        read -r -p "$(printf '  AV #%2d: ' $idx)" name
        name="${name#"${name%%[![:space:]]*}"}"   # ltrim
        name="${name%"${name##*[![:space:]]}"}"   # rtrim
        if [[ -z "$name" ]]; then
            if [[ ${#AV_LIST[@]} -eq 0 ]]; then
                echo -e "  ${C_YELLOW}At least one entry required.${C_RESET}"
                continue
            fi
            break
        fi
        AV_LIST+=("$name")
        (( idx++ ))
    done
}

# --- HTML ESCAPE -------------------------------------------------------------
html_escape() {
    local s="$1"
    s="${s//&/&amp;}"
    s="${s//</&lt;}"
    s="${s//>/&gt;}"
    s="${s//\"/&quot;}"
    echo "$s"
}

# =============================================================================
# MAIN
# =============================================================================
clear
echo ""
echo -e "  ${C_CYAN}================================================================${C_RESET}"
echo -e "  ${C_CYAN}  VirusTotal Reliability Score Calculator  (v1 - Bash)${C_RESET}"
echo -e "  ${C_CYAN}================================================================${C_RESET}"
echo ""
echo -e "  ${C_DGRAY}Scoring logic :${C_RESET}"
echo -e "    ${C_GREEN}[C]  CLEAN  =  +100${C_RESET}"
echo -e "    ${C_RED}[V]  VIRUS  =  -100${C_RESET}"
echo ""
echo -e "  ${C_DGRAY}Formula: GK = (CLEAN x +100) + (VIRUS x -100)${C_RESET}"
echo -e "    ${C_GREEN}GK > 0  -->  TEMIZ${C_RESET}"
echo -e "    ${C_RED}GK < 0  -->  ZARARLI${C_RESET}"
echo -e "    ${C_YELLOW}GK = 0  -->  ESIT (karar verilemiyor)${C_RESET}"
echo ""

# Step 1 — save path
read_output_path

# Step 2 — AV list
read_av_list
TOTAL=${#AV_LIST[@]}

# Step 3 — collect results
echo ""
echo -e "  ${C_CYAN}================================================================${C_RESET}"
echo -e "  ${C_CYAN}  Enter results  ($TOTAL engines)${C_RESET}"
echo -e "  ${C_CYAN}================================================================${C_RESET}"
echo ""

RESULT_NAMES=()
RESULT_STATUS=()
RESULT_SCORES=()

i=0
for avName in "${AV_LIST[@]}"; do
    (( i++ ))
    printf "  %2d/%-2d  %-22s  [C/V]: " "$i" "$TOTAL" "$avName"
    read_cv_key
    RESULT_NAMES+=("$avName")
    RESULT_STATUS+=("$CV_RESULT")
    if [[ "$CV_RESULT" == "CLEAN" ]]; then
        RESULT_SCORES+=(100)
    else
        RESULT_SCORES+=(-100)
    fi
done

# Step 4 — calculate
CLEAN_COUNT=0
VIRUS_COUNT=0
for st in "${RESULT_STATUS[@]}"; do
    [[ "$st" == "CLEAN" ]] && (( CLEAN_COUNT++ )) || (( VIRUS_COUNT++ ))
done

GK=$(( (CLEAN_COUNT * 100) + (VIRUS_COUNT * -100) ))

# Formula strings
TERMS=""
for sc in "${RESULT_SCORES[@]}"; do
    if [[ $sc -ge 0 ]]; then
        TERMS="${TERMS}+100 "
    else
        TERMS="${TERMS}-100 "
    fi
done
TERMS="${TERMS% }"                              # trim trailing space
FORMULA_LONG="GK = ${TERMS// / + } = $GK"
FORMULA_SHORT="GK = ($CLEAN_COUNT x +100) + ($VIRUS_COUNT x -100) = $GK"

# GK display string
if [[ $GK -ge 0 ]]; then GK_STR="+$GK"; else GK_STR="$GK"; fi

# Verdict
if [[ $GK -gt 0 ]]; then
    VERDICT="BU NESNE TEMIZDIR"
    V_COLOR="$C_GREEN"
    V_CLASS="safe"
    V_BG="#e8f5e9"; V_BORDER="#4caf50"; V_FG="#1b5e20"
elif [[ $GK -lt 0 ]]; then
    VERDICT="BU NESNE ZARARLI BULUNDURUYOR, KULLANMAYIN SILIN...!!!"
    V_COLOR="$C_RED"
    V_CLASS="infected"
    V_BG="#ffebee"; V_BORDER="#f44336"; V_FG="#b71c1c"
else
    VERDICT="ESIT SONUC -- Karar verilemiyor (GK = 0)"
    V_COLOR="$C_YELLOW"
    V_CLASS="equal"
    V_BG="#fff9c4"; V_BORDER="#fbc02d"; V_FG="#f57f17"
fi

# Step 5 — terminal output
echo ""
echo -e "  ${C_CYAN}================================================================${C_RESET}"
echo -e "  ${C_CYAN}  Results${C_RESET}"
echo -e "  ${C_CYAN}================================================================${C_RESET}"
echo ""
printf "  %-22s  %-8s  %s\n" "Antivirus" "Status" "Score"
printf "  %-22s  %-8s  %s\n" "----------------------" "--------" "------"

for (( j=0; j<${#RESULT_NAMES[@]}; j++ )); do
    name="${RESULT_NAMES[$j]}"
    st="${RESULT_STATUS[$j]}"
    sc="${RESULT_SCORES[$j]}"
    if [[ $sc -ge 0 ]]; then sc_str="+$sc"; else sc_str="$sc"; fi
    if [[ "$st" == "CLEAN" ]]; then
        st_colored="${C_GREEN}${st}${C_RESET}"
    else
        st_colored="${C_RED}${st}${C_RESET}"
    fi
    printf "  %-22s  " "$name"
    echo -ne "${st_colored}"
    printf "%-$((8 - ${#st}))s  %s\n" "" "$sc_str"
done

printf "  %-22s  %-8s  %s\n" "----------------------" "--------" "------"
echo -e "  ${C_CYAN}$(printf '%-22s  %-8s  %s' 'TOTAL (GK)' '' "$GK_STR")${C_RESET}"
echo ""
echo -e "  ${C_GREEN}CLEAN : $CLEAN_COUNT engine(s)${C_RESET}"
echo -e "  ${C_RED}VIRUS : $VIRUS_COUNT engine(s)${C_RESET}"
echo ""
echo -e "  ${C_CYAN}Algebraic formula:${C_RESET}"
echo -e "  ${C_CYAN}${FORMULA_SHORT}${C_RESET}"
echo -e "  ${C_CYAN}${FORMULA_LONG}${C_RESET}"
echo ""
echo -e "  ${V_COLOR}${C_BOLD}VERDICT: ${VERDICT}${C_RESET}"
echo ""

# Step 6 — build HTML
TABLE_ROWS=""
for (( j=0; j<${#RESULT_NAMES[@]}; j++ )); do
    name_esc=$(html_escape "${RESULT_NAMES[$j]}")
    st="${RESULT_STATUS[$j]}"
    sc="${RESULT_SCORES[$j]}"
    if [[ $sc -ge 0 ]]; then sc_str="+$sc"; else sc_str="$sc"; fi
    [[ "$st" == "CLEAN" ]] && st_class="clean" || st_class="virus"
    TABLE_ROWS+="<tr><td>${name_esc}</td>"
    TABLE_ROWS+="<td class='${st_class}'>${st}</td>"
    TABLE_ROWS+="<td class='sc'>${sc_str}</td></tr>"$'\n'
done

F_SHORT_H=$(html_escape "$FORMULA_SHORT")
F_LONG_H=$(html_escape "$FORMULA_LONG")
VERDICT_H=$(html_escape "$VERDICT")
GEN_DATE=$(date "+%Y-%m-%d %H:%M:%S")

cat > "$OUTPUT_PATH" << HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>VirusTotal Reliability Report</title>
<style>
  body  { font-family:Arial,sans-serif; margin:32px; background:#f4f4f4; }
  h1    { color:#1a237e; border-bottom:3px solid #1a237e; padding-bottom:8px; }
  h2    { color:#333; margin-top:28px; }
  table { border-collapse:collapse; width:100%; background:white;
          margin:16px 0; box-shadow:0 1px 4px rgba(0,0,0,.15); }
  th,td { border:1px solid #ddd; padding:10px 16px; text-align:left; }
  th    { background:#1a237e; color:white; }
  tr:nth-child(even) { background:#f9f9f9; }
  .clean  { color:#2e7d32; font-weight:bold; }
  .virus  { color:#c62828; font-weight:bold; }
  .sc     { font-family:monospace; text-align:center; }
  .totrow { background:#e8eaf6 !important; font-weight:bold; }
  .formula{ font-family:monospace; background:#e8eaf6;
            border-left:4px solid #3f51b5; padding:12px 18px;
            margin:12px 0; white-space:pre-wrap; line-height:1.8; }
  .verdict{ padding:20px 24px; margin:28px 0; border-radius:6px;
            border-left:6px solid; font-size:1.15em; font-weight:bold; }
  .meta   { color:#666; font-size:.9em; }
</style>
</head>
<body>
<h1>VirusTotal Reliability Score Report (v1 - Bash)</h1>
<p class="meta">Generated : ${GEN_DATE}</p>
<p class="meta">Total engines : ${TOTAL} &nbsp;|&nbsp;
   <span style="color:#2e7d32">CLEAN : ${CLEAN_COUNT}</span> &nbsp;|&nbsp;
   <span style="color:#c62828">VIRUS : ${VIRUS_COUNT}</span></p>

<h2>Scan Results</h2>
<table>
  <tr><th>Antivirus</th><th>Status</th><th>Score</th></tr>
  ${TABLE_ROWS}
  <tr class="totrow">
    <td colspan="2" style="text-align:right">TOTAL &nbsp;(GK)</td>
    <td class="sc">${GK_STR}</td>
  </tr>
</table>

<h2>Algebraic Calculation</h2>
<p>
  <span style="color:#2e7d32;font-weight:bold">CLEAN&nbsp;=&nbsp;+100</span>
  &nbsp;&nbsp;|&nbsp;&nbsp;
  <span style="color:#c62828;font-weight:bold">VIRUS&nbsp;=&nbsp;&minus;100</span>
</p>
<div class="formula">${F_SHORT_H}
${F_LONG_H}</div>

<div class="verdict" style="background:${V_BG}; border-color:${V_BORDER}; color:${V_FG}">
  GK = ${GK_STR}<br><br>
  ${VERDICT_H}
</div>
</body>
</html>
HTML

# Step 7 — report status
if [[ -f "$OUTPUT_PATH" ]]; then
    FILE_SIZE=$(wc -c < "$OUTPUT_PATH")
    echo -e "  ${C_GREEN}[OK] HTML report saved.${C_RESET}"
    echo -e "  File : ${C_CYAN}${OUTPUT_PATH}${C_RESET}"
    echo -e "  Size : ${C_DGRAY}${FILE_SIZE} bytes${C_RESET}"
else
    echo -e "  ${C_RED}[ERROR] Could not save HTML report.${C_RESET}"
fi

# Step 8 — open in browser (best effort)
echo ""
if command -v xdg-open &>/dev/null; then
    xdg-open "$OUTPUT_PATH" 2>/dev/null &
    echo -e "  ${C_GREEN}[OK] Opened in browser (xdg-open).${C_RESET}"
elif command -v firefox &>/dev/null; then
    firefox "$OUTPUT_PATH" &
    echo -e "  ${C_GREEN}[OK] Opened in Firefox.${C_RESET}"
elif command -v chromium-browser &>/dev/null; then
    chromium-browser "$OUTPUT_PATH" &
    echo -e "  ${C_GREEN}[OK] Opened in Chromium.${C_RESET}"
else
    echo -e "  ${C_YELLOW}[INFO] Open manually: $OUTPUT_PATH${C_RESET}"
fi

echo ""
read -rp $'\nPress ENTER to exit.' _
NASIL KULLANILIR?

Uygulama Adımları :

1.Önce bir nesneyi https://www.virustotal.com/gui/home/upload web adresinde taratın.
2.Çıkan tarama sonuçlarına göre kendinize yakın bulduğunuz Antivirüs isimlerini boş bir not defterine kayıt edin.(örnek : en yukarıdaki birinci ekran görüntüsüne bakın, TRWE_2012 kendisine göre kullandığı antivirüs listesini oluşturmuştur.)
3.Betği çalıştırın , teker teker kendi listenizdeki antivirüs isimleri yazın
4.Listeniz tamam ise en son gelen liste'den çıkmak klavyeden "ENTER" tuşuna basın
5.Şimdi listeniz betiğe aktarıldı.Yapmanız gereken listedeki antivirüs için, eğer VirüsTOTAL'de nesne hakkında virüs tespit etti ise klavye'den V'ye basın, eğer bulamadı ise klavyeden C 'ye basın. (V = VIRUS = -100 puan, C = CLEAN = + 100, klasik cebirsel toplama işlemi)


Böylece kullanmak istediğiniz nesne hakkında bilgi sahibi olursunuz.

Güle güle kullanın....
Cevapla

“Programlama ve Script dilleri” sayfasına dön