NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
Hossa
Feb 11, 2014Tutor
Add an option to manually update the virus definition file!
Hello, we use our ReadyNAS 314 in the company. Everything running pretty good, since the last update to 6.1.6. The only problem I have is, that the NAS does not have internet access. So it can not...
seatocl
Feb 24, 2015Aspirant
// C# test for middle server downloading the definitions to a NAS. Have not put error logic in. This is just a test in console. MS VS 2012 on Windows 7.
// I have not built anything to install the new definitions into the NAS for use. Again this is just a test of the front end download. Remember that just because it works today does not mean it will work in the future.
// Should really be directed by readyNAS team.
// We have other vendors that have built what they call a broker html that can be run on a middle device that can download and pass to their devices, very similar to offline loading of apps.
// This request has been submitted to have us offline users have the benefit of antivirus updates.
:idea:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string myLoginName = "0001E241P1281I072105";
string myLoginPassword = "MDAwMUUyNDFQMTI4MUkwNzIxMDU6";
string myBaseURL = "http://avdl.ctmail.com";
string myURL = "http://avdl.ctmail.com/csav/deffiles/def5/antivir-hit.ini";
NetworkCredential myCreds = new NetworkCredential(myLoginName,myLoginPassword);
CredentialCache credCache = new CredentialCache();
// Cached credentials can only be used when requested by
// specific URLs and authorization schemes
credCache.Add(new Uri(myBaseURL), "Basic", myCreds);
WebRequest myReq = WebRequest.Create(myURL);
// Must be a cache, basic credentials are cleared on redirect
myReq.Credentials = credCache;
myReq.PreAuthenticate = true; // More efficient, but optional
WebResponse myResponse = myReq.GetResponse();
StreamReader responseStreamReader = new StreamReader(myResponse.GetResponseStream());
String result = responseStreamReader.ReadToEnd();
responseStreamReader.Close();
if (result.StartsWith("[Current]\r\ndefId="))
{
string myDataString = result.Substring(17,12);
string myDownloadFile = "http://avdl.ctmail.com/csav/deffiles/def5/antivir-z-" + myDataString + ".zip";
using (WebClient myWebClient = new WebClient())
{
string myFileDest = "\\\\D7InNAS2\\apps\\APPS\\ReadtNAS_Virus_Definitions\\" + myDataString + ".zip";
if (!File.Exists(myFileDest))
{
myWebClient.Credentials = credCache;
myWebClient.DownloadFile(myDownloadFile, myFileDest);
}
}
}
}
}
}
// I have not built anything to install the new definitions into the NAS for use. Again this is just a test of the front end download. Remember that just because it works today does not mean it will work in the future.
// Should really be directed by readyNAS team.
// We have other vendors that have built what they call a broker html that can be run on a middle device that can download and pass to their devices, very similar to offline loading of apps.
// This request has been submitted to have us offline users have the benefit of antivirus updates.
:idea:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string myLoginName = "0001E241P1281I072105";
string myLoginPassword = "MDAwMUUyNDFQMTI4MUkwNzIxMDU6";
string myBaseURL = "http://avdl.ctmail.com";
string myURL = "http://avdl.ctmail.com/csav/deffiles/def5/antivir-hit.ini";
NetworkCredential myCreds = new NetworkCredential(myLoginName,myLoginPassword);
CredentialCache credCache = new CredentialCache();
// Cached credentials can only be used when requested by
// specific URLs and authorization schemes
credCache.Add(new Uri(myBaseURL), "Basic", myCreds);
WebRequest myReq = WebRequest.Create(myURL);
// Must be a cache, basic credentials are cleared on redirect
myReq.Credentials = credCache;
myReq.PreAuthenticate = true; // More efficient, but optional
WebResponse myResponse = myReq.GetResponse();
StreamReader responseStreamReader = new StreamReader(myResponse.GetResponseStream());
String result = responseStreamReader.ReadToEnd();
responseStreamReader.Close();
if (result.StartsWith("[Current]\r\ndefId="))
{
string myDataString = result.Substring(17,12);
string myDownloadFile = "http://avdl.ctmail.com/csav/deffiles/def5/antivir-z-" + myDataString + ".zip";
using (WebClient myWebClient = new WebClient())
{
string myFileDest = "\\\\D7InNAS2\\apps\\APPS\\ReadtNAS_Virus_Definitions\\" + myDataString + ".zip";
if (!File.Exists(myFileDest))
{
myWebClient.Credentials = credCache;
myWebClient.DownloadFile(myDownloadFile, myFileDest);
}
}
}
}
}
}
Related Content
NETGEAR Academy
Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!