From 4ccfb3fde0e535d4c1a9382b5a6c91898a3a3de7 Mon Sep 17 00:00:00 2001 From: hrbrmstr Date: Sat, 13 Feb 2021 13:23:46 -0500 Subject: [PATCH] initial commit --- .Rbuildignore | 1 + DESCRIPTION | 8 ++--- LICENSE | 2 ++ LICENSE.md | 21 +++++++++++++ NAMESPACE | 1 + R/darkdumpr.R | 37 ++++++++++++++++++++++ README.Rmd | 6 ++++ README.md | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ man/search_noir.Rd | 23 ++++++++++++++ 9 files changed, 187 insertions(+), 4 deletions(-) create mode 100644 LICENSE create mode 100644 LICENSE.md create mode 100644 R/darkdumpr.R create mode 100644 README.md create mode 100644 man/search_noir.Rd diff --git a/.Rbuildignore b/.Rbuildignore index c9a5c92..19cdbd8 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -19,3 +19,4 @@ ^CRAN-RELEASE$ ^appveyor\.yml$ ^tools$ +^LICENSE\.md$ diff --git a/DESCRIPTION b/DESCRIPTION index 73e301d..4746f40 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: darkdumpr Type: Package -Title: darkdumpr title goes here otherwise CRAN checks fail +Title: Query darkdump.io for Dark Web Content Version: 0.1.0 Date: 2021-02-13 Authors@R: c( @@ -8,15 +8,15 @@ Authors@R: c( comment = c(ORCID = "0000-0001-5670-2640")) ) Maintainer: Bob Rudis -Description: A good description goes here otherwise CRAN checks fail. +Description: Query darkdump.io for Dark Web Content. URL: https://git.rud.is/hrbrmstr/darkdumpr BugReports: https://git.rud.is/hrbrmstr/darkdumpr/issues Encoding: UTF-8 -License: AGPL +License: MIT + file LICENSE Suggests: covr, tinytest Depends: - R (>= 3.5.0) + R (>= 3.6.0) Imports: httr, jsonlite diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f51d1b2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2021 +COPYRIGHT HOLDER: Bob Rudis diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..c2304a0 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2021 Bob Rudis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/NAMESPACE b/NAMESPACE index 5b4b9ae..624a4e0 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,4 +1,5 @@ # Generated by roxygen2: do not edit by hand +export(search_noir) import(httr) importFrom(jsonlite,fromJSON) diff --git a/R/darkdumpr.R b/R/darkdumpr.R new file mode 100644 index 0000000..d87bb1b --- /dev/null +++ b/R/darkdumpr.R @@ -0,0 +1,37 @@ +.darkdumpr_ua <- "Mozilla/5.0 (Compatible; r-darkdumpr/1.0; https://gitlab.com/hrbrmstr/darkdumpr)" + +#' Query darkdump.io for Dark Web Content +#' +#' @param query <chr> terms to search (supports +#' [darkdump.io advanced search composition](https://darksearch.io/dorks)). +#' @param page pagination control +#' @return data frame with a "`metadata`" atttribute containing pagination info +#' @export +#' @examples +#' search_noir("ransomware") +search_noir <- function(query, page = 1) { + + httr::GET( + url = "https://darksearch.io/api/search", + query = list( + query = query[1], + page = page[1] + ), + httr::user_agent(.darkdumpr_ua) + ) -> res + + httr::stop_for_status(res) + + out <- httr::content(res, as = "text", encoding = "UTF-8") + out <- jsonlite::fromJSON(out) + + if (hasName(out, "data")) { + ret <- out$data + out$data <- NULL + attr(ret, "metadata") <- out + ret + } else { + out + } + +} \ No newline at end of file diff --git a/README.Rmd b/README.Rmd index 0da8c47..ff93852 100644 --- a/README.Rmd +++ b/README.Rmd @@ -39,6 +39,12 @@ packageVersion("darkdumpr") ``` +```{r ex-01} +res <- tibble::as_tibble(search_noir("ransomware")) + +cat(res$description[1]) +``` + ## darkdumpr Metrics ```{r cloc, echo=FALSE} diff --git a/README.md b/README.md new file mode 100644 index 0000000..2343d54 --- /dev/null +++ b/README.md @@ -0,0 +1,92 @@ + +[![Project Status: Active – The project has reached a stable, usable +state and is being actively +developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) +[![Signed +by](https://img.shields.io/badge/Keybase-Verified-brightgreen.svg)](https://keybase.io/hrbrmstr) +![Signed commit +%](https://img.shields.io/badge/Signed_Commits-100%25-lightgrey.svg) +[![Linux build +Status](https://travis-ci.org/hrbrmstr/darkdumpr.svg?branch=master)](https://travis-ci.org/hrbrmstr/darkdumpr) +![Minimal R +Version](https://img.shields.io/badge/R%3E%3D-3.6.0-blue.svg) +![License](https://img.shields.io/badge/License-MIT-blue.svg) + +# darkdumpr + +Query darkdump.io for Dark Web Content + +## Description + +Query darkdump.io for Dark Web Content. + +## What’s Inside The Tin + +The following functions are implemented: + +- `search_noir`: Query darkdump.io for Dark Web Content + +## Installation + +``` r +remotes::install_git("https://git.rud.is/hrbrmstr/darkdumpr.git") +# or +remotes::install_gitlab("hrbrmstr/darkdumpr") +# or +remotes::install_bitbucket("hrbrmstr/darkdumpr") +# or +remotes::install_github("hrbrmstr/darkdumpr") +``` + +NOTE: To use the ‘remotes’ install options you will need to have the +[{remotes} package](https://github.com/r-lib/remotes) installed. + +## Usage + +``` r +library(darkdumpr) + +# current version +packageVersion("darkdumpr") +## [1] '0.1.0' +``` + +``` r +res <- tibble::as_tibble(search_noir("ransomware")) + +cat(res$description[1]) +## Surfacing The News From The DeepWeb +## +## Menu +## +## * Home +## * News & Articles +## * Markets List +## * Markets Chart +## * Vpn's Chart +## * Bitcoin Casinos +## * BTC Mixer +## * Q&A ~ Ask Here! +## * Videos +## * Contact Us +## +## Home » Articles » An overview of bitcoin ransomware attack campaigns +## +## # An overview of bitcoin +``` + +## darkdumpr Metrics + +| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) | +|:-----|---------:|-----:|----:|-----:|------------:|-----:|---------:|-----:| +| R | 3 | 0.38 | 26 | 0.36 | 8 | 0.16 | 17 | 0.18 | +| Rmd | 1 | 0.12 | 10 | 0.14 | 17 | 0.34 | 30 | 0.32 | +| SUM | 4 | 0.50 | 36 | 0.50 | 25 | 0.50 | 47 | 0.50 | + +clock Package Metrics for darkdumpr + +## Code of Conduct + +Please note that this project is released with a Contributor Code of +Conduct. By participating in this project you agree to abide by its +terms. diff --git a/man/search_noir.Rd b/man/search_noir.Rd new file mode 100644 index 0000000..90cbf8c --- /dev/null +++ b/man/search_noir.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/darkdumpr.R +\name{search_noir} +\alias{search_noir} +\title{Query darkdump.io for Dark Web Content} +\usage{ +search_noir(query, page = 1) +} +\arguments{ +\item{query}{ terms to search (supports +\href{https://darksearch.io/dorks}{darkdump.io advanced search composition}).} + +\item{page}{pagination control} +} +\value{ +data frame with a "\code{metadata}" atttribute containing pagination info +} +\description{ +Query darkdump.io for Dark Web Content +} +\examples{ +search_noir("ransomware") +}