Skip to content

Commit d99a41e

Browse files
authored
Add files via upload
First Commit.
0 parents  commit d99a41e

File tree

9 files changed

+245
-0
lines changed

9 files changed

+245
-0
lines changed

DESCRIPTION

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Package: ip2proxy
2+
Type: Package
3+
Title: Lookup for IP Address Proxy Information
4+
Version: 1.0.0
5+
Author: IP2Location
6+
Maintainer: IP2Location <[email protected]>
7+
Description: A R package to find the IP addresses which are used as VPN anonymizer, open proxies, web proxies and Tor exits.
8+
The package lookup the proxy IP address from IP2Proxy BIN Data file. You may visit <https://lite.ip2location.com> for free database download.
9+
License: MIT + file LICENSE
10+
Encoding: UTF-8
11+
Depends: R (>= 3.2.3)
12+
Imports: reticulate (>= 1.13), stringr (>= 1.4.0), jsonlite (>= 1.6)
13+
LazyData: true
14+
SystemRequirements: IP2Proxy Python library
15+
<https://www.ip2location.com/development-libraries/ip2proxy/python>
16+
RoxygenNote: 7.1.1

LICENSE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
YEAR: 2020
2+
COPYRIGHT HOLDER: IP2Location

LICENSE.TXT

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 IP2Location.com
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

NAMESPACE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Generated by roxygen2: do not edit by hand
2+
3+
export(get_all)
4+
export(is_proxy)
5+
export(open)
6+
import(jsonlite)
7+
import(reticulate)

R/IP2Proxy.r

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#' @title Load IP2Proxy BIN data
2+
#'
3+
#' @description Load the IP2Proxy BIN data for lookup. Free IP2Proxy LITE data available for download at <https://lite.ip2location.com/>
4+
#' @param bin_location Absolute path of IP2Proxy BIN data
5+
#' @return NULL
6+
#' @import reticulate
7+
#' @export
8+
#' @examples \donttest{
9+
#' open("~/IP-COUNTRY.BIN")
10+
#' }
11+
#'
12+
13+
open <- function(bin_location){
14+
py_run_string("import IP2Proxy")
15+
py_run_string("import json")
16+
path = paste("data = IP2Proxy.IP2Proxy('", bin_location , "')", sep = "")
17+
py_run_string(path)
18+
}
19+
20+
#' @title Lookup for IP address proxy information
21+
#'
22+
#' @description Find the country, region, city, ISP, domain name, usage types, asn, as name, last seen and threat type. The return values will be depending on the BIN data loaded.
23+
#' @param ip IPv4 or IPv6 address
24+
#' @return Return all the proxy information about the IP address
25+
#' @import reticulate
26+
#' @import jsonlite
27+
#' @export
28+
#' @examples \donttest{
29+
#' get_all("8.8.8.8")
30+
#' }
31+
#'
32+
33+
get_all <- function(ip){
34+
address = paste("rec = data.get_all('", ip, "')", sep = "")
35+
py_run_string(address)
36+
py_run_string("j = json.dumps(rec)")
37+
result = fromJSON(py$j)
38+
return(result)
39+
}
40+
41+
#' @title Lookup for IP address proxy information
42+
#' @param ip IPv4 or IPv6 address
43+
#' @description Check whether if an IP address was a proxy.
44+
#' @return Return a digit value: -1 (errors), 0 (not a proxy), 1 (a proxy), and 2 (a data center IP address).
45+
#' @import reticulate
46+
#' @import jsonlite
47+
#' @export
48+
#' @examples \donttest{
49+
#' is_proxy("8.8.8.8")
50+
#' }
51+
#'
52+
53+
is_proxy <- function(ip){
54+
is_proxy = paste("is_proxy = data.is_proxy('", ip, "')", sep = "")
55+
py_run_string(is_proxy)
56+
py_run_string("rec1 = {}")
57+
py_run_string("rec1['is_proxy'] = is_proxy")
58+
py_run_string("j1 = json.dumps(rec1)")
59+
result = fromJSON(py$j1)
60+
return(result['is_proxy'])
61+
}

man/get_all.Rd

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/is_proxy.Rd

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/open.Rd

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# IP2Proxy R package
2+
3+
This library allows user to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits. It lookup the proxy IP address from **IP2Proxy BIN Data** file. This data file can be downloaded at
4+
5+
- Free IP2Proxy BIN Data: [https://lite.ip2location.com](https://lite.ip2location.com/)
6+
- Commercial IP2Proxy BIN Data: https://www.ip2location.com/proxy-database
7+
8+
## Requirement
9+
10+
IP2Proxy R package required IP2Proxy Python library to work. In order to install IP2Proxy Python library, you can use the following command:
11+
12+
## Installation
13+
14+
1. In your RStudio IDE, type the following command into the console:
15+
16+
```R
17+
install.packages("devtools")
18+
require(devtools)
19+
```
20+
21+
```
22+
23+
```
24+
25+
2. After that, install IP2Proxy R package by using the following command: `install_github("ip2location/ip2proxy-r")`
26+
27+
## Usage
28+
29+
1. Load IP2Proxy BIN database by the following command: `ip2proxy::open(path_to_your_database)`
30+
2. Query all the proxy information for an IP address by this command: `ip2proxy::get_all(ip_address)`
31+
3. To know whether an IP address is a proxy or not, you can do this by: `ip2proxy::is_proxy(ip_address)`
32+
33+
## Proxy Type
34+
35+
| Proxy Type | Description |
36+
| ---------- | ------------------------------ |
37+
| VPN | Anonymizing VPN services. |
38+
| TOR | Tor Exit Nodes. |
39+
| PUB | Public Proxies. |
40+
| WEB | Web Proxies. |
41+
| DCH | Hosting Providers/Data Center. |
42+
| SES | Search Engine Robots. |
43+
| RES | Residential Proxies [PX10+] |
44+
45+
## Usage Type
46+
47+
| Usage Type | Description |
48+
| ---------- | ------------------------------- |
49+
| COM | Commercial |
50+
| ORG | Organization |
51+
| GOV | Government |
52+
| MIL | Military |
53+
| EDU | University/College/School |
54+
| LIB | Library |
55+
| CDN | Content Delivery Network |
56+
| ISP | Fixed Line ISP |
57+
| MOB | Mobile ISP |
58+
| DCH | Data Center/Web Hosting/Transit |
59+
| SES | Search Engine Spider |
60+
| RSV | Reserved |
61+
62+
## Threat Type
63+
64+
| Threat Type | Description |
65+
| ----------- | -------------------------- |
66+
| SPAM | Spammer |
67+
| SCANNER | Security Scanner or Attack |
68+
| BOTNET | Spyware or Malware |
69+
70+
## Support
71+
72+
Email: [[email protected]](mailto:[email protected]). URL: [https://www.ip2location.com](https://www.ip2location.com/)

0 commit comments

Comments
 (0)