Skip to content

Commit 75beea9

Browse files
committed
Added "fraud_score" field to support PX12 database.
1 parent d49f343 commit 75beea9

File tree

13 files changed

+156
-96
lines changed

13 files changed

+156
-96
lines changed

COPYING

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 - 2024 IP2Location.com
3+
Copyright (c) 2020 - 2025 IP2Location.com
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

LICENSE.TXT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 - 2024 IP2Location.com
3+
Copyright (c) 2020 - 2025 IP2Location.com
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ For more details, please visit:
1717
make
1818

1919
### Windows
20-
Execute "vcvarsall.bat". (This file is part of Microsoft Visual C, not ip2location code)
20+
Execute "vcvarsall.bat". (This file is part of Microsoft Visual C, not ip2location code)
2121
nmake -f Makefile.win
2222

2323
### MacOS
2424
autoreconf -i -v --force
25-
export CFLAGS=-I/usr/include/malloc
25+
export CFLAGS=-I/usr/include/malloc
2626
./configure
2727
make
2828

@@ -33,7 +33,7 @@ For more details, please visit:
3333

3434
## Sample BIN Databases
3535

36-
* Download free IP2Proxy LITE databases at [https://lite.ip2location.com](https://lite.ip2location.com)
36+
* Download free IP2Proxy LITE databases at [https://lite.ip2location.com](https://lite.ip2location.com)
3737
* Download IP2Proxy sample databases at [https://www.ip2location.com/ip2proxy/developers](https://www.ip2location.com/ip2proxy/developers)
3838

3939
## Methods
@@ -64,6 +64,7 @@ Below are the methods supported in this library.
6464
| IP2Proxy_get_last_seen | Return proxy last seen in days. |
6565
| IP2Proxy_get_threat | Return security threat reported. |
6666
| IP2Proxy_get_provider | Return name of VPN provider if available. |
67+
| IP2Proxy_get_fraud_score | Return the potential risk score. |
6768

6869

6970

@@ -73,14 +74,14 @@ Open and read IP2Proxy binary database. There are 3 modes:
7374

7475
1. IP2Proxy_open("SAMPLE.BIN") - File I/O reading. Slower look, but low resource consuming.
7576
2. IP2Proxy_open_csv("SAMPLE.CSV") - CSV parsing. Slowest, but convenient to use.
76-
3. IP2Proxy_set_lookup_mode(IP2ProxyObj, IP2PROXY_SHARED_MEMORY) - Stores whole IP2Proxy database into system memory. Lookup is possible across all applications within the system. Extremely resources
77-
consuming. Do not use this mode if your system do not have enough
77+
3. IP2Proxy_set_lookup_mode(IP2ProxyObj, IP2PROXY_SHARED_MEMORY) - Stores whole IP2Proxy database into system memory. Lookup is possible across all applications within the system. Extremely resources
78+
consuming. Do not use this mode if your system do not have enough
7879
memory.
7980
4. IP2Proxy_set_lookup_mode(IP2ProxyObj, IP2PROXY_CACHE_MEMORY) - Caches database into memory for faster lookup. Required high memory.
8081

8182

8283

8384
## Support
8485

85-
86+
8687
URL: [https://www.ip2location.com](https://www.ip2location.com)

debian/changelog

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
libip2proxy (4.1.2) jammy; urgency=medium
1+
libip2proxy (4.2.0) jammy; urgency=medium
22

33
* Initial Release.
44

5-
-- IP2Location <[email protected]> Mon, 24 Mar 2023 08:58:00 +0800
5+
-- IP2Location <[email protected]> Mon, 4 Feb 2025 13:58:32 +0800

debian/copyright

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ Upstream-Contact: IP2Location <[email protected]>
44
Source: https://github.com/ip2location/ip2proxy-c.git
55

66
Files: *
7-
Copyright: 2020 IP2Location <[email protected]>
7+
Copyright: 2025 IP2Location <[email protected]>
88
License: MIT
99

1010
Files: debian/*
11-
Copyright: 2020 IP2Location <[email protected]>
11+
Copyright: 2025 IP2Location <[email protected]>
1212
License: MIT
1313

1414
License: MIT

docs/source/code.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,5 @@ Retrieve geolocation information for an IP address.
5353
| is_proxy | Determine whether if an IP address was a proxy or not. |
5454
| proxy_type | Type of proxy. |
5555
| provider | Name of VPN provider if available. |
56+
| fraud_score | Potential risk score (0 - 99) associated with IP address. |
5657
```

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# -- Project information
77

88
project = 'IP2Proxy C'
9-
copyright = '2024, IP2Location'
9+
copyright = '2025, IP2Location'
1010
author = 'IP2Location'
1111

1212
release = '0.1.0'

docs/source/quickstart.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ This library can be compiled and installed in different platform. Please refer t
2626
### Debian
2727

2828
```bash
29-
curl -LO https://github.com/ip2location/ip2proxy-c/releases/download/4.1.2/ip2proxy-4.1.2.deb
30-
sudo dpkg -i ip2proxy-4.1.2.deb
29+
curl -LO https://github.com/ip2location/ip2proxy-c/releases/download/4.2.0/ip2proxy-4.2.0.deb
30+
sudo dpkg -i ip2proxy-4.2.0.deb
3131
```
3232

3333

@@ -41,14 +41,14 @@ sudo apt install ip2proxy
4141

4242
### Windows
4343
```bash
44-
Execute "vcvarsall.bat". (This file is part of Microsoft Visual C, not ip2location code)
44+
Execute "vcvarsall.bat". (This file is part of Microsoft Visual C, not ip2location code)
4545
nmake -f Makefile.win
4646
```
4747

4848
### MacOS
4949
```bash
5050
autoreconf -i -v --force
51-
export CFLAGS=-I/usr/include/malloc
51+
export CFLAGS=-I/usr/include/malloc
5252
./configure
5353
make
5454
```
@@ -64,7 +64,7 @@ You can query the geolocation information from the IP2Proxy BIN database as belo
6464

6565
IP2Proxy *IP2ProxyObj = IP2Proxy_open("../data/SAMPLE.BIN");
6666
IP2ProxyRecord *record = IP2Proxy_get_all(IP2ProxyObj, "161.11.12.13");
67-
printf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
67+
printf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
6868
record->country_short,
6969
record->country_long,
7070
record->region,
@@ -78,7 +78,8 @@ printf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
7878
record->as_,
7979
record->last_seen,
8080
record->threat,
81-
record->provider);
81+
record->provider,
82+
record->fraud_score);
8283
IP2Proxy_free_record(record);
8384
IP2Proxy_close(IP2ProxyObj);
8485
```

ip2proxy.1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,15 @@ Query an IP address and display the country_short and city result
7777
\- last_seen
7878
\- threat
7979
\- provider
80-
80+
\- fraud_score
81+
8182
\-n, \-\no-heading
8283
Suppress the heading display.
8384

8485
.SH [AUTHORS]
8586
This tool was created by IP2Location (https://www.ip2location.com).
8687

8788
.SH [COPYRIGHT AND LICENSE]
88-
Copyright 2001\-2024 IP2Location.com
89+
Copyright 2001\-2025 IP2Location.com
8990

9091
This tool is licensed under MIT.

ip2proxy.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ static void print_usage(const char *argv0)
7676
" provider\n"
7777
" Name of VPN provider if available.\n"
7878
"\n"
79+
" fraud_score\n"
80+
" Potential risk score (0 - 99) associated with IP address.\n"
81+
"\n"
7982
" -f, --format\n"
8083
" Output format. Supported format:\n"
8184
" - csv (default)\n"
@@ -103,7 +106,7 @@ static void print_usage(const char *argv0)
103106

104107
static void print_version()
105108
{
106-
printf("IP2Proxy version 4.1.2\n");
109+
printf("IP2Proxy version 4.2.0\n");
107110
}
108111

109112
static void print_footer(FILE *fout, const char *field, const char *format)
@@ -160,6 +163,7 @@ static void print_header(FILE *fout, const char *field, const char *format)
160163
WRITE_HEADER("last_seen");
161164
WRITE_HEADER("threat");
162165
WRITE_HEADER("provider");
166+
WRITE_HEADER("fraud_score");
163167

164168
if (*end == ',') {
165169
start = end + 1;
@@ -186,7 +190,7 @@ static void print_record(FILE *fout, const char *field, IP2ProxyRecord *record,
186190
if (strncmp(start, field_name, end - start) == 0) { \
187191
const char *value = field; \
188192
if (strcmp(value, NOT_SUPPORTED) == 0) { \
189-
value = "N/A"; \
193+
value = "NOT SUPPORTED"; \
190194
} \
191195
if (strcmp(format, "XML") == 0) { \
192196
fprintf(fout, "<%s>%s</%s>", field_name, value, field_name); \
@@ -242,6 +246,7 @@ static void print_record(FILE *fout, const char *field, IP2ProxyRecord *record,
242246
WRITE_FIELD("last_seen", record->last_seen);
243247
WRITE_FIELD("threat", record->threat);
244248
WRITE_FIELD("provider", record->provider);
249+
WRITE_FIELD("fraud_score", record->fraud_score);
245250

246251
if (*end == ',') {
247252
start = end + 1;
@@ -272,7 +277,7 @@ int main(int argc, char *argv[])
272277
IP2ProxyRecord *record = NULL;
273278
FILE *fout = stdout;
274279

275-
field = "ip,is_proxy,proxy_type,country_code,country_name,region_name,city_name,isp,domain,as_number,as_name,last_seen,threat,provider";
280+
field = "ip,is_proxy,proxy_type,country_code,country_name,region_name,city_name,isp,domain,as_number,as_name,last_seen,threat,provider,fraud_score";
276281

277282
for (i = 1; i < argc; i++) {
278283
const char *argvi = argv[i];

0 commit comments

Comments
 (0)