GrayLog使用HTTP JSONPath方式调用微步在线云API识别威胁IP

简介: GrayLog使用HTTP JSONPath方式调用微步在线云API识别威胁IP

640.png

需求:


针对GrayLog的安全告警日志中的一些攻击IP,经常需要手工去微步在线情报社区去查恶意IP,为了提高效率,探索是否可以对IP进行自动化关联查询

640.png

思路:


1、GrayLog的LookupTable有HTTP JSONPATH这种方式,可以研究一下怎么使用2、翻阅微步在线API接口文档以及一些常用的IP地址库接口API 3、结合GrayLog强大的可定制化的功能,探索是否可以实现想要的效果


解决过程与步骤:


1、微步在线API接口文档

640.png



640.png

640.png


2、curl命令测试

curl -v -X GET 'https://api.threatbook.cn/v3/scene/ip_reputation?apikey=API_KEY&resource=37.59.54.205'

640.png

yum install jq -y
curl  -X GET 'https://api.threatbook.cn/v3/scene/ip_reputation?apikey=API_KEY&resource=37.59.54.205'| jq 

640.png


3、GrayLog配置Lookup Tables

https://api.threatbook.cn/v3/scene/ip_reputation?apikey=API_KEY&resource=${key}


640.png

640.png

640.png


{
  "data": {
    "37.59.54.205": {
      "severity": "low",
      "judgments": [
        "Scanner",
        "IDC"
      ],
      "tags_classes": [],
      "basic": {
        "carrier": "OVH SAS",
        "location": {
          "country": "France",
          "province": "Ile-de-France",
          "city": "Paris",
          "lng": "2.345101",
          "lat": "48.848483",
          "country_code": "FR"
        }
      },
      "asn": {
        "rank": 2,
        "info": "OVH, FR",
        "number": 16276
      },
      "scene": "",
      "confidence_level": "low",
      "is_malicious": true,
      "update_time": "2020-11-25 09:11:44"
    }
  },
  "response_code": 0,
  "verbose_msg": "OK"
}

640.png


640.png


IPv4 归属地,经纬度查询可以使用如下API接口

接口地址:https://api.ipplus360.com/ip/geo/v1/city/
请求方式:HTTPS GET/POST
请求示例:https://api.ipplus360.com/ip/geo/v1/city/?key=您申请的key&ip=您需要查询的ip&coordsys=WGS84


640.png


640.png

最后针对以上API接口配置的LookupTable如下


640.png


4、可以针对有公网IP字段调用以上接口并将查询结果保存为日志


例如对Linux服务器暴力破解攻击IP为例例如将Linux服务器接入到GrayLog后,使用正则表达式提取器提取出暴力破解IP的ssh_login_failed_ip字段

Failed password for .* from(.+?)\s.?

640.png


然后使用LookupTable提取器,将IP经纬度结果转成字段

ip_geo_latitude Lookup Table
Trying to extract data from ssh_login_failed_ip into ssh_login_failed_ip_geo_latitude
ip_geo_longitude Lookup Table
Trying to extract data from ssh_login_failed_ip into ssh_login_failed_ip_geo_longitude

当然也可以调用IP威胁情报的LookupTable

ip_geo_longitude Lookup Table
Trying to extract data from ssh_login_failed_ip into ssh_login_failed_ip_geo_longitude

640.png



5、Pipeline配置


使用Pipeline拼接出经纬度地址位置字段


rule "GeoIP lookup: ssh_login_failed_ip"
when
  has_field("ssh_login_failed_ip_geo_latitude") and has_field("ssh_login_failed_ip_geo_longitude")
then
    let ip_geo_latitude = to_string($message.ssh_login_failed_ip_geo_latitude);
    let ip_geo_longitude = to_string($message.ssh_login_failed_ip_geo_longitude);
    let ip_location_temp1 =  concat(to_string(ip_geo_latitude),",");
    let ip_location_temp2 =  concat(ip_location_temp1, ip_geo_longitude);
    set_field("ssh_login_failed_ip_location", ip_location_temp2);
end

image.png


使用Pipeline配置生成IP威胁情报查询结果字段ssh_login_failed_ip_threatcheck_result640.png

