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.
A TypeScript service to interact with the SearXNG search engine API, enabling customizable searches and result retrieval.
A TypeScript service to interact with the SearXNG search engine API. This service allows you to perform searches and retrieve results in various formats with customizable parameters.
npm install searxng
First, import and instantiate the SearxngService
with your configuration:
import { SearxngService, type SearxngServiceConfig } from 'searxng';
const config: SearxngServiceConfig = {
baseURL: 'https://your-searxng-instance.com',
defaultSearchParams: {
format: 'json',
lang: 'auto',
},
defaultRequestHeaders: {
'Content-Type': 'application/json',
},
};
const searxngService = new SearxngService(config);
export type SearxngCategory =
| 'general'
| 'translate'
| 'web'
| 'wikimedia'
| 'images'
| 'videos'
| 'news'
| 'map'
| 'music'
| 'lyrics'
| 'radio'
| 'it'
| 'packages'
| 'q&a'
| 'repos'
| 'software_wikis'
| 'science'
| 'scientific_publications'
| 'wikimedia'
| 'files'
| 'apps'
| 'social_media';
export type SearxngEngine =
| '1337x'
| '9gag'
// Other engines here
| 'zlibrary';
export type SearxngLocale =
| 'af'
| 'ar'
| 'bg'
// Other locales here
| 'zh-Hant-TW';
export type SearxngPlugin =
| 'Hash_plugin'
| 'Self_Information'
// Other plugins here
| 'Tor_check_plugin';
export interface SearxngSearchParameters {
categories?: SearxngCategory[];
engines?: SearxngEngine[];
lang?: 'auto' | SearxngLocale;
pageno?: number;
time_range?: 'day' | 'month' | 'year';
format?: 'json' | 'csv' | 'rss';
results_on_new_tab?: 0 | 1;
image_proxy?: boolean;
autocomplete?: 'google' | 'dbpedia' | 'duckduckgo' | 'mwmbl' | 'startpage' | 'wikipedia' | 'stract' | 'swisscows' | 'qwant';
safesearch?: 0 | 1 | 2;
theme?: 'simple';
enabled_plugins?: SearxngPlugin[];
disabled_plugins?: SearxngPlugin[];
enabled_engines?: SearxngEngine[];
disabled_engines?: SearxngEngine[];
}
export interface SearxngSearchResult {
url: string;
title: string;
content?: string;
engine: SearxngEngine;
parsed_url: string[];
template: 'default.html' | 'videos.html' | 'images.html';
engines: SearxngEngine[];
positions: number[];
publishedDate?: Date | null;
thumbnail?: null | string;
is_onion?: boolean;
score: number;
category: SearxngCategory;
length?: null | string;
duration?: null | string;
iframe_src?: string;
source?: string;
metadata?: string;
resolution?: null | string;
img_src?: string;
thumbnail_src?: string;
img_format?: 'jpeg' | 'Culture Snaxx' | 'png';
}
export interface SearxngSearchResults {
query: string;
number_of_results: number;
results: SearxngSearchResult[];
answers: string[];
corrections: string[];
infoboxes: Array<{
infobox: string;
content: string;
engine: string;
engines: string[];
}>;
suggestions: string[];
unresponsive_engines: string[];
}
export interface SearxngServiceConfig {
baseURL: string;
defaultSearchParams?: Partial<SearxngSearchParameters>;
defaultRequestHeaders?: Record<string, string>;
}
Perform a search with the given input query and optional parameters.
async search(
input: string,
params?: Partial<SearxngSearchParameters>,
): Promise<SearxngSearchResults>
input
(string): The search query string.params
(Partial, optional): Optional additional query parameters.Returns a promise that resolves to SearxngSearchResults
.
import { SearxngService, type SearxngServiceConfig } from 'searxng';
const config: SearxngServiceConfig = {
baseURL: 'https://your-searxng-instance.com',
defaultSearchParams: {
format: 'json',
lang: 'auto',
},
defaultRequestHeaders: {
'Content-Type': 'application/json',
},
};
const searxngService = new SearxngService(config);
async function performSearch() {
try {
const results = await searxngService.search('example query');
console.log(results);
} catch (error) {
console.error('Search failed:', error);
}
}
performSearch();
import { SearxngService, type SearxngServiceConfig } from 'searxng';
const config: SearxngServiceConfig = {
baseURL: 'https://your-searxng-instance.com'
};
const searxngService = new SearxngService(config);
async function performSearchWithParams() {
const searchParams = {
categories: ['general', 'web'],
engines: ['google', 'bing'],
lang: 'en',
pageno: 2,
time_range: 'month',
format: 'json',
};
try {
const results = await searxngService.search('example query', searchParams);
console.log(results);
} catch (error) {
console.error('Search failed:', error);
}
}
performSearchWithParams();
FAQs
A TypeScript service to interact with the SearXNG search engine API, enabling customizable searches and result retrieval.
We found that searxng demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.