Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
= Peddler
Peddler is a Ruby wrapper to the Amazon Inventory management API.
== Example usage
Fire off a client:
client = Peddler::Client.new( :username => "foo@bar.com", :password => "secret", :region => "us")
Create an inventory file:
batch = client.new_inventory_batch item = client.new_inventory_item( :product_id => "1234567890", :price => 100.00, :sku => "SKU-123", :quantity => 10) batch << item ...
Repeat ad infinitum and upload:
batch.upload
The batch now should have an upload ID. Go ahead and check the error log:
upload_log = client.new_report( :upload, :id => batch.id) upload_log.body => "Feed Processing Summary:\n\tNumber of records processed\t\t1\n\tNumber of records successful\t\t1\n\n"
You're done listing and are wondering if you have any new orders:
orders_report = client.new_report :order orders = client.detab(orders_report.body) p orders.size => 1500 p orders[0].item_name => "A Thousand Plateaus: Capitalism and Schizophrenia (Paperback) by Gilles Deleuze"
Now that you have diligently processed the orders, post back the results to Amazon:
feed = client.new_order_fulfillment_feed fulfilled_order = client.new_fulfilled_order( :order_id => "123-1234567-1234567", :order_date => "2009-08-01", :carrier_code => "USPS", :tracking_number => "0308 0330 0000 0000 0000") feed << fulfilled_order
Again, repeat until done and upload:
feed.upload
Curious to see the processing report?
p feed.status => "SUBMITTED"
Refresh until you get:
p feed.status! => "DONE"
Finally, check the report:
p feed.download.to_s => ...
Sadly, you also have an order you can't fulfill. No problem. The workflow is similar:
feed = client.new_order_cancellation_feed
cancelled_order = client.new_cancelled_order(
:order_id => "123-1234567-1234567",
:cancellation_reason_code => "NoInventory",
:amazon_order_item_code => "12341234567890")
feed << cancelled_order
feed.upload
sleep(60)
feed.status!
=> "DONE"
p feed.download.to_s
=> ...
Need to post a partial refund? You'll have to revert to the older batch refund API method:
refunds = client.new_refund_batch refund = client.new_refund( :order_id => "123-1234567-1234567", :payments_transaction_id => "12341234567890", :refund_amount => 1.00, :reason => "GeneralAdjustment", :message => "With our apologies.") refunds << refund refunds.upload
Great sales. For a change, let's download something different from Amazon. Here's a preorder report:
preorder_report = client.new_report( :preorder, :product_line => "Books", :frequency => 2) preorders = client.detab(preorder_report.body) p preorders.size => 2000 p preorders[0].asin => "1234567890" p preorders[0].average_asking_price => "100"
Run rdoc and check the source for more detailed info.
Copyright © 2009 Hakan Senol Ensari, released under the MIT license
FAQs
Unknown package
We found that snl-peddler 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.