ip_threatcheck_result
rule "IPThreatChecklookup: ssh_login_failed_ip"
when
  has_field("ssh_login_failed_ip")
then
    let ip_threatcheck_result = lookup("ipthreatcheck",to_string($message.ssh_login_failed_ip));
    debug (ip_threatcheck_result) ;
    set_field("ssh_login_failed_ip_threatcheck_result", ip_threatcheck_result);
end

8ce251d30be6810c61ddef75d5ba9b85.png

5a1f3b5698aabe96fdfca939ee099b82.png


6、配置DashBoard显示攻击IP的经纬度


最终的效果

38546c67f3619fb13518323ef8036a5f.png

9de5133dc4f7294e2ba4a7d6e51a5035.png

c799491cac3393f257f4bfd3314b7aa9.png


如上图所示:Zombie关键字搜索可以判定该攻击IP为僵尸傀儡机

地理位置为荷兰


Tips:


附上提取器的相关语法配置文件

{
  "extractors": [
    {
      "title": "ip_geo_latitude",
      "extractor_type": "lookup_table",
      "converters": [],
      "order": 1,
      "cursor_strategy": "copy",
      "source_field": "ssh_login_failed_ip",
      "target_field": "ssh_login_failed_ip_geo_latitude",
      "extractor_config": {
        "lookup_table_name": "ipplus360_lat"
      },
      "condition_type": "none",
      "condition_value": ""
    },
    {
      "title": "ip_geo_longitude",
      "extractor_type": "lookup_table",
      "converters": [],
      "order": 2,
      "cursor_strategy": "copy",
      "source_field": "ssh_login_failed_ip",
      "target_field": "ssh_login_failed_ip_geo_longitude",
      "extractor_config": {
        "lookup_table_name": "ipplus360_lng"
      },
      "condition_type": "none",
      "condition_value": ""
    },
    {
      "title": "ip_threatcheck",
      "extractor_type": "lookup_table",
      "converters": [],
      "order": 3,
      "cursor_strategy": "copy",
      "source_field": "ssh_login_failed_ip",
      "target_field": "ssh_login_failed_ip_threatcheck",
      "extractor_config": {
        "lookup_table_name": "ipthreatcheck"
      },
      "condition_type": "none",
      "condition_value": ""
    },
    {
      "title": "json_extractor",
      "extractor_type": "json",
      "converters": [],
      "order": 4,
      "cursor_strategy": "copy",
      "source_field": "ssh_login_failed_ip_threatcheck_result",
      "target_field": "",
      "extractor_config": {
        "flatten": false,
        "list_separator": ", ",
        "kv_separator": "=",
        "key_prefix": "ip_threatcheck_result_",
        "key_separator": "_",
        "replace_key_whitespace": false,
        "key_whitespace_replacement": "_"
      },
      "condition_type": "none",
      "condition_value": ""
    },
    {
      "title": "ssh_login_failed_ip_extractor",
      "extractor_type": "regex",
      "converters": [],
      "order": 0,
      "cursor_strategy": "copy",
      "source_field": "message",
      "target_field": "ssh_login_failed_ip",
      "extractor_config": {
        "regex_value": "Failed password for .* from(.+?)\\s.?"
      },
      "condition_type": "string",
      "condition_value": "Failed password "
    }
  ],
  "version": "4.2.10"
}

