This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export { | |
| global g_rolling_conn_counter: int = 0; | |
| global probeid: int = 12345; | |
| } | |
| event new_connection(c: connection) &priority=20 | |
| { | |
| local uid_1 = fmt("%08x", to_int(strftime("%s", c$start_time))); | |
| local uid_2 = fmt("%08x", g_rolling_conn_counter); | |
| local uid_3 = fmt("%08x", probeid); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Header: | |
| // template <class T> std::string to_hex(T t, std::string prefix = "", bool pad = true, int8 custom_len = -1); | |
| #include <sstream> | |
| #include <string> | |
| #include <limits> | |
| template <class T> std::string to_hex(T t, std::string prefix, bool pad, int8 custom_len) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string> | |
| #include <sstream> | |
| #include <vector> | |
| std::vector<std::string> split_tokens(const std::string &s, char delim) { | |
| std::stringstream ss(s); | |
| std::string item; | |
| std::vector<std::string> tokens; | |
| while (getline(ss, item, delim)) { | |
| if(item.length() > 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export { | |
| redef Log::default_writer = Log::WRITER_TCPLOG; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def disable_ssl_cert_validation(func): | |
| def inner(*args, **kwargs): | |
| default_context = None | |
| ret = None | |
| try: | |
| default_context = ssl._create_default_https_context | |
| ssl._create_default_https_context = ssl._create_unverified_context | |
| ret = func(*args, **kwargs) | |
| finally: | |
| ssl._create_default_https_context = default_context |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def port_ping(host, port): | |
| ret = False | |
| sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| try: | |
| sock.connect((socket.gethostbyname(host), int(port))) | |
| sock.close() | |
| ret = True | |
| except socket.error: | |
| ret = False | |
| return ret |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Install epel | |
| sudo yum -y install epel-release | |
| # Install kernel headers for current kernel | |
| sudo yum install -y kernel-devel-$(uname -r) kernel-headers-$(uname -r) | |
| # Install ntop repos | |
| cat << EOF | sudo tee /etc/yum.repos.d/ntop.repo | |
| [ntop] | |
| name=ntop packages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def launch_memory_usage_server(host="127.0.0.1", port=8080): | |
| import cherrypy | |
| import dowser | |
| cherrypy.tree.mount(dowser.Root()) | |
| cherrypy.config.update({ | |
| 'environment': 'embedded', | |
| 'server.socket_host': host, | |
| 'server.socket_port': port | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import os | |
| import sys | |
| import time | |
| DEFAULT_LOG = "/bro/logs/current/conn.log" | |
| def config(): | |
| print """ | |
| graph_category network |