Skip to content

Instantly share code, notes, and snippets.

View doron2402's full-sized avatar

Doron Segal doron2402

View GitHub Profile
@doron2402
doron2402 / vectors.md
Created October 2, 2022 11:56 — forked from susam/vectors.md

Recon and Attack Vectors from My Logs

This document contains excerpts from my web server logs collected over a period of 7 years that shows various kinds of recon and attack vectors.

There were a total of 37.2 million lines of logs out of which 1.1 million unique HTTP requests (Method + URI) were found.

$ sed 's/^.* - - \[.*\] "\(.*\) HTTP\/.*" .*/\1/' access.log > requests.txt
@doron2402
doron2402 / opencv_deep_learning_vision_caffe.py
Created October 1, 2020 20:43
OpenCV Deep Learning Vision using Caffe
import numpy as np
import cv2
IMAGE_TO_PROCESS = 'image.png'
TXT_BASED_CLASSIFICATION = 'words.txt'
def get_txt_data(file):
rows = open(file).read().strip().split('\n')
return rows
img = cv2.imread(IMAGE_TO_PROCESS)
@doron2402
doron2402 / opencv_read_video.py
Created September 29, 2020 23:44
OpenCV2 read a video
import numpy as np
import cv2
video_file_path = '<link to video>'
video = cv2.VideoCapture(video_file_path)
# Check if video was opened
if video.isOpened() == False:
print(f'Cannot open video stream {video_file_path}')
@doron2402
doron2402 / opencv_image_reading.py
Last active September 29, 2020 23:40
OpenCV2 read image and show different colors
import numpy as np
import cv2
img = cv2.imread('./<LINK TO YOUR IMAGE>')
# [x, y, color]
# colors are [blue, green, red]
blue = img[:,:,0]
green = img[:,:,1]
red = img[:,:,2]
@doron2402
doron2402 / mongodb-s3-backup.sh
Created June 5, 2020 07:15 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh
@doron2402
doron2402 / go_channel_ex.go
Created April 8, 2020 06:51
Go Channel - Example
// Go channel example
package main
import (
"fmt"
"sync"
)
// send only function
func sendOnlyMessage(ch chan<- int, wg *sync.WaitGroup) {
@doron2402
doron2402 / go_routines_ex_02.go
Created April 7, 2020 16:20
Go routines example
package main
import (
"fmt"
"math/rand"
"time"
)
var rnd = rand.New(rand.NewSource(time.Now().UnixNano()))
@doron2402
doron2402 / ex_channel.go
Created April 7, 2020 07:51
Golang Concurrent - Go channels
package main
import (
"fmt"
"time"
)
func say(str string) {
time.Sleep(1 * time.Millisecond)
for i := 0; i < 10; i++ {
@doron2402
doron2402 / main.go
Last active April 7, 2020 05:41
Golang sync package - example
package main
/**
A cool way to find out if there are any race condition is using
`go run --race .`
**/
import (
"fmt"
"math/rand"
"sync"
"time"
@doron2402
doron2402 / ais.js
Created March 27, 2020 02:27
AIS gitst
var _ = require('underscore');
var colors = require('colors');
var sprintf = require('sprintf-js').sprintf;
/**
* used to decode AIS messages.
* Currently decodes types 1,2,3,4,5,9,18,19,21,24,27
* Currently does not decode 6,7,8,10,11,12,13,14,15,16,17,20,22,23,25,26
* Currently does not support the USCG Extended AIVDM messages
*