Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
augnitorecorder
Advanced tools
Contents
The rationale behind an async implementation of the JS voice client is to decouple the following sets of tasks...
...such that each of the above run independently in their own thread insulated from each other and communicate via message passing.
The async JS client is composed of the following components, each portraying well-defined and exclusive roles.
Streamer is the entrypoint of the async JS client. It's role is two-fold:
When a new dictation session is started by the end-user, following steps are executed:
When a dictation session is stopped by the end-user, following steps are executed:
NOTE: Audio source in the existing implementation is in the form of a recorded audio played in a loop. To support audio generation through a microphone, please uncomment pertinent code in Streamer.
Worklet is employed mainly for audio processing, employing AudioWorklets. In this context, it can be used to resample the incoming audio stream before sending the same to the server. It also keeps the processed audio packets buffered for a short period of time before sending it back to the Streamer to decrease overhead of message passing between OS-level threads running itself and the Streamer.
This component deals with the following tasks:
Executor manages a websocket connection with the server in a Web Worker. Audio packets received from the Streamer are buffered in a read-queue to be sent over to the server. It houses 3 daemons running periodically:
This can be employed when a new dictation session begins by the user with an intent of creating a clinical document.
const recorderInstance = new AugnitoRecorder(
{
serverURL: WS_URL,
enableLogs: false,
isDebug: false,
bufferInterval: 1,
EOS_Message: "EOS",
socketTimeoutInterval: 10000,
},
heavyOp
);
recorderInstance.toggleStartStopAudioStream(); //if you want to start/stop audio on button click
or;
recorderInstance.togglePauseResumeAudioStream(); //if you want to pause/resume audio on button click
WS_URL
is the server websocket endpoint to which the client connects to, to stream audio.heavyOp
is a CPU-intensive operation which is run on the received ASR before displaying it on the editor. A dummy example is as follows:enableLogs
is set to true if you want to see logs in console else set to falseisDebug
is set to true if you want to save recorded audio to a file else set to falsebufferInterval
is set to any non negative integer, indicates the buffer size interval in seconds, default value is 1 secEOS_Message
is set to any string that indicates EOS or can be undefined, default value is EOSsocketTimeoutInterval
is set to any socket timeout interval as desired, default value is 10000const heavyOp = (text) => {
let num = -1;
let iters = 0;
let sum = 0;
for (let i = 0; i < text.length; i++) {
sum += text.charCodeAt(i);
}
console.debug(`Running Heavy Operation for "${text}" with sum: ${sum}`);
while (num != sum) {
num = Math.floor(Math.random() * 100000);
iters++;
}
console.log(`Iterations completed for sum(${sum}): ${iters}`);
return text;
};
This can be employed when the user pauses and resumes the dictation session emulating a toggle of the microphone button.
recorderInstance.pauseAudio();
/*
Do something interesting here...
*/
recorderInstance.resumeAudio();
This can be employed when the user has completed their dictation session after finishing off compiling the medical document.
recorderInstance.stopAudio();
These callbacks can be employed to read socket connection state change event, session event, speech text output event or any other error event from the library.
recorderInstance.onStateChanged = (connected) => {
//connected is true when socket is opened and false when socket is closed
};
recorderInstance.onSessionEvent = (response) => {
//handle all meta events
};
recorderInstance.onError = (error) => {
//handle any error message
};
recorderIns.onPartialResult = (text) => {
// hypothesis text output generated as the user speaks
};
recorderInstance.onFinalResult = (textResponse) => {
//text reponse can be parsed to read the speech output json
};
Below steps to compile library and the output is generated in dist folder
cd AugnitoRecorderJS
npm run build
cd AugnitoRecorderJS
python3 -m http.server
Once done, fire up the webpage at: http://localhost:8000. The webpage has following controls for speech:
FAQs
Audio recorder and streamer compatible with any browser
The npm package augnitorecorder receives a total of 1,803 weekly downloads. As such, augnitorecorder popularity was classified as popular.
We found that augnitorecorder 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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.