Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hrbrmstr/udpprobe
🔎 Send User Datagram Protocol ('UDP') Probes and Receive Responses in R
https://github.com/hrbrmstr/udpprobe
r r-cyber rstats ubiquiti udp udp-client
Last synced: 23 days ago
JSON representation
🔎 Send User Datagram Protocol ('UDP') Probes and Receive Responses in R
- Host: GitHub
- URL: https://github.com/hrbrmstr/udpprobe
- Owner: hrbrmstr
- License: other
- Created: 2019-02-03T19:12:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-02-06T15:26:26.000Z (over 5 years ago)
- Last Synced: 2024-08-13T07:11:42.525Z (3 months ago)
- Topics: r, r-cyber, rstats, ubiquiti, udp, udp-client
- Language: R
- Homepage:
- Size: 61.5 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - hrbrmstr/udpprobe - 🔎 Send User Datagram Protocol ('UDP') Probes and Receive Responses in R (R)
README
---
output: rmarkdown::github_document
editor_options:
chunk_output_type: console
---
```{r pkg-knitr-opts, include=FALSE}
knitr::opts_chunk$set(collapse=TRUE, fig.retina=2, message=FALSE, warning=FALSE)
options(width=60)
```[![Travis-CI Build Status](https://travis-ci.org/hrbrmstr/udpprobe.svg?branch=master)](https://travis-ci.org/hrbrmstr/udpprobe)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/hrbrmstr/udpprobe?branch=master&svg=true)](https://ci.appveyor.com/project/hrbrmstr/udpprobe)
[![Coverage Status](https://codecov.io/gh/hrbrmstr/udpprobe/branch/master/graph/badge.svg)](https://codecov.io/gh/hrbrmstr/udpprobe)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/udpprobe)](https://cran.r-project.org/package=udpprobe)# udpprobe
Send User Datagram Protocol ('UDP') Probes and Receive Responses
## Description
Unfortunately (but understandably) R has no built in connection support for
the user datagram protocol ('UDP'). We aim to somewhat fix that with the ability
to send a lightweight probe and receive lightweight responses over 'UDP' to
a target host/port. **Supports Windows, macOS and Linux clients.**## What's Inside The Tin
_The following functions are implemented:_
The core probe function:
- `udp_send_payload`: Send a UDP payload and return the response (if any)
Helpers for Ubiquity Discover Protocol probes:
- `ubnt_discovery_probe`: Send a Ubiquiti Discovery probe to a host with a discovery query payload and receive a response
udpprobe Send UDP payloads and gather response
- `parse_ubnt_discovery_response`: Parser for Ubiquiti Discovery Protocol responsesHelpers for old, insecure internet services:
- `udp_daytime`: Send an request for the day/time
- `udp_echo`: Send an echo request to an echo server
- `udp_qotd`: Send an request for the QOTD## Installation
```{r install-ex, eval=FALSE}
devtools::install_git("https://git.sr.ht/~hrbrmstr/udpprobe")
# or
devtools::install_gitlab("hrbrmstr/udpprobe")
# or
devtools::install_github("hrbrmstr/udpprobe")
```## Usage
```{r lib-ex}
library(udpprobe)# current version
packageVersion("udpprobe")```
### Fun with manually crafting DNS records
What's the IP address of `example.com`?
```{r dns}
c(
0xaa, 0xaa, # id
0x01, 0x00, # |QR| Opcode |AA|TC|RD|RA| Z | RCODE |
0x00, 0x01, # QDCOUNT num of questions
0x00, 0x00, # ANCOUNT 0 since it's only for answers
0x00, 0x00, # NSCOUNT 0 since it's only for answers
0x00, 0x00, # ARCOUNT 0 sicne it's only for answers
0x07, # start of QNAME beginning with size of "example"
0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, # example
0x03, # size of "com" (excluding null terminator)
0x63, 0x6f, 0x6d, 0x00, # "com" with null terminator
0x00, 0x01, # QTYPE ("A" == 1)
0x00, 0x01 # QCLASS (internet == 1)
) -> dns_req(resp <- udp_send_payload("8.8.8.8", 53, dns_req))
paste0(as.integer(tail(resp, 4)), collapse = ".")
curl::nslookup("example.com")
```### Live Ubiquiti Test (internet host redacted)
```{r ubnt}
# the following just does:
# udp_send_payload(Sys.getenv("UBNT_TEST_HOST"), 10001L, c(0x01, 0x00, 0x00, 0x00))
(x <- ubnt_discovery_probe(Sys.getenv("UBNT_TEST_HOST")))parse_ubnt_discovery_response(x)
```### Old, indecure internet services:
```{r old}
cat(udp_echo("91.207.125.246", "the message you want back"), "\n")cat(udp_qotd("119.48.167.199"), "\n")
cat(udp_daytime("195.34.89.241"), "\n")
```## udpprobe Metrics
```{r cloc, echo=FALSE}
cloc::cloc_pkg_md()
```## Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).
By participating in this project you agree to abide by its terms.