
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Dump http request use WebMock.
Supported HTTP libraries = WebMock supported liraries, Net::HTTP, HTTPParty, HTTPClient, Excon, more...
$ gem install http-dump
require 'net/http'
require 'uri'
require 'http-dump'
HTTPDump.dump {
Net::HTTP.get(URI('http://example.com'))
}
> GET http://example.com/ with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'example.com', 'User-Agent'=>'Ruby'}
< 200 OK
< Accept-Ranges: bytes
< Cache-Control: max-age=604800
< Content-Type: text/html
< Date: Fri, 03 Jan 2014 13:42:51 GMT
< Etag: "359670651"
< Expires: Fri, 10 Jan 2014 13:42:51 GMT
< Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT
< Server: ECS (sjc/4FB4)
< X-Cache: HIT
< X-Ec-Custom-Error: 1
< Content-Length: 1270
<
<!doctype html>
<html>
<head>
<title>Example Domain</title>
... more ...
require 'open-uri'
require 'http-dump'
HTTPDump.enable!
open('http://example.com').read
HTTPDump.disable!
> GET http://example.com/ with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'example.com', 'User-Agent'=>'Ruby'}
< 200 OK
... more ...
HTTPDump.quiet_format = true
HTTPDump.dump {
Net::HTTP.get(URI('http://example.com'))
}
> GET http://example.com/ with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'example.com', 'User-Agent'=>'Ruby'}
< 200 OK
< Accept-Ranges: bytes
< Cache-Control: max-age=604800
< Content-Type: text/html
< Date: Fri, 03 Jan 2014 14:06:43 GMT
< Etag: "359670651"
< Expires: Fri, 10 Jan 2014 14:06:43 GMT
< Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT
< Server: ECS (sjc/4FB4)
< X-Cache: HIT
< X-Ec-Custom-Error: 1
< Content-Length: 1270
<
<!doctype html>
* ... Response body is 1270 bytes.
</html>
HTTPDump.output #=> #<IO:<STDOUT>> (default output)
HTTPDump.output = STDERR
HTTPDump.dump {
Net::HTTP.get(URI('http://example.com')) # dump to STDERR
}
require 'logger'
logger = Logger.new(STDOUT)
logger.instance_eval { class << self; alias_method :puts, :info; end }
HTTPDump.output = logger
HTTPDump.dump {
Net::HTTP.get(URI('http://example.com')) # dump to logger
}
In some cases, encoding of request and response is not matched and it causes Encoding::CompatibilityError
.
HTTPDump.output_encoding=
may resolve the issue.
HTTPDump.output_encoding = "utf-8"
$ ruby -r'net/http' -r'uri' -r'http-dump/enable' -e 'Net::HTTP.get(URI("http://example.com/"))'
> GET http://example.com/ with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'example.com', 'User-Agent'=>'Ruby'}
< 200 OK
...
# in Gemfile
group :development do
gem 'http-dump', require: ENV['HTTP_DUMP_ENABLE'] ? 'http-dump/enable' : 'http-dump'
end
HTTP_DUMP_ENABLE=1 bundle exec rails s
Add this line to your application's Gemfile:
gem 'http-dump'
And then execute:
$ bundle
Or install it yourself as:
$ gem install http-dump
FAQs
Unknown package
We found that http-dump 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
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.