Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
pdwaggoner authored Sep 27, 2018
1 parent 8224112 commit 56bafd8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
14 changes: 14 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Package: rIP
Type: Package
Title: Passes an array of IP addresses to iphub.info and returns a dataframe with details of IP
Version: 0.1.0
Author: Ryan Kennedy
Maintainer: Ryan Kennedy <[email protected]>
Description: Takes as its input an array of IPs and the user's X-Key, passes these to iphub.info, and returns a dataframe with the ip (used for merging), country code, country name, asn, isp, block, and hostname.
Especially important in this is the variable "block", which gives a score indicating whether the IP address is likely from a server farm and should be excluded from the data. It is codes 0 if the IP is residential/unclassified (i.e. safe IP), 1 if the IP is non-residential IP (hostping provider, proxy, etc. -- should likely be excluded), and 2 for non-residential and residential IPs (more stringent, may flag innocent respondents).
The recommendation from iphub.info is to block or exclude those who score block = 1.
Imports:
httr
License: CC0
Encoding: UTF-8
LazyData: true
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exportPattern("^[[:alpha:]]+")
20 changes: 20 additions & 0 deletions R/rIP function.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#' @export

# rIP function

getIPinfo <- function(ips, key) {
options(stringsAsFactors = FALSE)
url <- "http://v2.api.iphub.info/ip/"
pb <- txtProgressBar(min = 0, max = length(ips), style = 3)
ipDF <- c()
for (i in 1:length(ips)) {
ipInfo <- httr::GET(paste0(url, ips[i]), add_headers(`X-Key` = key))
infoVector <- unlist(httr::content(ipInfo))
ipDF <- rbind(ipDF, infoVector)
setTxtProgressBar(pb, i)
}
close(pb)
ipDF <- data.frame(ipDF)
rownames(ipDF) <- NULL
return(ipDF)
}
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# rIP
This is an R code project for detecting likely responsese from server farms on MTurk surveys. It will eventually be built into a package, but for now is an easy function for use. Credit to @tylerburleigh for pointing out the utility of iphub.info. His method for incorporating this information into Qualtrics surveys can be found here: https://twitter.com/tylerburleigh/status/1042528912511848448?s=19.
This is an R code project for detecting likely responsese from server farms on MTurk surveys.

Takes as its input an array of IPs and the user's X-Key, passes these to iphub.info, and returns a dataframe with the ip (used for merging), country code, country name, asn, isp, block, and hostname.

Especially important in this is the variable "block", which gives a score indicating whether the IP address is likely from a server farm and should be excluded from the data. It is codes 0 if the IP is residential/unclassified (i.e. safe IP), 1 if the IP is non-residential IP (hostping provider, proxy, etc. -- should likely be excluded), and 2 for non-residential and residential IPs (more stringent, may flag innocent respondents).

The recommendation from iphub.info is to block or exclude those who score block = 1.

Credit to @tylerburleigh for pointing out the utility of iphub.info. His method for incorporating this information into Qualtrics surveys can be found here: https://twitter.com/tylerburleigh/status/1042528912511848448?s=19.

0 comments on commit 56bafd8

Please sign in to comment.