Skip to content

Instantly share code, notes, and snippets.

View clay584's full-sized avatar

clay584 clay584

  • USA
View GitHub Profile
<get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<filter>
<interfaces xmlns="http://openconfig.net/yang/interfaces">
<interface>
<config>
</config>
<name/>
</interface>
</interfaces>
</filter>
@clay584
clay584 / test_overlap.py
Created June 20, 2019 23:18
How to check overlapping IP networks
#!/usr/bin/env python3.6
from ipaddress import IPv4Network
list_a = [
'10.0.0.0/8',
'172.16.0.0/12',
'192.168.0.0/16'
]
#
# (c) 2019, Clay Curtis <[email protected]>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleError
from ansible.module_utils._text import to_bytes, to_native, to_text
from ansible.utils.display import Display
display = Display()
root@local-dev-box:/usr/share/kibana# bin/logstash --modules netflow --setup --log.level=debug
-bash: bin/logstash: No such file or directory
root@local-dev-box:/usr/share/kibana# cd ..
root@local-dev-box:/usr/share# cd logstash/
root@local-dev-box:/usr/share/logstash# bin/logstash --modules netflow --setup --log.level=debug
WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
Could not find log4j2 configuration at path /usr/share/logstash/config/log4j2.properties. Using default config which logs errors to the console
[DEBUG] 2018-10-09 10:28:34.440 [main] scaffold - Found module {:module_name=>"fb_apache", :directory=>"/usr/share/logstash/modules/fb_apache/configuration"}
[DEBUG] 2018-10-09 10:28:34.446 [main] registry - Adding plugin to the registry {:name=>"fb_apache", :type=>:modules, :class=>#<LogStash::Modules::Scaffold:0x95d80b1 @directory="/usr/share/logstash/modules/fb_apache/
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] starts_with "acme.com" && [string tolower[HTTP::path]] eq "/foo"} {
HTTP::header replace Host "newhost.acme.com"
HTTP::uri "/bar"
}
}
when HTTP_REQUEST {
# case sensitive
if { [HTTP::uri] contains "foo" } {
HTTP::respond 301 Location "https://[HTTP::host]/whatever"
}
# case insensitive
if { [string tolower [HTTP::uri]] contains "bar" } {
HTTP::respond 302 Location "https://[HTTP::host]/whatever"
}
@clay584
clay584 / xml.py
Created January 26, 2018 21:40
python xml crap
import jxmlease
with open('vuln.xml') as xml:
root = jxmlease.parse(xml)
root.prettyprint()
for item in root['solution']['ContainerBlockElement']['UnorderedList']['ListItem']:
print 'URL Link: {}'.format(item['Paragraph']['URLLink'].get_xml_attr('LinkURL'))
print 'URL Title: {}'.format(item['Paragraph']['URLLink'].get_xml_attr('LinkTitle'))
@clay584
clay584 / cisco_login.py
Created November 4, 2016 20:30
Cisco.com login using mechanize
#!/usr/bin/env python
import mechanize
def main():
br = mechanize.Browser()
br.addheaders = [('User-agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6')]
br.open("http://www.cisco.com/c/login/index.html?referer=/c/en/us/index.html")
br.select_form(name="login-form")
@clay584
clay584 / gist:da638ab1494d68a9eae0
Last active August 29, 2015 14:17
elasticsearch-template.json
{
"template" : "logstash-*",
"settings" : {
"index.refresh_interval" : "5s"
},
"mappings" : {
"_default_" : {
"_all" : {"enabled" : true},
"dynamic_templates" : [ {
"message_field" : {