
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
obd-raw-data-parser
Advanced tools
A React Native hook library to manage Bluetooth Low Energy connections and communication with ELM327 OBD-II adapters.
World's Only Stable Open-Source Solution for Raw OBD-II Data Decoding
Turn cryptic OBD-II data into human-readable vehicle information
If you find this library useful, please consider giving it a star on GitHub! Your star helps:
The only fully stable open-source solution for raw OBD-II data parsing with:
If you find this library useful, please consider giving it a star on GitHub! Your star helps:
npm install obd-raw-data-parser
If you find this library useful, please consider giving it a star on GitHub! Your star helps:
import { parseOBDResponse } from "obd-raw-data-parser";
// Parse vehicle speed (50 km/h)
const speed = parseOBDResponse("41 0D 32");
console.log(speed);
// { mode: '41', pid: '0D', name: 'vss', unit: 'km/h', value: 50 }
// Parse engine RPM (1726 RPM)
const rpm = parseOBDResponse("41 0C 1A F8");
console.log(rpm);
// { mode: '41', pid: '0C', name: 'rpm', unit: 'rev/min', value: 1726 }
import { getPIDInfo } from "obd-raw-data-parser";
const pidInfo = getPIDInfo("0C");
console.log(pidInfo);
/* Output:
{
mode: '01',
pid: '0C',
name: 'rpm',
description: 'Engine RPM',
min: 0,
max: 16383.75,
unit: 'rev/min',
bytes: 2
}
*/
import { VinDecoder } from "obd-raw-data-parser";
// Process segmented VIN response (common format)
const segmentedResponse = '014\r0:49020157304C\r1:4A443745433247\r2:42353839323737\r\r>';
const vin1 = VinDecoder.processVINResponse(segmentedResponse);
console.log(vin1); // 'W0LJD7EC2GB589277'
// Process non-segmented hex format
const hexResponse = '49020157304C4A443745433247423538393237373E';
const vin2 = VinDecoder.processVINSegments(hexResponse);
console.log(vin2); // 'W0LJD7EC2GB589277'
// Process VIN from byte array format
const byteArrayResponse = [
[48,49,52,13,48,58,52,57,48,50,48,49,53,55,51,48,52,67,13],
[49,58,52,65,52,52,51,55,52,53,52,51,51,50,52,55,13],
[50,58,52,50,51,53,51,56,51,57,51,50,51,55,51,55,13],
[13,62]
];
const vin3 = VinDecoder.processVINByteArray(byteArrayResponse);
console.log(vin3); // 'W0LJD7EC2GB589277'
// Validate if response contains VIN data
console.log(VinDecoder.isVinData('0902')); // true
console.log(VinDecoder.isVinData('490201')); // true
// Validate a VIN string
console.log(VinDecoder.validateVIN('W0LJD7EC2GB589277')); // true
console.log(VinDecoder.validateVIN('INVALID-VIN')); // false
The VIN decoder supports multiple raw data formats:
All decoding methods include built-in validation and error handling, returning null for invalid inputs.
import { DTCBaseDecoder } from "obd-raw-data-parser";
// Create a decoder instance for CAN protocol
const canDecoder = new DTCBaseDecoder({
isCan: true, // Use CAN protocol
serviceMode: "03", // Mode 03 for current DTCs
troubleCodeType: "CURRENT", // Type of DTCs being decoded
logPrefix: "MyApp", // Optional prefix for logs
});
// Example: Decoding current DTCs from CAN response
const rawBytes = [[0x43, 0x02, 0x01, 0x43, 0x01, 0x96, 0x02, 0x34]];
const dtcs = canDecoder.decodeDTCs(rawBytes);
console.log(dtcs); // ['P0143', 'P0196', 'P0234']
// Create a decoder for non-CAN protocol and pending DTCs
const nonCanDecoder = new DTCBaseDecoder({
isCan: false,
serviceMode: "07", // Mode 07 for pending DTCs
troubleCodeType: "PENDING",
logPrefix: "MyApp",
});
// Parse DTC status byte
const status = canDecoder.parseDTCStatus(0x8c);
console.log(status);
/* Output:
{
milActive: true, // Malfunction Indicator Lamp status
dtcCount: 12, // Number of DTCs
currentError: false,
pendingError: false,
confirmedError: true,
egrSystem: true,
oxygenSensor: false,
catalyst: false
}
*/
03: Current DTCs07: Pending DTCs0A: Permanent DTCsimport { parseOBDResponse } from "obd-raw-data-parser";
// Create a real-time dashboard
class VehicleDashboard {
update(rawData: string) {
const data = parseOBDResponse(rawData);
switch (data.pid) {
case "0C": // RPM
this.updateTachometer(data.value);
break;
case "0D": // Speed
this.updateSpeedometer(data.value);
break;
// ... handle other parameters
}
}
}
Current test coverage report:
| File | % Stmts | % Branch | % Funcs | % Lines |
|---|---|---|---|---|
| All files | 86.44 | 76.67 | 73.58 | 86.44 |
| index.ts | 81.25 | 78.95 | 100 | 81.25 |
| obdInfo.ts | 86.11 | 57.14 | 68.89 | 86.11 |
| obdPIDS.ts | 100 | 100 | 100 | 100 |
| obdTypes.ts | 100 | 100 | 100 | 100 |
| obdUtils.ts | 100 | 100 | 100 | 100 |
Detailed metrics:
Generated on: Feb 15, 2024
Contributions are welcome! Here's how you can help:
git checkout -b feature/amazinggit commit -am 'feat: add amazing feature'git push origin feature/amazing🛠️ Prerequisites
node >= 14.0.0
npm >= 6.0.0
🔧 Setup Project
git clone https://github.com/rakshitbharat/obd-raw-data-parser.git
cd obd-raw-data-parser
npm install
🧪 Run Tests
npm test
npm run test:coverage
📝 Documentation
🚗 Vehicle Support
💡 Feature Requests
🐛 Bug Reports
Together, we can make vehicle diagnostics more accessible to everyone! 🚀
This library would not have been possible without the excellent work done by obd-utils. A huge thank you to @Nishkalkashyap for creating the original implementation that inspired this library.
The OBD-II PID definitions, conversion algorithms, and core parsing logic are based on their excellent work. We've built upon their foundation to create a TypeScript-first, fully tested implementation with additional features and improvements.
If you're interested in OBD-II development, we highly recommend checking out their original work.
MIT © Rakshit Bharat
flowchart TD
A[Raw OBD-II Input] --> B{Special Response?}
B -->|NO DATA/ERROR| C[Return Raw Value]
B -->|Valid Hex| D[Remove Spaces & Split Bytes]
D --> E{Determine Mode}
E -->|Mode 01-0C| F[Lookup PID Configuration]
E -->|Mode 03 DTC| G[Init DTC Decoder]
F --> H{Conversion Required?}
H -->|Yes| I[Apply Conversion Formula]
H -->|No| J[Return Raw Bytes]
I --> K[Validate Output]
G --> L[Decode CAN/Non-CAN Frame]
L --> M[Extract DTC Codes]
K --> N[Format Measurement]
M --> O[Format DTC List]
N --> P[Structured Output]
O --> P
J --> P
C --> P
style A fill:#4CAF50,stroke:#388E3C
style P fill:#2196F3,stroke:#0D47A1
style G fill:#FF9800,stroke:#EF6C00
style L fill:#FF9800,stroke:#EF6C00
FAQs
A React Native hook library to manage Bluetooth Low Energy connections and communication with ELM327 OBD-II adapters.
The npm package obd-raw-data-parser receives a total of 1 weekly downloads. As such, obd-raw-data-parser popularity was classified as not popular.
We found that obd-raw-data-parser demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.