Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file lib/dhcp_parser
. To experiment with that code, run bin/console
for an interactive prompt.
TODO: Delete this and the text above, and describe your gem
Add this line to your application's Gemfile:
gem 'dhcp_parser'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dhcp_parser
subnet 192.168.1.0 netmask 255.255.255.0 {
# config file
# config file
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option domain-name-servers 194.168.4.100;
option ntp-servers 192.168.1.1;
option netbios-name-servers 192.168.1.1;
option netbios-node-type 2;
default-lease-time 86400;
max-lease-time 86400;
authoritative;
# config file
# config file
pool {
# config file
range 192.168.25.20 192.168.25.200;
allow unknown-clients;
host bla1 {
# comment .......
hardware ethernet DD:GH:DF:E5:F7:D7;
fixed-address 192.168.1.2;
}
host bla2 {
# comment .......
hardware ethernet 00:JJ:YU:38:AC:45;
fixed-address 192.168.1.20;
}
}
}
subnet 10.152.187.0 netmask 255.255.255.0 {
option routers 10.152.187.1;
option subnet-mask 255.255.255.0;
option broadcast-address 10.150.168.255;
option domain-name-servers 192.168.4.101;
option ntp-servers 10.152.187.10;
option netbios-name-servers 10.152.187.12;
option netbios-node-type 2;
default-lease-time 86400;
max-lease-time 86400;
pool {
range 192.168.25.20 192.168.25.30;
denny unknown-clients;
host bla3 {
hardware ethernet 00:KK:HD:66:55:9B;
fixed-address 10.152.187.2;
}
}
}
dhcp = DHCPParser::Conf.new(path)
dhcp.subnets
#Result
=> ["192.168.1.0", "10.152.187.0"]
dhcp.netmasks
#Result
=> ["255.255.255.0"]
dhcp.pools
#Result
=> [{"1"=>
{"host"=>"bla1",
"hardware_ethernet"=>"DD:GH:DF:E5:F7:D7",
"fixed-address"=>"192.168.1.2"},
"2"=>
{"host"=>"bla2",
"hardware_ethernet"=>"00:JJ:YU:38:AC:45",
"fixed-address"=>"192.168.1.20"}},
{"1"=>
{"host"=>"bla3",
"hardware_ethernet"=>"00:KK:HD:66:55:9B",
"fixed-address"=>"10.152.187.2"}}]
dhcp.options
=> [{"routers"=>"192.168.1.1",
"subnet-mask"=>"255.255.255.0",
"broadcast-address"=>"192.168.1.255",
"domain-name-servers"=>"194.168.4.100",
"ntp-servers"=>"192.168.1.1",
"netbios-name-servers"=>"192.168.1.1",
"netbios-node-type"=>"2",
"default-lease-time"=>"86400",
"max-lease-time"=>"86400",
"authoritative"=>true},
{"routers"=>"10.152.187.1",
"subnet-mask"=>"255.255.255.0",
"broadcast-address"=>"10.150.168.255",
"domain-name-servers"=>"192.168.4.101",
"ntp-servers"=>"10.152.187.10",
"netbios-name-servers"=>"10.152.187.12",
"netbios-node-type"=>"2",
"default-lease-time"=>"86400",
"max-lease-time"=>"86400"}]
dhcp.ranges
#Result
=> ["192.168.25.20 192.168.25.200", "192.168.25.20 192.168.25.30"]
dhcp.allow
#Result
=> ["unknown-clients"]
dhcp.denny
#Result
=> ["unknown-clients"]
array_net = dhcp.net
# Result
array_net[0]
=> [#<Net:0xb98d1594
@differ=
{"default-lease-time"=>"60400",
"max-lease-time"=>"60400",
"authoritative"=>true},
@netmask="255.255.255.0",
@option=
{"routers"=>"192.168.1.1",
"subnet-mask"=>"255.255.255.0",
"broadcast-address"=>"192.168.1.255",
"domain-name-servers"=>"194.168.4.100",
"ntp-servers"=>"192.168.1.1",
"netbios-name-servers"=>"192.168.1.1"},
@pool=
{"range"=>{"min"=>"192.168.25.20", "max"=>"192.168.25.200"},
"allow"=>"unknown-clients",
"denny"=>nil,
"hosts"=>
[#<Host:0xb98d8a24
@fix_address="192.168.1.2",
@hardware_ethernet="DD:GH:DF:E5:F7:D7",
@host="bla1">,
#<Host:0xb98d88a8
#
# Create object
net1 = Net.new
net2 = Net.new
# the object's attribute list
subnet = ""
netmask = ""
option = {}
differ = {}
pool = { "range" => "",
"allow" => "",
"denny" => "",
"hosts" => []
}
# Set attributes:
net1.attribute
net2.attribute
Create object net, then set attribute for object. Then call method write_file in module WriteConf with param: "path/file_name", "array_net","condition: true/false". If the condition is true, you will append new net into file. If the condition is false, you will write the new file .
array_net = dhcp.net
result = dhcp.write_file_conf(path/file_name.type, array_net, condition)
# Success
=> true
# Fail
=> false
# Convert to XML
array_net = dhcp.net
xml = dhcp.to_xml(array_net)
# Write file
result = dhcp.write_file_xml(path/filename.type, xml)
# Success
=> true
# Fail
=> false
After checking out the repo, run bin/setup
to install dependencies. Then, run rake false
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/hoanganhhanoi/dhcp_parser.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that dhcp_parser demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.