
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
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.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.