Endpoint Protection

 View Only

Script That Downloads .JDB Automatically 

Apr 20, 2013 09:00 AM

One day, My boss came and told me that we need to keep the backup of .jdb files from symantec, so that in case we run into some disaster then we can use these files to restore definitions rather than syncing with Symantec and downloading entire distribution through internet. So I scripted the entire thing in powershell. Now I have scheduled this script in my desktop and twice a week I have the file in my harddisk.

Paste it in a text file and save it as .ps1 file.

---------------------------------------------------------------------------------------------------------------------------------

 

cls
[int]$dwcount = 0

################ Download JDB function definition #####################

function downloadjdb($dwdetails, $hashfile)
{
    $dwdir = get-location
    $weblink = "http://www.symantec.com/security_response/definitions/download/detail.jsp?gid=savce"
    Write-output "Obtaining download details from $weblink"
    Write-Output " "
    $dwdetails = "$dwdir\details.txt"
    $client = new-object System.Net.Webclient
    $client.DownloadFile($weblink, $dwdetails)

    $hashmd5 = "http://www.symantec.com/avcenter/download/md5-hash.txt"
    $hashfile = "$dwdir\md5-hash.txt"
    $client.DownloadFile($hashmd5, $hashfile)

    $str = findstr ".jdb" $dwdetails
    $data = $($str[1]).split("<")
    $req = "$($data[3])"
    $final = $req.split(">")
    $jdbname = $($final[1])        
    $url="ftp://ftp.symantec.com/public/english_us_canada/antivirus_definitions/norton_antivirus/jdb/$jdbname"
    Write-output "Downloading JDB from $url"
    Write-output " "
    $dest="$dwdir\$jdbname"
    Write-Output "Saving to file $dest"
    $client.DownloadFile($url, $dest) 2> $null
    $detail = get-content $hashfile | findstr $jdbname
        $symhash = $detail.split(" ")
        fciv -md5 $dest | findstr .jdb | %{$filehash = $_.split(" ")}
        if ($($symhash[0]) -eq $($filehash[0]))
    {
        Write-output "$jdbname download successful"
    }
    elseif ($dwcount -lt 3)
    {
        Write-Output "Downloading $jdbname unsuccessful. Attempting to download again...."
        $dwcount=$dwcount+1
        downloadjdb($dwdetails, $hashfile)
    }
    else
    {
        Write-Output "$jdbname cannot be downloaded..."
    }
    
    del $hashfile
    del $dwdetails
}

#######################################################################

downloadjdb($dwdetails, $hashfile)
start-sleep 5

 

---------------------------------------------------------------------------------------------------------------------------------------------

Statistics
0 Favorited
5 Views
1 Files
0 Shares
1 Downloads
Attachment(s)
docx file
Task Configuration.docx   385 KB   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Comments

Aug 25, 2016 05:21 AM

Dear Darshan,

I'm yet to get any feedback on this request.

However, after little modification to the script it's still didn't work as it came up with error messages.

Counting on your swift response.

Thank you.

 

May 22, 2015 06:17 AM

Hi Hakeem,

 

Soryy for delayed reply. I'm working on it. I'll revert back soon.

 

Thanks.

Mar 25, 2015 11:11 AM

Pls Darshan,can you please modify this to download from http instead of ftp. I need to do same thing but cant download via ftp.

 

http://www.symantec.com/security_response/definitions/download/detail.jsp?gid=sep

 

Pls revet. 

Thank you

Apr 25, 2013 03:37 AM

Forgot one thing.. This scipt need Microsoft's FCIV tool to verify checksum. You can download the same from below mentioned link.

 

http://www.microsoft.com/en-in/download/details.aspx?id=11533

 

Save it in "%homedrive%\Windows\System32"

Apr 25, 2013 03:25 AM

Thanks Brian.. :)

Apr 24, 2013 03:05 PM

Very nice, thanks for posting.

Related Entries and Links

No Related Resource entered.