DGA聚类 使用DBScan
2024-09-02 07:51:52
features = sc.parallelize(data_group[idx]).map(lambda x: (x.host_ip+'^'+x.domain, 1)).reduceByKey(operator.add).map(get_domain_features)
def get_domain_features(x):
host_url = x[0].split('^')
host = host_url[0]
url = host_url[1]
ext = tldextract.extract(url)
if ext.domain == "":
domain = ext.suffix
else:
domain = ".".join(ext[1:])
main_tag = domain.split('.')[0]
num = [i for i in main_tag if i.isdigit()]
alp = [i for i in main_tag if i.isalpha()]
return (host, (url, domain, main_tag), x[1], len(url), url.count('.') + 1, domain.count('.') + 1, len(main_tag), __Weight(main_tag), __Weight(num), __Weight(alp), main_tag.count('-'))
最新文章
- 【C#公共帮助类】 ToolsHelper帮助类
- [Cordova] Plugin里使用iOS Framework
- Mysql 数据库之修改标的结构
- wpf 空白汉字占位符
- Python成长笔记 - 基础篇 (三)python列表元组、字典、集合
- Oracle必须死之奇怪的ORA-06502错误
- ls 知识点
- powermockito “mock public 方法内部 Private方法的问题”
- Linux下的各种软件安装方法汇总
- Android中使用开源框架citypickerview实现省市区三级联动选择
- HTML表格表单综合——用户注册表
- 通过window.location.search获取页面url传递的参数
- Caused by: java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be ope
- 我发起了一个 用 C# 写 的 浏览器 开源项目 HtmlCore
- Django基础笔记
- Asp.Net Core中Json序列化处理整理
- awbeci—一个帮助你快速处理日常工作的网址收集网站
- [转]Gson的基本使用
- 2555: SubString[LCT+SAM]
- python练习笔记——计算1/1-1/3+1/5-1/7……的和