Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
This is IP2Location Ruby on Rails library that enables the user to find the country, region or state, district, city, latitude and longitude, ZIP/Postal code, time zone, Internet Service Provider (ISP) or company name, domain name, net speed, area code, weather station code, weather station name, mobile country code (MCC), mobile network code (MNC) and carrier brand, elevation, usage type, address type, IAB category and ASN from IP address using IP2Location database. The library reads the geo location information from IP2Location BIN data file.
Supported IPv4 and IPv6 address.
gem 'ip2location_ruby'
gem 'ip2location_rails'
$ bundle install
config/environments
directory. Add the following code to the chosen configuration file after the Rails.application.configure do
line.config.ip2location_db_path = Rails.root.join('lib', 'assets', 'ip2location_rails', 'IP2LOCATION.BIN').to_s
ip2location_rails
in the lib/assets
directory.lib/assets/ip2location_rails
folder.bin/rails generate controller Test index --skip-routes
require 'ip2location_rails'
class TestController < ApplicationController
def index
location_service = Ip2locationRails.new('8.8.8.8')
@country_code = location_service.country_code
@country_name = location_service.country_name
@region = location_service.region
@city = location_service.city
@latitude = location_service.latitude
@longitude = location_service.longitude
@isp = location_service.isp
@domain = location_service.domain
@netspeed = location_service.netspeed
@area_code = location_service.areacode
@idd_code = location_service.iddcode
@time_zone = location_service.timezone
@zip_code = location_service.zipcode
@weather_station_name = location_service.weatherstationname
@weather_station_code = location_service.weatherstationcode
@mcc= location_service.mcc
@mnc = location_service.mnc
@mobile_brand = location_service.mobilebrand
@elevation = location_service.elevation
@usage_type = location_service.usagetype
@address_type = location_service.addresstype
@category = location_service.category
@district = location_service.district
@asn = location_service.asn
@as = location_service.as
end
end
<p>Country Code: <%= @country_code %></p>
<p>Country Name: <%= @country_name %></p>
<p>Region Name: <%= @region %></p>
<p>City Name: <%= @city %></p>
<p>Latitude: <%= @latitude %></p>
<p>Longitude: <%= @longitude %></p>
<p>ISP Name: <%= @isp %></p>
<p>Domain Name: <%= @domain %></p>
<p>Net Speed: <%= @netspeed %></p>
<p>Area Code: <%= @area_code %></p>
<p>IDD Code: <%= @idd_code %></p>
<p>Time Zone: <%= @time_zone %></p>
<p>ZIP Code: <%= @zip_code %></p>
<p>Weather Station Code: <%= @weather_station_name %></p>
<p>Weather Station Name: <%= @weather_station_code %></p>
<p>MCC: <%= @mcc %></p>
<p>MNC: <%= @mnc %></p>
<p>Mobile Carrier: <%= @mobile_brand %></p>
<p>Elevation: <%= @elevation %></p>
<p>Usage Type: <%= @usage_type %></p>
<p>Address Type: <%= @address_type %></p>
<p>Category: <%= @category %></p>
<p>District: <%= @district %></p>
<p>ASN: <%= @asn %></p>
<p>AS: <%= @as %></p>
Rails.application.routes.draw do
line.get "/test", to: "test#index"
$ bin/rails server
This library requires IP2Location BIN data file to function. You may download the BIN data file at
Email: support@ip2location.com URL: https://www.ip2location.com
FAQs
Unknown package
We found that ip2location_rails demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.