Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in virustotal_cat() when calls exceed four per minute #9

Open
bwmoore22 opened this issue Nov 3, 2016 · 2 comments
Open

Error in virustotal_cat() when calls exceed four per minute #9

bwmoore22 opened this issue Nov 3, 2016 · 2 comments
Assignees

Comments

@bwmoore22
Copy link

virustotal_cat() throws an error with the message shown below when you exceed the API limit of four per minute. You might look at a more descriptive message, and perhaps a wait and then a retry.

From a programming perspective, it would be nice if virustotal_cat() took a vector like the other _cat calls. You would have to put some rate-limiting code in.

[1] "i = 1"
[1] "Domain = 100dollars-seo.com"
[1] "Domain results = 1" "Domain results = NA" "Domain results = 1" "Domain results = 1" "Domain results = NA" "Domain results = NA"
[7] "Domain results = NA"
[1] "i = 2"
[1] "Domain = best-seo-offer.com"
[1] "Domain results = 1" "Domain results = NA" "Domain results = 1" "Domain results = 1" "Domain results = NA" "Domain results = NA"
[7] "Domain results = NA"
[1] "i = 3"
[1] "Domain = best-seo-solution.com"
[1] "Domain results = 1" "Domain results = 1" "Domain results = 1" "Domain results = 1" "Domain results = NA" "Domain results = NA"
[7] "Domain results = NA"
[1] "i = 4"
[1] "Domain = buttons-for-website.com"
[1] "Domain results = 1" "Domain results = NA" "Domain results = 1" "Domain results = 1" "Domain results = NA" "Domain results = NA"
[7] "Domain results = NA"
[1] "i = 5"
[1] "Domain = buttons-for-your-website.com"
Error in if (res$verbose_msg == "Domain not found") { :
argument is of length zero
d> traceback()
2: virustotal_cat(domainDf[i], apikey = virusTotalApiKey) at #19
1: getVirusTotal(gaRefSpamDf$referrerDomain, virusTotalApiKey)
d> virustotal_cat("buttons-for-your-website.com",apikey = virusTotalApiKey)
domain bitdefender websense google dr_web trendmicro alexa
1 buttons-for-your-website.com NA uncategorized uncategorized NA NA NA

Code to recreate

getVirusTotal <- function(domainDf,virusTotalApiKey) {
require(rdomains)
require(dplyr)
#if (exists("virusDomain")) {

rm(virusDomain)

#}
domainDf <- gaRefSpamDf$referrerDomain
print(NROW(domainDf))
virusDomain <- data.frame(domain=as.character(),
bitdefender=as.character(),
dr_web=as.character(),
alexa=as.character(),
google=as.character(),
websense=as.character(),
trendmicro=as.character());
for (i in 1:NROW(domainDf)) {
print(paste("i = ",i));
print(paste("Domain = ",domainDf[i]));
thisDomain <- virustotal_cat(domainDf[i],apikey = virusTotalApiKey);
if (exists("thisDomain")) {
print(paste("Domain results = ",thisDomain))
virusDomain <- merge(virusDomain,thisDomain,all=TRUE)
}
}
return(result)
}
gaRefSpam1Df <- getVirusTotal(gaRefSpamDf$referrerDomain,virusTotalApiKey)

d> gaRefSpamDf$referrerDomain[1:10]
[1] "100dollars-seo.com" "best-seo-offer.com" "best-seo-solution.com" "buttons-for-website.com"
[5] "buttons-for-your-website.com" "crazyguyonabike.com" "darodar.com" "delta-search.com"
[9] "duckduckgo.com" "facebook.com"

@soodoku soodoku added the bug label Nov 7, 2016
@soodoku soodoku self-assigned this Nov 7, 2016
@soodoku
Copy link
Member

soodoku commented Nov 7, 2016

Thanks again for raising great points.

Rate limiting added to virustotal package via: themains/virustotal@65c3a66

CRAN update to virustotal coming soon.

Will look into vector inputs next.

@soodoku
Copy link
Member

soodoku commented Nov 12, 2016

New v. of virustotal with rate_limiting on CRAN now:
https://cran.r-project.org/web/packages/virustotal/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants