
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
github.com/m0uka/golang-pdf-invoice-generator
This repository is a modified version of the original invoice, featuring extended functionality and support for use as a Go module.
To install the module, use:
go get github.com/m0uka/golang-pdf-invoice-generator
Import it in your Go project:
import "github.com/m0uka/golang-pdf-invoice-generator/invoicepdf"
Here is a basic example of how to generate an invoice:
package main
import (
"log"
"github.com/m0uka/golang-pdf-invoice-generator/invoicepdf"
"os"
"bytes"
)
func main() {
invoice := invoicepdf.Invoice{
Id: "12345",
Number: "INV-1001",
Title: "Invoice Title",
LogoUrl: "http://example.com/logo.png",
From: invoicepdf.InvoiceCompany{
Name: "Your Company Name",
AddressLine1: "Your Company Address Line 1",
AddressLine2: "Your Company Address Line 2",
City: "Your City",
Country: "Your Country",
State: "Your State",
PostalCode: "123456",
TaxID: "TAX123456",
Email: "info@yourcompany.com",
Website: "https://yourcompany.com",
},
To: invoicepdf.InvoiceCompany{
Name: "Customer Name",
AddressLine1: "Customer Address Line 1",
AddressLine2: "Customer Address Line 2",
City: "Customer City",
Country: "Customer Country",
State: "Customer State",
PostalCode: "654321",
TaxID: "CUST123456",
Email: "customer@example.com",
Website: "https://customerwebsite.com",
},
Date: "2024-07-11",
Due: "2024-07-25",
Items: []string{"Product 1", "Product 2"},
Quantities: []int{2, 1},
Rates: []float64{50.0, 75.0},
Tax: 10.0,
Discount: 5.0,
Currency: "USD",
Note: "Thank you for your business.",
HeaderNote: "Invoice Header Note",
}
buffer, err := invoicepdf.GenerateInvoice(&invoice)
if err != nil {
log.Fatalf("Could not generate invoice: %v", err)
}
// Save buffer to file or handle it as needed
err = saveBufferToFile(buffer, "invoice.pdf")
if err != nil {
log.Fatalf("Could not save invoice: %v", err)
}
}
func saveBufferToFile(buffer *bytes.Buffer, filename string) error {
return os.WriteFile(filename, buffer.Bytes(), 0644)
}
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
Unknown package
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
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.