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.
com.github.codesorcery:juan
Advanced tools
A fast, thread-safe and dependency-free user agent parser for Java 8+.
Simply add the library to the dependency section of your pom.xml (if you're using Maven):
<dependency>
<groupId>com.github.codesorcery</groupId>
<artifactId>juan</artifactId>
<version>0.1.1</version>
</dependency>
Or add it to your build.gradle (if you're using Gradle):
dependencies {
compile('com.github.codesorcery:juan:0.1.1')
}
The library can then be used as follows:
import com.github.codesorcery.juan.UserAgentParser;
import com.github.codesorcery.juan.ParsedUserAgent;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.Charset;
public class UserAgentParserExample {
private final UserAgentParser userAgentParser;
public UserAgentParserExample() throws IOException {
// To detect the device name and vendor for Android devices, we use Google's device list:
URL deviceList =
new URL("http://storage.googleapis.com/play_public/supported_devices.csv");
userAgentParser =
UserAgentParser.withPlayStoreDeviceList(deviceList, Charset.forName("UTF-16"));
// If you do not need Android device info, you can use the parser without the device list:
// userAgentParser = UserAgentParser.withoutPlayStoreDeviceList();
}
public void parsingExample() {
String userAgentString =
"Mozilla/5.0 (Linux; Android 7.0; SM-G892A Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/60.0.3112.107 Mobile Safari/537.36";
ParsedUserAgent parsed =
userAgentParser.parse(userAgentString);
parsed.agent().getVendor(); // => Google
parsed.agent().getName(); // => Chrome Mobile
parsed.agent().getVersion(); // => 60.0.3112.107
parsed.agent().getType(); // => Browser (mobile)
parsed.os().getVendor(); // => Google
parsed.os().getName(); // => Android
parsed.os().getVersion(); // => 7.0
parsed.os().getType(); // => Mobile
parsed.device().getVendor(); // => Samsung
parsed.device().getName(); // => Galaxy S8 Active
}
}
Benchmark performed on an Intel® Core™ 2 Duo P8600 CPU @ 2.4GHz:
Benchmark | Mode | Cnt | Score | Error | Units |
---|---|---|---|---|---|
UserAgentParserBenchmark.amazonKindleFireSilkBrowser | avgt | 5 | 4.641 | ± 0.136 | us/op |
UserAgentParserBenchmark.curl | avgt | 5 | 1.699 | ± 0.069 | us/op |
UserAgentParserBenchmark.iPadMobileSafari | avgt | 5 | 6.370 | ± 0.266 | us/op |
UserAgentParserBenchmark.iPhoneInstagram | avgt | 5 | 5.257 | ± 1.164 | us/op |
UserAgentParserBenchmark.linuxFirefox | avgt | 5 | 3.522 | ± 0.120 | us/op |
UserAgentParserBenchmark.macOsSafari | avgt | 5 | 3.126 | ± 0.022 | us/op |
UserAgentParserBenchmark.samsungGalaxyS8ChromeMobile | avgt | 5 | 5.375 | ± 0.102 | us/op |
UserAgentParserBenchmark.windows10Edge | avgt | 5 | 3.962 | ± 0.065 | us/op |
UserAgentParserBenchmark.windowsPhone | avgt | 5 | 9.555 | ± 0.190 | us/op |
FAQs
Fast and dependency-free Java 8 user agent analyzer
We found that com.github.codesorcery:juan demonstrated a not healthy version release cadence and project activity because the last version was released 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.