Browse Source

Merge pull request #1 from Ironholds/master

*southern voice* You been writin' too much Python, boy?
master
boB Rudis 8 years ago
parent
commit
bb8b227d47
  1. 9
      NAMESPACE
  2. 25
      R/analyze.r
  3. 6
      R/api-info.r
  4. 15
      R/endpoint.r
  5. 6
      R/root.r
  6. 6
      R/ssllabs-package.r
  7. 10
      man/ssllabs.Rd

9
NAMESPACE

@ -5,6 +5,9 @@ export(get_endpoint_data)
export(get_root_certs_raw)
export(get_status_codes)
export(ssllabs_api_info)
import(httr)
import(jsonlite)
import(openssl)
importFrom(httr,GET)
importFrom(httr,content)
importFrom(httr,stop_for_status)
importFrom(httr,user_agent)
importFrom(jsonlite,fromJSON)
importFrom(openssl,read_cert)

25
R/analyze.r

@ -32,20 +32,19 @@
#' cached report is returned.
#' @references \url{https://github.com/ssllabs/ssllabs-scan/blob/stable/ssllabs-api-docs.md}
#' @export
analyze_site <- function(host, publish="off", start_new=NULL,
from_cache="off", max_age=NULL,
all="on", ignore_mismatch="off") {
analyze_site <- function(host, publish = "off", start_new = NULL,
from_cache = "off", max_age = NULL,
all = "on", ignore_mismatch = "off") {
res <- httr::GET("https://api.ssllabs.com/api/v2/analyze",
query=list(host=host,
publish=publish,
startNew=start_new,
fromCache=from_cache,
maxAge=max_age,
all=all,
ignoreMismatch=ignore_mismatch))
query=list(host = host,
publish = publish,
startNew = start_new,
fromCache = from_cache,
maxAge = max_age,
all = all,
ignoreMismatch = ignore_mismatch))
httr::stop_for_status(res)
dat <- httr::content(res, as="text")
jsonlite::fromJSON(dat, flatten=TRUE)
return(jsonlite::fromJSON(dat, flatten=TRUE))
}

6
R/api-info.r

@ -9,7 +9,7 @@
ssllabs_api_info <- function() {
res <- httr::GET("https://api.ssllabs.com/api/v2/info")
dat <- httr::content(res, as="text")
jsonlite::fromJSON(dat, flatten=TRUE)
httr::stop_for_status(res)
dat <- httr::content(res, as = "text")
return(jsonlite::fromJSON(dat, flatten = TRUE))
}

15
R/endpoint.r

@ -13,14 +13,13 @@
#' time as the start_new parameter.
#' @references \url{https://github.com/ssllabs/ssllabs-scan/blob/stable/ssllabs-api-docs.md}
#' @export
get_endpoint_data <- function(host, ip, from_cache="off") {
get_endpoint_data <- function(host, ip, from_cache = "off") {
res <- httr::GET("https://api.ssllabs.com/api/v2/getEndpointData",
query=list(host=host,
s=ip,
fromCache=from_cache))
dat <- httr::content(res, as="text")
jsonlite::fromJSON(dat, flatten=TRUE)
query = list(host = host,
s = ip,
fromCache = from_cache))
httr::stop_for_status(res)
dat <- httr::content(res, as = "text")
return(jsonlite::fromJSON(dat, flatten = TRUE))
}

6
R/root.r

@ -7,7 +7,7 @@
get_root_certs_raw <- function() {
res <- httr::GET("https://api.ssllabs.com/api/v2/getRootCertsRaw")
dat <- httr::content(res, as="text")
openssl::read_cert(dat)
httr::stop_for_status(res)
dat <- httr::content(res, as = "text")
return(openssl::read_cert(dat))
}

6
R/ssllabs-package.r

@ -1,4 +1,4 @@
#' Tools to Work with the `SSL Labs` `API`
#' @title Tools to Work with the `SSL Labs` `API`
#'
#' SSL Labs APIs are provided free of charge, subject to our terms and conditions:
#' \url{https://www.ssllabs.com/about/terms.html}. The spirit of the license is that the
@ -45,5 +45,7 @@
#' @name ssllabs
#' @docType package
#' @author Bob Rudis (@@hrbrmstr)
#' @import httr jsonlite openssl
#' @importFrom httr stop_for_status GET user_agent content
#' @importFrom jsonlite fromJSON
#' @importFrom openssl read_cert
NULL

10
man/ssllabs.Rd

@ -4,8 +4,8 @@
\name{ssllabs}
\alias{ssllabs}
\alias{ssllabs-package}
\title{Tools to Work with the `SSL Labs` `API`}
\description{
\title{Tools to Work with the `SSL Labs` `API`
SSL Labs APIs are provided free of charge, subject to our terms and conditions:
\url{https://www.ssllabs.com/about/terms.html}. The spirit of the license is that the
APIs are made available so that system operators can test their own infrastructure.
@ -13,8 +13,7 @@ Please read the actual terms and conditions, which are more involved and cover t
such as integrating with open source projects, and so on. For example, it's important
(for reasons of privacy, compliance, etc.) for end users to understand that assessments
are carried out by Qualys's servers, not locally.
}
\details{
Commercial use is generally not allowed, except with an explicit permission from Qualys.
That said, we're usually happy to support good causes, even uses by commercial
organizations that help improve the security of their customers. If you're a CA, CDN,
@ -47,8 +46,7 @@ to be in. If you encounter it, take a break and come back later.
All successful API calls contain response headers X-Max-Assessments and
X-Current-Assessments. They can be used to calculate how many new assessments can be
submitted. It is recommended that clients update their internal state after each
complete response.
}
complete response.}
\author{
Bob Rudis (@hrbrmstr)
}

Loading…
Cancel
Save