Skip to content

Commit 90cc46c

Browse files
committed
Initial release: ip, security, asn, abuse tables
0 parents  commit 90cc46c

21 files changed

Lines changed: 3529 additions & 0 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

.goreleaser.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
- GO111MODULE=on
11+
- GOPRIVATE=github.com/turbot
12+
goos:
13+
- linux
14+
- darwin
15+
goarch:
16+
- amd64
17+
- arm64
18+
id: "steampipe"
19+
binary: "{{ .ProjectName }}.plugin"
20+
21+
archives:
22+
- formats:
23+
- gz
24+
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
25+
files:
26+
- none*
27+
28+
checksum:
29+
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
30+
algorithm: sha256

LICENSE

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
Apache License
2+
Version 2.0, January 2004
3+
http://www.apache.org/licenses/
4+
5+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6+
7+
1. Definitions.
8+
9+
"License" shall mean the terms and conditions for use, reproduction,
10+
and distribution as defined by Sections 1 through 9 of this document.
11+
12+
"Licensor" shall mean the copyright owner or entity authorized by
13+
the copyright owner that is granting the License.
14+
15+
"Legal Entity" shall mean the union of the acting entity and all
16+
other entities that control, are controlled by, or are under common
17+
control with that entity. For the purposes of this definition,
18+
"control" means (i) the power, direct or indirect, to cause the
19+
direction or management of such entity, whether by contract or
20+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
21+
outstanding shares, or (iii) beneficial ownership of such entity.
22+
23+
"You" (or "Your") shall mean an individual or Legal Entity
24+
exercising permissions granted by this License.
25+
26+
"Source" form shall mean the preferred form for making modifications,
27+
including but not limited to software source code, documentation
28+
source, and configuration files.
29+
30+
"Object" form shall mean any form resulting from mechanical
31+
transformation or translation of a Source form, including but
32+
not limited to compiled object code, generated documentation,
33+
and conversions to other media types.
34+
35+
"Work" shall mean the work of authorship made available under
36+
the License, as indicated by a copyright notice that is included in
37+
or attached to the work (an example is provided in the Appendix below).
38+
39+
"Derivative Works" shall mean any work, whether in Source or Object
40+
form, that is based on (or derived from) the Work and for which the
41+
editorial revisions, annotations, elaborations, or other modifications
42+
represent, as a whole, an original work of authorship. For the purposes
43+
of this License, Derivative Works shall not include works that remain
44+
separable from, or merely link (or bind by name) to the interfaces of,
45+
the Work and Derivative Works thereof.
46+
47+
"Contribution" shall mean, as submitted to the Licensor for inclusion
48+
in the Work by the copyright owner or by an individual or Legal Entity
49+
authorized to submit on behalf of the copyright owner. For the purposes
50+
of this definition, "submitted" means any form of electronic, verbal,
51+
or written communication sent to the Licensor or its representatives,
52+
including but not limited to communication on electronic mailing lists,
53+
source code control systems, and issue tracking systems that are managed
54+
by, or on behalf of, the Licensor for the purpose of discussing and
55+
improving the Work, but excluding communication that is conspicuously
56+
marked or designated in writing by the copyright owner as "Not a
57+
Contribution."
58+
59+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
60+
whom a Contribution has been received by the Licensor and incorporated
61+
within the Work.
62+
63+
2. Grant of Copyright License. Subject to the terms and conditions of
64+
this License, each Contributor hereby grants to You a perpetual,
65+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66+
copyright license to reproduce, prepare Derivative Works of,
67+
publicly display, publicly perform, sublicense, and distribute the
68+
Work and such Derivative Works in Source or Object form.
69+
70+
3. Grant of Patent License. Subject to the terms and conditions of
71+
this License, each Contributor hereby grants to You a perpetual,
72+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73+
(except as stated in this section) patent license to make, have made,
74+
use, offer to sell, sell, import, and otherwise transfer the Work,
75+
where such license applies only to those patent claims licensable
76+
by such Contributor that are necessarily infringed by their
77+
Contribution(s) alone or by combination of their Contribution(s)
78+
with the Work to which such Contribution(s) was submitted. If You
79+
institute patent litigation against any entity (including a cross-claim
80+
or counterclaim in a lawsuit) alleging that the Work or any
81+
Contribution embodied within the Work constitutes direct or
82+
contributory patent infringement, then any patent licenses granted to
83+
You under this License for that Work shall terminate as of the date
84+
such litigation is filed.
85+
86+
4. Redistribution. You may reproduce and distribute copies of the
87+
Work or Derivative Works thereof in any medium, with or without
88+
modifications, and in Source or Object form, provided that You
89+
meet the following conditions:
90+
91+
(a) You must give any other recipients of the Work or Derivative
92+
Works a copy of this License; and
93+
94+
(b) You must cause any modified files to carry prominent notices
95+
stating that You changed the files; and
96+
97+
(c) You must retain, in the Source form of any Derivative Works
98+
that You distribute, all copyright, patent, trademark, and
99+
attribution notices from the Source form of the Work,
100+
excluding those notices that do not pertain to any part of
101+
the Derivative Works; and
102+
103+
(d) If the Work includes a "NOTICE" text file as part of its
104+
distribution, You must include a readable copy of the
105+
attribution notices contained within such NOTICE file, in
106+
at least one of the following places: within a NOTICE text
107+
file distributed as part of the Derivative Works; within
108+
the Source form or documentation, if provided along with the
109+
Derivative Works; or, within a display generated by the
110+
Derivative Works, if and wherever such third-party notices
111+
normally appear. The contents of the NOTICE file are for
112+
informational purposes only and do not modify the License.
113+
You may add Your own attribution notices within Derivative
114+
Works that You distribute, alongside or in addition to the
115+
NOTICE text from the Work, provided that such additional
116+
attribution notices cannot be construed as modifying the License.
117+
118+
You may add Your own license statement for Your modifications and
119+
may provide additional grant of rights to use, copy, modify, merge,
120+
publish, distribute, sublicense, and/or sell copies of the
121+
Contribution, either on an original basis or as part of a larger Work.
122+
123+
5. Submission of Contributions. Unless You explicitly state otherwise,
124+
any Contribution intentionally submitted for inclusion in the Work
125+
by You to the Licensor shall be under the terms and conditions of
126+
this License, without any additional terms or conditions.
127+
Notwithstanding the above, nothing herein shall supersede or modify
128+
the terms of any separate license agreement you may have executed
129+
with Licensor regarding such Contributions.
130+
131+
6. Trademarks. This License does not grant permission to use the trade
132+
names, trademarks, service marks, or product names of the Licensor,
133+
except as required for reasonable and customary use in describing the
134+
origin of the Work and reproducing the content of the NOTICE file.
135+
136+
7. Disclaimer of Warranty. Unless required by applicable law or
137+
agreed to in writing, Licensor provides the Work (and each
138+
Contributor provides its Contributions) on an "AS IS" BASIS,
139+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
140+
implied, including, without limitation, any warranties or conditions
141+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
142+
PARTICULAR PURPOSE. You are solely responsible for determining the
143+
appropriateness of using or reproducing the Work and assume any
144+
risks associated with Your exercise of permissions under this License.
145+
146+
8. Limitation of Liability. In no event and under no legal theory,
147+
whether in tort (including negligence), contract, or otherwise,
148+
unless required by applicable law (such as deliberate and grossly
149+
negligent acts) or agreed to in writing, shall any Contributor be
150+
liable to You for damages, including any direct, indirect, special,
151+
incidental, or exemplary damages of any character arising as a
152+
result of this License or out of the use or inability to use the
153+
Work (including but not limited to damages for loss of goodwill,
154+
work stoppage, computer failure or malfunction, or all other
155+
commercial damages or losses), even if such Contributor has been
156+
advised of the possibility of such damages.
157+
158+
9. Accepting Warranty or Liability. While redistributing the Work or
159+
Derivative Works thereof, You may choose to offer, and charge a fee
160+
for, acceptance of support, warranty, indemnity, or other liability
161+
obligations and/or rights consistent with this License. However, in
162+
accepting such obligations, You may offer such obligations only on
163+
Your own behalf and on Your sole responsibility, not on behalf of
164+
any other Contributor, and only if You agree to indemnify, defend,
165+
and hold each Contributor harmless for any liability incurred by,
166+
or claims asserted against, such Contributor by reason of your
167+
accepting any such warranty or liability.
168+
169+
END OF TERMS AND CONDITIONS
170+
171+
APPENDIX: How to apply the Apache License to your work.
172+
173+
To apply the Apache License to your work, attach the following
174+
boilerplate notice, with the fields enclosed by brackets "[]"
175+
replaced with your own identifying information. (Don't include
176+
the brackets!) The text should be enclosed in the appropriate
177+
comment syntax for the format in question. It is also permissible
178+
to omit this notice from files where including it would be
179+
disruptive.
180+
181+
Copyright 2026 IPGeolocation.io
182+
183+
Licensed under the Apache License, Version 2.0 (the "License");
184+
you may not use this file except in compliance with the License.
185+
You may obtain a copy of the License at
186+
187+
http://www.apache.org/licenses/LICENSE-2.0
188+
189+
Unless required by applicable law or agreed to in writing, software
190+
distributed under the License is distributed on an "AS IS" BASIS,
191+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
192+
See the License for the specific language governing permissions and
193+
limitations under the License.

