Skip to content

Instantly share code, notes, and snippets.

View fnzv's full-sized avatar
🌐

Sami fnzv

🌐
View GitHub Profile
@fnzv
fnzv / scanner.py
Created February 2, 2018 23:15
scanner.py - collected from honeypot
#!/usr/bin/env python
import threading, paramiko, random, socket, time, sys
paramiko.util.log_to_file("/dev/null")
blacklist = [
'127'
]
passwords = [
@fnzv
fnzv / gist:22d508115a58006f68c1a5bd6a0fa9b3
Created February 20, 2018 09:08
Ansible-role-pure-ftpd
git clone https://github.com/gcoop-libre/ansible-role-pure-ftpd.git && cd ansible-role-pure-ftpd/ && echo '[ftpserver]' >> /etc/ansible/hosts && echo 'ftp ansible_ssh_host=127.0.0.1' >> /etc/ansible/hosts && ansible-playbook -i 127.0.0.1 playbook.yml
*filter
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -j ACCEPT
-A INPUT -p tcp --dport 80 -j ACCEPT
@fnzv
fnzv / haproxy.cfg
Created February 22, 2018 09:37 — forked from thisismitch/haproxy.cfg
Let's Encrypt Auto-Renewal script for HAProxy
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 2048
@fnzv
fnzv / install-something-template.yaml
Created February 25, 2018 11:12
install-something-template - Ansible
---
- name: Install something
hosts: localhost
user: root
# remote_user: user
# sudo: yes
roles:
- somerole1
- somerole2
@fnzv
fnzv / install-ftp.sh
Created February 26, 2018 11:58
Ansible working pureftp role
apt-get install -y ansible
ansible-galaxy install gcoop-libre.pure-ftpd
echo '- hosts: localhost
roles:
- gcoop-libre.pure-ftpd' > playbook.yml
ansible-playbook -i 127.0.0.1 playbook.yaml
@fnzv
fnzv / MSSQL_BACKUP_QUERY
Created March 8, 2018 11:44
MSSQL query to backup all databases on an external directory D:/Backup
DECLARE @name VARCHAR(50) -- database name
DECLARE @path VARCHAR(256) -- path for backup files
DECLARE @fileName VARCHAR(256) -- filename for backup
DECLARE @fileDate VARCHAR(20) -- used for file name
-- specify database backup directory
SET @path = 'D:\Backup\'
-- specify filename format
SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112)
@fnzv
fnzv / check_access.logs
Created March 9, 2018 09:58
Useful commands to parse access.log
# Sort access by Response Codes
awk -F\" '{print $2}' access.log | awk '{print $2}' | sort | uniq -c | sort -r
# Combined
awk '{print $9}' access.log | sort | uniq -c | sort
Example:
4 405
19 503
564 500
@fnzv
fnzv / check_ram
Created March 27, 2018 12:45
Check ram nagios
#!/bin/bash
if [ "$1" = "-w" ] && [ "$2" -gt "0" ] && [ "$3" = "-c" ] && [ "$4" -gt "0" ]; then
memTotal_b=`free -b |grep Mem |awk '{print $2}'`
@fnzv
fnzv / gen_data_es.sh
Created March 28, 2018 09:31
Generate random data on elasticsearch
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 | xargs -L1 -I {} curl -XPUT -H 'Content-Type: application/json' 'http://localhost:9201/twitter/tweet/{}' -d '{
"user" : "{}",
"post_date" : "2009-11-15T14:12:12",
"message" : "trying out Elastic {}"
}'