相关文章
|
1月前
|
缓存 监控 负载均衡
提升HTTP动态代理IP性能的最佳实践
在现代网络环境中,HTTP动态代理IP的优化配置至关重要。通过选择合适的代理类型(正向/反向代理)、配置缓存、使用负载均衡、加强安全配置(SSL/TLS加密、身份验证)、管理日志、性能监控、限制带宽、定期更新软件和优化用户体验(减少延迟、内容压缩),可以显著提升网络性能、安全性及用户满意度。根据具体需求灵活调整配置,实现最佳效果。
189 64
提升HTTP动态代理IP性能的最佳实践
|
8天前
|
数据采集 搜索推荐 API
短效HTTP代理IP的优点表现在哪些方面?
短效HTTP代理IP凭借其独特优势,在数字化时代备受青睐。它能满足多种业务场景,如广告推广、数据采集等,支持多个API参数,提供高效稳定的个性化定制服务。短效代理IP用量大、更换频繁,确保正常访问行为,提升业务执行效率。选择高质量的HTTP代理服务商,能保证更好的稳定性和请求速度,满足用户的核心需求。
40 4
|
7天前
探寻HTTP代理IP访问站点失败的背后因素
随着互联网发展,使用HTTP动态代理IP的人越来越多。但有时使用代理后仍无法访问站点,原因包括:1. IP失效;2. 网络质量差;3. 浏览器或程序设置错误;4. 需尝试其他代理商;5. 联系网站管理员;6. 不符合目标站点规范。选择高质量的代理服务商可提升访问成功率。
25 2
|
1月前
|
编解码 安全 网络安全
指纹浏览器中HTTP代理IP的重要性及使用原因
随着数字化发展,网络安全和隐私保护成为核心需求,指纹浏览器应运而生。它通过客户端信息唯一标识用户身份。搭配HTTP代理IP可增强安全性,具体表现为:1. 保护用户地址;2. 提高信息安全;3. 防止指纹检测;4. 增强网络安全。HTTP代理以其稳定性、安全性,在网络营销等领域发挥重要作用,二者结合为用户提供更强的隐私和安全保护。
100 34
|
10天前
|
数据采集 监控 安全
动态HTTP代理IP的使用案例与成功经验分享有哪些?
在信息化时代,网络不可或缺。动态HTTP代理IP广泛应用于网络爬虫、信息安全保护、安全访问站点和市场调研等领域。通过选择合适的代理服务、合理配置请求频率、监控IP状态、使用代理池及结合其他技术,用户可提升工作效率和数据安全性。
32 5
|
1月前
|
定位技术 数据安全/隐私保护
合适的HTTP代理IP关键考虑因素与实用建议
随着互联网发展,使用HTTP代理IP的需求日益增加。选择优质HTTP代理IP时需注意:1. 速度和稳定性;2. 用户信息保护;3. 地域性;4. 带宽上限;5. 支持的协议;6. 客户支持;7. 用户评价和信誉;8. 价格和性价比。确保选择可靠的代理服务,满足业务需求。
120 18
|
2月前
免费HTTP代理IP对业务稳定性的影响关键因素分析
随着互联网发展,使用代理IP的需求增加。免费代理IP虽便捷,但对业务稳定性有负面影响:1. 网络连接不稳定,易中断;2. 频繁更换IP影响业务连续性;3. 性能差,速度慢、响应延迟高;4. 服务质量低,缺乏技术支持且存在不受控的限制。因此,选择代理服务时需谨慎评估其对业务的影响。
87 13
|
2月前
|
数据采集 安全 搜索推荐
HTTP代理IP纯净度 提升用户网络体验的核心竞争力
随着互联网发展,使用HTTP动态代理IP的需求日益增加。高纯净度的代理IP在隐私与安全、网络体验和业务运营方面至关重要。它能保护用户信息、提高数据安全性、确保访问速度和连接稳定,并提升业务效率与信誉度。
62 2
|
2月前
|
负载均衡 监控 安全
HTTP代理IP的安全与稳定技术与策略的结合
随着科技与互联网的发展,企业对代理的需求日益增长。为加强HTTP代理IP的安全性和稳定性,可采取用户教育、使用加密协议、定期更换IP、监控可用性、设置访问控制、负载均衡、配置防火墙及定期更新维护等措施。这些方法能有效提升代理服务的安全性和可靠性。
76 7
|
3月前
|
安全 网络协议 应用服务中间件
内网ip申请SSL证书实现https访问
内网IP地址虽不能直接申请公网SSL证书,但可通过IP SSL证书保障数据安全。流程包括:确定固定内网IP,选择支持内网IP的CA,注册申请证书,生成CSR,验证IP所有权,下载部署证书至Web服务器,测试HTTPS访问,确保配置正确及证书有效。此方法适用于内网环境,提升数据传输安全性。
内网ip申请SSL证书实现https访问