Makefile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
PLUGIN_NAME = steampipe-plugin-ipgeolocation
2+
PLUGIN_DIR = $(HOME)/.steampipe/plugins/local/ipgeolocation
3+
PLUGIN_BIN = $(PLUGIN_DIR)/ipgeolocation.plugin
4+
CONFIG_DIR = $(HOME)/.steampipe/config
5+
CONFIG_FILE = $(CONFIG_DIR)/ipgeolocation.spc
6+
7+
.PHONY: all build install install-config setup fmt lint test clean
8+
9+
## Default: build the plugin binary
10+
all: build
11+
12+
## Compile the plugin binary
13+
build:
14+
go build -o $(PLUGIN_NAME) .
15+
16+
## Install binary into Steampipe's local plugin path
17+
install: build
18+
@mkdir -p $(PLUGIN_DIR)
19+
@cp $(PLUGIN_NAME) $(PLUGIN_BIN)
20+
@echo "✓ Plugin installed → $(PLUGIN_BIN)"
21+
22+
## Copy the sample config (skips if already exists so you don't lose edits)
23+
install-config:
24+
@mkdir -p $(CONFIG_DIR)
25+
@if [ -f "$(CONFIG_FILE)" ]; then \
26+
echo "⚠ Config already exists at $(CONFIG_FILE) — skipping."; \
27+
echo " To reset it, delete the file and re-run: make install-config"; \
28+
else \
29+
cp config/ipgeolocation.spc $(CONFIG_FILE); \
30+
echo "✓ Config installed → $(CONFIG_FILE)"; \
31+
echo " Edit the file to add your API key, or set IPGEOLOCATION_API_KEY."; \
32+
fi
33+
34+
## Full setup: dependencies + binary + config in one step
35+
setup:
36+
@echo "→ Fetching Go dependencies..."
37+
go mod tidy
38+
@echo "→ Building plugin..."
39+
@$(MAKE) install
40+
@echo "→ Installing config..."
41+
@$(MAKE) install-config
42+
@echo ""
43+
@echo "Done! Next steps:"
44+
@echo " 1. Edit ~/.steampipe/config/ipgeolocation.spc (or set IPGEOLOCATION_API_KEY)"
45+
@echo " 2. steampipe service restart"
46+
@echo " 3. steampipe query \"select * from ipgeolocation_ip where ip = '8.8.8.8'\""
47+
48+
## Format all Go source files
49+
fmt:
50+
gofmt -w .
51+
52+
## Lint (requires golangci-lint)
53+
lint:
54+
golangci-lint run ./...
55+
56+
## Run tests
57+
test:
58+
go test ./...
59+
60+
## Remove built binary
61+
clean:
62+
@rm -f $(PLUGIN_NAME)
63+
@echo "✓ Cleaned"

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Steampipe Plugin — IPGeolocation.io
2+
3+
Query IP geolocation, network, security, timezone, company, abuse, and hostname data using SQL via the [IPGeolocation.io](https://ipgeolocation.io) v3 API.
4+
5+
## Quick Start
6+
7+
### 1. Install the plugin
8+
9+
```sh
10+
steampipe plugin install ipgeolocation
11+
```
12+
13+
### 2. Configure credentials
14+
15+
```sh
16+
cp config/ipgeolocation.spc ~/.steampipe/config/ipgeolocation.spc
17+
# edit the file and set your api_key
18+
```
19+
20+
### 3. Query away
21+
22+
```sql
23+
-- Where is 8.8.8.8?
24+
select ip, country_name, city, isp
25+
from ipgeolocation_ip
26+
where ip = '8.8.8.8';
27+
28+
-- Is it a VPN/proxy/Tor?
29+
select ip, is_vpn, is_proxy, is_tor, threat_score
30+
from ipgeolocation_ip
31+
where ip = '185.220.101.45';
32+
```
33+
34+
## Requirements
35+
36+
| Requirement | Version |
37+
|---|---|
38+
| Steampipe | ≥ 0.20 |
39+
| Steampipe Plugin SDK | v5 |
40+
| Go | ≥ 1.21 |
41+
42+
## Building from Source
43+
44+
```sh
45+
git clone https://github.com/turbot/steampipe-plugin-ipgeolocation
46+
cd steampipe-plugin-ipgeolocation
47+
make
48+
```
49+
50+
## Configuration Reference
51+
52+
```hcl
53+
connection "ipgeolocation" {
54+
plugin = "ipgeolocation"
55+
56+
# Required for most modules. Free tier covers basic location data.
57+
# Sign up at https://app.ipgeolocation.io/
58+
api_key = "YOUR_API_KEY_HERE"
59+
}
60+
```
61+
62+
## Tables
63+
64+
| Table | Description |
65+
|---|---|
66+
| [ipgeolocation_ip](docs/tables/ipgeolocation_ip.md) | Geolocation data for a given IP address or domain |
67+
68+
## API Plan Notes
69+
70+
| Module | Free | Paid |
71+
|---|---|---|
72+
| Location (country, city, lat/lon) |||
73+
| Timezone |||
74+
| Network / ASN |||
75+
| Hostname |||
76+
| Security (VPN, proxy, threat score) |||
77+
| Company |||
78+
| Abuse contact |||
79+
80+
Free-plan columns will return `null` when the field is not available on your subscription tier.

config/ipgeolocation.spc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
connection "ipgeolocation" {
2+
plugin = "local/ipgeolocation"
3+
4+
# API key from https://app.ipgeolocation.io/dashboard
5+
# Free tier works without a key for basic geolocation.
6+
# Paid plans unlock hostname, security, company, abuse, and user-agent modules.
7+
# Can also be set with the IPGEOLOCATION_API_KEY environment variable.
8+
api_key = "a3fbecf6536a470b8d3426419f21ae99"
9+
}

0 commit comments

Comments
 (0)